Skip to content

Conversation

@dannykopping
Copy link
Collaborator

OpenAI's API sends tool call events like this:

data: ... delta":{"tool_calls":[{"index":0,"id":"call_0TxntkwDB66KH8z4RwNqeWrZ","type":"function","function":{"name":"bmcp_coder_coder_list_workspaces","arguments":""}}]}...
data: ... delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]}...
data: ... delta":{"tool_calls":[{"index":0,"function":{"arguments":"owner"}}]}...
data: ... delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]}...
data: ... delta":{"tool_calls":[{"index":0,"function":{"arguments":"admin"}}]}...
data: ... delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]}...

The first event specifies the name - and we know from the name whether it's an injected tool or not. Once all partials have been accumulated we have the full tool call payload, but we must not relay any of these events, including the first one, to the client.

Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
@deansheather deansheather merged commit 3f4ec16 into main Sep 29, 2025
deansheather added a commit to coder/coder that referenced this pull request Sep 29, 2025
aslilac pushed a commit to coder/coder that referenced this pull request Oct 7, 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.

2 participants