docs: updated args_schema to be required when using callback handlers in custom tools. (#25887)

- **Description:** if you use callback handlers when using tool,
run_manager will be added to input, so you need to explicitly specify
args_schema, but i was confused because it was not listed, so i added
it. Also, it seems that the type does not work with pydantic.BaseModel.
- **Issue:** None
- **Dependencies:** None
This commit is contained in:
k.muto 2024-08-31 01:04:40 +09:00 committed by GitHub
parent 6377185291
commit 5bb810c5c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,12 +9,12 @@
"\n",
"When constructing an agent, you will need to provide it with a list of `Tool`s that it can use. Besides the actual function that is called, the Tool consists of several components:\n",
"\n",
"| Attribute | Type | Description |\n",
"|-----------------|---------------------------|------------------------------------------------------------------------------------------------------------------|\n",
"| name | str | Must be unique within a set of tools provided to an LLM or agent. |\n",
"| description | str | Describes what the tool does. Used as context by the LLM or agent. |\n",
"| args_schema | Pydantic BaseModel | Optional but recommended, can be used to provide more information (e.g., few-shot examples) or validation for expected parameters |\n",
"| return_direct | boolean | Only relevant for agents. When True, after invoking the given tool, the agent will stop and return the result direcly to the user. |\n",
"| Attribute | Type | Description |\n",
"|---------------|---------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n",
"| name | str | Must be unique within a set of tools provided to an LLM or agent. |\n",
"| description | str | Describes what the tool does. Used as context by the LLM or agent. |\n",
"| args_schema | langchain.pydantic_v1.BaseModel | Optional but recommended, and required if using callback handlers. It can be used to provide more information (e.g., few-shot examples) or validation for expected parameters. |\n",
"| return_direct | boolean | Only relevant for agents. When True, after invoking the given tool, the agent will stop and return the result direcly to the user. |\n",
"\n",
"LangChain supports the creation of tools from:\n",
"\n",