-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
.Net Microsoft.SemanticKernel.HttpOperationException: "Invalid parameter: messages with role 'tool' must be a response to a preceeding message with 'tool_calls'. #4679
Comments
Can you confirm if you are using auto function calling? Or are you manually calling the functions? I'm interested in knowing what code path you are using to generate the chat history since it looks like it's not being created correctly. |
Yes, I'm using auto function calling. And I initialize chat history like this |
We are having the same problem with the The error says: Microsoft.SemanticKernel.HttpOperationException: 'An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages: call_0F3u0c9PktCz3RRDtF9hqnh9
Status: 400 (model_error) The planner configuration is: var plannerConfig = new FunctionCallingStepwisePlannerOptions
{
MaxTokens = options.PlannerMaxTokens,
MaxIterations = options.PlannerMaxIterations,
SemanticMemoryConfig = new SemanticMemoryConfig
{
Memory = memory,
},
ExecutionSettings = new OpenAIPromptExecutionSettings
{
User = request.UserId,
},
}; The model we are using is GPT-3.5-1106 The version of SK is the latest: 1.4.0 Thank you. |
I am experiencing the same issue with Azure Open AI (GPT-4), auto function calling although I am persisting the I'm using version 1.5.0. |
…er with RAG (#5817) ### Motivation and Context Also includes a fix so the planner handles errors in the final answer correctly. Closes #4679 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
…er with RAG (microsoft#5817) ### Motivation and Context Also includes a fix so the planner handles errors in the final answer correctly. Closes microsoft#4679 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
Describe the bug
I'm using IChatComplitionService with Azure OpenAI gpt-35-turbo-16k 0613 model. When user asked for something that requires calling function of plugin, it will respond as expected. But after this response when
IChatComplitionService.GetStreamingChatMessageContentsAsync
called next time, this exception will be thrown:To Reproduce
Steps to reproduce the behavior:
IChatComplitionService.GetStreamingChatMessageContentsAsync
orGetChatMessageContentAsync
method with user message that will require executing plugin method.Here is how it done in my code:
Expected behavior
Chat response generating without thrown exception
Platform
Additional context
It seems that messages with role
AuthorRole.Tool
in chat history cause this problem. As temporary solution I just deleting all messages withAuthorRole.Tool
role from chat history before generating response. After deleting messages no exception.There was similar bug like in this issue #4556 (comment)
The text was updated successfully, but these errors were encountered: