unknown variant `function`, expected one of `system`, `user`, `assistant`, `tool`
Describe the bug
unknown variant function, expected one of system, user, assistant, tool
Error message
openai.UnprocessableEntityError: Failed to deserialize the JSON body into the target type: messages[1].role: unknown variant function, expected one of system, user, assistant, tool
FAQ Check
- [X] Have you had a look at our new FAQ page?
System:
- OS: Windows 11
- GPU/CPU: AMD X86_64
- Haystack version (commit or version number):2.3.0
Hi @springrain, could you please provide more context around this error? Sharing the code snippet that's causing the issue would also be helpful.
Tools usage (which includes function calling) is not properly implemented into Haystack. The use of function is deprecated for OpenAI and ChatMessage does not yet support tool
Thank you for the clarification. A PR (check it out) is currently open in the haystack-experimental to address this issue. Once it's finalized, you’ll be able to test it. If the implementation is successful, it will be integrated into Haystack in a future release.
@springrain can you post a code example to reproduce the error?