> **add-function-examples** — skill 1 of 12 in [vercel/ai](https://skillsdocs.com/vercel/ai).
>
> Book (all skills, one file): https://skillsdocs.com/vercel/ai.md
> Machine manifest: https://skillsdocs.com/vercel/ai/.well-known/agent-skills/index.json
> Install the book: `npx skills add vercel/ai`
> Upstream: https://github.com/vercel/ai/blob/main/skills/add-function-examples/SKILL.md @ `main`
> Raw bytes, no header: https://raw.githubusercontent.com/vercel/ai/main/skills/add-function-examples/SKILL.md
> Base for relative paths: https://raw.githubusercontent.com/vercel/ai/main/skills/add-function-examples/
> Licence: Other — https://github.com/vercel/ai
>
> Content © its authors, served unmodified. Takedown: https://github.com/DreambaseAI/skillsdocs/issues/new?labels=takedown&title=Takedown+request

<!-- Verbatim upstream SKILL.md follows, YAML frontmatter included. -->

---
name: add-function-examples
description: Guide for adding new AI function examples, for testing specific features against the actual provider APIs.
metadata:
  internal: true
---

## Adding Function Examples

Review the changes in the current branch, and identify new or modified features or bug fixes that would benefit from having an example in the `examples/ai-functions` directory. These examples are used for testing specific features against the actual provider APIs, and can also serve as documentation for users.

Determine for which kind of model and top-level function the example should be added. For a language model, the example should be added in two variants, one for `generateText` and one for `streamText`. For any other models kinds, add the example for the relevant top-level function (e.g. `generateImage`, `generateSpeech`).

After creating the example, run `pnpm type-check:full`; fix any errors encountered.
