ai-sdk

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

AI SDK Documentation

AI SDK 文档

When you need up-to-date information about the AI SDK:
当你需要AI SDK的最新信息时:

If using ai@6.0.34 or above

如果你使用的是ai@6.0.34或更高版本

Search the bundled documentation and source code in
node_modules/ai/
:
  1. Documentation:
    grep "your query" node_modules/ai/docs/
  2. Source code:
    grep "your query" node_modules/ai/src/
To find specific files:
  • glob "node_modules/ai/docs/**/*.mdx"
    for documentation files
  • glob "node_modules/ai/src/**/*.ts"
    for source files
Provider packages (
@ai-sdk/openai
,
@ai-sdk/anthropic
, etc.) also include bundled docs in their respective
node_modules/@ai-sdk/<provider>/docs/
directories.
When in doubt, update to the latest version of the AI SDK.
node_modules/ai/
目录中搜索内置的文档和源代码:
  1. 文档
    grep "你的查询内容" node_modules/ai/docs/
  2. 源代码
    grep "你的查询内容" node_modules/ai/src/
查找特定文件:
  • glob "node_modules/ai/docs/**/*.mdx"
    用于查找文档文件
  • glob "node_modules/ai/src/**/*.ts"
    用于查找源文件
提供商包(如
@ai-sdk/openai
@ai-sdk/anthropic
等)在各自的
node_modules/@ai-sdk/<provider>/docs/
目录中也包含内置文档。
如有疑问,请更新至AI SDK的最新版本。

Otherwise

其他版本情况

  1. Search the docs:
    https://ai-sdk.dev/api/search-docs?q=your_query
  2. The response includes matches with links ending in
    .md
  3. Fetch those
    .md
    URLs directly to get plain text content (e.g.
    https://ai-sdk.dev/docs/agents/building-agents.md
    )
Use these resources for current API details, examples, and usage patterns.
For common errors and troubleshooting, see Common Errors Reference.
  1. 搜索文档:
    https://ai-sdk.dev/api/search-docs?q=你的查询内容
  2. 搜索结果包含以
    .md
    结尾的匹配链接
  3. 直接获取这些
    .md
    URL以获取纯文本内容(例如
    https://ai-sdk.dev/docs/agents/building-agents.md
利用这些资源获取当前的API细节、示例和使用模式。
关于常见错误和故障排查,请查看常见错误参考

Provider-Specific Information (ai@6.0.34+)

提供商专属信息(ai@6.0.34及以上版本)

For questions about specific providers (OpenAI, Anthropic, Google, etc.), search their dedicated packages:
  1. Provider documentation:
    grep "your query" node_modules/@ai-sdk/<provider>/docs/
  2. Provider source code:
    grep "your query" node_modules/@ai-sdk/<provider>/src/
To find provider files:
  • glob "node_modules/@ai-sdk/<provider>/docs/**/*.mdx"
    for provider documentation
  • glob "node_modules/@ai-sdk/<provider>/src/**/*.ts"
    for provider source files
This is especially important for
providerOptions
, which are provider-specific settings passed to model calls. Each provider has unique options documented in their package.
针对特定提供商(OpenAI、Anthropic、Google等)的问题,搜索其专属包:
  1. 提供商文档
    grep "你的查询内容" node_modules/@ai-sdk/<provider>/docs/
  2. 提供商源代码
    grep "你的查询内容" node_modules/@ai-sdk/<provider>/src/
查找提供商文件:
  • glob "node_modules/@ai-sdk/<provider>/docs/**/*.mdx"
    用于查找提供商文档
  • glob "node_modules/@ai-sdk/<provider>/src/**/*.ts"
    用于查找提供商源文件
这对于
providerOptions
尤为重要,它是传递给模型调用的提供商专属设置。每个提供商的包中都记录了其独有的配置选项。