@ai-sdk/mistral
Advanced tools
Comparing version 1.0.0-canary.1 to 1.0.0-canary.2
@@ -23,3 +23,2 @@ "use strict"; | ||
__export(src_exports, { | ||
Mistral: () => Mistral, | ||
createMistral: () => createMistral, | ||
@@ -30,4 +29,4 @@ mistral: () => mistral | ||
// src/mistral-facade.ts | ||
var import_provider_utils4 = require("@ai-sdk/provider-utils"); | ||
// src/mistral-provider.ts | ||
var import_provider_utils5 = require("@ai-sdk/provider-utils"); | ||
@@ -524,40 +523,5 @@ // src/mistral-chat-language-model.ts | ||
// src/mistral-facade.ts | ||
var Mistral = class { | ||
/** | ||
* Creates a new Mistral provider instance. | ||
*/ | ||
constructor(options = {}) { | ||
var _a; | ||
this.baseURL = (_a = (0, import_provider_utils4.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.mistral.ai/v1"; | ||
this.apiKey = options.apiKey; | ||
this.headers = options.headers; | ||
} | ||
get baseConfig() { | ||
return { | ||
baseURL: this.baseURL, | ||
headers: () => ({ | ||
Authorization: `Bearer ${(0, import_provider_utils4.loadApiKey)({ | ||
apiKey: this.apiKey, | ||
environmentVariableName: "MISTRAL_API_KEY", | ||
description: "Mistral" | ||
})}`, | ||
...this.headers | ||
}) | ||
}; | ||
} | ||
chat(modelId, settings = {}) { | ||
return new MistralChatLanguageModel(modelId, settings, { | ||
provider: "mistral.chat", | ||
...this.baseConfig | ||
}); | ||
} | ||
}; | ||
// src/mistral-provider.ts | ||
var import_provider_utils6 = require("@ai-sdk/provider-utils"); | ||
// src/mistral-embedding-model.ts | ||
var import_provider3 = require("@ai-sdk/provider"); | ||
var import_provider_utils5 = require("@ai-sdk/provider-utils"); | ||
var import_provider_utils4 = require("@ai-sdk/provider-utils"); | ||
var import_zod3 = require("zod"); | ||
@@ -595,5 +559,5 @@ var MistralEmbeddingModel = class { | ||
} | ||
const { responseHeaders, value: response } = await (0, import_provider_utils5.postJsonToApi)({ | ||
const { responseHeaders, value: response } = await (0, import_provider_utils4.postJsonToApi)({ | ||
url: `${this.config.baseURL}/embeddings`, | ||
headers: (0, import_provider_utils5.combineHeaders)(this.config.headers(), headers), | ||
headers: (0, import_provider_utils4.combineHeaders)(this.config.headers(), headers), | ||
body: { | ||
@@ -605,3 +569,3 @@ model: this.modelId, | ||
failedResponseHandler: mistralFailedResponseHandler, | ||
successfulResponseHandler: (0, import_provider_utils5.createJsonResponseHandler)( | ||
successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)( | ||
MistralTextEmbeddingResponseSchema | ||
@@ -627,5 +591,5 @@ ), | ||
var _a; | ||
const baseURL = (_a = (0, import_provider_utils6.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.mistral.ai/v1"; | ||
const baseURL = (_a = (0, import_provider_utils5.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.mistral.ai/v1"; | ||
const getHeaders = () => ({ | ||
Authorization: `Bearer ${(0, import_provider_utils6.loadApiKey)({ | ||
Authorization: `Bearer ${(0, import_provider_utils5.loadApiKey)({ | ||
apiKey: options.apiKey, | ||
@@ -667,3 +631,2 @@ environmentVariableName: "MISTRAL_API_KEY", | ||
0 && (module.exports = { | ||
Mistral, | ||
createMistral, | ||
@@ -670,0 +633,0 @@ mistral |
# @ai-sdk/mistral | ||
## 1.0.0-canary.2 | ||
### Major Changes | ||
- afe9283: chore (provider/mistral): remove Mistral facade | ||
### Patch Changes | ||
- Updated dependencies [dce4158] | ||
- Updated dependencies [dce4158] | ||
- @ai-sdk/provider-utils@2.0.0-canary.2 | ||
## 1.0.0-canary.1 | ||
@@ -4,0 +16,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { LanguageModelV1, ProviderV1, EmbeddingModelV1 } from '@ai-sdk/provider'; | ||
import { ProviderV1, LanguageModelV1, EmbeddingModelV1 } from '@ai-sdk/provider'; | ||
import { FetchFunction } from '@ai-sdk/provider-utils'; | ||
@@ -14,22 +14,2 @@ | ||
type MistralChatConfig = { | ||
provider: string; | ||
baseURL: string; | ||
headers: () => Record<string, string | undefined>; | ||
fetch?: FetchFunction; | ||
}; | ||
declare class MistralChatLanguageModel implements LanguageModelV1 { | ||
readonly specificationVersion = "v1"; | ||
readonly defaultObjectGenerationMode = "json"; | ||
readonly supportsImageUrls = false; | ||
readonly modelId: MistralChatModelId; | ||
readonly settings: MistralChatSettings; | ||
private readonly config; | ||
constructor(modelId: MistralChatModelId, settings: MistralChatSettings, config: MistralChatConfig); | ||
get provider(): string; | ||
private getArgs; | ||
doGenerate(options: Parameters<LanguageModelV1['doGenerate']>[0]): Promise<Awaited<ReturnType<LanguageModelV1['doGenerate']>>>; | ||
doStream(options: Parameters<LanguageModelV1['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV1['doStream']>>>; | ||
} | ||
type MistralEmbeddingModelId = 'mistral-embed' | (string & {}); | ||
@@ -97,20 +77,2 @@ interface MistralEmbeddingSettings { | ||
/** | ||
* @deprecated Use `createMistral` instead. | ||
*/ | ||
declare class Mistral { | ||
/** | ||
* Base URL for the Mistral API calls. | ||
*/ | ||
readonly baseURL: string; | ||
readonly apiKey?: string; | ||
readonly headers?: Record<string, string>; | ||
/** | ||
* Creates a new Mistral provider instance. | ||
*/ | ||
constructor(options?: MistralProviderSettings); | ||
private get baseConfig(); | ||
chat(modelId: MistralChatModelId, settings?: MistralChatSettings): MistralChatLanguageModel; | ||
} | ||
export { Mistral, type MistralProvider, type MistralProviderSettings, createMistral, mistral }; | ||
export { type MistralProvider, type MistralProviderSettings, createMistral, mistral }; |
@@ -23,3 +23,2 @@ "use strict"; | ||
__export(src_exports, { | ||
Mistral: () => Mistral, | ||
createMistral: () => createMistral, | ||
@@ -30,4 +29,4 @@ mistral: () => mistral | ||
// src/mistral-facade.ts | ||
var import_provider_utils4 = require("@ai-sdk/provider-utils"); | ||
// src/mistral-provider.ts | ||
var import_provider_utils5 = require("@ai-sdk/provider-utils"); | ||
@@ -524,40 +523,5 @@ // src/mistral-chat-language-model.ts | ||
// src/mistral-facade.ts | ||
var Mistral = class { | ||
/** | ||
* Creates a new Mistral provider instance. | ||
*/ | ||
constructor(options = {}) { | ||
var _a; | ||
this.baseURL = (_a = (0, import_provider_utils4.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.mistral.ai/v1"; | ||
this.apiKey = options.apiKey; | ||
this.headers = options.headers; | ||
} | ||
get baseConfig() { | ||
return { | ||
baseURL: this.baseURL, | ||
headers: () => ({ | ||
Authorization: `Bearer ${(0, import_provider_utils4.loadApiKey)({ | ||
apiKey: this.apiKey, | ||
environmentVariableName: "MISTRAL_API_KEY", | ||
description: "Mistral" | ||
})}`, | ||
...this.headers | ||
}) | ||
}; | ||
} | ||
chat(modelId, settings = {}) { | ||
return new MistralChatLanguageModel(modelId, settings, { | ||
provider: "mistral.chat", | ||
...this.baseConfig | ||
}); | ||
} | ||
}; | ||
// src/mistral-provider.ts | ||
var import_provider_utils6 = require("@ai-sdk/provider-utils"); | ||
// src/mistral-embedding-model.ts | ||
var import_provider3 = require("@ai-sdk/provider"); | ||
var import_provider_utils5 = require("@ai-sdk/provider-utils"); | ||
var import_provider_utils4 = require("@ai-sdk/provider-utils"); | ||
var import_zod3 = require("zod"); | ||
@@ -595,5 +559,5 @@ var MistralEmbeddingModel = class { | ||
} | ||
const { responseHeaders, value: response } = await (0, import_provider_utils5.postJsonToApi)({ | ||
const { responseHeaders, value: response } = await (0, import_provider_utils4.postJsonToApi)({ | ||
url: `${this.config.baseURL}/embeddings`, | ||
headers: (0, import_provider_utils5.combineHeaders)(this.config.headers(), headers), | ||
headers: (0, import_provider_utils4.combineHeaders)(this.config.headers(), headers), | ||
body: { | ||
@@ -605,3 +569,3 @@ model: this.modelId, | ||
failedResponseHandler: mistralFailedResponseHandler, | ||
successfulResponseHandler: (0, import_provider_utils5.createJsonResponseHandler)( | ||
successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)( | ||
MistralTextEmbeddingResponseSchema | ||
@@ -627,5 +591,5 @@ ), | ||
var _a; | ||
const baseURL = (_a = (0, import_provider_utils6.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.mistral.ai/v1"; | ||
const baseURL = (_a = (0, import_provider_utils5.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.mistral.ai/v1"; | ||
const getHeaders = () => ({ | ||
Authorization: `Bearer ${(0, import_provider_utils6.loadApiKey)({ | ||
Authorization: `Bearer ${(0, import_provider_utils5.loadApiKey)({ | ||
apiKey: options.apiKey, | ||
@@ -667,3 +631,2 @@ environmentVariableName: "MISTRAL_API_KEY", | ||
0 && (module.exports = { | ||
Mistral, | ||
createMistral, | ||
@@ -670,0 +633,0 @@ mistral |
{ | ||
"name": "@ai-sdk/mistral", | ||
"version": "1.0.0-canary.1", | ||
"version": "1.0.0-canary.2", | ||
"license": "Apache-2.0", | ||
@@ -23,3 +23,3 @@ "sideEffects": false, | ||
"@ai-sdk/provider": "1.0.0-canary.0", | ||
"@ai-sdk/provider-utils": "2.0.0-canary.1" | ||
"@ai-sdk/provider-utils": "2.0.0-canary.2" | ||
}, | ||
@@ -29,3 +29,3 @@ "devDependencies": { | ||
"tsup": "^8", | ||
"typescript": "5.5.4", | ||
"typescript": "5.6.3", | ||
"zod": "3.23.8", | ||
@@ -32,0 +32,0 @@ "@vercel/ai-tsconfig": "0.0.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
153689
1911
+ Added@ai-sdk/provider-utils@2.0.0-canary.2(transitive)
+ Addedeventsource-parser@3.0.0(transitive)
+ Addednanoid@5.1.2(transitive)
- Removed@ai-sdk/provider-utils@2.0.0-canary.1(transitive)
- Removedeventsource-parser@1.1.2(transitive)
- Removednanoid@3.3.8(transitive)