Langchain basetool. Args schema should be either: A subclass of pydantic.


Tea Makers / Tea Factory Officers


Langchain basetool. 🏃. It is built on the Runnable protocol. How to: chain runnables How to: stream runnables How to: invoke runnables in parallel How to: add default invocation args to runnables How Nov 8, 2024 · 在 LangChain 中, Tools 是大语言模型可以调用的各种外部函数、API、库或服务。 大语言模型在执行任务时可以调用这些工具来执行特定的任务,比如查找信息、运行代码、调用搜索引擎、发送HTTP请求、与外部API交互等。 *args – Extra positional arguments. manager import ( AsyncCallbackManagerForToolRun, CallbackManagerForToolRun, ) Dec 9, 2024 · langchain_core. Class hierarchy: ToolMetaclass --> BaseTool --> <name>Tool # Examples: AIPluginTool, BaseGraphQLTool <name> # Examples: BraveSearch, HumanInputRun Main helpers: CallbackManagerForToolRun, AsyncCallbackManagerForToolRun Classes Jun 20, 2023 · 要使用Tools,首先需要定义所需的工具。工具是代理程序与外部世界交互的方式。您可以定义自己的工具,也可以使用现有的工具。 定义自定义工具的方法有两种: 使用Tool数据类:您可以使用Tool数据类来创建一个新的工具。工具由名称、描述、函数和其他组件组成。 from langchain. Nov 30, 2023 · To define a custom tool in LangChain, you can use the Tool. BaseTool ¶ Note BaseTool implements the standard Runnable Interface. """ create_tool_calling_agent # langchain. Jun 14, 2024 · 您还可以通过将自定义工具子类化为BaseTool类来明确定义自定义工具。 这提供了对工具定义的最大控制,但需要更多的工作。 May 20, 2024 · from langchain. This method helps define and communicate input schemas to the model, similar to how get_format_instructions works for output schemas. BaseModel. In this notebook we will show how those parameters map to the LangGraph react agent executor using the create_react_agent prebuilt helper method. language_models import BaseLanguageModel from langchain_core. But you can define custom descriptions for each input easily. [docs] def tool( name_or_callable: Optional[Union[str, Callable]] = None, runnable: Optional[Runnable] = None, *args: Any, description: Optional[str] = None, return_direct: bool = False, args_schema: Optional[ArgsSchema] = None, infer_schema: bool = True, response_format: Literal["content", "content_and_artifact"] = "content", parse_docstring: bool = False, error_on_invalid_docstring: bool . # Construct the agent. AgentAction, str from langchain. language_models. agents ChatOpenAI 来自 langchain. Tools are components that can be called by agents to perform specific actions. Toolkits are collections of tools that agents can use. Raises [ValidationError] [pydantic_core Aug 3, 2024 · from langchain. load_tools(tool_names: List[str], llm: BaseLanguageModel | None = None, callbacks: List[BaseCallbackHandler] | BaseCallbackManager | None = None, allow_dangerous_tools: bool = False, **kwargs: Any) → List[BaseTool] [source] # Load tools based on their name. BaseToolkit [source] ¶ Bases: BaseModel, ABC Base Toolkit representing a collection of related tools. create_tool_calling_agent(llm: ~langchain_core. abstract get_tools() → List[BaseTool] [source] # Tool # class langchain_core. messages import BaseMessage from langchain_core. These updates require langchain-core>=0. BaseToolkit [source] # Bases: BaseModel, ABC Base Toolkit representing a collection of related tools. agents import initialize_agent, AgentType from langchain. LangChain supports the creation of tools from: Functions; LangChain Runnables; By sub-classing from BaseTool -- This is the most flexible method, it provides the largest degree of control, at the expense of more effort and code. A toolkit is a collection of related tools that can be used together to accomplish a specific task or work with a particular system. class langchain_core. Jul 5, 2025 · This utility function initializes all specified MCP servers in parallel, and returns LangChain Tools (tools: list[BaseTool]) by gathering available MCP tools from the servers, and by wrapping them into LangChain tools. tool(*args: str | Callable | Runnable, return_direct: bool = False, args_schema: Type | None = None, infer_schema: bool = True, response_format: Literal['content', 'content_and_artifact'] = 'content', parse_docstring: bool = False, error_on_invalid_docstring: bool = True) → Callable [source] # Make tools out of functions, can be used with or without Apr 8, 2024 · For more information on how to create and use tools in LangChain, you can refer to the LangChain Tools documentation and the source code for the BaseTool class. LangChain agents (the AgentExecutor in particular) have multiple configuration parameters. For example, the tool logic may require using the ID of the user who made the request. WikipediaQueryRun # class langchain_community. tools import BaseTool from pydantic import SecretStr from langchain_tests. No third-party integrations are Nov 26, 2024 · Subclassing BaseTool To create a personalized tool, inherit from BaseTool and define the necessary attributes, including the args_schema for input validation, and the _run method. agents. language_models import LanguageModelInput from typing import Sequence, Union, Dict, Any LangChain supports the creation of tools from: Functions; LangChain Runnables; By sub-classing from BaseTool -- This is the most flexible method, it provides the largest degree of control, at the expense of more effort and code. When defining the JSON schema of the arguments, it is important that the inputs remain the same as the function, so you shouldn't change that. Tool [source] ¶ Bases: BaseTool Tool that takes in function or coroutine directly. If a dictionary is passed in, it is assumed to already be a valid OpenAI function, a JSON schema with top-level ‘title’ key specified, an Anthropic format tool, or an Amazon Bedrock Converse Customizing Default Tools We can also modify the built in name, description, and JSON schema of the arguments. base import BaseStandardTests class ToolsTests(BaseStandardTests): """:private: Base class for testing tools. tools import BaseTool from langchain_core. BaseToolkit ¶ class langchain_community. convert. , specification Aug 14, 2024 · class langchain_core. Class hierarchy: Nov 21, 2023 · Using Subclass BaseTool Another approach for creating the structured tools is subclassing the BaseTool after importing the class CallBack and AsyncCallBack managers from LangChain: from typing import Optional, Type from langchain. Must be empty. 🏃 The Runnable Interface has additional methods that are available on runnables, such as with_types, with_retry, assign, bind, get_graph, and more. tools import BaseTool class GetIncidentsByUserTool (BaseTool): args_schema = UserInfoSchema # Use the Pydantic model def _run (self, userinfo, *args, **kwargs): # Implementation using userinfo pass 在这里,我们使用 LangChain 的 BaseTool 对象初始化了自定义的 CircumferenceTool 类。 我们可以将 BaseTool 视为 LangChain 工具的必要模板。 LangChain 要求工具具有两个属性,即 name 和 description 参数。 description 是工具的 自然语言 描述,LLM 根据它来决定是否需要使用该工具。 Mar 26, 2025 · LangChain提供了三种创建工具的方式: 使用@tool装饰器 ——定义自定义工具的最简单方式 使用StructuredTool. BaseToolkit ¶ class langchain_core. Most of the time, such values should not be controlled by the LLM. jsAbstract base class for toolkits in LangChain. return_direct – Whether to return directly from the tool rather than continuing the agent loop. If more configuration is needed-- e. agents import AgentAction from langchain_core. Tool ¶ class langchain. Subclassing the BaseTool class provides more control over the tool’s behaviour and defines custom instance variables or propagates callbacks. BaseLanguageModel, tools: ~typing. Class hierarchy: Oct 16, 2024 · LangChainでは、 @tool デコレーターなどで定義した関数を一度 BaseTool に変換し、その後、OpenAIやAnthropicなど各LLMモデル用のパラメータへと変換しています。 (@toolデコレーター => BaseTool => モデルのパラメタ) 関数名 -> name 関数の説明 -> description tools # Tools are classes that an Agent uses to interact with the world. LangChain Expression Language is a way to create arbitrary custom chains. tools import BaseTool, StructuredTool, tool tools # Tools are classes that an Agent uses to interact with the world. langchain: this package includes all advanced feature of an LLM invocation that can be used to implement a LLM app: memory, document retrieval, and agents. Create a new model by parsing and validating input data from keyword arguments. prompts. tools import BaseTool from langchain. May 7, 2024 · This tells your tool to expect and validate userinfo according to the schema defined. from langchain_core. agents import Tool tools Apr 30, 2024 · langchain提供了多种方式定义工具,本文将针对以下两个函数介绍定义工具的方法: 总是返回字符串"LangChain"的虚构搜索函数 将两个数字相乘的乘法函数 这两个函数最大的区别是,第一个函数只有一个输入,第二个函数需要多个输入。 Checked other resources I added a very descriptive title to this question. The Tool. tools StructuredTool 来自 langchain. First, we show how to create completely new tools from scratch. agents initialize_agent 来自 langchain. How can I change this code so that it doesn't throw an error? Code: from langchain. infer_schema – Whether to infer the schema of the arguments from the function’s signature. _parse_input discards any parameter that I pass to the tool. This abstract class defines the interface that all LangChain tools must implement. This also makes the resultant tool accept a import os from abc import abstractmethod from typing import Union from unittest import mock import pytest from langchain_core. It wraps any function you provide to let an agent easily interface with it. from typing import Type from crewai. from_function 类方法 —— 这类似于 @tool 装饰器,但允许更多配置和同步和异步实现的规范。 通过子类BaseTool —— 这是最灵活的方法,它提供了最大程度的控制,但需要更多的工作量和代码。 @tool Oct 28, 2023 · This BaseTool class is the base for all LangChain tools to inherit from, including the tools we used in the previous part. This can enhance type safety, improve code readability, and simplify the integration of tools and chat models. tool (Union[dict[str, Any], type[BaseModel], Callable, BaseTool]) – Either a dictionary, a pydantic. Aug 14, 2024 · class langchain_core. from_function () method lets you quickly create a tool from a simple function. 2k次,点赞10次,收藏19次。本文介绍了如何使用装饰器定义工具、继承BaseTool类以及StructuredTool类在构建智能体时提供功能,包括设置工具名称、描述和参数验证。通过谷歌搜索工具实例展示了这些方法的应用。 Oct 15, 2023 · カスタムリソースの定義部 サンプル例では円の半径(r)から円周 (2πr)を計算するためのツール(CircumferenceTool)を作成する。BaseToolを継承して作成する。 Apr 28, 2025 · 在LangChain项目中,开发者经常需要创建自定义工具类来扩展功能。当继承BaseTool类时,可能会遇到类型检查器对args_schema属性的警告问题。本文将深入分析这一问题,并提供专业解决方案。 ## 问题背景 在LangChain框架中,BaseTool是所有工具类的基类。开发者通过继 Semantic layer over graph database You can use database queries to retrieve information from a graph database like Neo4j. simple. If a dictionary is passed in, it is assumed to already be a valid OpenAI tool, OpenAI function, or a JSON schema with top-level ‘title’ and ‘description’ keys specified. tools import BaseTool BaseToolkit # class langchain_core. BaseTool ¶ class langchain_core. One option is to use LLMs to generate Cypher statements. agent_toolkits. # Import things that are needed generically from langchain. BaseTool [source] # Bases: RunnableSerializable [Union [str, Dict, ToolCall], Any] Interface LangChain tools must implement. tools import BaseTool from Apr 15, 2024 · 文章浏览阅读6. g. BaseModel 的子类。 或 - pydantic. LangChain 支持从以下内容创建工具: 函数; LangChain 运行接口; 通过从 BaseTool 子类化 -- 这是最灵活的方法,它提供了最大的控制程度,但需要更多的努力和代码。 从函数创建工具可能足以满足大多数用例,可以通过简单的 @tool 装饰器 来完成。如果需要更多配置,例如同时指定同步和异步实现,也可以 InjectedToolArg # class langchain_core. BaseTool 源码分析BaseTool 是 LangChain 框架中定义 tools 的模板类 核心属性name:表示 tool 唯一名称的字符串(用于识别) description:对如何 / 何时 / 为何使用该 tool 的描述,帮助模型决定什么时候调用该 … Feb 8, 2024 · However if I don't include it in the input model, the method langchain_core. Tool dataclass The 'Tool' dataclass wraps functions Aug 14, 2024 · class langchain_core. BaseModel class, Python function, or BaseTool. from_function () method or subclass the BaseTool class. A key feature of LangChain is the ability to create custom tools that integrate seamlessly with your AI models, enabling enhanced capabilities tailored to your specific use case. I used the GitHub search to find a similar question and load_tools # langchain_community. langchain_core. param args_schema: Optional[Type[BaseModel]] = None ¶ Pydantic model class to validate and parse the tool’s input arguments. Here we initialized our custom CircumferenceTool class using the BaseTool object from LangChain. tools import BaseTool from pydantic import BaseModel, Field class MyToolInput(BaseModel): """Input schema for MyCustomTool. chat_models import BaseChatModel from langchain_core. tools import BaseTool, StructuredTool, tool: BaseTool: This is a base class for tools in LangChain, which provides foundational functionalities for creating custom tools. One way is to use the StructuredTool class, which allows you to define a tool that takes structured arguments. function_calling import convert_to_openai_tool from langchain_core. BaseToolkit [source] # Bases: BaseModel, ABC Base class for toolkits containing related tools. runnables import Runnable, RunnablePassthrough from langchain_core. BaseTool. Initialize the tool. load_tools. prompts import ChatPromptTemplate from langchain_ollama. These tools provide access to various resources and services like APIs, databases, file systems, etc. invoke () takes from 2 to 3 positional arguments but 4 were given #23533 May 17, 2025 · langchain_core. We can think of the BaseTool as the required template for a LangChain tool. tool. Secondly, the model needs to return tool arguments that are valid. chat import ChatPromptTemplate from langchain_core. tools. Tools langchain. param callback_manager: Optional[BaseCallbackManager] = None ¶ Jun 19, 2024 · However, LangChain provides other ways to build custom tools that can handle more complex objects as inputs and outputs. tools 初始化用于代理程序的LLM。 tools # Tools are classes that an Agent uses to interact with the world. tools import BaseTool class My You may need to bind values to a tool that are only known at runtime. Sep 9, 2024 · langchain-core: contains the essential LangChain abstractions and the code base for using the new LangChain Expression Language. openai_tools Aug 5, 2024 · LangChain入門 (6) – Tool/Agent - 外部世界への橋渡し 16 例えば、検索結果を処理する場合、検索した内容が意図したものでない場合は繰り返し処理が必要になりことがあります。 Documentation for LangChain. Each tool has a description. tools 模块为 LangChain 提供了定义和管理工具的强大功能,通过基类(如 BaseTool)、工具实现(如 StructuredTool)和实用函数(如 @tool),支持开发者创建自定义工具并集成到复杂应用程序中。 Jun 14, 2024 · To properly provide the input schema to the model in LangChain, you can use the get_input_schema method from the BaseTool class. format_scratchpad. chat_models import ChatOpenAI from langchain. chat. Jun 26, 2024 · Langchain Tools: TypeError: BaseTool. Nov 2, 2024 · The tool is expecting an argument, but I haven't provided one. BaseTool], prompt: ~langchain_core. May 17, 2025 · BaseTool 是 LangChain 框架中的抽象基类,用于创建语言模型(尤其在基于代理的系统中)可调用的工具。 它提供标准接口,支持输入验证、错误处理、工件输出及与 LangChain 可运行对象的集成。 开发者通过子类化 BaseTool 定义自定义工具,指定工具名称、描述、输入模式和执行逻辑。 BaseTool 继承自 RunnableSerializable[Union[str, dict, ToolCall], Any],支持序列化并与 LangChain 的可运行对象生态系统无缝集成。 它是工具定义的基础,广泛用于代理系统、LangGraph 工作流和自定义链。 前文讨论的 @tool 装饰器通过将 Python 函数转换为 BaseTool 实例简化工具创建。 BaseTool implements the standard Runnable Interface. Subclasses must implement the tools property to provide the specific tools for the toolkit. or - A subclass of pydantic. In fact, allowing the LLM to control the user ID may lead to a security risk. We will use the default agent type here. How should I do it? Jun 11, 2024 · LangChain internally uses Pydantic v1, and mixing v1 and v2 primitives can raise cryptic errors. Using a model to invoke a tool has some obvious potential failure modes. abc import Sequence from typing import Callable from langchain_core. pydantic_v1 import BaseModel, Field from langchain. function_calling import convert_to_openai_tool from langchain. Examples using InjectedToolArg How to pass run time values to tools Jan 2, 2025 · Image by author using Chatgpt L angChain has emerged as one of the most powerful frameworks for building AI-driven applications, providing modular and extensible components to streamline complex workflows. strict (Optional[bool]) – If True, model output is Oct 24, 2024 · LangChain提供了多种方法来创建工具,通过这些工具,您可以大幅提升模型与代理的功能性和灵活性。 本指南将介绍如何在LangChain中创建工具,并包含实用的代码示例和潜在的挑战解决方案。 ## 主要内容 ### 1. ChatPromptTemplate, *, message_formatter: ~typing. A number of chat models also support accepting Pydantic v2 models in bind_tools and with_structured_output (including Anthropic, OpenAI, Fireworks, and Mistral). The universal invocation protocol (Runnables) along with a syntax for combining components (LangChain Expression Language) are also defined here. , specification from collections. langchain. tools import BaseTool, StructuredTool, tool # Define the input arguments' schema using Pydantic class MultiplySchema(BaseModel): langchain_core. The interfaces for core components like chat models, LLMs, vector stores, retrievers, and more are defined here. Base class for all LangChain tools. tools Tool 来自 langchain. Defaults to None. Agent uses the description to choose the right tool for the job. Tools allow agents to interact with various resources and services like APIs LLM based applications often involve a lot of I/O-bound operations, such as making API calls to language models, databases, or other services. args_schema – optional argument schema for user to specify. Tuple [~langchain_core. runnables import Runnable from langchain_core. wikipedia. StructuredTool [source] ¶ Bases: BaseTool Tool that can operate on any number of inputs. tools tool 来自 langchain. Add any additional Apr 16, 2024 · Checked other resources I added a very descriptive title to this question. BaseTool # class langchain_core. Class hierarchy: # Import things that are needed generically from langchain import LLMMathChain, SerpAPIWrapper from langchain. Here is an example of how to correctly define your Pydantic-based tool: Correct Usage with Pydantic v1: Jul 30, 2024 · LangChain APIs now allow using Pydantic v2 models for BaseTool and StructuredTool. Callable [ [~typing. param args_schema: Type[BaseModel] [Required] ¶ The input arguments’ schema. May 2, 2023 · Structured tool’s enable more complex, multi-faceted interactions between language models and tools, making it easier to build innovative, adaptable, and powerful applications. llms import Here we focus on how to move from legacy LangChain agents to more flexible LangGraph agents. Sequence [~typing. Args schema should be either: A subclass of pydantic. utils. Why is that? from langchain_core. 在LangChain中构建自定义工具时,如果您想要更细致地掌控工具的行为,并定义一些特殊的属性或者处理函数,可以考虑从BaseTool类进行派生。 Aug 22, 2023 · I want to create a custom tool class with an additional property, let's say number. The model may try to call a tool that doesn't exist or fail to return arguments that match the requested schema. callbacks. tools import BaseTool from langchain_core. BaseTool ¶ class langchain. langchain-core: 0. LCEL cheatsheet: For a quick overview of how to use the main LCEL primitives. Strategies like keeping schemas simple, reducing the number of tools you pass at once, and having good names and descriptions can help mitigate this risk, but aren't foolproof. Firstly, the model needs to return a output that can be parsed at all. base. Raises ValidationError if the input data cannot be parsed to form a valid model. Creating tools from functions may be sufficient for most use cases, and can be done via a simple @tool decorator. Sequence [~langchain_core. Tool arguments annotated with this class are not included in the tool schema sent to language models and are instead injected during execution. Here is a step-by-step guide: Define the input schema using Pydantic 's BaseModel. BaseModel 的子类(如果 Aug 27, 2024 · 创建工具,继承BaseTool并且传递了BaseTool中不包含的参数To create a tool by inheriting from BaseTool and passing parameters not included in BaseTool, you can follow the example provided in the LangChain documentation. BaseTool implements the standard Runnable Interface. Tool # class langchain_core. v1. BaseTool(*, name: str, description: str, args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict Completely New Tools - String Input and Output The simplest tools accept a single query string and return a string output. llms import OllamaLLM from langchain_ollama. tool_calling_agent. 2. Parameters: tool (Union[Dict[str, Any], Type[BaseModel], Callable, BaseTool]) – Either a dictionary, a pydantic. language_models. BaseTool [source] ¶ Bases: RunnableSerializable [Union [str, Dict], Any] Interface LangChain tools must implement. Instead of generating Cypher statements, we can implement Cypher templates as langchain_community. chat_models BaseTool 来自 langchain. I searched the LangChain documentation with the integrated search. Defaults to False. Tool(name: str, func: Callable, description: str, *, args_schema: Optional[Type[BaseModel]] = None, return LangChain 支持从以下对象创建工具 函数; LangChain Runnables; 通过从 BaseTool 子类化 -- 这是最灵活的方法,它提供了最大的控制程度,但代价是需要付出更多的努力和编写更多的代码。 从函数创建工具可能足以满足大多数用例,并且可以通过简单的 @tool 装饰器 完成。如果需要更多配置——例如,同时 LangChain 还有其他几种创建工具的方式;例如,通过子类化 BaseTool 类或使用 StructuredTool。 这些方法在 如何创建自定义工具指南 中有所展示,但我们通常建议在大多数情况下使用 @tool 装饰器。 Creating from BaseTool class If you want to create a BaseTool object directly, instead of decorating a function with @tool, you can do so like this: tool # langchain_core. Asynchronous programming (or async programming) is a paradigm that allows a program to perform multiple tasks concurrently without blocking the execution of other tasks, improving efficiency and responsiveness, particularly in I/O-bound operations. LangChain工具的基本组件 每个工具由以下几个属性组成: LangChain のエージェントについて概要を解説します。 Calling tools with an LLM is generally more reliable than pure prompting, but it isn't perfect. These methods are shown in the how to create custom tools guide, but we generally recommend using the @tool decorator for most cases. If your tool function requires multiple arguments, you might want to skip down to the StructuredTool section below. c Nov 21, 2023 · 🤖 To validate the input arguments in the LangChain framework and return a warning to the llm agent without breaking the LangChain flow, you can modify the validate_inputs method in the SmartLLMChain class. v1 LangChain has a few other ways to create tools; e. BaseTool [source] ¶ Bases: RunnableSerializable [Union [str, Dict, ToolCall], Any] Interface LangChain tools must implement. Nov 9, 2023 · In the LangChain framework, tools are defined as Python functions that return an instance of a class derived from BaseTool. The tool schema. utils. Apr 10, 2024 · The bottom up way to create a Tool in LangChain would be to extend the BaseTool class, set the name and description fields on the class, and implement the _run method. Initialize tool. There are two ways to do this: either by using the Tool dataclass, or by subclassing the BaseTool class. API参考: AgentType 来自 langchain. agents import AgentType, Tool, initialize_agent, tool from langchain. Instead, the LLM should only control the parameters of the tool that are meant to be Jul 8, 2025 · Aprende a usar BaseTool en LangChain para crear herramientas personalizadas con estado y manejo robusto de errores. Create a custom tool class by subclassing BaseTool. Ensure that both LangChain and your tool definitions use Pydantic v1. While that option provides excellent flexibility, the solution could be brittle and not consistently generating precise Cypher statements. InjectedToolArg [source] # Annotation for tool arguments that are injected at runtime. BaseTool [source] ¶ 基类: RunnableSerializable [Union [str, Dict, ToolCall], Any] LangChain 工具必须实现的接口。 初始化工具。 param args_schema: Optional[Type[BaseModel]] = None ¶ Pydantic 模型类,用于验证和解析工具的输入参数。 Args schema 应该是 pydantic. WikipediaQueryRun [source] # Bases: BaseTool Tool that searches the Wikipedia API. manager import CallbackManagerForToolRun, AsyncCallbackManagerForToolRun from typing import Optional, Type, Callable from pydantic import Field import requests import json # APIキーをセット (変数名はLangChain側で決められています) from langchain. , by sub-classing the BaseTool class or by using StructuredTool. This time we’ll build our own tools based on this BaseTool class. Dec 9, 2024 · from typing import Optional, Sequence from langchain_core. 39 # langchain-core defines the base abstractions for the LangChain ecosystem. LangChain 工具—— BaseTool 的实例——是具有额外约束的 可运行对象,使其能够被语言模型有效调用: 它们的输入被限制为可序列化,特别是字符串和 Python dict 对象; 它们包含名称和描述,指示如何以及何时使用; 它们可能包含详细的 args_schema 以定义其参数。 Sep 6, 2024 · from langchain_core. What is a “Structured Tool”? A structured tool represents an action an agent can take. I used the GitHub search to find a similar question and Apr 10, 2024 · The bottom up way to create a Tool in LangChain would be to extend the BaseTool class, set the name and description fields on the class, and implement the _run method. This guide [docs] classBaseTool(RunnableSerializable[Union[str,dict,ToolCall],Any]):"""Base class for all LangChain tools. Tool [source] # Bases: BaseTool Tool that takes in function or coroutine directly. Migration guide: For migrating legacy chain abstractions to LCEL. uuchmeu jwyqi qgngcc xjndd ajnh miqe jihthd eqb otugf mfgb