@@ -21,7 +21,7 @@ import { chat } from "@tanstack/ai";
2121import { openaiText } from " @tanstack/ai-openai" ;
2222
2323const stream = chat ({
24- adapter: openaiText (" gpt-4o " ),
24+ adapter: openaiText (" gpt-5.2 " ),
2525 messages: [{ role: " user" , content: " Hello!" }],
2626 tools: [myTool ],
2727 systemPrompts: [" You are a helpful assistant" ],
@@ -31,7 +31,7 @@ const stream = chat({
3131
3232### Parameters
3333
34- - ` adapter ` - An AI adapter instance with model (e.g., ` openaiText('gpt-4o ') ` , ` anthropicText('claude-sonnet-4-5') ` )
34+ - ` adapter ` - An AI adapter instance with model (e.g., ` openaiText('gpt-5.2 ') ` , ` anthropicText('claude-sonnet-4-5') ` )
3535- ` messages ` - Array of chat messages
3636- ` tools? ` - Array of tools for function calling
3737- ` systemPrompts? ` - System prompts to prepend to messages
@@ -52,7 +52,7 @@ import { summarize } from "@tanstack/ai";
5252import { openaiSummarize } from " @tanstack/ai-openai" ;
5353
5454const result = await summarize ({
55- adapter: openaiSummarize (" gpt-4o " ),
55+ adapter: openaiSummarize (" gpt-5.2 " ),
5656 text: " Long text to summarize..." ,
5757 maxLength: 100 ,
5858 style: " concise" ,
@@ -99,7 +99,7 @@ const myClientTool = myToolDef.client(async ({ param }) => {
9999
100100// Use directly in chat() (server-side, no execute)
101101chat ({
102- adapter: openaiText (" gpt-4o " ),
102+ adapter: openaiText (" gpt-5.2 " ),
103103 tools: [myToolDef ],
104104 messages: [{ role: " user" , content: " ..." }],
105105});
@@ -112,7 +112,7 @@ const myServerTool = myToolDef.server(async ({ param }) => {
112112
113113// Use directly in chat() (server-side, no execute)
114114chat ({
115- adapter: openaiText (" gpt-4o " ),
115+ adapter: openaiText (" gpt-5.2 " ),
116116 tools: [myServerTool ],
117117 messages: [{ role: " user" , content: " ..." }],
118118});
@@ -140,7 +140,7 @@ import { chat, toServerSentEventsStream } from "@tanstack/ai";
140140import { openaiText } from " @tanstack/ai-openai" ;
141141
142142const stream = chat ({
143- adapter: openaiText (" gpt-4o " ),
143+ adapter: openaiText (" gpt-5.2 " ),
144144 messages: [... ],
145145});
146146const readableStream = toServerSentEventsStream (stream );
@@ -167,7 +167,7 @@ import { chat, toServerSentEventsResponse } from "@tanstack/ai";
167167import { openaiText } from " @tanstack/ai-openai" ;
168168
169169const stream = chat ({
170- adapter: openaiText (" gpt-4o " ),
170+ adapter: openaiText (" gpt-5.2 " ),
171171 messages: [... ],
172172});
173173return toServerSentEventsResponse (stream );
@@ -191,7 +191,7 @@ import { chat, maxIterations } from "@tanstack/ai";
191191import { openaiText } from " @tanstack/ai-openai" ;
192192
193193const stream = chat ({
194- adapter: openaiText (" gpt-4o " ),
194+ adapter: openaiText (" gpt-5.2 " ),
195195 messages: [... ],
196196 agentLoopStrategy: maxIterations (20 ),
197197});
@@ -274,21 +274,21 @@ import {
274274
275275// --- Streaming chat
276276const stream = chat ({
277- adapter: openaiText (" gpt-4o " ),
277+ adapter: openaiText (" gpt-5.2 " ),
278278 messages: [{ role: " user" , content: " Hello!" }],
279279});
280280
281281// --- One-shot chat response (stream: false)
282282const response = await chat ({
283- adapter: openaiText (" gpt-4o " ),
283+ adapter: openaiText (" gpt-5.2 " ),
284284 messages: [{ role: " user" , content: " What's the capital of France?" }],
285285 stream: false , // Returns a Promise<string> instead of AsyncIterable
286286});
287287
288288// --- Structured response with outputSchema
289289import { z } from " zod" ;
290290const parsed = await chat ({
291- adapter: openaiText (" gpt-4o " ),
291+ adapter: openaiText (" gpt-5.2 " ),
292292 messages: [{ role: " user" , content: " Summarize this text in JSON with keys 'summary' and 'keywords': ... " }],
293293 outputSchema: z .object ({
294294 summary: z .string (),
@@ -310,7 +310,7 @@ const weatherTool = toolDefinition({
310310});
311311
312312const toolResult = await chat ({
313- adapter: openaiText (" gpt-4o " ),
313+ adapter: openaiText (" gpt-5.2 " ),
314314 messages: [
315315 { role: " user" , content: " What's the weather in Paris?" }
316316 ],
@@ -326,7 +326,7 @@ const toolResult = await chat({
326326
327327// --- Summarization
328328const summary = await summarize ({
329- adapter: openaiSummarize (" gpt-4o " ),
329+ adapter: openaiSummarize (" gpt-5.2 " ),
330330 text: " Long text to summarize..." ,
331331 maxLength: 100 ,
332332});
0 commit comments