Develop examples for AI SDK functions. Use when creating, running, or modifying examples under examples/ai-functions/src to validate provider support, demonstrate features, or create test fixtures.
View on GitHubFebruary 1, 2026
Select agents to install to:
npx add-skill https://github.com/vercel/ai/blob/47a970eb03eaba4c82172c419510df82fa1a4d15/skills/develop-ai-functions-example/SKILL.md -a claude-code --skill develop-ai-functions-exampleInstallation paths:
.claude/skills/develop-ai-functions-example/## AI Functions Examples
The `examples/ai-functions/` directory contains scripts for validating, testing, and iterating on AI SDK functions across providers.
## Example Categories
Examples are organized by AI SDK function in `examples/ai-functions/src/`:
| Directory | Purpose |
| ------------------ | ---------------------------------------------------- |
| `generate-text/` | Non-streaming text generation with `generateText()` |
| `stream-text/` | Streaming text generation with `streamText()` |
| `generate-object/` | Structured output generation with `generateObject()` |
| `stream-object/` | Streaming structured output with `streamObject()` |
| `agent/` | `ToolLoopAgent` examples for agentic workflows |
| `embed/` | Single embedding generation with `embed()` |
| `embed-many/` | Batch embedding generation with `embedMany()` |
| `generate-image/` | Image generation with `generateImage()` |
| `generate-speech/` | Text-to-speech with `generateSpeech()` |
| `transcribe/` | Audio transcription with `transcribe()` |
| `rerank/` | Document reranking with `rerank()` |
| `middleware/` | Custom middleware implementations |
| `registry/` | Provider registry setup and usage |
| `telemetry/` | OpenTelemetry integration |
| `complex/` | Multi-component examples (agents, routers) |
| `lib/` | Shared utilities (not examples) |
| `tools/` | Reusable tool definitions |
## File Naming Convention
Examples follow the pattern: `{provider}-{feature}.ts`
| Pattern | Example | Description |
| ---------------------------------------- | -----------