Repository navigation
@tanstack/ai-mistral@0.7.0
Minor Changes
-
#1697
cef1911- Prompt caching is now on by default. Eachchat()call asks the provider to cache the stable start of the request (system prompt, tools, and earlier messages), so repeated requests cost less and answer sooner.- New
chat()optionpromptCache:'none' | 'short' | 'long', or{ retention, key }. The default is'short'. The key ispromptCache.key, else thethreadIdorconversationIdthat you give. AthreadIdthatchat()makes up is never the key. - To turn it off, pass
promptCache: 'none'. Do this for a large prompt that you send to Claude one time only, because Claude bills the cache write. - A middleware can change it for the next model call:
onConfiggetsconfig.promptCacheand can return a new value. - Each adapter sends its own fields:
- Claude on Anthropic, Bedrock Converse, and OpenRouter gets cache markers.
'long'asks for the 1-hour TTL. - OpenAI (Responses and Chat Completions) gets
prompt_cache_key, andprompt_cache_retentionorprompt_cache_optionson'long'. - Mistral gets
prompt_cache_key, and usage now reports cache reads. - OpenRouter gets
sessionId.
- Claude on Anthropic, Bedrock Converse, and OpenRouter gets cache markers.
- A manual
cache_control,cachePoint,prompt_cache_key, orsessionIdwins over the automatic value. - New types:
PromptCacheRetention,PromptCacheOptions, andResolvedPromptCache. Adapters readTextOptions.promptCache.
- New
-
#1692
7532b2b- Set reasoning withchat({ reasoning }).- Mistral Small and Mistral Medium get
reasoning_effort, andnoneforoff. - Magistral gets
prompt_mode: 'reasoning'.offsends nothing. - Each chat model has its reasoning data in
model-meta.ts.MistralModelReasoningByNameandMISTRAL_MODEL_REASONINGcome from it.
Breaking: none. The adapter had no reasoning option before.
chat({ adapter: mistralText('mistral-small-latest'), messages, reasoning: 'high', })
- Mistral Small and Mistral Medium get
Patch Changes
-
#1732
eb4eea0- Keep a schema property or a tool argument named__proto__. Before this fix, code that copied it without[key] = valuewent to the__proto__setter instead, so the key was lost.@tanstack/ai-utils:transformNullsToUndefinedandundoNullWideningkeep the key.@tanstack/openai-base: the strict schema and its null-widening map keep the key.@tanstack/ai-mistral: the null-widening map keeps the key.@tanstack/ai-openrouter: the Responses tool input normalizer keeps the key.@tanstack/ai-gemini: the Interactions adapter keeps the key in tool parameters.@tanstack/ai-bedrock: the Converse adapter puts the tool schemas and tool inputs back into the request body after the AWS SDK serializes it, because the SDK drops the key.
-
#1698
1bfcee3- Keep a conversation valid when the next request goes to a different model.- Each assistant message records
metadata.tanstack.source({ provider, api, model }), andresponseIdand the resolvedmodelwhen the provider sends them. A failed or aborted answer getsstopReason: 'error'or'aborted'.RUN_FINISHEDhas a newresponseIdfield.TextAdapterhas new optionalproviderandapifields. - When the next request goes to a different source, the adapter removes signatures and redacted thinking, turns readable thinking into text, and rewrites tool call IDs to the shape the target API accepts. Each call stays paired with its result.
- Every request drops failed and aborted assistant batches and adds a
No result providedresult for an unanswered tool call. The saved history does not change. RUN_FINISHEDandRUN_ERRORmetadata now merge onto the assistant messages of that model call inStreamProcessor.- Anthropic: the new
allowEmptySignatureoption (defaultfalse) replays unsigned thinking from the same source, for gateways. The newprovideroption names a gateway. - Azure OpenAI reports the
azure-openai-responsesAPI. - Gemini, Mistral, and Bedrock Converse send same-source thinking back to the model, in block order.
withPersistencewrites the source and the stop reason onto streaming snapshot rows.- Adapter authors get
transformMessagesForReplay()andhashToolCallId()from@tanstack/ai/adapter-internals.
- Each assistant message records
-
#1692
7532b2b- Sendchat({ toolChoice })to each provider.- Anthropic and Bedrock Converse. Claude Fable 5.1, Mythos 5.1, Opus 5.5, and Sonnet 5.5 reject a forced tool, and every Claude model rejects one while thinking is on. On those,
'required'and a named tool fall back toauto. - Bedrock Converse has no
none.'none'sends no tool config. Bedrock refuses tool calls in the history without a tool config, so the history goes out as text. - Gemini maps the choice to
functionCallingConfig(AUTO,NONE,ANY, andallowedFunctionNames). With only provider tools, such as Google Search, it sends no tool config. - OpenAI and Azure OpenAI (Responses), Grok, Mistral, and OpenRouter (Chat Completions and Responses) send their own
tool_choiceshape.
- Anthropic and Bedrock Converse. Claude Fable 5.1, Mythos 5.1, Opus 5.5, and Sonnet 5.5 reject a forced tool, and every Claude model rejects one while thinking is on. On those,
-
Updated dependencies [
1bfcee3,412b0fe,a0150c2,b881627,fac0555,6774e80,5bd27f2,c20f7b0,cef1911,51f72fb,6f1e559,eb4eea0,cef1911,7532b2b,1bfcee3,78edeb2,44e3a0a,7532b2b,7a5c0d6,b881627]:- @tanstack/ai@0.69.0
- @tanstack/ai-utils@0.4.2