Loading...
Loading...
Capture API response test fixture.
npx skill4agent add vercel/ai capture-api-response-test-fixture__fixtures__packages/openai/src/responses/__fixtures__packages/openai/src/responses/__fixtures__packages/openai/src/responses/openai-responses-language-model.test.ts/examples/ai-functionsgenerateTextimport { openai } from '@ai-sdk/openai';
import { generateText } from 'ai';
import { run } from '../lib/run';
run(async () => {
const result = await generateText({
model: openai('gpt-5-nano'),
prompt: 'Invent a new holiday and describe its traditions.',
});
console.log(JSON.stringify(result.response.body, null, 2));
});streamTextincludeRawChunkstruesaveRawChunks/example/ai-functionspnpm tsx src/stream-text/script-name.ts/examples/ai-functions/outputimport { openai } from '@ai-sdk/openai';
import { streamText } from 'ai';
import { run } from '../lib/run';
import { saveRawChunks } from '../lib/save-raw-chunks';
run(async () => {
const result = streamText({
model: openai('gpt-5-nano'),
prompt: 'Invent a new holiday and describe its traditions.',
includeRawChunks: true,
});
await saveRawChunks({ result, filename: 'openai-gpt-5-nano' });
});