Skip to content

Docs: Add missing docstring to get_weather function #1478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2025

Conversation

Abbas-Asad
Copy link
Contributor

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:

@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.

## 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.
@seratch seratch added the documentation Improvements or additions to documentation label Aug 14, 2025
@seratch seratch merged commit a6378ce into openai:main Aug 14, 2025
6 checks passed
vcshih pushed a commit to veris-ai/openai-agents-python that referenced this pull request Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants