@ai-sdk/mistral
Advanced tools
+9
-0
| # @ai-sdk/mistral | ||
| ## 4.0.15 | ||
| ### Patch Changes | ||
| - 21d2a2f: fix (mistral): preserve reasoning in multi-turn conversations | ||
| - Updated dependencies [1e2f324] | ||
| - @ai-sdk/provider@4.0.4 | ||
| - @ai-sdk/provider-utils@5.0.13 | ||
| ## 4.0.14 | ||
@@ -4,0 +13,0 @@ |
+11
-3
@@ -153,2 +153,4 @@ // src/mistral-provider.ts | ||
| let text = ""; | ||
| let hasReasoning = false; | ||
| const contentParts = []; | ||
| const toolCalls = []; | ||
@@ -159,2 +161,3 @@ for (const part of content) { | ||
| text += part.text; | ||
| contentParts.push({ type: "text", text: part.text }); | ||
| break; | ||
@@ -174,3 +177,8 @@ } | ||
| case "reasoning": { | ||
| text += part.text; | ||
| hasReasoning = true; | ||
| contentParts.push({ | ||
| type: "thinking", | ||
| thinking: [{ type: "text", text: part.text }], | ||
| closed: true | ||
| }); | ||
| break; | ||
@@ -187,3 +195,3 @@ } | ||
| role: "assistant", | ||
| content: text, | ||
| content: hasReasoning ? contentParts : text, | ||
| prefix: isLastMessage ? true : void 0, | ||
@@ -1094,3 +1102,3 @@ tool_calls: toolCalls.length > 0 ? toolCalls : void 0 | ||
| // src/version.ts | ||
| var VERSION = true ? "4.0.14" : "0.0.0-test"; | ||
| var VERSION = true ? "4.0.15" : "0.0.0-test"; | ||
@@ -1097,0 +1105,0 @@ // src/mistral-provider.ts |
+3
-3
| { | ||
| "name": "@ai-sdk/mistral", | ||
| "version": "4.0.14", | ||
| "version": "4.0.15", | ||
| "type": "module", | ||
@@ -32,4 +32,4 @@ "license": "Apache-2.0", | ||
| "dependencies": { | ||
| "@ai-sdk/provider": "4.0.3", | ||
| "@ai-sdk/provider-utils": "5.0.12" | ||
| "@ai-sdk/provider": "4.0.4", | ||
| "@ai-sdk/provider-utils": "5.0.13" | ||
| }, | ||
@@ -36,0 +36,0 @@ "devDependencies": { |
@@ -6,3 +6,6 @@ import { | ||
| } from '@ai-sdk/provider'; | ||
| import type { MistralPrompt } from './mistral-chat-prompt'; | ||
| import type { | ||
| MistralAssistantMessageContent, | ||
| MistralPrompt, | ||
| } from './mistral-chat-prompt'; | ||
| import { | ||
@@ -105,2 +108,4 @@ convertToBase64, | ||
| let text = ''; | ||
| let hasReasoning = false; | ||
| const contentParts: Array<MistralAssistantMessageContent> = []; | ||
| const toolCalls: Array<{ | ||
@@ -116,2 +121,3 @@ id: string; | ||
| text += part.text; | ||
| contentParts.push({ type: 'text', text: part.text }); | ||
| break; | ||
@@ -131,3 +137,8 @@ } | ||
| case 'reasoning': { | ||
| text += part.text; | ||
| hasReasoning = true; | ||
| contentParts.push({ | ||
| type: 'thinking', | ||
| thinking: [{ type: 'text', text: part.text }], | ||
| closed: true, | ||
| }); | ||
| break; | ||
@@ -145,3 +156,3 @@ } | ||
| role: 'assistant', | ||
| content: text, | ||
| content: hasReasoning ? contentParts : text, | ||
| prefix: isLastMessage ? true : undefined, | ||
@@ -148,0 +159,0 @@ tool_calls: toolCalls.length > 0 ? toolCalls : undefined, |
@@ -26,3 +26,3 @@ export type MistralPrompt = Array<MistralMessage>; | ||
| role: 'assistant'; | ||
| content: string; | ||
| content: string | Array<MistralAssistantMessageContent>; | ||
| prefix?: boolean; | ||
@@ -36,2 +36,10 @@ tool_calls?: Array<{ | ||
| export type MistralAssistantMessageContent = | ||
| | { type: 'text'; text: string } | ||
| | { | ||
| type: 'thinking'; | ||
| thinking: Array<{ type: 'text'; text: string }>; | ||
| closed: true; | ||
| }; | ||
| export interface MistralToolMessage { | ||
@@ -38,0 +46,0 @@ role: 'tool'; |
Sorry, the diff of this file is too big to display
226219
0.82%2769
0.95%+ Added
+ Added
- Removed
- Removed
Updated