Repository navigation
@tanstack/ai-grok@0.22.0
Minor Changes
-
#1739
a0150c2- Text adapters now set one stable code onRUN_ERRORwhen the input does not fit in the model's context window:code: 'context_overflow'.@tanstack/aiexports it asCONTEXT_OVERFLOW_CODE. The provider's own text stays inmessage.if (chunk.type === 'RUN_ERROR' && chunk.code === CONTEXT_OVERFLOW_CODE) { // shorten the messages, then call chat() again }
These adapters set it: OpenAI and the other OpenAI-compatible adapters (from
code: 'context_length_exceeded'), Anthropic, Gemini, Bedrock (Converse, Chat Completions, and Responses), OpenRouter, Grok, Cloudflare Workers AI, and BytePlus.Changes to code that reads the old values:
- OpenAI-compatible adapters gave
code: 'context_length_exceeded'. They now give'context_overflow'.rawEventstill has the provider's code. - Anthropic, Grok, OpenRouter, and BytePlus gave the HTTP status or a general bad-request code for this error. Gemini and Bedrock Converse gave no code.
- The Anthropic adapter now sends
RUN_ERRORwith this code when the model stops withstop_reason: 'model_context_window_exceeded'. Before, it sentRUN_FINISHEDwithfinishReason: 'stop', so a cut-off answer looked complete.
- OpenAI-compatible adapters gave
-
#1692
7532b2b- Set reasoning withchat({ reasoning }).- The adapter sends the level as
reasoning.effort, with a summary. - Each chat model has its reasoning data in
model-meta.ts.GrokModelReasoningByNameandGROK_MODEL_REASONINGcome from it.grok-build-0.1takes noreasoning, because the xAI API refuses it.
Breaking:
reasoningis no longer inmodelOptions.GrokReasoning,GrokReasoningEffort, andGrokBuildProviderOptionsare removed.// Before chat({ adapter: grokText('grok-4.3'), messages, modelOptions: { reasoning: { effort: 'high' } }, }) // After chat({ adapter: grokText('grok-4.3'), messages, reasoning: 'high' })
- The adapter sends the level as
Patch Changes
-
#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,b881627,412b0fe,a0150c2,20954cc,b881627,fac0555,6774e80,5bd27f2,c20f7b0,cef1911,51f72fb,6f1e559,eb4eea0,cef1911,7532b2b,7532b2b,1bfcee3,78edeb2,44e3a0a,7532b2b,ce99a17,7a5c0d6,b881627]:- @tanstack/ai@0.69.0
- @tanstack/openai-base@0.14.0
- @tanstack/ai-utils@0.4.2