You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Our application uses completion request streaming alongside OpenAI's recent support for multiple parallel tool calls. However, we have found that while OpenAI correctly returns multiple tool call objects in the stream, ChatCompletionCreateResponse always batches them into a single call with multiple function argument objects. This causes the first tool call's arguments to be malformed, and ignores all other tool calls from the API.
Your code piece
varresult=newOpenAIResponse();usingvarcancellationTokenSource=newCancellationTokenSource(TimeSpan.FromSeconds(90));awaitforeach(varcompletionincompletionResult.WithCancellation(cancellationTokenSource.Token)){if(completion.Successful){varchoice=completion.Choices.First();vartools=choice.Message.ToolCalls;Console.WriteLine(tools.Count.ToString());Console.WriteLine(tools.First().FunctionCall.Arguments.ToString());}}// Our prompt includes multiple tools, including "googleSearch" and "getURL".// Our message to the agent: "Please search Google for cats and download the contents of www.wired.com."
Result
The code returns a single tool call containg the arguments of both tool calls: "{\"SearchTerm\": \"cats\"}{\"URL\": \"www.wired.com\"}"
Expected behavior
The code should return two separate tool calls in tools, each with its own arguments.
Desktop (please complete the following information):
OS: Windows Server 2019
Language: C#
Version: v7.4.6
Additional context
Looking at a proxy log of the response from OpenAI, we can see that the API properly returns two separate tool call objects:
This is what leads me to believe that this is an issue specifically with this library. I feel that this may be caused by the changes in #463, but I'm not familiar enough with the codebase to verify that.
The text was updated successfully, but these errors were encountered:
Hello,
it actually seems there's an use-case is not handled in changes i did, related to parallel tool calls responses in chat streaming completion mode API. I already have detected where the issue is and i will fix it asap ( this evening or at last tomorrow ).
Describe the bug
Our application uses completion request streaming alongside OpenAI's recent support for multiple parallel tool calls. However, we have found that while OpenAI correctly returns multiple tool call objects in the stream, ChatCompletionCreateResponse always batches them into a single call with multiple function argument objects. This causes the first tool call's arguments to be malformed, and ignores all other tool calls from the API.
Your code piece
Result
The code returns a single tool call containg the arguments of both tool calls:
"{\"SearchTerm\": \"cats\"}{\"URL\": \"www.wired.com\"}"
Expected behavior
The code should return two separate tool calls in
tools
, each with its own arguments.Desktop (please complete the following information):
Additional context
Looking at a proxy log of the response from OpenAI, we can see that the API properly returns two separate tool call objects:
This is what leads me to believe that this is an issue specifically with this library. I feel that this may be caused by the changes in #463, but I'm not familiar enough with the codebase to verify that.
The text was updated successfully, but these errors were encountered: