mistralai / client-ts

TS Client library for Mistral AI platform
Apache License 2.0
13 stars 6 forks source link

Getting "Response validation failed" #23

Open KernelDeimos opened 3 weeks ago

KernelDeimos commented 3 weeks ago

I'm trying to use the typescript client and I am getting the following error message:

SDKValidationError: Response validation failed: [
  {
    "code": "invalid_type",
    "expected": "boolean",
    "received": "undefined",
    "path": [
      "choices",
      0,
      "message",
      "prefix"
    ],
    "message": "Required"
  }
]

This appears to be because the API is not responding with a boolean value for the prefix parameter. I noticed the error object conveniently has a rawValue property containing the response, so I checked that and it looks like I'm getting a successful response from the API (just missing that property):

{
  "id": "368ace4bd8b74009b22b9f96881d477e",
  "object": "chat.completion",
  "created": 1724380968,
  "model": "mistral-large-latest",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "-- actual text removed because it was long --",
        "tool_calls": null
      },
      "finish_reason": "stop",
      "logprobs": null
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "total_tokens": 663,
    "completion_tokens": 651
  }
}
GaspardBT commented 3 weeks ago

Hey, thanks, for reporting this Could you share with us the following:

GaspardBT commented 3 weeks ago

Hey, https://github.com/mistralai/client-ts/pull/24 should have fix the issue, let us know if you still encounter the issue with the new version 👍