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

Fix: Handle multiple tool calls in json to stream response handler #248

Closed
VisargD opened this issue Mar 9, 2024 · 0 comments · Fixed by #249
Closed

Fix: Handle multiple tool calls in json to stream response handler #248

VisargD opened this issue Mar 9, 2024 · 0 comments · Fixed by #249
Assignees
Labels
bug Something isn't working triage

Comments

@VisargD
Copy link
Collaborator

VisargD commented Mar 9, 2024

In the OpenAIChatCompleteJSONToStreamResponseTransform function, we convert an OpenAI-like json response to stream response. But the function only considers the first tool call while creating stream chunks. This becomes an issue when there are more than 1 tool calls (parallel function calling) returned in response.

const currentToolCall = choice.message.tool_calls[0];

Discord link where the issue was reported which led to this finding: https://discord.com/channels/1143393887742861333/1214959777566826536

Solution: Instead of parsing only 0 index for tool_calls, loop all tool calls and generate respective stream chunks

@VisargD VisargD added the bug Something isn't working label Mar 9, 2024
@VisargD VisargD self-assigned this Mar 9, 2024
@github-actions github-actions bot added the triage label Mar 9, 2024
@VisargD VisargD mentioned this issue Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant