Skip to content
Discussion options

You must be logged in to vote

Yes, LangChain provides pre-built tools for handling basic calculations like addition and multiplication. You can use the @tool decorator to create tools for these operations. For example, the multiply tool is defined as follows:

from langchain_core.tools import tool

@tool
def multiply(first_int: int, second_int: int) -> int:
    """Multiply two integers together."""
    return first_int * second_int

Similarly, an add tool is defined for addition:

@tool
def add(first_int: int, second_int: int) -> int:
    "Add two integers."
    return first_int + second_int

These tools can be used in chains or agents to perform calculations as part of a larger workflow. Additionally, LangChain supports…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mraguth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant