calculator

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package calculator The Calculator Tool is a utility within the Atomic Agents ecosystem designed for performing a variety of mathematical calculations. It's essentially a wrapper around the sympy library to allow for expression-based calculations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExampleCalculator

func ExampleCalculator()

func Test

func Test(t *testing.T)

Types

type Calculator

type Calculator struct {
	tools.Config
}

func New

func New(opts ...tools.Option) *Calculator

func (*Calculator) Run

func (t *Calculator) Run(ctx context.Context, input *Input) (*Output, error)

Executes the CalculatorTool with the given parameters.

type Input

type Input struct {
	schema.Base
	// Expression Mathematical expression to evaluate. For example, '2 + 2'.
	Expression string `` /* 128-byte string literal not displayed */
	// Params represents expressions's parameters
	Params map[string]interface{} `json:"params,omitempty" jsonschema:"title=params,description=Parameters for the expression."`
}

Input Tool for performing calculations. Supports basic arithmetic operations like addition, subtraction, multiplication, and division, as well as more complex operations like exponentiation and trigonometric functions. Use this tool to evaluate mathematical expressions.

func NewInput

func NewInput(exp string, params map[string]interface{}) *Input

func (Input) String

func (s Input) String() string

type Output

type Output struct {
	schema.Base
	// Result Result of the calculation
	Result interface{} `json:"result,omitempty" jsonschema:"title=result,description=Result of the calculation."`
}

Output Schema for the output of the CalculatorTool

func NewOutput

func NewOutput(result interface{}) *Output

func (Output) String

func (s Output) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL