calculator

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2025 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

This section is empty.

Types

type Input

type Input struct {
	schema.Base
	// Expression Mathematical expression to evaluate. For example, '2 + 2'.
	Expression string `json:"expression" jsonschema:"title=expression,description=Mathematical expression to evaluate. For example, '2 + 2'."`
	// 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

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

type Tool added in v1.0.1

type Tool struct {
	tools.Config
}

func New

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

func (*Tool) Run added in v1.0.1

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

Executes the CalculatorTool with the given parameters.

func (*Tool) RunAnonymous added in v1.0.8

func (t *Tool) RunAnonymous(ctx context.Context, input any) (any, error)

RunAnonymous run tool for tools ochestration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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