Skip to content
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

Allow returning thought in the tool call responses #5192

Open
osdemah opened this issue Jan 25, 2025 · 2 comments
Open

Allow returning thought in the tool call responses #5192

osdemah opened this issue Jan 25, 2025 · 2 comments
Labels
api-break-change Will break existing api and needs an migration for previous code to work needs-triage proj-agentchat proj-core proj-extensions
Milestone

Comments

@osdemah
Copy link

osdemah commented Jan 25, 2025

What feature would you like to be added?

Some models include an additional text message in the tool call response. for example:

{
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "<thinking>To answer this question, I will: 1. Use the get_weather tool to get the current weather in San Francisco. 2. Use the get_time tool to get the current time in the America/Los_Angeles timezone, which covers San Francisco, CA.</thinking>"
    },
    {
      "type": "tool_use",
      "id": "toolu_01A09q90qw90lq917835lq9",
      "name": "get_weather",
      "input": {"location": "San Francisco, CA"}
    }
  ]
}

We need to allow including that message in the response, so that it can be properly surfaced to agent and users.

The proposal in #5173 is to change the content field to Union[str, FunctionCalls] instead of Union[str, List[FunctionCall]] so that additional fields could be included in FunctionCalls:

@dataclass
class FunctionCalls:
    function_calls: List[FunctionCall]
    thought: Optional[str] = None

Why is this needed?

to include model response properly

@ekzhu ekzhu added this to the 0.4.x milestone Jan 25, 2025
@ekzhu ekzhu added api-break-change Will break existing api and needs an migration for previous code to work proj-core proj-extensions proj-agentchat labels Jan 25, 2025
@ekzhu
Copy link
Collaborator

ekzhu commented Jan 25, 2025

Thank you @osdemah , since this is an API breaking change, let's have a bit more discussion around this. We may take a bit longer on this. I do think it is important.

cc @jackgerrits

Is there a way to avoid an API breaking change? So that existing code won't break?

@ekzhu
Copy link
Collaborator

ekzhu commented Jan 25, 2025

@osdemah related #5161 , what do you think about supporting reasoning models together with supporting thoughts in tool calls?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-break-change Will break existing api and needs an migration for previous code to work needs-triage proj-agentchat proj-core proj-extensions
Projects
None yet
Development

No branches or pull requests

2 participants