Skip to content

Commit 33ff454

Browse files
authored
Merge pull request #239 from nerdai/nerdai/align-pydantic-fn-tool-with-simple-fn-tool
2 parents ac3950e + 53a3a30 commit 33ff454

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/llm_agents_from_scratch/tools/pydantic_function.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def __init__(
114114
Defaults to None.
115115
"""
116116
self.func = func
117-
self.desc = desc or func.__doc__ or f"Tool for {func.__name__}"
117+
self._desc = desc
118118
self.params_mdl = _validate_pydantic_function(func)
119119

120120
@property
@@ -125,7 +125,9 @@ def name(self) -> str:
125125
@property
126126
def description(self) -> str:
127127
"""Description of what this function tool does."""
128-
return self.desc
128+
return (
129+
self._desc or self.func.__doc__ or f"Tool for {self.func.__name__}"
130+
)
129131

130132
@property
131133
def parameters_json_schema(self) -> dict[str, Any]:

0 commit comments

Comments
 (0)