diff --git a/examples/ai-core/src/generate-text/openai-responses-reasoning-summary.ts b/examples/ai-core/src/generate-text/openai-responses-reasoning-summary.ts deleted file mode 100644 index a6f3a2b55d3f..000000000000 --- a/examples/ai-core/src/generate-text/openai-responses-reasoning-summary.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { openai, OpenAIResponsesProviderOptions } from '@ai-sdk/openai'; -import { generateText } from 'ai'; -import 'dotenv/config'; - -async function main() { - const result = await generateText({ - // supported: o4-mini, o3, o3-mini and o1 - model: openai.responses('o3-mini'), - prompt: - 'Tell me about the debate over Taqueria La Cumbre and El Farolito and who created the San Francisco Mission-style burrito.', - providerOptions: { - openai: { - // https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries - reasoningSummary: 'auto', // auto gives you the best available summary (detailed > auto > None) - } satisfies OpenAIResponsesProviderOptions, - }, - }); - - process.stdout.write('\x1b[34m'); - console.log(JSON.stringify(result.reasoning, null, 2)); - process.stdout.write('\x1b[0m'); - console.log(result.text); - console.log(); - console.log('Finish reason:', result.finishReason); - console.log('Usage:', result.usage); - console.log(); - console.log('Request body:', JSON.stringify(result.request.body, null, 2)); - console.log('Response body:', JSON.stringify(result.response.body, null, 2)); -} - -main().catch(console.error); diff --git a/examples/ai-core/src/generate-text/openai-responses-reasoning-websearch.ts b/examples/ai-core/src/generate-text/openai-responses-reasoning-websearch.ts deleted file mode 100644 index 6f9962fb845e..000000000000 --- a/examples/ai-core/src/generate-text/openai-responses-reasoning-websearch.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { openai } from '@ai-sdk/openai'; -import { generateText } from 'ai'; -import 'dotenv/config'; - -async function main() { - const result = await generateText({ - model: openai.responses('gpt-5-mini'), - prompt: 'What happened in the world today?', - providerOptions: { - openai: { reasoningSummary: 'detailed', reasoningEffort: 'medium' }, - }, - tools: { - web_search: openai.tools.webSearch(), - }, - }); - - console.log(JSON.stringify(result.response?.messages, null, 2)); - - const result2 = await generateText({ - model: openai.responses('gpt-5-mini'), - messages: [ - ...result.response?.messages, - { role: 'user', content: 'Summarize in 2 sentences.' }, - ], - }); - - console.log(JSON.stringify(result2, null, 2)); -} - -main().catch(console.error); diff --git a/examples/ai-core/src/generate-text/openai-responses-reasoning-zero-data-retention.ts b/examples/ai-core/src/generate-text/openai-responses-reasoning-zero-data-retention.ts deleted file mode 100644 index d7b3280eab06..000000000000 --- a/examples/ai-core/src/generate-text/openai-responses-reasoning-zero-data-retention.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { openai, OpenAIResponsesProviderOptions } from '@ai-sdk/openai'; -import { generateText, UserModelMessage } from 'ai'; -import 'dotenv/config'; - -async function main() { - const result1 = await generateText({ - model: openai.responses('o3-mini'), - prompt: - 'Analyze the following encrypted data: U2VjcmV0UGFzc3dvcmQxMjM=. What type of encryption is this and what secret does it contain?', - providerOptions: { - openai: { - store: false, // No data retention - makes interaction stateless - reasoningEffort: 'medium', - reasoningSummary: 'auto', - include: ['reasoning.encrypted_content'], // Hence, we need to retrieve the model's encrypted reasoning to be able to pass it to follow-up requests - } satisfies OpenAIResponsesProviderOptions, - }, - }); - console.log('=== First request ==='); - process.stdout.write('\x1b[34m'); - console.log(JSON.stringify(result1.reasoning, null, 2)); - process.stdout.write('\x1b[0m'); - console.log(result1.text); - console.log(); - console.log('Finish reason:', result1.finishReason); - console.log('Usage:', result1.usage); - console.log(); - console.log('Request body:', JSON.stringify(result1.request.body, null, 2)); - console.log('Response body:', JSON.stringify(result1.response.body, null, 2)); - - const result2 = await generateText({ - model: openai.responses('o3-mini'), - prompt: [ - { - role: 'user', - content: [ - { - type: 'text', - text: 'Analyze the following encrypted data: U2VjcmV0UGFzc3dvcmQxMjM=. What type of encryption is this and what secret does it contain?', - }, - ], - }, - ...result1.response.messages, // Need to pass all previous messages to the follow-up request - { - role: 'user', - content: - 'Based on your previous analysis, what security recommendations would you make?', - } satisfies UserModelMessage, - ], - providerOptions: { - openai: { - store: false, // No data retention - makes interaction stateless - reasoningEffort: 'medium', - reasoningSummary: 'auto', - include: ['reasoning.encrypted_content'], // Hence, we need to retrieve the model's encrypted reasoning to be able to pass it to follow-up requests - } satisfies OpenAIResponsesProviderOptions, - }, - }); - - console.log('=== Second request ==='); - process.stdout.write('\x1b[34m'); - console.log(JSON.stringify(result2.reasoning, null, 2)); - process.stdout.write('\x1b[0m'); - console.log(result2.text); - console.log(); - console.log('Finish reason:', result2.finishReason); - console.log('Usage:', result2.usage); - console.log(); - console.log('Request body:', JSON.stringify(result2.request.body, null, 2)); - console.log('Response body:', JSON.stringify(result2.response.body, null, 2)); -} - -main().catch(console.error); diff --git a/examples/ai-core/src/generate-text/openai-responses-reasoning.ts b/examples/ai-core/src/generate-text/openai-responses-reasoning.ts deleted file mode 100644 index b6c93c1cf92c..000000000000 --- a/examples/ai-core/src/generate-text/openai-responses-reasoning.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { openai, OpenAIResponsesProviderOptions } from '@ai-sdk/openai'; -import { generateText } from 'ai'; -import 'dotenv/config'; - -async function main() { - const result = await generateText({ - model: openai.responses('o3-mini'), - prompt: 'How many "r"s are in the word "strawberry"?', - temperature: 0.5, // should get ignored (warning) - providerOptions: { - openai: { - reasoningEffort: 'low', - } satisfies OpenAIResponsesProviderOptions, - }, - }); - - process.stdout.write('\x1b[34m'); - console.log(JSON.stringify(result.reasoning, null, 2)); - process.stdout.write('\x1b[0m'); - console.log(result.text); - console.log(); - console.log('Finish reason:', result.finishReason); - console.log('Usage:', result.usage); - console.log(); - console.log('Request:', JSON.stringify(result.request, null, 2)); - console.log('Response:', JSON.stringify(result.response, null, 2)); -} - -main().catch(console.error); diff --git a/examples/ai-core/src/stream-text/openai-5-reasoning.ts b/examples/ai-core/src/stream-text/openai-5-reasoning.ts deleted file mode 100644 index edd5e7ea12d5..000000000000 --- a/examples/ai-core/src/stream-text/openai-5-reasoning.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { openai } from '@ai-sdk/openai'; -import { streamText } from 'ai'; -import 'dotenv/config'; -import { z } from 'zod'; -import { weatherTool } from '../tools/weather-tool'; - -async function main() { - const result = streamText({ - model: openai('gpt-5'), - tools: { - weather: weatherTool, - cityAttractions: { - inputSchema: z.object({ city: z.string() }), - }, - }, - prompt: 'What is the weather in San Francisco?', - }); - - for await (const part of result.fullStream) { - switch (part.type) { - case 'text-delta': { - console.log('Text:', part.text); - break; - } - - case 'tool-call': { - if (part.dynamic) { - continue; - } - - switch (part.toolName) { - case 'cityAttractions': { - console.log('TOOL CALL cityAttractions'); - console.log(`city: ${part.input.city}`); // string - break; - } - - case 'weather': { - console.log('TOOL CALL weather'); - console.log(`location: ${part.input.location}`); // string - break; - } - } - - break; - } - - case 'tool-result': { - if (part.dynamic) { - continue; - } - - switch (part.toolName) { - // NOT AVAILABLE (NO EXECUTE METHOD) - // case 'cityAttractions': { - // console.log('TOOL RESULT cityAttractions'); - // console.log(`city: ${part.input.city}`); // string - // console.log(`result: ${part.result}`); - // break; - // } - - case 'weather': { - console.log('TOOL RESULT weather'); - console.log(`location: ${part.input.location}`); // string - console.log(`temperature: ${part.output.temperature}`); // number - break; - } - } - - break; - } - - case 'finish': { - console.log('Finish reason:', part.finishReason); - console.log('Total Usage:', part.totalUsage); - break; - } - - case 'error': - console.error('Error:', part.error); - break; - } - } -} - -main().catch(console.error); diff --git a/examples/ai-core/src/stream-text/openai-responses-reasoning.ts b/examples/ai-core/src/stream-text/openai-responses-reasoning.ts deleted file mode 100644 index 463a8daaba89..000000000000 --- a/examples/ai-core/src/stream-text/openai-responses-reasoning.ts +++ /dev/null @@ -1,21 +0,0 @@ -import 'dotenv/config'; -import { openai } from '@ai-sdk/openai'; -import { streamText } from 'ai'; - -async function main() { - const result = streamText({ - model: openai.responses('o3-mini'), - system: 'You are a helpful assistant.', - prompt: 'Invent a new holiday and describe its traditions.', - }); - - for await (const textPart of result.textStream) { - process.stdout.write(textPart); - } - - console.log(); - console.log('Finish reason:', await result.finishReason); - console.log('Usage:', await result.usage); -} - -main().catch(console.error);