@mastra/mcp-docs-server 1.1.4 → 1.1.5-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/package.json +3 -3
- package/.docs/docs/agents/adding-voice.md +0 -353
- package/.docs/docs/agents/agent-approval.md +0 -377
- package/.docs/docs/agents/agent-memory.md +0 -212
- package/.docs/docs/agents/guardrails.md +0 -382
- package/.docs/docs/agents/network-approval.md +0 -275
- package/.docs/docs/agents/networks.md +0 -290
- package/.docs/docs/agents/overview.md +0 -309
- package/.docs/docs/agents/processors.md +0 -632
- package/.docs/docs/agents/structured-output.md +0 -271
- package/.docs/docs/agents/using-tools.md +0 -214
- package/.docs/docs/build-with-ai/mcp-docs-server.md +0 -241
- package/.docs/docs/build-with-ai/skills.md +0 -35
- package/.docs/docs/community/contributing-templates.md +0 -3
- package/.docs/docs/community/discord.md +0 -9
- package/.docs/docs/community/licensing.md +0 -66
- package/.docs/docs/deployment/cloud-providers.md +0 -15
- package/.docs/docs/deployment/mastra-server.md +0 -122
- package/.docs/docs/deployment/monorepo.md +0 -142
- package/.docs/docs/deployment/overview.md +0 -62
- package/.docs/docs/deployment/studio.md +0 -234
- package/.docs/docs/deployment/web-framework.md +0 -52
- package/.docs/docs/deployment/workflow-runners.md +0 -9
- package/.docs/docs/evals/built-in-scorers.md +0 -47
- package/.docs/docs/evals/custom-scorers.md +0 -519
- package/.docs/docs/evals/overview.md +0 -146
- package/.docs/docs/evals/running-in-ci.md +0 -106
- package/.docs/docs/getting-started/build-with-ai.md +0 -68
- package/.docs/docs/getting-started/manual-install.md +0 -226
- package/.docs/docs/getting-started/project-structure.md +0 -60
- package/.docs/docs/getting-started/start.md +0 -28
- package/.docs/docs/getting-started/studio.md +0 -101
- package/.docs/docs/index.md +0 -43
- package/.docs/docs/mastra-cloud/deployment.md +0 -77
- package/.docs/docs/mastra-cloud/observability.md +0 -38
- package/.docs/docs/mastra-cloud/overview.md +0 -23
- package/.docs/docs/mastra-cloud/setup.md +0 -42
- package/.docs/docs/mastra-cloud/studio.md +0 -24
- package/.docs/docs/mcp/overview.md +0 -370
- package/.docs/docs/mcp/publishing-mcp-server.md +0 -95
- package/.docs/docs/memory/memory-processors.md +0 -316
- package/.docs/docs/memory/message-history.md +0 -260
- package/.docs/docs/memory/observational-memory.md +0 -246
- package/.docs/docs/memory/overview.md +0 -45
- package/.docs/docs/memory/semantic-recall.md +0 -272
- package/.docs/docs/memory/storage.md +0 -261
- package/.docs/docs/memory/working-memory.md +0 -400
- package/.docs/docs/observability/datasets/overview.md +0 -188
- package/.docs/docs/observability/datasets/running-experiments.md +0 -266
- package/.docs/docs/observability/logging.md +0 -99
- package/.docs/docs/observability/overview.md +0 -70
- package/.docs/docs/observability/tracing/bridges/otel.md +0 -209
- package/.docs/docs/observability/tracing/exporters/arize.md +0 -274
- package/.docs/docs/observability/tracing/exporters/braintrust.md +0 -111
- package/.docs/docs/observability/tracing/exporters/cloud.md +0 -129
- package/.docs/docs/observability/tracing/exporters/datadog.md +0 -187
- package/.docs/docs/observability/tracing/exporters/default.md +0 -211
- package/.docs/docs/observability/tracing/exporters/laminar.md +0 -100
- package/.docs/docs/observability/tracing/exporters/langfuse.md +0 -217
- package/.docs/docs/observability/tracing/exporters/langsmith.md +0 -202
- package/.docs/docs/observability/tracing/exporters/otel.md +0 -479
- package/.docs/docs/observability/tracing/exporters/posthog.md +0 -148
- package/.docs/docs/observability/tracing/exporters/sentry.md +0 -208
- package/.docs/docs/observability/tracing/overview.md +0 -1114
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +0 -303
- package/.docs/docs/rag/chunking-and-embedding.md +0 -183
- package/.docs/docs/rag/graph-rag.md +0 -215
- package/.docs/docs/rag/overview.md +0 -72
- package/.docs/docs/rag/retrieval.md +0 -521
- package/.docs/docs/rag/vector-databases.md +0 -648
- package/.docs/docs/server/auth/auth0.md +0 -222
- package/.docs/docs/server/auth/better-auth.md +0 -203
- package/.docs/docs/server/auth/clerk.md +0 -132
- package/.docs/docs/server/auth/composite-auth.md +0 -234
- package/.docs/docs/server/auth/custom-auth-provider.md +0 -513
- package/.docs/docs/server/auth/firebase.md +0 -272
- package/.docs/docs/server/auth/jwt.md +0 -110
- package/.docs/docs/server/auth/simple-auth.md +0 -178
- package/.docs/docs/server/auth/supabase.md +0 -117
- package/.docs/docs/server/auth/workos.md +0 -190
- package/.docs/docs/server/auth.md +0 -38
- package/.docs/docs/server/custom-adapters.md +0 -374
- package/.docs/docs/server/custom-api-routes.md +0 -267
- package/.docs/docs/server/mastra-client.md +0 -243
- package/.docs/docs/server/mastra-server.md +0 -71
- package/.docs/docs/server/middleware.md +0 -228
- package/.docs/docs/server/request-context.md +0 -478
- package/.docs/docs/server/server-adapters.md +0 -547
- package/.docs/docs/streaming/events.md +0 -247
- package/.docs/docs/streaming/overview.md +0 -181
- package/.docs/docs/streaming/tool-streaming.md +0 -178
- package/.docs/docs/streaming/workflow-streaming.md +0 -109
- package/.docs/docs/voice/overview.md +0 -979
- package/.docs/docs/voice/speech-to-speech.md +0 -103
- package/.docs/docs/voice/speech-to-text.md +0 -80
- package/.docs/docs/voice/text-to-speech.md +0 -84
- package/.docs/docs/workflows/agents-and-tools.md +0 -170
- package/.docs/docs/workflows/control-flow.md +0 -823
- package/.docs/docs/workflows/error-handling.md +0 -360
- package/.docs/docs/workflows/human-in-the-loop.md +0 -213
- package/.docs/docs/workflows/overview.md +0 -372
- package/.docs/docs/workflows/snapshots.md +0 -238
- package/.docs/docs/workflows/suspend-and-resume.md +0 -205
- package/.docs/docs/workflows/time-travel.md +0 -309
- package/.docs/docs/workflows/workflow-state.md +0 -181
- package/.docs/docs/workspace/filesystem.md +0 -162
- package/.docs/docs/workspace/overview.md +0 -239
- package/.docs/docs/workspace/sandbox.md +0 -63
- package/.docs/docs/workspace/search.md +0 -219
- package/.docs/docs/workspace/skills.md +0 -126
- package/.docs/guides/agent-frameworks/ai-sdk.md +0 -140
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +0 -1463
- package/.docs/guides/build-your-ui/assistant-ui.md +0 -156
- package/.docs/guides/build-your-ui/copilotkit.md +0 -292
- package/.docs/guides/deployment/amazon-ec2.md +0 -130
- package/.docs/guides/deployment/aws-lambda.md +0 -248
- package/.docs/guides/deployment/azure-app-services.md +0 -114
- package/.docs/guides/deployment/cloudflare.md +0 -99
- package/.docs/guides/deployment/digital-ocean.md +0 -168
- package/.docs/guides/deployment/inngest.md +0 -685
- package/.docs/guides/deployment/netlify.md +0 -77
- package/.docs/guides/deployment/vercel.md +0 -101
- package/.docs/guides/getting-started/astro.md +0 -408
- package/.docs/guides/getting-started/electron.md +0 -504
- package/.docs/guides/getting-started/express.md +0 -251
- package/.docs/guides/getting-started/hono.md +0 -191
- package/.docs/guides/getting-started/next-js.md +0 -355
- package/.docs/guides/getting-started/nuxt.md +0 -476
- package/.docs/guides/getting-started/quickstart.md +0 -67
- package/.docs/guides/getting-started/sveltekit.md +0 -300
- package/.docs/guides/getting-started/vite-react.md +0 -439
- package/.docs/guides/guide/ai-recruiter.md +0 -227
- package/.docs/guides/guide/chef-michel.md +0 -215
- package/.docs/guides/guide/code-review-bot.md +0 -221
- package/.docs/guides/guide/dev-assistant.md +0 -304
- package/.docs/guides/guide/docs-manager.md +0 -238
- package/.docs/guides/guide/github-actions-pr-description.md +0 -236
- package/.docs/guides/guide/notes-mcp-server.md +0 -425
- package/.docs/guides/guide/research-assistant.md +0 -349
- package/.docs/guides/guide/stock-agent.md +0 -134
- package/.docs/guides/guide/web-search.md +0 -326
- package/.docs/guides/guide/whatsapp-chat-bot.md +0 -416
- package/.docs/guides/index.md +0 -3
- package/.docs/guides/migrations/agentnetwork.md +0 -101
- package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +0 -112
- package/.docs/guides/migrations/upgrade-to-v1/agent.md +0 -404
- package/.docs/guides/migrations/upgrade-to-v1/cli.md +0 -57
- package/.docs/guides/migrations/upgrade-to-v1/client.md +0 -337
- package/.docs/guides/migrations/upgrade-to-v1/deployment.md +0 -37
- package/.docs/guides/migrations/upgrade-to-v1/evals.md +0 -239
- package/.docs/guides/migrations/upgrade-to-v1/mastra.md +0 -143
- package/.docs/guides/migrations/upgrade-to-v1/mcp.md +0 -97
- package/.docs/guides/migrations/upgrade-to-v1/memory.md +0 -285
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +0 -119
- package/.docs/guides/migrations/upgrade-to-v1/processors.md +0 -68
- package/.docs/guides/migrations/upgrade-to-v1/rag.md +0 -42
- package/.docs/guides/migrations/upgrade-to-v1/storage.md +0 -553
- package/.docs/guides/migrations/upgrade-to-v1/tools.md +0 -180
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +0 -417
- package/.docs/guides/migrations/upgrade-to-v1/vectors.md +0 -87
- package/.docs/guides/migrations/upgrade-to-v1/voice.md +0 -30
- package/.docs/guides/migrations/upgrade-to-v1/workflows.md +0 -341
- package/.docs/guides/migrations/vnext-to-standard-apis.md +0 -364
- package/.docs/models/embeddings.md +0 -161
- package/.docs/models/gateways/azure-openai.md +0 -128
- package/.docs/models/gateways/custom-gateways.md +0 -545
- package/.docs/models/gateways/netlify.md +0 -88
- package/.docs/models/gateways/openrouter.md +0 -219
- package/.docs/models/gateways/vercel.md +0 -225
- package/.docs/models/gateways.md +0 -14
- package/.docs/models/index.md +0 -286
- package/.docs/models/providers/302ai.md +0 -134
- package/.docs/models/providers/abacus.md +0 -125
- package/.docs/models/providers/agentrouter.md +0 -90
- package/.docs/models/providers/aihubmix.md +0 -107
- package/.docs/models/providers/alibaba-cn.md +0 -135
- package/.docs/models/providers/alibaba.md +0 -111
- package/.docs/models/providers/amazon-bedrock.md +0 -33
- package/.docs/models/providers/anthropic.md +0 -153
- package/.docs/models/providers/azure.md +0 -33
- package/.docs/models/providers/bailing.md +0 -72
- package/.docs/models/providers/baseten.md +0 -77
- package/.docs/models/providers/berget.md +0 -78
- package/.docs/models/providers/cerebras.md +0 -101
- package/.docs/models/providers/chutes.md +0 -136
- package/.docs/models/providers/cloudflare-ai-gateway.md +0 -33
- package/.docs/models/providers/cloudflare-workers-ai.md +0 -109
- package/.docs/models/providers/cohere.md +0 -33
- package/.docs/models/providers/cortecs.md +0 -91
- package/.docs/models/providers/deepinfra.md +0 -112
- package/.docs/models/providers/deepseek.md +0 -88
- package/.docs/models/providers/fastrouter.md +0 -84
- package/.docs/models/providers/fireworks-ai.md +0 -89
- package/.docs/models/providers/firmware.md +0 -85
- package/.docs/models/providers/friendli.md +0 -78
- package/.docs/models/providers/github-models.md +0 -125
- package/.docs/models/providers/google-vertex.md +0 -33
- package/.docs/models/providers/google.md +0 -159
- package/.docs/models/providers/groq.md +0 -107
- package/.docs/models/providers/helicone.md +0 -161
- package/.docs/models/providers/huggingface.md +0 -90
- package/.docs/models/providers/iflowcn.md +0 -84
- package/.docs/models/providers/inception.md +0 -72
- package/.docs/models/providers/inference.md +0 -79
- package/.docs/models/providers/io-intelligence.md +0 -87
- package/.docs/models/providers/io-net.md +0 -87
- package/.docs/models/providers/jiekou.md +0 -131
- package/.docs/models/providers/kilo.md +0 -333
- package/.docs/models/providers/kimi-for-coding.md +0 -100
- package/.docs/models/providers/kuae-cloud-coding-plan.md +0 -71
- package/.docs/models/providers/llama.md +0 -77
- package/.docs/models/providers/lmstudio.md +0 -73
- package/.docs/models/providers/lucidquery.md +0 -72
- package/.docs/models/providers/minimax-cn-coding-plan.md +0 -102
- package/.docs/models/providers/minimax-cn.md +0 -102
- package/.docs/models/providers/minimax-coding-plan.md +0 -102
- package/.docs/models/providers/minimax.md +0 -104
- package/.docs/models/providers/mistral.md +0 -124
- package/.docs/models/providers/moark.md +0 -72
- package/.docs/models/providers/modelscope.md +0 -77
- package/.docs/models/providers/moonshotai-cn.md +0 -76
- package/.docs/models/providers/moonshotai.md +0 -76
- package/.docs/models/providers/morph.md +0 -73
- package/.docs/models/providers/nano-gpt.md +0 -103
- package/.docs/models/providers/nebius.md +0 -116
- package/.docs/models/providers/nova.md +0 -72
- package/.docs/models/providers/novita-ai.md +0 -154
- package/.docs/models/providers/nvidia.md +0 -141
- package/.docs/models/providers/ollama-cloud.md +0 -103
- package/.docs/models/providers/ollama.md +0 -33
- package/.docs/models/providers/openai.md +0 -193
- package/.docs/models/providers/opencode.md +0 -100
- package/.docs/models/providers/ovhcloud.md +0 -83
- package/.docs/models/providers/perplexity.md +0 -100
- package/.docs/models/providers/poe.md +0 -183
- package/.docs/models/providers/privatemode-ai.md +0 -75
- package/.docs/models/providers/requesty.md +0 -90
- package/.docs/models/providers/scaleway.md +0 -84
- package/.docs/models/providers/siliconflow-cn.md +0 -138
- package/.docs/models/providers/siliconflow.md +0 -140
- package/.docs/models/providers/stackit.md +0 -78
- package/.docs/models/providers/stepfun.md +0 -73
- package/.docs/models/providers/submodel.md +0 -79
- package/.docs/models/providers/synthetic.md +0 -96
- package/.docs/models/providers/togetherai.md +0 -115
- package/.docs/models/providers/upstage.md +0 -73
- package/.docs/models/providers/venice.md +0 -95
- package/.docs/models/providers/vivgrid.md +0 -106
- package/.docs/models/providers/vultr.md +0 -75
- package/.docs/models/providers/wandb.md +0 -80
- package/.docs/models/providers/xai.md +0 -141
- package/.docs/models/providers/xiaomi.md +0 -71
- package/.docs/models/providers/zai-coding-plan.md +0 -80
- package/.docs/models/providers/zai.md +0 -79
- package/.docs/models/providers/zenmux.md +0 -161
- package/.docs/models/providers/zhipuai-coding-plan.md +0 -79
- package/.docs/models/providers/zhipuai.md +0 -79
- package/.docs/models/providers.md +0 -81
- package/.docs/reference/agents/agent.md +0 -142
- package/.docs/reference/agents/generate.md +0 -174
- package/.docs/reference/agents/generateLegacy.md +0 -176
- package/.docs/reference/agents/getDefaultGenerateOptions.md +0 -36
- package/.docs/reference/agents/getDefaultOptions.md +0 -34
- package/.docs/reference/agents/getDefaultStreamOptions.md +0 -36
- package/.docs/reference/agents/getDescription.md +0 -21
- package/.docs/reference/agents/getInstructions.md +0 -34
- package/.docs/reference/agents/getLLM.md +0 -37
- package/.docs/reference/agents/getMemory.md +0 -34
- package/.docs/reference/agents/getModel.md +0 -34
- package/.docs/reference/agents/getTools.md +0 -29
- package/.docs/reference/agents/getVoice.md +0 -34
- package/.docs/reference/agents/listAgents.md +0 -35
- package/.docs/reference/agents/listScorers.md +0 -34
- package/.docs/reference/agents/listTools.md +0 -34
- package/.docs/reference/agents/listWorkflows.md +0 -34
- package/.docs/reference/agents/network.md +0 -134
- package/.docs/reference/ai-sdk/chat-route.md +0 -82
- package/.docs/reference/ai-sdk/handle-chat-stream.md +0 -53
- package/.docs/reference/ai-sdk/handle-network-stream.md +0 -37
- package/.docs/reference/ai-sdk/handle-workflow-stream.md +0 -55
- package/.docs/reference/ai-sdk/network-route.md +0 -74
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +0 -232
- package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +0 -79
- package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +0 -73
- package/.docs/reference/ai-sdk/with-mastra.md +0 -59
- package/.docs/reference/ai-sdk/workflow-route.md +0 -79
- package/.docs/reference/auth/auth0.md +0 -73
- package/.docs/reference/auth/better-auth.md +0 -71
- package/.docs/reference/auth/clerk.md +0 -36
- package/.docs/reference/auth/firebase.md +0 -80
- package/.docs/reference/auth/jwt.md +0 -26
- package/.docs/reference/auth/supabase.md +0 -33
- package/.docs/reference/auth/workos.md +0 -84
- package/.docs/reference/cli/create-mastra.md +0 -137
- package/.docs/reference/cli/mastra.md +0 -336
- package/.docs/reference/client-js/agents.md +0 -438
- package/.docs/reference/client-js/error-handling.md +0 -16
- package/.docs/reference/client-js/logs.md +0 -24
- package/.docs/reference/client-js/mastra-client.md +0 -63
- package/.docs/reference/client-js/memory.md +0 -225
- package/.docs/reference/client-js/observability.md +0 -72
- package/.docs/reference/client-js/telemetry.md +0 -20
- package/.docs/reference/client-js/tools.md +0 -44
- package/.docs/reference/client-js/vectors.md +0 -79
- package/.docs/reference/client-js/workflows.md +0 -199
- package/.docs/reference/configuration.md +0 -749
- package/.docs/reference/core/addGateway.md +0 -42
- package/.docs/reference/core/getAgent.md +0 -21
- package/.docs/reference/core/getAgentById.md +0 -21
- package/.docs/reference/core/getDeployer.md +0 -22
- package/.docs/reference/core/getGateway.md +0 -38
- package/.docs/reference/core/getGatewayById.md +0 -41
- package/.docs/reference/core/getLogger.md +0 -22
- package/.docs/reference/core/getMCPServer.md +0 -45
- package/.docs/reference/core/getMCPServerById.md +0 -53
- package/.docs/reference/core/getMemory.md +0 -50
- package/.docs/reference/core/getScorer.md +0 -54
- package/.docs/reference/core/getScorerById.md +0 -54
- package/.docs/reference/core/getServer.md +0 -22
- package/.docs/reference/core/getStorage.md +0 -22
- package/.docs/reference/core/getStoredAgentById.md +0 -89
- package/.docs/reference/core/getTelemetry.md +0 -22
- package/.docs/reference/core/getVector.md +0 -22
- package/.docs/reference/core/getWorkflow.md +0 -40
- package/.docs/reference/core/listAgents.md +0 -21
- package/.docs/reference/core/listGateways.md +0 -40
- package/.docs/reference/core/listLogs.md +0 -38
- package/.docs/reference/core/listLogsByRunId.md +0 -36
- package/.docs/reference/core/listMCPServers.md +0 -51
- package/.docs/reference/core/listMemory.md +0 -56
- package/.docs/reference/core/listScorers.md +0 -29
- package/.docs/reference/core/listStoredAgents.md +0 -93
- package/.docs/reference/core/listVectors.md +0 -22
- package/.docs/reference/core/listWorkflows.md +0 -21
- package/.docs/reference/core/mastra-class.md +0 -66
- package/.docs/reference/core/mastra-model-gateway.md +0 -153
- package/.docs/reference/core/setLogger.md +0 -26
- package/.docs/reference/core/setStorage.md +0 -27
- package/.docs/reference/datasets/addItem.md +0 -35
- package/.docs/reference/datasets/addItems.md +0 -33
- package/.docs/reference/datasets/compareExperiments.md +0 -48
- package/.docs/reference/datasets/create.md +0 -49
- package/.docs/reference/datasets/dataset.md +0 -78
- package/.docs/reference/datasets/datasets-manager.md +0 -84
- package/.docs/reference/datasets/delete.md +0 -23
- package/.docs/reference/datasets/deleteExperiment.md +0 -25
- package/.docs/reference/datasets/deleteItem.md +0 -25
- package/.docs/reference/datasets/deleteItems.md +0 -27
- package/.docs/reference/datasets/get.md +0 -29
- package/.docs/reference/datasets/getDetails.md +0 -45
- package/.docs/reference/datasets/getExperiment.md +0 -28
- package/.docs/reference/datasets/getItem.md +0 -31
- package/.docs/reference/datasets/getItemHistory.md +0 -29
- package/.docs/reference/datasets/list.md +0 -29
- package/.docs/reference/datasets/listExperimentResults.md +0 -37
- package/.docs/reference/datasets/listExperiments.md +0 -31
- package/.docs/reference/datasets/listItems.md +0 -44
- package/.docs/reference/datasets/listVersions.md +0 -31
- package/.docs/reference/datasets/startExperiment.md +0 -60
- package/.docs/reference/datasets/startExperimentAsync.md +0 -41
- package/.docs/reference/datasets/update.md +0 -46
- package/.docs/reference/datasets/updateItem.md +0 -36
- package/.docs/reference/deployer/cloudflare.md +0 -79
- package/.docs/reference/deployer/netlify.md +0 -82
- package/.docs/reference/deployer/vercel.md +0 -91
- package/.docs/reference/deployer.md +0 -100
- package/.docs/reference/evals/answer-relevancy.md +0 -105
- package/.docs/reference/evals/answer-similarity.md +0 -99
- package/.docs/reference/evals/bias.md +0 -120
- package/.docs/reference/evals/completeness.md +0 -137
- package/.docs/reference/evals/content-similarity.md +0 -101
- package/.docs/reference/evals/context-precision.md +0 -196
- package/.docs/reference/evals/context-relevance.md +0 -536
- package/.docs/reference/evals/create-scorer.md +0 -270
- package/.docs/reference/evals/faithfulness.md +0 -114
- package/.docs/reference/evals/hallucination.md +0 -220
- package/.docs/reference/evals/keyword-coverage.md +0 -128
- package/.docs/reference/evals/mastra-scorer.md +0 -123
- package/.docs/reference/evals/noise-sensitivity.md +0 -685
- package/.docs/reference/evals/prompt-alignment.md +0 -619
- package/.docs/reference/evals/run-evals.md +0 -138
- package/.docs/reference/evals/scorer-utils.md +0 -330
- package/.docs/reference/evals/textual-difference.md +0 -113
- package/.docs/reference/evals/tone-consistency.md +0 -119
- package/.docs/reference/evals/tool-call-accuracy.md +0 -533
- package/.docs/reference/evals/toxicity.md +0 -123
- package/.docs/reference/harness/harness-class.md +0 -645
- package/.docs/reference/index.md +0 -276
- package/.docs/reference/logging/pino-logger.md +0 -117
- package/.docs/reference/memory/clone-utilities.md +0 -199
- package/.docs/reference/memory/cloneThread.md +0 -130
- package/.docs/reference/memory/createThread.md +0 -68
- package/.docs/reference/memory/deleteMessages.md +0 -40
- package/.docs/reference/memory/getThreadById.md +0 -24
- package/.docs/reference/memory/listThreads.md +0 -145
- package/.docs/reference/memory/memory-class.md +0 -147
- package/.docs/reference/memory/observational-memory.md +0 -565
- package/.docs/reference/memory/recall.md +0 -91
- package/.docs/reference/observability/tracing/bridges/otel.md +0 -131
- package/.docs/reference/observability/tracing/configuration.md +0 -178
- package/.docs/reference/observability/tracing/exporters/arize.md +0 -141
- package/.docs/reference/observability/tracing/exporters/braintrust.md +0 -93
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +0 -163
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +0 -138
- package/.docs/reference/observability/tracing/exporters/datadog.md +0 -116
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +0 -174
- package/.docs/reference/observability/tracing/exporters/laminar.md +0 -78
- package/.docs/reference/observability/tracing/exporters/langfuse.md +0 -134
- package/.docs/reference/observability/tracing/exporters/langsmith.md +0 -110
- package/.docs/reference/observability/tracing/exporters/otel.md +0 -199
- package/.docs/reference/observability/tracing/exporters/posthog.md +0 -92
- package/.docs/reference/observability/tracing/exporters/sentry.md +0 -184
- package/.docs/reference/observability/tracing/instances.md +0 -109
- package/.docs/reference/observability/tracing/interfaces.md +0 -749
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +0 -144
- package/.docs/reference/observability/tracing/spans.md +0 -224
- package/.docs/reference/processors/batch-parts-processor.md +0 -61
- package/.docs/reference/processors/language-detector.md +0 -81
- package/.docs/reference/processors/message-history-processor.md +0 -85
- package/.docs/reference/processors/moderation-processor.md +0 -104
- package/.docs/reference/processors/pii-detector.md +0 -107
- package/.docs/reference/processors/processor-interface.md +0 -525
- package/.docs/reference/processors/prompt-injection-detector.md +0 -71
- package/.docs/reference/processors/semantic-recall-processor.md +0 -123
- package/.docs/reference/processors/system-prompt-scrubber.md +0 -80
- package/.docs/reference/processors/token-limiter-processor.md +0 -113
- package/.docs/reference/processors/tool-call-filter.md +0 -85
- package/.docs/reference/processors/tool-search-processor.md +0 -113
- package/.docs/reference/processors/unicode-normalizer.md +0 -62
- package/.docs/reference/processors/working-memory-processor.md +0 -154
- package/.docs/reference/rag/chunk.md +0 -221
- package/.docs/reference/rag/database-config.md +0 -264
- package/.docs/reference/rag/document.md +0 -114
- package/.docs/reference/rag/embeddings.md +0 -92
- package/.docs/reference/rag/extract-params.md +0 -168
- package/.docs/reference/rag/graph-rag.md +0 -111
- package/.docs/reference/rag/metadata-filters.md +0 -216
- package/.docs/reference/rag/rerank.md +0 -80
- package/.docs/reference/rag/rerankWithScorer.md +0 -80
- package/.docs/reference/server/create-route.md +0 -260
- package/.docs/reference/server/express-adapter.md +0 -176
- package/.docs/reference/server/fastify-adapter.md +0 -90
- package/.docs/reference/server/hono-adapter.md +0 -162
- package/.docs/reference/server/koa-adapter.md +0 -127
- package/.docs/reference/server/mastra-server.md +0 -298
- package/.docs/reference/server/register-api-route.md +0 -249
- package/.docs/reference/server/routes.md +0 -306
- package/.docs/reference/storage/cloudflare-d1.md +0 -218
- package/.docs/reference/storage/cloudflare.md +0 -88
- package/.docs/reference/storage/composite.md +0 -235
- package/.docs/reference/storage/convex.md +0 -161
- package/.docs/reference/storage/dynamodb.md +0 -282
- package/.docs/reference/storage/lance.md +0 -131
- package/.docs/reference/storage/libsql.md +0 -135
- package/.docs/reference/storage/mongodb.md +0 -262
- package/.docs/reference/storage/mssql.md +0 -155
- package/.docs/reference/storage/overview.md +0 -121
- package/.docs/reference/storage/postgresql.md +0 -529
- package/.docs/reference/storage/upstash.md +0 -160
- package/.docs/reference/streaming/ChunkType.md +0 -292
- package/.docs/reference/streaming/agents/MastraModelOutput.md +0 -182
- package/.docs/reference/streaming/agents/stream.md +0 -212
- package/.docs/reference/streaming/agents/streamLegacy.md +0 -142
- package/.docs/reference/streaming/workflows/observeStream.md +0 -42
- package/.docs/reference/streaming/workflows/resumeStream.md +0 -61
- package/.docs/reference/streaming/workflows/stream.md +0 -88
- package/.docs/reference/streaming/workflows/timeTravelStream.md +0 -142
- package/.docs/reference/templates/overview.md +0 -194
- package/.docs/reference/tools/create-tool.md +0 -237
- package/.docs/reference/tools/document-chunker-tool.md +0 -89
- package/.docs/reference/tools/graph-rag-tool.md +0 -185
- package/.docs/reference/tools/mcp-client.md +0 -962
- package/.docs/reference/tools/mcp-server.md +0 -1275
- package/.docs/reference/tools/vector-query-tool.md +0 -459
- package/.docs/reference/vectors/astra.md +0 -121
- package/.docs/reference/vectors/chroma.md +0 -267
- package/.docs/reference/vectors/convex.md +0 -303
- package/.docs/reference/vectors/couchbase.md +0 -226
- package/.docs/reference/vectors/duckdb.md +0 -318
- package/.docs/reference/vectors/elasticsearch.md +0 -189
- package/.docs/reference/vectors/lance.md +0 -220
- package/.docs/reference/vectors/libsql.md +0 -305
- package/.docs/reference/vectors/mongodb.md +0 -295
- package/.docs/reference/vectors/opensearch.md +0 -99
- package/.docs/reference/vectors/pg.md +0 -408
- package/.docs/reference/vectors/pinecone.md +0 -168
- package/.docs/reference/vectors/qdrant.md +0 -222
- package/.docs/reference/vectors/s3vectors.md +0 -277
- package/.docs/reference/vectors/turbopuffer.md +0 -157
- package/.docs/reference/vectors/upstash.md +0 -294
- package/.docs/reference/vectors/vectorize.md +0 -147
- package/.docs/reference/voice/azure.md +0 -148
- package/.docs/reference/voice/cloudflare.md +0 -83
- package/.docs/reference/voice/composite-voice.md +0 -121
- package/.docs/reference/voice/deepgram.md +0 -79
- package/.docs/reference/voice/elevenlabs.md +0 -98
- package/.docs/reference/voice/google-gemini-live.md +0 -378
- package/.docs/reference/voice/google.md +0 -228
- package/.docs/reference/voice/mastra-voice.md +0 -313
- package/.docs/reference/voice/murf.md +0 -122
- package/.docs/reference/voice/openai-realtime.md +0 -203
- package/.docs/reference/voice/openai.md +0 -88
- package/.docs/reference/voice/playai.md +0 -80
- package/.docs/reference/voice/sarvam.md +0 -126
- package/.docs/reference/voice/speechify.md +0 -75
- package/.docs/reference/voice/voice.addInstructions.md +0 -56
- package/.docs/reference/voice/voice.addTools.md +0 -67
- package/.docs/reference/voice/voice.answer.md +0 -54
- package/.docs/reference/voice/voice.close.md +0 -51
- package/.docs/reference/voice/voice.connect.md +0 -94
- package/.docs/reference/voice/voice.events.md +0 -37
- package/.docs/reference/voice/voice.getSpeakers.md +0 -129
- package/.docs/reference/voice/voice.listen.md +0 -164
- package/.docs/reference/voice/voice.off.md +0 -54
- package/.docs/reference/voice/voice.on.md +0 -111
- package/.docs/reference/voice/voice.send.md +0 -65
- package/.docs/reference/voice/voice.speak.md +0 -157
- package/.docs/reference/voice/voice.updateConfig.md +0 -60
- package/.docs/reference/workflows/run-methods/cancel.md +0 -86
- package/.docs/reference/workflows/run-methods/restart.md +0 -33
- package/.docs/reference/workflows/run-methods/resume.md +0 -59
- package/.docs/reference/workflows/run-methods/start.md +0 -58
- package/.docs/reference/workflows/run-methods/startAsync.md +0 -67
- package/.docs/reference/workflows/run-methods/timeTravel.md +0 -142
- package/.docs/reference/workflows/run.md +0 -59
- package/.docs/reference/workflows/step.md +0 -119
- package/.docs/reference/workflows/workflow-methods/branch.md +0 -25
- package/.docs/reference/workflows/workflow-methods/commit.md +0 -17
- package/.docs/reference/workflows/workflow-methods/create-run.md +0 -63
- package/.docs/reference/workflows/workflow-methods/dountil.md +0 -25
- package/.docs/reference/workflows/workflow-methods/dowhile.md +0 -25
- package/.docs/reference/workflows/workflow-methods/foreach.md +0 -118
- package/.docs/reference/workflows/workflow-methods/map.md +0 -93
- package/.docs/reference/workflows/workflow-methods/parallel.md +0 -21
- package/.docs/reference/workflows/workflow-methods/sleep.md +0 -35
- package/.docs/reference/workflows/workflow-methods/sleepUntil.md +0 -35
- package/.docs/reference/workflows/workflow-methods/then.md +0 -21
- package/.docs/reference/workflows/workflow.md +0 -157
- package/.docs/reference/workspace/e2b-sandbox.md +0 -288
- package/.docs/reference/workspace/filesystem.md +0 -202
- package/.docs/reference/workspace/gcs-filesystem.md +0 -170
- package/.docs/reference/workspace/local-filesystem.md +0 -327
- package/.docs/reference/workspace/local-sandbox.md +0 -285
- package/.docs/reference/workspace/s3-filesystem.md +0 -169
- package/.docs/reference/workspace/sandbox.md +0 -81
- package/.docs/reference/workspace/workspace-class.md +0 -226
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
# Migrate from VNext to Standard APIs
|
|
2
|
-
|
|
3
|
-
As of `v0.20.0` for `@mastra/core`, the following changes apply.
|
|
4
|
-
|
|
5
|
-
## Legacy APIs (AI SDK v4)
|
|
6
|
-
|
|
7
|
-
The original methods have been renamed and maintain backward compatibility with **AI SDK v4** and `v1` models.
|
|
8
|
-
|
|
9
|
-
- `.stream()` → `.streamLegacy()`
|
|
10
|
-
- `.generate()` → `.generateLegacy()`
|
|
11
|
-
|
|
12
|
-
## Standard APIs (AI SDK v5)
|
|
13
|
-
|
|
14
|
-
These are now the current APIs with full **AI SDK v5** and `v2` model compatibility.
|
|
15
|
-
|
|
16
|
-
- `.streamVNext()` → `.stream()`
|
|
17
|
-
- `.generateVNext()` → `.generate()`
|
|
18
|
-
|
|
19
|
-
## Migration paths
|
|
20
|
-
|
|
21
|
-
If you're already using `.streamVNext()` and `.generateVNext()` use find/replace to change methods to `.stream()` and `.generate()` respectively.
|
|
22
|
-
|
|
23
|
-
If you're using the old `.stream()` and `.generate()`, decide whether you want to upgrade or not. If you don't, use find/replace to change to `.streamLegacy()` and `.generateLegacy()`.
|
|
24
|
-
|
|
25
|
-
Choose the migration path that fits your needs:
|
|
26
|
-
|
|
27
|
-
### Keep using AI SDK v4 models
|
|
28
|
-
|
|
29
|
-
- Rename all your `.stream()` and `.generate()` calls to `.streamLegacy()` and `.generateLegacy()` respectively.
|
|
30
|
-
|
|
31
|
-
> No further changes required.
|
|
32
|
-
|
|
33
|
-
### Keep using AI SDK v5 models
|
|
34
|
-
|
|
35
|
-
- Rename all your `.streamVNext()` and `.generateVNext()` calls to `.stream()` and `.generate()` respectively.
|
|
36
|
-
|
|
37
|
-
> No further changes required.
|
|
38
|
-
|
|
39
|
-
### Upgrade from AI SDK v4 to v5
|
|
40
|
-
|
|
41
|
-
- Bump all your model provider packages by a major version.
|
|
42
|
-
|
|
43
|
-
> This will ensure that they are all v5 models now. Follow the guide below to understand the key differences and update your code accordingly.
|
|
44
|
-
|
|
45
|
-
## Key differences
|
|
46
|
-
|
|
47
|
-
The updated `.stream()` and `.generate()` methods differ from their legacy counterparts in behavior, compatibility, return types, and available options. This section highlights the most important changes you need to understand when migrating.
|
|
48
|
-
|
|
49
|
-
### Model version support
|
|
50
|
-
|
|
51
|
-
**Legacy APIs**
|
|
52
|
-
|
|
53
|
-
- `.generateLegacy()`
|
|
54
|
-
- `.streamLegacy()`
|
|
55
|
-
|
|
56
|
-
Only support **AI SDK v4** models (`specificationVersion: 'v1'`)
|
|
57
|
-
|
|
58
|
-
**Standard APIs**
|
|
59
|
-
|
|
60
|
-
- `.generate()`
|
|
61
|
-
- `.stream()`
|
|
62
|
-
|
|
63
|
-
Only support **AI SDK v5** models (`specificationVersion: 'v2'`)
|
|
64
|
-
|
|
65
|
-
> This is enforced at runtime with clear error messages.
|
|
66
|
-
|
|
67
|
-
### Return types
|
|
68
|
-
|
|
69
|
-
**Legacy APIs**
|
|
70
|
-
|
|
71
|
-
- `.generateLegacy()` Returns: `GenerateTextResult` or `GenerateObjectResult`
|
|
72
|
-
|
|
73
|
-
- `.streamLegacy()` Returns: `StreamTextResult` or `StreamObjectResult`
|
|
74
|
-
|
|
75
|
-
See the following API references for more information:
|
|
76
|
-
|
|
77
|
-
- [Agent.generateLegacy()](https://mastra.ai/reference/agents/generateLegacy)
|
|
78
|
-
- [Agent.streamLegacy()](https://mastra.ai/reference/streaming/agents/streamLegacy)
|
|
79
|
-
|
|
80
|
-
**Standard APIs**
|
|
81
|
-
|
|
82
|
-
- `.generate()`
|
|
83
|
-
|
|
84
|
-
- `format: 'mastra'` (default): Returns `MastraModelOutput.getFullOutput()`
|
|
85
|
-
- `format: 'aisdk'`: Returns `AISDKV5OutputStream.getFullOutput()`
|
|
86
|
-
- Internally calls `.stream()` and awaits `.getFullOutput()`
|
|
87
|
-
|
|
88
|
-
- `.stream()`
|
|
89
|
-
|
|
90
|
-
- `format: 'mastra'` (default): Returns `MastraModelOutput<OUTPUT>`
|
|
91
|
-
- `format: 'aisdk'`: Returns `AISDKV5OutputStream<OUTPUT>`
|
|
92
|
-
|
|
93
|
-
See the following API references for more information:
|
|
94
|
-
|
|
95
|
-
- [Agent.generate()](https://mastra.ai/reference/agents/generate)
|
|
96
|
-
- [Agent.stream()](https://mastra.ai/reference/streaming/agents/stream)
|
|
97
|
-
|
|
98
|
-
### Format control
|
|
99
|
-
|
|
100
|
-
**Legacy APIs**
|
|
101
|
-
|
|
102
|
-
No `format` option: Always return AI SDK v4 types
|
|
103
|
-
|
|
104
|
-
```typescript
|
|
105
|
-
// Mastra native format (default)
|
|
106
|
-
const result = await agent.stream(messages);
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
**Standard APIs**
|
|
110
|
-
|
|
111
|
-
Use `format` option to choose output:
|
|
112
|
-
|
|
113
|
-
- `'mastra'` (default)
|
|
114
|
-
- `'aisdk'` (AI SDK v5 compatible)
|
|
115
|
-
|
|
116
|
-
```typescript
|
|
117
|
-
// AI SDK v5 compatibility
|
|
118
|
-
const result = await agent.stream(messages, {
|
|
119
|
-
format: "aisdk",
|
|
120
|
-
});
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### New options in standard APIs
|
|
124
|
-
|
|
125
|
-
The following options are available in the standard `.stream()` and `generate()`, but **NOT** in their legacy counterparts:
|
|
126
|
-
|
|
127
|
-
- `format` - Choose between 'mastra' or 'aisdk' output format:
|
|
128
|
-
|
|
129
|
-
```typescript
|
|
130
|
-
const result = await agent.stream(messages, {
|
|
131
|
-
format: "aisdk", // or 'mastra' (default)
|
|
132
|
-
});
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
- `system` - Custom system message (separate from instructions).
|
|
136
|
-
|
|
137
|
-
```typescript
|
|
138
|
-
const result = await agent.stream(messages, {
|
|
139
|
-
system: "You are a helpful assistant",
|
|
140
|
-
});
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
- `structuredOutput` - Enhanced structured output with model override and custom options.
|
|
144
|
-
|
|
145
|
-
- `jsonPromptInjection` - Used to override the default behaviour of passing response\_format to the model. This will inject context into the prompt to coerce the model into returning structured outputs.
|
|
146
|
-
|
|
147
|
-
- `model` - If a model is added this will create a sub agent to structure the response from the main agent. The main agent will call tools and return text, and the sub agent will return an object that conforms to your schema provided. This is a replacement for `experimental_output`.
|
|
148
|
-
|
|
149
|
-
- `errorStrategy` - Determines what happens when the output doesn’t match the schema:
|
|
150
|
-
|
|
151
|
-
- 'warn' - log a warning
|
|
152
|
-
- 'error' - throw an error
|
|
153
|
-
- 'fallback' - return a fallback value you provide
|
|
154
|
-
|
|
155
|
-
```typescript
|
|
156
|
-
const result = await agent.generate(messages, {
|
|
157
|
-
structuredOutput: {
|
|
158
|
-
schema: z.object({
|
|
159
|
-
name: z.string(),
|
|
160
|
-
age: z.number(),
|
|
161
|
-
}),
|
|
162
|
-
model: "openai/gpt-5.1", // Optional model override for structuring
|
|
163
|
-
errorStrategy: "fallback",
|
|
164
|
-
fallbackValue: { name: "unknown", age: 0 },
|
|
165
|
-
instructions: "Extract user information", // Override default structuring instructions
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
- `stopWhen` - Flexible stop conditions (step count, token limit, etc).
|
|
171
|
-
|
|
172
|
-
```typescript
|
|
173
|
-
const result = await agent.stream(messages, {
|
|
174
|
-
stopWhen: ({ steps, totalTokens }) => steps >= 5 || totalTokens >= 10000,
|
|
175
|
-
});
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
- `providerOptions` - Provider-specific options (e.g., OpenAI-specific settings)
|
|
179
|
-
|
|
180
|
-
```typescript
|
|
181
|
-
const result = await agent.stream(messages, {
|
|
182
|
-
providerOptions: {
|
|
183
|
-
openai: {
|
|
184
|
-
store: true,
|
|
185
|
-
metadata: { userId: "123" },
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
});
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
- `onChunk` - Callback for each streaming chunk.
|
|
192
|
-
|
|
193
|
-
```typescript
|
|
194
|
-
const result = await agent.stream(messages, {
|
|
195
|
-
onChunk: (chunk) => {
|
|
196
|
-
console.log("Received chunk:", chunk);
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
- `onError` - Error callback.
|
|
202
|
-
|
|
203
|
-
```typescript
|
|
204
|
-
const result = await agent.stream(messages, {
|
|
205
|
-
onError: (error) => {
|
|
206
|
-
console.error("Stream error:", error);
|
|
207
|
-
},
|
|
208
|
-
});
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
- `onAbort` - Abort callback.
|
|
212
|
-
|
|
213
|
-
```typescript
|
|
214
|
-
const result = await agent.stream(messages, {
|
|
215
|
-
onAbort: () => {
|
|
216
|
-
console.log("Stream aborted");
|
|
217
|
-
},
|
|
218
|
-
});
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
- `activeTools` - Specify which tools are active for this execution.
|
|
222
|
-
|
|
223
|
-
```typescript
|
|
224
|
-
const result = await agent.stream(messages, {
|
|
225
|
-
activeTools: ["search", "calculator"], // Only these tools will be available
|
|
226
|
-
});
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
- `abortSignal` - AbortSignal for cancellation.
|
|
230
|
-
|
|
231
|
-
```typescript
|
|
232
|
-
const controller = new AbortController();
|
|
233
|
-
const result = await agent.stream(messages, {
|
|
234
|
-
abortSignal: controller.signal,
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
// Later: controller.abort();
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
- `prepareStep` - Callback before each step in multi-step execution.
|
|
241
|
-
|
|
242
|
-
```typescript
|
|
243
|
-
const result = await agent.stream(messages, {
|
|
244
|
-
prepareStep: ({ step, state }) => {
|
|
245
|
-
console.log("About to execute step:", step);
|
|
246
|
-
return {
|
|
247
|
-
/* modified state */
|
|
248
|
-
};
|
|
249
|
-
},
|
|
250
|
-
});
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
- `requireToolApproval` - Require approval for all tool calls.
|
|
254
|
-
|
|
255
|
-
```typescript
|
|
256
|
-
const result = await agent.stream(messages, {
|
|
257
|
-
requireToolApproval: true,
|
|
258
|
-
});
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
### Legacy options that moved
|
|
262
|
-
|
|
263
|
-
- `temperature` and other `modelSettings`.
|
|
264
|
-
|
|
265
|
-
Unified in `modelSettings`
|
|
266
|
-
|
|
267
|
-
```typescript
|
|
268
|
-
const result = await agent.stream(messages, {
|
|
269
|
-
modelSettings: {
|
|
270
|
-
temperature: 0.7,
|
|
271
|
-
maxTokens: 1000,
|
|
272
|
-
topP: 0.9,
|
|
273
|
-
},
|
|
274
|
-
});
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
- `resourceId` and `threadId`.
|
|
278
|
-
|
|
279
|
-
Moved to memory object.
|
|
280
|
-
|
|
281
|
-
```typescript
|
|
282
|
-
const result = await agent.stream(messages, {
|
|
283
|
-
memory: {
|
|
284
|
-
resource: "user-123",
|
|
285
|
-
thread: "thread-456",
|
|
286
|
-
},
|
|
287
|
-
});
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
### Deprecated or removed options
|
|
291
|
-
|
|
292
|
-
- `experimental_output`
|
|
293
|
-
|
|
294
|
-
Use `structuredOutput` instead to allow for tool calls and an object return.
|
|
295
|
-
|
|
296
|
-
```typescript
|
|
297
|
-
const result = await agent.generate(messages, {
|
|
298
|
-
structuredOutput: {
|
|
299
|
-
schema: z.object({
|
|
300
|
-
summary: z.string(),
|
|
301
|
-
}),
|
|
302
|
-
model: "openai/gpt-5.1",
|
|
303
|
-
},
|
|
304
|
-
});
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
- `output`
|
|
308
|
-
|
|
309
|
-
The `output` property is deprecated in favor of `structuredOutput`, to achieve the same results, omit the model and only pass `structuredOutput.schema`, optionally add `jsonPromptInjection: true` if your model does not natively support `response_format`.
|
|
310
|
-
|
|
311
|
-
```typescript
|
|
312
|
-
const result = await agent.generate(messages, {
|
|
313
|
-
structuredOutput: {
|
|
314
|
-
schema: {
|
|
315
|
-
z.object({
|
|
316
|
-
name: z.string()
|
|
317
|
-
})
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
});
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
- `memoryOptions`
|
|
324
|
-
|
|
325
|
-
Use `memory` instead.
|
|
326
|
-
|
|
327
|
-
```typescript
|
|
328
|
-
const result = await agent.generate(messages, {
|
|
329
|
-
memory: {},
|
|
330
|
-
});
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
### Type changes
|
|
334
|
-
|
|
335
|
-
**Legacy APIs**
|
|
336
|
-
|
|
337
|
-
- `CoreMessage[]`
|
|
338
|
-
|
|
339
|
-
See the following API references for more information:
|
|
340
|
-
|
|
341
|
-
- [Agent.generateLegacy()](https://mastra.ai/reference/agents/generateLegacy)
|
|
342
|
-
- [Agent.streamLegacy()](https://mastra.ai/reference/streaming/agents/streamLegacy)
|
|
343
|
-
|
|
344
|
-
**Standard APIs**
|
|
345
|
-
|
|
346
|
-
- `ModelMessage[]`
|
|
347
|
-
|
|
348
|
-
`toolChoice` uses the AI SDK v5 `ToolChoice` type.
|
|
349
|
-
|
|
350
|
-
```typescript
|
|
351
|
-
type ToolChoice<TOOLS extends Record<string, unknown>> =
|
|
352
|
-
| "auto"
|
|
353
|
-
| "none"
|
|
354
|
-
| "required"
|
|
355
|
-
| {
|
|
356
|
-
type: "tool";
|
|
357
|
-
toolName: Extract<keyof TOOLS, string>;
|
|
358
|
-
};
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
See the following API references for more information:
|
|
362
|
-
|
|
363
|
-
- [Agent.generate()](https://mastra.ai/reference/agents/generate)
|
|
364
|
-
- [Agent.stream()](https://mastra.ai/reference/streaming/agents/stream)
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
# Embedding Models
|
|
2
|
-
|
|
3
|
-
Mastra's model router supports embedding models using the same `provider/model` string format as language models. This provides a unified interface for both chat and embedding models with TypeScript autocomplete support.
|
|
4
|
-
|
|
5
|
-
## Quick Start
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
import { ModelRouterEmbeddingModel } from "@mastra/core/llm";
|
|
9
|
-
import { embedMany } from "ai";
|
|
10
|
-
|
|
11
|
-
// Generate embeddings
|
|
12
|
-
const { embeddings } = await embedMany({
|
|
13
|
-
model: new ModelRouterEmbeddingModel("openai/text-embedding-3-small"),
|
|
14
|
-
values: ["Hello world", "Semantic search is powerful"],
|
|
15
|
-
});
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Supported Models
|
|
19
|
-
|
|
20
|
-
### OpenAI
|
|
21
|
-
|
|
22
|
-
- `text-embedding-3-small` - 1536 dimensions, 8191 max tokens
|
|
23
|
-
- `text-embedding-3-large` - 3072 dimensions, 8191 max tokens
|
|
24
|
-
- `text-embedding-ada-002` - 1536 dimensions, 8191 max tokens
|
|
25
|
-
|
|
26
|
-
```typescript
|
|
27
|
-
const embedder = new ModelRouterEmbeddingModel("openai/text-embedding-3-small");
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Google
|
|
31
|
-
|
|
32
|
-
- `gemini-embedding-001` - 768 dimensions, 2048 max tokens
|
|
33
|
-
|
|
34
|
-
```typescript
|
|
35
|
-
const embedder = new ModelRouterEmbeddingModel("google/gemini-embedding-001");
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Authentication
|
|
39
|
-
|
|
40
|
-
The model router automatically detects API keys from environment variables:
|
|
41
|
-
|
|
42
|
-
- **OpenAI**: `OPENAI_API_KEY`
|
|
43
|
-
- **Google**: `GOOGLE_GENERATIVE_AI_API_KEY`
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
# .env
|
|
47
|
-
OPENAI_API_KEY=sk-...
|
|
48
|
-
GOOGLE_GENERATIVE_AI_API_KEY=...
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Custom Providers
|
|
52
|
-
|
|
53
|
-
You can use any OpenAI-compatible embedding endpoint with a custom URL:
|
|
54
|
-
|
|
55
|
-
```typescript
|
|
56
|
-
import { ModelRouterEmbeddingModel } from "@mastra/core/llm";
|
|
57
|
-
|
|
58
|
-
const embedder = new ModelRouterEmbeddingModel({
|
|
59
|
-
providerId: "ollama",
|
|
60
|
-
modelId: "nomic-embed-text",
|
|
61
|
-
url: "http://localhost:11434/v1",
|
|
62
|
-
apiKey: "not-needed", // Some providers don't require API keys
|
|
63
|
-
});
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Usage with Memory
|
|
67
|
-
|
|
68
|
-
The embedding model router integrates seamlessly with Mastra's memory system:
|
|
69
|
-
|
|
70
|
-
```typescript
|
|
71
|
-
import { Memory } from "@mastra/memory";
|
|
72
|
-
import { Agent } from "@mastra/core/agent";
|
|
73
|
-
import { ModelRouterEmbeddingModel } from "@mastra/core/llm";
|
|
74
|
-
|
|
75
|
-
const agent = new Agent({
|
|
76
|
-
id: "my-agent",
|
|
77
|
-
name: "my-agent",
|
|
78
|
-
instructions: "You are a helpful assistant",
|
|
79
|
-
model: "openai/gpt-5.1",
|
|
80
|
-
memory: new Memory({
|
|
81
|
-
embedder: new ModelRouterEmbeddingModel("openai/text-embedding-3-small"),
|
|
82
|
-
}),
|
|
83
|
-
});
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
> **Info:** The `embedder` field accepts:
|
|
87
|
-
>
|
|
88
|
-
> - `EmbeddingModelId` (string with autocomplete)
|
|
89
|
-
> - `EmbeddingModel<string>` (AI SDK v1)
|
|
90
|
-
> - `EmbeddingModelV2<string>` (AI SDK v2)
|
|
91
|
-
|
|
92
|
-
## Usage with RAG
|
|
93
|
-
|
|
94
|
-
Use embedding models for document chunking and retrieval:
|
|
95
|
-
|
|
96
|
-
```typescript
|
|
97
|
-
import { ModelRouterEmbeddingModel } from "@mastra/core/llm";
|
|
98
|
-
import { embedMany } from "ai";
|
|
99
|
-
|
|
100
|
-
// Embed document chunks
|
|
101
|
-
const { embeddings } = await embedMany({
|
|
102
|
-
model: new ModelRouterEmbeddingModel("openai/text-embedding-3-small"),
|
|
103
|
-
values: chunks.map((chunk) => chunk.text),
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// Store embeddings in your vector database
|
|
107
|
-
await vectorStore.upsert(
|
|
108
|
-
chunks.map((chunk, i) => ({
|
|
109
|
-
id: chunk.id,
|
|
110
|
-
vector: embeddings[i],
|
|
111
|
-
metadata: chunk.metadata,
|
|
112
|
-
})),
|
|
113
|
-
);
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## TypeScript Support
|
|
117
|
-
|
|
118
|
-
The model router provides full TypeScript autocomplete for embedding model IDs:
|
|
119
|
-
|
|
120
|
-
```typescript
|
|
121
|
-
import type { EmbeddingModelId } from "@mastra/core";
|
|
122
|
-
|
|
123
|
-
// Type-safe embedding model selection
|
|
124
|
-
const modelId: EmbeddingModelId = "openai/text-embedding-3-small";
|
|
125
|
-
// ^ Autocomplete shows all supported models
|
|
126
|
-
|
|
127
|
-
const embedder = new ModelRouterEmbeddingModel(modelId);
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
## Error Handling
|
|
131
|
-
|
|
132
|
-
The model router validates provider and model IDs at construction time:
|
|
133
|
-
|
|
134
|
-
```typescript
|
|
135
|
-
try {
|
|
136
|
-
const embedder = new ModelRouterEmbeddingModel("invalid/model");
|
|
137
|
-
} catch (error) {
|
|
138
|
-
console.error(error.message);
|
|
139
|
-
// "Unknown provider: invalid. Available providers: openai, google"
|
|
140
|
-
}
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
Missing API keys are also caught early:
|
|
144
|
-
|
|
145
|
-
```typescript
|
|
146
|
-
try {
|
|
147
|
-
const embedder = new ModelRouterEmbeddingModel(
|
|
148
|
-
"openai/text-embedding-3-small",
|
|
149
|
-
);
|
|
150
|
-
// Throws if OPENAI_API_KEY is not set
|
|
151
|
-
} catch (error) {
|
|
152
|
-
console.error(error.message);
|
|
153
|
-
// "API key not found for provider openai. Set OPENAI_API_KEY environment variable."
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
## Next Steps
|
|
158
|
-
|
|
159
|
-
- [Memory & Semantic Recall](https://mastra.ai/docs/memory/semantic-recall) - Use embeddings for agent memory
|
|
160
|
-
- [RAG & Chunking](https://mastra.ai/docs/rag/chunking-and-embedding) - Build retrieval-augmented generation systems
|
|
161
|
-
- [Vector Databases](https://mastra.ai/docs/rag/vector-databases) - Store and query embeddings
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
# Azure OpenAI
|
|
2
|
-
|
|
3
|
-
Azure OpenAI provides enterprise-grade access to OpenAI models through dedicated deployments with security, compliance, and SLA guarantees.
|
|
4
|
-
|
|
5
|
-
Unlike other providers that have fixed model names, Azure uses **deployment names** that you configure in the Azure Portal.
|
|
6
|
-
|
|
7
|
-
## How Azure Deployments Work
|
|
8
|
-
|
|
9
|
-
Azure model IDs follow this pattern: `azure-openai/your-deployment-name`
|
|
10
|
-
|
|
11
|
-
The deployment name is **specific to your Azure account** and chosen when you create a deployment in Azure Portal. Common examples:
|
|
12
|
-
|
|
13
|
-
- `azure-openai/my-gpt4-deployment`
|
|
14
|
-
- `azure-openai/production-gpt-35-turbo`
|
|
15
|
-
- `azure-openai/staging-gpt-4o`
|
|
16
|
-
|
|
17
|
-
## Setup
|
|
18
|
-
|
|
19
|
-
Create deployments in [Azure OpenAI Studio](https://oai.azure.com/). The resource name and API key are in Azure Portal under "Keys and Endpoint".
|
|
20
|
-
|
|
21
|
-
## Configuration
|
|
22
|
-
|
|
23
|
-
Instantiate the gateway and pass it to Mastra. Three configuration modes are available.
|
|
24
|
-
|
|
25
|
-
### Static Deployments
|
|
26
|
-
|
|
27
|
-
Provide deployment names from Azure Portal.
|
|
28
|
-
|
|
29
|
-
```typescript
|
|
30
|
-
import { Mastra } from "@mastra/core";
|
|
31
|
-
import { AzureOpenAIGateway } from "@mastra/core/llm";
|
|
32
|
-
|
|
33
|
-
export const mastra = new Mastra({
|
|
34
|
-
gateways: [
|
|
35
|
-
new AzureOpenAIGateway({
|
|
36
|
-
resourceName: "my-openai-resource",
|
|
37
|
-
apiKey: process.env.AZURE_API_KEY!,
|
|
38
|
-
deployments: ["gpt-4-prod", "gpt-35-turbo-dev"],
|
|
39
|
-
}),
|
|
40
|
-
],
|
|
41
|
-
});
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Dynamic Discovery
|
|
45
|
-
|
|
46
|
-
Provide Management API credentials. The gateway queries Azure Management API to list deployments.
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
import { Mastra } from "@mastra/core";
|
|
50
|
-
import { AzureOpenAIGateway } from "@mastra/core/llm";
|
|
51
|
-
|
|
52
|
-
export const mastra = new Mastra({
|
|
53
|
-
gateways: [
|
|
54
|
-
new AzureOpenAIGateway({
|
|
55
|
-
resourceName: "my-openai-resource",
|
|
56
|
-
apiKey: process.env.AZURE_API_KEY!,
|
|
57
|
-
management: {
|
|
58
|
-
tenantId: process.env.AZURE_TENANT_ID!,
|
|
59
|
-
clientId: process.env.AZURE_CLIENT_ID!,
|
|
60
|
-
clientSecret: process.env.AZURE_CLIENT_SECRET!,
|
|
61
|
-
subscriptionId: process.env.AZURE_SUBSCRIPTION_ID!,
|
|
62
|
-
resourceGroup: "my-resource-group",
|
|
63
|
-
},
|
|
64
|
-
}),
|
|
65
|
-
],
|
|
66
|
-
});
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
The Service Principal requires "Cognitive Services User" role. See [Azure documentation](https://learn.microsoft.com/en-us/entra/identity-platform/howto-create-service-principal-portal).
|
|
70
|
-
|
|
71
|
-
### Manual Deployment Names
|
|
72
|
-
|
|
73
|
-
Provide resource name and API key only. Specify deployment names when creating agents. No IDE autocomplete.
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
import { Mastra } from "@mastra/core";
|
|
77
|
-
import { AzureOpenAIGateway } from "@mastra/core/llm";
|
|
78
|
-
|
|
79
|
-
export const mastra = new Mastra({
|
|
80
|
-
gateways: [
|
|
81
|
-
new AzureOpenAIGateway({
|
|
82
|
-
resourceName: "my-openai-resource",
|
|
83
|
-
apiKey: process.env.AZURE_API_KEY!,
|
|
84
|
-
}),
|
|
85
|
-
],
|
|
86
|
-
});
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Configuration Reference
|
|
90
|
-
|
|
91
|
-
| Option | Type | Required | Description |
|
|
92
|
-
| --------------------------- | ---------- | -------- | ------------------------------------------- |
|
|
93
|
-
| `resourceName` | `string` | Yes | Azure OpenAI resource name |
|
|
94
|
-
| `apiKey` | `string` | Yes | API key from "Keys and Endpoint" |
|
|
95
|
-
| `apiVersion` | `string` | No | API version (default: `2024-04-01-preview`) |
|
|
96
|
-
| `deployments` | `string[]` | No | Deployment names for static mode |
|
|
97
|
-
| `management` | `object` | No | Management API credentials |
|
|
98
|
-
| `management.tenantId` | `string` | Yes\* | Azure AD tenant ID |
|
|
99
|
-
| `management.clientId` | `string` | Yes\* | Service Principal client ID |
|
|
100
|
-
| `management.clientSecret` | `string` | Yes\* | Service Principal secret |
|
|
101
|
-
| `management.subscriptionId` | `string` | Yes\* | Azure subscription ID |
|
|
102
|
-
| `management.resourceGroup` | `string` | Yes\* | Resource group name |
|
|
103
|
-
|
|
104
|
-
\* Required if `management` is provided
|
|
105
|
-
|
|
106
|
-
## Usage
|
|
107
|
-
|
|
108
|
-
```typescript
|
|
109
|
-
import { Agent } from "@mastra/core/agent";
|
|
110
|
-
|
|
111
|
-
const agent = new Agent({
|
|
112
|
-
id: "my-agent",
|
|
113
|
-
name: "My Agent",
|
|
114
|
-
instructions: "You are a helpful assistant",
|
|
115
|
-
model: "azure-openai/my-gpt4-deployment" // Use your Azure deployment name (autocompleted in dev mode)
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
// Generate a response
|
|
119
|
-
const response = await agent.generate("Hello!");
|
|
120
|
-
|
|
121
|
-
// Stream a response
|
|
122
|
-
const stream = await agent.stream("Tell me a story");
|
|
123
|
-
for await (const chunk of stream) {
|
|
124
|
-
console.log(chunk);
|
|
125
|
-
}
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
Check [Azure OpenAI model availability](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models) for region-specific options.
|