Skip to content

Commit 770adbc

Browse files
authored
Docs: Add missing docstring to get_weather function
## Summary Added a missing docstring to the `get_weather` function in the tools example to improve code documentation and tool description. ## Problem The `get_weather` function (tool) was missing a docstring, which is important for: - Function documentation and code clarity - Tool description that the LLM uses to understand when to call the tool - Following Python best practices for function documentation ## Changes Made Just added a clear and concise docstring to the `get_weather` function: ```python @function_tool def get_weather(city: str) -> Weather: """Get the current weather information for a specified city.""" print("[debug] get_weather called") return Weather(city=city, temperature_range="14-20C", conditions="Sunny with wind.") ``` This docstring provides a clear description of the function's purpose and helps both developers and LLMs understand when and how to use this tool.
1 parent c436389 commit 770adbc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

examples/basic/tools.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Weather(BaseModel):
1313

1414
@function_tool
1515
def get_weather(city: str) -> Weather:
16+
"""Get the current weather information for a specified city."""
1617
print("[debug] get_weather called")
1718
return Weather(city=city, temperature_range="14-20C", conditions="Sunny with wind.")
1819

0 commit comments

Comments
 (0)