mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
args_schema type hint on subclassing (#3323)
per https://github.com/hwchase17/langchain/issues/3297 Co-authored-by: Daniel Chalef <daniel.chalef@private.org>
This commit is contained in:
parent
05a8aa5447
commit
61e09229c8
@ -191,6 +191,8 @@
|
|||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"from typing import Type\n",
|
||||||
|
"\n",
|
||||||
"class CustomSearchTool(BaseTool):\n",
|
"class CustomSearchTool(BaseTool):\n",
|
||||||
" name = \"Search\"\n",
|
" name = \"Search\"\n",
|
||||||
" description = \"useful for when you need to answer questions about current events\"\n",
|
" description = \"useful for when you need to answer questions about current events\"\n",
|
||||||
@ -206,7 +208,7 @@
|
|||||||
"class CustomCalculatorTool(BaseTool):\n",
|
"class CustomCalculatorTool(BaseTool):\n",
|
||||||
" name = \"Calculator\"\n",
|
" name = \"Calculator\"\n",
|
||||||
" description = \"useful for when you need to answer questions about math\"\n",
|
" description = \"useful for when you need to answer questions about math\"\n",
|
||||||
" args_schema=CalculatorInput\n",
|
" args_schema: Type[BaseModel] = CalculatorInput\n",
|
||||||
"\n",
|
"\n",
|
||||||
" def _run(self, query: str) -> str:\n",
|
" def _run(self, query: str) -> str:\n",
|
||||||
" \"\"\"Use the tool.\"\"\"\n",
|
" \"\"\"Use the tool.\"\"\"\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user