The Calculator class is a tool used to evaluate mathematical expressions. It extends the base Tool class.

import { Calculator } from "@langchain/community/tools/calculator";

const calculator = new Calculator();
const sum = await calculator.invoke("99 + 99");
console.log("The sum of 99 and 99 is:", sum);
// The sum of 99 and 99 is: 198

Hierarchy (view full)

Constructors

Properties

Constructors

Properties

description: string = ...
name: string = "calculator"