@mastra/mcp-docs-server 1.1.5 → 1.1.6-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/.docs/docs/agents/adding-voice.md +349 -0
- package/.docs/docs/agents/agent-approval.md +558 -0
- package/.docs/docs/agents/agent-memory.md +209 -0
- package/.docs/docs/agents/guardrails.md +374 -0
- package/.docs/docs/agents/network-approval.md +275 -0
- package/.docs/docs/agents/networks.md +299 -0
- package/.docs/docs/agents/overview.md +304 -0
- package/.docs/docs/agents/processors.md +622 -0
- package/.docs/docs/agents/structured-output.md +273 -0
- package/.docs/docs/agents/supervisor-agents.md +304 -0
- package/.docs/docs/agents/using-tools.md +214 -0
- package/.docs/docs/build-with-ai/mcp-docs-server.md +238 -0
- package/.docs/docs/build-with-ai/skills.md +35 -0
- package/.docs/docs/community/contributing-templates.md +3 -0
- package/.docs/docs/community/discord.md +9 -0
- package/.docs/docs/community/licensing.md +66 -0
- package/.docs/docs/deployment/cloud-providers.md +15 -0
- package/.docs/docs/deployment/mastra-server.md +122 -0
- package/.docs/docs/deployment/monorepo.md +142 -0
- package/.docs/docs/deployment/overview.md +62 -0
- package/.docs/docs/deployment/studio.md +239 -0
- package/.docs/docs/deployment/web-framework.md +52 -0
- package/.docs/docs/deployment/workflow-runners.md +9 -0
- package/.docs/docs/evals/built-in-scorers.md +47 -0
- package/.docs/docs/evals/custom-scorers.md +519 -0
- package/.docs/docs/evals/overview.md +141 -0
- package/.docs/docs/evals/running-in-ci.md +124 -0
- package/.docs/docs/getting-started/build-with-ai.md +68 -0
- package/.docs/docs/getting-started/manual-install.md +226 -0
- package/.docs/docs/getting-started/project-structure.md +60 -0
- package/.docs/docs/getting-started/start.md +28 -0
- package/.docs/docs/getting-started/studio.md +101 -0
- package/.docs/docs/index.md +43 -0
- package/.docs/docs/mastra-cloud/deployment.md +77 -0
- package/.docs/docs/mastra-cloud/observability.md +38 -0
- package/.docs/docs/mastra-cloud/overview.md +23 -0
- package/.docs/docs/mastra-cloud/setup.md +42 -0
- package/.docs/docs/mastra-cloud/studio.md +24 -0
- package/.docs/docs/mastra-code/configuration.md +299 -0
- package/.docs/docs/mastra-code/customization.md +228 -0
- package/.docs/docs/mastra-code/modes.md +104 -0
- package/.docs/docs/mastra-code/overview.md +135 -0
- package/.docs/docs/mastra-code/tools.md +229 -0
- package/.docs/docs/mcp/overview.md +373 -0
- package/.docs/docs/mcp/publishing-mcp-server.md +95 -0
- package/.docs/docs/memory/memory-processors.md +314 -0
- package/.docs/docs/memory/message-history.md +260 -0
- package/.docs/docs/memory/observational-memory.md +248 -0
- package/.docs/docs/memory/overview.md +45 -0
- package/.docs/docs/memory/semantic-recall.md +272 -0
- package/.docs/docs/memory/storage.md +261 -0
- package/.docs/docs/memory/working-memory.md +400 -0
- package/.docs/docs/observability/datasets/overview.md +198 -0
- package/.docs/docs/observability/datasets/running-experiments.md +274 -0
- package/.docs/docs/observability/logging.md +99 -0
- package/.docs/docs/observability/overview.md +70 -0
- package/.docs/docs/observability/tracing/bridges/otel.md +209 -0
- package/.docs/docs/observability/tracing/exporters/arize.md +272 -0
- package/.docs/docs/observability/tracing/exporters/braintrust.md +111 -0
- package/.docs/docs/observability/tracing/exporters/cloud.md +127 -0
- package/.docs/docs/observability/tracing/exporters/datadog.md +187 -0
- package/.docs/docs/observability/tracing/exporters/default.md +209 -0
- package/.docs/docs/observability/tracing/exporters/laminar.md +100 -0
- package/.docs/docs/observability/tracing/exporters/langfuse.md +213 -0
- package/.docs/docs/observability/tracing/exporters/langsmith.md +198 -0
- package/.docs/docs/observability/tracing/exporters/otel.md +476 -0
- package/.docs/docs/observability/tracing/exporters/posthog.md +148 -0
- package/.docs/docs/observability/tracing/exporters/sentry.md +208 -0
- package/.docs/docs/observability/tracing/overview.md +1112 -0
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +300 -0
- package/.docs/docs/rag/chunking-and-embedding.md +183 -0
- package/.docs/docs/rag/graph-rag.md +215 -0
- package/.docs/docs/rag/overview.md +72 -0
- package/.docs/docs/rag/retrieval.md +515 -0
- package/.docs/docs/rag/vector-databases.md +645 -0
- package/.docs/docs/server/auth/auth0.md +220 -0
- package/.docs/docs/server/auth/better-auth.md +203 -0
- package/.docs/docs/server/auth/clerk.md +132 -0
- package/.docs/docs/server/auth/composite-auth.md +234 -0
- package/.docs/docs/server/auth/custom-auth-provider.md +513 -0
- package/.docs/docs/server/auth/firebase.md +272 -0
- package/.docs/docs/server/auth/jwt.md +110 -0
- package/.docs/docs/server/auth/simple-auth.md +180 -0
- package/.docs/docs/server/auth/supabase.md +117 -0
- package/.docs/docs/server/auth/workos.md +186 -0
- package/.docs/docs/server/auth.md +38 -0
- package/.docs/docs/server/custom-adapters.md +378 -0
- package/.docs/docs/server/custom-api-routes.md +267 -0
- package/.docs/docs/server/mastra-client.md +243 -0
- package/.docs/docs/server/mastra-server.md +71 -0
- package/.docs/docs/server/middleware.md +225 -0
- package/.docs/docs/server/request-context.md +471 -0
- package/.docs/docs/server/server-adapters.md +547 -0
- package/.docs/docs/streaming/events.md +237 -0
- package/.docs/docs/streaming/overview.md +175 -0
- package/.docs/docs/streaming/tool-streaming.md +175 -0
- package/.docs/docs/streaming/workflow-streaming.md +109 -0
- package/.docs/docs/voice/overview.md +959 -0
- package/.docs/docs/voice/speech-to-speech.md +102 -0
- package/.docs/docs/voice/speech-to-text.md +79 -0
- package/.docs/docs/voice/text-to-speech.md +83 -0
- package/.docs/docs/workflows/agents-and-tools.md +166 -0
- package/.docs/docs/workflows/control-flow.md +822 -0
- package/.docs/docs/workflows/error-handling.md +360 -0
- package/.docs/docs/workflows/human-in-the-loop.md +215 -0
- package/.docs/docs/workflows/overview.md +370 -0
- package/.docs/docs/workflows/snapshots.md +238 -0
- package/.docs/docs/workflows/suspend-and-resume.md +205 -0
- package/.docs/docs/workflows/time-travel.md +309 -0
- package/.docs/docs/workflows/workflow-state.md +181 -0
- package/.docs/docs/workspace/filesystem.md +164 -0
- package/.docs/docs/workspace/overview.md +239 -0
- package/.docs/docs/workspace/sandbox.md +63 -0
- package/.docs/docs/workspace/search.md +243 -0
- package/.docs/docs/workspace/skills.md +169 -0
- package/.docs/guides/agent-frameworks/ai-sdk.md +140 -0
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +1499 -0
- package/.docs/guides/build-your-ui/assistant-ui.md +156 -0
- package/.docs/guides/build-your-ui/copilotkit.md +289 -0
- package/.docs/guides/deployment/amazon-ec2.md +130 -0
- package/.docs/guides/deployment/aws-lambda.md +248 -0
- package/.docs/guides/deployment/azure-app-services.md +114 -0
- package/.docs/guides/deployment/cloudflare.md +99 -0
- package/.docs/guides/deployment/digital-ocean.md +168 -0
- package/.docs/guides/deployment/inngest.md +682 -0
- package/.docs/guides/deployment/netlify.md +77 -0
- package/.docs/guides/deployment/vercel.md +101 -0
- package/.docs/guides/getting-started/astro.md +398 -0
- package/.docs/guides/getting-started/electron.md +504 -0
- package/.docs/guides/getting-started/express.md +251 -0
- package/.docs/guides/getting-started/hono.md +190 -0
- package/.docs/guides/getting-started/next-js.md +347 -0
- package/.docs/guides/getting-started/nuxt.md +497 -0
- package/.docs/guides/getting-started/quickstart.md +67 -0
- package/.docs/guides/getting-started/sveltekit.md +296 -0
- package/.docs/guides/getting-started/vite-react.md +425 -0
- package/.docs/guides/guide/ai-recruiter.md +226 -0
- package/.docs/guides/guide/chef-michel.md +211 -0
- package/.docs/guides/guide/code-review-bot.md +226 -0
- package/.docs/guides/guide/dev-assistant.md +307 -0
- package/.docs/guides/guide/docs-manager.md +238 -0
- package/.docs/guides/guide/github-actions-pr-description.md +236 -0
- package/.docs/guides/guide/notes-mcp-server.md +416 -0
- package/.docs/guides/guide/research-assistant.md +348 -0
- package/.docs/guides/guide/research-coordinator.md +416 -0
- package/.docs/guides/guide/stock-agent.md +132 -0
- package/.docs/guides/guide/web-search.md +320 -0
- package/.docs/guides/guide/whatsapp-chat-bot.md +405 -0
- package/.docs/guides/index.md +3 -0
- package/.docs/guides/migrations/agentnetwork.md +97 -0
- package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +112 -0
- package/.docs/guides/migrations/network-to-supervisor.md +261 -0
- package/.docs/guides/migrations/upgrade-to-v1/agent.md +404 -0
- package/.docs/guides/migrations/upgrade-to-v1/cli.md +57 -0
- package/.docs/guides/migrations/upgrade-to-v1/client.md +337 -0
- package/.docs/guides/migrations/upgrade-to-v1/deployment.md +37 -0
- package/.docs/guides/migrations/upgrade-to-v1/evals.md +239 -0
- package/.docs/guides/migrations/upgrade-to-v1/mastra.md +143 -0
- package/.docs/guides/migrations/upgrade-to-v1/mcp.md +97 -0
- package/.docs/guides/migrations/upgrade-to-v1/memory.md +285 -0
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +119 -0
- package/.docs/guides/migrations/upgrade-to-v1/processors.md +68 -0
- package/.docs/guides/migrations/upgrade-to-v1/rag.md +42 -0
- package/.docs/guides/migrations/upgrade-to-v1/storage.md +553 -0
- package/.docs/guides/migrations/upgrade-to-v1/tools.md +180 -0
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +412 -0
- package/.docs/guides/migrations/upgrade-to-v1/vectors.md +87 -0
- package/.docs/guides/migrations/upgrade-to-v1/voice.md +30 -0
- package/.docs/guides/migrations/upgrade-to-v1/workflows.md +341 -0
- package/.docs/guides/migrations/vnext-to-standard-apis.md +362 -0
- package/.docs/models/embeddings.md +161 -0
- package/.docs/models/gateways/azure-openai.md +128 -0
- package/.docs/models/gateways/custom-gateways.md +545 -0
- package/.docs/models/gateways/netlify.md +88 -0
- package/.docs/models/gateways/openrouter.md +219 -0
- package/.docs/models/gateways/vercel.md +225 -0
- package/.docs/models/gateways.md +14 -0
- package/.docs/models/index.md +286 -0
- package/.docs/models/providers/302ai.md +134 -0
- package/.docs/models/providers/abacus.md +125 -0
- package/.docs/models/providers/agentrouter.md +90 -0
- package/.docs/models/providers/aihubmix.md +107 -0
- package/.docs/models/providers/alibaba-cn.md +135 -0
- package/.docs/models/providers/alibaba.md +111 -0
- package/.docs/models/providers/amazon-bedrock.md +33 -0
- package/.docs/models/providers/anthropic.md +153 -0
- package/.docs/models/providers/azure.md +33 -0
- package/.docs/models/providers/bailing.md +72 -0
- package/.docs/models/providers/baseten.md +77 -0
- package/.docs/models/providers/berget.md +78 -0
- package/.docs/models/providers/cerebras.md +101 -0
- package/.docs/models/providers/chutes.md +136 -0
- package/.docs/models/providers/cloudflare-ai-gateway.md +33 -0
- package/.docs/models/providers/cloudflare-workers-ai.md +109 -0
- package/.docs/models/providers/cohere.md +33 -0
- package/.docs/models/providers/cortecs.md +91 -0
- package/.docs/models/providers/deepinfra.md +112 -0
- package/.docs/models/providers/deepseek.md +88 -0
- package/.docs/models/providers/fastrouter.md +84 -0
- package/.docs/models/providers/fireworks-ai.md +89 -0
- package/.docs/models/providers/firmware.md +85 -0
- package/.docs/models/providers/friendli.md +78 -0
- package/.docs/models/providers/github-models.md +125 -0
- package/.docs/models/providers/google-vertex.md +33 -0
- package/.docs/models/providers/google.md +159 -0
- package/.docs/models/providers/groq.md +107 -0
- package/.docs/models/providers/helicone.md +161 -0
- package/.docs/models/providers/huggingface.md +90 -0
- package/.docs/models/providers/iflowcn.md +84 -0
- package/.docs/models/providers/inception.md +72 -0
- package/.docs/models/providers/inference.md +79 -0
- package/.docs/models/providers/io-intelligence.md +87 -0
- package/.docs/models/providers/io-net.md +87 -0
- package/.docs/models/providers/jiekou.md +131 -0
- package/.docs/models/providers/kilo.md +333 -0
- package/.docs/models/providers/kimi-for-coding.md +100 -0
- package/.docs/models/providers/kuae-cloud-coding-plan.md +71 -0
- package/.docs/models/providers/llama.md +77 -0
- package/.docs/models/providers/lmstudio.md +73 -0
- package/.docs/models/providers/lucidquery.md +72 -0
- package/.docs/models/providers/minimax-cn-coding-plan.md +102 -0
- package/.docs/models/providers/minimax-cn.md +102 -0
- package/.docs/models/providers/minimax-coding-plan.md +102 -0
- package/.docs/models/providers/minimax.md +104 -0
- package/.docs/models/providers/mistral.md +124 -0
- package/.docs/models/providers/moark.md +72 -0
- package/.docs/models/providers/modelscope.md +77 -0
- package/.docs/models/providers/moonshotai-cn.md +76 -0
- package/.docs/models/providers/moonshotai.md +76 -0
- package/.docs/models/providers/morph.md +73 -0
- package/.docs/models/providers/nano-gpt.md +103 -0
- package/.docs/models/providers/nebius.md +116 -0
- package/.docs/models/providers/nova.md +72 -0
- package/.docs/models/providers/novita-ai.md +154 -0
- package/.docs/models/providers/nvidia.md +141 -0
- package/.docs/models/providers/ollama-cloud.md +103 -0
- package/.docs/models/providers/ollama.md +33 -0
- package/.docs/models/providers/openai.md +193 -0
- package/.docs/models/providers/opencode.md +100 -0
- package/.docs/models/providers/ovhcloud.md +83 -0
- package/.docs/models/providers/perplexity.md +100 -0
- package/.docs/models/providers/poe.md +183 -0
- package/.docs/models/providers/privatemode-ai.md +75 -0
- package/.docs/models/providers/requesty.md +90 -0
- package/.docs/models/providers/scaleway.md +84 -0
- package/.docs/models/providers/siliconflow-cn.md +138 -0
- package/.docs/models/providers/siliconflow.md +140 -0
- package/.docs/models/providers/stackit.md +78 -0
- package/.docs/models/providers/stepfun.md +73 -0
- package/.docs/models/providers/submodel.md +79 -0
- package/.docs/models/providers/synthetic.md +96 -0
- package/.docs/models/providers/togetherai.md +115 -0
- package/.docs/models/providers/upstage.md +73 -0
- package/.docs/models/providers/venice.md +95 -0
- package/.docs/models/providers/vivgrid.md +106 -0
- package/.docs/models/providers/vultr.md +75 -0
- package/.docs/models/providers/wandb.md +80 -0
- package/.docs/models/providers/xai.md +141 -0
- package/.docs/models/providers/xiaomi.md +71 -0
- package/.docs/models/providers/zai-coding-plan.md +80 -0
- package/.docs/models/providers/zai.md +79 -0
- package/.docs/models/providers/zenmux.md +161 -0
- package/.docs/models/providers/zhipuai-coding-plan.md +79 -0
- package/.docs/models/providers/zhipuai.md +79 -0
- package/.docs/models/providers.md +81 -0
- package/.docs/reference/agents/agent.md +141 -0
- package/.docs/reference/agents/generate.md +186 -0
- package/.docs/reference/agents/generateLegacy.md +173 -0
- package/.docs/reference/agents/getDefaultGenerateOptions.md +36 -0
- package/.docs/reference/agents/getDefaultOptions.md +34 -0
- package/.docs/reference/agents/getDefaultStreamOptions.md +36 -0
- package/.docs/reference/agents/getDescription.md +21 -0
- package/.docs/reference/agents/getInstructions.md +34 -0
- package/.docs/reference/agents/getLLM.md +37 -0
- package/.docs/reference/agents/getMemory.md +34 -0
- package/.docs/reference/agents/getModel.md +34 -0
- package/.docs/reference/agents/getTools.md +29 -0
- package/.docs/reference/agents/getVoice.md +34 -0
- package/.docs/reference/agents/listAgents.md +35 -0
- package/.docs/reference/agents/listScorers.md +34 -0
- package/.docs/reference/agents/listTools.md +34 -0
- package/.docs/reference/agents/listWorkflows.md +34 -0
- package/.docs/reference/agents/network.md +133 -0
- package/.docs/reference/ai-sdk/chat-route.md +82 -0
- package/.docs/reference/ai-sdk/handle-chat-stream.md +53 -0
- package/.docs/reference/ai-sdk/handle-network-stream.md +37 -0
- package/.docs/reference/ai-sdk/handle-workflow-stream.md +55 -0
- package/.docs/reference/ai-sdk/network-route.md +74 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +231 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +79 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +76 -0
- package/.docs/reference/ai-sdk/with-mastra.md +59 -0
- package/.docs/reference/ai-sdk/workflow-route.md +79 -0
- package/.docs/reference/auth/auth0.md +73 -0
- package/.docs/reference/auth/better-auth.md +71 -0
- package/.docs/reference/auth/clerk.md +36 -0
- package/.docs/reference/auth/firebase.md +80 -0
- package/.docs/reference/auth/jwt.md +26 -0
- package/.docs/reference/auth/supabase.md +33 -0
- package/.docs/reference/auth/workos.md +84 -0
- package/.docs/reference/cli/create-mastra.md +137 -0
- package/.docs/reference/cli/mastra.md +336 -0
- package/.docs/reference/client-js/agents.md +437 -0
- package/.docs/reference/client-js/error-handling.md +16 -0
- package/.docs/reference/client-js/logs.md +24 -0
- package/.docs/reference/client-js/mastra-client.md +63 -0
- package/.docs/reference/client-js/memory.md +221 -0
- package/.docs/reference/client-js/observability.md +72 -0
- package/.docs/reference/client-js/telemetry.md +20 -0
- package/.docs/reference/client-js/tools.md +44 -0
- package/.docs/reference/client-js/vectors.md +79 -0
- package/.docs/reference/client-js/workflows.md +199 -0
- package/.docs/reference/configuration.md +752 -0
- package/.docs/reference/core/addGateway.md +42 -0
- package/.docs/reference/core/getAgent.md +21 -0
- package/.docs/reference/core/getAgentById.md +21 -0
- package/.docs/reference/core/getDeployer.md +22 -0
- package/.docs/reference/core/getGateway.md +38 -0
- package/.docs/reference/core/getGatewayById.md +41 -0
- package/.docs/reference/core/getLogger.md +22 -0
- package/.docs/reference/core/getMCPServer.md +47 -0
- package/.docs/reference/core/getMCPServerById.md +55 -0
- package/.docs/reference/core/getMemory.md +50 -0
- package/.docs/reference/core/getScorer.md +54 -0
- package/.docs/reference/core/getScorerById.md +54 -0
- package/.docs/reference/core/getServer.md +22 -0
- package/.docs/reference/core/getStorage.md +22 -0
- package/.docs/reference/core/getStoredAgentById.md +89 -0
- package/.docs/reference/core/getTelemetry.md +22 -0
- package/.docs/reference/core/getVector.md +22 -0
- package/.docs/reference/core/getWorkflow.md +42 -0
- package/.docs/reference/core/listAgents.md +21 -0
- package/.docs/reference/core/listGateways.md +40 -0
- package/.docs/reference/core/listLogs.md +38 -0
- package/.docs/reference/core/listLogsByRunId.md +36 -0
- package/.docs/reference/core/listMCPServers.md +55 -0
- package/.docs/reference/core/listMemory.md +56 -0
- package/.docs/reference/core/listScorers.md +29 -0
- package/.docs/reference/core/listStoredAgents.md +93 -0
- package/.docs/reference/core/listVectors.md +22 -0
- package/.docs/reference/core/listWorkflows.md +21 -0
- package/.docs/reference/core/mastra-class.md +66 -0
- package/.docs/reference/core/mastra-model-gateway.md +153 -0
- package/.docs/reference/core/setLogger.md +26 -0
- package/.docs/reference/core/setStorage.md +27 -0
- package/.docs/reference/datasets/addItem.md +37 -0
- package/.docs/reference/datasets/addItems.md +35 -0
- package/.docs/reference/datasets/compareExperiments.md +52 -0
- package/.docs/reference/datasets/create.md +51 -0
- package/.docs/reference/datasets/dataset.md +82 -0
- package/.docs/reference/datasets/datasets-manager.md +94 -0
- package/.docs/reference/datasets/delete.md +25 -0
- package/.docs/reference/datasets/deleteExperiment.md +27 -0
- package/.docs/reference/datasets/deleteItem.md +27 -0
- package/.docs/reference/datasets/deleteItems.md +29 -0
- package/.docs/reference/datasets/get.md +31 -0
- package/.docs/reference/datasets/getDetails.md +47 -0
- package/.docs/reference/datasets/getExperiment.md +30 -0
- package/.docs/reference/datasets/getItem.md +33 -0
- package/.docs/reference/datasets/getItemHistory.md +31 -0
- package/.docs/reference/datasets/list.md +31 -0
- package/.docs/reference/datasets/listExperimentResults.md +39 -0
- package/.docs/reference/datasets/listExperiments.md +33 -0
- package/.docs/reference/datasets/listItems.md +46 -0
- package/.docs/reference/datasets/listVersions.md +33 -0
- package/.docs/reference/datasets/startExperiment.md +62 -0
- package/.docs/reference/datasets/startExperimentAsync.md +43 -0
- package/.docs/reference/datasets/update.md +48 -0
- package/.docs/reference/datasets/updateItem.md +38 -0
- package/.docs/reference/deployer/cloudflare.md +79 -0
- package/.docs/reference/deployer/netlify.md +80 -0
- package/.docs/reference/deployer/vercel.md +91 -0
- package/.docs/reference/deployer.md +100 -0
- package/.docs/reference/evals/answer-relevancy.md +105 -0
- package/.docs/reference/evals/answer-similarity.md +99 -0
- package/.docs/reference/evals/bias.md +120 -0
- package/.docs/reference/evals/completeness.md +136 -0
- package/.docs/reference/evals/content-similarity.md +101 -0
- package/.docs/reference/evals/context-precision.md +196 -0
- package/.docs/reference/evals/context-relevance.md +531 -0
- package/.docs/reference/evals/create-scorer.md +270 -0
- package/.docs/reference/evals/faithfulness.md +114 -0
- package/.docs/reference/evals/hallucination.md +213 -0
- package/.docs/reference/evals/keyword-coverage.md +128 -0
- package/.docs/reference/evals/mastra-scorer.md +123 -0
- package/.docs/reference/evals/noise-sensitivity.md +675 -0
- package/.docs/reference/evals/prompt-alignment.md +614 -0
- package/.docs/reference/evals/run-evals.md +179 -0
- package/.docs/reference/evals/scorer-utils.md +326 -0
- package/.docs/reference/evals/textual-difference.md +113 -0
- package/.docs/reference/evals/tone-consistency.md +119 -0
- package/.docs/reference/evals/tool-call-accuracy.md +533 -0
- package/.docs/reference/evals/toxicity.md +123 -0
- package/.docs/reference/harness/harness-class.md +708 -0
- package/.docs/reference/index.md +277 -0
- package/.docs/reference/logging/pino-logger.md +117 -0
- package/.docs/reference/mastra-code/createMastraCode.md +108 -0
- package/.docs/reference/memory/clone-utilities.md +199 -0
- package/.docs/reference/memory/cloneThread.md +130 -0
- package/.docs/reference/memory/createThread.md +68 -0
- package/.docs/reference/memory/deleteMessages.md +38 -0
- package/.docs/reference/memory/getThreadById.md +24 -0
- package/.docs/reference/memory/listThreads.md +145 -0
- package/.docs/reference/memory/memory-class.md +147 -0
- package/.docs/reference/memory/observational-memory.md +565 -0
- package/.docs/reference/memory/recall.md +91 -0
- package/.docs/reference/observability/tracing/bridges/otel.md +131 -0
- package/.docs/reference/observability/tracing/configuration.md +178 -0
- package/.docs/reference/observability/tracing/exporters/arize.md +141 -0
- package/.docs/reference/observability/tracing/exporters/braintrust.md +93 -0
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +163 -0
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +138 -0
- package/.docs/reference/observability/tracing/exporters/datadog.md +116 -0
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +174 -0
- package/.docs/reference/observability/tracing/exporters/laminar.md +78 -0
- package/.docs/reference/observability/tracing/exporters/langfuse.md +134 -0
- package/.docs/reference/observability/tracing/exporters/langsmith.md +108 -0
- package/.docs/reference/observability/tracing/exporters/otel.md +199 -0
- package/.docs/reference/observability/tracing/exporters/posthog.md +92 -0
- package/.docs/reference/observability/tracing/exporters/sentry.md +184 -0
- package/.docs/reference/observability/tracing/instances.md +107 -0
- package/.docs/reference/observability/tracing/interfaces.md +743 -0
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +144 -0
- package/.docs/reference/observability/tracing/spans.md +224 -0
- package/.docs/reference/processors/batch-parts-processor.md +61 -0
- package/.docs/reference/processors/language-detector.md +82 -0
- package/.docs/reference/processors/message-history-processor.md +85 -0
- package/.docs/reference/processors/moderation-processor.md +104 -0
- package/.docs/reference/processors/pii-detector.md +108 -0
- package/.docs/reference/processors/processor-interface.md +521 -0
- package/.docs/reference/processors/prompt-injection-detector.md +72 -0
- package/.docs/reference/processors/semantic-recall-processor.md +117 -0
- package/.docs/reference/processors/system-prompt-scrubber.md +80 -0
- package/.docs/reference/processors/token-limiter-processor.md +115 -0
- package/.docs/reference/processors/tool-call-filter.md +85 -0
- package/.docs/reference/processors/tool-search-processor.md +111 -0
- package/.docs/reference/processors/unicode-normalizer.md +62 -0
- package/.docs/reference/processors/working-memory-processor.md +152 -0
- package/.docs/reference/rag/chunk.md +221 -0
- package/.docs/reference/rag/database-config.md +261 -0
- package/.docs/reference/rag/document.md +114 -0
- package/.docs/reference/rag/embeddings.md +92 -0
- package/.docs/reference/rag/extract-params.md +168 -0
- package/.docs/reference/rag/graph-rag.md +111 -0
- package/.docs/reference/rag/metadata-filters.md +216 -0
- package/.docs/reference/rag/rerank.md +75 -0
- package/.docs/reference/rag/rerankWithScorer.md +80 -0
- package/.docs/reference/server/create-route.md +262 -0
- package/.docs/reference/server/express-adapter.md +176 -0
- package/.docs/reference/server/fastify-adapter.md +90 -0
- package/.docs/reference/server/hono-adapter.md +162 -0
- package/.docs/reference/server/koa-adapter.md +127 -0
- package/.docs/reference/server/mastra-server.md +298 -0
- package/.docs/reference/server/register-api-route.md +249 -0
- package/.docs/reference/server/routes.md +306 -0
- package/.docs/reference/storage/cloudflare-d1.md +218 -0
- package/.docs/reference/storage/cloudflare.md +88 -0
- package/.docs/reference/storage/composite.md +235 -0
- package/.docs/reference/storage/convex.md +161 -0
- package/.docs/reference/storage/dynamodb.md +282 -0
- package/.docs/reference/storage/lance.md +131 -0
- package/.docs/reference/storage/libsql.md +135 -0
- package/.docs/reference/storage/mongodb.md +262 -0
- package/.docs/reference/storage/mssql.md +157 -0
- package/.docs/reference/storage/overview.md +121 -0
- package/.docs/reference/storage/postgresql.md +526 -0
- package/.docs/reference/storage/upstash.md +160 -0
- package/.docs/reference/streaming/ChunkType.md +292 -0
- package/.docs/reference/streaming/agents/MastraModelOutput.md +182 -0
- package/.docs/reference/streaming/agents/stream.md +221 -0
- package/.docs/reference/streaming/agents/streamLegacy.md +142 -0
- package/.docs/reference/streaming/workflows/observeStream.md +42 -0
- package/.docs/reference/streaming/workflows/resumeStream.md +61 -0
- package/.docs/reference/streaming/workflows/stream.md +88 -0
- package/.docs/reference/streaming/workflows/timeTravelStream.md +142 -0
- package/.docs/reference/templates/overview.md +194 -0
- package/.docs/reference/tools/create-tool.md +237 -0
- package/.docs/reference/tools/document-chunker-tool.md +89 -0
- package/.docs/reference/tools/graph-rag-tool.md +182 -0
- package/.docs/reference/tools/mcp-client.md +954 -0
- package/.docs/reference/tools/mcp-server.md +1271 -0
- package/.docs/reference/tools/vector-query-tool.md +459 -0
- package/.docs/reference/vectors/astra.md +121 -0
- package/.docs/reference/vectors/chroma.md +264 -0
- package/.docs/reference/vectors/convex.md +300 -0
- package/.docs/reference/vectors/couchbase.md +226 -0
- package/.docs/reference/vectors/duckdb.md +318 -0
- package/.docs/reference/vectors/elasticsearch.md +189 -0
- package/.docs/reference/vectors/lance.md +220 -0
- package/.docs/reference/vectors/libsql.md +305 -0
- package/.docs/reference/vectors/mongodb.md +295 -0
- package/.docs/reference/vectors/opensearch.md +99 -0
- package/.docs/reference/vectors/pg.md +408 -0
- package/.docs/reference/vectors/pinecone.md +168 -0
- package/.docs/reference/vectors/qdrant.md +222 -0
- package/.docs/reference/vectors/s3vectors.md +277 -0
- package/.docs/reference/vectors/turbopuffer.md +157 -0
- package/.docs/reference/vectors/upstash.md +294 -0
- package/.docs/reference/vectors/vectorize.md +147 -0
- package/.docs/reference/voice/azure.md +148 -0
- package/.docs/reference/voice/cloudflare.md +83 -0
- package/.docs/reference/voice/composite-voice.md +121 -0
- package/.docs/reference/voice/deepgram.md +79 -0
- package/.docs/reference/voice/elevenlabs.md +98 -0
- package/.docs/reference/voice/google-gemini-live.md +378 -0
- package/.docs/reference/voice/google.md +228 -0
- package/.docs/reference/voice/mastra-voice.md +311 -0
- package/.docs/reference/voice/murf.md +122 -0
- package/.docs/reference/voice/openai-realtime.md +203 -0
- package/.docs/reference/voice/openai.md +88 -0
- package/.docs/reference/voice/playai.md +80 -0
- package/.docs/reference/voice/sarvam.md +126 -0
- package/.docs/reference/voice/speechify.md +75 -0
- package/.docs/reference/voice/voice.addInstructions.md +55 -0
- package/.docs/reference/voice/voice.addTools.md +67 -0
- package/.docs/reference/voice/voice.answer.md +54 -0
- package/.docs/reference/voice/voice.close.md +51 -0
- package/.docs/reference/voice/voice.connect.md +94 -0
- package/.docs/reference/voice/voice.events.md +37 -0
- package/.docs/reference/voice/voice.getSpeakers.md +129 -0
- package/.docs/reference/voice/voice.listen.md +164 -0
- package/.docs/reference/voice/voice.off.md +54 -0
- package/.docs/reference/voice/voice.on.md +111 -0
- package/.docs/reference/voice/voice.send.md +65 -0
- package/.docs/reference/voice/voice.speak.md +157 -0
- package/.docs/reference/voice/voice.updateConfig.md +60 -0
- package/.docs/reference/workflows/run-methods/cancel.md +86 -0
- package/.docs/reference/workflows/run-methods/restart.md +33 -0
- package/.docs/reference/workflows/run-methods/resume.md +59 -0
- package/.docs/reference/workflows/run-methods/start.md +58 -0
- package/.docs/reference/workflows/run-methods/startAsync.md +67 -0
- package/.docs/reference/workflows/run-methods/timeTravel.md +142 -0
- package/.docs/reference/workflows/run.md +59 -0
- package/.docs/reference/workflows/step.md +119 -0
- package/.docs/reference/workflows/workflow-methods/branch.md +25 -0
- package/.docs/reference/workflows/workflow-methods/commit.md +17 -0
- package/.docs/reference/workflows/workflow-methods/create-run.md +63 -0
- package/.docs/reference/workflows/workflow-methods/dountil.md +25 -0
- package/.docs/reference/workflows/workflow-methods/dowhile.md +25 -0
- package/.docs/reference/workflows/workflow-methods/foreach.md +118 -0
- package/.docs/reference/workflows/workflow-methods/map.md +93 -0
- package/.docs/reference/workflows/workflow-methods/parallel.md +21 -0
- package/.docs/reference/workflows/workflow-methods/sleep.md +35 -0
- package/.docs/reference/workflows/workflow-methods/sleepUntil.md +35 -0
- package/.docs/reference/workflows/workflow-methods/then.md +21 -0
- package/.docs/reference/workflows/workflow.md +157 -0
- package/.docs/reference/workspace/e2b-sandbox.md +289 -0
- package/.docs/reference/workspace/filesystem.md +255 -0
- package/.docs/reference/workspace/gcs-filesystem.md +174 -0
- package/.docs/reference/workspace/local-filesystem.md +343 -0
- package/.docs/reference/workspace/local-sandbox.md +301 -0
- package/.docs/reference/workspace/s3-filesystem.md +175 -0
- package/.docs/reference/workspace/sandbox.md +87 -0
- package/.docs/reference/workspace/workspace-class.md +244 -0
- package/CHANGELOG.md +8 -0
- package/package.json +5 -5
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# voice.on()
|
|
2
|
+
|
|
3
|
+
The `on()` method registers event listeners for various voice events. This is particularly important for real-time voice providers, where events are used to communicate transcribed text, audio responses, and other state changes.
|
|
4
|
+
|
|
5
|
+
## Usage Example
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { OpenAIRealtimeVoice } from '@mastra/voice-openai-realtime'
|
|
9
|
+
import Speaker from '@mastra/node-speaker'
|
|
10
|
+
import chalk from 'chalk'
|
|
11
|
+
|
|
12
|
+
// Initialize a real-time voice provider
|
|
13
|
+
const voice = new OpenAIRealtimeVoice({
|
|
14
|
+
realtimeConfig: {
|
|
15
|
+
model: 'gpt-5.1-realtime',
|
|
16
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
// Connect to the real-time service
|
|
21
|
+
await voice.connect()
|
|
22
|
+
|
|
23
|
+
// Register event listener for transcribed text
|
|
24
|
+
voice.on('writing', event => {
|
|
25
|
+
if (event.role === 'user') {
|
|
26
|
+
process.stdout.write(chalk.green(event.text))
|
|
27
|
+
} else {
|
|
28
|
+
process.stdout.write(chalk.blue(event.text))
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// Listen for audio data and play it
|
|
33
|
+
const speaker = new Speaker({
|
|
34
|
+
sampleRate: 24100,
|
|
35
|
+
channels: 1,
|
|
36
|
+
bitDepth: 16,
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
voice.on('speaker', stream => {
|
|
40
|
+
stream.pipe(speaker)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
// Register event listener for errors
|
|
44
|
+
voice.on('error', ({ message, code, details }) => {
|
|
45
|
+
console.error(`Error ${code}: ${message}`, details)
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Parameters
|
|
50
|
+
|
|
51
|
+
**event:** (`string`): Name of the event to listen for. See the \[Voice Events]\(./voice.events) documentation for a list of available events.
|
|
52
|
+
|
|
53
|
+
**callback:** (`function`): Callback function that will be called when the event occurs. The callback signature depends on the specific event.
|
|
54
|
+
|
|
55
|
+
## Return Value
|
|
56
|
+
|
|
57
|
+
This method does not return a value.
|
|
58
|
+
|
|
59
|
+
## Events
|
|
60
|
+
|
|
61
|
+
For a comprehensive list of events and their payload structures, see the [Voice Events](https://mastra.ai/reference/voice/voice.events) documentation.
|
|
62
|
+
|
|
63
|
+
Common events include:
|
|
64
|
+
|
|
65
|
+
- `speaking`: Emitted when audio data is available
|
|
66
|
+
- `speaker`: Emitted with a stream that can be piped to audio output
|
|
67
|
+
- `writing`: Emitted when text is transcribed or generated
|
|
68
|
+
- `error`: Emitted when an error occurs
|
|
69
|
+
- `tool-call-start`: Emitted when a tool is about to be executed
|
|
70
|
+
- `tool-call-result`: Emitted when a tool execution is complete
|
|
71
|
+
|
|
72
|
+
Different voice providers may support different sets of events with varying payload structures.
|
|
73
|
+
|
|
74
|
+
## Using with CompositeVoice
|
|
75
|
+
|
|
76
|
+
When using `CompositeVoice`, the `on()` method delegates to the configured real-time provider:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { CompositeVoice } from '@mastra/core/voice'
|
|
80
|
+
import { OpenAIRealtimeVoice } from '@mastra/voice-openai-realtime'
|
|
81
|
+
import Speaker from '@mastra/node-speaker'
|
|
82
|
+
|
|
83
|
+
const speaker = new Speaker({
|
|
84
|
+
sampleRate: 24100, // Audio sample rate in Hz - standard for high-quality audio on MacBook Pro
|
|
85
|
+
channels: 1, // Mono audio output (as opposed to stereo which would be 2)
|
|
86
|
+
bitDepth: 16, // Bit depth for audio quality - CD quality standard (16-bit resolution)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
const realtimeVoice = new OpenAIRealtimeVoice()
|
|
90
|
+
const voice = new CompositeVoice({
|
|
91
|
+
realtime: realtimeVoice,
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
// Connect to the real-time service
|
|
95
|
+
await voice.connect()
|
|
96
|
+
|
|
97
|
+
// This will register the event listener with the OpenAIRealtimeVoice provider
|
|
98
|
+
voice.on('speaker', stream => {
|
|
99
|
+
stream.pipe(speaker)
|
|
100
|
+
})
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Notes
|
|
104
|
+
|
|
105
|
+
- This method is primarily used with real-time voice providers that support event-based communication
|
|
106
|
+
- If called on a voice provider that doesn't support events, it will log a warning and do nothing
|
|
107
|
+
- Event listeners should be registered before calling methods that might emit events
|
|
108
|
+
- To remove an event listener, use the [voice.off()](https://mastra.ai/reference/voice/voice.off) method with the same event name and callback function
|
|
109
|
+
- Multiple listeners can be registered for the same event
|
|
110
|
+
- The callback function will receive different data depending on the event type (see [Voice Events](https://mastra.ai/reference/voice/voice.events))
|
|
111
|
+
- For best performance, consider removing event listeners when they are no longer needed
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# voice.send()
|
|
2
|
+
|
|
3
|
+
The `send()` method streams audio data in real-time to voice providers for continuous processing. This method is essential for real-time speech-to-speech conversations, allowing you to send microphone input directly to the AI service.
|
|
4
|
+
|
|
5
|
+
## Usage Example
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { OpenAIRealtimeVoice } from '@mastra/voice-openai-realtime'
|
|
9
|
+
import Speaker from '@mastra/node-speaker'
|
|
10
|
+
import { getMicrophoneStream } from '@mastra/node-audio'
|
|
11
|
+
|
|
12
|
+
const speaker = new Speaker({
|
|
13
|
+
sampleRate: 24100, // Audio sample rate in Hz - standard for high-quality audio on MacBook Pro
|
|
14
|
+
channels: 1, // Mono audio output (as opposed to stereo which would be 2)
|
|
15
|
+
bitDepth: 16, // Bit depth for audio quality - CD quality standard (16-bit resolution)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
// Initialize a real-time voice provider
|
|
19
|
+
const voice = new OpenAIRealtimeVoice({
|
|
20
|
+
realtimeConfig: {
|
|
21
|
+
model: 'gpt-5.1-realtime',
|
|
22
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
// Connect to the real-time service
|
|
27
|
+
await voice.connect()
|
|
28
|
+
|
|
29
|
+
// Set up event listeners for responses
|
|
30
|
+
voice.on('writing', ({ text, role }) => {
|
|
31
|
+
console.log(`${role}: ${text}`)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
voice.on('speaker', stream => {
|
|
35
|
+
stream.pipe(speaker)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
// Get microphone stream (implementation depends on your environment)
|
|
39
|
+
const microphoneStream = getMicrophoneStream()
|
|
40
|
+
|
|
41
|
+
// Send audio data to the voice provider
|
|
42
|
+
await voice.send(microphoneStream)
|
|
43
|
+
|
|
44
|
+
// You can also send audio data as Int16Array
|
|
45
|
+
const audioBuffer = getAudioBuffer() // Assume this returns Int16Array
|
|
46
|
+
await voice.send(audioBuffer)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Parameters
|
|
50
|
+
|
|
51
|
+
**audioData:** (`NodeJS.ReadableStream | Int16Array`): Audio data to send to the voice provider. Can be a readable stream (like a microphone stream) or an Int16Array of audio samples.
|
|
52
|
+
|
|
53
|
+
## Return Value
|
|
54
|
+
|
|
55
|
+
Returns a `Promise<void>` that resolves when the audio data has been accepted by the voice provider.
|
|
56
|
+
|
|
57
|
+
## Notes
|
|
58
|
+
|
|
59
|
+
- This method is only implemented by real-time voice providers that support speech-to-speech capabilities
|
|
60
|
+
- If called on a voice provider that doesn't support this functionality, it will log a warning and resolve immediately
|
|
61
|
+
- You must call `connect()` before using `send()` to establish the WebSocket connection
|
|
62
|
+
- The audio format requirements depend on the specific voice provider
|
|
63
|
+
- For continuous conversation, you typically call `send()` to transmit user audio, then `answer()` to trigger the AI response
|
|
64
|
+
- The provider will typically emit 'writing' events with transcribed text as it processes the audio
|
|
65
|
+
- When the AI responds, the provider will emit 'speaking' events with the audio response
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# voice.speak()
|
|
2
|
+
|
|
3
|
+
The `speak()` method is a core function available in all Mastra voice providers that converts text to speech. It takes text input and returns an audio stream that can be played or saved.
|
|
4
|
+
|
|
5
|
+
## Parameters
|
|
6
|
+
|
|
7
|
+
**input:** (`string | NodeJS.ReadableStream`): Text to convert to speech. Can be a string or a readable stream of text.
|
|
8
|
+
|
|
9
|
+
**options?:** (`object`): Options for speech synthesis
|
|
10
|
+
|
|
11
|
+
**options.speaker?:** (`string`): Voice ID to use for this specific request. Overrides the default speaker set in the constructor.
|
|
12
|
+
|
|
13
|
+
## Return Value
|
|
14
|
+
|
|
15
|
+
Returns a `Promise<NodeJS.ReadableStream | void>` where:
|
|
16
|
+
|
|
17
|
+
- `NodeJS.ReadableStream`: A stream of audio data that can be played or saved
|
|
18
|
+
- `void`: When using a realtime voice provider that emits audio through events instead of returning it directly
|
|
19
|
+
|
|
20
|
+
## Provider-Specific Options
|
|
21
|
+
|
|
22
|
+
Each voice provider may support additional options specific to their implementation. Here are some examples:
|
|
23
|
+
|
|
24
|
+
### OpenAI
|
|
25
|
+
|
|
26
|
+
**options.speed?:** (`number`): Speech speed multiplier. Values between 0.25 and 4.0 are supported. (Default: `1.0`)
|
|
27
|
+
|
|
28
|
+
### ElevenLabs
|
|
29
|
+
|
|
30
|
+
**options.stability?:** (`number`): Voice stability. Higher values result in more stable, less expressive speech. (Default: `0.5`)
|
|
31
|
+
|
|
32
|
+
**options.similarity\_boost?:** (`number`): Voice clarity and similarity to the original voice. (Default: `0.75`)
|
|
33
|
+
|
|
34
|
+
### Google
|
|
35
|
+
|
|
36
|
+
**options.languageCode?:** (`string`): Language code for the voice (e.g., 'en-US').
|
|
37
|
+
|
|
38
|
+
**options.audioConfig?:** (`object`): Audio configuration options from Google Cloud Text-to-Speech API. (Default: `{ audioEncoding: 'LINEAR16' }`)
|
|
39
|
+
|
|
40
|
+
### Murf
|
|
41
|
+
|
|
42
|
+
**options.properties.rate?:** (`number`): Speech rate multiplier.
|
|
43
|
+
|
|
44
|
+
**options.properties.pitch?:** (`number`): Voice pitch adjustment.
|
|
45
|
+
|
|
46
|
+
**options.properties.format?:** (`'MP3' | 'WAV' | 'FLAC' | 'ALAW' | 'ULAW'`): Output audio format.
|
|
47
|
+
|
|
48
|
+
## Usage Example
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { OpenAIVoice } from '@mastra/voice-openai'
|
|
52
|
+
// Initialize a voice provider
|
|
53
|
+
const voice = new OpenAIVoice({
|
|
54
|
+
speaker: 'alloy', // Default voice
|
|
55
|
+
})
|
|
56
|
+
// Basic usage with default settings
|
|
57
|
+
const audioStream = await voice.speak('Hello, world!')
|
|
58
|
+
// Using a different voice for this specific request
|
|
59
|
+
const audioStreamWithDifferentVoice = await voice.speak('Hello again!', {
|
|
60
|
+
speaker: 'nova',
|
|
61
|
+
})
|
|
62
|
+
// Using provider-specific options
|
|
63
|
+
const audioStreamWithOptions = await voice.speak('Hello with options!', {
|
|
64
|
+
speaker: 'echo',
|
|
65
|
+
speed: 1.2, // OpenAI-specific option
|
|
66
|
+
})
|
|
67
|
+
// Using a text stream as input
|
|
68
|
+
import { Readable } from 'stream'
|
|
69
|
+
const textStream = Readable.from(['Hello', ' from', ' a', ' stream!'])
|
|
70
|
+
const audioStreamFromTextStream = await voice.speak(textStream)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Using with CompositeVoice
|
|
74
|
+
|
|
75
|
+
When using `CompositeVoice`, the `speak()` method delegates to the configured speaking provider:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { CompositeVoice } from '@mastra/core/voice'
|
|
79
|
+
import { OpenAIVoice } from '@mastra/voice-openai'
|
|
80
|
+
import { PlayAIVoice } from '@mastra/voice-playai'
|
|
81
|
+
|
|
82
|
+
const voice = new CompositeVoice({
|
|
83
|
+
output: new PlayAIVoice(),
|
|
84
|
+
input: new OpenAIVoice(),
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
// This will use the PlayAIVoice provider
|
|
88
|
+
const audioStream = await voice.speak('Hello, world!')
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Using AI SDK Model Providers
|
|
92
|
+
|
|
93
|
+
You can also use AI SDK speech models directly with `CompositeVoice`:
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { CompositeVoice } from '@mastra/core/voice'
|
|
97
|
+
import { openai } from '@ai-sdk/openai'
|
|
98
|
+
import { elevenlabs } from '@ai-sdk/elevenlabs'
|
|
99
|
+
|
|
100
|
+
// Use AI SDK speech models
|
|
101
|
+
const voice = new CompositeVoice({
|
|
102
|
+
output: elevenlabs.speech('eleven_turbo_v2'), // AI SDK model
|
|
103
|
+
input: openai.transcription('whisper-1'), // AI SDK model
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
// Works the same way
|
|
107
|
+
const audioStream = await voice.speak('Hello from AI SDK!')
|
|
108
|
+
|
|
109
|
+
// Provider-specific options can be passed through
|
|
110
|
+
const audioWithOptions = await voice.speak('Hello with options!', {
|
|
111
|
+
speaker: 'Rachel', // ElevenLabs voice
|
|
112
|
+
providerOptions: {
|
|
113
|
+
elevenlabs: {
|
|
114
|
+
stability: 0.5,
|
|
115
|
+
similarity_boost: 0.75,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
})
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
See the [CompositeVoice reference](https://mastra.ai/reference/voice/composite-voice) for more details on AI SDK integration.
|
|
122
|
+
|
|
123
|
+
## Realtime Voice Providers
|
|
124
|
+
|
|
125
|
+
When using realtime voice providers like `OpenAIRealtimeVoice`, the `speak()` method behaves differently:
|
|
126
|
+
|
|
127
|
+
- Instead of returning an audio stream, it emits a 'speaking' event with the audio data
|
|
128
|
+
- You need to register an event listener to receive the audio chunks
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
import { OpenAIRealtimeVoice } from '@mastra/voice-openai-realtime'
|
|
132
|
+
import Speaker from '@mastra/node-speaker'
|
|
133
|
+
|
|
134
|
+
const speaker = new Speaker({
|
|
135
|
+
sampleRate: 24100, // Audio sample rate in Hz - standard for high-quality audio on MacBook Pro
|
|
136
|
+
channels: 1, // Mono audio output (as opposed to stereo which would be 2)
|
|
137
|
+
bitDepth: 16, // Bit depth for audio quality - CD quality standard (16-bit resolution)
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
const voice = new OpenAIRealtimeVoice()
|
|
141
|
+
await voice.connect()
|
|
142
|
+
// Register event listener for audio chunks
|
|
143
|
+
voice.on('speaker', stream => {
|
|
144
|
+
// Handle audio chunk (e.g., play it or save it)
|
|
145
|
+
stream.pipe(speaker)
|
|
146
|
+
})
|
|
147
|
+
// This will emit 'speaking' events instead of returning a stream
|
|
148
|
+
await voice.speak('Hello, this is realtime speech!')
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Notes
|
|
152
|
+
|
|
153
|
+
- The behavior of `speak()` may vary slightly between providers, but all implementations follow the same basic interface.
|
|
154
|
+
- When using a realtime voice provider, the method might not return an audio stream directly but instead emit a 'speaking' event.
|
|
155
|
+
- If a text stream is provided as input, the provider will typically convert it to a string before processing.
|
|
156
|
+
- The audio format of the returned stream depends on the provider. Common formats include MP3, WAV, and OGG.
|
|
157
|
+
- For best performance, consider closing or ending the audio stream when you're done with it.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# voice.updateConfig()
|
|
2
|
+
|
|
3
|
+
The `updateConfig()` method allows you to update the configuration of a voice provider at runtime. This is useful for changing voice settings, API keys, or other provider-specific options without creating a new instance.
|
|
4
|
+
|
|
5
|
+
## Usage Example
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { OpenAIRealtimeVoice } from '@mastra/voice-openai-realtime'
|
|
9
|
+
|
|
10
|
+
// Initialize a real-time voice provider
|
|
11
|
+
const voice = new OpenAIRealtimeVoice({
|
|
12
|
+
realtimeConfig: {
|
|
13
|
+
model: 'gpt-5.1-realtime',
|
|
14
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
15
|
+
},
|
|
16
|
+
speaker: 'alloy',
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
// Connect to the real-time service
|
|
20
|
+
await voice.connect()
|
|
21
|
+
|
|
22
|
+
// Later, update the configuration
|
|
23
|
+
voice.updateConfig({
|
|
24
|
+
voice: 'nova', // Change the default voice
|
|
25
|
+
turn_detection: {
|
|
26
|
+
type: 'server_vad',
|
|
27
|
+
threshold: 0.5,
|
|
28
|
+
silence_duration_ms: 1000,
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// The next speak() call will use the new configuration
|
|
33
|
+
await voice.speak('Hello with my new voice!')
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Parameters
|
|
37
|
+
|
|
38
|
+
**options:** (`Record<string, unknown>`): Configuration options to update. The specific properties depend on the voice provider.
|
|
39
|
+
|
|
40
|
+
## Return Value
|
|
41
|
+
|
|
42
|
+
This method does not return a value.
|
|
43
|
+
|
|
44
|
+
## Configuration Options
|
|
45
|
+
|
|
46
|
+
Different voice providers support different configuration options:
|
|
47
|
+
|
|
48
|
+
### OpenAI Realtime
|
|
49
|
+
|
|
50
|
+
**voice?:** (`string`): Voice ID to use for speech synthesis (e.g., 'alloy', 'echo', 'nova')
|
|
51
|
+
|
|
52
|
+
**turn\_detection?:** (`{ type: string, threshold?: number, silence_duration_ms?: number }`): Configuration for detecting when a user has finished speaking
|
|
53
|
+
|
|
54
|
+
## Notes
|
|
55
|
+
|
|
56
|
+
- The default implementation logs a warning if the provider doesn't support this method
|
|
57
|
+
- Configuration updates are typically applied to subsequent operations, not ongoing ones
|
|
58
|
+
- Not all properties that can be set in the constructor can be updated at runtime
|
|
59
|
+
- The specific behavior depends on the voice provider implementation
|
|
60
|
+
- For real-time voice providers, some configuration changes may require reconnecting to the service
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Run.cancel()
|
|
2
|
+
|
|
3
|
+
The `.cancel()` method cancels a workflow run, stopping execution and cleaning up resources.
|
|
4
|
+
|
|
5
|
+
This method aborts any running steps and updates the workflow status to 'canceled'. It works for both actively running workflows and suspended/waiting workflows.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
const run = await workflow.createRun()
|
|
11
|
+
|
|
12
|
+
await run.cancel()
|
|
13
|
+
// Returns: { message: 'Workflow run canceled' }
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
**No parameters:** (`void`): This method takes no parameters
|
|
19
|
+
|
|
20
|
+
## Returns
|
|
21
|
+
|
|
22
|
+
**result:** (`Promise<{ message: string }>`): A promise that resolves with { message: 'Workflow run canceled' } when cancellation succeeds
|
|
23
|
+
|
|
24
|
+
## How cancellation works
|
|
25
|
+
|
|
26
|
+
When called, the workflow will:
|
|
27
|
+
|
|
28
|
+
1. **Trigger the abort signal** - Uses the standard Web API AbortSignal to notify running steps
|
|
29
|
+
2. **Prevent subsequent steps** - No further steps will be executed
|
|
30
|
+
|
|
31
|
+
## Abort signal behavior
|
|
32
|
+
|
|
33
|
+
Steps that check the `abortSignal` parameter can respond to cancellation:
|
|
34
|
+
|
|
35
|
+
- Steps can listen to the 'abort' event: `abortSignal.addEventListener('abort', callback)`
|
|
36
|
+
- Steps can check if already aborted: `if (abortSignal.aborted) { ... }`
|
|
37
|
+
- Useful for cancelling timeouts, network requests, or long-running operations
|
|
38
|
+
|
|
39
|
+
**Note:** Steps must actively check the abort signal to be canceled mid-execution. Steps that don't check the signal will run to completion, but subsequent steps won't execute.
|
|
40
|
+
|
|
41
|
+
## Extended usage examples
|
|
42
|
+
|
|
43
|
+
### Cancelling a workflow on error
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
const run = await workflow.createRun()
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const result = await run.start({ inputData: { value: 'initial data' } })
|
|
50
|
+
} catch (error) {
|
|
51
|
+
await run.cancel()
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Creating a step that responds to cancellation
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
const step = createStep({
|
|
59
|
+
id: 'long-running-step',
|
|
60
|
+
execute: async ({ inputData, abortSignal, abort }) => {
|
|
61
|
+
const timeout = new Promise(resolve => {
|
|
62
|
+
const timer = setTimeout(() => resolve('done'), 10000)
|
|
63
|
+
|
|
64
|
+
// Clean up if canceled
|
|
65
|
+
abortSignal.addEventListener('abort', () => {
|
|
66
|
+
clearTimeout(timer)
|
|
67
|
+
resolve('canceled')
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
const result = await timeout
|
|
72
|
+
|
|
73
|
+
// Check if aborted after async operation
|
|
74
|
+
if (abortSignal.aborted) {
|
|
75
|
+
return abort() // Stop execution
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return { result }
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Related
|
|
84
|
+
|
|
85
|
+
- [Workflows overview](https://mastra.ai/docs/workflows/overview)
|
|
86
|
+
- [Workflow.createRun()](https://mastra.ai/reference/workflows/workflow-methods/create-run)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Run.restart()
|
|
2
|
+
|
|
3
|
+
The `.restart()` method restarts an active workflow run that lost connection to the server, allowing you to continue execution from the moment it lost connection (the last active step).
|
|
4
|
+
|
|
5
|
+
## Usage example
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
const run = await workflow.createRun()
|
|
9
|
+
|
|
10
|
+
const result = await run.start({ inputData: { value: 'initial data' } })
|
|
11
|
+
|
|
12
|
+
const restartedResult = await run.restart()
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
**requestContext?:** (`RequestContext`): Request Context data to use when resuming
|
|
18
|
+
|
|
19
|
+
**tracingContext?:** (`TracingContext`): currentSpan?:SpanCurrent span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution.
|
|
20
|
+
|
|
21
|
+
**tracingOptions?:** (`TracingOptions`): metadata?:Record\<string, any>Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags.requestContextKeys?:string\[]Additional RequestContext keys to extract as metadata for this trace. Supports dot notation for nested values (e.g., 'user.id').traceId?:stringTrace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.parentSpanId?:stringParent span ID to use for this execution (1-16 hexadecimal characters). If provided, the root span will be created as a child of this span.tags?:string\[]Tags to apply to this trace. String labels for categorizing and filtering traces.
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
**result:** (`Promise<WorkflowResult<TState, TOutput, TSteps>>`): A promise that resolves to the workflow execution result containing step outputs and status
|
|
26
|
+
|
|
27
|
+
**traceId?:** (`string`): The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.
|
|
28
|
+
|
|
29
|
+
## Related
|
|
30
|
+
|
|
31
|
+
- [Workflows overview](https://mastra.ai/docs/workflows/overview)
|
|
32
|
+
- [Restart workflows](https://mastra.ai/docs/workflows/overview)
|
|
33
|
+
- [Workflow.createRun()](https://mastra.ai/reference/workflows/workflow-methods/create-run)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Run.resume()
|
|
2
|
+
|
|
3
|
+
The `.resume()` method resumes a suspended workflow run with new data, allowing you to continue execution from a specific step.
|
|
4
|
+
|
|
5
|
+
## Usage example
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
const run = await workflow.createRun()
|
|
9
|
+
|
|
10
|
+
const result = await run.start({ inputData: { value: 'initial data' } })
|
|
11
|
+
|
|
12
|
+
if (result.status === 'suspended') {
|
|
13
|
+
const resumedResults = await run.resume({
|
|
14
|
+
resumeData: { value: 'resume data' },
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Parameters
|
|
20
|
+
|
|
21
|
+
**resumeData?:** (`z.infer<TResumeSchema>`): Data for resuming the suspended step
|
|
22
|
+
|
|
23
|
+
**step?:** (`Step<string, any, any, TResumeSchema, any, TEngineType> | [...Step<string, any, any, any, any, TEngineType>[], Step<string, any, any, TResumeSchema, any, TEngineType>] | string | string[]`): The step(s) to resume execution from. Can be a Step instance, array of Steps, step ID string, or array of step ID strings
|
|
24
|
+
|
|
25
|
+
**requestContext?:** (`RequestContext`): Request Context data to use when resuming
|
|
26
|
+
|
|
27
|
+
**retryCount?:** (`number`): Optional retry count for nested workflow execution
|
|
28
|
+
|
|
29
|
+
**tracingContext?:** (`TracingContext`): currentSpan?:SpanCurrent span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution.
|
|
30
|
+
|
|
31
|
+
**tracingOptions?:** (`TracingOptions`): metadata?:Record\<string, any>Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags.requestContextKeys?:string\[]Additional RequestContext keys to extract as metadata for this trace. Supports dot notation for nested values (e.g., 'user.id').traceId?:stringTrace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.parentSpanId?:stringParent span ID to use for this execution (1-16 hexadecimal characters). If provided, the root span will be created as a child of this span.tags?:string\[]Tags to apply to this trace. String labels for categorizing and filtering traces.
|
|
32
|
+
|
|
33
|
+
**outputOptions?:** (`OutputOptions`): includeState?:booleanWhether to include the workflow run state in the result.
|
|
34
|
+
|
|
35
|
+
## Returns
|
|
36
|
+
|
|
37
|
+
**result:** (`Promise<WorkflowResult<TState, TOutput, TSteps>>`): A promise that resolves to the workflow execution result containing step outputs and status
|
|
38
|
+
|
|
39
|
+
**traceId?:** (`string`): The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.
|
|
40
|
+
|
|
41
|
+
## Extended usage example
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
if (result.status === 'suspended') {
|
|
45
|
+
const resumedResults = await run.resume({
|
|
46
|
+
step: result.suspended[0],
|
|
47
|
+
resumeData: { value: 'resume data' },
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
> **Note:** When exactly one step is suspended, you can omit the `step` parameter and the workflow will automatically resume that step. For workflows with multiple suspended steps, you must explicitly specify which step to resume.
|
|
53
|
+
|
|
54
|
+
## Related
|
|
55
|
+
|
|
56
|
+
- [Workflows overview](https://mastra.ai/docs/workflows/overview)
|
|
57
|
+
- [Workflow.createRun()](https://mastra.ai/reference/workflows/workflow-methods/create-run)
|
|
58
|
+
- [Suspend and resume](https://mastra.ai/docs/workflows/suspend-and-resume)
|
|
59
|
+
- [Human in the loop](https://mastra.ai/docs/workflows/human-in-the-loop)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Run.start()
|
|
2
|
+
|
|
3
|
+
The `.start()` method starts a workflow run with input data, allowing you to execute the workflow from the beginning.
|
|
4
|
+
|
|
5
|
+
## Usage example
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
const run = await workflow.createRun()
|
|
9
|
+
|
|
10
|
+
const result = await run.start({
|
|
11
|
+
inputData: {
|
|
12
|
+
value: 'initial data',
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
**inputData?:** (`z.infer<TInput>`): Input data that matches the workflow's input schema
|
|
20
|
+
|
|
21
|
+
**requestContext?:** (`RequestContext`): Request Context data to use during workflow execution
|
|
22
|
+
|
|
23
|
+
**outputWriter?:** (`(chunk: TOutput) => Promise<void>`): Optional asynchronous function to handle output chunks as they are produced
|
|
24
|
+
|
|
25
|
+
**tracingContext?:** (`TracingContext`): currentSpan?:SpanCurrent span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution.
|
|
26
|
+
|
|
27
|
+
**tracingOptions?:** (`TracingOptions`): metadata?:Record\<string, any>Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags.requestContextKeys?:string\[]Additional RequestContext keys to extract as metadata for this trace. Supports dot notation for nested values (e.g., 'user.id').traceId?:stringTrace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.parentSpanId?:stringParent span ID to use for this execution (1-16 hexadecimal characters). If provided, the root span will be created as a child of this span.tags?:string\[]Tags to apply to this trace. String labels for categorizing and filtering traces.
|
|
28
|
+
|
|
29
|
+
**outputOptions?:** (`OutputOptions`): includeState?:booleanWhether to include the workflow run state in the result.
|
|
30
|
+
|
|
31
|
+
## Returns
|
|
32
|
+
|
|
33
|
+
**result:** (`Promise<WorkflowResult<TState, TOutput, TSteps>>`): A promise that resolves to the workflow execution result containing step outputs and status
|
|
34
|
+
|
|
35
|
+
**traceId?:** (`string`): The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.
|
|
36
|
+
|
|
37
|
+
## Extended usage example
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { RequestContext } from '@mastra/core/request-context'
|
|
41
|
+
|
|
42
|
+
const run = await workflow.createRun()
|
|
43
|
+
|
|
44
|
+
const requestContext = new RequestContext()
|
|
45
|
+
requestContext.set('variable', false)
|
|
46
|
+
|
|
47
|
+
const result = await run.start({
|
|
48
|
+
inputData: {
|
|
49
|
+
value: 'initial data',
|
|
50
|
+
},
|
|
51
|
+
requestContext,
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Related
|
|
56
|
+
|
|
57
|
+
- [Workflows overview](https://mastra.ai/docs/workflows/overview)
|
|
58
|
+
- [Workflow.createRun()](https://mastra.ai/reference/workflows/workflow-methods/create-run)
|