Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãORetrievalChainsMemoryAgentsAgent TypesHow-toToolsDefining Custom ToolsHuman-in-the-loop Tool ValidationMulti-Input ToolsTool Input SchemaTools as OpenAI FunctionsToolkitsCallbacksModulesSecurityGuidesMoreModulesAgentsToolsMulti-Input ToolsOn this pageMulti-Input ToolsThis notebook shows how to use a tool that requires multiple inputs with an agent. The recommended way to do so is with the StructuredTool class.import osos.environ["LANGCHAIN_TRACING"] = "true"from langchain.llms import OpenAIfrom langchain.agents import initialize_agent, AgentTypellm = OpenAI(temperature=0)from langchain.tools import StructuredTooldef multiplier(a: float, b: float) -> float:    """Multiply the provided floats."""    return a * btool = StructuredTool.from_function(multiplier)# Structured tools are compatible with the STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION agent type.agent_executor = initialize_agent(    [tool],    llm,    agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,    verbose=True,)agent_executor.run("What is 3 times 4")            > Entering new AgentExecutor chain...        Thought: I need to multiply 3 and 4    Action:    ```    {      "action": "multiplier",      "action_input": {"a": 3, "b": 4}    }    ```        Observation: 12    Thought: I know what to respond    Action:    ```    {      "action": "Final Answer",      "action_input": "3 times 4 is 12"    }    ```        > Finished chain.    '3 times 4 is 12'Multi-Input Tools with a string format‚ÄãAn alternative to the structured tool would be to use the regular Tool class and accept a single string. The tool would then have to handle the parsing logic to extract the relevant values from the text, which tightly couples the
This notebook shows how to use a tool that requires multiple inputs with an agent. The recommended way to do so is with the StructuredTool class.
This notebook shows how to use a tool that requires multiple inputs with an agent. The recommended way to do so is with the StructuredTool class. ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãORetrievalChainsMemoryAgentsAgent TypesHow-toToolsDefining Custom ToolsHuman-in-the-loop Tool ValidationMulti-Input ToolsTool Input SchemaTools as OpenAI FunctionsToolkitsCallbacksModulesSecurityGuidesMoreModulesAgentsToolsMulti-Input ToolsOn this pageMulti-Input ToolsThis notebook shows how to use a tool that requires multiple inputs with an agent. The recommended way to do so is with the StructuredTool class.import osos.environ["LANGCHAIN_TRACING"] = "true"from langchain.llms import OpenAIfrom langchain.agents import initialize_agent, AgentTypellm = OpenAI(temperature=0)from langchain.tools import StructuredTooldef multiplier(a: float, b: float) -> float:    """Multiply the provided floats."""    return a * btool = StructuredTool.from_function(multiplier)# Structured tools are compatible with the STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION agent type.agent_executor = initialize_agent(    [tool],    llm,    agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,    verbose=True,)agent_executor.run("What is 3 times 4")            > Entering new AgentExecutor chain...        Thought: I need to multiply 3 and 4    Action:    ```    {      "action": "multiplier",      "action_input": {"a": 3, "b": 4}    }    ```        Observation: 12    Thought: I know what to respond    Action:    ```    {      "action": "Final Answer",      "action_input": "3 times 4 is 12"    }    ```        > Finished chain.    '3 times 4 is 12'Multi-Input Tools with a string format‚ÄãAn alternative to the structured tool would be to use the regular Tool class and accept a single string. The tool would then have to handle the parsing logic to extract the relevant values from the text, which tightly couples the