langchain.js
    Preparing search index...

    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 Summary)

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

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

    Accessors

    • get lc_namespace(): any[]

      Returns any[]

    Methods

    • Returns string