mistralai/client-python

ChatCompletionResponse Pydantic Enum Error

sploithunter opened this issue · 2 comments

Code I had yesterday that functioned quit working today. This could be an inference endpoint change for mistral-large-latest but I figured I would list it here as well as it is probably easier (as in $$$) to fix the client rather than the endpoint.

This is easily reproduced with the function calling example in this repository. A simple cut and paste will do. That example and other function calling code produces:

"
pydantic_core._pydantic_core.ValidationError: 1 validation error for ChatCompletionResponse
choices.0.finish_reason
Input should be 'stop', 'length', 'error' or 'tool_calls' [type=enum, input_value='tool_call', input_type=str]
"

Where the endpoint is sending "tool_call" (singular) and the client is expecting an enum of "tool_calls" (plural) . Yesterday, (29 Feb 2024) all was well and the code worked fine. Was there an endpoint update?

I was unable to reproduce the error. I believe this was resolved with PR #59, where tool_calls enum value was added to the FinishReason class.

This issue is fixed. Please let us know if you see more issues. Thanks!