Skip to content

feat: Implement get_tool_call_output method in RunResultBase and update doc #637

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hieutrtr
Copy link

@hieutrtr hieutrtr commented May 1, 2025

Purpose:
The get_tool_call_output method provides a convenient way to retrieve the output of a specific tool call by its name. This is particularly useful when:

  1. Working with multiple tool calls in an agent interaction
  2. Need to access specific tool results for post-processing or validation
  3. Want to check if a particular tool was called and what its output was

Problem It Solves:
Without this method, developers would need to:

  1. Manually iterate through the new_items list
  2. Match tool calls with their corresponding outputs using call_id
  3. Handle potential errors and edge cases themselves
    This leads to repetitive code and potential errors. The method encapsulates this common operation in a clean, reusable way.

…umentation

This commit introduces the `get_tool_call_output` method to the `RunResultBase` class, allowing retrieval of tool call outputs by name. Additionally, the documentation in `results.md` has been updated to include usage examples for this new method. Unit tests have been added to ensure functionality and handle various scenarios, including successful retrieval, non-existent tools, and mismatched call IDs.
@hieutrtr hieutrtr changed the title Implement get_tool_call_output method in RunResultBase and update doc… Implement get_tool_call_output method in RunResultBase and update doc May 1, 2025
@hieutrtr hieutrtr marked this pull request as draft May 1, 2025 13:28
@hieutrtr hieutrtr closed this May 1, 2025
@hieutrtr hieutrtr reopened this May 1, 2025
@hieutrtr hieutrtr marked this pull request as ready for review May 1, 2025 13:31
@hieutrtr hieutrtr changed the title Implement get_tool_call_output method in RunResultBase and update doc feat: Implement get_tool_call_output method in RunResultBase and update doc May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant