ai_agent.calculator.pkg package
Submodules
ai_agent.calculator.pkg.calculator module
Calculator class.
- class ai_agent.calculator.pkg.calculator.Calculator
Bases:
object
Calculator Class. currently only supports basic arithmatic expressions with standard order of operations.
- evaluate(expression: str) float | None
Evaluates expresion passed into the calculator.
Evaluates the entire expresion. only handels basic arithmatic. expresion must be space delimeted. ex: “1 + 2 / 4”. not “1+2/4”.
- Parameters:
expression (str) – expresion to evaluate
- Returns:
final value, None if expresion is malformated
- Return type:
float | None
ai_agent.calculator.pkg.render module
math expression renderer.
- ai_agent.calculator.pkg.render.render(expression: str, result: float | None) str
Redneres a box with the answer from the expression.
- Parameters:
expression – expression that was evalueated
result – final result of expression
- Returns:
ASCII box with expresion and result inside
- Return type:
str