mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-11 05:45:01 +00:00
DOC: type checker complain on args_schema type hint when inheriting from BaseTool (#30167)
Thank you for contributing to LangChain! - **Description:** update docs to suppress type checker complain on args_schema type hint when inheriting from BaseTool - **Issue:** #30142 - **Dependencies:** N/A - **Twitter handle:** N/A Additional guidelines: - Make sure optional dependencies are imported within a function. - Please do not add dependencies to pyproject.toml files (even optional ones) unless they are required for unit tests. - Most PRs should not touch more than one package. - Changes should be backwards compatible. - If you are adding something to community, do not re-import it in langchain. If no one reviews your PR within a few days, please @-mention one of baskaryan, eyurtsev, ccurme, vbarda, hwchase17.
This commit is contained in:
parent
17507c9ba6
commit
01317fde21
@ -492,7 +492,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 9,
|
"execution_count": null,
|
||||||
"id": "1dad8f8e",
|
"id": "1dad8f8e",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
@ -504,13 +504,14 @@
|
|||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from typing import Optional, Type\n",
|
"from typing import Optional\n",
|
||||||
"\n",
|
"\n",
|
||||||
"from langchain_core.callbacks import (\n",
|
"from langchain_core.callbacks import (\n",
|
||||||
" AsyncCallbackManagerForToolRun,\n",
|
" AsyncCallbackManagerForToolRun,\n",
|
||||||
" CallbackManagerForToolRun,\n",
|
" CallbackManagerForToolRun,\n",
|
||||||
")\n",
|
")\n",
|
||||||
"from langchain_core.tools import BaseTool\n",
|
"from langchain_core.tools import BaseTool\n",
|
||||||
|
"from langchain_core.tools.base import ArgsSchema\n",
|
||||||
"from pydantic import BaseModel, Field\n",
|
"from pydantic import BaseModel, Field\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -524,7 +525,7 @@
|
|||||||
"class CustomCalculatorTool(BaseTool):\n",
|
"class CustomCalculatorTool(BaseTool):\n",
|
||||||
" name: str = \"Calculator\"\n",
|
" name: str = \"Calculator\"\n",
|
||||||
" description: str = \"useful for when you need to answer questions about math\"\n",
|
" description: str = \"useful for when you need to answer questions about math\"\n",
|
||||||
" args_schema: Type[BaseModel] = CalculatorInput\n",
|
" args_schema: Optional[ArgsSchema] = CalculatorInput\n",
|
||||||
" return_direct: bool = True\n",
|
" return_direct: bool = True\n",
|
||||||
"\n",
|
"\n",
|
||||||
" def _run(\n",
|
" def _run(\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user