Skip to content

parameter: messages with role 'tool' must be a response to a preceeding message with 'tool_calls' #189

Answered by Lexian-droid
Lexian-droid asked this question in Q&A
Discussion options

You must be logged in to vote

Found the issue, you have to add the message, but use "usedTool" as the role, like this:

messages.Add(new Message(usedTool, functionResult));

I didn't notice until just now that in the sample code (in the readme.md) there is the tool message that is using usedTool as it's role, and I thought that was invalid, so I changed it to Role.Tool, I did it because the type was OpenAI.Tool, not OpenAI.Role, which until now I didn't know that type of syntax was possible. That was definitely a big mistake on my part, thanks for the help, and I apologize for any time that I may have wasted.

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@Lexian-droid
Comment options

@alexsafayan
Comment options

@Lexian-droid
Comment options

@Lexian-droid
Comment options

Answer selected by Lexian-droid
@StephenHodgson
Comment options

@Lexian-droid
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
3 participants
Converted from issue

This discussion was converted from issue #188 on February 09, 2024 19:36.