@mastra/mcp-docs-server 1.1.8 → 1.1.9-alpha.1
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 +4 -4
- package/.docs/docs/agents/agent-approval.md +3 -3
- package/.docs/docs/agents/agent-memory.md +3 -3
- package/.docs/docs/agents/guardrails.md +3 -3
- package/.docs/docs/agents/network-approval.md +5 -2
- package/.docs/docs/agents/networks.md +2 -2
- package/.docs/docs/agents/overview.md +2 -2
- package/.docs/docs/agents/processors.md +42 -24
- package/.docs/docs/agents/structured-output.md +2 -2
- package/.docs/docs/agents/supervisor-agents.md +3 -3
- package/.docs/docs/agents/using-tools.md +3 -3
- package/.docs/docs/build-with-ai/mcp-docs-server.md +5 -5
- package/.docs/docs/build-with-ai/skills.md +2 -2
- package/.docs/docs/community/contributing-templates.md +1 -1
- package/.docs/docs/community/discord.md +3 -3
- package/.docs/docs/community/licensing.md +2 -2
- package/.docs/docs/deployment/cloud-providers.md +2 -2
- package/.docs/docs/deployment/mastra-server.md +2 -2
- package/.docs/docs/deployment/monorepo.md +1 -1
- package/.docs/docs/deployment/overview.md +3 -3
- package/.docs/docs/deployment/studio.md +3 -3
- package/.docs/docs/deployment/web-framework.md +2 -2
- package/.docs/docs/deployment/workflow-runners.md +1 -1
- package/.docs/docs/evals/built-in-scorers.md +1 -1
- package/.docs/docs/evals/custom-scorers.md +6 -6
- package/.docs/docs/evals/overview.md +2 -2
- package/.docs/docs/evals/running-in-ci.md +6 -6
- package/.docs/docs/getting-started/build-with-ai.md +3 -3
- package/.docs/docs/getting-started/manual-install.md +1 -1
- package/.docs/docs/getting-started/project-structure.md +2 -2
- package/.docs/docs/index.md +63 -17
- package/.docs/docs/mastra-cloud/deployment.md +1 -1
- package/.docs/docs/mastra-cloud/studio.md +1 -1
- package/.docs/docs/mcp/overview.md +1 -1
- package/.docs/docs/mcp/publishing-mcp-server.md +4 -4
- package/.docs/docs/memory/memory-processors.md +9 -9
- package/.docs/docs/memory/message-history.md +4 -4
- package/.docs/docs/memory/observational-memory.md +11 -7
- package/.docs/docs/memory/semantic-recall.md +9 -9
- package/.docs/docs/memory/storage.md +1 -1
- package/.docs/docs/memory/working-memory.md +20 -20
- package/.docs/docs/observability/datasets/overview.md +1 -1
- package/.docs/docs/observability/datasets/running-experiments.md +1 -1
- package/.docs/docs/observability/logging.md +1 -1
- package/.docs/docs/observability/overview.md +5 -5
- package/.docs/docs/observability/tracing/bridges/otel.md +9 -9
- package/.docs/docs/observability/tracing/exporters/arize.md +3 -3
- package/.docs/docs/observability/tracing/exporters/braintrust.md +1 -1
- package/.docs/docs/observability/tracing/exporters/cloud.md +2 -2
- package/.docs/docs/observability/tracing/exporters/datadog.md +3 -3
- package/.docs/docs/observability/tracing/exporters/default.md +8 -8
- package/.docs/docs/observability/tracing/exporters/laminar.md +1 -1
- package/.docs/docs/observability/tracing/exporters/langfuse.md +3 -3
- package/.docs/docs/observability/tracing/exporters/langsmith.md +4 -4
- package/.docs/docs/observability/tracing/exporters/otel.md +8 -8
- package/.docs/docs/observability/tracing/exporters/posthog.md +2 -2
- package/.docs/docs/observability/tracing/exporters/sentry.md +4 -4
- package/.docs/docs/observability/tracing/overview.md +24 -24
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +13 -13
- package/.docs/docs/rag/chunking-and-embedding.md +5 -5
- package/.docs/docs/rag/overview.md +2 -2
- package/.docs/docs/rag/retrieval.md +4 -4
- package/.docs/docs/rag/vector-databases.md +13 -13
- package/.docs/docs/server/auth/auth0.md +2 -2
- package/.docs/docs/server/auth/clerk.md +1 -1
- package/.docs/docs/server/auth/composite-auth.md +9 -9
- package/.docs/docs/server/auth/custom-auth-provider.md +12 -12
- package/.docs/docs/server/auth/firebase.md +3 -3
- package/.docs/docs/server/auth/jwt.md +1 -1
- package/.docs/docs/server/auth/simple-auth.md +9 -9
- package/.docs/docs/server/auth/supabase.md +1 -1
- package/.docs/docs/server/auth/workos.md +1 -1
- package/.docs/docs/server/auth.md +2 -2
- package/.docs/docs/server/custom-adapters.md +7 -7
- package/.docs/docs/server/custom-api-routes.md +2 -2
- package/.docs/docs/server/mastra-client.md +2 -2
- package/.docs/docs/server/mastra-server.md +2 -2
- package/.docs/docs/server/request-context.md +2 -2
- package/.docs/docs/server/server-adapters.md +3 -3
- package/.docs/docs/streaming/events.md +2 -2
- package/.docs/docs/streaming/overview.md +2 -2
- package/.docs/docs/streaming/tool-streaming.md +46 -32
- package/.docs/docs/streaming/workflow-streaming.md +1 -1
- package/.docs/docs/voice/overview.md +3 -3
- package/.docs/docs/voice/speech-to-speech.md +1 -1
- package/.docs/docs/voice/speech-to-text.md +2 -2
- package/.docs/docs/voice/text-to-speech.md +2 -2
- package/.docs/docs/workflows/agents-and-tools.md +1 -1
- package/.docs/docs/workflows/control-flow.md +45 -3
- package/.docs/docs/workflows/error-handling.md +4 -4
- package/.docs/docs/workflows/overview.md +3 -3
- package/.docs/docs/workflows/snapshots.md +1 -1
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/docs/workflows/time-travel.md +3 -3
- package/.docs/docs/workflows/workflow-state.md +1 -1
- package/.docs/docs/workspace/filesystem.md +3 -3
- package/.docs/docs/workspace/overview.md +53 -8
- package/.docs/docs/workspace/sandbox.md +72 -13
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/docs/workspace/skills.md +4 -4
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +2 -2
- package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
- package/.docs/guides/build-your-ui/copilotkit.md +2 -2
- package/.docs/guides/deployment/digital-ocean.md +1 -1
- package/.docs/guides/deployment/inngest.md +4 -4
- package/.docs/guides/getting-started/astro.md +1 -1
- package/.docs/guides/getting-started/electron.md +1 -1
- package/.docs/guides/getting-started/next-js.md +1 -1
- package/.docs/guides/getting-started/vite-react.md +1 -1
- package/.docs/guides/guide/ai-recruiter.md +4 -4
- package/.docs/guides/guide/chef-michel.md +4 -4
- package/.docs/guides/guide/code-review-bot.md +3 -3
- package/.docs/guides/guide/dev-assistant.md +5 -5
- package/.docs/guides/guide/docs-manager.md +3 -3
- package/.docs/guides/guide/github-actions-pr-description.md +4 -4
- package/.docs/guides/guide/notes-mcp-server.md +4 -4
- package/.docs/guides/guide/research-assistant.md +4 -4
- package/.docs/guides/guide/research-coordinator.md +1 -1
- package/.docs/guides/guide/stock-agent.md +6 -6
- package/.docs/guides/guide/web-search.md +2 -2
- package/.docs/guides/guide/whatsapp-chat-bot.md +1 -1
- package/.docs/guides/migrations/agentnetwork.md +1 -1
- package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +3 -3
- package/.docs/guides/migrations/network-to-supervisor.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/agent.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/client.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/deployment.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/evals.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/mastra.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/memory.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/storage.md +4 -4
- package/.docs/guides/migrations/upgrade-to-v1/tools.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/vectors.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/voice.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/workflows.md +6 -6
- package/.docs/guides/migrations/vnext-to-standard-apis.md +3 -3
- package/.docs/models/embeddings.md +4 -4
- package/.docs/models/gateways/custom-gateways.md +4 -4
- package/.docs/models/gateways/netlify.md +2 -3
- package/.docs/models/gateways/openrouter.md +9 -2
- package/.docs/models/gateways/vercel.md +11 -2
- package/.docs/models/gateways.md +2 -2
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/302ai.md +3 -3
- package/.docs/models/providers/abacus.md +24 -14
- package/.docs/models/providers/aihubmix.md +10 -5
- package/.docs/models/providers/alibaba-cn.md +83 -74
- package/.docs/models/providers/alibaba-coding-plan-cn.md +78 -0
- package/.docs/models/providers/alibaba-coding-plan.md +78 -0
- package/.docs/models/providers/alibaba.md +3 -3
- package/.docs/models/providers/anthropic.md +4 -4
- package/.docs/models/providers/bailing.md +3 -3
- package/.docs/models/providers/baseten.md +3 -3
- package/.docs/models/providers/berget.md +3 -3
- package/.docs/models/providers/cerebras.md +4 -4
- package/.docs/models/providers/chutes.md +7 -6
- package/.docs/models/providers/clarifai.md +81 -0
- package/.docs/models/providers/cloudferro-sherlock.md +8 -7
- package/.docs/models/providers/cloudflare-workers-ai.md +6 -5
- package/.docs/models/providers/cortecs.md +10 -8
- package/.docs/models/providers/deepinfra.md +11 -6
- package/.docs/models/providers/deepseek.md +4 -4
- package/.docs/models/providers/drun.md +73 -0
- package/.docs/models/providers/evroc.md +3 -3
- package/.docs/models/providers/fastrouter.md +3 -3
- package/.docs/models/providers/fireworks-ai.md +3 -3
- package/.docs/models/providers/firmware.md +31 -23
- package/.docs/models/providers/friendli.md +3 -3
- package/.docs/models/providers/github-models.md +3 -3
- package/.docs/models/providers/google.md +7 -5
- package/.docs/models/providers/groq.md +4 -4
- package/.docs/models/providers/helicone.md +3 -3
- package/.docs/models/providers/huggingface.md +3 -3
- package/.docs/models/providers/iflowcn.md +3 -3
- package/.docs/models/providers/inception.md +7 -5
- package/.docs/models/providers/inference.md +3 -3
- package/.docs/models/providers/io-net.md +3 -3
- package/.docs/models/providers/jiekou.md +3 -3
- package/.docs/models/providers/kilo.md +6 -4
- package/.docs/models/providers/kimi-for-coding.md +4 -4
- package/.docs/models/providers/kuae-cloud-coding-plan.md +3 -3
- package/.docs/models/providers/llama.md +3 -3
- package/.docs/models/providers/lmstudio.md +3 -3
- package/.docs/models/providers/lucidquery.md +3 -3
- package/.docs/models/providers/meganova.md +3 -3
- package/.docs/models/providers/minimax-cn-coding-plan.md +4 -4
- package/.docs/models/providers/minimax-cn.md +4 -4
- package/.docs/models/providers/minimax-coding-plan.md +4 -4
- package/.docs/models/providers/minimax.md +4 -4
- package/.docs/models/providers/mistral.md +4 -4
- package/.docs/models/providers/moark.md +3 -3
- package/.docs/models/providers/modelscope.md +3 -3
- package/.docs/models/providers/moonshotai-cn.md +3 -3
- package/.docs/models/providers/moonshotai.md +3 -3
- package/.docs/models/providers/morph.md +3 -3
- package/.docs/models/providers/nano-gpt.md +523 -42
- package/.docs/models/providers/nebius.md +37 -37
- package/.docs/models/providers/nova.md +3 -3
- package/.docs/models/providers/novita-ai.md +3 -3
- package/.docs/models/providers/nvidia.md +7 -5
- package/.docs/models/providers/ollama-cloud.md +4 -5
- package/.docs/models/providers/openai.md +7 -5
- package/.docs/models/providers/opencode-go.md +3 -3
- package/.docs/models/providers/opencode.md +39 -36
- package/.docs/models/providers/ovhcloud.md +3 -3
- package/.docs/models/providers/perplexity-agent.md +4 -4
- package/.docs/models/providers/perplexity.md +4 -4
- package/.docs/models/providers/poe.md +11 -5
- package/.docs/models/providers/privatemode-ai.md +3 -3
- package/.docs/models/providers/qihang-ai.md +3 -3
- package/.docs/models/providers/qiniu-ai.md +23 -8
- package/.docs/models/providers/requesty.md +20 -4
- package/.docs/models/providers/scaleway.md +3 -3
- package/.docs/models/providers/siliconflow-cn.md +10 -4
- package/.docs/models/providers/siliconflow.md +3 -3
- package/.docs/models/providers/stackit.md +3 -3
- package/.docs/models/providers/stepfun.md +3 -3
- package/.docs/models/providers/submodel.md +3 -3
- package/.docs/models/providers/synthetic.md +3 -3
- package/.docs/models/providers/togetherai.md +5 -7
- package/.docs/models/providers/upstage.md +3 -3
- package/.docs/models/providers/vivgrid.md +4 -4
- package/.docs/models/providers/vultr.md +3 -3
- package/.docs/models/providers/wandb.md +3 -3
- package/.docs/models/providers/xai.md +34 -31
- package/.docs/models/providers/xiaomi.md +4 -4
- package/.docs/models/providers/zai-coding-plan.md +3 -3
- package/.docs/models/providers/zai.md +3 -3
- package/.docs/models/providers/zenmux.md +7 -5
- package/.docs/models/providers/zhipuai-coding-plan.md +3 -3
- package/.docs/models/providers/zhipuai.md +3 -3
- package/.docs/models/providers.md +4 -0
- package/.docs/reference/agents/agent.md +3 -3
- package/.docs/reference/agents/generateLegacy.md +1 -1
- package/.docs/reference/agents/getDefaultGenerateOptions.md +1 -1
- package/.docs/reference/agents/getDefaultOptions.md +1 -1
- package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
- package/.docs/reference/agents/getDescription.md +1 -1
- package/.docs/reference/agents/network.md +5 -3
- package/.docs/reference/ai-sdk/handle-chat-stream.md +2 -0
- package/.docs/reference/ai-sdk/handle-network-stream.md +2 -0
- package/.docs/reference/ai-sdk/network-route.md +2 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +1 -1
- package/.docs/reference/auth/auth0.md +7 -7
- package/.docs/reference/auth/better-auth.md +2 -2
- package/.docs/reference/auth/clerk.md +1 -1
- package/.docs/reference/auth/firebase.md +5 -5
- package/.docs/reference/auth/jwt.md +1 -1
- package/.docs/reference/auth/supabase.md +1 -1
- package/.docs/reference/auth/workos.md +6 -6
- package/.docs/reference/cli/mastra.md +5 -5
- package/.docs/reference/client-js/agents.md +22 -22
- package/.docs/reference/client-js/error-handling.md +2 -2
- package/.docs/reference/client-js/logs.md +2 -2
- package/.docs/reference/client-js/mastra-client.md +2 -2
- package/.docs/reference/client-js/memory.md +6 -6
- package/.docs/reference/client-js/observability.md +4 -4
- package/.docs/reference/client-js/telemetry.md +1 -1
- package/.docs/reference/client-js/tools.md +3 -3
- package/.docs/reference/client-js/vectors.md +2 -2
- package/.docs/reference/client-js/workflows.md +12 -12
- package/.docs/reference/configuration.md +62 -6
- package/.docs/reference/core/getDeployer.md +1 -1
- package/.docs/reference/core/getGatewayById.md +1 -1
- package/.docs/reference/core/getLogger.md +1 -1
- package/.docs/reference/core/getMCPServer.md +2 -2
- package/.docs/reference/core/getMCPServerById.md +2 -2
- package/.docs/reference/core/getMemory.md +1 -1
- package/.docs/reference/core/getScorer.md +4 -4
- package/.docs/reference/core/getScorerById.md +2 -2
- package/.docs/reference/core/getServer.md +1 -1
- package/.docs/reference/core/getStorage.md +1 -1
- package/.docs/reference/core/getStoredAgentById.md +3 -3
- package/.docs/reference/core/getTelemetry.md +1 -1
- package/.docs/reference/core/getWorkflow.md +1 -1
- package/.docs/reference/core/listAgents.md +1 -1
- package/.docs/reference/core/listMCPServers.md +3 -3
- package/.docs/reference/core/listMemory.md +1 -1
- package/.docs/reference/core/listScorers.md +1 -1
- package/.docs/reference/core/listStoredAgents.md +3 -3
- package/.docs/reference/core/listVectors.md +1 -1
- package/.docs/reference/core/mastra-class.md +2 -2
- package/.docs/reference/core/mastra-model-gateway.md +11 -11
- package/.docs/reference/core/setLogger.md +1 -1
- package/.docs/reference/core/setStorage.md +1 -1
- package/.docs/reference/datasets/dataset.md +2 -2
- package/.docs/reference/datasets/datasets-manager.md +1 -1
- package/.docs/reference/datasets/get.md +2 -2
- package/.docs/reference/datasets/getDetails.md +1 -1
- package/.docs/reference/datasets/listItems.md +1 -1
- package/.docs/reference/deployer/vercel.md +1 -1
- package/.docs/reference/deployer.md +4 -4
- package/.docs/reference/evals/answer-relevancy.md +4 -4
- package/.docs/reference/evals/answer-similarity.md +3 -3
- package/.docs/reference/evals/bias.md +4 -4
- package/.docs/reference/evals/completeness.md +6 -6
- package/.docs/reference/evals/content-similarity.md +3 -3
- package/.docs/reference/evals/context-precision.md +9 -9
- package/.docs/reference/evals/context-relevance.md +7 -7
- package/.docs/reference/evals/create-scorer.md +7 -7
- package/.docs/reference/evals/faithfulness.md +3 -3
- package/.docs/reference/evals/hallucination.md +8 -14
- package/.docs/reference/evals/keyword-coverage.md +4 -4
- package/.docs/reference/evals/mastra-scorer.md +7 -7
- package/.docs/reference/evals/noise-sensitivity.md +11 -11
- package/.docs/reference/evals/prompt-alignment.md +5 -5
- package/.docs/reference/evals/run-evals.md +5 -5
- package/.docs/reference/evals/scorer-utils.md +17 -17
- package/.docs/reference/evals/textual-difference.md +4 -4
- package/.docs/reference/evals/tone-consistency.md +5 -5
- package/.docs/reference/evals/tool-call-accuracy.md +10 -10
- package/.docs/reference/evals/toxicity.md +3 -3
- package/.docs/reference/harness/harness-class.md +5 -3
- package/.docs/reference/index.md +2 -0
- package/.docs/reference/memory/clone-utilities.md +7 -7
- package/.docs/reference/memory/cloneThread.md +5 -5
- package/.docs/reference/memory/createThread.md +1 -1
- package/.docs/reference/memory/deleteMessages.md +1 -1
- package/.docs/reference/memory/getThreadById.md +1 -1
- package/.docs/reference/memory/listThreads.md +3 -3
- package/.docs/reference/memory/memory-class.md +1 -1
- package/.docs/reference/memory/observational-memory.md +8 -6
- package/.docs/reference/memory/recall.md +1 -1
- package/.docs/reference/observability/tracing/bridges/otel.md +6 -6
- package/.docs/reference/observability/tracing/configuration.md +17 -17
- package/.docs/reference/observability/tracing/exporters/arize.md +4 -4
- package/.docs/reference/observability/tracing/exporters/braintrust.md +3 -3
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +6 -6
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +4 -4
- package/.docs/reference/observability/tracing/exporters/datadog.md +4 -4
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +6 -6
- package/.docs/reference/observability/tracing/exporters/laminar.md +2 -2
- package/.docs/reference/observability/tracing/exporters/langfuse.md +4 -4
- package/.docs/reference/observability/tracing/exporters/langsmith.md +6 -6
- package/.docs/reference/observability/tracing/exporters/otel.md +12 -12
- package/.docs/reference/observability/tracing/exporters/posthog.md +3 -3
- package/.docs/reference/observability/tracing/exporters/sentry.md +5 -5
- package/.docs/reference/observability/tracing/instances.md +9 -9
- package/.docs/reference/observability/tracing/interfaces.md +39 -39
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +6 -6
- package/.docs/reference/observability/tracing/spans.md +15 -13
- package/.docs/reference/processors/message-history-processor.md +1 -1
- package/.docs/reference/processors/processor-interface.md +21 -17
- package/.docs/reference/processors/token-limiter-processor.md +2 -2
- package/.docs/reference/rag/chunk.md +2 -2
- package/.docs/reference/rag/database-config.md +8 -8
- package/.docs/reference/rag/document.md +11 -11
- package/.docs/reference/rag/embeddings.md +5 -5
- package/.docs/reference/rag/extract-params.md +8 -8
- package/.docs/reference/rag/graph-rag.md +4 -4
- package/.docs/reference/rag/metadata-filters.md +15 -15
- package/.docs/reference/rag/rerank.md +2 -2
- package/.docs/reference/rag/rerankWithScorer.md +2 -2
- package/.docs/reference/server/create-route.md +2 -0
- package/.docs/reference/server/express-adapter.md +1 -1
- package/.docs/reference/server/fastify-adapter.md +1 -1
- package/.docs/reference/server/hono-adapter.md +1 -1
- package/.docs/reference/server/koa-adapter.md +2 -2
- package/.docs/reference/server/mastra-server.md +16 -16
- package/.docs/reference/server/register-api-route.md +7 -7
- package/.docs/reference/server/routes.md +1 -1
- package/.docs/reference/storage/cloudflare-d1.md +5 -5
- package/.docs/reference/storage/cloudflare.md +3 -3
- package/.docs/reference/storage/composite.md +1 -1
- package/.docs/reference/storage/convex.md +6 -6
- package/.docs/reference/storage/dynamodb.md +7 -7
- package/.docs/reference/storage/lance.md +5 -5
- package/.docs/reference/storage/libsql.md +1 -1
- package/.docs/reference/storage/mongodb.md +6 -6
- package/.docs/reference/storage/mssql.md +4 -4
- package/.docs/reference/storage/overview.md +2 -2
- package/.docs/reference/storage/postgresql.md +7 -7
- package/.docs/reference/storage/upstash.md +4 -4
- package/.docs/reference/streaming/ChunkType.md +13 -13
- package/.docs/reference/streaming/agents/MastraModelOutput.md +6 -6
- package/.docs/reference/streaming/agents/stream.md +2 -2
- package/.docs/reference/streaming/agents/streamLegacy.md +1 -1
- package/.docs/reference/streaming/workflows/observeStream.md +2 -2
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/streaming/workflows/stream.md +1 -1
- package/.docs/reference/templates/overview.md +4 -4
- package/.docs/reference/tools/create-tool.md +10 -10
- package/.docs/reference/tools/document-chunker-tool.md +4 -4
- package/.docs/reference/tools/graph-rag-tool.md +7 -7
- package/.docs/reference/tools/mcp-client.md +13 -13
- package/.docs/reference/tools/mcp-server.md +27 -27
- package/.docs/reference/tools/vector-query-tool.md +12 -12
- package/.docs/reference/vectors/astra.md +13 -13
- package/.docs/reference/vectors/chroma.md +18 -18
- package/.docs/reference/vectors/convex.md +15 -15
- package/.docs/reference/vectors/couchbase.md +21 -21
- package/.docs/reference/vectors/duckdb.md +17 -17
- package/.docs/reference/vectors/elasticsearch.md +14 -14
- package/.docs/reference/vectors/lance.md +22 -22
- package/.docs/reference/vectors/libsql.md +15 -15
- package/.docs/reference/vectors/mongodb.md +18 -18
- package/.docs/reference/vectors/opensearch.md +11 -11
- package/.docs/reference/vectors/pg.md +23 -21
- package/.docs/reference/vectors/pinecone.md +15 -15
- package/.docs/reference/vectors/qdrant.md +15 -15
- package/.docs/reference/vectors/s3vectors.md +22 -22
- package/.docs/reference/vectors/turbopuffer.md +14 -14
- package/.docs/reference/vectors/upstash.md +15 -15
- package/.docs/reference/vectors/vectorize.md +16 -16
- package/.docs/reference/voice/azure.md +12 -10
- package/.docs/reference/voice/cloudflare.md +9 -7
- package/.docs/reference/voice/composite-voice.md +5 -5
- package/.docs/reference/voice/deepgram.md +5 -5
- package/.docs/reference/voice/elevenlabs.md +7 -7
- package/.docs/reference/voice/google-gemini-live.md +22 -22
- package/.docs/reference/voice/google.md +12 -12
- package/.docs/reference/voice/mastra-voice.md +18 -18
- package/.docs/reference/voice/murf.md +8 -8
- package/.docs/reference/voice/openai-realtime.md +19 -17
- package/.docs/reference/voice/openai.md +12 -8
- package/.docs/reference/voice/playai.md +9 -7
- package/.docs/reference/voice/sarvam.md +8 -6
- package/.docs/reference/voice/speechify.md +11 -9
- package/.docs/reference/voice/voice.addInstructions.md +4 -4
- package/.docs/reference/voice/voice.addTools.md +3 -3
- package/.docs/reference/voice/voice.answer.md +2 -2
- package/.docs/reference/voice/voice.close.md +4 -4
- package/.docs/reference/voice/voice.connect.md +9 -7
- package/.docs/reference/voice/voice.events.md +4 -4
- package/.docs/reference/voice/voice.getSpeakers.md +4 -4
- package/.docs/reference/voice/voice.listen.md +17 -11
- package/.docs/reference/voice/voice.off.md +4 -4
- package/.docs/reference/voice/voice.on.md +5 -5
- package/.docs/reference/voice/voice.send.md +2 -2
- package/.docs/reference/voice/voice.speak.md +19 -9
- package/.docs/reference/voice/voice.updateConfig.md +4 -4
- package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
- package/.docs/reference/workflows/run.md +3 -3
- package/.docs/reference/workflows/step.md +2 -2
- package/.docs/reference/workflows/workflow-methods/create-run.md +1 -1
- package/.docs/reference/workflows/workflow.md +1 -1
- package/.docs/reference/workspace/blaxel-sandbox.md +164 -0
- package/.docs/reference/workspace/daytona-sandbox.md +50 -141
- package/.docs/reference/workspace/e2b-sandbox.md +41 -77
- package/.docs/reference/workspace/filesystem.md +25 -11
- package/.docs/reference/workspace/gcs-filesystem.md +21 -1
- package/.docs/reference/workspace/local-filesystem.md +24 -10
- package/.docs/reference/workspace/local-sandbox.md +27 -102
- package/.docs/reference/workspace/process-manager.md +296 -0
- package/.docs/reference/workspace/s3-filesystem.md +21 -1
- package/.docs/reference/workspace/sandbox.md +9 -1
- package/.docs/reference/workspace/workspace-class.md +95 -27
- package/CHANGELOG.md +15 -0
- package/dist/tools/course.d.ts +7 -27
- package/dist/tools/course.d.ts.map +1 -1
- package/dist/tools/docs.d.ts +6 -18
- package/dist/tools/docs.d.ts.map +1 -1
- package/dist/tools/embedded-docs.d.ts +12 -112
- package/dist/tools/embedded-docs.d.ts.map +1 -1
- package/dist/tools/migration.d.ts +6 -26
- package/dist/tools/migration.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -8,7 +8,7 @@ A SpanOutputProcessor that redacts sensitive information from span fields.
|
|
|
8
8
|
new SensitiveDataFilter(options?: SensitiveDataFilterOptions)
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
## SensitiveDataFilterOptions
|
|
11
|
+
## `SensitiveDataFilterOptions`
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
14
|
interface SensitiveDataFilterOptions {
|
|
@@ -38,7 +38,7 @@ interface SensitiveDataFilterOptions {
|
|
|
38
38
|
}
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
## RedactionStyle
|
|
41
|
+
## `RedactionStyle`
|
|
42
42
|
|
|
43
43
|
```typescript
|
|
44
44
|
type RedactionStyle = 'full' | 'partial'
|
|
@@ -70,7 +70,7 @@ No cleanup needed for this processor.
|
|
|
70
70
|
readonly name = 'sensitive-data-filter';
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
## Default
|
|
73
|
+
## Default sensitive fields
|
|
74
74
|
|
|
75
75
|
When no custom fields are provided:
|
|
76
76
|
|
|
@@ -94,7 +94,7 @@ When no custom fields are provided:
|
|
|
94
94
|
]
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
## Processing
|
|
97
|
+
## Processing behavior
|
|
98
98
|
|
|
99
99
|
### Field Matching
|
|
100
100
|
|
|
@@ -105,7 +105,7 @@ When no custom fields are provided:
|
|
|
105
105
|
- **Exact matching**: After normalization, fields must match exactly
|
|
106
106
|
|
|
107
107
|
- `token` matches `token`, `Token`, `TOKEN`
|
|
108
|
-
- `token`
|
|
108
|
+
- `token` doesn't match `promptTokens` or `tokenCount`
|
|
109
109
|
|
|
110
110
|
### Redaction Styles
|
|
111
111
|
|
|
@@ -119,7 +119,7 @@ All matched values replaced with redactionToken.
|
|
|
119
119
|
- Values ≤ 6 characters are fully redacted
|
|
120
120
|
- Non-string values are converted to strings before partial redaction
|
|
121
121
|
|
|
122
|
-
### Error
|
|
122
|
+
### Error handling
|
|
123
123
|
|
|
124
124
|
If filtering a field fails, the field is replaced with:
|
|
125
125
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Spans
|
|
2
2
|
|
|
3
|
-
## BaseSpan
|
|
3
|
+
## `BaseSpan`
|
|
4
4
|
|
|
5
5
|
Base interface for all span types.
|
|
6
6
|
|
|
@@ -45,6 +45,8 @@ interface BaseSpan<TType extends SpanType> {
|
|
|
45
45
|
details?: Record<string, any>
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/** Snapshot of the RequestContext */
|
|
49
|
+
requestContext?: Record<string, any>
|
|
48
50
|
/** Is an event span? (occurs at startTime, has no endTime) */
|
|
49
51
|
isEvent: boolean
|
|
50
52
|
}
|
|
@@ -109,7 +111,7 @@ update(options: UpdateSpanOptions<TType>): void
|
|
|
109
111
|
|
|
110
112
|
Updates span data while it's still active. Can modify `input`, `output`, `metadata`, and `attributes`.
|
|
111
113
|
|
|
112
|
-
#### createChildSpan
|
|
114
|
+
#### `createChildSpan`
|
|
113
115
|
|
|
114
116
|
```typescript
|
|
115
117
|
createChildSpan<TChildType extends SpanType>(
|
|
@@ -119,7 +121,7 @@ createChildSpan<TChildType extends SpanType>(
|
|
|
119
121
|
|
|
120
122
|
Creates a child span under this span. Child spans track sub-operations and inherit the trace context.
|
|
121
123
|
|
|
122
|
-
#### createEventSpan
|
|
124
|
+
#### `createEventSpan`
|
|
123
125
|
|
|
124
126
|
```typescript
|
|
125
127
|
createEventSpan<TChildType extends SpanType>(
|
|
@@ -129,7 +131,7 @@ createEventSpan<TChildType extends SpanType>(
|
|
|
129
131
|
|
|
130
132
|
Creates an event span under this span. Event spans represent point-in-time occurrences with no duration.
|
|
131
133
|
|
|
132
|
-
## ExportedSpan
|
|
134
|
+
## `ExportedSpan`
|
|
133
135
|
|
|
134
136
|
Exported Span interface, used for tracing exporters. A lightweight version of Span without methods or circular references.
|
|
135
137
|
|
|
@@ -143,11 +145,11 @@ interface ExportedSpan<TType extends SpanType> extends BaseSpan<TType> {
|
|
|
143
145
|
}
|
|
144
146
|
```
|
|
145
147
|
|
|
146
|
-
## Span
|
|
148
|
+
## Span lifecycle events
|
|
147
149
|
|
|
148
150
|
Events emitted during the span lifecycle.
|
|
149
151
|
|
|
150
|
-
### TracingEventType
|
|
152
|
+
### `TracingEventType`
|
|
151
153
|
|
|
152
154
|
```typescript
|
|
153
155
|
enum TracingEventType {
|
|
@@ -162,7 +164,7 @@ enum TracingEventType {
|
|
|
162
164
|
}
|
|
163
165
|
```
|
|
164
166
|
|
|
165
|
-
### TracingEvent
|
|
167
|
+
### `TracingEvent`
|
|
166
168
|
|
|
167
169
|
```typescript
|
|
168
170
|
type TracingEvent =
|
|
@@ -173,9 +175,9 @@ type TracingEvent =
|
|
|
173
175
|
|
|
174
176
|
Exporters receive these events to process and send trace data to observability platforms.
|
|
175
177
|
|
|
176
|
-
## Union
|
|
178
|
+
## Union types
|
|
177
179
|
|
|
178
|
-
### AnySpan
|
|
180
|
+
### `AnySpan`
|
|
179
181
|
|
|
180
182
|
```typescript
|
|
181
183
|
type AnySpan = Span<keyof SpanTypeMap>
|
|
@@ -183,7 +185,7 @@ type AnySpan = Span<keyof SpanTypeMap>
|
|
|
183
185
|
|
|
184
186
|
Union type for cases that need to handle any span type.
|
|
185
187
|
|
|
186
|
-
### AnyExportedSpan
|
|
188
|
+
### `AnyExportedSpan`
|
|
187
189
|
|
|
188
190
|
```typescript
|
|
189
191
|
type AnyExportedSpan = ExportedSpan<keyof SpanTypeMap>
|
|
@@ -191,11 +193,11 @@ type AnyExportedSpan = ExportedSpan<keyof SpanTypeMap>
|
|
|
191
193
|
|
|
192
194
|
Union type for cases that need to handle any exported span type.
|
|
193
195
|
|
|
194
|
-
## NO-OP
|
|
196
|
+
## NO-OP spans
|
|
195
197
|
|
|
196
198
|
When tracing is disabled (sampling returns false), NO-OP spans are returned:
|
|
197
199
|
|
|
198
|
-
### NoOpSpan
|
|
200
|
+
### `NoOpSpan`
|
|
199
201
|
|
|
200
202
|
```typescript
|
|
201
203
|
class NoOpSpan<TType extends SpanType> extends BaseSpan<TType>
|
|
@@ -209,7 +211,7 @@ A span that performs no operations. All methods are no-ops:
|
|
|
209
211
|
- `end()`, `error()`, `update()` do nothing
|
|
210
212
|
- `createChildSpan()` returns another NO-OP span
|
|
211
213
|
|
|
212
|
-
## See
|
|
214
|
+
## See also
|
|
213
215
|
|
|
214
216
|
### Documentation
|
|
215
217
|
|
|
@@ -66,7 +66,7 @@ export const agent = new Agent({
|
|
|
66
66
|
|
|
67
67
|
1. Retrieves `threadId` from the request context
|
|
68
68
|
2. Fetches historical messages from storage (ordered by creation date, descending)
|
|
69
|
-
3. Filters out system messages (they
|
|
69
|
+
3. Filters out system messages (they shouldn't be stored in the database)
|
|
70
70
|
4. Merges historical messages with incoming messages, avoiding duplicates by ID
|
|
71
71
|
5. Adds historical messages with `source: 'memory'` tag
|
|
72
72
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Processor
|
|
1
|
+
# Processor interface
|
|
2
2
|
|
|
3
3
|
The `Processor` interface defines the contract for all processors in Mastra. Processors can implement one or more methods to handle different stages of the agent execution pipeline.
|
|
4
4
|
|
|
@@ -86,15 +86,15 @@ interface Processor<TId extends string = string> {
|
|
|
86
86
|
|
|
87
87
|
## Methods
|
|
88
88
|
|
|
89
|
-
### processInput
|
|
89
|
+
### `processInput`
|
|
90
90
|
|
|
91
|
-
Processes input messages before they
|
|
91
|
+
Processes input messages before they're sent to the LLM. Runs once at the start of agent execution.
|
|
92
92
|
|
|
93
93
|
```typescript
|
|
94
94
|
processInput?(args: ProcessInputArgs): Promise<ProcessInputResult> | ProcessInputResult;
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
#### ProcessInputArgs
|
|
97
|
+
#### `ProcessInputArgs`
|
|
98
98
|
|
|
99
99
|
**messages** (`MastraDBMessage[]`): User and assistant messages to process (excludes system messages).
|
|
100
100
|
|
|
@@ -110,7 +110,7 @@ processInput?(args: ProcessInputArgs): Promise<ProcessInputResult> | ProcessInpu
|
|
|
110
110
|
|
|
111
111
|
**requestContext** (`RequestContext`): Request-scoped context with execution metadata like threadId and resourceId.
|
|
112
112
|
|
|
113
|
-
#### ProcessInputResult
|
|
113
|
+
#### `ProcessInputResult`
|
|
114
114
|
|
|
115
115
|
The method can return one of three types:
|
|
116
116
|
|
|
@@ -122,9 +122,9 @@ The method can return one of three types:
|
|
|
122
122
|
|
|
123
123
|
***
|
|
124
124
|
|
|
125
|
-
### processInputStep
|
|
125
|
+
### `processInputStep`
|
|
126
126
|
|
|
127
|
-
Processes input messages at each step of the agentic loop, before they
|
|
127
|
+
Processes input messages at each step of the agentic loop, before they're sent to the LLM. Unlike `processInput` which runs once at the start, this runs at every step including tool call continuations.
|
|
128
128
|
|
|
129
129
|
```typescript
|
|
130
130
|
processInputStep?(args: ProcessInputStepArgs): ProcessorMessageResult;
|
|
@@ -139,7 +139,7 @@ processInputStep?(args: ProcessInputStepArgs): ProcessorMessageResult;
|
|
|
139
139
|
5. Tool execution (if needed)
|
|
140
140
|
6. Repeat from step 2 if tools were called
|
|
141
141
|
|
|
142
|
-
#### ProcessInputStepArgs
|
|
142
|
+
#### `ProcessInputStepArgs`
|
|
143
143
|
|
|
144
144
|
**messages** (`MastraDBMessage[]`): All messages including tool calls and results from previous steps (read-only snapshot).
|
|
145
145
|
|
|
@@ -171,7 +171,7 @@ processInputStep?(args: ProcessInputStepArgs): ProcessorMessageResult;
|
|
|
171
171
|
|
|
172
172
|
**requestContext** (`RequestContext`): Request-scoped context with execution metadata.
|
|
173
173
|
|
|
174
|
-
#### ProcessInputStepResult
|
|
174
|
+
#### `ProcessInputStepResult`
|
|
175
175
|
|
|
176
176
|
The method can return any combination of these properties:
|
|
177
177
|
|
|
@@ -222,7 +222,7 @@ System messages are **reset to their original values** at the start of each step
|
|
|
222
222
|
|
|
223
223
|
***
|
|
224
224
|
|
|
225
|
-
### processOutputStream
|
|
225
|
+
### `processOutputStream`
|
|
226
226
|
|
|
227
227
|
Processes streaming output chunks with built-in state management. Allows processors to accumulate chunks and make decisions based on larger context.
|
|
228
228
|
|
|
@@ -230,7 +230,7 @@ Processes streaming output chunks with built-in state management. Allows process
|
|
|
230
230
|
processOutputStream?(args: ProcessOutputStreamArgs): Promise<ChunkType | null | undefined>;
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-
#### ProcessOutputStreamArgs
|
|
233
|
+
#### `ProcessOutputStreamArgs`
|
|
234
234
|
|
|
235
235
|
**part** (`ChunkType`): The current stream chunk being processed.
|
|
236
236
|
|
|
@@ -255,7 +255,7 @@ processOutputStream?(args: ProcessOutputStreamArgs): Promise<ChunkType | null |
|
|
|
255
255
|
|
|
256
256
|
***
|
|
257
257
|
|
|
258
|
-
### processOutputResult
|
|
258
|
+
### `processOutputResult`
|
|
259
259
|
|
|
260
260
|
Processes the complete output result after streaming or generation is finished.
|
|
261
261
|
|
|
@@ -263,12 +263,16 @@ Processes the complete output result after streaming or generation is finished.
|
|
|
263
263
|
processOutputResult?(args: ProcessOutputResultArgs): ProcessorMessageResult;
|
|
264
264
|
```
|
|
265
265
|
|
|
266
|
-
#### ProcessOutputResultArgs
|
|
266
|
+
#### `ProcessOutputResultArgs`
|
|
267
267
|
|
|
268
268
|
**messages** (`MastraDBMessage[]`): The generated response messages.
|
|
269
269
|
|
|
270
270
|
**messageList** (`MessageList`): MessageList instance for managing messages.
|
|
271
271
|
|
|
272
|
+
**state** (`Record<string, unknown>`): Per-processor state that persists across all method calls within this request. Shared with processOutputStream and other methods.
|
|
273
|
+
|
|
274
|
+
**result** (`OutputResult`): Resolved generation result containing \`text\` (accumulated text), \`usage\` (token usage with inputTokens, outputTokens, totalTokens), \`finishReason\` (why generation ended), and \`steps\` (all LLM step results, each with toolCalls, toolResults, reasoning, sources, files, etc.).
|
|
275
|
+
|
|
272
276
|
**abort** (`(reason?: string) => never`): Function to abort processing.
|
|
273
277
|
|
|
274
278
|
**tracingContext** (`TracingContext`): Tracing context for observability.
|
|
@@ -279,7 +283,7 @@ processOutputResult?(args: ProcessOutputResultArgs): ProcessorMessageResult;
|
|
|
279
283
|
|
|
280
284
|
***
|
|
281
285
|
|
|
282
|
-
### processOutputStep
|
|
286
|
+
### `processOutputStep`
|
|
283
287
|
|
|
284
288
|
Processes output after each LLM response in the agentic loop, before tool execution. Unlike `processOutputResult` which runs once at the end, this runs at every step. This is the ideal method for implementing guardrails that can trigger retries.
|
|
285
289
|
|
|
@@ -287,7 +291,7 @@ Processes output after each LLM response in the agentic loop, before tool execut
|
|
|
287
291
|
processOutputStep?(args: ProcessOutputStepArgs): ProcessorMessageResult;
|
|
288
292
|
```
|
|
289
293
|
|
|
290
|
-
#### ProcessOutputStepArgs
|
|
294
|
+
#### `ProcessOutputStepArgs`
|
|
291
295
|
|
|
292
296
|
**messages** (`MastraDBMessage[]`): All messages including the latest LLM response.
|
|
293
297
|
|
|
@@ -388,7 +392,7 @@ export class LowercaseProcessor implements Processor {
|
|
|
388
392
|
}
|
|
389
393
|
```
|
|
390
394
|
|
|
391
|
-
### Per-step processor with processInputStep
|
|
395
|
+
### Per-step processor with `processInputStep`
|
|
392
396
|
|
|
393
397
|
```typescript
|
|
394
398
|
import type { Processor, ProcessInputStepArgs, ProcessInputStepResult } from '@mastra/core'
|
|
@@ -421,7 +425,7 @@ export class DynamicModelProcessor implements Processor {
|
|
|
421
425
|
}
|
|
422
426
|
```
|
|
423
427
|
|
|
424
|
-
### Message transformer with processInputStep
|
|
428
|
+
### Message transformer with `processInputStep`
|
|
425
429
|
|
|
426
430
|
```typescript
|
|
427
431
|
import type { Processor, MastraDBMessage } from '@mastra/core'
|
|
@@ -47,8 +47,8 @@ const processor = new TokenLimiterProcessor({
|
|
|
47
47
|
|
|
48
48
|
When used as an input processor, `TokenLimiterProcessor` throws a `TripWire` error in the following cases:
|
|
49
49
|
|
|
50
|
-
- **Empty messages**: If there are no messages to process, a TripWire is thrown because you
|
|
51
|
-
- **System messages exceed limit**: If system messages alone exceed the token limit, a TripWire is thrown because you
|
|
50
|
+
- **Empty messages**: If there are no messages to process, a TripWire is thrown because you can't send an LLM request with no messages.
|
|
51
|
+
- **System messages exceed limit**: If system messages alone exceed the token limit, a TripWire is thrown because you can't send an LLM request with only system messages and no user/assistant messages.
|
|
52
52
|
|
|
53
53
|
```typescript
|
|
54
54
|
import { TripWire } from '@mastra/core/agent'
|
|
@@ -57,7 +57,7 @@ The following parameters are available for all chunking strategies. **Important:
|
|
|
57
57
|
|
|
58
58
|
See [ExtractParams reference](https://mastra.ai/reference/rag/extract-params) for details on the `extract` parameter.
|
|
59
59
|
|
|
60
|
-
## Strategy-
|
|
60
|
+
## Strategy-specific options
|
|
61
61
|
|
|
62
62
|
Strategy-specific options are passed as top-level parameters alongside the strategy parameter. For example:
|
|
63
63
|
|
|
@@ -208,7 +208,7 @@ The options documented below are passed directly at the top level of the configu
|
|
|
208
208
|
|
|
209
209
|
The Latex strategy uses only the general chunking options listed above. It provides LaTeX-aware splitting optimized for mathematical and academic documents.
|
|
210
210
|
|
|
211
|
-
## Return
|
|
211
|
+
## Return value
|
|
212
212
|
|
|
213
213
|
Returns a `MDocument` instance containing the chunked documents. Each chunk includes:
|
|
214
214
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `DatabaseConfig` type allows you to specify database-specific configurations when using vector query tools. These configurations enable you to leverage unique features and optimizations offered by different vector stores.
|
|
4
4
|
|
|
5
|
-
## Type
|
|
5
|
+
## Type definition
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
8
|
export type DatabaseConfig = {
|
|
@@ -13,9 +13,9 @@ export type DatabaseConfig = {
|
|
|
13
13
|
}
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
## Database-
|
|
16
|
+
## Database-specific types
|
|
17
17
|
|
|
18
|
-
### PineconeConfig
|
|
18
|
+
### `PineconeConfig`
|
|
19
19
|
|
|
20
20
|
Configuration options specific to Pinecone vector store.
|
|
21
21
|
|
|
@@ -33,7 +33,7 @@ Configuration options specific to Pinecone vector store.
|
|
|
33
33
|
- Environment isolation (dev/staging/prod namespaces)
|
|
34
34
|
- Hybrid search combining semantic and keyword matching
|
|
35
35
|
|
|
36
|
-
### PgVectorConfig
|
|
36
|
+
### `PgVectorConfig`
|
|
37
37
|
|
|
38
38
|
Configuration options specific to PostgreSQL with pgvector extension.
|
|
39
39
|
|
|
@@ -55,7 +55,7 @@ Configuration options specific to PostgreSQL with pgvector extension.
|
|
|
55
55
|
- Quality filtering to remove irrelevant results
|
|
56
56
|
- Fine-tuning search accuracy vs speed tradeoffs
|
|
57
57
|
|
|
58
|
-
### ChromaConfig
|
|
58
|
+
### `ChromaConfig`
|
|
59
59
|
|
|
60
60
|
Configuration options specific to Chroma vector store.
|
|
61
61
|
|
|
@@ -88,7 +88,7 @@ whereDocument: { "$contains": "API documentation" }
|
|
|
88
88
|
- Content-based document filtering
|
|
89
89
|
- Complex query combinations
|
|
90
90
|
|
|
91
|
-
## Usage
|
|
91
|
+
## Usage examples
|
|
92
92
|
|
|
93
93
|
**Basic Usage**:
|
|
94
94
|
|
|
@@ -233,7 +233,7 @@ const vectorTool = createVectorQueryTool({
|
|
|
233
233
|
})
|
|
234
234
|
```
|
|
235
235
|
|
|
236
|
-
## Best
|
|
236
|
+
## Best practices
|
|
237
237
|
|
|
238
238
|
1. **Environment Configuration**: Use different namespaces or configurations for different environments
|
|
239
239
|
2. **Performance Tuning**: Start with default values and adjust based on your specific needs
|
|
@@ -241,7 +241,7 @@ const vectorTool = createVectorQueryTool({
|
|
|
241
241
|
4. **Runtime Flexibility**: Override configurations at runtime for dynamic scenarios
|
|
242
242
|
5. **Documentation**: Document your specific configuration choices for team members
|
|
243
243
|
|
|
244
|
-
## Migration
|
|
244
|
+
## Migration guide
|
|
245
245
|
|
|
246
246
|
Existing vector query tools continue to work without changes. To add database configurations:
|
|
247
247
|
|
|
@@ -8,9 +8,9 @@ The MDocument class processes documents for RAG applications. The main methods a
|
|
|
8
8
|
|
|
9
9
|
**type** (`'text' | 'html' | 'markdown' | 'json' | 'latex'`): Type of document content
|
|
10
10
|
|
|
11
|
-
## Static
|
|
11
|
+
## Static methods
|
|
12
12
|
|
|
13
|
-
### fromText()
|
|
13
|
+
### `fromText()`
|
|
14
14
|
|
|
15
15
|
Creates a document from plain text content.
|
|
16
16
|
|
|
@@ -18,7 +18,7 @@ Creates a document from plain text content.
|
|
|
18
18
|
static fromText(text: string, metadata?: Record<string, any>): MDocument
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
### fromHTML()
|
|
21
|
+
### `fromHTML()`
|
|
22
22
|
|
|
23
23
|
Creates a document from HTML content.
|
|
24
24
|
|
|
@@ -26,7 +26,7 @@ Creates a document from HTML content.
|
|
|
26
26
|
static fromHTML(html: string, metadata?: Record<string, any>): MDocument
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
### fromMarkdown()
|
|
29
|
+
### `fromMarkdown()`
|
|
30
30
|
|
|
31
31
|
Creates a document from Markdown content.
|
|
32
32
|
|
|
@@ -34,7 +34,7 @@ Creates a document from Markdown content.
|
|
|
34
34
|
static fromMarkdown(markdown: string, metadata?: Record<string, any>): MDocument
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
### fromJSON()
|
|
37
|
+
### `fromJSON()`
|
|
38
38
|
|
|
39
39
|
Creates a document from JSON content.
|
|
40
40
|
|
|
@@ -42,9 +42,9 @@ Creates a document from JSON content.
|
|
|
42
42
|
static fromJSON(json: string, metadata?: Record<string, any>): MDocument
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
## Instance
|
|
45
|
+
## Instance methods
|
|
46
46
|
|
|
47
|
-
### chunk()
|
|
47
|
+
### `chunk()`
|
|
48
48
|
|
|
49
49
|
Splits document into chunks and optionally extracts metadata.
|
|
50
50
|
|
|
@@ -54,7 +54,7 @@ async chunk(params?: ChunkParams): Promise<Chunk[]>
|
|
|
54
54
|
|
|
55
55
|
See [chunk() reference](https://mastra.ai/reference/rag/chunk) for detailed options.
|
|
56
56
|
|
|
57
|
-
### getDocs()
|
|
57
|
+
### `getDocs()`
|
|
58
58
|
|
|
59
59
|
Returns array of processed document chunks.
|
|
60
60
|
|
|
@@ -62,7 +62,7 @@ Returns array of processed document chunks.
|
|
|
62
62
|
getDocs(): Chunk[]
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
### getText()
|
|
65
|
+
### `getText()`
|
|
66
66
|
|
|
67
67
|
Returns array of text strings from chunks.
|
|
68
68
|
|
|
@@ -70,7 +70,7 @@ Returns array of text strings from chunks.
|
|
|
70
70
|
getText(): string[]
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
### getMetadata()
|
|
73
|
+
### `getMetadata()`
|
|
74
74
|
|
|
75
75
|
Returns array of metadata objects from chunks.
|
|
76
76
|
|
|
@@ -78,7 +78,7 @@ Returns array of metadata objects from chunks.
|
|
|
78
78
|
getMetadata(): Record<string, any>[]
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
### extractMetadata()
|
|
81
|
+
### `extractMetadata()`
|
|
82
82
|
|
|
83
83
|
Extracts metadata using specified extractors. See [ExtractParams reference](https://mastra.ai/reference/rag/extract-params) for details.
|
|
84
84
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Mastra uses the AI SDK's `embed` and `embedMany` functions to generate vector embeddings for text inputs, enabling similarity search and RAG workflows.
|
|
4
4
|
|
|
5
|
-
## Single
|
|
5
|
+
## Single embedding
|
|
6
6
|
|
|
7
7
|
The `embed` function generates a vector embedding for a single text input:
|
|
8
8
|
|
|
@@ -29,11 +29,11 @@ const result = await embed({
|
|
|
29
29
|
|
|
30
30
|
**headers** (`Record<string, string>`): Additional HTTP headers for the request (only for HTTP-based providers)
|
|
31
31
|
|
|
32
|
-
### Return
|
|
32
|
+
### Return value
|
|
33
33
|
|
|
34
34
|
**embedding** (`number[]`): The embedding vector for the input
|
|
35
35
|
|
|
36
|
-
## Multiple
|
|
36
|
+
## Multiple embeddings
|
|
37
37
|
|
|
38
38
|
For embedding multiple texts at once, use the `embedMany` function:
|
|
39
39
|
|
|
@@ -59,11 +59,11 @@ const result = await embedMany({
|
|
|
59
59
|
|
|
60
60
|
**headers** (`Record<string, string>`): Additional HTTP headers for the request (only for HTTP-based providers)
|
|
61
61
|
|
|
62
|
-
### Return
|
|
62
|
+
### Return value
|
|
63
63
|
|
|
64
64
|
**embeddings** (`number[][]`): Array of embedding vectors corresponding to the input values
|
|
65
65
|
|
|
66
|
-
## Example
|
|
66
|
+
## Example usage
|
|
67
67
|
|
|
68
68
|
```typescript
|
|
69
69
|
import { embed, embedMany } from 'ai'
|
|
@@ -38,9 +38,9 @@ The `extract` parameter accepts the following fields:
|
|
|
38
38
|
|
|
39
39
|
**schema** (`SchemaExtractArgs`): Enable structured metadata extraction using a Zod schema.
|
|
40
40
|
|
|
41
|
-
## Extractor
|
|
41
|
+
## Extractor arguments
|
|
42
42
|
|
|
43
|
-
### TitleExtractorsArgs
|
|
43
|
+
### `TitleExtractorsArgs`
|
|
44
44
|
|
|
45
45
|
**llm** (`MastraLanguageModel`): AI SDK language model to use for title extraction
|
|
46
46
|
|
|
@@ -50,7 +50,7 @@ The `extract` parameter accepts the following fields:
|
|
|
50
50
|
|
|
51
51
|
**combineTemplate** (`string`): Custom prompt template for combining titles. Must include {context} placeholder
|
|
52
52
|
|
|
53
|
-
### SummaryExtractArgs
|
|
53
|
+
### `SummaryExtractArgs`
|
|
54
54
|
|
|
55
55
|
**llm** (`MastraLanguageModel`): AI SDK language model to use for summary extraction
|
|
56
56
|
|
|
@@ -58,7 +58,7 @@ The `extract` parameter accepts the following fields:
|
|
|
58
58
|
|
|
59
59
|
**promptTemplate** (`string`): Custom prompt template for summary generation. Must include {context} placeholder
|
|
60
60
|
|
|
61
|
-
### QuestionAnswerExtractArgs
|
|
61
|
+
### `QuestionAnswerExtractArgs`
|
|
62
62
|
|
|
63
63
|
**llm** (`MastraLanguageModel`): AI SDK language model to use for question generation
|
|
64
64
|
|
|
@@ -68,7 +68,7 @@ The `extract` parameter accepts the following fields:
|
|
|
68
68
|
|
|
69
69
|
**embeddingOnly** (`boolean`): If true, only generate embeddings without actual questions
|
|
70
70
|
|
|
71
|
-
### KeywordExtractArgs
|
|
71
|
+
### `KeywordExtractArgs`
|
|
72
72
|
|
|
73
73
|
**llm** (`MastraLanguageModel`): AI SDK language model to use for keyword extraction
|
|
74
74
|
|
|
@@ -76,7 +76,7 @@ The `extract` parameter accepts the following fields:
|
|
|
76
76
|
|
|
77
77
|
**promptTemplate** (`string`): Custom prompt template for keyword extraction. Must include both {context} and {maxKeywords} placeholders
|
|
78
78
|
|
|
79
|
-
### SchemaExtractArgs
|
|
79
|
+
### `SchemaExtractArgs`
|
|
80
80
|
|
|
81
81
|
**schema** (`ZodType`): Zod schema defining the structure of the data to extract.
|
|
82
82
|
|
|
@@ -86,7 +86,7 @@ The `extract` parameter accepts the following fields:
|
|
|
86
86
|
|
|
87
87
|
**metadataKey** (`string`): Key to nest extraction results under. If omitted, results are spread into the metadata object.
|
|
88
88
|
|
|
89
|
-
## Advanced
|
|
89
|
+
## Advanced example
|
|
90
90
|
|
|
91
91
|
```typescript
|
|
92
92
|
import { MDocument } from '@mastra/rag'
|
|
@@ -145,7 +145,7 @@ const chunks = await doc.chunk({
|
|
|
145
145
|
// }
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
## Document
|
|
148
|
+
## Document grouping for title extraction
|
|
149
149
|
|
|
150
150
|
When using the `TitleExtractor`, you can group multiple chunks together for title extraction by specifying a shared `docId` in the `metadata` field of each chunk. All chunks with the same `docId` will receive the same extracted title. If no `docId` is set, each chunk is treated as its own document for title extraction.
|
|
151
151
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `GraphRAG` class implements a graph-based approach to retrieval augmented generation. It creates a knowledge graph from document chunks where nodes represent documents and edges represent semantic relationships, enabling both direct similarity matching and discovery of related content through graph traversal.
|
|
4
4
|
|
|
5
|
-
## Basic
|
|
5
|
+
## Basic usage
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
8
|
import { GraphRAG } from '@mastra/rag'
|
|
@@ -24,7 +24,7 @@ const results = await graphRag.query({
|
|
|
24
24
|
})
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
## Constructor
|
|
27
|
+
## Constructor parameters
|
|
28
28
|
|
|
29
29
|
**dimension** (`number`): Dimension of the embedding vectors (Default: `1536`)
|
|
30
30
|
|
|
@@ -32,7 +32,7 @@ const results = await graphRag.query({
|
|
|
32
32
|
|
|
33
33
|
## Methods
|
|
34
34
|
|
|
35
|
-
### createGraph
|
|
35
|
+
### `createGraph`
|
|
36
36
|
|
|
37
37
|
Creates a knowledge graph from document chunks and their embeddings.
|
|
38
38
|
|
|
@@ -86,7 +86,7 @@ Returns an array of `RankedNode` objects, where each node contains:
|
|
|
86
86
|
|
|
87
87
|
**score** (`number`): Combined relevance score from graph traversal
|
|
88
88
|
|
|
89
|
-
## Advanced
|
|
89
|
+
## Advanced example
|
|
90
90
|
|
|
91
91
|
```typescript
|
|
92
92
|
const graphRag = new GraphRAG({
|