File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
libs/core/langchain_core/tools Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,9 @@ def _infer_arg_descriptions(
192192) -> tuple [str | None , dict ]:
193193 """Infer argument descriptions from function docstring and annotations."""
194194 annotations = typing .get_type_hints (fn , include_extras = True )
195+ description : str | None
196+ arg_descriptions : dict
197+
195198 if parse_docstring :
196199 description , arg_descriptions = _parse_python_function_docstring (
197200 fn , annotations , error_on_invalid_docstring = error_on_invalid_docstring
Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5+ import inspect
56import textwrap
67from collections .abc import Awaitable , Callable
78from inspect import signature
@@ -218,7 +219,9 @@ def add(a: int, b: int) -> int:
218219 raise TypeError (msg )
219220
220221 if description_ is None :
221- if is_basemodel_subclass (source_function ):
222+ if inspect .isclass (source_function ) and is_basemodel_subclass (
223+ source_function
224+ ):
222225 description_ = ""
223226 else :
224227 msg = "Function must have a docstring if description not provided."
You can’t perform that action at this time.
0 commit comments