From 61e09229c8a13e0528b1c533408ab36fa516ed6c Mon Sep 17 00:00:00 2001 From: Daniel Chalef <131175+danielchalef@users.noreply.github.com> Date: Fri, 21 Apr 2023 16:51:13 -0600 Subject: [PATCH] args_schema type hint on subclassing (#3323) per https://github.com/hwchase17/langchain/issues/3297 Co-authored-by: Daniel Chalef --- docs/modules/agents/tools/custom_tools.ipynb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/modules/agents/tools/custom_tools.ipynb b/docs/modules/agents/tools/custom_tools.ipynb index 2e2fa6f7..b34cd90d 100644 --- a/docs/modules/agents/tools/custom_tools.ipynb +++ b/docs/modules/agents/tools/custom_tools.ipynb @@ -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",