Skip to content

Docs: Add missing docstring to how_many_jokes tool #1479

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 how_many_jokes function in the stream_items example to improve code documentation and tool description.

Problem

The how_many_jokes function 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

Added a clear and precise docstring to the how_many_jokes function:

def how_many_jokes() -> int:
    """Return a random integer of jokes to tell between 1 and 10 (inclusive)."""
    return random.randint(1, 10)

The 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 `how_many_jokes` function in the `stream_items` example to improve code documentation and tool description.

## Problem

The `how_many_jokes` function 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

Added a clear and precise docstring to the `how_many_jokes` function:
```python
def how_many_jokes() -> int:
    """Return a random integer of jokes to tell between 1 and 10 (inclusive)."""
    return random.randint(1, 10)
```

The 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
Copy link
Member

seratch commented Aug 14, 2025

Thanks for sending these pull requests! If you see more like this one, you can have multiple changes as long as they're the same kind of changes.

@seratch seratch added the documentation Improvements or additions to documentation label Aug 14, 2025
@seratch seratch merged commit 90a57d0 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