ai-sdk-model-manager

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

AI SDK Model Manager

AI SDK 模型管理器

This skill helps maintain AI SDK model configurations in the Tambo Cloud codebase. It automates the process of keeping model definitions up-to-date with the latest AI SDK releases.
该Skill用于维护Tambo Cloud代码库中的AI SDK模型配置,可自动完成模型定义与最新AI SDK版本同步的流程。

What This Skill Does

该Skill的功能

  1. Updates AI SDK Packages - Checks and updates @ai-sdk/openai, @ai-sdk/google, @ai-sdk/groq, and other provider packages to their latest versions
  2. Identifies Missing Models - Compares TypeScript definitions in the SDKs against configured models to find newly available models
  3. Researches Models - Gathers information about new models including capabilities, context windows, pricing, and use cases
  4. Prompts User - Asks which models to add before making changes
  5. Adds Models - Updates model configuration files with proper TypeScript types and metadata
  6. Updates Documentation - Updates relevant docs and README files to reflect new model availability
  1. 更新AI SDK包 - 检查并将@ai-sdk/openai、@ai-sdk/google、@ai-sdk/groq及其他供应商包更新至最新版本
  2. 识别缺失模型 - 对比SDK中的TypeScript定义与已配置模型,找出新增可用模型
  3. 调研模型信息 - 收集新模型的相关信息,包括功能、上下文窗口、定价及适用场景
  4. 询问用户 - 在做出更改前,询问用户需要添加哪些模型
  5. 添加模型 - 更新模型配置文件,确保包含正确的TypeScript类型和元数据
  6. 更新文档 - 更新相关文档和README文件,以反映新模型的可用情况

When to Use This Skill

使用场景

Use this skill when:
  • You want to check if AI SDK packages need updating
  • New models have been released by OpenAI, Google, Anthropic, or other providers
  • You're getting TypeScript errors about model IDs not being in SDK types
  • You want to ensure Tambo supports the latest models
在以下场景中使用该Skill:
  • 你需要检查AI SDK包是否需要更新
  • OpenAI、Google、Anthropic或其他供应商发布了新模型
  • 你遇到了关于模型ID不在SDK类型中的TypeScript错误
  • 你希望确保Tambo支持最新模型

Files This Skill Works With

