├── .changeset
├── README.md
└── config.json
├── .eslintrc.js
├── .github
├── ISSUE_TEMPLATE
│ ├── 1.support_request.yml
│ └── config.yml
├── SECURITY.md
├── pull_request_template.md
├── scripts
│ └── cleanup-examples-changesets.mjs
└── workflows
│ ├── actions
│ └── verify-changesets
│ │ ├── index.js
│ │ ├── package.json
│ │ └── test.js
│ ├── assign-team-pull-request.yml
│ ├── ci.yml
│ ├── quality.yml
│ ├── release-snapshot.yml
│ ├── release.yml
│ └── verify-changesets.yml
├── .gitignore
├── .kodiak.toml
├── .npmrc
├── .prettierignore
├── .vscode
└── settings.json
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── assets
└── hero.gif
├── content
├── cookbook
│ ├── 01-next
│ │ ├── 10-generate-text.mdx
│ │ ├── 11-generate-text-with-chat-prompt.mdx
│ │ ├── 12-generate-image-with-chat-prompt.mdx
│ │ ├── 120-stream-assistant-response.mdx
│ │ ├── 121-stream-assistant-response-with-tools.mdx
│ │ ├── 122-caching-middleware.mdx
│ │ ├── 20-stream-text.mdx
│ │ ├── 21-stream-text-with-chat-prompt.mdx
│ │ ├── 22-stream-text-with-image-prompt.mdx
│ │ ├── 23-chat-with-pdf.mdx
│ │ ├── 24-stream-text-multistep.mdx
│ │ ├── 25-markdown-chatbot-with-memoization.mdx
│ │ ├── 30-generate-object.mdx
│ │ ├── 31-generate-object-with-file-prompt.mdx
│ │ ├── 40-stream-object.mdx
│ │ ├── 70-call-tools.mdx
│ │ ├── 71-call-tools-in-parallel.mdx
│ │ ├── 72-call-tools-multiple-steps.mdx
│ │ ├── 73-mcp-tools.mdx
│ │ ├── 75-human-in-the-loop.mdx
│ │ ├── 80-send-custom-body-from-use-chat.mdx
│ │ ├── 90-render-visual-interface-in-chat.mdx
│ │ └── index.mdx
│ ├── 05-node
│ │ ├── 10-generate-text.mdx
│ │ ├── 100-retrieval-augmented-generation.mdx
│ │ ├── 11-generate-text-with-chat-prompt.mdx
│ │ ├── 12-generate-text-with-image-prompt.mdx
│ │ ├── 20-stream-text.mdx
│ │ ├── 21-stream-text-with-chat-prompt.mdx
│ │ ├── 22-stream-text-with-image-prompt.mdx
│ │ ├── 23-stream-text-with-file-prompt.mdx
│ │ ├── 30-generate-object-reasoning.mdx
│ │ ├── 30-generate-object.mdx
│ │ ├── 40-stream-object.mdx
│ │ ├── 41-stream-object-with-image-prompt.mdx
│ │ ├── 45-stream-object-record-token-usage.mdx
│ │ ├── 46-stream-object-record-final-object.mdx
│ │ ├── 50-call-tools.mdx
│ │ ├── 51-call-tools-in-parallel.mdx
│ │ ├── 52-call-tools-with-image-prompt.mdx
│ │ ├── 53-call-tools-multiple-steps.mdx
│ │ ├── 54-mcp-tools.mdx
│ │ ├── 56-web-search-agent.mdx
│ │ ├── 60-embed-text.mdx
│ │ ├── 61-embed-text-batch.mdx
│ │ ├── 70-intercept-fetch-requests.mdx
│ │ ├── 80-local-caching-middleware.mdx
│ │ └── index.mdx
│ ├── 15-api-servers
│ │ ├── 10-node-http-server.mdx
│ │ ├── 20-express.mdx
│ │ ├── 30-hono.mdx
│ │ ├── 40-fastify.mdx
│ │ ├── 50-nest.mdx
│ │ └── index.mdx
│ └── 20-rsc
│ │ ├── 10-generate-text.mdx
│ │ ├── 11-generate-text-with-chat-prompt.mdx
│ │ ├── 120-stream-assistant-response.mdx
│ │ ├── 121-stream-assistant-response-with-tools.mdx
│ │ ├── 20-stream-text.mdx
│ │ ├── 21-stream-text-with-chat-prompt.mdx
│ │ ├── 30-generate-object.mdx
│ │ ├── 40-stream-object.mdx
│ │ ├── 50-call-tools.mdx
│ │ ├── 51-call-tools-in-parallel.mdx
│ │ ├── 60-save-messages-to-database.mdx
│ │ ├── 61-restore-messages-from-database.mdx
│ │ ├── 90-render-visual-interface-in-chat.mdx
│ │ ├── 91-stream-updates-to-visual-interfaces.mdx
│ │ ├── 92-stream-ui-record-token-usage.mdx
│ │ └── index.mdx
├── docs
│ ├── 00-introduction
│ │ └── index.mdx
│ ├── 01-announcing-ai-sdk-5-alpha
│ │ └── index.mdx
│ ├── 02-foundations
│ │ ├── 01-overview.mdx
│ │ ├── 02-providers-and-models.mdx
│ │ ├── 03-prompts.mdx
│ │ ├── 04-tools.mdx
│ │ ├── 05-streaming.mdx
│ │ ├── 06-agents.mdx
│ │ └── index.mdx
│ ├── 02-getting-started
│ │ ├── 01-navigating-the-library.mdx
│ │ ├── 02-nextjs-app-router.mdx
│ │ ├── 03-nextjs-pages-router.mdx
│ │ ├── 04-svelte.mdx
│ │ ├── 05-nuxt.mdx
│ │ ├── 06-nodejs.mdx
│ │ ├── 07-expo.mdx
│ │ └── index.mdx
│ ├── 02-guides
│ │ ├── 01-rag-chatbot.mdx
│ │ ├── 02-multi-modal-chatbot.mdx
│ │ ├── 03-slackbot.mdx
│ │ ├── 04-natural-language-postgres.mdx
│ │ ├── 05-computer-use.mdx
│ │ ├── 18-claude-4.mdx
│ │ ├── 19-openai-responses.mdx
│ │ ├── 20-sonnet-3-7.mdx
│ │ ├── 21-llama-3_1.mdx
│ │ ├── 22-gpt-4-5.mdx
│ │ ├── 23-o1.mdx
│ │ ├── 24-o3.mdx
│ │ ├── 25-r1.mdx
│ │ └── index.mdx
│ ├── 03-ai-sdk-core
│ │ ├── 01-overview.mdx
│ │ ├── 05-generating-text.mdx
│ │ ├── 10-generating-structured-data.mdx
│ │ ├── 15-tools-and-tool-calling.mdx
│ │ ├── 20-prompt-engineering.mdx
│ │ ├── 25-settings.mdx
│ │ ├── 30-embeddings.mdx
│ │ ├── 35-image-generation.mdx
│ │ ├── 36-transcription.mdx
│ │ ├── 37-speech.mdx
│ │ ├── 40-middleware.mdx
│ │ ├── 45-provider-management.mdx
│ │ ├── 50-error-handling.mdx
│ │ ├── 55-testing.mdx
│ │ ├── 60-telemetry.mdx
│ │ └── index.mdx
│ ├── 04-ai-sdk-ui
│ │ ├── 01-overview.mdx
│ │ ├── 02-chatbot.mdx
│ │ ├── 03-chatbot-message-persistence.mdx
│ │ ├── 03-chatbot-tool-usage.mdx
│ │ ├── 04-generative-user-interfaces.mdx
│ │ ├── 05-completion.mdx
│ │ ├── 08-object-generation.mdx
│ │ ├── 10-openai-assistants.mdx
│ │ ├── 20-streaming-data.mdx
│ │ ├── 21-error-handling.mdx
│ │ ├── 22-smooth-stream-japanese.mdx
│ │ ├── 23-smooth-stream-chinese.mdx
│ │ ├── 50-stream-protocol.mdx
│ │ └── index.mdx
│ ├── 05-ai-sdk-rsc
│ │ ├── 01-overview.mdx
│ │ ├── 02-streaming-react-components.mdx
│ │ ├── 03-generative-ui-state.mdx
│ │ ├── 03-saving-and-restoring-states.mdx
│ │ ├── 04-multistep-interfaces.mdx
│ │ ├── 05-streaming-values.mdx
│ │ ├── 06-loading-state.mdx
│ │ ├── 08-error-handling.mdx
│ │ ├── 09-authentication.mdx
│ │ ├── 10-migrating-to-ui.mdx
│ │ └── index.mdx
│ ├── 06-advanced
│ │ ├── 01-prompt-engineering.mdx
│ │ ├── 02-stopping-streams.mdx
│ │ ├── 03-backpressure.mdx
│ │ ├── 04-caching.mdx
│ │ ├── 05-multiple-streamables.mdx
│ │ ├── 06-rate-limiting.mdx
│ │ ├── 07-rendering-ui-with-language-models.mdx
│ │ ├── 08-model-as-router.mdx
│ │ ├── 09-multistep-interfaces.mdx
│ │ ├── 09-sequential-generations.mdx
│ │ ├── 10-vercel-deployment-guide.mdx
│ │ └── index.mdx
│ ├── 07-reference
│ │ ├── 01-ai-sdk-core
│ │ │ ├── 01-generate-text.mdx
│ │ │ ├── 02-stream-text.mdx
│ │ │ ├── 03-generate-object.mdx
│ │ │ ├── 04-stream-object.mdx
│ │ │ ├── 05-embed.mdx
│ │ │ ├── 06-embed-many.mdx
│ │ │ ├── 10-generate-image.mdx
│ │ │ ├── 11-transcribe.mdx
│ │ │ ├── 12-generate-speech.mdx
│ │ │ ├── 20-tool.mdx
│ │ │ ├── 21-create-mcp-client.mdx
│ │ │ ├── 22-mcp-stdio-transport.mdx
│ │ │ ├── 25-json-schema.mdx
│ │ │ ├── 26-zod-schema.mdx
│ │ │ ├── 27-valibot-schema.mdx
│ │ │ ├── 30-core-message.mdx
│ │ │ ├── 40-provider-registry.mdx
│ │ │ ├── 42-custom-provider.mdx
│ │ │ ├── 50-cosine-similarity.mdx
│ │ │ ├── 60-wrap-language-model.mdx
│ │ │ ├── 65-language-model-v1-middleware.mdx
│ │ │ ├── 66-extract-reasoning-middleware.mdx
│ │ │ ├── 67-simulate-streaming-middleware.mdx
│ │ │ ├── 68-default-settings-middleware.mdx
│ │ │ ├── 75-simulate-readable-stream.mdx
│ │ │ ├── 80-smooth-stream.mdx
│ │ │ ├── 90-generate-id.mdx
│ │ │ ├── 91-create-id-generator.mdx
│ │ │ └── index.mdx
│ │ ├── 02-ai-sdk-ui
│ │ │ ├── 01-use-chat.mdx
│ │ │ ├── 02-use-completion.mdx
│ │ │ ├── 03-use-object.mdx
│ │ │ ├── 20-use-assistant.mdx
│ │ │ ├── 21-assistant-response.mdx
│ │ │ ├── 31-convert-to-core-messages.mdx
│ │ │ ├── 32-append-response-messages.mdx
│ │ │ ├── 33-append-client-message.mdx
│ │ │ ├── 40-create-data-stream.mdx
│ │ │ ├── 41-create-data-stream-response.mdx
│ │ │ ├── 42-pipe-data-stream-to-response.mdx
│ │ │ ├── 45-stream-data.mdx
│ │ │ └── index.mdx
│ │ ├── 03-ai-sdk-rsc
│ │ │ ├── 01-stream-ui.mdx
│ │ │ ├── 02-create-ai.mdx
│ │ │ ├── 03-create-streamable-ui.mdx
│ │ │ ├── 04-create-streamable-value.mdx
│ │ │ ├── 05-read-streamable-value.mdx
│ │ │ ├── 06-get-ai-state.mdx
│ │ │ ├── 07-get-mutable-ai-state.mdx
│ │ │ ├── 08-use-ai-state.mdx
│ │ │ ├── 09-use-actions.mdx
│ │ │ ├── 10-use-ui-state.mdx
│ │ │ ├── 11-use-streamable-value.mdx
│ │ │ ├── 20-render.mdx
│ │ │ └── index.mdx
│ │ ├── 04-stream-helpers
│ │ │ ├── 01-ai-stream.mdx
│ │ │ ├── 02-streaming-text-response.mdx
│ │ │ ├── 05-stream-to-response.mdx
│ │ │ ├── 07-openai-stream.mdx
│ │ │ ├── 08-anthropic-stream.mdx
│ │ │ ├── 09-aws-bedrock-stream.mdx
│ │ │ ├── 10-aws-bedrock-anthropic-stream.mdx
│ │ │ ├── 10-aws-bedrock-messages-stream.mdx
│ │ │ ├── 11-aws-bedrock-cohere-stream.mdx
│ │ │ ├── 12-aws-bedrock-llama-2-stream.mdx
│ │ │ ├── 13-cohere-stream.mdx
│ │ │ ├── 14-google-generative-ai-stream.mdx
│ │ │ ├── 15-hugging-face-stream.mdx
│ │ │ ├── 16-langchain-adapter.mdx
│ │ │ ├── 16-langchain-stream.mdx
│ │ │ ├── 16-llamaindex-adapter.mdx
│ │ │ ├── 17-mistral-stream.mdx
│ │ │ ├── 18-replicate-stream.mdx
│ │ │ ├── 19-inkeep-stream.mdx
│ │ │ └── index.mdx
│ │ ├── 05-ai-sdk-errors
│ │ │ ├── ai-api-call-error.mdx
│ │ │ ├── ai-download-error.mdx
│ │ │ ├── ai-empty-response-body-error.mdx
│ │ │ ├── ai-invalid-argument-error.mdx
│ │ │ ├── ai-invalid-data-content-error.mdx
│ │ │ ├── ai-invalid-data-content.mdx
│ │ │ ├── ai-invalid-message-role-error.mdx
│ │ │ ├── ai-invalid-prompt-error.mdx
│ │ │ ├── ai-invalid-response-data-error.mdx
│ │ │ ├── ai-invalid-tool-arguments-error.mdx
│ │ │ ├── ai-json-parse-error.mdx
│ │ │ ├── ai-load-api-key-error.mdx
│ │ │ ├── ai-load-setting-error.mdx
│ │ │ ├── ai-message-conversion-error.mdx
│ │ │ ├── ai-no-audio-generated-error.mdx
│ │ │ ├── ai-no-content-generated-error.mdx
│ │ │ ├── ai-no-image-generated-error.mdx
│ │ │ ├── ai-no-object-generated-error.mdx
│ │ │ ├── ai-no-output-specified-error.mdx
│ │ │ ├── ai-no-such-model-error.mdx
│ │ │ ├── ai-no-such-provider-error.mdx
│ │ │ ├── ai-no-such-tool-error.mdx
│ │ │ ├── ai-no-transcript-generated-error.mdx
│ │ │ ├── ai-retry-error.mdx
│ │ │ ├── ai-too-many-embedding-values-for-call-error.mdx
│ │ │ ├── ai-tool-call-repair-error.mdx
│ │ │ ├── ai-tool-execution-error.mdx
│ │ │ ├── ai-type-validation-error.mdx
│ │ │ ├── ai-unsupported-functionality-error.mdx
│ │ │ └── index.mdx
│ │ └── index.mdx
│ ├── 08-migration-guides
│ │ ├── 00-versioning.mdx
│ │ ├── 27-migration-guide-4-2.mdx
│ │ ├── 28-migration-guide-4-1.mdx
│ │ ├── 29-migration-guide-4-0.mdx
│ │ ├── 36-migration-guide-3-4.mdx
│ │ ├── 37-migration-guide-3-3.mdx
│ │ ├── 38-migration-guide-3-2.mdx
│ │ ├── 39-migration-guide-3-1.mdx
│ │ └── index.mdx
│ └── 09-troubleshooting
│ │ ├── 01-azure-stream-slow.mdx
│ │ ├── 02-client-side-function-calls-not-invoked.mdx
│ │ ├── 03-server-actions-in-client-components.mdx
│ │ ├── 04-strange-stream-output.mdx
│ │ ├── 05-streamable-ui-errors.mdx
│ │ ├── 05-tool-invocation-missing-result.mdx
│ │ ├── 06-streaming-not-working-when-deployed.mdx
│ │ ├── 06-streaming-not-working-when-proxied.mdx
│ │ ├── 06-timeout-on-vercel.mdx
│ │ ├── 07-unclosed-streams.mdx
│ │ ├── 08-use-chat-failed-to-parse-stream.mdx
│ │ ├── 09-client-stream-error.mdx
│ │ ├── 10-use-chat-tools-no-response.mdx
│ │ ├── 12-use-chat-an-error-occurred.mdx
│ │ ├── 15-stream-text-not-working.mdx
│ │ ├── 20-nan-token-counts-openai-streaming.mdx
│ │ ├── 30-model-is-not-assignable-to-type.mdx
│ │ ├── 40-typescript-cannot-find-namespace-jsx.mdx
│ │ ├── 50-react-maximum-update-depth-exceeded.mdx
│ │ ├── 60-jest-cannot-find-module-ai-rsc.mdx
│ │ └── index.mdx
└── providers
│ ├── 01-ai-sdk-providers
│ ├── 01-xai.mdx
│ ├── 02-vercel.mdx
│ ├── 03-openai.mdx
│ ├── 04-azure.mdx
│ ├── 05-anthropic.mdx
│ ├── 08-amazon-bedrock.mdx
│ ├── 09-groq.mdx
│ ├── 10-fal.mdx
│ ├── 100-assemblyai.mdx
│ ├── 11-deepinfra.mdx
│ ├── 110-deepgram.mdx
│ ├── 120-gladia.mdx
│ ├── 140-lmnt.mdx
│ ├── 15-google-generative-ai.mdx
│ ├── 150-hume.mdx
│ ├── 16-google-vertex.mdx
│ ├── 160-revai.mdx
│ ├── 20-mistral.mdx
│ ├── 24-togetherai.mdx
│ ├── 25-cohere.mdx
│ ├── 26-fireworks.mdx
│ ├── 30-deepseek.mdx
│ ├── 40-cerebras.mdx
│ ├── 60-replicate.mdx
│ ├── 70-perplexity.mdx
│ ├── 80-luma.mdx
│ ├── 90-elevenlabs.mdx
│ └── index.mdx
│ ├── 02-openai-compatible-providers
│ ├── 01-custom-providers.mdx
│ ├── 30-lmstudio.mdx
│ ├── 35-nim.mdx
│ ├── 40-baseten.mdx
│ └── index.mdx
│ ├── 03-community-providers
│ ├── 01-custom-providers.mdx
│ ├── 02-qwen.mdx
│ ├── 03-ollama.mdx
│ ├── 04-chrome-ai.mdx
│ ├── 08-friendliai.mdx
│ ├── 10-portkey.mdx
│ ├── 11-cloudflare-workers-ai.mdx
│ ├── 12-cloudflare-ai-gateway.mdx
│ ├── 13-openrouter.mdx
│ ├── 14-azure-ai.mdx
│ ├── 21-crosshatch.mdx
│ ├── 60-mixedbread.mdx
│ ├── 61-voyage-ai.mdx
│ ├── 70-mem0.mdx
│ ├── 71-letta.mdx
│ ├── 90-llama-cpp.mdx
│ ├── 91-anthropic-vertex-ai.mdx
│ ├── 92-spark.mdx
│ ├── 93-inflection-ai.mdx
│ ├── 94-langdb.mdx
│ ├── 95-zhipu.mdx
│ ├── 96-sambanova.mdx
│ ├── 97-dify.mdx
│ ├── 97-sarvam.mdx
│ └── index.mdx
│ ├── 04-adapters
│ ├── 01-langchain.mdx
│ ├── 02-llamaindex.mdx
│ └── index.mdx
│ └── 05-observability
│ ├── braintrust.mdx
│ ├── helicone.mdx
│ ├── index.mdx
│ ├── laminar.mdx
│ ├── langfuse.mdx
│ ├── langsmith.mdx
│ ├── langwatch.mdx
│ ├── patronus.mdx
│ ├── traceloop.mdx
│ └── weave.mdx
├── examples
├── ai-core
│ ├── .env.example
│ ├── .gitignore
│ ├── README.md
│ ├── data
│ │ ├── ai.pdf
│ │ ├── comic-cat.png
│ │ ├── error-message.txt
│ │ ├── galileo.mp3
│ │ └── screenshot-editor.png
│ ├── package.json
│ ├── src
│ │ ├── complex
│ │ │ ├── math-agent
│ │ │ │ ├── agent-required-tool-choice.ts
│ │ │ │ └── agent.ts
│ │ │ └── semantic-router
│ │ │ │ ├── main.ts
│ │ │ │ └── semantic-router.ts
│ │ ├── e2e
│ │ │ ├── cerebras.test.ts
│ │ │ ├── cohere.test.ts
│ │ │ ├── deepinfra.test.ts
│ │ │ ├── deepseek.test.ts
│ │ │ ├── feature-test-suite.ts
│ │ │ ├── fireworks.test.ts
│ │ │ ├── google-vertex-anthropic.test.ts
│ │ │ ├── google-vertex.test.ts
│ │ │ ├── google.test.ts
│ │ │ ├── groq.test.ts
│ │ │ ├── luma.test.ts
│ │ │ ├── openai.test.ts
│ │ │ ├── perplexity.test.ts
│ │ │ ├── togetherai.test.ts
│ │ │ └── xai.test.ts
│ │ ├── embed-many
│ │ │ ├── amazon-bedrock.ts
│ │ │ ├── azure.ts
│ │ │ ├── cohere.ts
│ │ │ ├── google-vertex.ts
│ │ │ ├── google.ts
│ │ │ ├── mistral.ts
│ │ │ ├── openai-compatible-togetherai.ts
│ │ │ ├── openai-cosine-similarity.ts
│ │ │ └── openai.ts
│ │ ├── embed
│ │ │ ├── amazon-bedrock.ts
│ │ │ ├── azure.ts
│ │ │ ├── cohere.ts
│ │ │ ├── google-vertex.ts
│ │ │ ├── google.ts
│ │ │ ├── mistral.ts
│ │ │ ├── openai-compatible-togetherai.ts
│ │ │ ├── openai.ts
│ │ │ └── togetherai.ts
│ │ ├── generate-image
│ │ │ ├── amazon-bedrock.ts
│ │ │ ├── azure.ts
│ │ │ ├── deepinfra.ts
│ │ │ ├── fal-kontext.ts
│ │ │ ├── fal-photon.ts
│ │ │ ├── fal-recraft.ts
│ │ │ ├── fal.ts
│ │ │ ├── fireworks.ts
│ │ │ ├── google-vertex.ts
│ │ │ ├── luma-character-reference.ts
│ │ │ ├── luma-image-reference.ts
│ │ │ ├── luma-modify-image.ts
│ │ │ ├── luma-style-reference.ts
│ │ │ ├── luma.ts
│ │ │ ├── openai-gpt-image.ts
│ │ │ ├── openai-many.ts
│ │ │ ├── openai.ts
│ │ │ ├── replicate-1.ts
│ │ │ ├── replicate-2.ts
│ │ │ ├── replicate-3.ts
│ │ │ ├── replicate-versioned.ts
│ │ │ ├── togetherai.ts
│ │ │ ├── xai-many.ts
│ │ │ └── xai.ts
│ │ ├── generate-object
│ │ │ ├── amazon-bedrock.ts
│ │ │ ├── anthropic.ts
│ │ │ ├── azure.ts
│ │ │ ├── cohere-json.ts
│ │ │ ├── cohere-tool.ts
│ │ │ ├── fireworks.ts
│ │ │ ├── google-complex-1.ts
│ │ │ ├── google-complex-2.ts
│ │ │ ├── google-enum.ts
│ │ │ ├── google-gemini-files.ts
│ │ │ ├── google-no-structured-output.ts
│ │ │ ├── google-pdf-url.ts
│ │ │ ├── google-vertex-anthropic.ts
│ │ │ ├── google-vertex-tool.ts
│ │ │ ├── google-vertex.ts
│ │ │ ├── google.ts
│ │ │ ├── groq.ts
│ │ │ ├── mistral-json.ts
│ │ │ ├── mistral-tool.ts
│ │ │ ├── mistral.ts
│ │ │ ├── mock-error.ts
│ │ │ ├── mock-repair-add-close.ts
│ │ │ ├── mock.ts
│ │ │ ├── nim.ts
│ │ │ ├── openai-array.ts
│ │ │ ├── openai-compatible-togetherai.ts
│ │ │ ├── openai-date-parsing.ts
│ │ │ ├── openai-enum.ts
│ │ │ ├── openai-full-result.ts
│ │ │ ├── openai-json.ts
│ │ │ ├── openai-multimodal.ts
│ │ │ ├── openai-no-schema.ts
│ │ │ ├── openai-raw-json-schema.ts
│ │ │ ├── openai-reasoning.ts
│ │ │ ├── openai-request-body.ts
│ │ │ ├── openai-responses.ts
│ │ │ ├── openai-store-generation.ts
│ │ │ ├── openai-structured-outputs-name-description.ts
│ │ │ ├── openai-tool.ts
│ │ │ ├── openai-valibot.ts
│ │ │ ├── openai.ts
│ │ │ ├── perplexity.ts
│ │ │ ├── togetherai.ts
│ │ │ ├── vercel.ts
│ │ │ ├── xai-structured-outputs-name-description.ts
│ │ │ └── xai.ts
│ │ ├── generate-speech
│ │ │ ├── hume-instructions.ts
│ │ │ ├── hume-speed.ts
│ │ │ ├── hume-voice.ts
│ │ │ ├── hume.ts
│ │ │ ├── lmnt-speed.ts
│ │ │ ├── lmnt-voice.ts
│ │ │ ├── lmnt.ts
│ │ │ ├── openai-instructions.ts
│ │ │ ├── openai-speed.ts
│ │ │ ├── openai-voice.ts
│ │ │ └── openai.ts
│ │ ├── generate-text
│ │ │ ├── amazon-bedrock-cache-point-assistant.ts
│ │ │ ├── amazon-bedrock-cache-point-system.ts
│ │ │ ├── amazon-bedrock-cache-point-tool-call.ts
│ │ │ ├── amazon-bedrock-cache-point-user-image.ts
│ │ │ ├── amazon-bedrock-cache-point-user.ts
│ │ │ ├── amazon-bedrock-chatbot.ts
│ │ │ ├── amazon-bedrock-guardrails.ts
│ │ │ ├── amazon-bedrock-image-url.ts
│ │ │ ├── amazon-bedrock-image.ts
│ │ │ ├── amazon-bedrock-prefilled-assistant-message.ts
│ │ │ ├── amazon-bedrock-reasoning-chatbot.ts
│ │ │ ├── amazon-bedrock-reasoning.ts
│ │ │ ├── amazon-bedrock-tool-call-image-result.ts
│ │ │ ├── amazon-bedrock-tool-call.ts
│ │ │ ├── amazon-bedrock-tool-choice.ts
│ │ │ ├── amazon-bedrock.ts
│ │ │ ├── anthropic-cache-control.ts
│ │ │ ├── anthropic-chatbot.ts
│ │ │ ├── anthropic-computer-use-bash.ts
│ │ │ ├── anthropic-computer-use-computer.ts
│ │ │ ├── anthropic-computer-use-editor-cache-control.ts
│ │ │ ├── anthropic-computer-use-editor.ts
│ │ │ ├── anthropic-custom-fetch.ts
│ │ │ ├── anthropic-full-result.ts
│ │ │ ├── anthropic-image-url.ts
│ │ │ ├── anthropic-image.ts
│ │ │ ├── anthropic-multi-step-continue.ts
│ │ │ ├── anthropic-pdf-url.ts
│ │ │ ├── anthropic-pdf.ts
│ │ │ ├── anthropic-reasoning-chatbot.ts
│ │ │ ├── anthropic-reasoning.ts
│ │ │ ├── anthropic-tool-call.ts
│ │ │ ├── anthropic-tool-choice.ts
│ │ │ ├── anthropic.ts
│ │ │ ├── azure-custom-fetch.ts
│ │ │ ├── azure-image.ts
│ │ │ ├── azure-responses.ts
│ │ │ ├── azure.ts
│ │ │ ├── cerebras-tool-call.ts
│ │ │ ├── cerebras.ts
│ │ │ ├── cohere-chatbot.ts
│ │ │ ├── cohere-tool-call-empty-params.ts
│ │ │ ├── cohere-tool-call.ts
│ │ │ ├── cohere.ts
│ │ │ ├── deepinfra-tool-call.ts
│ │ │ ├── deepinfra.ts
│ │ │ ├── deepseek-cache-token.ts
│ │ │ ├── deepseek-reasoning.ts
│ │ │ ├── deepseek.ts
│ │ │ ├── fireworks-deepseek.ts
│ │ │ ├── fireworks-reasoning.ts
│ │ │ ├── google-audio.ts
│ │ │ ├── google-chatbot-image-output.ts
│ │ │ ├── google-custom-fetch.ts
│ │ │ ├── google-image-output.ts
│ │ │ ├── google-image-url.ts
│ │ │ ├── google-image.ts
│ │ │ ├── google-multi-step.ts
│ │ │ ├── google-output-object.ts
│ │ │ ├── google-pdf.ts
│ │ │ ├── google-reasoning.ts
│ │ │ ├── google-sources.ts
│ │ │ ├── google-tool-call.ts
│ │ │ ├── google-tool-choice.ts
│ │ │ ├── google-vertex-anthropic-cache-control.ts
│ │ │ ├── google-vertex-anthropic-chatbot.ts
│ │ │ ├── google-vertex-anthropic-computer-use-bash.ts
│ │ │ ├── google-vertex-anthropic-computer-use-computer.ts
│ │ │ ├── google-vertex-anthropic-computer-use-editor-cache-control.ts
│ │ │ ├── google-vertex-anthropic-computer-use-editor.ts
│ │ │ ├── google-vertex-anthropic-custom-fetch.ts
│ │ │ ├── google-vertex-anthropic-full-result.ts
│ │ │ ├── google-vertex-anthropic-image-url.ts
│ │ │ ├── google-vertex-anthropic-image.ts
│ │ │ ├── google-vertex-anthropic-multi-step-continue.ts
│ │ │ ├── google-vertex-anthropic-pdf.ts
│ │ │ ├── google-vertex-anthropic-tool-call.ts
│ │ │ ├── google-vertex-anthropic-tool-choice.ts
│ │ │ ├── google-vertex-anthropic.ts
│ │ │ ├── google-vertex-audio.ts
│ │ │ ├── google-vertex-grounding.ts
│ │ │ ├── google-vertex-image-base64.ts
│ │ │ ├── google-vertex-image-url.ts
│ │ │ ├── google-vertex-multi-step.ts
│ │ │ ├── google-vertex-output-object.ts
│ │ │ ├── google-vertex-pdf-url.ts
│ │ │ ├── google-vertex-pdf.ts
│ │ │ ├── google-vertex-reasoning-generate-text.ts
│ │ │ ├── google-vertex-safety.ts
│ │ │ ├── google-vertex-tool-call.ts
│ │ │ ├── google-vertex.ts
│ │ │ ├── google.ts
│ │ │ ├── groq-reasoning.ts
│ │ │ ├── groq.ts
│ │ │ ├── mistral-chatbot.ts
│ │ │ ├── mistral-custom-fetch.ts
│ │ │ ├── mistral-full-result.ts
│ │ │ ├── mistral-image-base64.ts
│ │ │ ├── mistral-image-url.ts
│ │ │ ├── mistral-multi-step-continue.ts
│ │ │ ├── mistral-pdf-url.ts
│ │ │ ├── mistral-tool-call.ts
│ │ │ ├── mistral-tool-choice.ts
│ │ │ ├── mistral.ts
│ │ │ ├── mock-tool-call-repair-reask.ts
│ │ │ ├── mock-tool-call-repair-structured-model.ts
│ │ │ ├── mock.ts
│ │ │ ├── nim.ts
│ │ │ ├── openai-active-tools.ts
│ │ │ ├── openai-audio.ts
│ │ │ ├── openai-cached-prompt-tokens.ts
│ │ │ ├── openai-compatible-deepseek.ts
│ │ │ ├── openai-compatible-litellm-anthropic-cache-control.ts
│ │ │ ├── openai-compatible-openai-image.ts
│ │ │ ├── openai-compatible-togetherai-tool-call.ts
│ │ │ ├── openai-compatible-togetherai.ts
│ │ │ ├── openai-completion-chat.ts
│ │ │ ├── openai-completion.ts
│ │ │ ├── openai-custom-fetch.ts
│ │ │ ├── openai-custom-headers.ts
│ │ │ ├── openai-full-result.ts
│ │ │ ├── openai-image-base64.ts
│ │ │ ├── openai-image-url-download.ts
│ │ │ ├── openai-image.ts
│ │ │ ├── openai-log-metadata-middleware.ts
│ │ │ ├── openai-logprobs.ts
│ │ │ ├── openai-multi-step-continue.ts
│ │ │ ├── openai-multi-step.ts
│ │ │ ├── openai-output-object.ts
│ │ │ ├── openai-pdf-url.ts
│ │ │ ├── openai-pdf.ts
│ │ │ ├── openai-reasoning.ts
│ │ │ ├── openai-request-body.ts
│ │ │ ├── openai-responses-chatbot.ts
│ │ │ ├── openai-responses-image-url.ts
│ │ │ ├── openai-responses-image.ts
│ │ │ ├── openai-responses-output-object.ts
│ │ │ ├── openai-responses-pdf-url.ts
│ │ │ ├── openai-responses-pdf.ts
│ │ │ ├── openai-responses-previous-response-id.ts
│ │ │ ├── openai-responses-reasoning-summary.ts
│ │ │ ├── openai-responses-reasoning.ts
│ │ │ ├── openai-responses-tool-call.ts
│ │ │ ├── openai-responses-websearch.ts
│ │ │ ├── openai-responses.ts
│ │ │ ├── openai-store-generation.ts
│ │ │ ├── openai-system-message-a.ts
│ │ │ ├── openai-system-message-b.ts
│ │ │ ├── openai-timeout.ts
│ │ │ ├── openai-tool-call-raw-json-schema.ts
│ │ │ ├── openai-tool-call.ts
│ │ │ ├── openai-tool-choice.ts
│ │ │ ├── openai-tool-execution-error.ts
│ │ │ ├── openai.ts
│ │ │ ├── perplexity-images.ts
│ │ │ ├── perplexity.ts
│ │ │ ├── togetherai-tool-call.ts
│ │ │ ├── togetherai.ts
│ │ │ ├── vercel-image.ts
│ │ │ ├── vercel.ts
│ │ │ ├── xai-structured-output.ts
│ │ │ ├── xai-tool-call.ts
│ │ │ └── xai.ts
│ │ ├── lib
│ │ │ ├── present-image.ts
│ │ │ └── save-audio.ts
│ │ ├── middleware
│ │ │ ├── add-to-last-user-message.ts
│ │ │ ├── default-settings-example.ts
│ │ │ ├── generate-text-cache-middleware-example.ts
│ │ │ ├── generate-text-log-middleware-example.ts
│ │ │ ├── get-last-user-message-text.ts
│ │ │ ├── simulate-streaming-example.ts
│ │ │ ├── stream-text-log-middleware.ts
│ │ │ ├── stream-text-rag-middleware.ts
│ │ │ ├── your-cache-middleware.ts
│ │ │ ├── your-guardrail-middleware.ts
│ │ │ ├── your-log-middleware.ts
│ │ │ └── your-rag-middleware.ts
│ │ ├── registry
│ │ │ ├── embed-openai.ts
│ │ │ ├── generate-image.ts
│ │ │ ├── setup-registry.ts
│ │ │ ├── stream-text-anthropic.ts
│ │ │ ├── stream-text-groq.ts
│ │ │ ├── stream-text-openai.ts
│ │ │ └── stream-text-xai.ts
│ │ ├── stream-object
│ │ │ ├── amazon-bedrock.ts
│ │ │ ├── anthropic.ts
│ │ │ ├── azure.ts
│ │ │ ├── fireworks.ts
│ │ │ ├── google-vertex-anthropic.ts
│ │ │ ├── google-vertex.ts
│ │ │ ├── google.ts
│ │ │ ├── groq.ts
│ │ │ ├── mistral-json.ts
│ │ │ ├── mistral-tool.ts
│ │ │ ├── mistral.ts
│ │ │ ├── mock.ts
│ │ │ ├── nim.ts
│ │ │ ├── openai-array.ts
│ │ │ ├── openai-compatible-togetherai.ts
│ │ │ ├── openai-fullstream.ts
│ │ │ ├── openai-json.ts
│ │ │ ├── openai-no-schema.ts
│ │ │ ├── openai-object.ts
│ │ │ ├── openai-on-finish.ts
│ │ │ ├── openai-raw-json-schema.ts
│ │ │ ├── openai-reasoning.ts
│ │ │ ├── openai-request-body.ts
│ │ │ ├── openai-responses-tool.ts
│ │ │ ├── openai-responses.ts
│ │ │ ├── openai-store-generation.ts
│ │ │ ├── openai-structured-outputs-name-description.ts
│ │ │ ├── openai-structured-outputs.ts
│ │ │ ├── openai-token-usage.ts
│ │ │ ├── openai-tool.ts
│ │ │ ├── openai.ts
│ │ │ ├── togetherai.ts
│ │ │ ├── vercel.ts
│ │ │ ├── xai-structured-outputs-name-description.ts
│ │ │ └── xai.ts
│ │ ├── stream-text
│ │ │ ├── amazon-bedrock-cache-point-assistant.ts
│ │ │ ├── amazon-bedrock-cache-point-image.ts
│ │ │ ├── amazon-bedrock-cache-point-system.ts
│ │ │ ├── amazon-bedrock-cache-point-tool-call.ts
│ │ │ ├── amazon-bedrock-cache-point-user.ts
│ │ │ ├── amazon-bedrock-chatbot.ts
│ │ │ ├── amazon-bedrock-fullstream.ts
│ │ │ ├── amazon-bedrock-image.ts
│ │ │ ├── amazon-bedrock-multi-step-continue.ts
│ │ │ ├── amazon-bedrock-pdf.ts
│ │ │ ├── amazon-bedrock-reasoning-chatbot.ts
│ │ │ ├── amazon-bedrock-reasoning-fullstream.ts
│ │ │ ├── amazon-bedrock-reasoning.ts
│ │ │ ├── amazon-bedrock-tool-call.ts
│ │ │ ├── amazon-bedrock.ts
│ │ │ ├── anthropic-cache-control.ts
│ │ │ ├── anthropic-chatbot.ts
│ │ │ ├── anthropic-fullstream.ts
│ │ │ ├── anthropic-image.ts
│ │ │ ├── anthropic-multi-step-continue.ts
│ │ │ ├── anthropic-pdf.ts
│ │ │ ├── anthropic-reasoning-chatbot.ts
│ │ │ ├── anthropic-reasoning-fullstream.ts
│ │ │ ├── anthropic-reasoning.ts
│ │ │ ├── anthropic-smooth.ts
│ │ │ ├── anthropic.ts
│ │ │ ├── azure-completion.ts
│ │ │ ├── azure-fullstream-logprobs.ts
│ │ │ ├── azure-fullstream.ts
│ │ │ ├── azure-smooth-line.ts
│ │ │ ├── azure-smooth.ts
│ │ │ ├── azure.ts
│ │ │ ├── baseten.ts
│ │ │ ├── cerebras-tool-call.ts
│ │ │ ├── cerebras.ts
│ │ │ ├── cohere-chatbot.ts
│ │ │ ├── cohere-response.ts
│ │ │ ├── cohere-tool-call-empty-params.ts
│ │ │ ├── cohere-tool-call.ts
│ │ │ ├── cohere.ts
│ │ │ ├── deepseek-cache-token.ts
│ │ │ ├── deepseek-reasoning.ts
│ │ │ ├── deepseek-tool-call.ts
│ │ │ ├── deepseek.ts
│ │ │ ├── fireworks-deepseek.ts
│ │ │ ├── fireworks-reasoning.ts
│ │ │ ├── fireworks.ts
│ │ │ ├── google-chatbot-image-output.ts
│ │ │ ├── google-chatbot.ts
│ │ │ ├── google-fullstream.ts
│ │ │ ├── google-grounding.ts
│ │ │ ├── google-image-output.ts
│ │ │ ├── google-reasoning.ts
│ │ │ ├── google-vertex-anthropic-cache-control.ts
│ │ │ ├── google-vertex-anthropic-chatbot.ts
│ │ │ ├── google-vertex-anthropic-fullstream.ts
│ │ │ ├── google-vertex-anthropic-image-url.ts
│ │ │ ├── google-vertex-anthropic-image.ts
│ │ │ ├── google-vertex-anthropic-multi-step-continue.ts
│ │ │ ├── google-vertex-anthropic-pdf.ts
│ │ │ ├── google-vertex-anthropic-tool-call.ts
│ │ │ ├── google-vertex-anthropic.ts
│ │ │ ├── google-vertex-fullstream.ts
│ │ │ ├── google-vertex-grounding.ts
│ │ │ ├── google-vertex-pdf-url.ts
│ │ │ ├── google-vertex-reasoning.ts
│ │ │ ├── google-vertex.ts
│ │ │ ├── google.ts
│ │ │ ├── groq-reasoning-fullstream.ts
│ │ │ ├── groq.ts
│ │ │ ├── lmstudio.ts
│ │ │ ├── mistral-chatbot.ts
│ │ │ ├── mistral-fullstream.ts
│ │ │ ├── mistral-multi-step-continue.ts
│ │ │ ├── mistral.ts
│ │ │ ├── mock.ts
│ │ │ ├── nim.ts
│ │ │ ├── openai-abort.ts
│ │ │ ├── openai-audio.ts
│ │ │ ├── openai-cached-prompt-tokens.ts
│ │ │ ├── openai-chatbot.ts
│ │ │ ├── openai-compatible-deepseek.ts
│ │ │ ├── openai-compatible-litellm-anthropic-cache-control.ts
│ │ │ ├── openai-compatible-togetherai-tool-call.ts
│ │ │ ├── openai-compatible-togetherai.ts
│ │ │ ├── openai-completion-chat.ts
│ │ │ ├── openai-completion.ts
│ │ │ ├── openai-custom-fetch-inject-error.ts
│ │ │ ├── openai-fullstream-logprobs.ts
│ │ │ ├── openai-fullstream-raw.ts
│ │ │ ├── openai-fullstream.ts
│ │ │ ├── openai-multi-step-continue.ts
│ │ │ ├── openai-multi-step.ts
│ │ │ ├── openai-on-chunk-tool-call-streaming.ts
│ │ │ ├── openai-on-chunk.ts
│ │ │ ├── openai-on-finish-response-messages.ts
│ │ │ ├── openai-on-finish-steps.ts
│ │ │ ├── openai-on-finish.ts
│ │ │ ├── openai-on-step-finish.ts
│ │ │ ├── openai-output-object.ts
│ │ │ ├── openai-predicted-output.ts
│ │ │ ├── openai-reader.ts
│ │ │ ├── openai-reasoning.ts
│ │ │ ├── openai-request-body.ts
│ │ │ ├── openai-responses-chatbot.ts
│ │ │ ├── openai-responses-reasoning-summary.ts
│ │ │ ├── openai-responses-reasoning.ts
│ │ │ ├── openai-responses-tool-call.ts
│ │ │ ├── openai-responses-websearch.ts
│ │ │ ├── openai-responses.ts
│ │ │ ├── openai-simulated-streaming.ts
│ │ │ ├── openai-store-generation.ts
│ │ │ ├── openai-tool-abort.ts
│ │ │ ├── openai-tool-call-raw-json-schema.ts
│ │ │ ├── openai-tool-call.ts
│ │ │ ├── openai-web-search-tool.ts
│ │ │ ├── openai.ts
│ │ │ ├── perplexity-images.ts
│ │ │ ├── perplexity.ts
│ │ │ ├── smooth-stream-chinese.ts
│ │ │ ├── smooth-stream-japanese.ts
│ │ │ ├── togetherai-tool-call.ts
│ │ │ ├── togetherai.ts
│ │ │ ├── vercel-image.ts
│ │ │ ├── vercel-tool-call.ts
│ │ │ ├── vercel.ts
│ │ │ ├── xai-chatbot.ts
│ │ │ ├── xai-image.ts
│ │ │ ├── xai-tool-call.ts
│ │ │ └── xai.ts
│ │ ├── telemetry
│ │ │ ├── generate-object.ts
│ │ │ ├── generate-text-tool-call.ts
│ │ │ ├── generate-text.ts
│ │ │ ├── stream-object.ts
│ │ │ └── stream-text.ts
│ │ ├── test
│ │ │ └── response-format.ts
│ │ ├── tools
│ │ │ └── weather-tool.ts
│ │ ├── transcribe
│ │ │ ├── assemblyai-string.ts
│ │ │ ├── assemblyai-url.ts
│ │ │ ├── assemblyai.ts
│ │ │ ├── azure-string.ts
│ │ │ ├── azure-url.ts
│ │ │ ├── azure.ts
│ │ │ ├── deepgram-string.ts
│ │ │ ├── deepgram-url.ts
│ │ │ ├── deepgram.ts
│ │ │ ├── elevenlabs-string.ts
│ │ │ ├── elevenlabs-url.ts
│ │ │ ├── elevenlabs.ts
│ │ │ ├── fal-string.ts
│ │ │ ├── fal-url.ts
│ │ │ ├── fal.ts
│ │ │ ├── gladia-string.ts
│ │ │ ├── gladia-url.ts
│ │ │ ├── gladia.ts
│ │ │ ├── groq-string.ts
│ │ │ ├── groq-url.ts
│ │ │ ├── groq.ts
│ │ │ ├── openai-string.ts
│ │ │ ├── openai-url.ts
│ │ │ ├── openai.ts
│ │ │ ├── revai-string.ts
│ │ │ ├── revai-url.ts
│ │ │ └── revai.ts
│ │ └── types
│ │ │ └── tool-set.ts
│ ├── tsconfig.json
│ └── vitest.config.js
├── express
│ ├── .env.example
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ └── server.ts
│ └── tsconfig.json
├── fastify
│ ├── .env.example
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ └── server.ts
│ └── tsconfig.json
├── hono
│ ├── .env.example
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ └── server.ts
│ └── tsconfig.json
├── mcp
│ ├── .env.example
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── http
│ │ │ ├── client.ts
│ │ │ └── server.ts
│ │ ├── sse
│ │ │ ├── client.ts
│ │ │ └── server.ts
│ │ └── stdio
│ │ │ ├── client.ts
│ │ │ └── server.ts
│ └── tsconfig.json
├── nest
│ ├── .env.example
│ ├── .eslintrc.js
│ ├── .gitignore
│ ├── .prettierrc
│ ├── README.md
│ ├── nest-cli.json
│ ├── package.json
│ ├── src
│ │ ├── app.controller.ts
│ │ ├── app.module.ts
│ │ └── main.ts
│ ├── tsconfig.build.json
│ └── tsconfig.json
├── next-fastapi
│ ├── .env.local.example
│ ├── .gitignore
│ ├── README.md
│ ├── api
│ │ ├── index.py
│ │ └── utils
│ │ │ ├── __init__.py
│ │ │ ├── prompt.py
│ │ │ ├── tools.py
│ │ │ └── types.py
│ ├── app
│ │ ├── (examples)
│ │ │ ├── 01-chat-text
│ │ │ │ ├── layout.tsx
│ │ │ │ └── page.tsx
│ │ │ ├── 02-chat-data
│ │ │ │ ├── layout.tsx
│ │ │ │ └── page.tsx
│ │ │ └── 03-chat-attachments
│ │ │ │ ├── layout.tsx
│ │ │ │ └── page.tsx
│ │ ├── components.tsx
│ │ ├── favicon.ico
│ │ ├── globals.css
│ │ ├── icons.tsx
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── next.config.js
│ ├── package.json
│ ├── postcss.config.js
│ ├── public
│ │ ├── next.svg
│ │ └── vercel.svg
│ ├── requirements.txt
│ ├── tailwind.config.js
│ └── tsconfig.json
├── next-google-vertex
│ ├── .env.local.example
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── app
│ │ ├── api
│ │ │ ├── generate-edge
│ │ │ │ └── route.ts
│ │ │ └── generate-node
│ │ │ │ └── route.ts
│ │ ├── edge
│ │ │ └── page.tsx
│ │ ├── favicon.ico
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ ├── node
│ │ │ └── page.tsx
│ │ └── page.tsx
│ ├── next.config.js
│ ├── package.json
│ ├── postcss.config.mjs
│ ├── tailwind.config.ts
│ └── tsconfig.json
├── next-langchain
│ ├── .env.local.example
│ ├── .gitignore
│ ├── README.md
│ ├── app
│ │ ├── api
│ │ │ ├── chat
│ │ │ │ └── route.ts
│ │ │ ├── completion-stream-data
│ │ │ │ └── route.ts
│ │ │ ├── completion-string-output-parser
│ │ │ │ └── route.ts
│ │ │ └── completion
│ │ │ │ └── route.ts
│ │ ├── completion-stream-data
│ │ │ └── page.tsx
│ │ ├── completion-string-output-parser
│ │ │ └── page.tsx
│ │ ├── completion
│ │ │ └── page.tsx
│ │ ├── favicon.ico
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── next.config.js
│ ├── package.json
│ ├── postcss.config.js
│ ├── tailwind.config.js
│ └── tsconfig.json
├── next-openai-kasada-bot-protection
│ ├── .env.local.example
│ ├── .gitignore
│ ├── README.md
│ ├── app
│ │ ├── 149e9513-01fa-4fb0-aad4-566afd725d1b
│ │ │ └── 2d206a39-8ed7-437e-a3be-862e0f06eea3
│ │ │ │ └── [[...restpath]]
│ │ │ │ └── route.ts
│ │ ├── api
│ │ │ └── chat
│ │ │ │ └── route.ts
│ │ ├── favicon.ico
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ ├── page.tsx
│ │ └── toaster.tsx
│ ├── kasada
│ │ ├── kasada-client.tsx
│ │ └── kasada-server.tsx
│ ├── middleware.ts
│ ├── next.config.js
│ ├── package.json
│ ├── postcss.config.js
│ ├── tailwind.config.js
│ └── tsconfig.json
├── next-openai-pages
│ ├── .env.local.example
│ ├── .gitignore
│ ├── README.md
│ ├── app
│ │ └── api
│ │ │ ├── assistant-tools
│ │ │ └── route.ts
│ │ │ ├── assistant
│ │ │ └── route.ts
│ │ │ ├── call-tool
│ │ │ └── route.ts
│ │ │ ├── call-tools-in-parallel
│ │ │ └── route.ts
│ │ │ ├── generate-chat
│ │ │ └── route.ts
│ │ │ ├── generate-object
│ │ │ └── route.ts
│ │ │ ├── generate-text
│ │ │ └── route.ts
│ │ │ ├── generative-ui-route
│ │ │ └── route.ts
│ │ │ ├── stream-chat
│ │ │ └── route.ts
│ │ │ ├── stream-object
│ │ │ └── route.ts
│ │ │ └── stream-text
│ │ │ └── route.ts
│ ├── next.config.js
│ ├── package.json
│ ├── pages
│ │ ├── _app.tsx
│ │ ├── _document.tsx
│ │ ├── api
│ │ │ ├── chat-api-route.ts
│ │ │ └── chat-edge.ts
│ │ ├── assistants
│ │ │ ├── stream-assistant-response-with-tools
│ │ │ │ └── index.tsx
│ │ │ ├── stream-assistant-response
│ │ │ │ └── index.tsx
│ │ │ └── stream-assistant-switch-threads
│ │ │ │ └── index.tsx
│ │ ├── basics
│ │ │ ├── generate-object
│ │ │ │ └── index.tsx
│ │ │ ├── generate-text
│ │ │ │ └── index.tsx
│ │ │ ├── stream-object
│ │ │ │ └── index.tsx
│ │ │ └── stream-text
│ │ │ │ └── index.tsx
│ │ ├── chat
│ │ │ ├── generate-chat
│ │ │ │ └── index.tsx
│ │ │ ├── stream-chat-api-route
│ │ │ │ └── index.tsx
│ │ │ ├── stream-chat-edge
│ │ │ │ └── index.tsx
│ │ │ └── stream-chat
│ │ │ │ └── index.tsx
│ │ ├── generative-user-interface
│ │ │ └── route-components
│ │ │ │ └── index.tsx
│ │ ├── index.tsx
│ │ └── tools
│ │ │ ├── call-tool
│ │ │ └── index.tsx
│ │ │ └── call-tools-in-parallel
│ │ │ └── index.tsx
│ ├── postcss.config.js
│ ├── styles
│ │ └── globals.css
│ ├── tailwind.config.js
│ └── tsconfig.json
├── next-openai-telemetry-sentry
│ ├── .env.local.example
│ ├── .gitignore
│ ├── README.md
│ ├── app
│ │ ├── api
│ │ │ └── text
│ │ │ │ └── route.ts
│ │ ├── favicon.ico
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── instrumentation.ts
│ ├── next.config.js
│ ├── package.json
│ ├── postcss.config.js
│ ├── sentry.client.config.js
│ ├── sentry.edge.config.js
│ ├── sentry.server.config.js
│ ├── tailwind.config.js
│ └── tsconfig.json
├── next-openai-telemetry
│ ├── .env.local.example
│ ├── .gitignore
│ ├── README.md
│ ├── app
│ │ ├── README.md
│ │ ├── api
│ │ │ └── text
│ │ │ │ └── route.ts
│ │ ├── favicon.ico
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── instrumentation.ts
│ ├── next.config.js
│ ├── package.json
│ ├── postcss.config.js
│ ├── tailwind.config.js
│ └── tsconfig.json
├── next-openai-upstash-rate-limits
│ ├── .env.local.example
│ ├── .gitignore
│ ├── README.md
│ ├── app
│ │ ├── api
│ │ │ └── chat
│ │ │ │ └── route.ts
│ │ ├── favicon.ico
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ ├── page.tsx
│ │ └── toaster.tsx
│ ├── next.config.js
│ ├── package.json
│ ├── postcss.config.js
│ ├── tailwind.config.js
│ └── tsconfig.json
├── next-openai
│ ├── .env.local.example
│ ├── .gitignore
│ ├── README.md
│ ├── app
│ │ ├── api
│ │ │ ├── assistant
│ │ │ │ ├── assistant-setup.md
│ │ │ │ └── route.ts
│ │ │ ├── chat
│ │ │ │ └── route.ts
│ │ │ ├── completion
│ │ │ │ └── route.ts
│ │ │ ├── files
│ │ │ │ └── route.ts
│ │ │ ├── generate-image
│ │ │ │ └── route.ts
│ │ │ ├── mcp-zapier
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-cache
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-continue
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-custom-sources
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-human-in-the-loop
│ │ │ │ ├── route.ts
│ │ │ │ ├── tools.ts
│ │ │ │ └── utils.ts
│ │ │ ├── use-chat-image-output
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-persistence-single-message-image-output
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-persistence-single-message-tools
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-persistence-single-message
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-persistence
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-reasoning-tools
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-reasoning
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-resilient-persistence
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-resume
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-sources
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-streamdata-multistep
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-streamdata
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-streaming-tool-calls
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-throttle
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-tools
│ │ │ │ └── route.ts
│ │ │ ├── use-chat-vision
│ │ │ │ └── route.ts
│ │ │ ├── use-completion-long-response
│ │ │ │ └── route.ts
│ │ │ ├── use-completion-server-side-multi-step
│ │ │ │ └── route.ts
│ │ │ ├── use-completion-throttle
│ │ │ │ └── route.ts
│ │ │ ├── use-object-expense-tracker
│ │ │ │ ├── route.ts
│ │ │ │ └── schema.ts
│ │ │ └── use-object
│ │ │ │ ├── route.ts
│ │ │ │ └── schema.ts
│ │ ├── assistant
│ │ │ └── page.tsx
│ │ ├── completion-rsc
│ │ │ ├── generate-completion.ts
│ │ │ └── page.tsx
│ │ ├── completion
│ │ │ └── page.tsx
│ │ ├── favicon.ico
│ │ ├── generate-image
│ │ │ └── page.tsx
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ ├── mcp-zapier
│ │ │ └── page.tsx
│ │ ├── mcp
│ │ │ ├── chat
│ │ │ │ └── route.ts
│ │ │ ├── page.tsx
│ │ │ └── server
│ │ │ │ └── route.ts
│ │ ├── page.tsx
│ │ ├── stream-assistant-responses-with-tools
│ │ │ ├── actions.tsx
│ │ │ ├── ai.ts
│ │ │ ├── function.ts
│ │ │ ├── layout.tsx
│ │ │ ├── message.tsx
│ │ │ └── page.tsx
│ │ ├── stream-assistant-responses
│ │ │ ├── actions.tsx
│ │ │ ├── ai.ts
│ │ │ ├── functions.tsx
│ │ │ ├── layout.tsx
│ │ │ ├── message.tsx
│ │ │ └── page.tsx
│ │ ├── stream-object
│ │ │ ├── actions.ts
│ │ │ ├── page.tsx
│ │ │ └── schema.ts
│ │ ├── stream-ui
│ │ │ ├── actions.tsx
│ │ │ ├── ai.ts
│ │ │ ├── layout.tsx
│ │ │ ├── message.tsx
│ │ │ └── page.tsx
│ │ ├── use-chat-attachments-append
│ │ │ └── page.tsx
│ │ ├── use-chat-attachments-url
│ │ │ └── page.tsx
│ │ ├── use-chat-attachments
│ │ │ └── page.tsx
│ │ ├── use-chat-continue
│ │ │ └── page.tsx
│ │ ├── use-chat-custom-sources
│ │ │ └── page.tsx
│ │ ├── use-chat-human-in-the-loop
│ │ │ └── page.tsx
│ │ ├── use-chat-image-output
│ │ │ └── page.tsx
│ │ ├── use-chat-persistence-single-message-image-output
│ │ │ ├── [id]
│ │ │ │ ├── chat.tsx
│ │ │ │ └── page.tsx
│ │ │ └── page.tsx
│ │ ├── use-chat-persistence-single-message-tools
│ │ │ ├── [id]
│ │ │ │ ├── chat.tsx
│ │ │ │ └── page.tsx
│ │ │ └── page.tsx
│ │ ├── use-chat-persistence-single-message
│ │ │ ├── [id]
│ │ │ │ ├── chat.tsx
│ │ │ │ └── page.tsx
│ │ │ └── page.tsx
│ │ ├── use-chat-persistence
│ │ │ ├── [id]
│ │ │ │ ├── chat.tsx
│ │ │ │ └── page.tsx
│ │ │ └── page.tsx
│ │ ├── use-chat-reasoning-tools
│ │ │ └── page.tsx
│ │ ├── use-chat-reasoning
│ │ │ └── page.tsx
│ │ ├── use-chat-resilient-persistence
│ │ │ ├── [id]
│ │ │ │ ├── chat.tsx
│ │ │ │ └── page.tsx
│ │ │ └── page.tsx
│ │ ├── use-chat-resume
│ │ │ ├── [id]
│ │ │ │ └── page.tsx
│ │ │ ├── chat.tsx
│ │ │ └── page.tsx
│ │ ├── use-chat-sources
│ │ │ └── page.tsx
│ │ ├── use-chat-streamdata-multistep
│ │ │ └── page.tsx
│ │ ├── use-chat-streamdata
│ │ │ └── page.tsx
│ │ ├── use-chat-streaming-tool-calls
│ │ │ └── page.tsx
│ │ ├── use-chat-throttle
│ │ │ └── page.tsx
│ │ ├── use-chat-tools
│ │ │ └── page.tsx
│ │ ├── use-chat-vision
│ │ │ └── page.tsx
│ │ ├── use-completion-long-response
│ │ │ └── page.tsx
│ │ ├── use-completion-server-side-multi-step
│ │ │ └── page.tsx
│ │ ├── use-completion-throttle
│ │ │ └── page.tsx
│ │ ├── use-object-expense-tracker
│ │ │ └── page.tsx
│ │ └── use-object
│ │ │ └── page.tsx
│ ├── next.config.js
│ ├── package.json
│ ├── postcss.config.js
│ ├── tailwind.config.js
│ ├── tsconfig.json
│ └── util
│ │ ├── chat-store.ts
│ │ └── mcp
│ │ ├── handler.ts
│ │ ├── incoming-message.ts
│ │ └── server-response.ts
├── node-http-server
│ ├── .env.example
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ └── server.ts
│ └── tsconfig.json
├── nuxt-openai
│ ├── .env.example
│ ├── .gitignore
│ ├── README.md
│ ├── nuxt.config.ts
│ ├── package.json
│ ├── pages
│ │ ├── assistant
│ │ │ └── index.vue
│ │ ├── completion
│ │ │ └── index.vue
│ │ ├── index.vue
│ │ ├── use-chat-attachments-append
│ │ │ └── index.vue
│ │ ├── use-chat-attachments
│ │ │ └── index.vue
│ │ ├── use-chat-request
│ │ │ └── index.vue
│ │ ├── use-chat-streamdata
│ │ │ └── index.vue
│ │ ├── use-chat-tools
│ │ │ └── index.vue
│ │ └── vision
│ │ │ └── index.vue
│ ├── server
│ │ ├── api
│ │ │ ├── assistant.ts
│ │ │ ├── chat-with-vision.ts
│ │ │ ├── chat.ts
│ │ │ ├── completion.ts
│ │ │ ├── use-chat-request.ts
│ │ │ ├── use-chat-streamdata.ts
│ │ │ └── use-chat-tools.ts
│ │ └── tsconfig.json
│ └── tsconfig.json
├── solidstart-openai
│ ├── .env.example
│ ├── .gitignore
│ ├── README.md
│ ├── app.config.ts
│ ├── package.json
│ ├── postcss.config.cjs
│ ├── public
│ │ └── favicon.ico
│ ├── src
│ │ ├── app.css
│ │ ├── app.tsx
│ │ ├── entry-client.tsx
│ │ ├── entry-server.tsx
│ │ ├── global.d.ts
│ │ └── routes
│ │ │ ├── api
│ │ │ ├── chat
│ │ │ │ └── index.ts
│ │ │ ├── completion
│ │ │ │ └── index.ts
│ │ │ ├── use-chat-request
│ │ │ │ └── index.ts
│ │ │ ├── use-chat-streamdata
│ │ │ │ └── index.ts
│ │ │ ├── use-chat-tools
│ │ │ │ └── index.ts
│ │ │ ├── use-chat-vision
│ │ │ │ └── index.ts
│ │ │ └── use-object
│ │ │ │ ├── index.ts
│ │ │ │ └── schema.ts
│ │ │ ├── completion
│ │ │ └── index.tsx
│ │ │ ├── index.tsx
│ │ │ ├── use-chat-attachments
│ │ │ └── index.tsx
│ │ │ ├── use-chat-request
│ │ │ └── index.tsx
│ │ │ ├── use-chat-streamdata
│ │ │ └── index.tsx
│ │ │ ├── use-chat-tools
│ │ │ └── index.tsx
│ │ │ ├── use-chat-vision
│ │ │ └── index.tsx
│ │ │ └── use-object
│ │ │ └── index.tsx
│ ├── tailwind.config.cjs
│ └── tsconfig.json
└── sveltekit-openai
│ ├── .gitignore
│ ├── README.md
│ ├── components.json
│ ├── eslint.config.js
│ ├── package.json
│ ├── postcss.config.js
│ ├── src
│ ├── app.css
│ ├── app.d.ts
│ ├── app.html
│ ├── lib
│ │ ├── components
│ │ │ ├── icons
│ │ │ │ └── arrow-up.svelte
│ │ │ └── ui
│ │ │ │ ├── button
│ │ │ │ ├── button.svelte
│ │ │ │ └── index.ts
│ │ │ │ └── textarea
│ │ │ │ ├── index.ts
│ │ │ │ └── textarea.svelte
│ │ └── utils.ts
│ └── routes
│ │ ├── +layout.svelte
│ │ ├── +page.svelte
│ │ ├── api
│ │ ├── chat
│ │ │ └── +server.ts
│ │ ├── completion
│ │ │ └── +server.ts
│ │ └── structured-object
│ │ │ └── +server.ts
│ │ ├── chat
│ │ └── +page.svelte
│ │ ├── completion
│ │ └── +page.svelte
│ │ └── structured-object
│ │ ├── +page.svelte
│ │ └── schema.ts
│ ├── static
│ ├── favicon.png
│ └── robots.txt
│ ├── svelte.config.js
│ ├── tailwind.config.ts
│ ├── tsconfig.json
│ ├── turbo.json
│ └── vite.config.ts
├── package.json
├── packages
├── ai
│ ├── .changeset
│ │ └── quick-toys-study.md
│ ├── .eslintrc.js
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── core
│ │ ├── data-stream
│ │ │ ├── create-data-stream-response.test.ts
│ │ │ ├── create-data-stream-response.ts
│ │ │ ├── create-data-stream.test.ts
│ │ │ ├── create-data-stream.ts
│ │ │ ├── data-stream-writer.ts
│ │ │ ├── index.ts
│ │ │ ├── pipe-data-stream-to-response.test.ts
│ │ │ └── pipe-data-stream-to-response.ts
│ │ ├── embed
│ │ │ ├── __snapshots__
│ │ │ │ ├── embed-many.test.ts.snap
│ │ │ │ └── embed.test.ts.snap
│ │ │ ├── embed-many-result.ts
│ │ │ ├── embed-many.test.ts
│ │ │ ├── embed-many.ts
│ │ │ ├── embed-result.ts
│ │ │ ├── embed.test.ts
│ │ │ ├── embed.ts
│ │ │ └── index.ts
│ │ ├── generate-image
│ │ │ ├── generate-image-result.ts
│ │ │ ├── generate-image.test.ts
│ │ │ ├── generate-image.ts
│ │ │ └── index.ts
│ │ ├── generate-object
│ │ │ ├── __snapshots__
│ │ │ │ ├── generate-object.test.ts.snap
│ │ │ │ └── stream-object.test.ts.snap
│ │ │ ├── generate-object-result.ts
│ │ │ ├── generate-object.test.ts
│ │ │ ├── generate-object.ts
│ │ │ ├── index.ts
│ │ │ ├── inject-json-instruction.test.ts
│ │ │ ├── inject-json-instruction.ts
│ │ │ ├── output-strategy.ts
│ │ │ ├── stream-object-result.ts
│ │ │ ├── stream-object.test.ts
│ │ │ ├── stream-object.ts
│ │ │ └── validate-object-generation-input.ts
│ │ ├── generate-speech
│ │ │ ├── generate-speech-result.ts
│ │ │ ├── generate-speech.test.ts
│ │ │ ├── generate-speech.ts
│ │ │ ├── generated-audio-file.ts
│ │ │ └── index.ts
│ │ ├── generate-text
│ │ │ ├── __snapshots__
│ │ │ │ ├── generate-text.test.ts.snap
│ │ │ │ └── stream-text.test.ts.snap
│ │ │ ├── generate-text-result.ts
│ │ │ ├── generate-text.test.ts
│ │ │ ├── generate-text.ts
│ │ │ ├── generated-file.ts
│ │ │ ├── index.ts
│ │ │ ├── output.test.ts
│ │ │ ├── output.ts
│ │ │ ├── parse-tool-call.test.ts
│ │ │ ├── parse-tool-call.ts
│ │ │ ├── reasoning-detail.ts
│ │ │ ├── run-tools-transformation.test.ts
│ │ │ ├── run-tools-transformation.ts
│ │ │ ├── smooth-stream.test.ts
│ │ │ ├── smooth-stream.ts
│ │ │ ├── step-result.ts
│ │ │ ├── stream-text-result.ts
│ │ │ ├── stream-text.test.ts
│ │ │ ├── stream-text.ts
│ │ │ ├── to-response-messages.test.ts
│ │ │ ├── to-response-messages.ts
│ │ │ ├── tool-call-repair.ts
│ │ │ ├── tool-call.ts
│ │ │ ├── tool-result.ts
│ │ │ └── tool-set.ts
│ │ ├── index.ts
│ │ ├── middleware
│ │ │ ├── __snapshots__
│ │ │ │ └── simulate-streaming-middleware.test.ts.snap
│ │ │ ├── default-settings-middleware.test.ts
│ │ │ ├── default-settings-middleware.ts
│ │ │ ├── extract-reasoning-middleware.test.ts
│ │ │ ├── extract-reasoning-middleware.ts
│ │ │ ├── index.ts
│ │ │ ├── language-model-v1-middleware.ts
│ │ │ ├── simulate-streaming-middleware.test.ts
│ │ │ ├── simulate-streaming-middleware.ts
│ │ │ ├── wrap-language-model.test.ts
│ │ │ └── wrap-language-model.ts
│ │ ├── prompt
│ │ │ ├── __snapshots__
│ │ │ │ ├── append-response-messages.test.ts.snap
│ │ │ │ ├── convert-to-core-messages.test.ts.snap
│ │ │ │ └── standardize-prompt.test.ts.snap
│ │ │ ├── append-client-message.test.ts
│ │ │ ├── append-client-message.ts
│ │ │ ├── append-response-messages.test.ts
│ │ │ ├── append-response-messages.ts
│ │ │ ├── attachments-to-parts.ts
│ │ │ ├── call-settings.ts
│ │ │ ├── content-part.ts
│ │ │ ├── convert-to-core-messages.test.ts
│ │ │ ├── convert-to-core-messages.ts
│ │ │ ├── convert-to-language-model-prompt.test.ts
│ │ │ ├── convert-to-language-model-prompt.ts
│ │ │ ├── data-content.test.ts
│ │ │ ├── data-content.ts
│ │ │ ├── index.ts
│ │ │ ├── invalid-data-content-error.ts
│ │ │ ├── invalid-message-role-error.ts
│ │ │ ├── message-conversion-error.ts
│ │ │ ├── message.ts
│ │ │ ├── prepare-call-settings.test.ts
│ │ │ ├── prepare-call-settings.ts
│ │ │ ├── prepare-retries.test.ts
│ │ │ ├── prepare-retries.ts
│ │ │ ├── prepare-tools-and-tool-choice.test.ts
│ │ │ ├── prepare-tools-and-tool-choice.ts
│ │ │ ├── prompt.ts
│ │ │ ├── split-data-url.ts
│ │ │ ├── standardize-prompt.test.ts
│ │ │ ├── standardize-prompt.ts
│ │ │ ├── stringify-for-telemetry.test.ts
│ │ │ ├── stringify-for-telemetry.ts
│ │ │ └── tool-result-content.ts
│ │ ├── registry
│ │ │ ├── custom-provider.test.ts
│ │ │ ├── custom-provider.ts
│ │ │ ├── index.ts
│ │ │ ├── no-such-provider-error.ts
│ │ │ ├── provider-registry.test.ts
│ │ │ └── provider-registry.ts
│ │ ├── telemetry
│ │ │ ├── assemble-operation-name.ts
│ │ │ ├── get-base-telemetry-attributes.ts
│ │ │ ├── get-tracer.ts
│ │ │ ├── noop-tracer.ts
│ │ │ ├── record-span.ts
│ │ │ ├── select-telemetry-attributes.ts
│ │ │ ├── select-temetry-attributes.test.ts
│ │ │ └── telemetry-settings.ts
│ │ ├── test
│ │ │ ├── mock-embedding-model-v1.ts
│ │ │ ├── mock-image-model-v1.ts
│ │ │ ├── mock-language-model-v1.ts
│ │ │ ├── mock-server-response.ts
│ │ │ ├── mock-speech-model-v1.ts
│ │ │ ├── mock-tracer.ts
│ │ │ ├── mock-transcription-model-v1.ts
│ │ │ ├── mock-values.ts
│ │ │ └── not-implemented.ts
│ │ ├── tool
│ │ │ ├── index.ts
│ │ │ ├── mcp
│ │ │ │ ├── json-rpc-message.ts
│ │ │ │ ├── mcp-client.test.ts
│ │ │ │ ├── mcp-client.ts
│ │ │ │ ├── mcp-sse-transport.test.ts
│ │ │ │ ├── mcp-sse-transport.ts
│ │ │ │ ├── mcp-transport.ts
│ │ │ │ ├── mock-mcp-transport.ts
│ │ │ │ └── types.ts
│ │ │ └── tool.ts
│ │ ├── transcribe
│ │ │ ├── index.ts
│ │ │ ├── transcribe-result.ts
│ │ │ ├── transcribe.test.ts
│ │ │ └── transcribe.ts
│ │ ├── types
│ │ │ ├── embedding-model.ts
│ │ │ ├── image-model-response-metadata.ts
│ │ │ ├── image-model.ts
│ │ │ ├── index.ts
│ │ │ ├── json-value.ts
│ │ │ ├── language-model-request-metadata.ts
│ │ │ ├── language-model-response-metadata.ts
│ │ │ ├── language-model.ts
│ │ │ ├── provider-metadata.ts
│ │ │ ├── provider.ts
│ │ │ ├── speech-model-response-metadata.ts
│ │ │ ├── speech-model.ts
│ │ │ ├── transcription-model-response-metadata.ts
│ │ │ ├── transcription-model.ts
│ │ │ └── usage.ts
│ │ └── util
│ │ │ ├── async-iterable-stream.test.ts
│ │ │ ├── async-iterable-stream.ts
│ │ │ ├── cosine-similarity.test.ts
│ │ │ ├── cosine-similarity.ts
│ │ │ ├── create-stitchable-stream.test.ts
│ │ │ ├── create-stitchable-stream.ts
│ │ │ ├── detect-mimetype.test.ts
│ │ │ ├── detect-mimetype.ts
│ │ │ ├── get-potential-start-index.test.ts
│ │ │ ├── get-potential-start-index.ts
│ │ │ ├── is-non-empty-object.ts
│ │ │ ├── merge-objects.test.ts
│ │ │ ├── merge-objects.ts
│ │ │ ├── merge-streams.test.ts
│ │ │ ├── merge-streams.ts
│ │ │ ├── now.ts
│ │ │ ├── prepare-outgoing-http-headers.test.ts
│ │ │ ├── prepare-outgoing-http-headers.ts
│ │ │ ├── prepare-response-headers.test.ts
│ │ │ ├── prepare-response-headers.ts
│ │ │ ├── remove-text-after-last-whitespace.test.ts
│ │ │ ├── remove-text-after-last-whitespace.ts
│ │ │ ├── simulate-readable-stream.test.ts
│ │ │ ├── simulate-readable-stream.ts
│ │ │ ├── split-array.test.ts
│ │ │ ├── split-array.ts
│ │ │ ├── split-on-last-whitespace.test.ts
│ │ │ ├── split-on-last-whitespace.ts
│ │ │ ├── value-of.ts
│ │ │ └── write-to-server-response.ts
│ ├── errors
│ │ ├── index.ts
│ │ ├── invalid-argument-error.ts
│ │ ├── invalid-stream-part-error.ts
│ │ ├── invalid-tool-arguments-error.ts
│ │ ├── mcp-client-error.ts
│ │ ├── no-image-generated-error.ts
│ │ ├── no-object-generated-error.ts
│ │ ├── no-output-specified-error.ts
│ │ ├── no-speech-generated-error.ts
│ │ ├── no-such-tool-error.ts
│ │ ├── no-transcript-generated-error.ts
│ │ ├── tool-call-repair-error.ts
│ │ └── tool-execution-error.ts
│ ├── mcp-stdio
│ │ ├── create-child-process.test.ts
│ │ ├── create-child-process.ts
│ │ ├── get-environment.test.ts
│ │ ├── get-environment.ts
│ │ ├── index.ts
│ │ ├── mcp-stdio-transport.test.ts
│ │ └── mcp-stdio-transport.ts
│ ├── package.json
│ ├── playwright.config.ts
│ ├── react
│ │ ├── index.ts
│ │ └── package.json
│ ├── rsc
│ │ ├── ai-state.test.ts
│ │ ├── ai-state.tsx
│ │ ├── index.ts
│ │ ├── package.json
│ │ ├── provider.tsx
│ │ ├── rsc-client.ts
│ │ ├── rsc-server.ts
│ │ ├── rsc-shared.mts
│ │ ├── shared-client
│ │ │ ├── context.tsx
│ │ │ └── index.ts
│ │ ├── stream-ui
│ │ │ ├── __snapshots__
│ │ │ │ ├── render.ui.test.tsx.snap
│ │ │ │ └── stream-ui.ui.test.tsx.snap
│ │ │ ├── index.tsx
│ │ │ ├── stream-ui.tsx
│ │ │ └── stream-ui.ui.test.tsx
│ │ ├── streamable-ui
│ │ │ ├── create-streamable-ui.tsx
│ │ │ ├── create-streamable-ui.ui.test.tsx
│ │ │ └── create-suspended-chunk.tsx
│ │ ├── streamable-value
│ │ │ ├── create-streamable-value.test.tsx
│ │ │ ├── create-streamable-value.ts
│ │ │ ├── is-streamable-value.ts
│ │ │ ├── read-streamable-value.tsx
│ │ │ ├── read-streamable-value.ui.test.tsx
│ │ │ ├── streamable-value.ts
│ │ │ └── use-streamable-value.tsx
│ │ ├── types.test-d.ts
│ │ └── types.ts
│ ├── streams
│ │ ├── assistant-response.ts
│ │ ├── index.ts
│ │ ├── langchain-adapter.test.ts
│ │ ├── langchain-adapter.ts
│ │ ├── llamaindex-adapter.test.ts
│ │ ├── llamaindex-adapter.ts
│ │ ├── stream-callbacks.ts
│ │ └── stream-data.ts
│ ├── test
│ │ └── index.ts
│ ├── tests
│ │ └── e2e
│ │ │ ├── next-server
│ │ │ ├── CHANGELOG.md
│ │ │ ├── app
│ │ │ │ ├── layout.js
│ │ │ │ ├── page.js
│ │ │ │ └── rsc
│ │ │ │ │ ├── actions.jsx
│ │ │ │ │ ├── client-utils.js
│ │ │ │ │ ├── client.js
│ │ │ │ │ └── page.js
│ │ │ └── package.json
│ │ │ └── spec
│ │ │ └── streamable.e2e.test.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── util
│ │ ├── as-array.ts
│ │ ├── constants.ts
│ │ ├── consume-stream.ts
│ │ ├── create-resolvable-promise.ts
│ │ ├── delayed-promise.test.ts
│ │ ├── delayed-promise.ts
│ │ ├── download-error.ts
│ │ ├── download.test.ts
│ │ ├── download.ts
│ │ ├── is-async-generator.ts
│ │ ├── is-function.ts
│ │ ├── is-generator.ts
│ │ ├── retry-error.ts
│ │ └── retry-with-exponential-backoff.ts
│ ├── vitest.edge.config.js
│ ├── vitest.node.config.js
│ └── vitest.ui.react.config.js
├── amazon-bedrock
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── bedrock-api-types.ts
│ │ ├── bedrock-chat-language-model.test.ts
│ │ ├── bedrock-chat-language-model.ts
│ │ ├── bedrock-chat-settings.ts
│ │ ├── bedrock-embedding-model.test.ts
│ │ ├── bedrock-embedding-model.ts
│ │ ├── bedrock-embedding-settings.ts
│ │ ├── bedrock-error.ts
│ │ ├── bedrock-event-stream-response-handler.test.ts
│ │ ├── bedrock-event-stream-response-handler.ts
│ │ ├── bedrock-image-model.test.ts
│ │ ├── bedrock-image-model.ts
│ │ ├── bedrock-image-settings.ts
│ │ ├── bedrock-prepare-tools.ts
│ │ ├── bedrock-provider.test.ts
│ │ ├── bedrock-provider.ts
│ │ ├── bedrock-sigv4-fetch.test.ts
│ │ ├── bedrock-sigv4-fetch.ts
│ │ ├── convert-to-bedrock-chat-messages.test.ts
│ │ ├── convert-to-bedrock-chat-messages.ts
│ │ ├── headers-utils.test.ts
│ │ ├── headers-utils.ts
│ │ ├── index.ts
│ │ ├── inject-fetch-headers.test.ts
│ │ ├── inject-fetch-headers.ts
│ │ └── map-bedrock-finish-reason.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── anthropic
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── anthropic-api-types.ts
│ │ ├── anthropic-error.ts
│ │ ├── anthropic-messages-language-model.test.ts
│ │ ├── anthropic-messages-language-model.ts
│ │ ├── anthropic-messages-settings.ts
│ │ ├── anthropic-prepare-tools.test.ts
│ │ ├── anthropic-prepare-tools.ts
│ │ ├── anthropic-provider.ts
│ │ ├── anthropic-tools.ts
│ │ ├── convert-to-anthropic-messages-prompt.test.ts
│ │ ├── convert-to-anthropic-messages-prompt.ts
│ │ ├── index.ts
│ │ ├── internal
│ │ │ └── index.ts
│ │ └── map-anthropic-stop-reason.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── assemblyai
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── assemblyai-api-types.ts
│ │ ├── assemblyai-config.ts
│ │ ├── assemblyai-error.test.ts
│ │ ├── assemblyai-error.ts
│ │ ├── assemblyai-provider.ts
│ │ ├── assemblyai-transcription-model.test.ts
│ │ ├── assemblyai-transcription-model.ts
│ │ ├── assemblyai-transcription-settings.ts
│ │ ├── index.ts
│ │ └── transcript-test.mp3
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── azure
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── azure-openai-provider.test.ts
│ │ ├── azure-openai-provider.ts
│ │ └── index.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── cerebras
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── cerebras-chat-settings.ts
│ │ ├── cerebras-provider.test.ts
│ │ ├── cerebras-provider.ts
│ │ └── index.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── codemod
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── scripts
│ │ └── scaffold-codemod.ts
│ ├── src
│ │ ├── bin
│ │ │ └── codemod.ts
│ │ ├── codemods
│ │ │ ├── lib
│ │ │ │ ├── create-transformer.ts
│ │ │ │ ├── remove-await-fn.ts
│ │ │ │ └── remove-facade.ts
│ │ │ ├── remove-ai-stream-methods-from-stream-text-result.ts
│ │ │ ├── remove-anthropic-facade.ts
│ │ │ ├── remove-await-streamobject.ts
│ │ │ ├── remove-await-streamtext.ts
│ │ │ ├── remove-deprecated-provider-registry-exports.ts
│ │ │ ├── remove-experimental-ai-fn-exports.ts
│ │ │ ├── remove-experimental-message-types.ts
│ │ │ ├── remove-experimental-streamdata.ts
│ │ │ ├── remove-experimental-tool.ts
│ │ │ ├── remove-experimental-useassistant.ts
│ │ │ ├── remove-google-facade.ts
│ │ │ ├── remove-isxxxerror.ts
│ │ │ ├── remove-metadata-with-headers.ts
│ │ │ ├── remove-mistral-facade.ts
│ │ │ ├── remove-openai-facade.ts
│ │ │ ├── rename-format-stream-part.ts
│ │ │ ├── rename-parse-stream-part.ts
│ │ │ ├── replace-baseurl.ts
│ │ │ ├── replace-continuation-steps.ts
│ │ │ ├── replace-langchain-toaistream.ts
│ │ │ ├── replace-nanoid.ts
│ │ │ ├── replace-roundtrips-with-maxsteps.ts
│ │ │ ├── replace-token-usage-types.ts
│ │ │ └── rewrite-framework-imports.ts
│ │ ├── lib
│ │ │ ├── transform-options.ts
│ │ │ ├── transform.ts
│ │ │ └── upgrade.ts
│ │ └── test
│ │ │ ├── __testfixtures__
│ │ │ ├── remove-ai-stream-methods-from-stream-text-result.input.ts
│ │ │ ├── remove-ai-stream-methods-from-stream-text-result.output.ts
│ │ │ ├── remove-anthropic-facade.input.ts
│ │ │ ├── remove-anthropic-facade.output.ts
│ │ │ ├── remove-await-fn-alias.input.ts
│ │ │ ├── remove-await-fn-alias.output.ts
│ │ │ ├── remove-await-fn-other-fn.input.ts
│ │ │ ├── remove-await-fn-other-fn.output.ts
│ │ │ ├── remove-await-fn-other.input.ts
│ │ │ ├── remove-await-fn-other.output.ts
│ │ │ ├── remove-await-fn.input.ts
│ │ │ ├── remove-await-fn.output.ts
│ │ │ ├── remove-deprecated-provider-registry-exports.input.ts
│ │ │ ├── remove-deprecated-provider-registry-exports.output.ts
│ │ │ ├── remove-experimental-ai-fn-exports.input.ts
│ │ │ ├── remove-experimental-ai-fn-exports.output.ts
│ │ │ ├── remove-experimental-message-types.input.ts
│ │ │ ├── remove-experimental-message-types.output.ts
│ │ │ ├── remove-experimental-streamdata.input.ts
│ │ │ ├── remove-experimental-streamdata.output.ts
│ │ │ ├── remove-experimental-tool-not-ai.input.ts
│ │ │ ├── remove-experimental-tool-not-ai.output.ts
│ │ │ ├── remove-experimental-tool.input.ts
│ │ │ ├── remove-experimental-tool.output.ts
│ │ │ ├── remove-experimental-useassistant.input.tsx
│ │ │ ├── remove-experimental-useassistant.output.tsx
│ │ │ ├── remove-google-facade.input.ts
│ │ │ ├── remove-google-facade.output.ts
│ │ │ ├── remove-isxxxerror.input.ts
│ │ │ ├── remove-isxxxerror.output.ts
│ │ │ ├── remove-metadata-with-headers.input.ts
│ │ │ ├── remove-metadata-with-headers.output.ts
│ │ │ ├── remove-mistral-facade.input.ts
│ │ │ ├── remove-mistral-facade.output.ts
│ │ │ ├── remove-openai-facade-as.input.ts
│ │ │ ├── remove-openai-facade-as.output.ts
│ │ │ ├── remove-openai-facade-corp.input.ts
│ │ │ ├── remove-openai-facade-corp.output.ts
│ │ │ ├── remove-openai-facade.input.ts
│ │ │ ├── remove-openai-facade.output.ts
│ │ │ ├── rename-format-stream-part-not-ai.input.ts
│ │ │ ├── rename-format-stream-part-not-ai.output.ts
│ │ │ ├── rename-format-stream-part.input.ts
│ │ │ ├── rename-format-stream-part.output.ts
│ │ │ ├── rename-parse-stream-part-not-ai.input.ts
│ │ │ ├── rename-parse-stream-part-not-ai.output.ts
│ │ │ ├── rename-parse-stream-part.input.ts
│ │ │ ├── rename-parse-stream-part.output.ts
│ │ │ ├── replace-baseurl.input.ts
│ │ │ ├── replace-baseurl.output.ts
│ │ │ ├── replace-continuation-steps.input.ts
│ │ │ ├── replace-continuation-steps.output.ts
│ │ │ ├── replace-langchain-toaistream.input.ts
│ │ │ ├── replace-langchain-toaistream.output.ts
│ │ │ ├── replace-nanoid-not-ai.input.ts
│ │ │ ├── replace-nanoid-not-ai.output.ts
│ │ │ ├── replace-nanoid.input.ts
│ │ │ ├── replace-nanoid.output.ts
│ │ │ ├── replace-roundtrips-with-maxsteps.input.ts
│ │ │ ├── replace-roundtrips-with-maxsteps.output.ts
│ │ │ ├── replace-token-usage-types.input.ts
│ │ │ ├── replace-token-usage-types.output.ts
│ │ │ ├── rewrite-framework-imports-solid.input.ts
│ │ │ ├── rewrite-framework-imports-solid.output.ts
│ │ │ ├── rewrite-framework-imports-svelte.input.ts
│ │ │ ├── rewrite-framework-imports-svelte.output.ts
│ │ │ ├── rewrite-framework-imports-vue.input.ts
│ │ │ └── rewrite-framework-imports-vue.output.ts
│ │ │ ├── create-transformer.test.ts
│ │ │ ├── jscodeshift-testUtils.d.ts
│ │ │ ├── remove-ai-stream-methods-from-stream-text-result.test.ts
│ │ │ ├── remove-anthropic-facade.test.ts
│ │ │ ├── remove-await-fn.test.ts
│ │ │ ├── remove-deprecated-provider-registry-exports.test.ts
│ │ │ ├── remove-experimental-ai-fn-exports.test.ts
│ │ │ ├── remove-experimental-message-types.test.ts
│ │ │ ├── remove-experimental-streamdata.test.ts
│ │ │ ├── remove-experimental-tool.test.ts
│ │ │ ├── remove-experimental-useassistant.test.ts
│ │ │ ├── remove-google-facade.test.ts
│ │ │ ├── remove-isxxxerror.test.ts
│ │ │ ├── remove-metadata-with-headers.test.ts
│ │ │ ├── remove-mistral-facade.test.ts
│ │ │ ├── remove-openai-facade.test.ts
│ │ │ ├── rename-format-stream-part.test.ts
│ │ │ ├── rename-parse-stream-part.test.ts
│ │ │ ├── replace-baseurl.test.ts
│ │ │ ├── replace-continuation-steps.test.ts
│ │ │ ├── replace-langchain-toaistream.test.ts
│ │ │ ├── replace-nanoid.test.ts
│ │ │ ├── replace-roundtrips-with-maxsteps.test.ts
│ │ │ ├── replace-token-usage-types.test.ts
│ │ │ ├── rewrite-framework-imports.test.ts
│ │ │ ├── test-utils.test.ts
│ │ │ └── test-utils.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ └── vitest.config.ts
├── cohere
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── cohere-chat-language-model.test.ts
│ │ ├── cohere-chat-language-model.ts
│ │ ├── cohere-chat-prompt.ts
│ │ ├── cohere-chat-settings.ts
│ │ ├── cohere-embedding-model.test.ts
│ │ ├── cohere-embedding-model.ts
│ │ ├── cohere-embedding-settings.ts
│ │ ├── cohere-error.ts
│ │ ├── cohere-prepare-tools.test.ts
│ │ ├── cohere-prepare-tools.ts
│ │ ├── cohere-provider.ts
│ │ ├── convert-to-cohere-chat-prompt.test.ts
│ │ ├── convert-to-cohere-chat-prompt.ts
│ │ ├── index.ts
│ │ └── map-cohere-finish-reason.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── deepgram
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── deepgram-api-types.ts
│ │ ├── deepgram-config.ts
│ │ ├── deepgram-error.test.ts
│ │ ├── deepgram-error.ts
│ │ ├── deepgram-provider.ts
│ │ ├── deepgram-transcription-model.test.ts
│ │ ├── deepgram-transcription-model.ts
│ │ ├── deepgram-transcription-settings.ts
│ │ ├── index.ts
│ │ └── transcript-test.mp3
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── deepinfra
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── deepinfra-chat-settings.ts
│ │ ├── deepinfra-completion-settings.ts
│ │ ├── deepinfra-embedding-settings.ts
│ │ ├── deepinfra-image-model.test.ts
│ │ ├── deepinfra-image-model.ts
│ │ ├── deepinfra-image-settings.ts
│ │ ├── deepinfra-provider.test.ts
│ │ ├── deepinfra-provider.ts
│ │ └── index.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── deepseek
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── deepseek-chat-settings.ts
│ │ ├── deepseek-metadata-extractor.test.ts
│ │ ├── deepseek-metadata-extractor.ts
│ │ ├── deepseek-provider.test.ts
│ │ ├── deepseek-provider.ts
│ │ └── index.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── elevenlabs
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── elevenlabs-api-types.ts
│ │ ├── elevenlabs-config.ts
│ │ ├── elevenlabs-error.test.ts
│ │ ├── elevenlabs-error.ts
│ │ ├── elevenlabs-provider.ts
│ │ ├── elevenlabs-transcription-model.test.ts
│ │ ├── elevenlabs-transcription-model.ts
│ │ ├── elevenlabs-transcription-settings.ts
│ │ ├── index.ts
│ │ └── transcript-test.mp3
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── fal
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── fal-api-types.ts
│ │ ├── fal-config.ts
│ │ ├── fal-error.test.ts
│ │ ├── fal-error.ts
│ │ ├── fal-image-model.test.ts
│ │ ├── fal-image-model.ts
│ │ ├── fal-image-settings.ts
│ │ ├── fal-provider.test.ts
│ │ ├── fal-provider.ts
│ │ ├── fal-transcription-model.test.ts
│ │ ├── fal-transcription-model.ts
│ │ ├── fal-transcription-settings.ts
│ │ ├── index.ts
│ │ └── transcript-test.mp3
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── fireworks
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── fireworks-chat-settings.ts
│ │ ├── fireworks-completion-settings.ts
│ │ ├── fireworks-embedding-settings.ts
│ │ ├── fireworks-image-model.test.ts
│ │ ├── fireworks-image-model.ts
│ │ ├── fireworks-image-settings.ts
│ │ ├── fireworks-provider.test.ts
│ │ ├── fireworks-provider.ts
│ │ └── index.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── gladia
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── gladia-api-types.ts
│ │ ├── gladia-config.ts
│ │ ├── gladia-error.test.ts
│ │ ├── gladia-error.ts
│ │ ├── gladia-provider.ts
│ │ ├── gladia-transcription-model.test.ts
│ │ ├── gladia-transcription-model.ts
│ │ ├── index.ts
│ │ └── transcript-test.mp3
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── google-vertex
│ ├── .gitignore
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── anthropic
│ │ │ ├── edge
│ │ │ │ ├── google-vertex-anthropic-provider-edge.test.ts
│ │ │ │ ├── google-vertex-anthropic-provider-edge.ts
│ │ │ │ └── index.ts
│ │ │ ├── google-vertex-anthropic-messages-settings.ts
│ │ │ ├── google-vertex-anthropic-provider-node.test.ts
│ │ │ ├── google-vertex-anthropic-provider-node.ts
│ │ │ ├── google-vertex-anthropic-provider.test.ts
│ │ │ ├── google-vertex-anthropic-provider.ts
│ │ │ └── index.ts
│ │ ├── edge
│ │ │ ├── google-vertex-auth-edge.test.ts
│ │ │ ├── google-vertex-auth-edge.ts
│ │ │ ├── google-vertex-provider-edge.test.ts
│ │ │ ├── google-vertex-provider-edge.ts
│ │ │ └── index.ts
│ │ ├── google-vertex-auth-google-auth-library.test.ts
│ │ ├── google-vertex-auth-google-auth-library.ts
│ │ ├── google-vertex-config.ts
│ │ ├── google-vertex-embedding-model.test.ts
│ │ ├── google-vertex-embedding-model.ts
│ │ ├── google-vertex-embedding-settings.ts
│ │ ├── google-vertex-error.ts
│ │ ├── google-vertex-image-model.test.ts
│ │ ├── google-vertex-image-model.ts
│ │ ├── google-vertex-image-settings.ts
│ │ ├── google-vertex-provider-node.test.ts
│ │ ├── google-vertex-provider-node.ts
│ │ ├── google-vertex-provider.test.ts
│ │ ├── google-vertex-provider.ts
│ │ ├── google-vertex-settings.ts
│ │ ├── google-vertex-supported-file-url.test.ts
│ │ ├── google-vertex-supported-file-url.ts
│ │ └── index.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── google
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── convert-json-schema-to-openapi-schema.test.ts
│ │ ├── convert-json-schema-to-openapi-schema.ts
│ │ ├── convert-to-google-generative-ai-messages.test.ts
│ │ ├── convert-to-google-generative-ai-messages.ts
│ │ ├── get-model-path.test.ts
│ │ ├── get-model-path.ts
│ │ ├── google-error.ts
│ │ ├── google-generative-ai-embedding-model.test.ts
│ │ ├── google-generative-ai-embedding-model.ts
│ │ ├── google-generative-ai-embedding-settings.ts
│ │ ├── google-generative-ai-language-model.test.ts
│ │ ├── google-generative-ai-language-model.ts
│ │ ├── google-generative-ai-prompt.ts
│ │ ├── google-generative-ai-settings.ts
│ │ ├── google-prepare-tools.ts
│ │ ├── google-provider.test.ts
│ │ ├── google-provider.ts
│ │ ├── google-supported-file-url.test.ts
│ │ ├── google-supported-file-url.ts
│ │ ├── index.ts
│ │ ├── internal
│ │ │ └── index.ts
│ │ └── map-google-generative-ai-finish-reason.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── groq
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── convert-to-groq-chat-messages.test.ts
│ │ ├── convert-to-groq-chat-messages.ts
│ │ ├── get-response-metadata.ts
│ │ ├── groq-api-types.ts
│ │ ├── groq-chat-language-model.test.ts
│ │ ├── groq-chat-language-model.ts
│ │ ├── groq-chat-settings.ts
│ │ ├── groq-config.ts
│ │ ├── groq-error.ts
│ │ ├── groq-prepare-tools.ts
│ │ ├── groq-provider.ts
│ │ ├── groq-transcription-model.test.ts
│ │ ├── groq-transcription-model.ts
│ │ ├── groq-transcription-settings.ts
│ │ ├── index.ts
│ │ ├── map-groq-finish-reason.ts
│ │ └── transcript-test.mp3
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── hume
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── hume-api-types.ts
│ │ ├── hume-config.ts
│ │ ├── hume-error.test.ts
│ │ ├── hume-error.ts
│ │ ├── hume-provider.ts
│ │ ├── hume-speech-model.test.ts
│ │ ├── hume-speech-model.ts
│ │ └── index.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── lmnt
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ │ ├── lmnt-api-types.ts
│ │ ├── lmnt-config.ts
│ │ ├── lmnt-error.test.ts
│ │ ├── lmnt-error.ts
│ │ ├── lmnt-provider.ts
│ │ ├── lmnt-speech-model.test.ts
│ │ ├── lmnt-speech-model.ts
│ │ └── lmnt-speech-settings.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── luma
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ │ ├── luma-image-model.test.ts
│ │ ├── luma-image-model.ts
│ │ ├── luma-image-settings.ts
│ │ ├── luma-provider.test.ts
│ │ └── luma-provider.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── mistral
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── __snapshots__
│ │ │ └── convert-to-mistral-chat-messages.test.ts.snap
│ │ ├── convert-to-mistral-chat-messages.test.ts
│ │ ├── convert-to-mistral-chat-messages.ts
│ │ ├── get-response-metadata.ts
│ │ ├── index.ts
│ │ ├── map-mistral-finish-reason.ts
│ │ ├── mistral-chat-language-model.test.ts
│ │ ├── mistral-chat-language-model.ts
│ │ ├── mistral-chat-prompt.ts
│ │ ├── mistral-chat-settings.ts
│ │ ├── mistral-embedding-model.test.ts
│ │ ├── mistral-embedding-model.ts
│ │ ├── mistral-embedding-settings.ts
│ │ ├── mistral-error.ts
│ │ ├── mistral-prepare-tools.ts
│ │ └── mistral-provider.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── openai-compatible
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── convert-to-openai-compatible-chat-messages.test.ts
│ │ ├── convert-to-openai-compatible-chat-messages.ts
│ │ ├── convert-to-openai-compatible-completion-prompt.ts
│ │ ├── get-response-metadata.ts
│ │ ├── index.ts
│ │ ├── internal
│ │ │ └── index.ts
│ │ ├── map-openai-compatible-finish-reason.ts
│ │ ├── openai-compatible-api-types.ts
│ │ ├── openai-compatible-chat-language-model.test.ts
│ │ ├── openai-compatible-chat-language-model.ts
│ │ ├── openai-compatible-chat-settings.ts
│ │ ├── openai-compatible-completion-language-model.test.ts
│ │ ├── openai-compatible-completion-language-model.ts
│ │ ├── openai-compatible-completion-settings.ts
│ │ ├── openai-compatible-embedding-model.test.ts
│ │ ├── openai-compatible-embedding-model.ts
│ │ ├── openai-compatible-embedding-settings.ts
│ │ ├── openai-compatible-error.ts
│ │ ├── openai-compatible-image-model.test.ts
│ │ ├── openai-compatible-image-model.ts
│ │ ├── openai-compatible-image-settings.ts
│ │ ├── openai-compatible-metadata-extractor.ts
│ │ ├── openai-compatible-prepare-tools.ts
│ │ ├── openai-compatible-provider.test.ts
│ │ └── openai-compatible-provider.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── openai
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── convert-to-openai-chat-messages.test.ts
│ │ ├── convert-to-openai-chat-messages.ts
│ │ ├── convert-to-openai-completion-prompt.ts
│ │ ├── get-response-metadata.ts
│ │ ├── index.ts
│ │ ├── internal
│ │ │ └── index.ts
│ │ ├── map-openai-chat-logprobs.ts
│ │ ├── map-openai-completion-logprobs.ts
│ │ ├── map-openai-finish-reason.ts
│ │ ├── openai-api-types.ts
│ │ ├── openai-chat-language-model.test.ts
│ │ ├── openai-chat-language-model.ts
│ │ ├── openai-chat-prompt.ts
│ │ ├── openai-chat-settings.ts
│ │ ├── openai-completion-language-model.test.ts
│ │ ├── openai-completion-language-model.ts
│ │ ├── openai-completion-settings.ts
│ │ ├── openai-config.ts
│ │ ├── openai-embedding-model.test.ts
│ │ ├── openai-embedding-model.ts
│ │ ├── openai-embedding-settings.ts
│ │ ├── openai-error.test.ts
│ │ ├── openai-error.ts
│ │ ├── openai-image-model.test.ts
│ │ ├── openai-image-model.ts
│ │ ├── openai-image-settings.ts
│ │ ├── openai-prepare-tools.ts
│ │ ├── openai-provider.ts
│ │ ├── openai-speech-model.test.ts
│ │ ├── openai-speech-model.ts
│ │ ├── openai-speech-settings.ts
│ │ ├── openai-tools.ts
│ │ ├── openai-transcription-model.test.ts
│ │ ├── openai-transcription-model.ts
│ │ ├── openai-transcription-settings.ts
│ │ ├── responses
│ │ │ ├── convert-to-openai-responses-messages.test.ts
│ │ │ ├── convert-to-openai-responses-messages.ts
│ │ │ ├── map-openai-responses-finish-reason.ts
│ │ │ ├── openai-responses-api-types.ts
│ │ │ ├── openai-responses-language-model.test.ts
│ │ │ ├── openai-responses-language-model.ts
│ │ │ ├── openai-responses-prepare-tools.ts
│ │ │ └── openai-responses-settings.ts
│ │ └── transcript-test.mp3
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── perplexity
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── __snapshots__
│ │ │ └── convert-to-perplexity-messages.test.ts.snap
│ │ ├── convert-to-perplexity-messages.test.ts
│ │ ├── convert-to-perplexity-messages.ts
│ │ ├── index.ts
│ │ ├── map-perplexity-finish-reason.ts
│ │ ├── perplexity-language-model-prompt.ts
│ │ ├── perplexity-language-model-settings.ts
│ │ ├── perplexity-language-model.test.ts
│ │ ├── perplexity-language-model.ts
│ │ └── perplexity-provider.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── provider-utils
│ ├── .gitignore
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── combine-headers.ts
│ │ ├── convert-async-iterator-to-readable-stream.ts
│ │ ├── delay.ts
│ │ ├── event-source-parser-stream.test.ts
│ │ ├── event-source-parser-stream.ts
│ │ ├── extract-response-headers.ts
│ │ ├── fetch-function.ts
│ │ ├── generate-id.test.ts
│ │ ├── generate-id.ts
│ │ ├── get-error-message.ts
│ │ ├── get-from-api.test.ts
│ │ ├── get-from-api.ts
│ │ ├── index.ts
│ │ ├── is-abort-error.ts
│ │ ├── load-api-key.ts
│ │ ├── load-optional-setting.ts
│ │ ├── load-setting.ts
│ │ ├── parse-json.test.ts
│ │ ├── parse-json.ts
│ │ ├── parse-provider-options.ts
│ │ ├── post-to-api.ts
│ │ ├── remove-undefined-entries.test.ts
│ │ ├── remove-undefined-entries.ts
│ │ ├── resolve.test.ts
│ │ ├── resolve.ts
│ │ ├── response-handler.test.ts
│ │ ├── response-handler.ts
│ │ ├── test
│ │ │ ├── convert-array-to-async-iterable.ts
│ │ │ ├── convert-array-to-readable-stream.ts
│ │ │ ├── convert-async-iterable-to-array.ts
│ │ │ ├── convert-readable-stream-to-array.ts
│ │ │ ├── convert-response-stream-to-array.ts
│ │ │ ├── index.ts
│ │ │ ├── json-test-server.ts
│ │ │ ├── mock-id.ts
│ │ │ ├── streaming-test-server.ts
│ │ │ ├── test-server.ts
│ │ │ └── unified-test-server.ts
│ │ ├── types
│ │ │ ├── tool-call.ts
│ │ │ └── tool-result.ts
│ │ ├── uint8-utils.ts
│ │ ├── validate-types.test.ts
│ │ ├── validate-types.ts
│ │ ├── validator.ts
│ │ └── without-trailing-slash.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── provider
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── embedding-model
│ │ │ ├── index.ts
│ │ │ └── v1
│ │ │ │ ├── embedding-model-v1-embedding.ts
│ │ │ │ ├── embedding-model-v1.ts
│ │ │ │ └── index.ts
│ │ ├── errors
│ │ │ ├── ai-sdk-error.ts
│ │ │ ├── api-call-error.ts
│ │ │ ├── empty-response-body-error.ts
│ │ │ ├── get-error-message.ts
│ │ │ ├── index.ts
│ │ │ ├── invalid-argument-error.ts
│ │ │ ├── invalid-prompt-error.ts
│ │ │ ├── invalid-response-data-error.ts
│ │ │ ├── json-parse-error.ts
│ │ │ ├── load-api-key-error.ts
│ │ │ ├── load-setting-error.ts
│ │ │ ├── no-content-generated-error.ts
│ │ │ ├── no-such-model-error.ts
│ │ │ ├── too-many-embedding-values-for-call-error.ts
│ │ │ ├── type-validation-error.ts
│ │ │ └── unsupported-functionality-error.ts
│ │ ├── image-model
│ │ │ ├── index.ts
│ │ │ └── v1
│ │ │ │ ├── image-model-v1-call-options.ts
│ │ │ │ ├── image-model-v1-call-warning.ts
│ │ │ │ ├── image-model-v1.ts
│ │ │ │ └── index.ts
│ │ ├── index.ts
│ │ ├── json-value
│ │ │ ├── index.ts
│ │ │ ├── is-json.ts
│ │ │ └── json-value.ts
│ │ ├── language-model
│ │ │ ├── index.ts
│ │ │ └── v1
│ │ │ │ ├── index.ts
│ │ │ │ ├── language-model-v1-call-options.ts
│ │ │ │ ├── language-model-v1-call-settings.ts
│ │ │ │ ├── language-model-v1-call-warning.ts
│ │ │ │ ├── language-model-v1-finish-reason.ts
│ │ │ │ ├── language-model-v1-function-tool-call.ts
│ │ │ │ ├── language-model-v1-function-tool.ts
│ │ │ │ ├── language-model-v1-logprobs.ts
│ │ │ │ ├── language-model-v1-prompt.ts
│ │ │ │ ├── language-model-v1-provider-defined-tool.ts
│ │ │ │ ├── language-model-v1-provider-metadata.ts
│ │ │ │ ├── language-model-v1-source.ts
│ │ │ │ ├── language-model-v1-tool-choice.ts
│ │ │ │ └── language-model-v1.ts
│ │ ├── provider
│ │ │ ├── index.ts
│ │ │ └── v1
│ │ │ │ ├── index.ts
│ │ │ │ └── provider-v1.ts
│ │ ├── speech-model
│ │ │ ├── index.ts
│ │ │ └── v1
│ │ │ │ ├── index.ts
│ │ │ │ ├── speech-model-v1-call-options.ts
│ │ │ │ ├── speech-model-v1-call-warning.ts
│ │ │ │ └── speech-model-v1.ts
│ │ └── transcription-model
│ │ │ ├── index.ts
│ │ │ └── v1
│ │ │ ├── index.ts
│ │ │ ├── transcription-model-v1-call-options.ts
│ │ │ ├── transcription-model-v1-call-warning.ts
│ │ │ └── transcription-model-v1.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ └── turbo.json
├── react
│ ├── .eslintrc.js
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ │ ├── setup-test-component.tsx
│ │ ├── throttle.ts
│ │ ├── use-assistant.ts
│ │ ├── use-assistant.ui.test.tsx
│ │ ├── use-chat.ts
│ │ ├── use-chat.ui.test.tsx
│ │ ├── use-completion.ts
│ │ ├── use-completion.ui.test.tsx
│ │ ├── use-object.ts
│ │ ├── use-object.ui.test.tsx
│ │ └── util
│ │ │ └── use-stable-value.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ └── vitest.config.js
├── replicate
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ │ ├── replicate-error.ts
│ │ ├── replicate-image-model.test.ts
│ │ ├── replicate-image-model.ts
│ │ ├── replicate-image-settings.ts
│ │ ├── replicate-provider.test.ts
│ │ └── replicate-provider.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── revai
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ │ ├── revai-api-types.ts
│ │ ├── revai-config.ts
│ │ ├── revai-error.test.ts
│ │ ├── revai-error.ts
│ │ ├── revai-provider.ts
│ │ ├── revai-transcription-model.test.ts
│ │ ├── revai-transcription-model.ts
│ │ ├── revai-transcription-settings.ts
│ │ └── transcript-test.mp3
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── solid
│ ├── .eslintrc.js
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ │ ├── package.json
│ │ ├── use-assistant.ts
│ │ ├── use-assistant.ui.test.tsx
│ │ ├── use-chat.ts
│ │ ├── use-chat.ui.test.tsx
│ │ ├── use-completion.ts
│ │ ├── use-completion.ui.test.tsx
│ │ ├── use-object.ts
│ │ ├── use-object.ui.test.tsx
│ │ └── utils
│ │ │ ├── convert-to-accessor-options.ts
│ │ │ └── reactive-lru.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ └── vitest.config.js
├── svelte
│ ├── .gitignore
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── eslint.config.js
│ ├── package.json
│ ├── src
│ │ ├── chat-context.svelte.ts
│ │ ├── chat.svelte.test.ts
│ │ ├── chat.svelte.ts
│ │ ├── completion-context.svelte.ts
│ │ ├── completion.svelte.test.ts
│ │ ├── completion.svelte.ts
│ │ ├── context-provider.ts
│ │ ├── index.ts
│ │ ├── structured-object-context.svelte.ts
│ │ ├── structured-object.svelte.test.ts
│ │ ├── structured-object.svelte.ts
│ │ ├── tests
│ │ │ ├── chat-synchronization.svelte
│ │ │ ├── completion-synchronization.svelte
│ │ │ └── structured-object-synchronization.svelte
│ │ └── utils.svelte.ts
│ ├── svelte.config.js
│ ├── tsconfig.json
│ ├── vite.config.ts
│ └── vitest-setup-client.ts
├── togetherai
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ │ ├── togetherai-chat-settings.ts
│ │ ├── togetherai-completion-settings.ts
│ │ ├── togetherai-embedding-settings.ts
│ │ ├── togetherai-image-model.test.ts
│ │ ├── togetherai-image-model.ts
│ │ ├── togetherai-image-settings.ts
│ │ ├── togetherai-provider.test.ts
│ │ └── togetherai-provider.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── ui-utils
│ ├── .eslintrc.js
│ ├── .gitignore
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── __snapshots__
│ │ │ ├── process-chat-response.test.ts.snap
│ │ │ ├── process-chat-text-response.test.ts.snap
│ │ │ └── zod-schema.test.ts.snap
│ │ ├── assistant-stream-parts.test.ts
│ │ ├── assistant-stream-parts.ts
│ │ ├── call-chat-api.ts
│ │ ├── call-completion-api.ts
│ │ ├── data-stream-parts.test.ts
│ │ ├── data-stream-parts.ts
│ │ ├── data-url.ts
│ │ ├── deep-partial.ts
│ │ ├── duplicated
│ │ │ └── usage.ts
│ │ ├── extract-max-tool-invocation-step.ts
│ │ ├── fill-message-parts.ts
│ │ ├── fix-json.test.ts
│ │ ├── fix-json.ts
│ │ ├── get-message-parts.test.ts
│ │ ├── get-message-parts.ts
│ │ ├── index.ts
│ │ ├── is-deep-equal-data.test.ts
│ │ ├── is-deep-equal-data.ts
│ │ ├── parse-partial-json.test.ts
│ │ ├── parse-partial-json.ts
│ │ ├── prepare-attachments-for-request.ts
│ │ ├── process-assistant-stream.test.ts
│ │ ├── process-assistant-stream.ts
│ │ ├── process-chat-response.test.ts
│ │ ├── process-chat-response.ts
│ │ ├── process-chat-text-response.test.ts
│ │ ├── process-chat-text-response.ts
│ │ ├── process-data-stream.test.ts
│ │ ├── process-data-stream.ts
│ │ ├── process-text-stream.test.ts
│ │ ├── process-text-stream.ts
│ │ ├── schema.ts
│ │ ├── should-resubmit-messages.test.ts
│ │ ├── should-resubmit-messages.ts
│ │ ├── test
│ │ │ ├── create-data-protocol-stream.ts
│ │ │ ├── index.ts
│ │ │ └── mock-fetch.ts
│ │ ├── types.ts
│ │ ├── update-tool-call-result.ts
│ │ ├── use-assistant-types.ts
│ │ ├── zod-schema.test.ts
│ │ └── zod-schema.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── valibot
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ │ └── valibot-schema.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── vercel
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ │ ├── vercel-chat-settings.ts
│ │ ├── vercel-provider.test.ts
│ │ └── vercel-provider.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── vue
│ ├── .eslintrc.js
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── TestChatAppendAttachmentsComponent.vue
│ │ ├── TestChatAssistantStreamComponent.vue
│ │ ├── TestChatAssistantThreadChangeComponent.vue
│ │ ├── TestChatAttachmentsComponent.vue
│ │ ├── TestChatComponent.vue
│ │ ├── TestChatCustomMetadataComponent.vue
│ │ ├── TestChatFormComponent.vue
│ │ ├── TestChatFormOptionsComponent.vue
│ │ ├── TestChatPrepareRequestBodyComponent.vue
│ │ ├── TestChatReloadComponent.vue
│ │ ├── TestChatTextStreamComponent.vue
│ │ ├── TestChatToolInvocationsComponent.vue
│ │ ├── TestChatUrlAttachmentsComponent.vue
│ │ ├── TestCompletionComponent.vue
│ │ ├── TestCompletionTextStreamComponent.vue
│ │ ├── index.ts
│ │ ├── package.json
│ │ ├── setup-test-component.ts
│ │ ├── shims-vue.d.ts
│ │ ├── use-assistant.ts
│ │ ├── use-assistant.ui.test.tsx
│ │ ├── use-chat.ts
│ │ ├── use-chat.ui.test.tsx
│ │ ├── use-completion.ts
│ │ └── use-completion.ui.test.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ └── vitest.config.js
└── xai
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src
│ ├── index.ts
│ ├── xai-chat-settings.ts
│ ├── xai-error.ts
│ ├── xai-image-settings.ts
│ ├── xai-provider.test.ts
│ └── xai-provider.ts
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ ├── turbo.json
│ ├── vitest.edge.config.js
│ └── vitest.node.config.js
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
├── socket.yaml
├── tools
├── analyze-downloads
│ ├── package.json
│ └── src
│ │ ├── analyze-market.ts
│ │ ├── analyze-providers.ts
│ │ └── analyze-versions.ts
├── eslint-config
│ ├── index.js
│ └── package.json
├── generate-llms-txt
│ ├── package.json
│ └── src
│ │ └── generate-llms-txt.ts
└── tsconfig
│ ├── base.json
│ ├── package.json
│ ├── react-library.json
│ └── ts-library.json
└── turbo.json
/.changeset/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://unpkg.com/@changesets/config@2.2.0/schema.json",
3 | "changelog": "@changesets/cli/changelog",
4 | "commit": false,
5 | "fixed": [],
6 | "linked": [],
7 | "access": "public",
8 | "baseBranch": "main",
9 | "updateInternalDependencies": "patch"
10 | }
11 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | // This tells ESLint to load the config from the package `eslint-config-vercel-ai`
4 | extends: ['vercel-ai'],
5 | settings: {
6 | next: {
7 | rootDir: ['apps/*/'],
8 | },
9 | },
10 | };
11 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Ask a question
4 | url: https://github.com/vercel/ai/discussions
5 | about: Please ask questions in our discussions forum.
6 |
--------------------------------------------------------------------------------
/.github/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Reporting Security Issues
2 |
3 | If you believe you have found a security vulnerability in the AI SDK, we encourage you to let us know right away.
4 |
5 | We will investigate all legitimate reports and do our best to quickly fix the problem.
6 |
7 | Email `security@vercel.com` to disclose any security vulnerabilities.
8 |
9 | https://vercel.com/security
10 |
--------------------------------------------------------------------------------
/.github/workflows/actions/verify-changesets/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "verify-changesets-action",
3 | "private": true,
4 | "type": "module",
5 | "scripts": {
6 | "test": "node --test test.js"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | .turbo
4 | *.log
5 | .next
6 | dist
7 | dist-ssr
8 | *.local
9 | .env
10 | .cache
11 | server/dist
12 | public/dist
13 | .turbo
14 | test-results
15 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | auto-install-peers = true
2 | link-workspace-packages = true
3 | public-hoist-pattern[]=*eslint*
4 | public-hoist-pattern[]=*prettier*
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | .next
2 | .nuxt
3 | node_modules
4 | dist
5 | .svelte-kit
6 | .solid
7 | _nuxt
8 | __testfixtures__
9 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "typescript.tsdk": "node_modules/typescript/lib"
3 | }
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | packages/ai/README.md
2 |
--------------------------------------------------------------------------------
/assets/hero.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/assets/hero.gif
--------------------------------------------------------------------------------
/content/cookbook/01-next/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Next.js
3 | ---
4 |
--------------------------------------------------------------------------------
/content/cookbook/05-node/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Node
3 | ---
4 |
--------------------------------------------------------------------------------
/content/cookbook/15-api-servers/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: API Servers
3 | ---
4 |
--------------------------------------------------------------------------------
/content/cookbook/20-rsc/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: React Server Components
3 | collapsed: true
4 | ---
5 |
--------------------------------------------------------------------------------
/content/docs/08-migration-guides/28-migration-guide-4-1.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Migrate AI SDK 4.0 to 4.1
3 | description: Learn how to upgrade AI SDK 4.0 to 4.1.
4 | ---
5 |
6 | # Migrate AI SDK 4.0 to 4.1
7 |
8 |
9 | Check out the [AI SDK 4.1 release blog
10 | post](https://vercel.com/blog/ai-sdk-4-1) for more information about the
11 | release.
12 |
13 |
14 | No breaking changes in this release.
15 |
--------------------------------------------------------------------------------
/content/docs/08-migration-guides/36-migration-guide-3-4.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Migrate AI SDK 3.3 to 3.4
3 | description: Learn how to upgrade AI SDK 3.3 to 3.4.
4 | ---
5 |
6 | # Migrate AI SDK 3.3 to 3.4
7 |
8 |
9 | Check out the [AI SDK 3.4 release blog
10 | post](https://vercel.com/blog/ai-sdk-3-4) for more information about the
11 | release.
12 |
13 |
14 | No breaking changes in this release.
15 |
--------------------------------------------------------------------------------
/content/docs/09-troubleshooting/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Troubleshooting
3 | description: Troubleshooting information for common issues encountered with the AI SDK.
4 | collapsed: true
5 | ---
6 |
7 | # Troubleshooting
8 |
9 | This section is designed to help you quickly identify and resolve common issues encountered with the AI SDK, ensuring a smoother and more efficient development experience.
10 |
11 |
12 |
--------------------------------------------------------------------------------
/examples/ai-core/.gitignore:
--------------------------------------------------------------------------------
1 | output
2 |
3 |
--------------------------------------------------------------------------------
/examples/ai-core/data/ai.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/ai-core/data/ai.pdf
--------------------------------------------------------------------------------
/examples/ai-core/data/comic-cat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/ai-core/data/comic-cat.png
--------------------------------------------------------------------------------
/examples/ai-core/data/galileo.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/ai-core/data/galileo.mp3
--------------------------------------------------------------------------------
/examples/ai-core/data/screenshot-editor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/ai-core/data/screenshot-editor.png
--------------------------------------------------------------------------------
/examples/ai-core/src/embed/azure.ts:
--------------------------------------------------------------------------------
1 | import { azure } from '@ai-sdk/azure';
2 | import { embed } from 'ai';
3 | import 'dotenv/config';
4 |
5 | async function main() {
6 | const { embedding, usage } = await embed({
7 | model: azure.embedding('my-embedding-deployment'),
8 | value: 'sunny day at the beach',
9 | });
10 |
11 | console.log(embedding);
12 | console.log(usage);
13 | }
14 |
15 | main().catch(console.error);
16 |
--------------------------------------------------------------------------------
/examples/ai-core/src/embed/cohere.ts:
--------------------------------------------------------------------------------
1 | import { cohere } from '@ai-sdk/cohere';
2 | import { embed } from 'ai';
3 | import 'dotenv/config';
4 |
5 | async function main() {
6 | const { embedding, usage } = await embed({
7 | model: cohere.embedding('embed-multilingual-v3.0'),
8 | value: 'sunny day at the beach',
9 | });
10 |
11 | console.log(embedding);
12 | console.log(usage);
13 | }
14 |
15 | main().catch(console.error);
16 |
--------------------------------------------------------------------------------
/examples/ai-core/src/embed/google-vertex.ts:
--------------------------------------------------------------------------------
1 | import { vertex } from '@ai-sdk/google-vertex';
2 | import { embed } from 'ai';
3 | import 'dotenv/config';
4 |
5 | async function main() {
6 | const { embedding, usage } = await embed({
7 | model: vertex.textEmbeddingModel('text-embedding-004'),
8 | value: 'sunny day at the beach',
9 | });
10 |
11 | console.log(embedding);
12 | console.log(usage);
13 | }
14 |
15 | main().catch(console.error);
16 |
--------------------------------------------------------------------------------
/examples/ai-core/src/embed/google.ts:
--------------------------------------------------------------------------------
1 | import { google } from '@ai-sdk/google';
2 | import { embed } from 'ai';
3 | import 'dotenv/config';
4 |
5 | async function main() {
6 | const { embedding, usage } = await embed({
7 | model: google.textEmbeddingModel('text-embedding-004'),
8 | value: 'sunny day at the beach',
9 | });
10 |
11 | console.log(embedding);
12 | console.log(usage);
13 | }
14 |
15 | main().catch(console.error);
16 |
--------------------------------------------------------------------------------
/examples/ai-core/src/embed/mistral.ts:
--------------------------------------------------------------------------------
1 | import { mistral } from '@ai-sdk/mistral';
2 | import { embed } from 'ai';
3 | import 'dotenv/config';
4 |
5 | async function main() {
6 | const { embedding, usage } = await embed({
7 | model: mistral.embedding('mistral-embed'),
8 | value: 'sunny day at the beach',
9 | });
10 |
11 | console.log(embedding);
12 | console.log(usage);
13 | }
14 |
15 | main().catch(console.error);
16 |
--------------------------------------------------------------------------------
/examples/ai-core/src/embed/openai.ts:
--------------------------------------------------------------------------------
1 | import { openai } from '@ai-sdk/openai';
2 | import { embed } from 'ai';
3 | import 'dotenv/config';
4 |
5 | async function main() {
6 | const { embedding, usage } = await embed({
7 | model: openai.embedding('text-embedding-3-small'),
8 | value: 'sunny day at the beach',
9 | });
10 |
11 | console.log(embedding);
12 | console.log(usage);
13 | }
14 |
15 | main().catch(console.error);
16 |
--------------------------------------------------------------------------------
/examples/ai-core/src/registry/embed-openai.ts:
--------------------------------------------------------------------------------
1 | import { embed } from 'ai';
2 | import { registry } from './setup-registry';
3 |
4 | async function main() {
5 | const { embedding } = await embed({
6 | model: registry.textEmbeddingModel('openai:text-embedding-3-small'),
7 | value: 'sunny day at the beach',
8 | });
9 |
10 | console.log(embedding);
11 | }
12 |
13 | main().catch(console.error);
14 |
--------------------------------------------------------------------------------
/examples/ai-core/vitest.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/examples/express/.env.example:
--------------------------------------------------------------------------------
1 | OPENAI_API_KEY=""
--------------------------------------------------------------------------------
/examples/fastify/.env.example:
--------------------------------------------------------------------------------
1 | OPENAI_API_KEY=""
--------------------------------------------------------------------------------
/examples/hono/.env.example:
--------------------------------------------------------------------------------
1 | OPENAI_API_KEY=""
--------------------------------------------------------------------------------
/examples/mcp/.env.example:
--------------------------------------------------------------------------------
1 | OPENAI_API_KEY=""
--------------------------------------------------------------------------------
/examples/nest/.env.example:
--------------------------------------------------------------------------------
1 | OPENAI_API_KEY=""
2 |
--------------------------------------------------------------------------------
/examples/nest/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true,
3 | "trailingComma": "all"
4 | }
--------------------------------------------------------------------------------
/examples/nest/nest-cli.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/nest-cli",
3 | "collection": "@nestjs/schematics",
4 | "sourceRoot": "src",
5 | "compilerOptions": {
6 | "deleteOutDir": true
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/examples/nest/src/app.module.ts:
--------------------------------------------------------------------------------
1 | import { Module } from '@nestjs/common';
2 | import { AppController } from './app.controller';
3 |
4 | @Module({
5 | imports: [],
6 | controllers: [AppController],
7 | providers: [],
8 | })
9 | export class AppModule {}
10 |
--------------------------------------------------------------------------------
/examples/nest/src/main.ts:
--------------------------------------------------------------------------------
1 | import { NestFactory } from '@nestjs/core';
2 | import { AppModule } from './app.module';
3 | import 'dotenv/config';
4 |
5 | async function bootstrap() {
6 | const app = await NestFactory.create(AppModule);
7 | await app.listen(8080);
8 | }
9 |
10 | bootstrap();
11 |
--------------------------------------------------------------------------------
/examples/nest/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
4 | }
5 |
--------------------------------------------------------------------------------
/examples/next-fastapi/.env.local.example:
--------------------------------------------------------------------------------
1 | # You must first activate a Billing Account here: https://platform.openai.com/account/billing/overview
2 | # Then get your OpenAI API Key here: https://platform.openai.com/account/api-keys
3 | OPENAI_API_KEY=xxxxxxx
4 |
--------------------------------------------------------------------------------
/examples/next-fastapi/api/utils/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/next-fastapi/api/utils/__init__.py
--------------------------------------------------------------------------------
/examples/next-fastapi/api/utils/tools.py:
--------------------------------------------------------------------------------
1 | import random
2 |
3 |
4 | def get_current_weather(location, unit="fahrenheit"):
5 | if unit == "celsius":
6 | temperature = random.randint(-34, 43)
7 | else:
8 | temperature = random.randint(-30, 110)
9 |
10 | return {
11 | "temperature": temperature,
12 | "unit": unit,
13 | "location": location,
14 | }
15 |
--------------------------------------------------------------------------------
/examples/next-fastapi/api/utils/types.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 |
3 |
4 | class ClientAttachment(BaseModel):
5 | name: str
6 | contentType: str
7 | url: str
8 |
9 |
10 | class ToolInvocation(BaseModel):
11 | toolCallId: str
12 | toolName: str
13 | args: dict
14 | result: dict
15 |
--------------------------------------------------------------------------------
/examples/next-fastapi/app/(examples)/01-chat-text/layout.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from 'next';
2 |
3 | export const metadata: Metadata = {
4 | title: 'useChat',
5 | };
6 |
7 | export default function Layout({ children }: { children: React.ReactNode }) {
8 | return <>{children}>;
9 | }
10 |
--------------------------------------------------------------------------------
/examples/next-fastapi/app/(examples)/02-chat-data/layout.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from 'next';
2 |
3 | export const metadata: Metadata = {
4 | title: 'useChat',
5 | };
6 |
7 | export default function Layout({ children }: { children: React.ReactNode }) {
8 | return <>{children}>;
9 | }
10 |
--------------------------------------------------------------------------------
/examples/next-fastapi/app/(examples)/03-chat-attachments/layout.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from 'next';
2 |
3 | export const metadata: Metadata = {
4 | title: 'useChat with attachments',
5 | };
6 |
7 | export default function Layout({ children }: { children: React.ReactNode }) {
8 | return <>{children}>;
9 | }
10 |
--------------------------------------------------------------------------------
/examples/next-fastapi/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/next-fastapi/app/favicon.ico
--------------------------------------------------------------------------------
/examples/next-fastapi/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
5 | :root {
6 | --foreground-rgb: 0, 0, 0;
7 | --background-start-rgb: 214, 219, 220;
8 | --background-end-rgb: 255, 255, 255;
9 | }
10 |
--------------------------------------------------------------------------------
/examples/next-fastapi/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/examples/next-google-vertex/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["vercel-ai"],
3 | "settings": {
4 | "next": {
5 | "rootDir": "."
6 | }
7 | },
8 | "rules": {
9 | "@next/next/no-html-link-for-pages": "off"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/examples/next-google-vertex/app/api/generate-edge/route.ts:
--------------------------------------------------------------------------------
1 | export const runtime = 'edge';
2 |
3 | import { generateText } from 'ai';
4 | import { vertex } from '@ai-sdk/google-vertex/edge';
5 |
6 | export async function GET() {
7 | const model = vertex('gemini-1.5-flash');
8 | const { text } = await generateText({
9 | model,
10 | prompt: 'tell me a story',
11 | });
12 | return Response.json({ message: text });
13 | }
14 |
--------------------------------------------------------------------------------
/examples/next-google-vertex/app/api/generate-node/route.ts:
--------------------------------------------------------------------------------
1 | import { vertex } from '@ai-sdk/google-vertex';
2 | import { generateText } from 'ai';
3 |
4 | export async function GET() {
5 | const model = vertex('gemini-1.5-flash');
6 | const { text } = await generateText({
7 | model,
8 | prompt: 'tell me a story',
9 | });
10 | return Response.json({ message: text });
11 | }
12 |
--------------------------------------------------------------------------------
/examples/next-google-vertex/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/next-google-vertex/app/favicon.ico
--------------------------------------------------------------------------------
/examples/next-google-vertex/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {};
3 |
4 | module.exports = nextConfig;
5 |
--------------------------------------------------------------------------------
/examples/next-google-vertex/postcss.config.mjs:
--------------------------------------------------------------------------------
1 | /** @type {import('postcss-load-config').Config} */
2 | const config = {
3 | plugins: {
4 | tailwindcss: {},
5 | },
6 | };
7 |
8 | export default config;
9 |
--------------------------------------------------------------------------------
/examples/next-langchain/.env.local.example:
--------------------------------------------------------------------------------
1 | OPENAI_API_KEY=xxxxxxx
--------------------------------------------------------------------------------
/examples/next-langchain/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/next-langchain/app/favicon.ico
--------------------------------------------------------------------------------
/examples/next-langchain/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/examples/next-langchain/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {};
3 |
4 | module.exports = nextConfig;
5 |
--------------------------------------------------------------------------------
/examples/next-langchain/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/examples/next-openai-kasada-bot-protection/.env.local.example:
--------------------------------------------------------------------------------
1 | OPENAI_API_KEY=xxxxxxx
2 | KV_REST_API_URL=xxxxxxx
3 | KV_REST_API_TOKEN=xxxxxxx
--------------------------------------------------------------------------------
/examples/next-openai-kasada-bot-protection/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/next-openai-kasada-bot-protection/app/favicon.ico
--------------------------------------------------------------------------------
/examples/next-openai-kasada-bot-protection/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/examples/next-openai-kasada-bot-protection/app/toaster.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 |
3 | export { Toaster as default } from 'sonner';
4 |
--------------------------------------------------------------------------------
/examples/next-openai-kasada-bot-protection/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {};
3 |
4 | module.exports = nextConfig;
5 |
--------------------------------------------------------------------------------
/examples/next-openai-kasada-bot-protection/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/examples/next-openai-pages/.env.local.example:
--------------------------------------------------------------------------------
1 | OPENAI_API_KEY=xxxxxxx
2 | ASSISTANT_ID=xxxxxxx
--------------------------------------------------------------------------------
/examples/next-openai-pages/app/api/stream-text/route.ts:
--------------------------------------------------------------------------------
1 | import { streamText } from 'ai';
2 | import { openai } from '@ai-sdk/openai';
3 |
4 | export async function POST(req: Request) {
5 | const { prompt }: { prompt: string } = await req.json();
6 |
7 | const result = streamText({
8 | model: openai('gpt-4'),
9 | system: 'You are a helpful assistant.',
10 | prompt,
11 | });
12 |
13 | return result.toDataStreamResponse();
14 | }
15 |
--------------------------------------------------------------------------------
/examples/next-openai-pages/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {};
3 |
4 | module.exports = nextConfig;
5 |
--------------------------------------------------------------------------------
/examples/next-openai-pages/pages/_app.tsx:
--------------------------------------------------------------------------------
1 | import '@/styles/globals.css';
2 | import type { AppProps } from 'next/app';
3 |
4 | export default function App({ Component, pageProps }: AppProps) {
5 | return ;
6 | }
7 |
--------------------------------------------------------------------------------
/examples/next-openai-pages/pages/_document.tsx:
--------------------------------------------------------------------------------
1 | import { Html, Head, Main, NextScript } from 'next/document';
2 |
3 | export default function Document() {
4 | return (
5 |
6 |
8 |
9 |
10 |
11 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/examples/next-openai-pages/pages/api/chat-edge.ts:
--------------------------------------------------------------------------------
1 | import { openai } from '@ai-sdk/openai';
2 | import { streamText } from 'ai';
3 |
4 | export const runtime = 'edge';
5 |
6 | export default async function handler(req: Request) {
7 | const { messages } = await req.json();
8 |
9 | const result = streamText({
10 | model: openai('gpt-4-turbo-preview'),
11 | messages,
12 | });
13 |
14 | return result.toDataStreamResponse();
15 | }
16 |
--------------------------------------------------------------------------------
/examples/next-openai-pages/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/examples/next-openai-pages/styles/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/examples/next-openai-telemetry-sentry/.env.local.example:
--------------------------------------------------------------------------------
1 | OPENAI_API_KEY=xxxxxxx
2 | SENTRY_AUTH_TOKEN=xxxxxxx
3 | SENTRY_ORG=xxxxxxx
4 | SENTRY_PROJECT=xxxxxxx
5 | NEXT_PUBLIC_SENTRY_DSN=xxxxxxx
--------------------------------------------------------------------------------
/examples/next-openai-telemetry-sentry/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/next-openai-telemetry-sentry/app/favicon.ico
--------------------------------------------------------------------------------
/examples/next-openai-telemetry-sentry/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/examples/next-openai-telemetry-sentry/instrumentation.ts:
--------------------------------------------------------------------------------
1 | import { registerOTel } from '@vercel/otel';
2 |
3 | export async function register() {
4 | if (process.env.NEXT_RUNTIME === 'nodejs') {
5 | await import('./sentry.server.config');
6 | }
7 |
8 | if (process.env.NEXT_RUNTIME === 'edge') {
9 | await import('./sentry.edge.config');
10 | }
11 |
12 | registerOTel({
13 | serviceName: 'next-app',
14 | });
15 | }
16 |
--------------------------------------------------------------------------------
/examples/next-openai-telemetry-sentry/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/examples/next-openai-telemetry/.env.local.example:
--------------------------------------------------------------------------------
1 | OPENAI_API_KEY=xxxxxxx
--------------------------------------------------------------------------------
/examples/next-openai-telemetry/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/next-openai-telemetry/app/favicon.ico
--------------------------------------------------------------------------------
/examples/next-openai-telemetry/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/examples/next-openai-telemetry/instrumentation.ts:
--------------------------------------------------------------------------------
1 | import { registerOTel } from '@vercel/otel';
2 |
3 | export function register() {
4 | registerOTel({
5 | serviceName: 'next-app',
6 | });
7 | }
8 |
--------------------------------------------------------------------------------
/examples/next-openai-telemetry/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {};
3 |
4 | module.exports = nextConfig;
5 |
--------------------------------------------------------------------------------
/examples/next-openai-telemetry/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/examples/next-openai-upstash-rate-limits/.env.local.example:
--------------------------------------------------------------------------------
1 | OPENAI_API_KEY=xxxxxxx
2 | KV_REST_API_URL=xxxxxxx
3 | KV_REST_API_TOKEN=xxxxxxx
--------------------------------------------------------------------------------
/examples/next-openai-upstash-rate-limits/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/next-openai-upstash-rate-limits/app/favicon.ico
--------------------------------------------------------------------------------
/examples/next-openai-upstash-rate-limits/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/examples/next-openai-upstash-rate-limits/app/toaster.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 |
3 | export { Toaster as default } from 'sonner';
4 |
--------------------------------------------------------------------------------
/examples/next-openai-upstash-rate-limits/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {};
3 |
4 | module.exports = nextConfig;
5 |
--------------------------------------------------------------------------------
/examples/next-openai-upstash-rate-limits/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/examples/next-openai/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/next-openai/app/favicon.ico
--------------------------------------------------------------------------------
/examples/next-openai/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/examples/next-openai/app/stream-assistant-responses-with-tools/ai.ts:
--------------------------------------------------------------------------------
1 | import { createAI } from 'ai/rsc';
2 | import { submitMessage } from './actions';
3 |
4 | export const AI = createAI({
5 | actions: {
6 | submitMessage,
7 | },
8 | initialAIState: [],
9 | initialUIState: [],
10 | });
11 |
--------------------------------------------------------------------------------
/examples/next-openai/app/stream-assistant-responses-with-tools/layout.tsx:
--------------------------------------------------------------------------------
1 | import { ReactNode } from 'react';
2 | import { AI } from './ai';
3 |
4 | export default function Layout({ children }: { children: ReactNode }) {
5 | return {children};
6 | }
7 |
--------------------------------------------------------------------------------
/examples/next-openai/app/stream-assistant-responses-with-tools/message.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 |
3 | import { StreamableValue, useStreamableValue } from 'ai/rsc';
4 |
5 | export function Message({ textStream }: { textStream: StreamableValue }) {
6 | const [text] = useStreamableValue(textStream);
7 |
8 | return {text}
;
9 | }
10 |
--------------------------------------------------------------------------------
/examples/next-openai/app/stream-assistant-responses/ai.ts:
--------------------------------------------------------------------------------
1 | import { createAI } from 'ai/rsc';
2 | import { submitMessage } from './actions';
3 |
4 | export const AI = createAI({
5 | actions: {
6 | submitMessage,
7 | },
8 | initialAIState: [],
9 | initialUIState: [],
10 | });
11 |
--------------------------------------------------------------------------------
/examples/next-openai/app/stream-assistant-responses/layout.tsx:
--------------------------------------------------------------------------------
1 | import { ReactNode } from 'react';
2 | import { AI } from './ai';
3 |
4 | export default function Layout({ children }: { children: ReactNode }) {
5 | return {children};
6 | }
7 |
--------------------------------------------------------------------------------
/examples/next-openai/app/stream-assistant-responses/message.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 |
3 | import { StreamableValue, useStreamableValue } from 'ai/rsc';
4 |
5 | export function Message({ textStream }: { textStream: StreamableValue }) {
6 | const [text] = useStreamableValue(textStream);
7 |
8 | return {text}
;
9 | }
10 |
--------------------------------------------------------------------------------
/examples/next-openai/app/stream-ui/ai.ts:
--------------------------------------------------------------------------------
1 | import { createAI } from 'ai/rsc';
2 | import { AIState, submitUserMessage, UIState } from './actions';
3 | import { generateId } from 'ai';
4 |
5 | export const AI = createAI({
6 | actions: { submitUserMessage },
7 | initialUIState: [] as UIState,
8 | initialAIState: { chatId: generateId(), messages: [] } as AIState,
9 | });
10 |
--------------------------------------------------------------------------------
/examples/next-openai/app/stream-ui/layout.tsx:
--------------------------------------------------------------------------------
1 | import { AI } from './ai';
2 |
3 | export default function Layout({ children }: { children: React.ReactNode }) {
4 | return {children};
5 | }
6 |
--------------------------------------------------------------------------------
/examples/next-openai/app/use-chat-persistence-single-message-image-output/page.tsx:
--------------------------------------------------------------------------------
1 | import { redirect } from 'next/navigation';
2 | import { createChat } from '@util/chat-store';
3 |
4 | export default async function ChatPage() {
5 | const id = await createChat();
6 | redirect(`/use-chat-persistence-single-message-image-output/${id}`);
7 | }
8 |
--------------------------------------------------------------------------------
/examples/next-openai/app/use-chat-persistence-single-message-tools/page.tsx:
--------------------------------------------------------------------------------
1 | import { redirect } from 'next/navigation';
2 | import { createChat } from '@util/chat-store';
3 |
4 | export default async function ChatPage() {
5 | const id = await createChat();
6 | redirect(`/use-chat-persistence-single-message-tools/${id}`);
7 | }
8 |
--------------------------------------------------------------------------------
/examples/next-openai/app/use-chat-persistence-single-message/page.tsx:
--------------------------------------------------------------------------------
1 | import { redirect } from 'next/navigation';
2 | import { createChat } from '@util/chat-store';
3 |
4 | export default async function ChatPage() {
5 | const id = await createChat();
6 | redirect(`/use-chat-persistence-single-message/${id}`);
7 | }
8 |
--------------------------------------------------------------------------------
/examples/next-openai/app/use-chat-persistence/[id]/page.tsx:
--------------------------------------------------------------------------------
1 | import { loadChat } from '@util/chat-store';
2 | import Chat from './chat';
3 |
4 | export default async function Page(props: { params: Promise<{ id: string }> }) {
5 | const { id } = await props.params; // get the chat ID from the URL
6 | const messages = await loadChat(id); // load the chat messages
7 | return ; // display the chat
8 | }
9 |
--------------------------------------------------------------------------------
/examples/next-openai/app/use-chat-persistence/page.tsx:
--------------------------------------------------------------------------------
1 | import { redirect } from 'next/navigation';
2 | import { createChat } from '@util/chat-store';
3 |
4 | export default async function ChatPage() {
5 | const id = await createChat();
6 | redirect(`/use-chat-persistence/${id}`);
7 | }
8 |
--------------------------------------------------------------------------------
/examples/next-openai/app/use-chat-resilient-persistence/[id]/page.tsx:
--------------------------------------------------------------------------------
1 | import { loadChat } from '@util/chat-store';
2 | import Chat from './chat';
3 |
4 | export default async function Page(props: { params: Promise<{ id: string }> }) {
5 | const { id } = await props.params; // get the chat ID from the URL
6 | const messages = await loadChat(id); // load the chat messages
7 | return ; // display the chat
8 | }
9 |
--------------------------------------------------------------------------------
/examples/next-openai/app/use-chat-resilient-persistence/page.tsx:
--------------------------------------------------------------------------------
1 | import { redirect } from 'next/navigation';
2 | import { createChat } from '@util/chat-store';
3 |
4 | export default async function ChatPage() {
5 | const id = await createChat();
6 | redirect(`/use-chat-resilient-persistence/${id}`);
7 | }
8 |
--------------------------------------------------------------------------------
/examples/next-openai/app/use-chat-resume/[id]/page.tsx:
--------------------------------------------------------------------------------
1 | import { loadChat } from '@/util/chat-store';
2 | import { Chat } from '../chat';
3 |
4 | export default async function Page({
5 | params,
6 | }: {
7 | params: Promise<{ id: string }>;
8 | }) {
9 | const { id } = await params;
10 |
11 | const messages = await loadChat(id);
12 |
13 | return ;
14 | }
15 |
--------------------------------------------------------------------------------
/examples/next-openai/app/use-chat-resume/page.tsx:
--------------------------------------------------------------------------------
1 | import { Chat } from './chat';
2 | import { generateId } from 'ai';
3 |
4 | export default function Page() {
5 | const chatId = generateId(32);
6 |
7 | return ;
8 | }
9 |
--------------------------------------------------------------------------------
/examples/next-openai/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {};
3 |
4 | module.exports = nextConfig;
5 |
--------------------------------------------------------------------------------
/examples/next-openai/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/examples/node-http-server/.env.example:
--------------------------------------------------------------------------------
1 | # You must first activate a Billing Account here: https://platform.openai.com/account/billing/overview
2 | # Then get your OpenAI API Key here: https://platform.openai.com/api-keys
3 | OPENAI_API_KEY=""
--------------------------------------------------------------------------------
/examples/nuxt-openai/.env.example:
--------------------------------------------------------------------------------
1 | NUXT_OPENAI_API_KEY=xxxxxxx
2 | NUXT_ASSISTANT_ID=xxxxxxx
--------------------------------------------------------------------------------
/examples/nuxt-openai/.gitignore:
--------------------------------------------------------------------------------
1 | # Nuxt dev/build outputs
2 | .output
3 | .nuxt
4 | .vercel
5 | .nitro
6 | .cache
7 | dist
8 |
9 | # Node dependencies
10 | node_modules
11 |
12 | # Logs
13 | logs
14 | *.log
15 |
16 | # Misc
17 | .DS_Store
18 | .fleet
19 | .idea
20 |
21 | # Local env files
22 | .env
23 | .env.*
24 | !.env.example
25 | .dev.vars
26 | .data
--------------------------------------------------------------------------------
/examples/nuxt-openai/server/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../.nuxt/tsconfig.server.json"
3 | }
4 |
--------------------------------------------------------------------------------
/examples/nuxt-openai/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | // https://nuxt.com/docs/guide/concepts/typescript
3 | "extends": "./.nuxt/tsconfig.json"
4 | }
5 |
--------------------------------------------------------------------------------
/examples/solidstart-openai/.env.example:
--------------------------------------------------------------------------------
1 | OPENAI_API_KEY=xxxxxxx
2 |
--------------------------------------------------------------------------------
/examples/solidstart-openai/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | dist
3 | .solid
4 | .output
5 | .vercel
6 | .netlify
7 | .vinxi
8 |
9 | # Environment
10 | .env
11 | .env*.local
12 |
13 | # dependencies
14 | /node_modules
15 |
16 | # IDEs and editors
17 | /.idea
18 | .project
19 | .classpath
20 | *.launch
21 | .settings/
22 |
23 | # Temp
24 | gitignore
25 |
26 | # System Files
27 | .DS_Store
28 | Thumbs.db
29 |
--------------------------------------------------------------------------------
/examples/solidstart-openai/app.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from '@solidjs/start/config';
2 |
3 | export default defineConfig({});
4 |
--------------------------------------------------------------------------------
/examples/solidstart-openai/postcss.config.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/examples/solidstart-openai/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/solidstart-openai/public/favicon.ico
--------------------------------------------------------------------------------
/examples/solidstart-openai/src/app.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
--------------------------------------------------------------------------------
/examples/solidstart-openai/src/entry-client.tsx:
--------------------------------------------------------------------------------
1 | // @refresh reload
2 | import { mount, StartClient } from '@solidjs/start/client';
3 |
4 | mount(() => , document.getElementById('app')!);
5 |
--------------------------------------------------------------------------------
/examples/solidstart-openai/src/global.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/examples/solidstart-openai/tailwind.config.cjs:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | content: ["./src/**/*.{html,js,jsx,ts,tsx}"],
4 | theme: {
5 | extend: {}
6 | },
7 | plugins: []
8 | };
9 |
--------------------------------------------------------------------------------
/examples/sveltekit-openai/.gitignore:
--------------------------------------------------------------------------------
1 | .output
2 | .vercel
3 | /.svelte-kit
4 | /build
5 | /dist
6 |
7 | vite.config.js.timestamp-*
8 | vite.config.ts.timestamp-*
9 |
--------------------------------------------------------------------------------
/examples/sveltekit-openai/README.md:
--------------------------------------------------------------------------------
1 | # `sveltekit-openai`
2 |
3 | To run this example, clone the repository, and at the root install dependencies and build:
4 |
5 | ```
6 | pnpm install
7 | pnpm build
8 | ```
9 |
10 | Then create a `.env.local` file in `examples/sveltekit-openai` with:
11 |
12 | ```
13 | OPENAI_API_KEY=
14 | ```
15 |
16 | Then, run:
17 |
18 | ```bash
19 | pnpm -F sveltekit-openai dev
20 | ```
21 |
--------------------------------------------------------------------------------
/examples/sveltekit-openai/postcss.config.js:
--------------------------------------------------------------------------------
1 | export default {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/examples/sveltekit-openai/src/app.d.ts:
--------------------------------------------------------------------------------
1 | // See https://svelte.dev/docs/kit/types#app.d.ts
2 | // for information about these interfaces
3 | declare global {
4 | namespace App {
5 | // interface Error {}
6 | // interface Locals {}
7 | // interface PageData {}
8 | // interface PageState {}
9 | // interface Platform {}
10 | }
11 | }
12 |
13 | export {};
14 |
--------------------------------------------------------------------------------
/examples/sveltekit-openai/src/app.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | %sveltekit.head%
8 |
9 |
10 | %sveltekit.body%
11 |
12 |
13 |
--------------------------------------------------------------------------------
/examples/sveltekit-openai/src/lib/components/ui/button/index.ts:
--------------------------------------------------------------------------------
1 | import Root, {
2 | type ButtonProps,
3 | type ButtonSize,
4 | type ButtonVariant,
5 | buttonVariants,
6 | } from './button.svelte';
7 |
8 | export {
9 | Root,
10 | type ButtonProps as Props,
11 | //
12 | Root as Button,
13 | buttonVariants,
14 | type ButtonProps,
15 | type ButtonSize,
16 | type ButtonVariant,
17 | };
18 |
--------------------------------------------------------------------------------
/examples/sveltekit-openai/src/lib/components/ui/textarea/index.ts:
--------------------------------------------------------------------------------
1 | import Root from './textarea.svelte';
2 |
3 | export {
4 | Root,
5 | //
6 | Root as Textarea,
7 | };
8 |
--------------------------------------------------------------------------------
/examples/sveltekit-openai/src/lib/utils.ts:
--------------------------------------------------------------------------------
1 | import { type ClassValue, clsx } from 'clsx';
2 | import { twMerge } from 'tailwind-merge';
3 |
4 | export function cn(...inputs: ClassValue[]) {
5 | return twMerge(clsx(inputs));
6 | }
7 |
--------------------------------------------------------------------------------
/examples/sveltekit-openai/src/routes/+layout.svelte:
--------------------------------------------------------------------------------
1 |
8 |
9 | {@render children()}
10 |
--------------------------------------------------------------------------------
/examples/sveltekit-openai/src/routes/structured-object/schema.ts:
--------------------------------------------------------------------------------
1 | import { z } from 'zod';
2 |
3 | // define a schema for the notifications
4 | export const notificationSchema = z.object({
5 | notifications: z.array(
6 | z.object({
7 | name: z.string().describe('Name of a fictional person.'),
8 | message: z.string().describe('Message. Do not use emojis or links.'),
9 | }),
10 | ),
11 | });
12 |
--------------------------------------------------------------------------------
/examples/sveltekit-openai/static/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/examples/sveltekit-openai/static/favicon.png
--------------------------------------------------------------------------------
/examples/sveltekit-openai/static/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/examples/sveltekit-openai/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["//"],
3 | "tasks": {
4 | "build": {
5 | "outputs": [".svelte-kit/**", ".vercel/**"]
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/examples/sveltekit-openai/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { sveltekit } from '@sveltejs/kit/vite';
2 | import { defineConfig } from 'vite';
3 |
4 | export default defineConfig({
5 | plugins: [sveltekit()],
6 | });
7 |
--------------------------------------------------------------------------------
/packages/ai/.changeset/quick-toys-study.md:
--------------------------------------------------------------------------------
1 | ---
2 | 'ai': patch
3 | ---
4 |
5 | fix (ai/mcp-stdio): make `createChildProcess` synchronous to prevent spawn race condition
6 |
--------------------------------------------------------------------------------
/packages/ai/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: ['vercel-ai'],
4 | };
5 |
--------------------------------------------------------------------------------
/packages/ai/core/data-stream/index.ts:
--------------------------------------------------------------------------------
1 | export { createDataStream } from './create-data-stream';
2 | export { createDataStreamResponse } from './create-data-stream-response';
3 | export type { DataStreamWriter } from './data-stream-writer';
4 | export { pipeDataStreamToResponse } from './pipe-data-stream-to-response';
5 |
--------------------------------------------------------------------------------
/packages/ai/core/embed/index.ts:
--------------------------------------------------------------------------------
1 | export * from './embed';
2 | export * from './embed-many';
3 | export * from './embed-many-result';
4 | export * from './embed-result';
5 |
--------------------------------------------------------------------------------
/packages/ai/core/generate-image/index.ts:
--------------------------------------------------------------------------------
1 | export { generateImage as experimental_generateImage } from './generate-image';
2 | export type { GenerateImageResult as Experimental_GenerateImageResult } from './generate-image-result';
3 |
--------------------------------------------------------------------------------
/packages/ai/core/generate-speech/index.ts:
--------------------------------------------------------------------------------
1 | export { generateSpeech as experimental_generateSpeech } from './generate-speech';
2 | export type { SpeechResult as Experimental_SpeechResult } from './generate-speech-result';
3 | export type { GeneratedAudioFile } from './generated-audio-file';
4 |
--------------------------------------------------------------------------------
/packages/ai/core/generate-text/tool-set.ts:
--------------------------------------------------------------------------------
1 | import { Tool } from '../tool';
2 |
3 | export type ToolSet = Record;
4 |
--------------------------------------------------------------------------------
/packages/ai/core/prompt/prepare-retries.test.ts:
--------------------------------------------------------------------------------
1 | import { expect, it } from 'vitest';
2 | import { prepareRetries } from './prepare-retries';
3 |
4 | it('should set default values correctly when no input is provided', () => {
5 | const defaultResult = prepareRetries({ maxRetries: undefined });
6 | expect(defaultResult.maxRetries).toBe(2);
7 | });
8 |
--------------------------------------------------------------------------------
/packages/ai/core/registry/index.ts:
--------------------------------------------------------------------------------
1 | export { customProvider, experimental_customProvider } from './custom-provider';
2 | export { NoSuchProviderError } from './no-such-provider-error';
3 | export {
4 | createProviderRegistry,
5 | experimental_createProviderRegistry,
6 | } from './provider-registry';
7 | export type { ProviderRegistryProvider } from './provider-registry';
8 |
--------------------------------------------------------------------------------
/packages/ai/core/test/mock-values.ts:
--------------------------------------------------------------------------------
1 | export function mockValues(...values: T[]): () => T {
2 | let counter = 0;
3 | return () => values[counter++] ?? values[values.length - 1];
4 | }
5 |
--------------------------------------------------------------------------------
/packages/ai/core/test/not-implemented.ts:
--------------------------------------------------------------------------------
1 | export function notImplemented(): never {
2 | throw new Error('Not implemented');
3 | }
4 |
--------------------------------------------------------------------------------
/packages/ai/core/tool/index.ts:
--------------------------------------------------------------------------------
1 | export type {
2 | JSONRPCError,
3 | JSONRPCMessage,
4 | JSONRPCNotification,
5 | JSONRPCRequest,
6 | JSONRPCResponse,
7 | } from './mcp/json-rpc-message';
8 | export { createMCPClient as experimental_createMCPClient } from './mcp/mcp-client';
9 | export type { MCPTransport } from './mcp/mcp-transport';
10 | export { tool } from './tool';
11 | export type { CoreTool, Tool, ToolExecutionOptions } from './tool';
12 |
--------------------------------------------------------------------------------
/packages/ai/core/transcribe/index.ts:
--------------------------------------------------------------------------------
1 | export { transcribe as experimental_transcribe } from './transcribe';
2 | export type { TranscriptionResult as Experimental_TranscriptionResult } from './transcribe-result';
3 |
--------------------------------------------------------------------------------
/packages/ai/core/types/embedding-model.ts:
--------------------------------------------------------------------------------
1 | import { EmbeddingModelV1, EmbeddingModelV1Embedding } from '@ai-sdk/provider';
2 |
3 | /**
4 | Embedding model that is used by the AI SDK Core functions.
5 | */
6 | export type EmbeddingModel = EmbeddingModelV1;
7 |
8 | /**
9 | Embedding.
10 | */
11 | export type Embedding = EmbeddingModelV1Embedding;
12 |
--------------------------------------------------------------------------------
/packages/ai/core/types/image-model-response-metadata.ts:
--------------------------------------------------------------------------------
1 | export type ImageModelResponseMetadata = {
2 | /**
3 | Timestamp for the start of the generated response.
4 | */
5 | timestamp: Date;
6 |
7 | /**
8 | The ID of the response model that was used to generate the response.
9 | */
10 | modelId: string;
11 |
12 | /**
13 | Response headers.
14 | */
15 | headers?: Record;
16 | };
17 |
--------------------------------------------------------------------------------
/packages/ai/core/types/json-value.ts:
--------------------------------------------------------------------------------
1 | import { JSONValue } from '@ai-sdk/provider';
2 | import { z } from 'zod';
3 |
4 | export const jsonValueSchema: z.ZodType = z.lazy(() =>
5 | z.union([
6 | z.null(),
7 | z.string(),
8 | z.number(),
9 | z.boolean(),
10 | z.record(z.string(), jsonValueSchema),
11 | z.array(jsonValueSchema),
12 | ]),
13 | );
14 |
--------------------------------------------------------------------------------
/packages/ai/core/types/language-model-request-metadata.ts:
--------------------------------------------------------------------------------
1 | export type LanguageModelRequestMetadata = {
2 | /**
3 | Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
4 | */
5 | body?: string;
6 | };
7 |
--------------------------------------------------------------------------------
/packages/ai/core/types/speech-model-response-metadata.ts:
--------------------------------------------------------------------------------
1 | export type SpeechModelResponseMetadata = {
2 | /**
3 | Timestamp for the start of the generated response.
4 | */
5 | timestamp: Date;
6 |
7 | /**
8 | The ID of the response model that was used to generate the response.
9 | */
10 | modelId: string;
11 |
12 | /**
13 | Response headers.
14 | */
15 | headers?: Record;
16 | };
17 |
--------------------------------------------------------------------------------
/packages/ai/core/types/transcription-model-response-metadata.ts:
--------------------------------------------------------------------------------
1 | export type TranscriptionModelResponseMetadata = {
2 | /**
3 | Timestamp for the start of the generated response.
4 | */
5 | timestamp: Date;
6 |
7 | /**
8 | The ID of the response model that was used to generate the response.
9 | */
10 | modelId: string;
11 |
12 | /**
13 | Response headers.
14 | */
15 | headers?: Record;
16 | };
17 |
--------------------------------------------------------------------------------
/packages/ai/core/util/is-non-empty-object.ts:
--------------------------------------------------------------------------------
1 | export function isNonEmptyObject(
2 | object: Record | undefined | null,
3 | ): object is Record {
4 | return object != null && Object.keys(object).length > 0;
5 | }
6 |
--------------------------------------------------------------------------------
/packages/ai/core/util/now.ts:
--------------------------------------------------------------------------------
1 | // Shim for performance.now() to support environments that don't have it:
2 | export function now(): number {
3 | return globalThis?.performance?.now() ?? Date.now();
4 | }
5 |
--------------------------------------------------------------------------------
/packages/ai/core/util/remove-text-after-last-whitespace.ts:
--------------------------------------------------------------------------------
1 | import { splitOnLastWhitespace } from './split-on-last-whitespace';
2 |
3 | export function removeTextAfterLastWhitespace(text: string): string {
4 | const match = splitOnLastWhitespace(text);
5 | return match ? match.prefix + match.whitespace : text;
6 | }
7 |
--------------------------------------------------------------------------------
/packages/ai/mcp-stdio/index.ts:
--------------------------------------------------------------------------------
1 | export {
2 | StdioMCPTransport as Experimental_StdioMCPTransport,
3 | type StdioConfig,
4 | } from './mcp-stdio-transport';
5 |
--------------------------------------------------------------------------------
/packages/ai/react/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "main": "./dist/index.js",
3 | "module": "./dist/index.mjs",
4 | "types": "./dist/index.d.ts",
5 | "exports": "./dist/index.mjs",
6 | "private": true,
7 | "peerDependencies": {
8 | "react": ">=18"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/packages/ai/rsc/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "types": "./dist/index.d.ts",
3 | "exports": {
4 | "types": "./dist/index.d.ts",
5 | "react-server": "./dist/rsc-server.mjs",
6 | "import": "./dist/rsc-client.mjs"
7 | },
8 | "private": true,
9 | "peerDependencies": {
10 | "react": ">=18",
11 | "zod": ">=3"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/packages/ai/rsc/rsc-client.ts:
--------------------------------------------------------------------------------
1 | export {
2 | readStreamableValue,
3 | useStreamableValue,
4 | useUIState,
5 | useAIState,
6 | useActions,
7 | useSyncUIState,
8 | } from './rsc-shared.mjs';
9 |
--------------------------------------------------------------------------------
/packages/ai/rsc/rsc-server.ts:
--------------------------------------------------------------------------------
1 | export { getAIState, getMutableAIState } from './ai-state';
2 | export { createAI } from './provider';
3 | export { streamUI } from './stream-ui';
4 | export { createStreamableUI } from './streamable-ui/create-streamable-ui';
5 | export { createStreamableValue } from './streamable-value/create-streamable-value';
6 |
--------------------------------------------------------------------------------
/packages/ai/rsc/rsc-shared.mts:
--------------------------------------------------------------------------------
1 | 'use client';
2 |
3 | export {
4 | readStreamableValue,
5 | useStreamableValue,
6 | useUIState,
7 | useAIState,
8 | useActions,
9 | useSyncUIState,
10 | InternalAIProvider,
11 | } from './shared-client';
12 |
--------------------------------------------------------------------------------
/packages/ai/rsc/shared-client/index.ts:
--------------------------------------------------------------------------------
1 | 'use client';
2 |
3 | export { readStreamableValue } from '../streamable-value/read-streamable-value';
4 | export { useStreamableValue } from '../streamable-value/use-streamable-value';
5 | export {
6 | InternalAIProvider,
7 | useAIState,
8 | useActions,
9 | useSyncUIState,
10 | useUIState,
11 | } from './context';
12 |
--------------------------------------------------------------------------------
/packages/ai/rsc/stream-ui/index.tsx:
--------------------------------------------------------------------------------
1 | export { streamUI } from './stream-ui';
2 |
--------------------------------------------------------------------------------
/packages/ai/rsc/streamable-value/is-streamable-value.ts:
--------------------------------------------------------------------------------
1 | import { STREAMABLE_VALUE_TYPE, StreamableValue } from './streamable-value';
2 |
3 | export function isStreamableValue(value: unknown): value is StreamableValue {
4 | return (
5 | value != null &&
6 | typeof value === 'object' &&
7 | 'type' in value &&
8 | value.type === STREAMABLE_VALUE_TYPE
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/packages/ai/streams/index.ts:
--------------------------------------------------------------------------------
1 | export * from '../core/index';
2 | export * from '../errors/index';
3 |
4 | export * from './assistant-response';
5 | export * as LangChainAdapter from './langchain-adapter';
6 | export * as LlamaIndexAdapter from './llamaindex-adapter';
7 | export * from './stream-data';
8 |
--------------------------------------------------------------------------------
/packages/ai/tests/e2e/next-server/app/layout.js:
--------------------------------------------------------------------------------
1 | export const metadata = {
2 | title: 'Next.js',
3 | description: 'Generated by Next.js',
4 | };
5 |
6 | export default function RootLayout({ children }) {
7 | return (
8 |
9 | {children}
10 |
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/packages/ai/tests/e2e/next-server/app/page.js:
--------------------------------------------------------------------------------
1 | export default function Page() {
2 | return Page
;
3 | }
4 |
--------------------------------------------------------------------------------
/packages/ai/tests/e2e/next-server/app/rsc/client-utils.js:
--------------------------------------------------------------------------------
1 | 'use client';
2 |
3 | export function ClientInfo({ children }) {
4 | return {children}
;
5 | }
6 |
--------------------------------------------------------------------------------
/packages/ai/tests/e2e/next-server/app/rsc/page.js:
--------------------------------------------------------------------------------
1 | import { streamableUI, streamableValue } from './actions';
2 | import { Client } from './client';
3 |
4 | export default function Page() {
5 | return (
6 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/packages/ai/tests/e2e/next-server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ai-core-e2e-next-server",
3 | "private": true,
4 | "scripts": {
5 | "dev": "next"
6 | },
7 | "dependencies": {
8 | "next": "canary",
9 | "react": "rc",
10 | "react-dom": "rc",
11 | "ai": "workspace:*"
12 | },
13 | "version": "0.0.0"
14 | }
15 |
--------------------------------------------------------------------------------
/packages/ai/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/react-library.json",
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "stripInternal": true,
6 | "lib": ["dom", "dom.iterable", "esnext"],
7 | "types": ["@types/node", "vitest/globals"]
8 | },
9 | "include": ["."],
10 | "exclude": ["*/dist", "dist", "build", "node_modules"]
11 | }
12 |
--------------------------------------------------------------------------------
/packages/ai/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/ai/util/as-array.ts:
--------------------------------------------------------------------------------
1 | export function asArray(value: T | T[] | undefined): T[] {
2 | return value === undefined ? [] : Array.isArray(value) ? value : [value];
3 | }
4 |
--------------------------------------------------------------------------------
/packages/ai/util/constants.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Warning time for notifying developers that a stream is hanging in dev mode
3 | * using a console.warn.
4 | */
5 | export const HANGING_STREAM_WARNING_TIME_MS = 15 * 1000;
6 |
--------------------------------------------------------------------------------
/packages/ai/util/is-async-generator.ts:
--------------------------------------------------------------------------------
1 | export function isAsyncGenerator(
2 | value: unknown,
3 | ): value is AsyncGenerator {
4 | return (
5 | value != null && typeof value === 'object' && Symbol.asyncIterator in value
6 | );
7 | }
8 |
--------------------------------------------------------------------------------
/packages/ai/util/is-function.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Checks if the given value is a function.
3 | *
4 | * @param {unknown} value - The value to check.
5 | * @returns {boolean} True if the value is a function, false otherwise.
6 | */
7 | export const isFunction = (value: unknown): value is Function =>
8 | typeof value === 'function';
9 |
--------------------------------------------------------------------------------
/packages/ai/util/is-generator.ts:
--------------------------------------------------------------------------------
1 | export function isGenerator(
2 | value: unknown,
3 | ): value is Generator {
4 | return value != null && typeof value === 'object' && Symbol.iterator in value;
5 | }
6 |
--------------------------------------------------------------------------------
/packages/ai/vitest.ui.react.config.js:
--------------------------------------------------------------------------------
1 | import react from '@vitejs/plugin-react';
2 | import { defineConfig } from 'vite';
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | test: {
8 | environment: 'jsdom',
9 | globals: true,
10 | include: ['rsc/**/*.ui.test.ts{,x}'],
11 | exclude: ['**/node_modules/**'],
12 | },
13 | });
14 |
--------------------------------------------------------------------------------
/packages/amazon-bedrock/src/bedrock-error.ts:
--------------------------------------------------------------------------------
1 | import { z } from 'zod';
2 |
3 | export const BedrockErrorSchema = z.object({
4 | message: z.string(),
5 | type: z.string().nullish(),
6 | });
7 |
--------------------------------------------------------------------------------
/packages/amazon-bedrock/src/index.ts:
--------------------------------------------------------------------------------
1 | export { bedrock, createAmazonBedrock } from './bedrock-provider';
2 | export type {
3 | AmazonBedrockProvider,
4 | AmazonBedrockProviderSettings,
5 | } from './bedrock-provider';
6 |
--------------------------------------------------------------------------------
/packages/amazon-bedrock/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/amazon-bedrock/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/amazon-bedrock/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/amazon-bedrock/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/amazon-bedrock/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/anthropic/src/index.ts:
--------------------------------------------------------------------------------
1 | export type { AnthropicProviderOptions } from './anthropic-messages-language-model';
2 | export { anthropic, createAnthropic } from './anthropic-provider';
3 | export type {
4 | AnthropicProvider,
5 | AnthropicProviderSettings,
6 | } from './anthropic-provider';
7 |
--------------------------------------------------------------------------------
/packages/anthropic/src/internal/index.ts:
--------------------------------------------------------------------------------
1 | export { AnthropicMessagesLanguageModel } from '../anthropic-messages-language-model';
2 | export { anthropicTools } from '../anthropic-tools';
3 | export type {
4 | AnthropicMessagesModelId,
5 | AnthropicMessagesSettings,
6 | } from '../anthropic-messages-settings';
7 |
--------------------------------------------------------------------------------
/packages/anthropic/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/anthropic/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | {
11 | entry: ['src/internal/index.ts'],
12 | outDir: 'internal/dist',
13 | format: ['cjs', 'esm'],
14 | dts: true,
15 | sourcemap: true,
16 | },
17 | ]);
18 |
--------------------------------------------------------------------------------
/packages/anthropic/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/anthropic/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/anthropic/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/assemblyai/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @ai-sdk/assemblyai
2 |
3 | ## 0.0.1
4 |
5 | ### Patch Changes
6 |
7 | - cb05e9c: feat(providers/assemblyai): add transcribe
8 |
--------------------------------------------------------------------------------
/packages/assemblyai/src/assemblyai-config.ts:
--------------------------------------------------------------------------------
1 | import { FetchFunction } from '@ai-sdk/provider-utils';
2 |
3 | export type AssemblyAIConfig = {
4 | provider: string;
5 | url: (options: { modelId: string; path: string }) => string;
6 | headers: () => Record;
7 | fetch?: FetchFunction;
8 | generateId?: () => string;
9 | };
10 |
--------------------------------------------------------------------------------
/packages/assemblyai/src/assemblyai-transcription-settings.ts:
--------------------------------------------------------------------------------
1 | export type AssemblyAITranscriptionModelId = 'best' | 'nano';
2 |
--------------------------------------------------------------------------------
/packages/assemblyai/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createAssemblyAI, assemblyai } from './assemblyai-provider';
2 | export type {
3 | AssemblyAIProvider,
4 | AssemblyAIProviderSettings,
5 | } from './assemblyai-provider';
6 |
--------------------------------------------------------------------------------
/packages/assemblyai/src/transcript-test.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/packages/assemblyai/src/transcript-test.mp3
--------------------------------------------------------------------------------
/packages/assemblyai/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/assemblyai/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/assemblyai/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/assemblyai/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/assemblyai/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/azure/src/index.ts:
--------------------------------------------------------------------------------
1 | export { azure, createAzure } from './azure-openai-provider';
2 | export type {
3 | AzureOpenAIProvider,
4 | AzureOpenAIProviderSettings,
5 | } from './azure-openai-provider';
6 |
--------------------------------------------------------------------------------
/packages/azure/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/azure/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/azure/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/azure/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/azure/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/cerebras/src/cerebras-chat-settings.ts:
--------------------------------------------------------------------------------
1 | import { OpenAICompatibleChatSettings } from '@ai-sdk/openai-compatible';
2 |
3 | // https://inference-docs.cerebras.ai/introduction
4 | export type CerebrasChatModelId =
5 | | 'llama3.1-8b'
6 | | 'llama3.1-70b'
7 | | 'llama-3.3-70b'
8 | | (string & {});
9 |
10 | export interface CerebrasChatSettings extends OpenAICompatibleChatSettings {}
11 |
--------------------------------------------------------------------------------
/packages/cerebras/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createCerebras, cerebras } from './cerebras-provider';
2 | export type {
3 | CerebrasProvider,
4 | CerebrasProviderSettings,
5 | } from './cerebras-provider';
6 | export type { CerebrasErrorData } from './cerebras-provider';
7 |
--------------------------------------------------------------------------------
/packages/cerebras/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/cerebras/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/cerebras/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/cerebras/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/cerebras/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/codemod/src/codemods/remove-anthropic-facade.ts:
--------------------------------------------------------------------------------
1 | import { removeFacade } from './lib/remove-facade';
2 |
3 | export default removeFacade({
4 | packageName: 'anthropic',
5 | className: 'Anthropic',
6 | createFnName: 'createAnthropic',
7 | });
8 |
--------------------------------------------------------------------------------
/packages/codemod/src/codemods/remove-await-streamobject.ts:
--------------------------------------------------------------------------------
1 | import { removeAwaitFn } from './lib/remove-await-fn';
2 |
3 | export default removeAwaitFn('streamObject');
4 |
--------------------------------------------------------------------------------
/packages/codemod/src/codemods/remove-await-streamtext.ts:
--------------------------------------------------------------------------------
1 | import { removeAwaitFn } from './lib/remove-await-fn';
2 |
3 | export default removeAwaitFn('streamText');
4 |
--------------------------------------------------------------------------------
/packages/codemod/src/codemods/remove-google-facade.ts:
--------------------------------------------------------------------------------
1 | import { removeFacade } from './lib/remove-facade';
2 |
3 | export default removeFacade({
4 | packageName: 'google',
5 | className: 'Google',
6 | createFnName: 'createGoogleGenerativeAI',
7 | });
8 |
--------------------------------------------------------------------------------
/packages/codemod/src/codemods/remove-mistral-facade.ts:
--------------------------------------------------------------------------------
1 | import { removeFacade } from './lib/remove-facade';
2 |
3 | export default removeFacade({
4 | packageName: 'mistral',
5 | className: 'Mistral',
6 | createFnName: 'createMistral',
7 | });
8 |
--------------------------------------------------------------------------------
/packages/codemod/src/codemods/remove-openai-facade.ts:
--------------------------------------------------------------------------------
1 | import { removeFacade } from './lib/remove-facade';
2 |
3 | export default removeFacade({
4 | packageName: 'openai',
5 | className: 'OpenAI',
6 | createFnName: 'createOpenAI',
7 | });
8 |
--------------------------------------------------------------------------------
/packages/codemod/src/lib/transform-options.ts:
--------------------------------------------------------------------------------
1 | export interface TransformOptions {
2 | dry?: boolean;
3 | print?: boolean;
4 | verbose?: boolean;
5 | jscodeshift?: string;
6 | }
7 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-ai-stream-methods-from-stream-text-result.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { streamText } from 'ai';
3 |
4 | async function handler(req, res) {
5 | const stream = await streamText({
6 | model: 'gpt-4',
7 | prompt: 'Hello'
8 | });
9 |
10 | const aiStream = stream.toAIStream();
11 | stream.pipeAIStreamToResponse(res);
12 | return stream.toAIStreamResponse();
13 | }
14 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-anthropic-facade.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { Anthropic } from '@ai-sdk/anthropic';
3 |
4 | const anthropic = new Anthropic({
5 | apiKey: 'key',
6 | baseURL: 'url',
7 | headers: { 'custom': 'header' }
8 | });
9 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-anthropic-facade.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { createAnthropic } from '@ai-sdk/anthropic';
3 |
4 | const anthropic = createAnthropic({
5 | apiKey: 'key',
6 | baseURL: 'url',
7 | headers: { 'custom': 'header' }
8 | });
9 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-await-fn-alias.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { streamText as myStreamText } from 'ai';
3 |
4 | async function main() {
5 | const result = await myStreamText({
6 | model: 'gpt-3.5-turbo',
7 | prompt: 'Hello, world!',
8 | });
9 | console.log(result);
10 | }
11 |
12 | main();
13 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-await-fn-alias.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { streamText as myStreamText } from 'ai';
3 |
4 | async function main() {
5 | const result = myStreamText({
6 | model: 'gpt-3.5-turbo',
7 | prompt: 'Hello, world!',
8 | });
9 | console.log(result);
10 | }
11 |
12 | main();
13 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-await-fn-other-fn.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { streamText } from 'ai';
3 |
4 | async function main() {
5 | const result = await otherFunction({
6 | data: 'test',
7 | });
8 | const streamResult = await streamText({
9 | model: 'gpt-3.5-turbo',
10 | prompt: 'Hello again!',
11 | });
12 | console.log(result, streamResult);
13 | }
14 |
15 | main();
16 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-await-fn-other-fn.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { streamText } from 'ai';
3 |
4 | async function main() {
5 | const result = await otherFunction({
6 | data: 'test',
7 | });
8 | const streamResult = streamText({
9 | model: 'gpt-3.5-turbo',
10 | prompt: 'Hello again!',
11 | });
12 | console.log(result, streamResult);
13 | }
14 |
15 | main();
16 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-await-fn-other.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { streamText } from 'other-module';
3 |
4 | async function main() {
5 | const result = await streamText({
6 | model: 'gpt-3.5-turbo',
7 | prompt: 'Hello, world!',
8 | });
9 | console.log(result);
10 | }
11 |
12 | main();
13 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-await-fn-other.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { streamText } from 'other-module';
3 |
4 | async function main() {
5 | const result = await streamText({
6 | model: 'gpt-3.5-turbo',
7 | prompt: 'Hello, world!',
8 | });
9 | console.log(result);
10 | }
11 |
12 | main();
13 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-await-fn.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { streamText } from 'ai';
3 |
4 | async function main() {
5 | const result = await streamText({
6 | model: 'gpt-3.5-turbo',
7 | prompt: 'Hello, world!',
8 | });
9 | console.log(result);
10 | }
11 |
12 | main();
13 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-await-fn.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { streamText } from 'ai';
3 |
4 | async function main() {
5 | const result = streamText({
6 | model: 'gpt-3.5-turbo',
7 | prompt: 'Hello, world!',
8 | });
9 | console.log(result);
10 | }
11 |
12 | main();
13 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-experimental-tool-not-ai.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { ExperimentalTool } from 'not-ai';
3 |
4 | interface Config {
5 | tool: ExperimentalTool;
6 | }
7 |
8 | const myTool: ExperimentalTool = {
9 | description: 'test',
10 | parameters: {}
11 | };
12 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-experimental-tool-not-ai.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { ExperimentalTool } from 'not-ai';
3 |
4 | interface Config {
5 | tool: ExperimentalTool;
6 | }
7 |
8 | const myTool: ExperimentalTool = {
9 | description: 'test',
10 | parameters: {}
11 | };
12 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-experimental-tool.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { ExperimentalTool } from 'ai';
3 |
4 | interface Config {
5 | tool: ExperimentalTool;
6 | }
7 |
8 | const myTool: ExperimentalTool = {
9 | description: 'test',
10 | parameters: {}
11 | };
12 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-experimental-tool.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { CoreTool } from 'ai';
3 |
4 | interface Config {
5 | tool: CoreTool;
6 | }
7 |
8 | const myTool: CoreTool = {
9 | description: 'test',
10 | parameters: {}
11 | };
12 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-google-facade.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { Google } from '@ai-sdk/google';
3 |
4 | const google = new Google({
5 | apiKey: 'key',
6 | baseURL: 'url',
7 | headers: { 'custom': 'header' }
8 | });
9 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-google-facade.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { createGoogleGenerativeAI } from '@ai-sdk/google';
3 |
4 | const google = createGoogleGenerativeAI({
5 | apiKey: 'key',
6 | baseURL: 'url',
7 | headers: { 'custom': 'header' }
8 | });
9 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-mistral-facade.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { Mistral } from '@ai-sdk/mistral';
3 |
4 | const mistral = new Mistral({
5 | apiKey: 'key',
6 | baseURL: 'url',
7 | headers: { 'custom': 'header' }
8 | });
9 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-mistral-facade.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { createMistral } from '@ai-sdk/mistral';
3 |
4 | const mistral = createMistral({
5 | apiKey: 'key',
6 | baseURL: 'url',
7 | headers: { 'custom': 'header' }
8 | });
9 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-openai-facade-as.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import OpenAI from 'openai';
3 | import { OpenAI as AiOpenAI } from '@ai-sdk/openai';
4 |
5 | const client1 = new OpenAI();
6 | const client2 = new AiOpenAI();
7 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-openai-facade-as.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import OpenAI from 'openai';
3 | import { createOpenAI } from '@ai-sdk/openai';
4 |
5 | const client1 = new OpenAI();
6 | const client2 = createOpenAI();
7 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-openai-facade-corp.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import OpenAI from 'openai';
3 |
4 | const openaiClient = new OpenAI({
5 | apiKey: 'key2'
6 | });
7 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-openai-facade-corp.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import OpenAI from 'openai';
3 |
4 | const openaiClient = new OpenAI({
5 | apiKey: 'key2'
6 | });
7 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-openai-facade.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { OpenAI } from '@ai-sdk/openai';
3 |
4 | const openai = new OpenAI({
5 | apiKey: 'key',
6 | baseURL: 'url',
7 | headers: { 'custom': 'header' }
8 | });
9 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/remove-openai-facade.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { createOpenAI } from '@ai-sdk/openai';
3 |
4 | const openai = createOpenAI({
5 | apiKey: 'key',
6 | baseURL: 'url',
7 | headers: { 'custom': 'header' }
8 | });
9 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/rename-format-stream-part-not-ai.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { formatStreamPart } from 'not-ai';
3 |
4 | const response = new Response(formatStreamPart('text', cached));
5 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/rename-format-stream-part-not-ai.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { formatStreamPart } from 'not-ai';
3 |
4 | const response = new Response(formatStreamPart('text', cached));
5 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/rename-format-stream-part.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { formatStreamPart } from 'ai';
3 |
4 | const response = new Response(formatStreamPart('text', cached));
5 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/rename-format-stream-part.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { formatDataStreamPart } from 'ai';
3 |
4 | const response = new Response(formatDataStreamPart('text', cached));
5 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/rename-parse-stream-part-not-ai.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { parseStreamPart } from 'not-ai';
3 |
4 | const result = parseStreamPart(data);
5 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/rename-parse-stream-part-not-ai.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { parseStreamPart } from 'not-ai';
3 |
4 | const result = parseStreamPart(data);
5 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/rename-parse-stream-part.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { parseStreamPart } from 'ai';
3 |
4 | const result = parseStreamPart(data);
5 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/rename-parse-stream-part.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { parseDataStreamPart } from 'ai';
3 |
4 | const result = parseDataStreamPart(data);
5 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/replace-langchain-toaistream.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { LangChainAdapter } from 'ai';
3 | import { model } from 'langchain';
4 |
5 | const stream = LangChainAdapter.toAIStream(model.stream(), {
6 | onToken: token => console.log(token)
7 | });
8 |
9 | const response = new Response(stream);
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/replace-langchain-toaistream.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { LangChainAdapter } from 'ai';
3 | import { model } from 'langchain';
4 |
5 | const stream = LangChainAdapter.toDataStream(model.stream(), {
6 | onToken: token => console.log(token)
7 | });
8 |
9 | const response = new Response(stream);
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/replace-token-usage-types.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { TokenUsage, CompletionTokenUsage, EmbeddingTokenUsage } from 'ai';
3 |
4 | function recordUsage(usage: TokenUsage) {
5 | console.log(usage);
6 | }
7 |
8 | function processEmbedding(usage: EmbeddingTokenUsage) {
9 | console.log(usage);
10 | }
11 |
12 | const handler = (data: CompletionTokenUsage) => {
13 | console.log(data);
14 | };
15 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/replace-token-usage-types.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { LanguageModelUsage, EmbeddingModelUsage } from 'ai';
3 |
4 | function recordUsage(usage: LanguageModelUsage) {
5 | console.log(usage);
6 | }
7 |
8 | function processEmbedding(usage: EmbeddingModelUsage) {
9 | console.log(usage);
10 | }
11 |
12 | const handler = (data: LanguageModelUsage) => {
13 | console.log(data);
14 | };
15 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/rewrite-framework-imports-solid.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { useChat } from 'ai/solid';
3 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/rewrite-framework-imports-solid.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { useChat } from '@ai-sdk/solid';
3 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/rewrite-framework-imports-svelte.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { useChat } from 'ai/svelte';
3 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/rewrite-framework-imports-svelte.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { useChat } from '@ai-sdk/svelte';
3 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/rewrite-framework-imports-vue.input.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { useChat } from 'ai/vue';
3 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/__testfixtures__/rewrite-framework-imports-vue.output.ts:
--------------------------------------------------------------------------------
1 | // @ts-nocheck
2 | import { useChat } from '@ai-sdk/vue';
3 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/jscodeshift-testUtils.d.ts:
--------------------------------------------------------------------------------
1 | declare module 'jscodeshift/dist/testUtils' {
2 | export function defineTest(
3 | dirName: string,
4 | transformName: string,
5 | options?: any,
6 | testFilePrefix?: string,
7 | testOptions?: any,
8 | ): void;
9 | }
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/remove-anthropic-facade.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'vitest';
2 | import transformer from '../codemods/remove-anthropic-facade';
3 | import { testTransform } from './test-utils';
4 |
5 | describe('remove-anthropic-facade', () => {
6 | it('transforms correctly', () => {
7 | testTransform(transformer, 'remove-anthropic-facade');
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/remove-experimental-ai-fn-exports.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'vitest';
2 | import transformer from '../codemods/remove-experimental-ai-fn-exports';
3 | import { testTransform } from './test-utils';
4 |
5 | describe('remove-experimental-ai-fn-exports', () => {
6 | it('transforms correctly', () => {
7 | testTransform(transformer, 'remove-experimental-ai-fn-exports');
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/remove-experimental-message-types.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'vitest';
2 | import transformer from '../codemods/remove-experimental-message-types';
3 | import { testTransform } from './test-utils';
4 |
5 | describe('remove-experimental-message-types', () => {
6 | it('transforms correctly', () => {
7 | testTransform(transformer, 'remove-experimental-message-types');
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/remove-experimental-streamdata.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'vitest';
2 | import transformer from '../codemods/remove-experimental-streamdata';
3 | import { testTransform } from './test-utils';
4 |
5 | describe('remove-experimental-streamdata', () => {
6 | it('transforms correctly', () => {
7 | testTransform(transformer, 'remove-experimental-streamdata');
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/remove-experimental-useassistant.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'vitest';
2 | import transformer from '../codemods/remove-experimental-useassistant';
3 | import { testTransform } from './test-utils';
4 |
5 | describe('remove-experimental-useassistant', () => {
6 | it('transforms correctly', () => {
7 | testTransform(transformer, 'remove-experimental-useassistant');
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/remove-google-facade.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'vitest';
2 | import transformer from '../codemods/remove-google-facade';
3 | import { testTransform } from './test-utils';
4 |
5 | describe('remove-google-facade', () => {
6 | it('transforms correctly', () => {
7 | testTransform(transformer, 'remove-google-facade');
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/remove-isxxxerror.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'vitest';
2 | import transformer from '../codemods/remove-isxxxerror';
3 | import { testTransform } from './test-utils';
4 |
5 | describe('remove-isxxxerror', () => {
6 | it('transforms correctly', () => {
7 | testTransform(transformer, 'remove-isxxxerror');
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/remove-metadata-with-headers.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'vitest';
2 | import transformer from '../codemods/remove-metadata-with-headers';
3 | import { testTransform } from './test-utils';
4 |
5 | describe('remove-metadata-with-headers', () => {
6 | it('transforms correctly', () => {
7 | testTransform(transformer, 'remove-metadata-with-headers');
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/remove-mistral-facade.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'vitest';
2 | import transformer from '../codemods/remove-mistral-facade';
3 | import { testTransform } from './test-utils';
4 |
5 | describe('remove-mistral-facade', () => {
6 | it('transforms correctly', () => {
7 | testTransform(transformer, 'remove-mistral-facade');
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/replace-baseurl.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'vitest';
2 | import transformer from '../codemods/replace-baseurl';
3 | import { testTransform } from './test-utils';
4 |
5 | describe('replace-baseurl', () => {
6 | it('transforms correctly', () => {
7 | testTransform(transformer, 'replace-baseurl');
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/replace-continuation-steps.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'vitest';
2 | import transformer from '../codemods/replace-continuation-steps';
3 | import { testTransform } from './test-utils';
4 |
5 | describe('replace-continuation-steps', () => {
6 | it('transforms correctly', () => {
7 | testTransform(transformer, 'replace-continuation-steps');
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/replace-langchain-toaistream.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'vitest';
2 | import transformer from '../codemods/replace-langchain-toaistream';
3 | import { testTransform } from './test-utils';
4 |
5 | describe('replace-langchain-toaistream', () => {
6 | it('transforms correctly', () => {
7 | testTransform(transformer, 'replace-langchain-toaistream');
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/replace-roundtrips-with-maxsteps.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'vitest';
2 | import transformer from '../codemods/replace-roundtrips-with-maxsteps';
3 | import { testTransform } from './test-utils';
4 |
5 | describe('replace-roundtrips-with-maxsteps', () => {
6 | it('transforms correctly', () => {
7 | testTransform(transformer, 'replace-roundtrips-with-maxsteps');
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/codemod/src/test/replace-token-usage-types.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'vitest';
2 | import transformer from '../codemods/replace-token-usage-types';
3 | import { testTransform } from './test-utils';
4 |
5 | describe('replace-token-usage-types', () => {
6 | it('transforms correctly', () => {
7 | testTransform(transformer, 'replace-token-usage-types');
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/packages/codemod/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/codemod/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/bin/codemod.ts'],
6 | outDir: 'dist/bin',
7 | format: ['cjs'],
8 | dts: false,
9 | sourcemap: true,
10 | },
11 | {
12 | entry: ['src/codemods/**/*.ts'],
13 | outDir: 'dist/codemods',
14 | format: ['cjs'],
15 | dts: false,
16 | sourcemap: true,
17 | },
18 | ]);
19 |
--------------------------------------------------------------------------------
/packages/codemod/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/codemod/vitest.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vitest/config';
2 |
3 | export default defineConfig({
4 | test: {
5 | globals: true,
6 | environment: 'node',
7 | },
8 | });
9 |
--------------------------------------------------------------------------------
/packages/cohere/src/index.ts:
--------------------------------------------------------------------------------
1 | export { cohere, createCohere } from './cohere-provider';
2 | export type { CohereProvider, CohereProviderSettings } from './cohere-provider';
3 |
--------------------------------------------------------------------------------
/packages/cohere/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/cohere/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/cohere/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/cohere/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/cohere/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/deepgram/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @ai-sdk/deepgram
2 |
3 | ## 0.0.1
4 |
5 | ### Patch Changes
6 |
7 | - 3eeb27f: feat(providers/deepgram): add transcribe
8 |
--------------------------------------------------------------------------------
/packages/deepgram/src/deepgram-config.ts:
--------------------------------------------------------------------------------
1 | import { FetchFunction } from '@ai-sdk/provider-utils';
2 |
3 | export type DeepgramConfig = {
4 | provider: string;
5 | url: (options: { modelId: string; path: string }) => string;
6 | headers: () => Record;
7 | fetch?: FetchFunction;
8 | generateId?: () => string;
9 | };
10 |
--------------------------------------------------------------------------------
/packages/deepgram/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createDeepgram, deepgram } from './deepgram-provider';
2 | export type {
3 | DeepgramProvider,
4 | DeepgramProviderSettings,
5 | } from './deepgram-provider';
6 |
--------------------------------------------------------------------------------
/packages/deepgram/src/transcript-test.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/packages/deepgram/src/transcript-test.mp3
--------------------------------------------------------------------------------
/packages/deepgram/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/deepgram/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/deepgram/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/deepgram/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/deepgram/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/deepinfra/src/deepinfra-completion-settings.ts:
--------------------------------------------------------------------------------
1 | import { OpenAICompatibleCompletionSettings } from '@ai-sdk/openai-compatible';
2 | import { DeepInfraChatModelId } from './deepinfra-chat-settings';
3 |
4 | // Use the same model IDs as chat
5 | export type DeepInfraCompletionModelId = DeepInfraChatModelId;
6 |
7 | export interface DeepInfraCompletionSettings
8 | extends OpenAICompatibleCompletionSettings {}
9 |
--------------------------------------------------------------------------------
/packages/deepinfra/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createDeepInfra, deepinfra } from './deepinfra-provider';
2 | export type {
3 | DeepInfraProvider,
4 | DeepInfraProviderSettings,
5 | } from './deepinfra-provider';
6 | export type { OpenAICompatibleErrorData as DeepInfraErrorData } from '@ai-sdk/openai-compatible';
7 |
--------------------------------------------------------------------------------
/packages/deepinfra/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/deepinfra/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/deepinfra/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/deepinfra/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/deepinfra/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/deepseek/src/deepseek-chat-settings.ts:
--------------------------------------------------------------------------------
1 | import { OpenAICompatibleChatSettings } from '@ai-sdk/openai-compatible';
2 |
3 | // https://api-docs.deepseek.com/quick_start/pricing
4 | export type DeepSeekChatModelId =
5 | | 'deepseek-chat'
6 | | 'deepseek-reasoner'
7 | | (string & {});
8 |
9 | export interface DeepSeekChatSettings extends OpenAICompatibleChatSettings {}
10 |
--------------------------------------------------------------------------------
/packages/deepseek/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createDeepSeek, deepseek } from './deepseek-provider';
2 | export type {
3 | DeepSeekProvider,
4 | DeepSeekProviderSettings,
5 | } from './deepseek-provider';
6 | export type { OpenAICompatibleErrorData as DeepSeekErrorData } from '@ai-sdk/openai-compatible';
7 |
--------------------------------------------------------------------------------
/packages/deepseek/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/deepseek/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/deepseek/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/deepseek/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/deepseek/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/elevenlabs/src/elevenlabs-config.ts:
--------------------------------------------------------------------------------
1 | import { FetchFunction } from '@ai-sdk/provider-utils';
2 |
3 | export type ElevenLabsConfig = {
4 | provider: string;
5 | url: (options: { modelId: string; path: string }) => string;
6 | headers: () => Record;
7 | fetch?: FetchFunction;
8 | generateId?: () => string;
9 | };
10 |
--------------------------------------------------------------------------------
/packages/elevenlabs/src/elevenlabs-transcription-settings.ts:
--------------------------------------------------------------------------------
1 | export type ElevenLabsTranscriptionModelId =
2 | | 'scribe_v1'
3 | | 'scribe_v1_experimental'
4 | | (string & {});
5 |
--------------------------------------------------------------------------------
/packages/elevenlabs/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createElevenLabs, elevenlabs } from './elevenlabs-provider';
2 | export type {
3 | ElevenLabsProvider,
4 | ElevenLabsProviderSettings,
5 | } from './elevenlabs-provider';
6 |
--------------------------------------------------------------------------------
/packages/elevenlabs/src/transcript-test.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/packages/elevenlabs/src/transcript-test.mp3
--------------------------------------------------------------------------------
/packages/elevenlabs/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/elevenlabs/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/elevenlabs/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/elevenlabs/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/elevenlabs/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/fal/src/fal-config.ts:
--------------------------------------------------------------------------------
1 | import { FetchFunction } from '@ai-sdk/provider-utils';
2 |
3 | export type FalConfig = {
4 | provider: string;
5 | url: (options: { modelId: string; path: string }) => string;
6 | headers: () => Record;
7 | fetch?: FetchFunction;
8 | generateId?: () => string;
9 | };
10 |
--------------------------------------------------------------------------------
/packages/fal/src/fal-transcription-settings.ts:
--------------------------------------------------------------------------------
1 | export type FalTranscriptionModelId = 'whisper' | 'wizper' | (string & {});
2 |
--------------------------------------------------------------------------------
/packages/fal/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createFal, fal } from './fal-provider';
2 | export type { FalProvider, FalProviderSettings } from './fal-provider';
3 |
--------------------------------------------------------------------------------
/packages/fal/src/transcript-test.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/packages/fal/src/transcript-test.mp3
--------------------------------------------------------------------------------
/packages/fal/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/fal/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/fal/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["//"],
3 | "tasks": {
4 | "build": {
5 | "outputs": ["**/dist/**"]
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/fal/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/fal/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/fireworks/src/fireworks-embedding-settings.ts:
--------------------------------------------------------------------------------
1 | import { OpenAICompatibleEmbeddingSettings } from '@ai-sdk/openai-compatible';
2 |
3 | // Below is just a subset of the available models.
4 | export type FireworksEmbeddingModelId =
5 | | 'nomic-ai/nomic-embed-text-v1.5'
6 | | (string & {});
7 |
8 | export interface FireworksEmbeddingSettings
9 | extends OpenAICompatibleEmbeddingSettings {}
10 |
--------------------------------------------------------------------------------
/packages/fireworks/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createFireworks, fireworks } from './fireworks-provider';
2 | export type {
3 | FireworksProvider,
4 | FireworksProviderSettings,
5 | FireworksErrorData,
6 | } from './fireworks-provider';
7 |
--------------------------------------------------------------------------------
/packages/fireworks/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/fireworks/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/fireworks/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/fireworks/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/fireworks/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/gladia/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @ai-sdk/gladia
2 |
3 | ## 0.0.1
4 |
5 | ### Patch Changes
6 |
7 | - e6e1cd9: feat(providers/gladia): add transcribe
8 |
--------------------------------------------------------------------------------
/packages/gladia/src/gladia-config.ts:
--------------------------------------------------------------------------------
1 | import { FetchFunction } from '@ai-sdk/provider-utils';
2 |
3 | export type GladiaConfig = {
4 | provider: string;
5 | url: (options: { modelId: string; path: string }) => string;
6 | headers: () => Record;
7 | fetch?: FetchFunction;
8 | generateId?: () => string;
9 | };
10 |
--------------------------------------------------------------------------------
/packages/gladia/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createGladia, gladia } from './gladia-provider';
2 | export type { GladiaProvider, GladiaProviderSettings } from './gladia-provider';
3 |
--------------------------------------------------------------------------------
/packages/gladia/src/transcript-test.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/packages/gladia/src/transcript-test.mp3
--------------------------------------------------------------------------------
/packages/gladia/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/gladia/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/gladia/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/gladia/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/gladia/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/google-vertex/.gitignore:
--------------------------------------------------------------------------------
1 | edge/dist
2 | anthropic/dist
3 | anthropic/edge/dist
4 |
--------------------------------------------------------------------------------
/packages/google-vertex/src/anthropic/edge/index.ts:
--------------------------------------------------------------------------------
1 | export {
2 | createVertexAnthropic,
3 | vertexAnthropic,
4 | } from './google-vertex-anthropic-provider-edge';
5 | export type {
6 | GoogleVertexAnthropicProviderSettings,
7 | GoogleVertexAnthropicProvider,
8 | } from './google-vertex-anthropic-provider-edge';
9 |
--------------------------------------------------------------------------------
/packages/google-vertex/src/anthropic/index.ts:
--------------------------------------------------------------------------------
1 | export {
2 | vertexAnthropic,
3 | createVertexAnthropic,
4 | } from './google-vertex-anthropic-provider-node';
5 | export type {
6 | GoogleVertexAnthropicProvider,
7 | GoogleVertexAnthropicProviderSettings,
8 | } from './google-vertex-anthropic-provider-node';
9 |
--------------------------------------------------------------------------------
/packages/google-vertex/src/edge/index.ts:
--------------------------------------------------------------------------------
1 | export { createVertex, vertex } from './google-vertex-provider-edge';
2 | export type {
3 | GoogleVertexProviderSettings,
4 | GoogleVertexProvider,
5 | } from './google-vertex-provider-edge';
6 |
--------------------------------------------------------------------------------
/packages/google-vertex/src/google-vertex-config.ts:
--------------------------------------------------------------------------------
1 | import { FetchFunction, Resolvable } from '@ai-sdk/provider-utils';
2 |
3 | export interface GoogleVertexConfig {
4 | provider: string;
5 | baseURL: string;
6 | headers: Resolvable>;
7 | fetch?: FetchFunction;
8 | }
9 |
--------------------------------------------------------------------------------
/packages/google-vertex/src/google-vertex-image-settings.ts:
--------------------------------------------------------------------------------
1 | export type GoogleVertexImageModelId =
2 | | 'imagen-3.0-generate-001'
3 | | 'imagen-3.0-generate-002'
4 | | 'imagen-3.0-fast-generate-001'
5 | | (string & {});
6 |
7 | export interface GoogleVertexImageSettings {
8 | /**
9 | Override the maximum number of images per call (default 4)
10 | */
11 | maxImagesPerCall?: number;
12 | }
13 |
--------------------------------------------------------------------------------
/packages/google-vertex/src/google-vertex-supported-file-url.ts:
--------------------------------------------------------------------------------
1 | // https://firebase.google.com/docs/vertex-ai/input-file-requirements
2 | // The definition of supported file URLs reduces to a simple protocol check as
3 | // any publicly accessible file can be used as input.
4 | export function isSupportedFileUrl(url: URL) {
5 | return ['http:', 'https:', 'gs:'].includes(url.protocol);
6 | }
7 |
--------------------------------------------------------------------------------
/packages/google-vertex/src/index.ts:
--------------------------------------------------------------------------------
1 | export type { GoogleVertexImageProviderOptions } from './google-vertex-image-model';
2 | export { createVertex, vertex } from './google-vertex-provider-node';
3 | export type {
4 | GoogleVertexProvider,
5 | GoogleVertexProviderSettings,
6 | } from './google-vertex-provider-node';
7 |
--------------------------------------------------------------------------------
/packages/google-vertex/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/google-vertex/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/google-vertex/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/google-vertex/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/google/src/get-model-path.ts:
--------------------------------------------------------------------------------
1 | export function getModelPath(modelId: string): string {
2 | return modelId.includes('/') ? modelId : `models/${modelId}`;
3 | }
4 |
--------------------------------------------------------------------------------
/packages/google/src/google-supported-file-url.ts:
--------------------------------------------------------------------------------
1 | export function isSupportedFileUrl(url: URL): boolean {
2 | return url
3 | .toString()
4 | .startsWith('https://generativelanguage.googleapis.com/v1beta/files/');
5 | }
6 |
--------------------------------------------------------------------------------
/packages/google/src/internal/index.ts:
--------------------------------------------------------------------------------
1 | export * from '../google-generative-ai-language-model';
2 | export type { InternalGoogleGenerativeAISettings } from '../google-generative-ai-settings';
3 |
--------------------------------------------------------------------------------
/packages/google/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/google/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | {
11 | entry: ['src/internal/index.ts'],
12 | outDir: 'internal/dist',
13 | format: ['cjs', 'esm'],
14 | dts: true,
15 | sourcemap: true,
16 | },
17 | ]);
18 |
--------------------------------------------------------------------------------
/packages/google/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/google/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/google/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/groq/src/get-response-metadata.ts:
--------------------------------------------------------------------------------
1 | export function getResponseMetadata({
2 | id,
3 | model,
4 | created,
5 | }: {
6 | id?: string | undefined | null;
7 | created?: number | undefined | null;
8 | model?: string | undefined | null;
9 | }) {
10 | return {
11 | id: id ?? undefined,
12 | modelId: model ?? undefined,
13 | timestamp: created != null ? new Date(created * 1000) : undefined,
14 | };
15 | }
16 |
--------------------------------------------------------------------------------
/packages/groq/src/groq-config.ts:
--------------------------------------------------------------------------------
1 | import { FetchFunction } from '@ai-sdk/provider-utils';
2 |
3 | export type GroqConfig = {
4 | provider: string;
5 | url: (options: { modelId: string; path: string }) => string;
6 | headers: () => Record;
7 | fetch?: FetchFunction;
8 | generateId?: () => string;
9 | };
10 |
--------------------------------------------------------------------------------
/packages/groq/src/groq-transcription-settings.ts:
--------------------------------------------------------------------------------
1 | export type GroqTranscriptionModelId =
2 | | 'whisper-large-v3-turbo'
3 | | 'distil-whisper-large-v3-en'
4 | | 'whisper-large-v3'
5 | | (string & {});
6 |
--------------------------------------------------------------------------------
/packages/groq/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createGroq, groq } from './groq-provider';
2 | export type { GroqProvider, GroqProviderSettings } from './groq-provider';
3 |
--------------------------------------------------------------------------------
/packages/groq/src/transcript-test.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/packages/groq/src/transcript-test.mp3
--------------------------------------------------------------------------------
/packages/groq/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/groq/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/groq/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/groq/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/groq/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/hume/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @ai-sdk/hume
2 |
3 | ## 0.0.2
4 |
5 | ### Patch Changes
6 |
7 | - Updated dependencies [d87b9d1]
8 | - @ai-sdk/provider-utils@2.2.8
9 |
10 | ## 0.0.1
11 |
12 | ### Patch Changes
13 |
14 | - 69e8344: feat(providers/hume): add speech
15 |
--------------------------------------------------------------------------------
/packages/hume/src/hume-config.ts:
--------------------------------------------------------------------------------
1 | import { FetchFunction } from '@ai-sdk/provider-utils';
2 |
3 | export type HumeConfig = {
4 | provider: string;
5 | url: (options: { modelId: string; path: string }) => string;
6 | headers: () => Record;
7 | fetch?: FetchFunction;
8 | generateId?: () => string;
9 | };
10 |
--------------------------------------------------------------------------------
/packages/hume/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createHume, hume } from './hume-provider';
2 | export type { HumeProvider, HumeProviderSettings } from './hume-provider';
3 |
--------------------------------------------------------------------------------
/packages/hume/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/hume/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/hume/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/hume/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/hume/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/lmnt/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @ai-sdk/lmnt
2 |
3 | ## 0.0.2
4 |
5 | ### Patch Changes
6 |
7 | - Updated dependencies [d87b9d1]
8 | - @ai-sdk/provider-utils@2.2.8
9 |
10 | ## 0.0.1
11 |
12 | ### Patch Changes
13 |
14 | - 0d7291a: feat(providers/lmnt): add speech
15 |
--------------------------------------------------------------------------------
/packages/lmnt/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createLMNT, lmnt } from './lmnt-provider';
2 | export type { LMNTProvider, LMNTProviderSettings } from './lmnt-provider';
3 |
--------------------------------------------------------------------------------
/packages/lmnt/src/lmnt-config.ts:
--------------------------------------------------------------------------------
1 | import { FetchFunction } from '@ai-sdk/provider-utils';
2 |
3 | export type LMNTConfig = {
4 | provider: string;
5 | url: (options: { modelId: string; path: string }) => string;
6 | headers: () => Record;
7 | fetch?: FetchFunction;
8 | generateId?: () => string;
9 | };
10 |
--------------------------------------------------------------------------------
/packages/lmnt/src/lmnt-speech-settings.ts:
--------------------------------------------------------------------------------
1 | export type LMNTSpeechModelId = 'aurora' | 'blizzard' | (string & {});
2 |
--------------------------------------------------------------------------------
/packages/lmnt/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/lmnt/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/lmnt/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/lmnt/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/lmnt/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/luma/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createLuma, luma } from './luma-provider';
2 | export type { LumaProvider, LumaProviderSettings } from './luma-provider';
3 | export type { LumaErrorData } from './luma-image-model';
4 |
--------------------------------------------------------------------------------
/packages/luma/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/luma/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/luma/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/luma/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/luma/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/mistral/src/get-response-metadata.ts:
--------------------------------------------------------------------------------
1 | export function getResponseMetadata({
2 | id,
3 | model,
4 | created,
5 | }: {
6 | id?: string | undefined | null;
7 | created?: number | undefined | null;
8 | model?: string | undefined | null;
9 | }) {
10 | return {
11 | id: id ?? undefined,
12 | modelId: model ?? undefined,
13 | timestamp: created != null ? new Date(created * 1000) : undefined,
14 | };
15 | }
16 |
--------------------------------------------------------------------------------
/packages/mistral/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createMistral, mistral } from './mistral-provider';
2 | export type {
3 | MistralProvider,
4 | MistralProviderSettings,
5 | } from './mistral-provider';
6 |
--------------------------------------------------------------------------------
/packages/mistral/src/mistral-embedding-settings.ts:
--------------------------------------------------------------------------------
1 | export type MistralEmbeddingModelId = 'mistral-embed' | (string & {});
2 |
3 | export interface MistralEmbeddingSettings {
4 | /**
5 | Override the maximum number of embeddings per call.
6 | */
7 | maxEmbeddingsPerCall?: number;
8 |
9 | /**
10 | Override the parallelism of embedding calls.
11 | */
12 | supportsParallelCalls?: boolean;
13 | }
14 |
--------------------------------------------------------------------------------
/packages/mistral/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/mistral/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/mistral/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/mistral/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/mistral/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/openai-compatible/src/get-response-metadata.ts:
--------------------------------------------------------------------------------
1 | export function getResponseMetadata({
2 | id,
3 | model,
4 | created,
5 | }: {
6 | id?: string | undefined | null;
7 | created?: number | undefined | null;
8 | model?: string | undefined | null;
9 | }) {
10 | return {
11 | id: id ?? undefined,
12 | modelId: model ?? undefined,
13 | timestamp: created != null ? new Date(created * 1000) : undefined,
14 | };
15 | }
16 |
--------------------------------------------------------------------------------
/packages/openai-compatible/src/internal/index.ts:
--------------------------------------------------------------------------------
1 | export { convertToOpenAICompatibleChatMessages } from '../convert-to-openai-compatible-chat-messages';
2 | export { mapOpenAICompatibleFinishReason } from '../map-openai-compatible-finish-reason';
3 | export { getResponseMetadata } from '../get-response-metadata';
4 | export type { OpenAICompatibleChatConfig } from '../openai-compatible-chat-language-model';
5 |
--------------------------------------------------------------------------------
/packages/openai-compatible/src/openai-compatible-image-settings.ts:
--------------------------------------------------------------------------------
1 | export type OpenAICompatibleImageModelId = string;
2 |
3 | export interface OpenAICompatibleImageSettings {
4 | /**
5 | A unique identifier representing your end-user, which can help the provider to
6 | monitor and detect abuse.
7 | */
8 | user?: string;
9 |
10 | /**
11 | * The maximum number of images to generate.
12 | */
13 | maxImagesPerCall?: number;
14 | }
15 |
--------------------------------------------------------------------------------
/packages/openai-compatible/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/openai-compatible/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | {
11 | entry: ['src/internal/index.ts'],
12 | outDir: 'internal/dist',
13 | format: ['cjs', 'esm'],
14 | dts: true,
15 | sourcemap: true,
16 | },
17 | ]);
18 |
--------------------------------------------------------------------------------
/packages/openai-compatible/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/openai-compatible/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/openai-compatible/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/openai/src/get-response-metadata.ts:
--------------------------------------------------------------------------------
1 | export function getResponseMetadata({
2 | id,
3 | model,
4 | created,
5 | }: {
6 | id?: string | undefined | null;
7 | created?: number | undefined | null;
8 | model?: string | undefined | null;
9 | }) {
10 | return {
11 | id: id ?? undefined,
12 | modelId: model ?? undefined,
13 | timestamp: created != null ? new Date(created * 1000) : undefined,
14 | };
15 | }
16 |
--------------------------------------------------------------------------------
/packages/openai/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createOpenAI, openai } from './openai-provider';
2 | export type { OpenAIProvider, OpenAIProviderSettings } from './openai-provider';
3 | export type { OpenAIResponsesProviderOptions } from './responses/openai-responses-language-model';
4 |
--------------------------------------------------------------------------------
/packages/openai/src/openai-config.ts:
--------------------------------------------------------------------------------
1 | import { FetchFunction } from '@ai-sdk/provider-utils';
2 |
3 | export type OpenAIConfig = {
4 | provider: string;
5 | url: (options: { modelId: string; path: string }) => string;
6 | headers: () => Record;
7 | fetch?: FetchFunction;
8 | generateId?: () => string;
9 | };
10 |
--------------------------------------------------------------------------------
/packages/openai/src/openai-speech-settings.ts:
--------------------------------------------------------------------------------
1 | export type OpenAISpeechModelId =
2 | | 'tts-1'
3 | | 'tts-1-hd'
4 | | 'gpt-4o-mini-tts'
5 | | (string & {});
6 |
--------------------------------------------------------------------------------
/packages/openai/src/transcript-test.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/packages/openai/src/transcript-test.mp3
--------------------------------------------------------------------------------
/packages/openai/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/openai/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | {
11 | entry: ['src/internal/index.ts'],
12 | outDir: 'internal/dist',
13 | format: ['cjs', 'esm'],
14 | dts: true,
15 | sourcemap: true,
16 | },
17 | ]);
18 |
--------------------------------------------------------------------------------
/packages/openai/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/openai/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/openai/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/perplexity/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createPerplexity, perplexity } from './perplexity-provider';
2 | export type {
3 | PerplexityProvider,
4 | PerplexityProviderSettings,
5 | } from './perplexity-provider';
6 |
--------------------------------------------------------------------------------
/packages/perplexity/src/map-perplexity-finish-reason.ts:
--------------------------------------------------------------------------------
1 | import { LanguageModelV1FinishReason } from '@ai-sdk/provider';
2 |
3 | export function mapPerplexityFinishReason(
4 | finishReason: string | null | undefined,
5 | ): LanguageModelV1FinishReason {
6 | switch (finishReason) {
7 | case 'stop':
8 | case 'length':
9 | return finishReason;
10 | default:
11 | return 'unknown';
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/packages/perplexity/src/perplexity-language-model-prompt.ts:
--------------------------------------------------------------------------------
1 | export type PerplexityPrompt = Array;
2 |
3 | export type PerplexityMessage = {
4 | role: 'system' | 'user' | 'assistant';
5 | content: string;
6 | };
7 |
--------------------------------------------------------------------------------
/packages/perplexity/src/perplexity-language-model-settings.ts:
--------------------------------------------------------------------------------
1 | // https://docs.perplexity.ai/models/model-cards
2 | export type PerplexityLanguageModelId =
3 | | 'sonar-deep-research'
4 | | 'sonar-reasoning-pro'
5 | | 'sonar-reasoning'
6 | | 'sonar-pro'
7 | | 'sonar'
8 | | (string & {});
9 |
--------------------------------------------------------------------------------
/packages/perplexity/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/perplexity/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/perplexity/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/perplexity/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/perplexity/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/provider-utils/.gitignore:
--------------------------------------------------------------------------------
1 | # test distribution folder:
2 | ./test
--------------------------------------------------------------------------------
/packages/provider-utils/README.md:
--------------------------------------------------------------------------------
1 | # AI SDK - Provider Implementation Utilities
2 |
--------------------------------------------------------------------------------
/packages/provider-utils/src/combine-headers.ts:
--------------------------------------------------------------------------------
1 | export function combineHeaders(
2 | ...headers: Array | undefined>
3 | ): Record {
4 | return headers.reduce(
5 | (combinedHeaders, currentHeaders) => ({
6 | ...combinedHeaders,
7 | ...(currentHeaders ?? {}),
8 | }),
9 | {},
10 | ) as Record;
11 | }
12 |
--------------------------------------------------------------------------------
/packages/provider-utils/src/fetch-function.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Fetch function type (standardizes the version of fetch used).
3 | */
4 | export type FetchFunction = typeof globalThis.fetch;
5 |
--------------------------------------------------------------------------------
/packages/provider-utils/src/get-error-message.ts:
--------------------------------------------------------------------------------
1 | export function getErrorMessage(error: unknown | undefined) {
2 | if (error == null) {
3 | return 'unknown error';
4 | }
5 |
6 | if (typeof error === 'string') {
7 | return error;
8 | }
9 |
10 | if (error instanceof Error) {
11 | return error.message;
12 | }
13 |
14 | return JSON.stringify(error);
15 | }
16 |
--------------------------------------------------------------------------------
/packages/provider-utils/src/is-abort-error.ts:
--------------------------------------------------------------------------------
1 | export function isAbortError(error: unknown): error is Error {
2 | return (
3 | error instanceof Error &&
4 | (error.name === 'AbortError' || error.name === 'TimeoutError')
5 | );
6 | }
7 |
--------------------------------------------------------------------------------
/packages/provider-utils/src/test/convert-array-to-async-iterable.ts:
--------------------------------------------------------------------------------
1 | export function convertArrayToAsyncIterable(values: T[]): AsyncIterable {
2 | return {
3 | async *[Symbol.asyncIterator]() {
4 | for (const value of values) {
5 | yield value;
6 | }
7 | },
8 | };
9 | }
10 |
--------------------------------------------------------------------------------
/packages/provider-utils/src/test/convert-array-to-readable-stream.ts:
--------------------------------------------------------------------------------
1 | export function convertArrayToReadableStream(
2 | values: T[],
3 | ): ReadableStream {
4 | return new ReadableStream({
5 | start(controller) {
6 | try {
7 | for (const value of values) {
8 | controller.enqueue(value);
9 | }
10 | } finally {
11 | controller.close();
12 | }
13 | },
14 | });
15 | }
16 |
--------------------------------------------------------------------------------
/packages/provider-utils/src/test/convert-async-iterable-to-array.ts:
--------------------------------------------------------------------------------
1 | export async function convertAsyncIterableToArray(
2 | iterable: AsyncIterable,
3 | ): Promise {
4 | const result: T[] = [];
5 | for await (const item of iterable) {
6 | result.push(item);
7 | }
8 | return result;
9 | }
10 |
--------------------------------------------------------------------------------
/packages/provider-utils/src/test/convert-readable-stream-to-array.ts:
--------------------------------------------------------------------------------
1 | export async function convertReadableStreamToArray(
2 | stream: ReadableStream,
3 | ): Promise {
4 | const reader = stream.getReader();
5 | const result: T[] = [];
6 |
7 | while (true) {
8 | const { done, value } = await reader.read();
9 | if (done) break;
10 | result.push(value);
11 | }
12 |
13 | return result;
14 | }
15 |
--------------------------------------------------------------------------------
/packages/provider-utils/src/test/convert-response-stream-to-array.ts:
--------------------------------------------------------------------------------
1 | import { convertReadableStreamToArray } from './convert-readable-stream-to-array';
2 |
3 | export async function convertResponseStreamToArray(
4 | response: Response,
5 | ): Promise {
6 | return convertReadableStreamToArray(
7 | response.body!.pipeThrough(new TextDecoderStream()),
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/packages/provider-utils/src/test/mock-id.ts:
--------------------------------------------------------------------------------
1 | export function mockId({
2 | prefix = 'id',
3 | }: {
4 | prefix?: string;
5 | } = {}): () => string {
6 | let counter = 0;
7 | return () => `${prefix}-${counter++}`;
8 | }
9 |
--------------------------------------------------------------------------------
/packages/provider-utils/src/without-trailing-slash.ts:
--------------------------------------------------------------------------------
1 | export function withoutTrailingSlash(url: string | undefined) {
2 | return url?.replace(/\/$/, '');
3 | }
4 |
--------------------------------------------------------------------------------
/packages/provider-utils/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/provider-utils/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | {
11 | entry: ['src/test/index.ts'],
12 | outDir: 'test/dist',
13 | format: ['cjs', 'esm'],
14 | dts: true,
15 | sourcemap: true,
16 | },
17 | ]);
18 |
--------------------------------------------------------------------------------
/packages/provider-utils/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/provider-utils/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/provider-utils/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/provider/README.md:
--------------------------------------------------------------------------------
1 | # AI SDK - Provider Language Model Specification
2 |
--------------------------------------------------------------------------------
/packages/provider/src/embedding-model/index.ts:
--------------------------------------------------------------------------------
1 | export * from './v1/index';
2 |
--------------------------------------------------------------------------------
/packages/provider/src/embedding-model/v1/embedding-model-v1-embedding.ts:
--------------------------------------------------------------------------------
1 | /**
2 | An embedding is a vector, i.e. an array of numbers.
3 | It is e.g. used to represent a text as a vector of word embeddings.
4 | */
5 | export type EmbeddingModelV1Embedding = Array;
6 |
--------------------------------------------------------------------------------
/packages/provider/src/embedding-model/v1/index.ts:
--------------------------------------------------------------------------------
1 | export * from './embedding-model-v1';
2 | export * from './embedding-model-v1-embedding';
3 |
--------------------------------------------------------------------------------
/packages/provider/src/errors/get-error-message.ts:
--------------------------------------------------------------------------------
1 | export function getErrorMessage(error: unknown | undefined) {
2 | if (error == null) {
3 | return 'unknown error';
4 | }
5 |
6 | if (typeof error === 'string') {
7 | return error;
8 | }
9 |
10 | if (error instanceof Error) {
11 | return error.message;
12 | }
13 |
14 | return JSON.stringify(error);
15 | }
16 |
--------------------------------------------------------------------------------
/packages/provider/src/image-model/index.ts:
--------------------------------------------------------------------------------
1 | export * from './v1/index';
2 |
--------------------------------------------------------------------------------
/packages/provider/src/image-model/v1/index.ts:
--------------------------------------------------------------------------------
1 | export type { ImageModelV1 } from './image-model-v1';
2 | export type { ImageModelV1CallOptions } from './image-model-v1-call-options';
3 | export type { ImageModelV1CallWarning } from './image-model-v1-call-warning';
4 |
--------------------------------------------------------------------------------
/packages/provider/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './embedding-model/index';
2 | export * from './errors/index';
3 | export * from './image-model/index';
4 | export * from './json-value/index';
5 | export * from './language-model/index';
6 | export * from './provider/index';
7 | export * from './speech-model/index';
8 | export * from './transcription-model/index';
9 |
10 | export type { JSONSchema7, JSONSchema7Definition } from 'json-schema';
11 |
--------------------------------------------------------------------------------
/packages/provider/src/json-value/index.ts:
--------------------------------------------------------------------------------
1 | export { isJSONArray, isJSONObject, isJSONValue } from './is-json';
2 | export type { JSONArray, JSONObject, JSONValue } from './json-value';
3 |
--------------------------------------------------------------------------------
/packages/provider/src/json-value/json-value.ts:
--------------------------------------------------------------------------------
1 | export type JSONValue =
2 | | null
3 | | string
4 | | number
5 | | boolean
6 | | JSONObject
7 | | JSONArray;
8 |
9 | export type JSONObject = {
10 | [key: string]: JSONValue;
11 | };
12 |
13 | export type JSONArray = JSONValue[];
14 |
--------------------------------------------------------------------------------
/packages/provider/src/language-model/index.ts:
--------------------------------------------------------------------------------
1 | export * from './v1/index';
2 |
--------------------------------------------------------------------------------
/packages/provider/src/language-model/v1/language-model-v1-function-tool-call.ts:
--------------------------------------------------------------------------------
1 | export type LanguageModelV1FunctionToolCall = {
2 | toolCallType: 'function';
3 | toolCallId: string;
4 | toolName: string;
5 |
6 | /**
7 | Stringified JSON object with the tool call arguments. Must match the
8 | parameters schema of the tool.
9 | */
10 | args: string;
11 | };
12 |
--------------------------------------------------------------------------------
/packages/provider/src/language-model/v1/language-model-v1-logprobs.ts:
--------------------------------------------------------------------------------
1 | /**
2 | Log probabilities for each token and its top log probabilities.
3 | */
4 | export type LanguageModelV1LogProbs = Array<{
5 | token: string;
6 | logprob: number;
7 | topLogprobs: Array<{
8 | token: string;
9 | logprob: number;
10 | }>;
11 | }>;
12 |
--------------------------------------------------------------------------------
/packages/provider/src/language-model/v1/language-model-v1-tool-choice.ts:
--------------------------------------------------------------------------------
1 | export type LanguageModelV1ToolChoice =
2 | | { type: 'auto' } // the tool selection is automatic (can be no tool)
3 | | { type: 'none' } // no tool must be selected
4 | | { type: 'required' } // one of the available tools must be selected
5 | | { type: 'tool'; toolName: string }; // a specific tool must be selected:
6 |
--------------------------------------------------------------------------------
/packages/provider/src/provider/index.ts:
--------------------------------------------------------------------------------
1 | export * from './v1/index';
2 |
--------------------------------------------------------------------------------
/packages/provider/src/provider/v1/index.ts:
--------------------------------------------------------------------------------
1 | export type { ProviderV1 } from './provider-v1';
2 |
--------------------------------------------------------------------------------
/packages/provider/src/speech-model/index.ts:
--------------------------------------------------------------------------------
1 | export * from './v1/index';
2 |
--------------------------------------------------------------------------------
/packages/provider/src/speech-model/v1/index.ts:
--------------------------------------------------------------------------------
1 | export type { SpeechModelV1 } from './speech-model-v1';
2 | export type { SpeechModelV1CallOptions } from './speech-model-v1-call-options';
3 | export type { SpeechModelV1CallWarning } from './speech-model-v1-call-warning';
4 |
--------------------------------------------------------------------------------
/packages/provider/src/transcription-model/index.ts:
--------------------------------------------------------------------------------
1 | export * from './v1/index';
2 |
--------------------------------------------------------------------------------
/packages/provider/src/transcription-model/v1/index.ts:
--------------------------------------------------------------------------------
1 | export type { TranscriptionModelV1 } from './transcription-model-v1';
2 | export type { TranscriptionModelV1CallOptions } from './transcription-model-v1-call-options';
3 | export type { TranscriptionModelV1CallWarning } from './transcription-model-v1-call-warning';
4 |
--------------------------------------------------------------------------------
/packages/provider/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/provider/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/provider/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/react/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: ['vercel-ai'],
4 | };
5 |
--------------------------------------------------------------------------------
/packages/react/README.md:
--------------------------------------------------------------------------------
1 | # AI SDK: React provider
2 |
3 | [React](https://react.dev/) UI components for the [AI SDK](https://ai-sdk.dev/docs):
4 |
5 | - [`useChat`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-chat) hook
6 | - [`useCompletion`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-completion) hook
7 | - [`useAssistant`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-assistant) hook
8 |
--------------------------------------------------------------------------------
/packages/react/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './use-assistant';
2 | export * from './use-chat';
3 | export * from './use-completion';
4 | export * from './use-object';
5 |
--------------------------------------------------------------------------------
/packages/react/src/throttle.ts:
--------------------------------------------------------------------------------
1 | import throttleFunction from 'throttleit';
2 |
3 | export function throttle any>(
4 | fn: T,
5 | waitMs: number | undefined,
6 | ): T {
7 | return waitMs != null ? throttleFunction(fn, waitMs) : fn;
8 | }
9 |
--------------------------------------------------------------------------------
/packages/react/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/react-library.json",
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "stripInternal": true
6 | },
7 | "include": ["."],
8 | "exclude": ["*/dist", "dist", "build", "node_modules"]
9 | }
10 |
--------------------------------------------------------------------------------
/packages/react/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | outDir: 'dist',
7 | banner: {},
8 | format: ['cjs', 'esm'],
9 | external: ['vue'],
10 | dts: true,
11 | sourcemap: true,
12 | },
13 | ]);
14 |
--------------------------------------------------------------------------------
/packages/react/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/react/vitest.config.js:
--------------------------------------------------------------------------------
1 | import react from '@vitejs/plugin-react';
2 | import { defineConfig } from 'vite';
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | test: {
8 | environment: 'jsdom',
9 | globals: true,
10 | include: ['src/**/*.ui.test.ts', 'src/**/*.ui.test.tsx'],
11 | },
12 | });
13 |
--------------------------------------------------------------------------------
/packages/replicate/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createReplicate, replicate } from './replicate-provider';
2 | export type {
3 | ReplicateProvider,
4 | ReplicateProviderSettings,
5 | } from './replicate-provider';
6 |
--------------------------------------------------------------------------------
/packages/replicate/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/replicate/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/replicate/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/replicate/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/replicate/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/revai/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @ai-sdk/revai
2 |
3 | ## 0.0.2
4 |
5 | ### Patch Changes
6 |
7 | - Updated dependencies [d87b9d1]
8 | - @ai-sdk/provider-utils@2.2.8
9 |
10 | ## 0.0.1
11 |
12 | ### Patch Changes
13 |
14 | - a7cb932: feat(providers/revai): add transcribe
15 |
--------------------------------------------------------------------------------
/packages/revai/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createRevai, revai } from './revai-provider';
2 | export type { RevaiProvider, RevaiProviderSettings } from './revai-provider';
3 |
--------------------------------------------------------------------------------
/packages/revai/src/revai-config.ts:
--------------------------------------------------------------------------------
1 | import { FetchFunction } from '@ai-sdk/provider-utils';
2 |
3 | export type RevaiConfig = {
4 | provider: string;
5 | url: (options: { modelId: string; path: string }) => string;
6 | headers: () => Record;
7 | fetch?: FetchFunction;
8 | generateId?: () => string;
9 | };
10 |
--------------------------------------------------------------------------------
/packages/revai/src/revai-transcription-settings.ts:
--------------------------------------------------------------------------------
1 | export type RevaiTranscriptionModelId = 'machine' | 'low_cost' | 'fusion';
2 |
--------------------------------------------------------------------------------
/packages/revai/src/transcript-test.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vercel/ai/65e042afde6aad4da9d7a62526ece839eb34f9a5/packages/revai/src/transcript-test.mp3
--------------------------------------------------------------------------------
/packages/revai/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/revai/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/revai/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/revai/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/revai/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/solid/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: ['vercel-ai'],
4 | rules: {
5 | 'react-hooks/rules-of-hooks': 'off',
6 | },
7 | };
8 |
--------------------------------------------------------------------------------
/packages/solid/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './use-chat';
2 | export * from './use-completion';
3 | export * from './use-object';
4 | export * from './use-assistant';
5 |
--------------------------------------------------------------------------------
/packages/solid/src/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "main": "./dist/index.js",
3 | "module": "./dist/index.mjs",
4 | "types": "./dist/index.d.ts",
5 | "exports": "./dist/index.mjs",
6 | "private": true,
7 | "peerDependencies": {
8 | "solid-js": "*"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/packages/solid/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | outDir: 'dist',
7 | banner: {},
8 | format: ['cjs', 'esm'],
9 | external: ['vue'],
10 | dts: true,
11 | sourcemap: true,
12 | },
13 | ]);
14 |
--------------------------------------------------------------------------------
/packages/solid/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/svelte/.gitignore:
--------------------------------------------------------------------------------
1 | /dist
2 | .svelte-kit
3 |
4 | vite.config.js.timestamp-*
5 | vite.config.ts.timestamp-*
6 |
--------------------------------------------------------------------------------
/packages/svelte/src/tests/chat-synchronization.svelte:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/packages/svelte/src/tests/completion-synchronization.svelte:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/packages/svelte/svelte.config.js:
--------------------------------------------------------------------------------
1 | import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
2 |
3 | /** @type {import('@sveltejs/kit').Config} */
4 | const config = {
5 | // Consult https://svelte.dev/docs/kit/integrations
6 | // for more information about preprocessors
7 | preprocess: vitePreprocess(),
8 | };
9 |
10 | export default config;
11 |
--------------------------------------------------------------------------------
/packages/togetherai/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createTogetherAI, togetherai } from './togetherai-provider';
2 | export type {
3 | TogetherAIProvider,
4 | TogetherAIProviderSettings,
5 | } from './togetherai-provider';
6 | export type { OpenAICompatibleErrorData as TogetherAIErrorData } from '@ai-sdk/openai-compatible';
7 |
--------------------------------------------------------------------------------
/packages/togetherai/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/togetherai/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/togetherai/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/togetherai/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/togetherai/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/ui-utils/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: ['vercel-ai'],
4 | };
5 |
--------------------------------------------------------------------------------
/packages/ui-utils/.gitignore:
--------------------------------------------------------------------------------
1 | # test distribution folder:
2 | ./test
--------------------------------------------------------------------------------
/packages/ui-utils/README.md:
--------------------------------------------------------------------------------
1 | # AI SDK - UI Framework Integration Implementation Utilities
2 |
3 | Important: this is an internal API. Expect breaking changes.
4 |
--------------------------------------------------------------------------------
/packages/ui-utils/src/extract-max-tool-invocation-step.ts:
--------------------------------------------------------------------------------
1 | import { ToolInvocation } from './types';
2 |
3 | export function extractMaxToolInvocationStep(
4 | toolInvocations: ToolInvocation[] | undefined,
5 | ): number | undefined {
6 | return toolInvocations?.reduce((max, toolInvocation) => {
7 | return Math.max(max, toolInvocation.step ?? 0);
8 | }, 0);
9 | }
10 |
--------------------------------------------------------------------------------
/packages/ui-utils/src/fill-message-parts.ts:
--------------------------------------------------------------------------------
1 | import { getMessageParts } from './get-message-parts';
2 | import { Message, UIMessage } from './types';
3 |
4 | export function fillMessageParts(messages: Message[]): UIMessage[] {
5 | return messages.map(message => ({
6 | ...message,
7 | parts: getMessageParts(message),
8 | }));
9 | }
10 |
--------------------------------------------------------------------------------
/packages/ui-utils/src/test/create-data-protocol-stream.ts:
--------------------------------------------------------------------------------
1 | import { convertArrayToReadableStream } from '@ai-sdk/provider-utils/test';
2 | import { DataStreamString } from '../data-stream-parts';
3 |
4 | export function createDataProtocolStream(
5 | dataPartTexts: DataStreamString[],
6 | ): ReadableStream {
7 | return convertArrayToReadableStream(dataPartTexts).pipeThrough(
8 | new TextEncoderStream(),
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/packages/ui-utils/src/test/index.ts:
--------------------------------------------------------------------------------
1 | export * from './mock-fetch';
2 |
--------------------------------------------------------------------------------
/packages/ui-utils/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/react-library.json",
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "stripInternal": true
6 | },
7 | "include": ["."],
8 | "exclude": ["dist", "build", "node_modules"]
9 | }
10 |
--------------------------------------------------------------------------------
/packages/ui-utils/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | {
11 | entry: ['src/test/index.ts'],
12 | outDir: 'test/dist',
13 | format: ['cjs', 'esm'],
14 | external: ['vitest'],
15 | dts: true,
16 | sourcemap: true,
17 | },
18 | ]);
19 |
--------------------------------------------------------------------------------
/packages/ui-utils/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/ui-utils/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/ui-utils/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/valibot/README.md:
--------------------------------------------------------------------------------
1 | # AI SDK - Valibot Schema Support
2 |
3 | ## Setup
4 |
5 | ```bash
6 | npm i @ai-sdk/valibot
7 | ```
8 |
--------------------------------------------------------------------------------
/packages/valibot/src/index.ts:
--------------------------------------------------------------------------------
1 | export { valibotSchema } from './valibot-schema';
2 |
--------------------------------------------------------------------------------
/packages/valibot/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/valibot/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/valibot/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/valibot/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/valibot/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/vercel/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @ai-sdk/vercel
2 |
3 | ## 0.0.1
4 |
5 | ### Patch Changes
6 |
7 | - 42e37fb: feat (provider/vercel): initial vercel provider
8 |
--------------------------------------------------------------------------------
/packages/vercel/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createVercel, vercel } from './vercel-provider';
2 | export type { VercelProvider, VercelProviderSettings } from './vercel-provider';
3 | export type { OpenAICompatibleErrorData as VercelErrorData } from '@ai-sdk/openai-compatible';
4 |
--------------------------------------------------------------------------------
/packages/vercel/src/vercel-chat-settings.ts:
--------------------------------------------------------------------------------
1 | import { OpenAICompatibleChatSettings } from '@ai-sdk/openai-compatible';
2 |
3 | // https://vercel.com/docs/v0/api
4 | export type VercelChatModelId = 'v0-1.0-md' | (string & {});
5 |
6 | export interface VercelChatSettings extends OpenAICompatibleChatSettings {}
7 |
--------------------------------------------------------------------------------
/packages/vercel/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/vercel/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/vercel/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/vercel/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/vercel/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/vue/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: ['vercel-ai'],
4 | };
5 |
--------------------------------------------------------------------------------
/packages/vue/README.md:
--------------------------------------------------------------------------------
1 | # AI SDK: Vue.js provider
2 |
3 | [Vue.js](https://vuejs.org/) UI components for the [AI SDK](https://ai-sdk.dev/docs):
4 |
5 | - [`useChat`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-chat) composable
6 | - [`useCompletion`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-completion) composable
7 | - [`useAssistant`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-assistant) composable
8 |
--------------------------------------------------------------------------------
/packages/vue/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './use-chat';
2 | export * from './use-completion';
3 | export * from './use-assistant';
4 |
--------------------------------------------------------------------------------
/packages/vue/src/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "main": "./dist/index.js",
3 | "module": "./dist/index.mjs",
4 | "types": "./dist/index.d.ts",
5 | "exports": "./dist/index.mjs",
6 | "private": true,
7 | "peerDependencies": {
8 | "vue": "*"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/packages/vue/src/shims-vue.d.ts:
--------------------------------------------------------------------------------
1 | // required for vue testing library
2 | declare module '*.vue' {
3 | import Vue from 'vue';
4 | export default Vue;
5 | }
6 |
--------------------------------------------------------------------------------
/packages/vue/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/react-library.json",
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "stripInternal": true
6 | },
7 | "include": ["."],
8 | "exclude": ["*/dist", "dist", "build", "node_modules"]
9 | }
10 |
--------------------------------------------------------------------------------
/packages/vue/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | outDir: 'dist',
7 | banner: {},
8 | format: ['cjs', 'esm'],
9 | external: ['vue'],
10 | dts: true,
11 | sourcemap: true,
12 | },
13 | ]);
14 |
--------------------------------------------------------------------------------
/packages/vue/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/vue/vitest.config.js:
--------------------------------------------------------------------------------
1 | import vue from '@vitejs/plugin-vue';
2 | import { defineConfig } from 'vite';
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [vue()],
7 | test: {
8 | environment: 'jsdom',
9 | globals: true,
10 | include: ['src/**/*.ui.test.ts', 'src/**/*.ui.test.tsx'],
11 | },
12 | });
13 |
--------------------------------------------------------------------------------
/packages/xai/src/index.ts:
--------------------------------------------------------------------------------
1 | export { createXai, xai } from './xai-provider';
2 | export type { XaiProvider, XaiProviderSettings } from './xai-provider';
3 | export type { XaiErrorData } from './xai-error';
4 |
--------------------------------------------------------------------------------
/packages/xai/src/xai-error.ts:
--------------------------------------------------------------------------------
1 | import { z } from 'zod';
2 |
3 | // Add error schema and structure
4 | export const xaiErrorSchema = z.object({
5 | code: z.string(),
6 | error: z.string(),
7 | });
8 |
9 | export type XaiErrorData = z.infer;
10 |
--------------------------------------------------------------------------------
/packages/xai/src/xai-image-settings.ts:
--------------------------------------------------------------------------------
1 | export type XaiImageModelId = 'grok-2-image' | (string & {});
2 |
3 | export interface XaiImageSettings {
4 | /**
5 | Override the maximum number of images per call. Default is 10.
6 | */
7 | maxImagesPerCall?: number;
8 | }
9 |
--------------------------------------------------------------------------------
/packages/xai/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@vercel/ai-tsconfig/ts-library.json",
3 | "include": ["."],
4 | "exclude": ["*/dist", "dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/xai/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'tsup';
2 |
3 | export default defineConfig([
4 | {
5 | entry: ['src/index.ts'],
6 | format: ['cjs', 'esm'],
7 | dts: true,
8 | sourcemap: true,
9 | },
10 | ]);
11 |
--------------------------------------------------------------------------------
/packages/xai/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "//"
4 | ],
5 | "tasks": {
6 | "build": {
7 | "outputs": [
8 | "**/dist/**"
9 | ]
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/xai/vitest.edge.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'edge-runtime',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/packages/xai/vitest.node.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 |
3 | // https://vitejs.dev/config/
4 | export default defineConfig({
5 | test: {
6 | environment: 'node',
7 | globals: true,
8 | include: ['**/*.test.ts', '**/*.test.tsx'],
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/pnpm-workspace.yaml:
--------------------------------------------------------------------------------
1 | packages:
2 | - 'apps/*'
3 | - 'packages/*'
4 | - 'tools/*'
5 | - 'examples/*'
6 | - 'packages/ai/tests/e2e/next-server'
7 |
--------------------------------------------------------------------------------
/socket.yaml:
--------------------------------------------------------------------------------
1 | # top level version field is required
2 | version: 2
3 |
4 | githubApp:
5 | enabled: true
6 | pullRequestAlertsEnabled: false
7 | dependencyOverviewEnabled: false
8 | projectReportsEnabled: true
9 |
10 | projectIgnorePaths:
11 | - '.github/'
12 | - 'examples/'
13 |
--------------------------------------------------------------------------------
/tools/eslint-config/index.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ['next', 'turbo', 'prettier'],
3 | rules: {
4 | '@next/next/no-html-link-for-pages': 'off',
5 | },
6 | parserOptions: {
7 | babelOptions: {
8 | presets: [require.resolve('next/babel')],
9 | },
10 | },
11 | };
12 |
--------------------------------------------------------------------------------
/tools/eslint-config/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "eslint-config-vercel-ai",
3 | "version": "0.0.0",
4 | "license": "MIT",
5 | "main": "index.js",
6 | "dependencies": {
7 | "eslint-config-next": "^14.2.3",
8 | "eslint-config-prettier": "^10.0.1",
9 | "eslint-config-turbo": "^2.3.0",
10 | "eslint-plugin-react": "7.34.1"
11 | },
12 | "publishConfig": {
13 | "access": "public"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/tools/generate-llms-txt/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "name": "generate-llms-txt",
4 | "scripts": {
5 | "generate-llms-txt": "tsx src/generate-llms-txt.ts"
6 | },
7 | "lint-staged": {
8 | "*": [
9 | "prettier --ignore-unknown --write"
10 | ]
11 | },
12 | "devDependencies": {
13 | "tsx": "4.19.2",
14 | "typescript": "5.6.3"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/tools/tsconfig/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@vercel/ai-tsconfig",
3 | "version": "0.0.0",
4 | "private": true,
5 | "license": "MIT",
6 | "publishConfig": {
7 | "access": "public"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/tools/tsconfig/react-library.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/tsconfig",
3 | "display": "React Library",
4 | "extends": "./base.json",
5 | "compilerOptions": {
6 | "jsx": "react-jsx",
7 | "lib": ["dom", "ES2015"],
8 | "module": "ESNext",
9 | "target": "es6"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tools/tsconfig/ts-library.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/tsconfig",
3 | "display": "TypeScript Library",
4 | "extends": "./base.json",
5 | "compilerOptions": {
6 | "lib": [
7 | "dom",
8 | "ES2018"
9 | ],
10 | "module": "ESNext",
11 | "target": "ES2018",
12 | "stripInternal": true
13 | },
14 | }
15 |
--------------------------------------------------------------------------------