Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Explains how to create, run, and modify AI SDK examples in examples/ai-functions/src that validate providers and demonstrate features.
18% 100%+82 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 4 of 22 without it.
3 of 3 safety checks passed
Not used yet
The examples/ai-functions/ directory contains reusable scripts for validating, testing, and iterating on AI SDK functions across providers. Place examples under examples/ai-functions/src/<function>/<provider>/. Reproduction-only scripts belong only in the PR description's End-to-End Verification section and must never be committed; see Bug Reproductions.
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 |
Group examples by function and provider. Name the entry example basic.ts and use descriptive kebab-case.ts names for additional examples:
| Pattern | Example | Description |
|---|---|---|
<function>/<provider>/basic.ts | generate-text/openai/basic.ts | Basic provider usage |
<function>/<provider>/<feature>.ts | stream-text/openai/tool-call.ts | Specific feature |
<function>/<provider>/<sub-provider>.ts | stream-text/amazon-bedrock/anthropic.ts | Provider with sub-provider |
<function>/<provider>/<sub-provider>-<feature>.ts | stream-text/google/vertex-anthropic-cache-control.ts | Sub-provider with feature |
Do not create flat provider files such as generate-text/openai.ts.
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.