UNPKG

@ai-sdk/mistral

Version:

The **[Mistral provider](https://ai-sdk.dev/providers/ai-sdk-providers/mistral)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model, embedding model, and speech model support for Mistral APIs.

18 lines (14 loc) 517 B
import { createJsonErrorResponseHandler } from '@ai-sdk/provider-utils'; import { z } from 'zod/v4'; const mistralErrorDataSchema = z.object({ object: z.literal('error'), message: z.string(), type: z.string(), param: z.string().nullable(), code: z.string().nullable(), }); export type MistralErrorData = z.infer<typeof mistralErrorDataSchema>; export const mistralFailedResponseHandler = createJsonErrorResponseHandler({ errorSchema: mistralErrorDataSchema, errorToMessage: data => data.message, });