I am using Mistral AI client in my javascript project and Mistral Ai is giving me a tool_calls response. When I call the tool and push response in messages array. And Then I call a send a second request to the Mistral AI it gives me this error:
MistralAPIError: HTTP error! status: 400 Response:
{"object":"error","message":"Unexpected role RoleEnum.tool","type":"invalid_request_error","param":null,"code":null}
I am using Mistral AI client in my javascript project and Mistral Ai is giving me a tool_calls response. When I call the tool and push response in messages array. And Then I call a send a second request to the Mistral AI it gives me this error: MistralAPIError: HTTP error! status: 400 Response: {"object":"error","message":"Unexpected role RoleEnum.tool","type":"invalid_request_error","param":null,"code":null}
My messages array contains: Messages: [ { "role": "user", "name": "User", "content": "give me random cat image\n\n" }, { "role": "tool", "name": "RandomCatImage", "content": "{"data":{"id":"cpq","url":"[https://cdn2.thecatapi.com/images/cpq.png/",/"width/":1024,/"height/":765%7D],/"success/":true,/"message/":/"Successfully accomplished!"}" } ]
My implementation for function calling:
I am unable to get chat response from Mistral AI after calling a tool.