Repository navigation
@tanstack/ai-openrouter@0.23.0
Minor Changes
-
#1775
85c2956- Structured output sendsresponse_format: { type: "json_object" }for OpenRouter and Groq models that declare a response format without strict structured outputs. These models reject strictjson_schema. In JSON mode the adapter adds the schema as a system prompt.await chat({ outputSchema })checks the reply when the schema is a Standard Schema, such as Zod. Other models keep strictjson_schema.modelOptionscan setjson_objectfor any model. On the OpenAI-base adapters (OpenAI, Grok, Groq and others), ajson_objectinmodelOptionswas replaced by strictjson_schema. It is now sent as given, with the schema in a system prompt. In JSON mode,supportsCombinedToolsAndSchema()returnsfalse. Tools and the schema then go out in separate requests, so the tool-calling turns do not get the schema prompt.OpenRouter catalog ids with a
:variant, such asgoogle/gemma-4-26b-a4b-it:free, now match their own catalog entry. Before, only the id without the variant was checked.
Patch Changes
-
#1750
3170517- Keep the provider's raw tool argument string for replay.- Adapters now send the raw argument string as
argsonTOOL_CALL_END. - The tool call in the history keeps that exact string when it is the same JSON value as the parsed input, so the next request sends the provider's own bytes back (for example
1.50, or an id pastNumber.MAX_SAFE_INTEGER). When the parsed input differs, only the changed values are written again. - The
TOOL_CALL_ENDthat reaches the client carries the same string inmetadata.tanstack.args, so the client history matches the server history. It no longer also carriesmetadata.tanstack.input: in-processchat()andStreamProcessorparseinputfromargs. Run the client and the server on the same release: an older client ignoresargs, so it builds the tool input from the streamed deltas only, and a tool call with no deltas (for example an Anthropic server tool) gets no input. - History converters for Bedrock and the Gemini Interactions API send malformed tool arguments as
{}instead of failing the request. - Gemini Interactions: the initial
step.argumentssnapshot goes out as aTOOL_CALL_ARGSdelta only when no argument deltas follow, so the deltas always add up to the final arguments. - Malformed tool arguments are no longer turned into
{}by an adapter. The tool gets a "Failed to parse tool arguments as JSON" error that the model can repair. Mistral still ends the run with an error on malformed arguments, as before.
- Adapters now send the raw argument string as
-
Updated dependencies [
1d0f8f1,1d0f8f1,5f95dbd,3170517,3292bad,3170517,4298480,f68da51,85c2956,30fa651,1d0f8f1,3170517,3170517]:- @tanstack/ai@0.70.0
- @tanstack/ai-utils@0.5.0