@mastra/mcp-docs-server 1.0.0-beta.13 → 1.0.0-beta.15
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/organized/changelogs/%40mastra%2Fagent-builder.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +78 -78
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +173 -173
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +248 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +338 -338
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +33 -33
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +41 -41
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Flance.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +139 -139
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +219 -219
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +219 -219
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +235 -235
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +102 -102
- package/.docs/organized/changelogs/%40mastra%2Frag.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Freact.md +77 -70
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +218 -218
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +195 -195
- package/.docs/organized/changelogs/create-mastra.md +13 -13
- package/.docs/organized/changelogs/mastra.md +56 -56
- package/.docs/organized/code-examples/agent-v6.md +210 -0
- package/.docs/organized/code-examples/ai-elements.md +1 -1
- package/.docs/organized/code-examples/client-side-tools.md +1 -1
- package/.docs/raw/agents/adding-voice.mdx +10 -6
- package/.docs/raw/agents/agent-approval.mdx +5 -6
- package/.docs/raw/agents/agent-memory.mdx +22 -30
- package/.docs/raw/agents/guardrails.mdx +60 -50
- package/.docs/raw/agents/networks.mdx +8 -12
- package/.docs/raw/agents/overview.mdx +39 -23
- package/.docs/raw/agents/processors.mdx +20 -19
- package/.docs/raw/agents/structured-output.mdx +11 -7
- package/.docs/raw/agents/using-tools.mdx +4 -5
- package/.docs/raw/deployment/mastra-server.mdx +3 -3
- package/.docs/raw/deployment/overview.mdx +7 -1
- package/.docs/raw/deployment/web-framework.mdx +4 -6
- package/.docs/raw/deployment/workflow-runners.mdx +14 -0
- package/.docs/raw/evals/custom-scorers.mdx +9 -6
- package/.docs/raw/evals/overview.mdx +3 -6
- package/.docs/raw/evals/running-in-ci.mdx +2 -2
- package/.docs/raw/getting-started/manual-install.mdx +20 -20
- package/.docs/raw/getting-started/mcp-docs-server.mdx +2 -2
- package/.docs/raw/getting-started/studio.mdx +1 -1
- package/.docs/raw/guides/agent-frameworks/ai-sdk.mdx +4 -4
- package/.docs/raw/guides/build-your-ui/ai-sdk-ui.mdx +30 -30
- package/.docs/raw/guides/build-your-ui/assistant-ui.mdx +8 -8
- package/.docs/raw/guides/build-your-ui/copilotkit.mdx +11 -11
- package/.docs/raw/guides/deployment/amazon-ec2.mdx +9 -9
- package/.docs/raw/guides/deployment/aws-lambda.mdx +11 -11
- package/.docs/raw/guides/deployment/azure-app-services.mdx +2 -2
- package/.docs/raw/guides/deployment/cloudflare-deployer.mdx +5 -6
- package/.docs/raw/guides/deployment/digital-ocean.mdx +10 -10
- package/.docs/raw/guides/deployment/index.mdx +1 -1
- package/.docs/raw/guides/deployment/inngest.mdx +444 -0
- package/.docs/raw/guides/deployment/netlify-deployer.mdx +4 -4
- package/.docs/raw/guides/deployment/vercel-deployer.mdx +5 -6
- package/.docs/raw/guides/getting-started/astro.mdx +292 -451
- package/.docs/raw/guides/getting-started/express.mdx +7 -7
- package/.docs/raw/guides/getting-started/hono.mdx +18 -18
- package/.docs/raw/guides/getting-started/next-js.mdx +19 -20
- package/.docs/raw/guides/getting-started/quickstart.mdx +4 -4
- package/.docs/raw/guides/getting-started/sveltekit.mdx +238 -409
- package/.docs/raw/guides/getting-started/vite-react.mdx +21 -21
- package/.docs/raw/guides/guide/ai-recruiter.mdx +10 -10
- package/.docs/raw/guides/guide/chef-michel.mdx +9 -11
- package/.docs/raw/guides/guide/notes-mcp-server.mdx +15 -15
- package/.docs/raw/guides/guide/research-assistant.mdx +13 -13
- package/.docs/raw/guides/guide/stock-agent.mdx +5 -5
- package/.docs/raw/guides/guide/web-search.mdx +8 -8
- package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +7 -7
- package/.docs/raw/guides/migrations/ai-sdk-v4-to-v5.mdx +2 -2
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +1 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/memory.mdx +11 -3
- package/.docs/raw/guides/migrations/upgrade-to-v1/processors.mdx +11 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/storage.mdx +41 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +0 -2
- package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +21 -23
- package/.docs/raw/index.mdx +2 -2
- package/.docs/raw/mastra-cloud/deployment.mdx +39 -0
- package/.docs/raw/mastra-cloud/observability.mdx +9 -15
- package/.docs/raw/mastra-cloud/overview.mdx +14 -44
- package/.docs/raw/mastra-cloud/setup.mdx +64 -0
- package/.docs/raw/mastra-cloud/studio.mdx +35 -0
- package/.docs/raw/mcp/overview.mdx +31 -13
- package/.docs/raw/mcp/publishing-mcp-server.mdx +2 -2
- package/.docs/raw/memory/memory-processors.mdx +9 -9
- package/.docs/raw/memory/message-history.mdx +69 -0
- package/.docs/raw/memory/overview.mdx +34 -76
- package/.docs/raw/memory/semantic-recall.mdx +58 -49
- package/.docs/raw/memory/storage.mdx +188 -0
- package/.docs/raw/memory/working-memory.mdx +7 -7
- package/.docs/raw/observability/logging.mdx +9 -10
- package/.docs/raw/observability/overview.mdx +0 -1
- package/.docs/raw/observability/tracing/bridges/otel.mdx +2 -2
- package/.docs/raw/observability/tracing/exporters/default.mdx +3 -3
- package/.docs/raw/observability/tracing/exporters/langfuse.mdx +1 -2
- package/.docs/raw/observability/tracing/overview.mdx +23 -25
- package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +3 -3
- package/.docs/raw/rag/chunking-and-embedding.mdx +6 -6
- package/.docs/raw/rag/graph-rag.mdx +7 -7
- package/.docs/raw/rag/overview.mdx +1 -1
- package/.docs/raw/rag/retrieval.mdx +21 -22
- package/.docs/raw/rag/vector-databases.mdx +22 -22
- package/.docs/raw/reference/agents/agent.mdx +3 -3
- package/.docs/raw/reference/agents/generate.mdx +1 -1
- package/.docs/raw/reference/agents/generateLegacy.mdx +2 -2
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +2 -2
- package/.docs/raw/reference/agents/getDefaultOptions.mdx +2 -2
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +2 -2
- package/.docs/raw/reference/agents/getDescription.mdx +1 -1
- package/.docs/raw/reference/agents/getInstructions.mdx +2 -2
- package/.docs/raw/reference/agents/getLLM.mdx +2 -2
- package/.docs/raw/reference/agents/getMemory.mdx +2 -2
- package/.docs/raw/reference/agents/getModel.mdx +2 -2
- package/.docs/raw/reference/agents/getTools.mdx +2 -2
- package/.docs/raw/reference/agents/getVoice.mdx +2 -2
- package/.docs/raw/reference/agents/listAgents.mdx +2 -2
- package/.docs/raw/reference/agents/listScorers.mdx +2 -2
- package/.docs/raw/reference/agents/listTools.mdx +2 -2
- package/.docs/raw/reference/agents/listWorkflows.mdx +2 -2
- package/.docs/raw/reference/agents/network.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/chat-route.mdx +2 -2
- package/.docs/raw/reference/ai-sdk/handle-chat-stream.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/handle-network-stream.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/handle-workflow-stream.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/network-route.mdx +2 -2
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-stream.mdx +6 -6
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-v4-messages.mdx +3 -3
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-v5-messages.mdx +3 -3
- package/.docs/raw/reference/ai-sdk/with-mastra.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/workflow-route.mdx +2 -2
- package/.docs/raw/reference/auth/auth0.mdx +1 -2
- package/.docs/raw/reference/auth/clerk.mdx +1 -2
- package/.docs/raw/reference/auth/firebase.mdx +2 -4
- package/.docs/raw/reference/auth/jwt.mdx +1 -2
- package/.docs/raw/reference/auth/supabase.mdx +1 -2
- package/.docs/raw/reference/auth/workos.mdx +1 -2
- package/.docs/raw/reference/cli/create-mastra.mdx +10 -10
- package/.docs/raw/reference/cli/mastra.mdx +9 -9
- package/.docs/raw/reference/client-js/agents.mdx +1 -2
- package/.docs/raw/reference/client-js/mastra-client.mdx +1 -1
- package/.docs/raw/reference/core/getAgent.mdx +1 -1
- package/.docs/raw/reference/core/getAgentById.mdx +1 -1
- package/.docs/raw/reference/core/getDeployer.mdx +1 -1
- package/.docs/raw/reference/core/getLogger.mdx +1 -1
- package/.docs/raw/reference/core/getMCPServer.mdx +1 -1
- package/.docs/raw/reference/core/getMCPServerById.mdx +1 -1
- package/.docs/raw/reference/core/getMemory.mdx +2 -2
- package/.docs/raw/reference/core/getServer.mdx +1 -1
- package/.docs/raw/reference/core/getStorage.mdx +2 -2
- package/.docs/raw/reference/core/getStoredAgentById.mdx +3 -3
- package/.docs/raw/reference/core/getTelemetry.mdx +1 -1
- package/.docs/raw/reference/core/getVector.mdx +1 -1
- package/.docs/raw/reference/core/getWorkflow.mdx +1 -1
- package/.docs/raw/reference/core/listAgents.mdx +1 -1
- package/.docs/raw/reference/core/listLogs.mdx +1 -1
- package/.docs/raw/reference/core/listLogsByRunId.mdx +1 -1
- package/.docs/raw/reference/core/listMCPServers.mdx +1 -1
- package/.docs/raw/reference/core/listMemory.mdx +2 -2
- package/.docs/raw/reference/core/listStoredAgents.mdx +4 -4
- package/.docs/raw/reference/core/listVectors.mdx +1 -1
- package/.docs/raw/reference/core/listWorkflows.mdx +1 -1
- package/.docs/raw/reference/core/setLogger.mdx +1 -1
- package/.docs/raw/reference/core/setStorage.mdx +2 -2
- package/.docs/raw/reference/core/setTelemetry.mdx +1 -1
- package/.docs/raw/reference/deployer/cloudflare.mdx +1 -2
- package/.docs/raw/reference/deployer/deployer.mdx +0 -1
- package/.docs/raw/reference/deployer/netlify.mdx +1 -1
- package/.docs/raw/reference/deployer/vercel.mdx +2 -4
- package/.docs/raw/reference/evals/answer-relevancy.mdx +1 -1
- package/.docs/raw/reference/evals/answer-similarity.mdx +1 -1
- package/.docs/raw/reference/evals/bias.mdx +1 -1
- package/.docs/raw/reference/evals/completeness.mdx +1 -1
- package/.docs/raw/reference/evals/content-similarity.mdx +1 -1
- package/.docs/raw/reference/evals/context-precision.mdx +1 -1
- package/.docs/raw/reference/evals/faithfulness.mdx +1 -1
- package/.docs/raw/reference/evals/hallucination.mdx +1 -1
- package/.docs/raw/reference/evals/keyword-coverage.mdx +1 -1
- package/.docs/raw/reference/evals/prompt-alignment.mdx +7 -7
- package/.docs/raw/reference/evals/textual-difference.mdx +1 -1
- package/.docs/raw/reference/evals/tone-consistency.mdx +1 -1
- package/.docs/raw/reference/evals/tool-call-accuracy.mdx +10 -10
- package/.docs/raw/reference/evals/toxicity.mdx +1 -1
- package/.docs/raw/reference/logging/pino-logger.mdx +7 -8
- package/.docs/raw/reference/memory/createThread.mdx +2 -2
- package/.docs/raw/reference/memory/deleteMessages.mdx +2 -2
- package/.docs/raw/reference/memory/listThreadsByResourceId.mdx +2 -2
- package/.docs/raw/reference/memory/memory-class.mdx +3 -3
- package/.docs/raw/reference/memory/query.mdx +2 -2
- package/.docs/raw/reference/memory/recall.mdx +2 -2
- package/.docs/raw/reference/observability/tracing/exporters/langfuse.mdx +1 -1
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +2 -2
- package/.docs/raw/reference/processors/language-detector.mdx +2 -2
- package/.docs/raw/reference/processors/message-history-processor.mdx +2 -2
- package/.docs/raw/reference/processors/moderation-processor.mdx +3 -3
- package/.docs/raw/reference/processors/pii-detector.mdx +3 -3
- package/.docs/raw/reference/processors/processor-interface.mdx +13 -13
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +2 -2
- package/.docs/raw/reference/processors/semantic-recall-processor.mdx +2 -2
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +2 -2
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +40 -19
- package/.docs/raw/reference/processors/tool-call-filter.mdx +3 -3
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +2 -2
- package/.docs/raw/reference/processors/working-memory-processor.mdx +3 -3
- package/.docs/raw/reference/rag/chunk.mdx +1 -1
- package/.docs/raw/reference/rag/extract-params.mdx +2 -2
- package/.docs/raw/reference/rag/metadata-filters.mdx +7 -7
- package/.docs/raw/reference/server/create-route.mdx +13 -13
- package/.docs/raw/reference/server/express-adapter.mdx +6 -7
- package/.docs/raw/reference/server/hono-adapter.mdx +6 -7
- package/.docs/raw/reference/server/mastra-server.mdx +20 -20
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +7 -5
- package/.docs/raw/reference/storage/cloudflare.mdx +2 -2
- package/.docs/raw/reference/storage/convex.mdx +6 -6
- package/.docs/raw/reference/storage/dynamodb.mdx +4 -4
- package/.docs/raw/reference/storage/lance.mdx +6 -5
- package/.docs/raw/reference/storage/libsql.mdx +72 -54
- package/.docs/raw/reference/storage/mongodb.mdx +84 -9
- package/.docs/raw/reference/storage/mssql.mdx +8 -6
- package/.docs/raw/{memory → reference}/storage/overview.mdx +12 -110
- package/.docs/raw/reference/storage/postgresql.mdx +82 -9
- package/.docs/raw/reference/storage/upstash.mdx +74 -2
- package/.docs/raw/reference/streaming/agents/stream.mdx +5 -5
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +2 -2
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/resumeStream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/stream.mdx +2 -2
- package/.docs/raw/reference/streaming/workflows/timeTravelStream.mdx +4 -4
- package/.docs/raw/reference/templates/overview.mdx +1 -2
- package/.docs/raw/reference/tools/create-tool.mdx +1 -4
- package/.docs/raw/reference/tools/vector-query-tool.mdx +1 -1
- package/.docs/raw/reference/vectors/astra.mdx +3 -3
- package/.docs/raw/reference/vectors/chroma.mdx +3 -3
- package/.docs/raw/reference/vectors/convex.mdx +12 -12
- package/.docs/raw/reference/vectors/couchbase.mdx +5 -5
- package/.docs/raw/reference/vectors/duckdb.mdx +10 -10
- package/.docs/raw/reference/vectors/elasticsearch.mdx +4 -4
- package/.docs/raw/reference/vectors/lance.mdx +4 -4
- package/.docs/raw/reference/vectors/libsql.mdx +61 -11
- package/.docs/raw/reference/vectors/mongodb.mdx +58 -5
- package/.docs/raw/reference/vectors/pg.mdx +53 -6
- package/.docs/raw/reference/vectors/pinecone.mdx +3 -3
- package/.docs/raw/reference/vectors/qdrant.mdx +3 -3
- package/.docs/raw/reference/vectors/s3vectors.mdx +6 -6
- package/.docs/raw/reference/vectors/turbopuffer.mdx +4 -4
- package/.docs/raw/reference/vectors/upstash.mdx +55 -6
- package/.docs/raw/reference/vectors/vectorize.mdx +3 -3
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/restart.mdx +1 -3
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/start.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/startAsync.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/timeTravel.mdx +5 -5
- package/.docs/raw/reference/workflows/run.mdx +1 -1
- package/.docs/raw/reference/workflows/step.mdx +3 -3
- package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +3 -3
- package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +6 -6
- package/.docs/raw/reference/workflows/workflow-methods/map.mdx +7 -7
- package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/then.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow.mdx +3 -3
- package/.docs/raw/server/auth/auth0.mdx +20 -14
- package/.docs/raw/server/auth/clerk.mdx +16 -9
- package/.docs/raw/server/auth/firebase.mdx +21 -15
- package/.docs/raw/server/auth/jwt.mdx +14 -7
- package/.docs/raw/server/auth/supabase.mdx +16 -9
- package/.docs/raw/server/auth/workos.mdx +19 -13
- package/.docs/raw/server/custom-adapters.mdx +10 -10
- package/.docs/raw/server/custom-api-routes.mdx +2 -4
- package/.docs/raw/server/mastra-client.mdx +24 -13
- package/.docs/raw/server/mastra-server.mdx +3 -3
- package/.docs/raw/server/middleware.mdx +7 -7
- package/.docs/raw/server/request-context.mdx +31 -30
- package/.docs/raw/server/server-adapters.mdx +6 -6
- package/.docs/raw/streaming/events.mdx +14 -7
- package/.docs/raw/streaming/overview.mdx +21 -10
- package/.docs/raw/streaming/tool-streaming.mdx +6 -6
- package/.docs/raw/streaming/workflow-streaming.mdx +6 -8
- package/.docs/raw/tools-mcp/advanced-usage.mdx +2 -2
- package/.docs/raw/tools-mcp/mcp-overview.mdx +31 -12
- package/.docs/raw/tools-mcp/overview.mdx +9 -10
- package/.docs/raw/voice/overview.mdx +2 -2
- package/.docs/raw/workflows/agents-and-tools.mdx +28 -19
- package/.docs/raw/workflows/control-flow.mdx +27 -40
- package/.docs/raw/workflows/error-handling.mdx +15 -22
- package/.docs/raw/workflows/human-in-the-loop.mdx +6 -7
- package/.docs/raw/workflows/input-data-mapping.mdx +7 -7
- package/.docs/raw/workflows/overview.mdx +34 -23
- package/.docs/raw/workflows/snapshots.mdx +16 -45
- package/.docs/raw/workflows/suspend-and-resume.mdx +7 -7
- package/.docs/raw/workflows/time-travel.mdx +16 -16
- package/.docs/raw/workflows/workflow-state.mdx +5 -8
- package/CHANGELOG.md +16 -0
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/stdio.js +53 -0
- package/package.json +3 -3
- package/.docs/raw/mastra-cloud/dashboard.mdx +0 -96
- package/.docs/raw/mastra-cloud/setting-up.mdx +0 -102
- package/.docs/raw/memory/conversation-history.mdx +0 -24
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +0 -140
- package/.docs/raw/memory/storage/memory-with-mongodb.mdx +0 -150
- package/.docs/raw/memory/storage/memory-with-pg.mdx +0 -138
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +0 -146
- package/.docs/raw/memory/threads-and-resources.mdx +0 -95
- package/.docs/raw/workflows/inngest-workflow.mdx +0 -363
|
@@ -21,12 +21,11 @@ Traces are created by:
|
|
|
21
21
|
|
|
22
22
|
### Basic Config
|
|
23
23
|
|
|
24
|
-
```ts title="src/mastra/index.ts"
|
|
24
|
+
```ts title="src/mastra/index.ts"
|
|
25
25
|
import { Mastra } from "@mastra/core";
|
|
26
26
|
import { Observability } from "@mastra/observability";
|
|
27
27
|
|
|
28
28
|
export const mastra = new Mastra({
|
|
29
|
-
// ... other config
|
|
30
29
|
observability: new Observability({
|
|
31
30
|
default: { enabled: true }, // Enables DefaultExporter and CloudExporter
|
|
32
31
|
}),
|
|
@@ -50,7 +49,7 @@ When enabled, the default configuration automatically includes:
|
|
|
50
49
|
|
|
51
50
|
This default configuration is a minimal helper that equates to this more verbose configuration:
|
|
52
51
|
|
|
53
|
-
```ts title="src/mastra/index.ts"
|
|
52
|
+
```ts title="src/mastra/index.ts"
|
|
54
53
|
import {
|
|
55
54
|
Observability,
|
|
56
55
|
CloudExporter,
|
|
@@ -59,7 +58,6 @@ import {
|
|
|
59
58
|
} from "@mastra/observability";
|
|
60
59
|
|
|
61
60
|
export const mastra = new Mastra({
|
|
62
|
-
// ... other config
|
|
63
61
|
observability: new Observability({
|
|
64
62
|
configs: {
|
|
65
63
|
default: {
|
|
@@ -174,7 +172,7 @@ sampling: {
|
|
|
174
172
|
|
|
175
173
|
### Complete Example
|
|
176
174
|
|
|
177
|
-
```ts title="src/mastra/index.ts"
|
|
175
|
+
```ts title="src/mastra/index.ts"
|
|
178
176
|
export const mastra = new Mastra({
|
|
179
177
|
observability: new Observability({
|
|
180
178
|
configs: {
|
|
@@ -214,7 +212,7 @@ Note that only a single config can be used for a specific execution. But a singl
|
|
|
214
212
|
|
|
215
213
|
Use `configSelector` to choose the appropriate tracing configuration based on request context:
|
|
216
214
|
|
|
217
|
-
```ts title="src/mastra/index.ts"
|
|
215
|
+
```ts title="src/mastra/index.ts"
|
|
218
216
|
export const mastra = new Mastra({
|
|
219
217
|
observability: new Observability({
|
|
220
218
|
configs: {
|
|
@@ -259,7 +257,7 @@ export const mastra = new Mastra({
|
|
|
259
257
|
|
|
260
258
|
A common pattern is to select configurations based on deployment environment:
|
|
261
259
|
|
|
262
|
-
```ts title="src/mastra/index.ts"
|
|
260
|
+
```ts title="src/mastra/index.ts"
|
|
263
261
|
export const mastra = new Mastra({
|
|
264
262
|
observability: new Observability({
|
|
265
263
|
configs: {
|
|
@@ -293,7 +291,7 @@ export const mastra = new Mastra({
|
|
|
293
291
|
|
|
294
292
|
Having both the default config enabled and adding custom configs is an invalid configuration of Observability. Use either the default or custom config, but not both.
|
|
295
293
|
|
|
296
|
-
```ts title="src/mastra/index.ts"
|
|
294
|
+
```ts title="src/mastra/index.ts"
|
|
297
295
|
export const mastra = new Mastra({
|
|
298
296
|
observability: new Observability({
|
|
299
297
|
default: { enabled: true }, // This will always be used!
|
|
@@ -311,7 +309,7 @@ export const mastra = new Mastra({
|
|
|
311
309
|
|
|
312
310
|
When creating a custom config with external exporters, you might lose access to Studio and Cloud. To maintain access while adding external exporters, include the default exporters in your custom config:
|
|
313
311
|
|
|
314
|
-
```ts title="src/mastra/index.ts"
|
|
312
|
+
```ts title="src/mastra/index.ts"
|
|
315
313
|
import { DefaultExporter, CloudExporter } from "@mastra/observability";
|
|
316
314
|
import { ArizeExporter } from "@mastra/arize";
|
|
317
315
|
|
|
@@ -354,7 +352,7 @@ Custom metadata allows you to attach additional context to your traces, making i
|
|
|
354
352
|
|
|
355
353
|
You can add metadata to any span using the tracing context:
|
|
356
354
|
|
|
357
|
-
```ts
|
|
355
|
+
```ts
|
|
358
356
|
execute: async ({ inputData, tracingContext }) => {
|
|
359
357
|
const startTime = Date.now();
|
|
360
358
|
const response = await fetch(inputData.endpoint);
|
|
@@ -384,7 +382,7 @@ Instead of manually adding metadata to each span, you can configure Mastra to au
|
|
|
384
382
|
|
|
385
383
|
Define which RequestContext keys to extract in your tracing configuration. These keys will be automatically included as metadata for all spans created with this configuration:
|
|
386
384
|
|
|
387
|
-
```ts title="src/mastra/index.ts"
|
|
385
|
+
```ts title="src/mastra/index.ts"
|
|
388
386
|
export const mastra = new Mastra({
|
|
389
387
|
observability: new Observability({
|
|
390
388
|
configs: {
|
|
@@ -400,7 +398,7 @@ export const mastra = new Mastra({
|
|
|
400
398
|
|
|
401
399
|
Now when you execute agents or workflows with a RequestContext, these values are automatically extracted:
|
|
402
400
|
|
|
403
|
-
```ts
|
|
401
|
+
```ts
|
|
404
402
|
const requestContext = new RequestContext();
|
|
405
403
|
requestContext.set("userId", "user-123");
|
|
406
404
|
requestContext.set("environment", "production");
|
|
@@ -417,7 +415,7 @@ const result = await agent.generate({
|
|
|
417
415
|
|
|
418
416
|
You can add trace-specific keys using `tracingOptions.requestContextKeys`. These are merged with the configuration-level keys:
|
|
419
417
|
|
|
420
|
-
```ts
|
|
418
|
+
```ts
|
|
421
419
|
const requestContext = new RequestContext();
|
|
422
420
|
requestContext.set("userId", "user-123");
|
|
423
421
|
requestContext.set("environment", "production");
|
|
@@ -438,7 +436,7 @@ const result = await agent.generate({
|
|
|
438
436
|
|
|
439
437
|
Use dot notation to extract nested values from RequestContext:
|
|
440
438
|
|
|
441
|
-
```ts
|
|
439
|
+
```ts
|
|
442
440
|
export const mastra = new Mastra({
|
|
443
441
|
observability: new Observability({
|
|
444
442
|
configs: {
|
|
@@ -470,7 +468,7 @@ Tags are string labels that help you categorize and filter traces. Unlike metada
|
|
|
470
468
|
|
|
471
469
|
Use `tracingOptions.tags` to add tags when executing agents or workflows:
|
|
472
470
|
|
|
473
|
-
```ts
|
|
471
|
+
```ts
|
|
474
472
|
// With agents
|
|
475
473
|
const result = await agent.generate({
|
|
476
474
|
messages: [{ role: "user", content: "Hello" }],
|
|
@@ -500,7 +498,7 @@ const result = await run.start({
|
|
|
500
498
|
- **OtelBridge** - `mastra.tags` span attribute
|
|
501
499
|
- **Combinable with metadata**: You can use both `tags` and `metadata` in the same `tracingOptions`
|
|
502
500
|
|
|
503
|
-
```ts
|
|
501
|
+
```ts
|
|
504
502
|
const result = await agent.generate({
|
|
505
503
|
messages: [{ role: "user", content: "Analyze this" }],
|
|
506
504
|
tracingOptions: {
|
|
@@ -522,7 +520,7 @@ const result = await agent.generate({
|
|
|
522
520
|
|
|
523
521
|
When creating child spans within tools or workflow steps, you can pass the `requestContext` parameter to enable metadata extraction:
|
|
524
522
|
|
|
525
|
-
```ts
|
|
523
|
+
```ts
|
|
526
524
|
execute: async ({ tracingContext, requestContext }) => {
|
|
527
525
|
// Create child span WITH requestContext - gets metadata extraction
|
|
528
526
|
const dbSpan = tracingContext.currentSpan?.createChildSpan({
|
|
@@ -553,7 +551,7 @@ Child spans allow you to track fine-grained operations within your workflow step
|
|
|
553
551
|
|
|
554
552
|
Create child spans inside a tool call or workflow step to track specific operations:
|
|
555
553
|
|
|
556
|
-
```ts
|
|
554
|
+
```ts
|
|
557
555
|
execute: async ({ inputData, tracingContext }) => {
|
|
558
556
|
// Create another child span for the main database operation
|
|
559
557
|
const querySpan = tracingContext.currentSpan?.createChildSpan({
|
|
@@ -598,7 +596,7 @@ Span processors allow you to transform, filter, or enrich trace data before it's
|
|
|
598
596
|
|
|
599
597
|
You can create custom span processors by implementing the `SpanOutputProcessor` interface. Here's a simple example that converts all input text in spans to lowercase:
|
|
600
598
|
|
|
601
|
-
```ts title="src/processors/lowercase-input-processor.ts"
|
|
599
|
+
```ts title="src/processors/lowercase-input-processor.ts"
|
|
602
600
|
import type { SpanOutputProcessor, AnySpan } from "@mastra/observability";
|
|
603
601
|
|
|
604
602
|
export class LowercaseInputProcessor implements SpanOutputProcessor {
|
|
@@ -643,7 +641,7 @@ When you execute agents or workflows with tracing enabled, the response includes
|
|
|
643
641
|
|
|
644
642
|
Both `generate` and `stream` methods return the trace ID in their response:
|
|
645
643
|
|
|
646
|
-
```ts
|
|
644
|
+
```ts
|
|
647
645
|
// Using generate
|
|
648
646
|
const result = await agent.generate({
|
|
649
647
|
messages: [{ role: "user", content: "Hello" }],
|
|
@@ -663,7 +661,7 @@ console.log("Trace ID:", streamResult.traceId);
|
|
|
663
661
|
|
|
664
662
|
Workflow executions also return trace IDs:
|
|
665
663
|
|
|
666
|
-
```ts
|
|
664
|
+
```ts
|
|
667
665
|
// Create a workflow run
|
|
668
666
|
const run = await mastra.getWorkflow("myWorkflow").createRun();
|
|
669
667
|
|
|
@@ -703,7 +701,7 @@ When running Mastra agents or workflows within applications that have existing d
|
|
|
703
701
|
|
|
704
702
|
Use the `tracingOptions` parameter to specify the trace context from your parent system:
|
|
705
703
|
|
|
706
|
-
```ts
|
|
704
|
+
```ts
|
|
707
705
|
// Get trace context from your existing tracing system
|
|
708
706
|
const parentTraceId = getCurrentTraceId(); // Your tracing system
|
|
709
707
|
const parentSpanId = getCurrentSpanId(); // Your tracing system
|
|
@@ -723,7 +721,7 @@ const result = await agent.generate("Analyze this data", {
|
|
|
723
721
|
|
|
724
722
|
Integration with OpenTelemetry allows Mastra traces to appear seamlessly in your existing observability platform:
|
|
725
723
|
|
|
726
|
-
```ts
|
|
724
|
+
```ts
|
|
727
725
|
import { trace } from "@opentelemetry/api";
|
|
728
726
|
|
|
729
727
|
// Get the current OpenTelemetry span
|
|
@@ -744,7 +742,7 @@ if (spanContext) {
|
|
|
744
742
|
|
|
745
743
|
Workflows support the same pattern for trace propagation:
|
|
746
744
|
|
|
747
|
-
```ts
|
|
745
|
+
```ts
|
|
748
746
|
const workflow = mastra.getWorkflow("data-pipeline");
|
|
749
747
|
const run = await workflow.createRun();
|
|
750
748
|
|
|
@@ -775,7 +773,7 @@ This ensures tracing never crashes your application, even with malformed input.
|
|
|
775
773
|
|
|
776
774
|
Here's a complete example showing trace propagation in an Express application:
|
|
777
775
|
|
|
778
|
-
```ts
|
|
776
|
+
```ts
|
|
779
777
|
import { trace } from "@opentelemetry/api";
|
|
780
778
|
import express from "express";
|
|
781
779
|
|
|
@@ -11,7 +11,7 @@ The Sensitive Data Filter is a span processor that automatically redacts sensiti
|
|
|
11
11
|
|
|
12
12
|
By default, the Sensitive Data Filter is automatically enabled when you use the standard Mastra configuration:
|
|
13
13
|
|
|
14
|
-
```ts title="src/mastra/index.ts"
|
|
14
|
+
```ts title="src/mastra/index.ts"
|
|
15
15
|
export const mastra = new Mastra({
|
|
16
16
|
observability: new Observability({
|
|
17
17
|
default: { enabled: true }, // Automatically includes SensitiveDataFilter
|
|
@@ -63,7 +63,7 @@ When a sensitive field is detected, its value is replaced with `[REDACTED]` by d
|
|
|
63
63
|
|
|
64
64
|
You can customize which fields are redacted and how redaction appears:
|
|
65
65
|
|
|
66
|
-
```ts title="src/mastra/index.ts"
|
|
66
|
+
```ts title="src/mastra/index.ts"
|
|
67
67
|
import { SensitiveDataFilter, DefaultExporter, Observability } from "@mastra/observability";
|
|
68
68
|
|
|
69
69
|
export const mastra = new Mastra({
|
|
@@ -210,7 +210,7 @@ The Sensitive Data Filter is designed to be lightweight and efficient:
|
|
|
210
210
|
|
|
211
211
|
If you need to disable sensitive data filtering (not recommended for production):
|
|
212
212
|
|
|
213
|
-
```ts title="src/mastra/index.ts"
|
|
213
|
+
```ts title="src/mastra/index.ts"
|
|
214
214
|
export const mastra = new Mastra({
|
|
215
215
|
observability: new Observability({
|
|
216
216
|
configs: {
|
|
@@ -7,7 +7,7 @@ description: Guide on chunking and embedding documents in Mastra for efficient p
|
|
|
7
7
|
|
|
8
8
|
Before processing, create a MDocument instance from your content. You can initialize it from various formats:
|
|
9
9
|
|
|
10
|
-
```ts
|
|
10
|
+
```ts
|
|
11
11
|
const docFromText = MDocument.fromText("Your plain text content...");
|
|
12
12
|
const docFromHTML = MDocument.fromHTML("<html>Your HTML content...</html>");
|
|
13
13
|
const docFromMarkdown = MDocument.fromMarkdown("# Your Markdown content...");
|
|
@@ -34,7 +34,7 @@ Each strategy accepts different parameters optimized for its chunking approach.
|
|
|
34
34
|
|
|
35
35
|
Here's an example of how to use the `recursive` strategy:
|
|
36
36
|
|
|
37
|
-
```ts
|
|
37
|
+
```ts
|
|
38
38
|
const chunks = await doc.chunk({
|
|
39
39
|
strategy: "recursive",
|
|
40
40
|
maxSize: 512,
|
|
@@ -48,7 +48,7 @@ const chunks = await doc.chunk({
|
|
|
48
48
|
|
|
49
49
|
For text where preserving sentence structure is important, here's an example of how to use the `sentence` strategy:
|
|
50
50
|
|
|
51
|
-
```ts
|
|
51
|
+
```ts
|
|
52
52
|
const chunks = await doc.chunk({
|
|
53
53
|
strategy: "sentence",
|
|
54
54
|
maxSize: 450,
|
|
@@ -61,7 +61,7 @@ const chunks = await doc.chunk({
|
|
|
61
61
|
|
|
62
62
|
For markdown documents where preserving the semantic relationships between sections is important, here's an example of how to use the `semantic-markdown` strategy:
|
|
63
63
|
|
|
64
|
-
```ts
|
|
64
|
+
```ts
|
|
65
65
|
const chunks = await doc.chunk({
|
|
66
66
|
strategy: "semantic-markdown",
|
|
67
67
|
joinThreshold: 500,
|
|
@@ -83,7 +83,7 @@ Transform chunks into embeddings using your preferred provider. Mastra supports
|
|
|
83
83
|
|
|
84
84
|
The simplest way is to use Mastra's model router with `provider/model` strings:
|
|
85
85
|
|
|
86
|
-
```ts
|
|
86
|
+
```ts
|
|
87
87
|
import { ModelRouterEmbeddingModel } from "@mastra/core/llm";
|
|
88
88
|
import { embedMany } from "ai";
|
|
89
89
|
|
|
@@ -142,7 +142,7 @@ When storing embeddings, the vector database index must be configured to match t
|
|
|
142
142
|
|
|
143
143
|
Here's an example showing document processing and embedding generation with both providers:
|
|
144
144
|
|
|
145
|
-
```ts
|
|
145
|
+
```ts
|
|
146
146
|
import { embedMany } from "ai";
|
|
147
147
|
|
|
148
148
|
import { MDocument } from "@mastra/rag";
|
|
@@ -34,7 +34,7 @@ This process helps surface information that might not be semantically similar to
|
|
|
34
34
|
|
|
35
35
|
The Graph Query Tool provides agents with the ability to perform graph-based retrieval:
|
|
36
36
|
|
|
37
|
-
```ts
|
|
37
|
+
```ts
|
|
38
38
|
import { createGraphRAGTool } from "@mastra/rag";
|
|
39
39
|
import { ModelRouterEmbeddingModel } from "@mastra/core/llm";
|
|
40
40
|
|
|
@@ -55,7 +55,7 @@ The `graphOptions` parameter controls how the knowledge graph is built and trave
|
|
|
55
55
|
- `threshold`: Similarity threshold (0-1) for determining which chunks are related. Higher values create sparser graphs with stronger connections; lower values create denser graphs with more potential relationships.
|
|
56
56
|
- `dimension`: Vector embedding dimension. Must match the embedding model's output dimension (e.g., 1536 for OpenAI's text-embedding-3-small).
|
|
57
57
|
|
|
58
|
-
```ts
|
|
58
|
+
```ts
|
|
59
59
|
const graphQueryTool = createGraphRAGTool({
|
|
60
60
|
vectorStoreName: "pgVector",
|
|
61
61
|
indexName: "embeddings",
|
|
@@ -71,7 +71,7 @@ const graphQueryTool = createGraphRAGTool({
|
|
|
71
71
|
|
|
72
72
|
Integrate the graph query tool with an agent to enable graph-based retrieval:
|
|
73
73
|
|
|
74
|
-
```ts
|
|
74
|
+
```ts
|
|
75
75
|
import { Agent } from "@mastra/core/agent";
|
|
76
76
|
|
|
77
77
|
const ragAgent = new Agent({
|
|
@@ -91,7 +91,7 @@ Base your answers on the context provided by the tool, and clearly state if the
|
|
|
91
91
|
|
|
92
92
|
Before using graph-based retrieval, process documents into chunks and store their embeddings:
|
|
93
93
|
|
|
94
|
-
```ts
|
|
94
|
+
```ts
|
|
95
95
|
import { MDocument } from "@mastra/rag";
|
|
96
96
|
import { embedMany } from "ai";
|
|
97
97
|
import { ModelRouterEmbeddingModel } from "@mastra/core/llm";
|
|
@@ -129,7 +129,7 @@ await vectorStore.upsert({
|
|
|
129
129
|
|
|
130
130
|
Once configured, the agent can perform graph-based queries:
|
|
131
131
|
|
|
132
|
-
```ts
|
|
132
|
+
```ts
|
|
133
133
|
const query = "What are the effects of infrastructure changes on local businesses?";
|
|
134
134
|
const response = await ragAgent.generate(query);
|
|
135
135
|
console.log(response.text);
|
|
@@ -153,7 +153,7 @@ The threshold parameter significantly impacts retrieval quality:
|
|
|
153
153
|
|
|
154
154
|
Start with 0.7 and adjust based on your specific use case:
|
|
155
155
|
|
|
156
|
-
```ts
|
|
156
|
+
```ts
|
|
157
157
|
// Strict connections for precise answers
|
|
158
158
|
const strictGraphTool = createGraphRAGTool({
|
|
159
159
|
vectorStoreName: "pgVector",
|
|
@@ -179,7 +179,7 @@ const broadGraphTool = createGraphRAGTool({
|
|
|
179
179
|
|
|
180
180
|
GraphRAG can be used alongside other retrieval approaches:
|
|
181
181
|
|
|
182
|
-
```ts
|
|
182
|
+
```ts
|
|
183
183
|
import { createVectorQueryTool } from "@mastra/rag";
|
|
184
184
|
|
|
185
185
|
const vectorQueryTool = createVectorQueryTool({
|
|
@@ -18,7 +18,7 @@ Mastra's RAG system provides:
|
|
|
18
18
|
|
|
19
19
|
To implement RAG, you process your documents into chunks, create embeddings, store them in a vector database, and then retrieve relevant context at query time.
|
|
20
20
|
|
|
21
|
-
```ts
|
|
21
|
+
```ts
|
|
22
22
|
import { embedMany } from "ai";
|
|
23
23
|
import { PgVector } from "@mastra/pg";
|
|
24
24
|
import { MDocument } from "@mastra/rag";
|
|
@@ -26,7 +26,7 @@ Mastra provides flexible retrieval options with support for semantic search, fil
|
|
|
26
26
|
|
|
27
27
|
The simplest approach is direct semantic search. This method uses vector similarity to find chunks that are semantically similar to the query:
|
|
28
28
|
|
|
29
|
-
```ts
|
|
29
|
+
```ts
|
|
30
30
|
import { embed } from "ai";
|
|
31
31
|
import { PgVector } from "@mastra/pg";
|
|
32
32
|
import { ModelRouterEmbeddingModel } from "@mastra/core/llm";
|
|
@@ -56,7 +56,7 @@ The `topK` parameter specifies the maximum number of most similar results to ret
|
|
|
56
56
|
|
|
57
57
|
Results include both the text content and a similarity score:
|
|
58
58
|
|
|
59
|
-
```ts
|
|
59
|
+
```ts
|
|
60
60
|
[
|
|
61
61
|
{
|
|
62
62
|
text: "Climate change poses significant challenges...",
|
|
@@ -68,7 +68,6 @@ Results include both the text content and a similarity score:
|
|
|
68
68
|
score: 0.82,
|
|
69
69
|
metadata: { source: "article1.txt" },
|
|
70
70
|
},
|
|
71
|
-
// ... more results
|
|
72
71
|
];
|
|
73
72
|
```
|
|
74
73
|
|
|
@@ -84,7 +83,7 @@ For detailed information about available operators and syntax, see the [Metadata
|
|
|
84
83
|
|
|
85
84
|
Basic filtering examples:
|
|
86
85
|
|
|
87
|
-
```ts
|
|
86
|
+
```ts
|
|
88
87
|
// Simple equality filter
|
|
89
88
|
const results = await pgVector.query({
|
|
90
89
|
indexName: "embeddings",
|
|
@@ -152,7 +151,7 @@ Common use cases for metadata filtering:
|
|
|
152
151
|
|
|
153
152
|
Sometimes you want to give your agent the ability to query a vector database directly. The Vector Query Tool allows your agent to be in charge of retrieval decisions, combining semantic search with optional filtering and reranking based on the agent's understanding of the user's needs.
|
|
154
153
|
|
|
155
|
-
```ts
|
|
154
|
+
```ts
|
|
156
155
|
import { createVectorQueryTool } from "@mastra/rag";
|
|
157
156
|
import { ModelRouterEmbeddingModel } from "@mastra/core/llm";
|
|
158
157
|
|
|
@@ -182,7 +181,7 @@ These configurations are for **query-time options** like namespaces, performance
|
|
|
182
181
|
Connection credentials (URLs, auth tokens) are configured when you instantiate the vector store class (e.g., `new LibSQLVector({ connectionUrl: '...' })`).
|
|
183
182
|
:::
|
|
184
183
|
|
|
185
|
-
```ts
|
|
184
|
+
```ts
|
|
186
185
|
import { createVectorQueryTool } from "@mastra/rag";
|
|
187
186
|
import { ModelRouterEmbeddingModel } from "@mastra/core/llm";
|
|
188
187
|
|
|
@@ -257,7 +256,7 @@ const lanceQueryTool = createVectorQueryTool({
|
|
|
257
256
|
|
|
258
257
|
You can also override these configurations at runtime using the request context:
|
|
259
258
|
|
|
260
|
-
```ts
|
|
259
|
+
```ts
|
|
261
260
|
import { RequestContext } from "@mastra/core/request-context";
|
|
262
261
|
|
|
263
262
|
const requestContext = new RequestContext();
|
|
@@ -284,7 +283,7 @@ When implementing filtering, these prompts are required in the agent's instructi
|
|
|
284
283
|
<Tabs>
|
|
285
284
|
<TabItem value="pgvector" label="pgVector">
|
|
286
285
|
|
|
287
|
-
```ts
|
|
286
|
+
```ts
|
|
288
287
|
import { PGVECTOR_PROMPT } from "@mastra/pg";
|
|
289
288
|
|
|
290
289
|
export const ragAgent = new Agent({
|
|
@@ -303,7 +302,7 @@ export const ragAgent = new Agent({
|
|
|
303
302
|
|
|
304
303
|
<TabItem value="pinecone" label="Pinecone">
|
|
305
304
|
|
|
306
|
-
```ts title="vector-store.ts"
|
|
305
|
+
```ts title="vector-store.ts"
|
|
307
306
|
import { PINECONE_PROMPT } from "@mastra/pinecone";
|
|
308
307
|
|
|
309
308
|
export const ragAgent = new Agent({
|
|
@@ -322,7 +321,7 @@ export const ragAgent = new Agent({
|
|
|
322
321
|
|
|
323
322
|
<TabItem value="qdrant" label="Qdrant">
|
|
324
323
|
|
|
325
|
-
```ts title="vector-store.ts"
|
|
324
|
+
```ts title="vector-store.ts"
|
|
326
325
|
import { QDRANT_PROMPT } from "@mastra/qdrant";
|
|
327
326
|
|
|
328
327
|
export const ragAgent = new Agent({
|
|
@@ -341,7 +340,7 @@ export const ragAgent = new Agent({
|
|
|
341
340
|
|
|
342
341
|
<TabItem value="chroma" label="Chroma">
|
|
343
342
|
|
|
344
|
-
```ts title="vector-store.ts"
|
|
343
|
+
```ts title="vector-store.ts"
|
|
345
344
|
import { CHROMA_PROMPT } from "@mastra/chroma";
|
|
346
345
|
|
|
347
346
|
export const ragAgent = new Agent({
|
|
@@ -360,7 +359,7 @@ export const ragAgent = new Agent({
|
|
|
360
359
|
|
|
361
360
|
<TabItem value="astra" label="Astra">
|
|
362
361
|
|
|
363
|
-
```ts title="vector-store.ts"
|
|
362
|
+
```ts title="vector-store.ts"
|
|
364
363
|
import { ASTRA_PROMPT } from "@mastra/astra";
|
|
365
364
|
|
|
366
365
|
export const ragAgent = new Agent({
|
|
@@ -377,9 +376,9 @@ export const ragAgent = new Agent({
|
|
|
377
376
|
|
|
378
377
|
</TabItem>
|
|
379
378
|
|
|
380
|
-
<TabItem value="libsql" label="
|
|
379
|
+
<TabItem value="libsql" label="libSQL">
|
|
381
380
|
|
|
382
|
-
```ts title="vector-store.ts"
|
|
381
|
+
```ts title="vector-store.ts"
|
|
383
382
|
import { LIBSQL_PROMPT } from "@mastra/libsql";
|
|
384
383
|
|
|
385
384
|
export const ragAgent = new Agent({
|
|
@@ -398,7 +397,7 @@ export const ragAgent = new Agent({
|
|
|
398
397
|
|
|
399
398
|
<TabItem value="upstash" label="Upstash">
|
|
400
399
|
|
|
401
|
-
```ts title="vector-store.ts"
|
|
400
|
+
```ts title="vector-store.ts"
|
|
402
401
|
import { UPSTASH_PROMPT } from "@mastra/upstash";
|
|
403
402
|
|
|
404
403
|
export const ragAgent = new Agent({
|
|
@@ -417,7 +416,7 @@ export const ragAgent = new Agent({
|
|
|
417
416
|
|
|
418
417
|
<TabItem value="vectorize" label="Vectorize">
|
|
419
418
|
|
|
420
|
-
```ts title="vector-store.ts"
|
|
419
|
+
```ts title="vector-store.ts"
|
|
421
420
|
import { VECTORIZE_PROMPT } from "@mastra/vectorize";
|
|
422
421
|
|
|
423
422
|
export const ragAgent = new Agent({
|
|
@@ -436,7 +435,7 @@ export const ragAgent = new Agent({
|
|
|
436
435
|
|
|
437
436
|
<TabItem value="mongodb" label="MongoDB">
|
|
438
437
|
|
|
439
|
-
```ts title="vector-store.ts"
|
|
438
|
+
```ts title="vector-store.ts"
|
|
440
439
|
import { MONGODB_PROMPT } from "@mastra/mongodb";
|
|
441
440
|
|
|
442
441
|
export const ragAgent = new Agent({
|
|
@@ -455,7 +454,7 @@ export const ragAgent = new Agent({
|
|
|
455
454
|
|
|
456
455
|
<TabItem value="opensearch" label="OpenSearch">
|
|
457
456
|
|
|
458
|
-
```ts title="vector-store.ts"
|
|
457
|
+
```ts title="vector-store.ts"
|
|
459
458
|
import { OPENSEARCH_PROMPT } from "@mastra/opensearch";
|
|
460
459
|
|
|
461
460
|
export const ragAgent = new Agent({
|
|
@@ -474,7 +473,7 @@ export const ragAgent = new Agent({
|
|
|
474
473
|
|
|
475
474
|
<TabItem value="s3vectors" label="S3Vectors">
|
|
476
475
|
|
|
477
|
-
```ts title="vector-store.ts"
|
|
476
|
+
```ts title="vector-store.ts"
|
|
478
477
|
import { S3VECTORS_PROMPT } from "@mastra/s3vectors";
|
|
479
478
|
|
|
480
479
|
export const ragAgent = new Agent({
|
|
@@ -503,7 +502,7 @@ Initial vector similarity search can sometimes miss nuanced relevance. Re-rankin
|
|
|
503
502
|
|
|
504
503
|
Here's how to use re-ranking:
|
|
505
504
|
|
|
506
|
-
```ts
|
|
505
|
+
```ts
|
|
507
506
|
import {
|
|
508
507
|
rerankWithScorer as rerank,
|
|
509
508
|
MastraAgentRelevanceScorer
|
|
@@ -547,11 +546,11 @@ For semantic scoring to work properly during re-ranking, each result must includ
|
|
|
547
546
|
|
|
548
547
|
You can also use other relevance score providers like Cohere or ZeroEntropy:
|
|
549
548
|
|
|
550
|
-
```ts
|
|
549
|
+
```ts
|
|
551
550
|
const relevanceProvider = new CohereRelevanceScorer("rerank-v3.5");
|
|
552
551
|
```
|
|
553
552
|
|
|
554
|
-
```ts
|
|
553
|
+
```ts
|
|
555
554
|
const relevanceProvider = new ZeroEntropyRelevanceScorer("zerank-1");
|
|
556
555
|
```
|
|
557
556
|
|