Skip to content

docs: Improve clarity of LitellmModel and InternalChatCompletionMessage #1343

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

Closed
wants to merge 19 commits into from

Conversation

MuhammadHamidRaza
Copy link
Contributor

This Pull Request improves the clarity and user-friendliness of two key docstrings in the litellm_model.py file. The goal is to make these core components more accessible to new developers without altering any functionality.

The changes are:

  • InternalChatCompletionMessage: The docstring has been updated to explain why this internal class is important. It now clarifies that it's used to store the agent's "reasoning content," which is vital for debugging and understanding the agent's thought process.
  • LitellmModel: The docstring has been expanded to better explain the value of using a LiteLLM model. It now highlights its key benefit: providing a flexible way to switch between multiple LLM providers (like Gemini, OpenAI, etc.) without changing core agent code.

These changes are purely textual and do not affect the functionality of the SDK. They enhance the documentation by providing a more complete and understandable overview of these core primitives.

muhammadhamidrazasidtechno and others added 19 commits July 28, 2025 20:03
…l Behavior Definitions" documentation to provide clearer explanations and more robust examples for agent tool usage. Key improvements include: - Explicitly defining import paths for `StopAtTools` and `ToolsToFinalOutputFunction`. - Providing comprehensive and corrected code examples for all `tool_choice` and `tool_use_behavior` configurations, including `"stop_on_first_tool"`, `StopAtTools`, and the usage of `ToolsToFinalOutputFunction`. - Ensuring proper Markdown formatting for code blocks and notes to enhance readability and accuracy. This update aims to significantly reduce ambiguity and improve the developer experience by offering ready-to-use and well-explained code snippets.
This update significantly enhances the "Tool Behavior Definitions" documentation, directly addressing the common challenges and wasted time developers previously experienced. Without clear examples and explicit guidance on import paths and usage patterns, implementing advanced agent tool behaviors was often a source of confusion and trial-and-error.

**Key improvements in this update include:**

-   **Explicitly defining crucial import paths** for `StopAtTools` and `ToolsToFinalOutputFunction`, removing guesswork.
-   **Providing comprehensive and corrected code examples** for all `tool_choice` and `tool_use_behavior` configurations, including `"stop_on_first_tool"`, `StopAtTools`, and `ToolsToFinalOutputFunction`. These examples are now streamlined and use consistent, easy-to-understand tools like `get_weather`.
-   **Ensuring proper Markdown formatting** for code blocks and notes to enhance readability and accuracy.

My personal experience, including significant time spent troubleshooting these very behaviors due to lack of clear examples, fueled this contribution. This update aims to drastically reduce ambiguity and improve the developer experience by offering ready-to-use and well-explained code snippets, saving countless hours for others.
This update significantly enhances the "Tool Behavior Definitions" documentation, directly addressing the common challenges and wasted time developers previously experienced. Without clear examples and explicit guidance on import paths and usage patterns, implementing advanced agent tool behaviors was often a source of confusion and trial-and-error.

**Key improvements in this update include:**

-   **Explicitly defining crucial import paths** for `StopAtTools` and `ToolsToFinalOutputFunction`, removing guesswork.
-   **Providing comprehensive and corrected code examples** for all `tool_choice` and `tool_use_behavior` configurations, including `"stop_on_first_tool"`, `StopAtTools`, and `ToolsToFinalOutputFunction`. These examples are now streamlined and use consistent, easy-to-understand tools like `get_weather`.
-   **Ensuring proper Markdown formatting** for code blocks and notes to enhance readability and accuracy.

My personal experience, including significant time spent troubleshooting these very behaviors due to lack of clear examples, fueled this contribution. This update aims to drastically reduce ambiguity and improve the developer experience by offering ready-to-use and well-explained code snippets, saving countless hours for others.
@seratch
Copy link
Member

seratch commented Aug 1, 2025

@MuhammadHamidRaza I think the current comments are not so bad, so I don't see the necessity to change them. Also, when you send a pull request, please include only the relevant diff. This means you need to start a new branch based on the latest main branch instead of reusing a long-lived branch. Also, having only single commit as the starting point would be appreciated.

@seratch seratch closed this Aug 1, 2025
@seratch seratch added the documentation Improvements or additions to documentation label Aug 1, 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.

3 participants