haystack icon indicating copy to clipboard operation
haystack copied to clipboard

unknown variant `function`, expected one of `system`, `user`, `assistant`, `tool`

Open springrain opened this issue 1 year ago • 3 comments

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

System:

  • OS: Windows 11
  • GPU/CPU: AMD X86_64
  • Haystack version (commit or version number):2.3.0

springrain avatar Aug 12 '24 10:08 springrain

Hi @springrain, could you please provide more context around this error? Sharing the code snippet that's causing the issue would also be helpful.

Amnah199 avatar Aug 14 '24 13:08 Amnah199

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

lbux avatar Aug 14 '24 18:08 lbux

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.

Amnah199 avatar Aug 16 '24 14:08 Amnah199

@springrain can you post a code example to reproduce the error?

anakin87 avatar Oct 28 '24 17:10 anakin87