[BUG] Tool call results are not properly de-serialized. #49274
Labels
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
needs-team-attention
Workflow: This issue needs attention from Azure service team or SDK team
OpenAI
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Service Attention
Workflow: This issue is responsible by Azure service team.
Library name and version
Azure.AI.OpenAI 2.2.0
Describe the bug
According to documentation on this page: https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/function-calling
We should always append response tool calls to the message history for the OpenAI completions:
If we go to this example here, the code clearly expects you to just use the competions object to create a new assistant message:
Expected behavior
The expected behaviour is that content from responses is serialized into the content of the response, so that it adheres to the expected string content (tool call, id, args).
To make the above example work, you have to hack it, using something like:
completion.Content.Add(ChatMessageContentPart.CreateTextPart("just an example"));
Otherwise, you get a 400 bad request.
Actual behavior
You get a 400 bad request, using the official example.
Reproduction Steps
Go through the example of the official docs here
Environment
Ran it on 2.2.1 version and 2.2.2-beta-4. Neither serializes the tool calls to the content of the competions object, meaning
messages.Add(new AssistantChatMessage(completion));
Doesn't actually create a correct value for the interface.
The text was updated successfully, but these errors were encountered: