@core-ai/mistral 0.15.0 → 0.16.0

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.
Files changed (2) hide show
  1. package/dist/index.js +24 -10
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -127,14 +127,16 @@ function convertUserContentPart(part) {
127
127
  };
128
128
  }
129
129
  function convertTools(tools) {
130
- return Object.values(tools).map((tool) => ({
131
- type: "function",
132
- function: {
133
- name: tool.name,
134
- description: tool.description,
135
- parameters: zodSchemaToJsonSchema(tool.parameters)
136
- }
137
- }));
130
+ return Object.values(tools).map(
131
+ (tool) => ({
132
+ type: "function",
133
+ function: {
134
+ name: tool.name,
135
+ description: tool.description,
136
+ parameters: zodSchemaToJsonSchema(tool.parameters)
137
+ }
138
+ })
139
+ );
138
140
  }
139
141
  function convertToolChoice(choice) {
140
142
  if (typeof choice === "string") {
@@ -235,6 +237,16 @@ function mapGenerateResponse(response) {
235
237
  usage: mapUsage(response.usage)
236
238
  };
237
239
  }
240
+ if (!firstChoice.message) {
241
+ return {
242
+ parts: [],
243
+ content: null,
244
+ reasoning: null,
245
+ toolCalls: [],
246
+ finishReason: mapFinishReason(firstChoice.finishReason),
247
+ usage: mapUsage(response.usage)
248
+ };
249
+ }
238
250
  const parts = extractAssistantParts(firstChoice.message);
239
251
  const toolCalls = parts.flatMap(
240
252
  (part) => part.type === "tool-call" ? [part.toolCall] : []
@@ -535,8 +547,10 @@ function toObject(value) {
535
547
  }
536
548
 
537
549
  // src/mistral-error.ts
538
- import { RequestAbortedError } from "@mistralai/mistralai/models/errors/httpclienterrors";
539
- import { MistralError } from "@mistralai/mistralai/models/errors";
550
+ import {
551
+ RequestAbortedError,
552
+ MistralError
553
+ } from "@mistralai/mistralai/models/errors";
540
554
  import { AbortedError, ProviderError } from "@core-ai/core-ai";
541
555
  function wrapMistralError(error) {
542
556
  if (error instanceof RequestAbortedError || error instanceof Error && error.name === "AbortError") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@core-ai/mistral",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Mistral provider package for @core-ai/core-ai",
5
5
  "license": "MIT",
6
6
  "author": "Omnifact (https://omnifact.ai)",
@@ -43,8 +43,8 @@
43
43
  "test:watch": "vitest"
44
44
  },
45
45
  "dependencies": {
46
- "@core-ai/core-ai": "^0.15.0",
47
- "@mistralai/mistralai": "^1.14.0"
46
+ "@core-ai/core-ai": "^0.16.0",
47
+ "@mistralai/mistralai": "^2.4.1"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "zod": "^4.0.0"