mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-04 04:07:54 +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": [],
|
||||
"source": [
|
||||
"from typing import Type\n",
|
||||
"\n",
|
||||
"class CustomSearchTool(BaseTool):\n",
|
||||
" name = \"Search\"\n",
|
||||
" description = \"useful for when you need to answer questions about current events\"\n",
|
||||
@ -206,7 +208,7 @@
|
||||
"class CustomCalculatorTool(BaseTool):\n",
|
||||
" name = \"Calculator\"\n",
|
||||
" description = \"useful for when you need to answer questions about math\"\n",
|
||||
" args_schema=CalculatorInput\n",
|
||||
" args_schema: Type[BaseModel] = CalculatorInput\n",
|
||||
"\n",
|
||||
" def _run(self, query: str) -> str:\n",
|
||||
" \"\"\"Use the tool.\"\"\"\n",
|
||||
|
Loading…
Reference in New Issue
Block a user