@ai-sdk/mistral 4.0.0-beta.20 → 4.0.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/index.js +140 -143
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/dist/index.d.mts +0 -82
- package/dist/index.mjs +0 -920
- package/dist/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @ai-sdk/mistral
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.22
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [ef992f8]
|
|
12
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
13
|
+
- @ai-sdk/provider-utils@5.0.0-beta.19
|
|
14
|
+
|
|
15
|
+
## 4.0.0-beta.21
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [90e2d8a]
|
|
20
|
+
- @ai-sdk/provider-utils@5.0.0-beta.18
|
|
21
|
+
|
|
3
22
|
## 4.0.0-beta.20
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1,38 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
VERSION: () => VERSION,
|
|
24
|
-
createMistral: () => createMistral,
|
|
25
|
-
mistral: () => mistral
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
|
|
29
1
|
// src/mistral-provider.ts
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
import {
|
|
3
|
+
NoSuchModelError
|
|
4
|
+
} from "@ai-sdk/provider";
|
|
5
|
+
import {
|
|
6
|
+
loadApiKey,
|
|
7
|
+
withoutTrailingSlash,
|
|
8
|
+
withUserAgentSuffix
|
|
9
|
+
} from "@ai-sdk/provider-utils";
|
|
32
10
|
|
|
33
11
|
// src/mistral-chat-language-model.ts
|
|
34
|
-
|
|
35
|
-
|
|
12
|
+
import {
|
|
13
|
+
combineHeaders,
|
|
14
|
+
createEventSourceResponseHandler,
|
|
15
|
+
createJsonResponseHandler,
|
|
16
|
+
generateId,
|
|
17
|
+
injectJsonInstructionIntoMessages,
|
|
18
|
+
isCustomReasoning,
|
|
19
|
+
mapReasoningToProviderEffort,
|
|
20
|
+
parseProviderOptions,
|
|
21
|
+
postJsonToApi
|
|
22
|
+
} from "@ai-sdk/provider-utils";
|
|
23
|
+
import { z as z3 } from "zod/v4";
|
|
36
24
|
|
|
37
25
|
// src/convert-mistral-usage.ts
|
|
38
26
|
function convertMistralUsage(usage) {
|
|
@@ -71,13 +59,15 @@ function convertMistralUsage(usage) {
|
|
|
71
59
|
}
|
|
72
60
|
|
|
73
61
|
// src/convert-to-mistral-chat-messages.ts
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
import {
|
|
63
|
+
UnsupportedFunctionalityError
|
|
64
|
+
} from "@ai-sdk/provider";
|
|
65
|
+
import { convertToBase64, isProviderReference } from "@ai-sdk/provider-utils";
|
|
76
66
|
function formatFileUrl({
|
|
77
67
|
data,
|
|
78
68
|
mediaType
|
|
79
69
|
}) {
|
|
80
|
-
return data instanceof URL ? data.toString() : `data:${mediaType};base64,${
|
|
70
|
+
return data instanceof URL ? data.toString() : `data:${mediaType};base64,${convertToBase64(data)}`;
|
|
81
71
|
}
|
|
82
72
|
function convertToMistralChatMessages(prompt) {
|
|
83
73
|
var _a;
|
|
@@ -99,8 +89,8 @@ function convertToMistralChatMessages(prompt) {
|
|
|
99
89
|
return { type: "text", text: part.text };
|
|
100
90
|
}
|
|
101
91
|
case "file": {
|
|
102
|
-
if (
|
|
103
|
-
throw new
|
|
92
|
+
if (isProviderReference(part.data)) {
|
|
93
|
+
throw new UnsupportedFunctionalityError({
|
|
104
94
|
functionality: "file parts with provider references"
|
|
105
95
|
});
|
|
106
96
|
}
|
|
@@ -119,7 +109,7 @@ function convertToMistralChatMessages(prompt) {
|
|
|
119
109
|
})
|
|
120
110
|
};
|
|
121
111
|
} else {
|
|
122
|
-
throw new
|
|
112
|
+
throw new UnsupportedFunctionalityError({
|
|
123
113
|
functionality: "Only images and PDF file parts are supported"
|
|
124
114
|
});
|
|
125
115
|
}
|
|
@@ -236,61 +226,63 @@ function mapMistralFinishReason(finishReason) {
|
|
|
236
226
|
}
|
|
237
227
|
|
|
238
228
|
// src/mistral-chat-options.ts
|
|
239
|
-
|
|
240
|
-
var mistralLanguageModelOptions =
|
|
229
|
+
import { z } from "zod/v4";
|
|
230
|
+
var mistralLanguageModelOptions = z.object({
|
|
241
231
|
/**
|
|
242
232
|
* Whether to inject a safety prompt before all conversations.
|
|
243
233
|
*
|
|
244
234
|
* Defaults to `false`.
|
|
245
235
|
*/
|
|
246
|
-
safePrompt:
|
|
247
|
-
documentImageLimit:
|
|
248
|
-
documentPageLimit:
|
|
236
|
+
safePrompt: z.boolean().optional(),
|
|
237
|
+
documentImageLimit: z.number().optional(),
|
|
238
|
+
documentPageLimit: z.number().optional(),
|
|
249
239
|
/**
|
|
250
240
|
* Whether to use structured outputs.
|
|
251
241
|
*
|
|
252
242
|
* @default true
|
|
253
243
|
*/
|
|
254
|
-
structuredOutputs:
|
|
244
|
+
structuredOutputs: z.boolean().optional(),
|
|
255
245
|
/**
|
|
256
246
|
* Whether to use strict JSON schema validation.
|
|
257
247
|
*
|
|
258
248
|
* @default false
|
|
259
249
|
*/
|
|
260
|
-
strictJsonSchema:
|
|
250
|
+
strictJsonSchema: z.boolean().optional(),
|
|
261
251
|
/**
|
|
262
252
|
* Whether to enable parallel function calling during tool use.
|
|
263
253
|
* When set to false, the model will use at most one tool per response.
|
|
264
254
|
*
|
|
265
255
|
* @default true
|
|
266
256
|
*/
|
|
267
|
-
parallelToolCalls:
|
|
257
|
+
parallelToolCalls: z.boolean().optional(),
|
|
268
258
|
/**
|
|
269
259
|
* Controls the reasoning effort for models that support adjustable reasoning.
|
|
270
260
|
*
|
|
271
261
|
* - `'high'`: Enable reasoning
|
|
272
262
|
* - `'none'`: Disable reasoning
|
|
273
263
|
*/
|
|
274
|
-
reasoningEffort:
|
|
264
|
+
reasoningEffort: z.enum(["high", "none"]).optional()
|
|
275
265
|
});
|
|
276
266
|
|
|
277
267
|
// src/mistral-error.ts
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
var mistralErrorDataSchema =
|
|
281
|
-
object:
|
|
282
|
-
message:
|
|
283
|
-
type:
|
|
284
|
-
param:
|
|
285
|
-
code:
|
|
268
|
+
import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
|
|
269
|
+
import { z as z2 } from "zod/v4";
|
|
270
|
+
var mistralErrorDataSchema = z2.object({
|
|
271
|
+
object: z2.literal("error"),
|
|
272
|
+
message: z2.string(),
|
|
273
|
+
type: z2.string(),
|
|
274
|
+
param: z2.string().nullable(),
|
|
275
|
+
code: z2.string().nullable()
|
|
286
276
|
});
|
|
287
|
-
var mistralFailedResponseHandler =
|
|
277
|
+
var mistralFailedResponseHandler = createJsonErrorResponseHandler({
|
|
288
278
|
errorSchema: mistralErrorDataSchema,
|
|
289
279
|
errorToMessage: (data) => data.message
|
|
290
280
|
});
|
|
291
281
|
|
|
292
282
|
// src/mistral-prepare-tools.ts
|
|
293
|
-
|
|
283
|
+
import {
|
|
284
|
+
UnsupportedFunctionalityError as UnsupportedFunctionalityError2
|
|
285
|
+
} from "@ai-sdk/provider";
|
|
294
286
|
function prepareTools({
|
|
295
287
|
tools,
|
|
296
288
|
toolChoice
|
|
@@ -341,7 +333,7 @@ function prepareTools({
|
|
|
341
333
|
};
|
|
342
334
|
default: {
|
|
343
335
|
const _exhaustiveCheck = type;
|
|
344
|
-
throw new
|
|
336
|
+
throw new UnsupportedFunctionalityError2({
|
|
345
337
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
346
338
|
});
|
|
347
339
|
}
|
|
@@ -358,7 +350,7 @@ var MistralChatLanguageModel = class {
|
|
|
358
350
|
var _a;
|
|
359
351
|
this.modelId = modelId;
|
|
360
352
|
this.config = config;
|
|
361
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
353
|
+
this.generateId = (_a = config.generateId) != null ? _a : generateId;
|
|
362
354
|
}
|
|
363
355
|
get provider() {
|
|
364
356
|
return this.config.provider;
|
|
@@ -381,7 +373,7 @@ var MistralChatLanguageModel = class {
|
|
|
381
373
|
}) {
|
|
382
374
|
var _a, _b, _c, _d, _e;
|
|
383
375
|
const warnings = [];
|
|
384
|
-
const options = (_a = await
|
|
376
|
+
const options = (_a = await parseProviderOptions({
|
|
385
377
|
provider: "mistral",
|
|
386
378
|
providerOptions,
|
|
387
379
|
schema: mistralLanguageModelOptions
|
|
@@ -401,7 +393,7 @@ var MistralChatLanguageModel = class {
|
|
|
401
393
|
const supportsReasoningEffort = this.modelId === "mistral-small-latest" || this.modelId === "mistral-small-2603";
|
|
402
394
|
let resolvedReasoningEffort;
|
|
403
395
|
if (supportsReasoningEffort) {
|
|
404
|
-
resolvedReasoningEffort = (_b = options.reasoningEffort) != null ? _b :
|
|
396
|
+
resolvedReasoningEffort = (_b = options.reasoningEffort) != null ? _b : isCustomReasoning(reasoning) ? reasoning === "none" ? "none" : mapReasoningToProviderEffort({
|
|
405
397
|
reasoning,
|
|
406
398
|
effortMap: {
|
|
407
399
|
minimal: "high",
|
|
@@ -412,7 +404,7 @@ var MistralChatLanguageModel = class {
|
|
|
412
404
|
},
|
|
413
405
|
warnings
|
|
414
406
|
}) : void 0;
|
|
415
|
-
} else if (
|
|
407
|
+
} else if (isCustomReasoning(reasoning)) {
|
|
416
408
|
warnings.push({
|
|
417
409
|
type: "unsupported",
|
|
418
410
|
feature: "reasoning",
|
|
@@ -422,7 +414,7 @@ var MistralChatLanguageModel = class {
|
|
|
422
414
|
const structuredOutputs = (_c = options.structuredOutputs) != null ? _c : true;
|
|
423
415
|
const strictJsonSchema = (_d = options.strictJsonSchema) != null ? _d : false;
|
|
424
416
|
if ((responseFormat == null ? void 0 : responseFormat.type) === "json" && !(responseFormat == null ? void 0 : responseFormat.schema)) {
|
|
425
|
-
prompt =
|
|
417
|
+
prompt = injectJsonInstructionIntoMessages({
|
|
426
418
|
messages: prompt,
|
|
427
419
|
schema: responseFormat.schema
|
|
428
420
|
});
|
|
@@ -479,12 +471,12 @@ var MistralChatLanguageModel = class {
|
|
|
479
471
|
responseHeaders,
|
|
480
472
|
value: response,
|
|
481
473
|
rawValue: rawResponse
|
|
482
|
-
} = await
|
|
474
|
+
} = await postJsonToApi({
|
|
483
475
|
url: `${this.config.baseURL}/chat/completions`,
|
|
484
|
-
headers:
|
|
476
|
+
headers: combineHeaders(this.config.headers(), options.headers),
|
|
485
477
|
body,
|
|
486
478
|
failedResponseHandler: mistralFailedResponseHandler,
|
|
487
|
-
successfulResponseHandler:
|
|
479
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
488
480
|
mistralChatResponseSchema
|
|
489
481
|
),
|
|
490
482
|
abortSignal: options.abortSignal,
|
|
@@ -540,12 +532,12 @@ var MistralChatLanguageModel = class {
|
|
|
540
532
|
async doStream(options) {
|
|
541
533
|
const { args, warnings } = await this.getArgs(options);
|
|
542
534
|
const body = { ...args, stream: true };
|
|
543
|
-
const { responseHeaders, value: response } = await
|
|
535
|
+
const { responseHeaders, value: response } = await postJsonToApi({
|
|
544
536
|
url: `${this.config.baseURL}/chat/completions`,
|
|
545
|
-
headers:
|
|
537
|
+
headers: combineHeaders(this.config.headers(), options.headers),
|
|
546
538
|
body,
|
|
547
539
|
failedResponseHandler: mistralFailedResponseHandler,
|
|
548
|
-
successfulResponseHandler:
|
|
540
|
+
successfulResponseHandler: createEventSourceResponseHandler(
|
|
549
541
|
mistralChatChunkSchema
|
|
550
542
|
),
|
|
551
543
|
abortSignal: options.abortSignal,
|
|
@@ -717,95 +709,101 @@ function extractTextContent(content) {
|
|
|
717
709
|
}
|
|
718
710
|
return textContent.length ? textContent.join("") : void 0;
|
|
719
711
|
}
|
|
720
|
-
var mistralContentSchema =
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
type:
|
|
726
|
-
text:
|
|
712
|
+
var mistralContentSchema = z3.union([
|
|
713
|
+
z3.string(),
|
|
714
|
+
z3.array(
|
|
715
|
+
z3.discriminatedUnion("type", [
|
|
716
|
+
z3.object({
|
|
717
|
+
type: z3.literal("text"),
|
|
718
|
+
text: z3.string()
|
|
727
719
|
}),
|
|
728
|
-
|
|
729
|
-
type:
|
|
730
|
-
image_url:
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
url:
|
|
734
|
-
detail:
|
|
720
|
+
z3.object({
|
|
721
|
+
type: z3.literal("image_url"),
|
|
722
|
+
image_url: z3.union([
|
|
723
|
+
z3.string(),
|
|
724
|
+
z3.object({
|
|
725
|
+
url: z3.string(),
|
|
726
|
+
detail: z3.string().nullable()
|
|
735
727
|
})
|
|
736
728
|
])
|
|
737
729
|
}),
|
|
738
|
-
|
|
739
|
-
type:
|
|
740
|
-
reference_ids:
|
|
730
|
+
z3.object({
|
|
731
|
+
type: z3.literal("reference"),
|
|
732
|
+
reference_ids: z3.array(z3.union([z3.string(), z3.number()]))
|
|
741
733
|
}),
|
|
742
|
-
|
|
743
|
-
type:
|
|
744
|
-
thinking:
|
|
745
|
-
|
|
746
|
-
type:
|
|
747
|
-
text:
|
|
734
|
+
z3.object({
|
|
735
|
+
type: z3.literal("thinking"),
|
|
736
|
+
thinking: z3.array(
|
|
737
|
+
z3.object({
|
|
738
|
+
type: z3.literal("text"),
|
|
739
|
+
text: z3.string()
|
|
748
740
|
})
|
|
749
741
|
)
|
|
750
742
|
})
|
|
751
743
|
])
|
|
752
744
|
)
|
|
753
745
|
]).nullish();
|
|
754
|
-
var mistralUsageSchema =
|
|
755
|
-
prompt_tokens:
|
|
756
|
-
completion_tokens:
|
|
757
|
-
total_tokens:
|
|
746
|
+
var mistralUsageSchema = z3.object({
|
|
747
|
+
prompt_tokens: z3.number(),
|
|
748
|
+
completion_tokens: z3.number(),
|
|
749
|
+
total_tokens: z3.number()
|
|
758
750
|
});
|
|
759
|
-
var mistralChatResponseSchema =
|
|
760
|
-
id:
|
|
761
|
-
created:
|
|
762
|
-
model:
|
|
763
|
-
choices:
|
|
764
|
-
|
|
765
|
-
message:
|
|
766
|
-
role:
|
|
751
|
+
var mistralChatResponseSchema = z3.object({
|
|
752
|
+
id: z3.string().nullish(),
|
|
753
|
+
created: z3.number().nullish(),
|
|
754
|
+
model: z3.string().nullish(),
|
|
755
|
+
choices: z3.array(
|
|
756
|
+
z3.object({
|
|
757
|
+
message: z3.object({
|
|
758
|
+
role: z3.literal("assistant"),
|
|
767
759
|
content: mistralContentSchema,
|
|
768
|
-
tool_calls:
|
|
769
|
-
|
|
770
|
-
id:
|
|
771
|
-
function:
|
|
760
|
+
tool_calls: z3.array(
|
|
761
|
+
z3.object({
|
|
762
|
+
id: z3.string(),
|
|
763
|
+
function: z3.object({ name: z3.string(), arguments: z3.string() })
|
|
772
764
|
})
|
|
773
765
|
).nullish()
|
|
774
766
|
}),
|
|
775
|
-
index:
|
|
776
|
-
finish_reason:
|
|
767
|
+
index: z3.number(),
|
|
768
|
+
finish_reason: z3.string().nullish()
|
|
777
769
|
})
|
|
778
770
|
),
|
|
779
|
-
object:
|
|
771
|
+
object: z3.literal("chat.completion"),
|
|
780
772
|
usage: mistralUsageSchema
|
|
781
773
|
});
|
|
782
|
-
var mistralChatChunkSchema =
|
|
783
|
-
id:
|
|
784
|
-
created:
|
|
785
|
-
model:
|
|
786
|
-
choices:
|
|
787
|
-
|
|
788
|
-
delta:
|
|
789
|
-
role:
|
|
774
|
+
var mistralChatChunkSchema = z3.object({
|
|
775
|
+
id: z3.string().nullish(),
|
|
776
|
+
created: z3.number().nullish(),
|
|
777
|
+
model: z3.string().nullish(),
|
|
778
|
+
choices: z3.array(
|
|
779
|
+
z3.object({
|
|
780
|
+
delta: z3.object({
|
|
781
|
+
role: z3.enum(["assistant"]).optional(),
|
|
790
782
|
content: mistralContentSchema,
|
|
791
|
-
tool_calls:
|
|
792
|
-
|
|
793
|
-
id:
|
|
794
|
-
function:
|
|
783
|
+
tool_calls: z3.array(
|
|
784
|
+
z3.object({
|
|
785
|
+
id: z3.string(),
|
|
786
|
+
function: z3.object({ name: z3.string(), arguments: z3.string() })
|
|
795
787
|
})
|
|
796
788
|
).nullish()
|
|
797
789
|
}),
|
|
798
|
-
finish_reason:
|
|
799
|
-
index:
|
|
790
|
+
finish_reason: z3.string().nullish(),
|
|
791
|
+
index: z3.number()
|
|
800
792
|
})
|
|
801
793
|
),
|
|
802
794
|
usage: mistralUsageSchema.nullish()
|
|
803
795
|
});
|
|
804
796
|
|
|
805
797
|
// src/mistral-embedding-model.ts
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
798
|
+
import {
|
|
799
|
+
TooManyEmbeddingValuesForCallError
|
|
800
|
+
} from "@ai-sdk/provider";
|
|
801
|
+
import {
|
|
802
|
+
combineHeaders as combineHeaders2,
|
|
803
|
+
createJsonResponseHandler as createJsonResponseHandler2,
|
|
804
|
+
postJsonToApi as postJsonToApi2
|
|
805
|
+
} from "@ai-sdk/provider-utils";
|
|
806
|
+
import { z as z4 } from "zod/v4";
|
|
809
807
|
var MistralEmbeddingModel = class {
|
|
810
808
|
constructor(modelId, config) {
|
|
811
809
|
this.specificationVersion = "v4";
|
|
@@ -823,7 +821,7 @@ var MistralEmbeddingModel = class {
|
|
|
823
821
|
headers
|
|
824
822
|
}) {
|
|
825
823
|
if (values.length > this.maxEmbeddingsPerCall) {
|
|
826
|
-
throw new
|
|
824
|
+
throw new TooManyEmbeddingValuesForCallError({
|
|
827
825
|
provider: this.provider,
|
|
828
826
|
modelId: this.modelId,
|
|
829
827
|
maxEmbeddingsPerCall: this.maxEmbeddingsPerCall,
|
|
@@ -834,16 +832,16 @@ var MistralEmbeddingModel = class {
|
|
|
834
832
|
responseHeaders,
|
|
835
833
|
value: response,
|
|
836
834
|
rawValue
|
|
837
|
-
} = await (
|
|
835
|
+
} = await postJsonToApi2({
|
|
838
836
|
url: `${this.config.baseURL}/embeddings`,
|
|
839
|
-
headers: (
|
|
837
|
+
headers: combineHeaders2(this.config.headers(), headers),
|
|
840
838
|
body: {
|
|
841
839
|
model: this.modelId,
|
|
842
840
|
input: values,
|
|
843
841
|
encoding_format: "float"
|
|
844
842
|
},
|
|
845
843
|
failedResponseHandler: mistralFailedResponseHandler,
|
|
846
|
-
successfulResponseHandler: (
|
|
844
|
+
successfulResponseHandler: createJsonResponseHandler2(
|
|
847
845
|
MistralTextEmbeddingResponseSchema
|
|
848
846
|
),
|
|
849
847
|
abortSignal,
|
|
@@ -857,21 +855,21 @@ var MistralEmbeddingModel = class {
|
|
|
857
855
|
};
|
|
858
856
|
}
|
|
859
857
|
};
|
|
860
|
-
var MistralTextEmbeddingResponseSchema =
|
|
861
|
-
data:
|
|
862
|
-
usage:
|
|
858
|
+
var MistralTextEmbeddingResponseSchema = z4.object({
|
|
859
|
+
data: z4.array(z4.object({ embedding: z4.array(z4.number()) })),
|
|
860
|
+
usage: z4.object({ prompt_tokens: z4.number() }).nullish()
|
|
863
861
|
});
|
|
864
862
|
|
|
865
863
|
// src/version.ts
|
|
866
|
-
var VERSION = true ? "4.0.0-beta.
|
|
864
|
+
var VERSION = true ? "4.0.0-beta.22" : "0.0.0-test";
|
|
867
865
|
|
|
868
866
|
// src/mistral-provider.ts
|
|
869
867
|
function createMistral(options = {}) {
|
|
870
868
|
var _a;
|
|
871
|
-
const baseURL = (_a =
|
|
872
|
-
const getHeaders = () =>
|
|
869
|
+
const baseURL = (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : "https://api.mistral.ai/v1";
|
|
870
|
+
const getHeaders = () => withUserAgentSuffix(
|
|
873
871
|
{
|
|
874
|
-
Authorization: `Bearer ${
|
|
872
|
+
Authorization: `Bearer ${loadApiKey({
|
|
875
873
|
apiKey: options.apiKey,
|
|
876
874
|
environmentVariableName: "MISTRAL_API_KEY",
|
|
877
875
|
description: "Mistral"
|
|
@@ -909,15 +907,14 @@ function createMistral(options = {}) {
|
|
|
909
907
|
provider.textEmbedding = createEmbeddingModel;
|
|
910
908
|
provider.textEmbeddingModel = createEmbeddingModel;
|
|
911
909
|
provider.imageModel = (modelId) => {
|
|
912
|
-
throw new
|
|
910
|
+
throw new NoSuchModelError({ modelId, modelType: "imageModel" });
|
|
913
911
|
};
|
|
914
912
|
return provider;
|
|
915
913
|
}
|
|
916
914
|
var mistral = createMistral();
|
|
917
|
-
|
|
918
|
-
0 && (module.exports = {
|
|
915
|
+
export {
|
|
919
916
|
VERSION,
|
|
920
917
|
createMistral,
|
|
921
918
|
mistral
|
|
922
|
-
}
|
|
919
|
+
};
|
|
923
920
|
//# sourceMappingURL=index.js.map
|