mistralai / client-ts

TS Client library for Mistral AI platform
Apache License 2.0
30 stars 10 forks source link

Need to create and ErrorResponse Type. #38

Closed jwerre closed 1 month ago

jwerre commented 1 month ago

When doing chat completions the response can either be ChatCompletionResponse or { object: 'error', message: string, type: string}. For example:

export interface ErrorResponse {
  object: 'error',
  message: string,
  type: string,
}

class MistralClient {

  constructor(...);

  chat(
    request: ChatRequest,
    options?: ChatRequestOptions
    ): Promise<ChatCompletionResponse|ErrorResponse>; // <---------- ADD 
}
jwerre commented 1 month ago

Ooops, was using version 0