涉及文件

  • packages/core/src/llms/models/*.ts
    - Model configuration files
  • packages/backend/package.json
    - AI SDK dependencies (source of truth for versions)
  • docs/content/docs/models/*.mdx
    - Model documentation
  • README.md
    - Main documentation file
  • packages/core/src/llms/models/*.ts
    - 模型配置文件
  • packages/backend/package.json
    - AI SDK依赖(版本的权威来源)
  • docs/content/docs/models/*.mdx
    - 模型文档
  • README.md
    - 主文档文件

Process

操作流程

Step 1: Update AI SDK Packages

步骤1:更新AI SDK包

Check current versions and update to latest:
bash
cd packages/backend
npm outdated | grep '@ai-sdk'
npm install @ai-sdk/openai@latest @ai-sdk/google@latest @ai-sdk/groq@latest @ai-sdk/anthropic@latest @ai-sdk/mistral@latest
检查当前版本并更新至最新:
bash
cd packages/backend
npm outdated | grep '@ai-sdk'
npm install @ai-sdk/openai@latest @ai-sdk/google@latest @ai-sdk/groq@latest @ai-sdk/anthropic@latest @ai-sdk/mistral@latest

Step 2: Identify Missing Models

步骤2:识别缺失模型

For each provider, inspect the TypeScript definitions:
bash
undefined
针对每个供应商,检查TypeScript定义:
bash
undefined

Check what models are in the SDK types

查看SDK类型中包含的模型

cat node_modules/@ai-sdk/openai/dist/index.d.ts | grep 'type.*ModelId' cat node_modules/@ai-sdk/google/dist/index.d.ts | grep 'type.*ModelId' cat node_modules/@ai-sdk/groq/dist/index.d.ts | grep 'type.*ModelId'

Compare against current model configurations in:

- `packages/core/src/llms/models/openai.ts`
- `packages/core/src/llms/models/gemini.ts`
- `packages/core/src/llms/models/groq.ts`
- `packages/core/src/llms/models/anthropic.ts`
- `packages/core/src/llms/models/mistral.ts`
cat node_modules/@ai-sdk/openai/dist/index.d.ts | grep 'type.*ModelId' cat node_modules/@ai-sdk/google/dist/index.d.ts | grep 'type.*ModelId' cat node_modules/@ai-sdk/groq/dist/index.d.ts | grep 'type.*ModelId'

与当前模型配置文件进行对比:

- `packages/core/src/llms/models/openai.ts`
- `packages/core/src/llms/models/gemini.ts`
- `packages/core/src/llms/models/groq.ts`
- `packages/core/src/llms/models/anthropic.ts`
- `packages/core/src/llms/models/mistral.ts`

Step 3: Research New Models

步骤3:调研新模型

Use the researcher subagent to gather information about each missing model:
Launch a researcher subagent to find:
- Official documentation link
- Model capabilities (reasoning, vision, function calling, etc.)
- Context window size (inputTokenLimit)
- Pricing tier
- Best use cases
- Release date and status (experimental, stable, deprecated)
The researcher subagent has access to web search and can efficiently gather this information for multiple models in parallel.
调用研究员子Agent收集每个缺失模型的信息:
启动研究员子Agent来获取以下信息:
- 官方文档链接
- 模型功能(推理、视觉、函数调用等)
- 上下文窗口大小(inputTokenLimit)
- 定价层级
- 最佳适用场景
- 发布日期及状态(实验性、稳定版、已弃用)
研究员子Agent支持网页搜索,可并行高效收集多个模型的上述信息。

Step 4: Prompt User

步骤4:询问用户

Present findings:
Found the following new models in updated AI SDK packages:

OpenAI:
- gpt-6-preview (200k context, experimental reasoning model)
- gpt-4.2-turbo (1M context, improved function calling)

Google:
- gemini-3.5-pro (2M context, advanced reasoning)

Which models would you like to add? (all/none/specific)
Wait for user response before proceeding.
展示调研结果:
在更新后的AI SDK包中发现以下新模型:

OpenAI:
- gpt-6-preview(20万上下文,实验性推理模型)
- gpt-4.2-turbo(100万上下文,函数调用能力提升)

Google:
- gemini-3.5-pro(200万上下文,高级推理能力)

你希望添加哪些模型?(全部/无/指定)
等待用户回复后再继续操作。

Step 5: Add Selected Models

步骤5:添加选定模型

Consider launching parallel subagents to add models to each provider file:
For models spread across multiple providers (OpenAI, Google, Groq), launch separate subagents to edit each file concurrently. This is faster than doing them sequentially.
For each model being added, ensure these required fields:
  • apiName
    : Exact model ID string from SDK
  • displayName
    : Human-friendly name
  • status
    : "untested" | "tested" | "known-issues"
  • notes
    : Brief description of capabilities and use cases
  • docLink
    : Official provider documentation URL
  • tamboDocLink
    : "https://docs.tambo.co"
  • inputTokenLimit
    : Context window size in tokens
  • modelSpecificParams
    : Any special parameters (reasoning, thinking, etc.)
Follow existing patterns in each file and ensure model IDs match SDK type definitions exactly.
Example:
typescript
"gpt-6-preview": {
  apiName: "gpt-6-preview",
  displayName: "gpt-6-preview",
  status: "untested",
  notes: "Experimental next-generation reasoning model with extended context",
  docLink: "https://platform.openai.com/docs/models/gpt-6-preview",
  tamboDocLink: "https://docs.tambo.co",
  inputTokenLimit: 200000,
  modelSpecificParams: reasoningParameters,
},
考虑启动并行子Agent来为每个供应商文件添加模型:
对于分布在多个供应商(OpenAI、Google、Groq)的模型,启动独立的子Agent同时编辑每个文件,这比按顺序处理更快。
对于每个要添加的模型,确保包含以下必填字段:
  • apiName
    : SDK中的精确模型ID字符串
  • displayName
    : 人性化名称
  • status
    : "untested" | "tested" | "known-issues"
  • notes
    : 功能及适用场景的简要描述
  • docLink
    : 供应商官方文档URL
  • tamboDocLink
    : "https://docs.tambo.co"
  • inputTokenLimit
    : 上下文窗口的token数量
  • modelSpecificParams
    : 特殊参数(推理、思考等)
遵循每个文件中的现有格式,确保模型ID与SDK类型定义完全匹配。
示例:
typescript
"gpt-6-preview": {
  apiName: "gpt-6-preview",
  displayName: "gpt-6-preview",
  status: "untested",
  notes: "具有扩展上下文的实验性下一代推理模型",
  docLink: "https://platform.openai.com/docs/models/gpt-6-preview",
  tamboDocLink: "https://docs.tambo.co",
  inputTokenLimit: 200000,
  modelSpecificParams: reasoningParameters,
},

Step 6: Verify TypeScript

步骤6:验证TypeScript

Run type checking to ensure all model IDs are valid:
bash
cd packages/core
npm run check-types
If there are type errors, fix model IDs to match SDK definitions exactly.
运行类型检查以确保所有模型ID有效:
bash
cd packages/core
npm run check-types
如果出现类型错误,修正模型ID使其与SDK定义完全匹配。

Step 7: Update Documentation

步骤7:更新文档

Consider using subagents to update documentation in parallel:
If updating multiple documentation files, launch parallel subagents to handle:
  1. README.md - Update the "Supported LLM Providers" section if new providers or significant models were added
  2. docs/content/docs/models/*.mdx - Add new models to appropriate documentation pages with:
    • Model name and description
    • Key capabilities
    • Context window
    • Example use cases
    • Links to provider docs
考虑使用并行子Agent来更新文档:
如果需要更新多个文档文件,启动并行子Agent分别处理:
  1. README.md - 如果添加了新供应商或重要模型,更新“支持的LLM供应商”章节
  2. docs/content/docs/models/*.mdx - 在对应文档页面添加新模型信息,包括:
    • 模型名称及描述
    • 核心功能
    • 上下文窗口
    • 示例适用场景
    • 供应商文档链接

Step 8: Run Quality Checks

步骤8:运行质量检查

Before completing:
bash
cd packages/core
npm run lint
npm run check-types
npm run test
完成前运行以下检查:
bash
cd packages/core
npm run lint
npm run check-types
npm run test

Step 9: Create Pull Request

步骤9:创建拉取请求

Create a PR with proper conventional commit format:
bash
gh pr create --title "feat(models): add [model names] support" --body "$(cat <<'EOF'
Updated AI SDK packages and added support for newly released models:

Models added:
- [list models here]

Package updates:
- @ai-sdk/openai: X.X.X → X.X.X
- @ai-sdk/groq: X.X.X → X.X.X

All type checks passing, documentation updated.
EOF
)"
PR title format:
feat(models): add [model names] support
Use
feat(models):
for new models or
deps(core):
for package updates only.
按照规范提交格式创建PR:
bash
gh pr create --title "feat(models): add [model names] support" --body "$(cat <<'EOF'
更新了AI SDK包并添加对新发布模型的支持:

新增模型:
- [在此列出模型]

包更新:
- @ai-sdk/openai: X.X.X → X.X.X
- @ai-sdk/groq: X.X.X → X.X.X

所有类型检查已通过,文档已更新。
EOF
)"
PR标题格式:
feat(models): add [model names] support
添加新模型使用
feat(models):
,仅更新包使用
deps(core):

Guidelines

指导原则

  • Use subagents for efficiency - Launch researcher subagents for gathering information and parallel subagents for editing multiple files
  • Always research before adding - Don't guess at model capabilities or context limits
  • Match SDK types exactly - Model IDs must match the TypeScript definitions in node_modules
  • Mark new models as "untested" - Let the team test before marking as "tested"
  • Include official doc links - Always link to provider's official documentation
  • Be conservative - Only add models the user explicitly approves
  • Update docs comprehensively - Don't just update code, update all relevant documentation
  • 使用子Agent提升效率 - 启动研究员子Agent收集信息,启动并行子Agent编辑多个文件
  • 添加前务必调研 - 不要猜测模型功能或上下文限制
  • 完全匹配SDK类型 - 模型ID必须与node_modules中的TypeScript定义一致
  • 新模型标记为"untested" - 待团队测试后再标记为"tested"
  • 包含官方文档链接 - 始终链接到供应商的官方文档
  • 保持谨慎 - 仅添加用户明确批准的模型
  • 全面更新文档 - 不仅更新代码,还要更新所有相关文档

Error Handling

错误处理

If you encounter:
  • Type errors after adding models - Double-check the model ID matches the SDK's TypeScript definition exactly
  • Missing model in SDK - The provider may not have released it yet, suggest waiting for next SDK update
  • Conflicting model names - Use the SDK's preferred naming convention
  • Unknown context limits - Research provider docs or mark as "unknown" and note it needs verification
如果遇到以下问题:
  • 添加模型后出现类型错误 - 再次检查模型ID是否与SDK的TypeScript定义完全匹配
  • SDK中缺失模型 - 供应商可能尚未发布该模型,建议等待下一次SDK更新
  • 模型名称冲突 - 使用SDK推荐的命名规范
  • 未知上下文限制 - 调研供应商文档,或标记为"unknown"并注明需要验证

Notes

注意事项

  • This skill should be run periodically (monthly or when new models are announced)
  • Always check the git diff before committing to ensure only intended changes were made
  • Some models may have special requirements (API access, pricing tier, etc.) - note these in the model's
    notes
    field
  • If a model is renamed in the SDK, update both the key and apiName, and consider adding a deprecation note to the old entry
  • 应定期运行该Skill(每月一次或在新模型发布时)
  • 提交前务必查看git diff,确保仅包含预期更改
  • 部分模型可能有特殊要求(API权限、定价层级等)- 在模型的
    notes
    字段中注明这些信息
  • 如果SDK中模型重命名,同时更新键名和apiName,并考虑在旧条目上添加弃用说明