Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions content/cookbook/00-guides/20-sonnet-3-7.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ At the center of the AI SDK is [AI SDK Core](/docs/ai-sdk-core/overview), which
import { anthropic } from '@ai-sdk/anthropic';
import { generateText } from 'ai';

const { text, reasoning, reasoningDetails } = await generateText({
const { text, reasoningText, reasoning } = await generateText({
model: anthropic('claude-3-7-sonnet-20250219'),
prompt: 'How many people will live in the world in 2040?',
});
Expand All @@ -53,7 +53,7 @@ Claude 3.7 Sonnet introduces a new extended thinking—the ability to solve comp
import { anthropic, AnthropicProviderOptions } from '@ai-sdk/anthropic';
import { generateText } from 'ai';

const { text, reasoning, reasoningDetails } = await generateText({
const { text, reasoningText, reasoning } = await generateText({
model: anthropic('claude-3-7-sonnet-20250219'),
prompt: 'How many people will live in the world in 2040?',
providerOptions: {
Expand All @@ -63,8 +63,8 @@ const { text, reasoning, reasoningDetails } = await generateText({
},
});

console.log(reasoning); // reasoning text
console.log(reasoningDetails); // reasoning details including redacted reasoning
console.log(reasoningText); // reasoning text
console.log(reasoning); // reasoning details including redacted reasoning
console.log(text); // text response
```

Expand Down
4 changes: 2 additions & 2 deletions content/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -983,13 +983,13 @@ To see `generateText` in action, check out [these examples](#examples).
description: 'The full text that has been generated.',
},
{
name: 'reasoning',
name: 'reasoningText',
type: 'string | undefined',
description:
'The reasoning text of the model (only available for some models).',
},
{
name: 'reasoningDetails',
name: 'reasoning',
type: 'Array<ReasoningDetail>',
description:
'The reasoning details of the model (only available for some models).',
Expand Down
4 changes: 2 additions & 2 deletions content/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ To see `streamText` in action, check out [these examples](#examples).
description: 'The full text that has been generated.',
},
{
name: 'reasoning',
name: 'reasoningText',
type: 'string | undefined',
description:
'The reasoning text of the model (only available for some models).',
Expand Down Expand Up @@ -1314,7 +1314,7 @@ To see `streamText` in action, check out [these examples](#examples).
'The reasoning text of the model (only available for some models).',
},
{
name: 'reasoningDetails',
name: 'reasoning',
type: 'Array<ReasoningDetail>',
description:
'The reasoning details of the model (only available for some models).',
Expand Down
6 changes: 3 additions & 3 deletions content/providers/01-ai-sdk-providers/05-anthropic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ and specifying a thinking budget in tokens.
import { anthropic, AnthropicProviderOptions } from '@ai-sdk/anthropic';
import { generateText } from 'ai';

const { text, reasoning, reasoningDetails } = await generateText({
const { text, reasoningText, reasoning } = await generateText({
model: anthropic('claude-opus-4-20250514'),
prompt: 'How many people will live in the world in 2040?',
providerOptions: {
Expand All @@ -200,8 +200,8 @@ const { text, reasoning, reasoningDetails } = await generateText({
},
});

console.log(reasoning); // reasoning text
console.log(reasoningDetails); // reasoning details including redacted reasoning
console.log(reasoningText); // reasoning text
console.log(reasoning); // reasoning details including redacted reasoning
console.log(text); // text response
```

Expand Down
4 changes: 2 additions & 2 deletions content/providers/01-ai-sdk-providers/08-amazon-bedrock.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ const anthropicResult = await generateText({
},
});

console.log(anthropicResult.reasoning); // reasoning text
console.log(anthropicResult.reasoningText); // reasoning text
console.log(anthropicResult.text); // text response

// Nova 2 example
Expand All @@ -450,7 +450,7 @@ const amazonResult = await generateText({
},
});

console.log(amazonResult.reasoning); // reasoning text
console.log(amazonResult.reasoningText); // reasoning text
console.log(amazonResult.text); // text response
```

Expand Down
14 changes: 7 additions & 7 deletions content/providers/01-ai-sdk-providers/16-google-vertex.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ import { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google'; // Note: imp
import { generateText, streamText } from 'ai';

// For generateText:
const { text, reasoning, reasoningDetails } = await generateText({
const { text, reasoningText, reasoning } = await generateText({
model: vertex('gemini-2.0-flash-001'), // Or other supported model via Vertex
providerOptions: {
google: {
Expand All @@ -408,8 +408,8 @@ const { text, reasoning, reasoningDetails } = await generateText({
prompt: 'Explain quantum computing in simple terms.',
});

console.log('Reasoning:', reasoning);
console.log('Reasoning Details:', reasoningDetails);
console.log('Reasoning:', reasoningText);
console.log('Reasoning Details:', reasoning);
console.log('Final Text:', text);

// For streamText:
Expand Down Expand Up @@ -438,7 +438,7 @@ for await (const part of result.fullStream) {

When `includeThoughts` is true, parts of the API response marked with `thought: true` will be processed as reasoning.

- In `generateText`, these contribute to the `reasoning` (string) and `reasoningDetails` (array) fields.
- In `generateText`, these contribute to the `reasoningText` (string) and `reasoning` (array) fields.
- In `streamText`, these are emitted as `reasoning` stream parts.

<Note>
Expand Down Expand Up @@ -970,7 +970,7 @@ and specifying a thinking budget in tokens.
import { vertexAnthropic } from '@ai-sdk/google-vertex/anthropic';
import { generateText } from 'ai';

const { text, reasoning, reasoningDetails } = await generateText({
const { text, reasoningText, reasoning } = await generateText({
model: vertexAnthropic('claude-3-7-sonnet@20250219'),
prompt: 'How many people will live in the world in 2040?',
providerOptions: {
Expand All @@ -980,8 +980,8 @@ const { text, reasoning, reasoningDetails } = await generateText({
},
});

console.log(reasoning); // reasoning text
console.log(reasoningDetails); // reasoning details including redacted reasoning
console.log(reasoningText); // reasoning text
console.log(reasoning); // reasoning details including redacted reasoning
console.log(text); // text response
```

Expand Down
Loading