generatetext
tool judged 30% likely a named technique or architecture
See how it has spread across media tiers
Mentions over time
Table view
| Week | Articles | Sources |
|---|---|---|
| 2024-W25 | 1 | 1 |
| 2024-W33 | 2 | 1 |
| 2024-W47 | 1 | 1 |
| 2025-W11 | 1 | 1 |
| 2026-W02 | 1 | 1 |
| 2026-W25 | 2 | 1 |
| 2026-W40 | 1 | 1 |
In their words
Here’s how the MCP client hands its tools straight to a single generateText call: import { generateText, stepCountIs } from 'ai' ; import { createMCPClient } from '@ai-sdk/mcp' ; const mcpClient = await createMCPClient({ transport : { type : 'http' , url : 'https://your-instance/mcp' }, }); const { text } = await generateText({ model, prompt : 'What did this customer ask about last time?' , tools
AI SDK 7 standardizes this with a reasoning option for generateText and streamText .
Develop Agents Provider-agnostic reasoning control : generateText and streamText now support a top-level reasoning option that maps to provider-native settings across OpenAI, Anthropic, Google, Groq, xAI, Bedrock, Fireworks, DeepSeek, Open Responses, and OpenAI-compatible providers.
import { generateText } from "ai"import { gateway } from "@ai-sdk/gateway"const result = await generateText({ model: "openai/gpt-5.2", tools: { perplexity_search: gateway.tools.perplexitySearch(), }, prompt: "What changed in Next.js this week?",})console.log(result.text) Some example use cases include: • Models without native search: Enable web search on models like zai/glm-4.7 or any from any oth
You can access the model’s reasoning tokens with the reasoning property: import { generateText } from 'ai';import { anthropic } from '@ai-sdk/anthropic';const { text, reasoning } = await generateText({ model: anthropic('claude-3-7-sonnet-20250219'), prompt: 'How many people will live in the world in 2040?',}); You can experiment with different models to find the best fit for your application.
Here’s an example with Anthropic’s Claude Sonnet 3.5 model: import { generateText } from 'ai';import { anthropic } from '@ai-sdk/anthropic';const result = await generateText({ model: anthropic('claude-3-5-sonnet-20241022'), messages: [ { role: 'user', content: [ { type: 'text', text: 'What is an embedding model according to this document?', }, { type: 'file', data: fs.readFileSync('./data/ai.pdf')
We went with generateText because we needed a singular text output in the form of a 3 character language code.
Integrating any model into your app with the AI SDK is just a few lines of code: import { generateText } from "ai";import { anthropic } from "@ai-sdk/anthropic";const { text } = await generateText({ model: anthropic("claude-3-5-sonnet-20240620"), prompt: "What is the best way to architect an AI application?",}); Copy link to headingThird-party, fine-tuning, or in-house models Depending on your use