@mastra/mongodb 1.15.0-alpha.1 → 1.15.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +78 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-memory-semantic-recall.md +3 -3
- package/dist/docs/references/docs-memory-working-memory.md +8 -8
- package/dist/docs/references/docs-rag-retrieval.md +18 -18
- package/dist/docs/references/docs-rag-vector-databases.md +2 -2
- package/dist/docs/references/docs-storage-overview.md +2 -2
- package/dist/docs/references/reference-storage-mongodb.md +2 -2
- package/dist/docs/references/reference-vectors-mongodb.md +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,83 @@
|
|
|
1
1
|
# @mastra/mongodb
|
|
2
2
|
|
|
3
|
+
## 1.15.1-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dependencies updates: ([#19779](https://github.com/mastra-ai/mastra/pull/19779))
|
|
8
|
+
- Updated dependency [`mongodb@^7.5.0` ↗︎](https://www.npmjs.com/package/mongodb/v/7.5.0) (from `^7.2.0`, in `dependencies`)
|
|
9
|
+
- Updated dependencies [[`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73)]:
|
|
10
|
+
- @mastra/core@1.55.0-alpha.3
|
|
11
|
+
|
|
12
|
+
## 1.15.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- Added exact metadata filtering to message history queries across Memory APIs and supported storage providers. ([#19991](https://github.com/mastra-ai/mastra/pull/19991))
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
const messages = await memory.recall({
|
|
20
|
+
threadId: 'thread-1',
|
|
21
|
+
filter: {
|
|
22
|
+
metadata: {
|
|
23
|
+
status: 'done',
|
|
24
|
+
priority: 'high',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Multiple fields use AND semantics. Supported values are strings, finite numbers, booleans, and `null`.
|
|
31
|
+
|
|
32
|
+
- MongoDBVector can now index an existing (operational) collection instead of a managed one. Pass `collectionName` (and optionally `searchIndexName`) to `createIndex`, and query with `metadataMode: 'document'` to get the full source document back as metadata. ([#19805](https://github.com/mastra-ai/mastra/pull/19805))
|
|
33
|
+
|
|
34
|
+
**Bring-your-own collections are read-only by default.** The store never modifies or deletes caller-owned operational documents: `upsert`, `updateVector`, `deleteVector`, and `deleteVectors` throw a clear USER-category error on a BYO index unless it was created with `allowWrites: true`. The write policy is persisted alongside the index registration (surviving restarts) and fails closed for entries that predate it. Managed collections are unaffected and remain always writable.
|
|
35
|
+
|
|
36
|
+
The bring-your-own index target (collection name, search-index name, and the `isByo` safety flag) is now persisted durably in a mastra-owned registry collection and hydrated on demand, so BYO classification survives a process restart: `deleteIndex` from a fresh process drops only the Atlas search index and never drops the caller's operational collection. `listIndexes` now returns **logical** Mastra index names (not physical collection names), so its output round-trips correctly back into `deleteIndex`/`describeIndex`. `metadataMode: 'document'` now returns a clean source document (the synthetic relevance score is no longer merged into `metadata`, so a real source field named `score` is preserved).
|
|
37
|
+
|
|
38
|
+
**Example**
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
await vectorStore.createIndex({ indexName: 'precedents', dimension: 1024, collectionName: 'transactions' });
|
|
42
|
+
const hits = await vectorStore.query({ indexName: 'precedents', queryVector, metadataMode: 'document' });
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- MongoDBVector now supports full-text and hybrid retrieval. `createSearchIndex` provisions an Atlas Search index, `textQuery` runs a BM25 search, and `hybridQuery` fuses vector + text results server-side with $rankFusion (requires MongoDB 8.0+; on 8.0.x it may need a MongoDB support case to enable). ([#19805](https://github.com/mastra-ai/mastra/pull/19805))
|
|
46
|
+
|
|
47
|
+
A custom or field-restricted text-search index name is now persisted and resolved automatically by `textQuery`/`hybridQuery` (with a per-call override), so a `searchIndexName` passed to `createSearchIndex` is reachable; when `fields` is supplied without an explicit name, the field-mapped index is created under a distinct name so its mapping is not shadowed by the auto-created dynamic index. `hybridQuery`'s vector branch now reuses the same pushdown-vs-fallback filter logic as `query`, so metadata filters on undeclared fields no longer hard-error on bring-your-own collections.
|
|
48
|
+
|
|
49
|
+
Hardening for bring-your-own (BYO) operational collections:
|
|
50
|
+
|
|
51
|
+
- Full-text/hybrid search on a BYO collection is now **opt-in**: `createIndex` no longer auto-creates a billable dynamic full-text index on a caller-owned collection. Call `createSearchIndex` to enable `textQuery`/`hybridQuery` (which otherwise throw a clear error); managed collections keep auto-creating it for back-compat.
|
|
52
|
+
- `deleteIndex` on a BYO index now also drops the companion full-text search index (when one was provisioned), not just the vector index, so it no longer leaks an untracked index onto the caller's collection. The collection and its documents are still preserved.
|
|
53
|
+
- `createIndex` now throws a clear error when a logical index is retargeted to a different collection than the one already registered, instead of silently orphaning the previous collection's index; idempotent re-creation against the same collection still succeeds.
|
|
54
|
+
- `metadataMode: 'document'` now omits the (large) embedding field from `metadata` by default; set `includeVector: true` to retain it and also expose it as a top-level `vector`. A real source field named `score` is still preserved.
|
|
55
|
+
- BYO operational collections with native **`ObjectId` `_id`s** are now fully supported: query results coerce `_id` to a string (the `QueryResult.id` contract), and `deleteVector`/`updateVector`/`deleteVectors` accept that string and match the underlying `ObjectId` document. Managed (string `_id`) collections are unaffected.
|
|
56
|
+
- In `metadataMode: 'document'`, metadata filters now operate on **root document fields** instead of being rewritten to `metadata.<field>`, so filters like `{ lane: 'fraud' }` match a BYO collection's top-level operational fields (both the pushdown and `$match` fallback paths). Managed `'field'` mode keeps the `metadata.` rewriting.
|
|
57
|
+
- The full-text search index builds asynchronously; a new `waitForSearchIndexReady()` (and a `waitUntilReady` option on `createSearchIndex`) blocks until the text index reports READY, so an immediate `textQuery`/`hybridQuery` no longer intermittently fails. The field-mapped default text-index name is now unique per logical index so two logical indexes on one collection no longer collide.
|
|
58
|
+
- `hybridQuery` floors its vector-branch `numCandidates` at the branch limit, so `numCandidates` smaller than the internal limit no longer triggers a server-side error. `describeIndex().count` now counts only documents that actually carry the embedding field (relevant on BYO collections with a mix of embedded and non-embedded documents).
|
|
59
|
+
- The `$rankFusion` support probe (`buildInfo`) is memoized per instance, and `textQuery` guards its score consistently with `hybridQuery`.
|
|
60
|
+
|
|
61
|
+
**Example**
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
await store.createSearchIndex({ indexName: 'precedents', fields: ['note'] });
|
|
65
|
+
const hits = await store.hybridQuery({
|
|
66
|
+
indexName: 'precedents',
|
|
67
|
+
queryVector,
|
|
68
|
+
query: 'shell company',
|
|
69
|
+
paths: ['note'],
|
|
70
|
+
topK: 10,
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- Temporarily pin bson to 7.2.0 to work around a hang in an edge case with the newer bson version. Will unpin shortly. ([#20178](https://github.com/mastra-ai/mastra/pull/20178))
|
|
77
|
+
|
|
78
|
+
- Updated dependencies [[`ce93a3c`](https://github.com/mastra-ai/mastra/commit/ce93a3c114ea1cbfbd576f3db41d7c26c9844f5b), [`5718a22`](https://github.com/mastra-ai/mastra/commit/5718a229281dcfd36bcd1f42a242e3717e510a33), [`a211d09`](https://github.com/mastra-ai/mastra/commit/a211d09185dc65a746534914cf38b67f21ee9bac), [`0dca9d0`](https://github.com/mastra-ai/mastra/commit/0dca9d0b1356024a53b72ea6f040db528b126caa), [`6218217`](https://github.com/mastra-ai/mastra/commit/62182171b6cfca0b099f1c6a77a2e65e7639ab86), [`5807d3a`](https://github.com/mastra-ai/mastra/commit/5807d3ae1d259b8b7d6df7e5bf2b485c694af9c8), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`05db566`](https://github.com/mastra-ai/mastra/commit/05db566fcbdcbf33d0bffca0c72ec30129e2e3ca), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`5718a22`](https://github.com/mastra-ai/mastra/commit/5718a229281dcfd36bcd1f42a242e3717e510a33), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`d1b7e3a`](https://github.com/mastra-ai/mastra/commit/d1b7e3a978a309a5653eeaa490d2d6c7c53bd093), [`29c584a`](https://github.com/mastra-ai/mastra/commit/29c584a13a88831e5ed1fdeb0ff8e82eae180433), [`c093146`](https://github.com/mastra-ai/mastra/commit/c0931466404d3c521308ea119cb165bb7e695155), [`8124754`](https://github.com/mastra-ai/mastra/commit/8124754ae89fbc69f8136d1df4a91904d0f84c4e), [`d12b2e4`](https://github.com/mastra-ai/mastra/commit/d12b2e4023fd9e3d3e93a9169f5088bcee2a849c)]:
|
|
79
|
+
- @mastra/core@1.54.0
|
|
80
|
+
|
|
3
81
|
## 1.15.0-alpha.1
|
|
4
82
|
|
|
5
83
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-mongodb
|
|
|
3
3
|
description: Documentation for @mastra/mongodb. Use when working with @mastra/mongodb APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/mongodb"
|
|
6
|
-
version: "1.15.
|
|
6
|
+
version: "1.15.1-alpha.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -10,7 +10,7 @@ If you ask your friend what they did last weekend, they will search in their mem
|
|
|
10
10
|
|
|
11
11
|
Semantic recall is RAG-based search that helps agents maintain context across longer interactions when messages are no longer within [recent message history](https://mastra.ai/docs/memory/message-history).
|
|
12
12
|
|
|
13
|
-
It uses vector embeddings of messages for similarity search
|
|
13
|
+
It uses vector embeddings of messages for similarity search and integrates with vector stores, plus has configurable context windows around retrieved messages.
|
|
14
14
|
|
|
15
15
|

|
|
16
16
|
|
|
@@ -34,7 +34,7 @@ const agent = new Agent({
|
|
|
34
34
|
id: 'support-agent',
|
|
35
35
|
name: 'SupportAgent',
|
|
36
36
|
instructions: 'You are a helpful support agent.',
|
|
37
|
-
model: 'openai/gpt-5.
|
|
37
|
+
model: 'openai/gpt-5.6-sol',
|
|
38
38
|
memory: new Memory({
|
|
39
39
|
storage: new LibSQLStore({
|
|
40
40
|
id: 'agent-storage',
|
|
@@ -64,7 +64,7 @@ const agent = new Agent({
|
|
|
64
64
|
id: 'support-agent',
|
|
65
65
|
name: 'SupportAgent',
|
|
66
66
|
instructions: 'You are a helpful support agent.',
|
|
67
|
-
model: 'openai/gpt-5.
|
|
67
|
+
model: 'openai/gpt-5.6-sol',
|
|
68
68
|
memory: new Memory({
|
|
69
69
|
storage: new MongoDBStore({
|
|
70
70
|
id: 'agent-storage',
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
While [message history](https://mastra.ai/docs/memory/message-history) and [semantic recall](https://mastra.ai/docs/memory/semantic-recall) help agents remember conversations, working memory allows them to maintain persistent information about users across interactions.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Working memory is the agent's active scratchpad: key information it keeps available about the user or task. It can retain a person's name, preferences, or other important details during a conversation.
|
|
8
8
|
|
|
9
9
|
This is useful for maintaining ongoing state that's always relevant and should always be available to the agent.
|
|
10
10
|
|
|
@@ -17,7 +17,7 @@ Working memory can persist at two different scopes:
|
|
|
17
17
|
- **Resource-scoped** (default): Memory persists across all conversation threads for the same user
|
|
18
18
|
- **Thread-scoped**: Memory is isolated per conversation thread
|
|
19
19
|
|
|
20
|
-
**
|
|
20
|
+
**Requirement:** Switching between scopes means the agent won't see memory from the other scope - thread-scoped memory is completely separate from resource-scoped memory.
|
|
21
21
|
|
|
22
22
|
## Quickstart
|
|
23
23
|
|
|
@@ -32,7 +32,7 @@ const agent = new Agent({
|
|
|
32
32
|
id: 'personal-assistant',
|
|
33
33
|
name: 'PersonalAssistant',
|
|
34
34
|
instructions: 'You are a helpful personal assistant.',
|
|
35
|
-
model: 'openai/gpt-5.
|
|
35
|
+
model: 'openai/gpt-5.6-sol',
|
|
36
36
|
memory: new Memory({
|
|
37
37
|
options: {
|
|
38
38
|
workingMemory: {
|
|
@@ -45,7 +45,7 @@ const agent = new Agent({
|
|
|
45
45
|
|
|
46
46
|
## How it works
|
|
47
47
|
|
|
48
|
-
Working memory is a block of Markdown text that the agent
|
|
48
|
+
Working memory is a block of Markdown text that the agent can update over time to store continuously relevant information.
|
|
49
49
|
|
|
50
50
|
## Memory persistence scopes
|
|
51
51
|
|
|
@@ -134,7 +134,7 @@ Resource-scoped working memory requires specific storage adapters that support t
|
|
|
134
134
|
|
|
135
135
|
## Custom templates
|
|
136
136
|
|
|
137
|
-
Templates guide the agent on what information to track and update in working memory.
|
|
137
|
+
Templates guide the agent on what information to track and update in working memory. Mastra uses a default template when you don't provide one. Define a custom template for your agent's use case so it remembers the most relevant information. For threads shared by multiple users, see [Multi-user threads](https://mastra.ai/docs/memory/multi-user-threads).
|
|
138
138
|
|
|
139
139
|
Here's an example of a custom template. In this example the agent will store the users name, location, timezone, etc as soon as the user sends a message containing any of the info:
|
|
140
140
|
|
|
@@ -214,7 +214,7 @@ const paragraphMemory = new Memory({
|
|
|
214
214
|
|
|
215
215
|
Working memory can also be defined using a structured schema instead of a Markdown template. This allows you to specify the exact fields and types that should be tracked, using a [Standard JSON Schema](https://standardschema.dev/json-schema) ([Zod](https://zod.dev/), [Valibot](https://valibot.dev/), [ArkType](https://arktype.io/), etc.). When using a schema, the agent will see and update working memory as a JSON object matching your schema.
|
|
216
216
|
|
|
217
|
-
**
|
|
217
|
+
**Requirement:** You must specify either `template` or `schema`, but not both.
|
|
218
218
|
|
|
219
219
|
### Example: Schema-Based Working Memory
|
|
220
220
|
|
|
@@ -271,8 +271,8 @@ Schema-based working memory uses **merge semantics**, meaning the agent only nee
|
|
|
271
271
|
|
|
272
272
|
## Choosing between template and schema
|
|
273
273
|
|
|
274
|
-
- Use a **template** (Markdown) if you want the agent to maintain memory as a free-form text block, such as a user profile or scratchpad. Templates use **replace semantics
|
|
275
|
-
- Use a **schema** if you need structured, type-safe data that can be validated and programmatically accessed as JSON. The `workingMemory.schema` field accepts any `PublicSchema`-compatible schema (including Zod v3, Zod v4, JSON Schema, or already-standard schemas). Schemas use **merge semantics
|
|
274
|
+
- Use a **template** (Markdown) if you want the agent to maintain memory as a free-form text block, such as a user profile or scratchpad. Templates use **replace semantics**: the agent must provide the complete memory content on each update.
|
|
275
|
+
- Use a **schema** if you need structured, type-safe data that can be validated and programmatically accessed as JSON. The `workingMemory.schema` field accepts any `PublicSchema`-compatible schema (including Zod v3, Zod v4, JSON Schema, or already-standard schemas). Schemas use **merge semantics**: the agent only provides fields to update, and existing fields are preserved.
|
|
276
276
|
- Only one mode can be active at a time: setting both `template` and `schema` isn't supported.
|
|
277
277
|
|
|
278
278
|
## Example: Multi-step retention
|
|
@@ -160,15 +160,15 @@ When creating the tool, pay special attention to the tool's name and description
|
|
|
160
160
|
|
|
161
161
|
This is particularly useful when:
|
|
162
162
|
|
|
163
|
-
- Your agent needs to
|
|
163
|
+
- Your agent needs to decide at runtime what information to retrieve
|
|
164
164
|
- The retrieval process requires complex decision-making
|
|
165
165
|
- You want the agent to combine multiple retrieval strategies based on context
|
|
166
166
|
|
|
167
167
|
#### Database-Specific Configurations
|
|
168
168
|
|
|
169
|
-
The Vector Query Tool supports database-specific configurations that enable you to
|
|
169
|
+
The Vector Query Tool supports database-specific configurations that enable you to use unique features and optimizations of different vector stores.
|
|
170
170
|
|
|
171
|
-
> **Note:** These configurations are for **query-time options** like namespaces, performance tuning, and filtering
|
|
171
|
+
> **Note:** These configurations are for **query-time options** like namespaces, performance tuning, and filtering, not for database connection setup.
|
|
172
172
|
>
|
|
173
173
|
> Connection credentials (URLs, auth tokens) are configured when you instantiate the vector store class (e.g., `new LibSQLVector({ url: '...' })`).
|
|
174
174
|
|
|
@@ -235,7 +235,7 @@ const lanceQueryTool = createVectorQueryTool({
|
|
|
235
235
|
- **pgVector optimization**: Control search accuracy and speed with ef/probes parameters
|
|
236
236
|
- **Quality filtering**: Set minimum similarity thresholds to improve result relevance
|
|
237
237
|
- **LanceDB tables**: Separate data into tables for better organization and performance
|
|
238
|
-
- **Runtime flexibility**: Override configurations
|
|
238
|
+
- **Runtime flexibility**: Override configurations at runtime based on context
|
|
239
239
|
|
|
240
240
|
**Common Use Cases:**
|
|
241
241
|
|
|
@@ -274,7 +274,7 @@ import { PGVECTOR_PROMPT } from '@mastra/pg'
|
|
|
274
274
|
export const ragAgent = new Agent({
|
|
275
275
|
id: 'rag-agent',
|
|
276
276
|
name: 'RAG Agent',
|
|
277
|
-
model: 'openai/gpt-5.
|
|
277
|
+
model: 'openai/gpt-5.6-sol',
|
|
278
278
|
instructions: `
|
|
279
279
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
280
280
|
${PGVECTOR_PROMPT}
|
|
@@ -291,7 +291,7 @@ import { PINECONE_PROMPT } from '@mastra/pinecone'
|
|
|
291
291
|
export const ragAgent = new Agent({
|
|
292
292
|
id: 'rag-agent',
|
|
293
293
|
name: 'RAG Agent',
|
|
294
|
-
model: 'openai/gpt-5.
|
|
294
|
+
model: 'openai/gpt-5.6-sol',
|
|
295
295
|
instructions: `
|
|
296
296
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
297
297
|
${PINECONE_PROMPT}
|
|
@@ -308,7 +308,7 @@ import { QDRANT_PROMPT } from '@mastra/qdrant'
|
|
|
308
308
|
export const ragAgent = new Agent({
|
|
309
309
|
id: 'rag-agent',
|
|
310
310
|
name: 'RAG Agent',
|
|
311
|
-
model: 'openai/gpt-5.
|
|
311
|
+
model: 'openai/gpt-5.6-sol',
|
|
312
312
|
instructions: `
|
|
313
313
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
314
314
|
${QDRANT_PROMPT}
|
|
@@ -325,7 +325,7 @@ import { CHROMA_PROMPT } from '@mastra/chroma'
|
|
|
325
325
|
export const ragAgent = new Agent({
|
|
326
326
|
id: 'rag-agent',
|
|
327
327
|
name: 'RAG Agent',
|
|
328
|
-
model: 'openai/gpt-5.
|
|
328
|
+
model: 'openai/gpt-5.6-sol',
|
|
329
329
|
instructions: `
|
|
330
330
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
331
331
|
${CHROMA_PROMPT}
|
|
@@ -342,7 +342,7 @@ import { ASTRA_PROMPT } from '@mastra/astra'
|
|
|
342
342
|
export const ragAgent = new Agent({
|
|
343
343
|
id: 'rag-agent',
|
|
344
344
|
name: 'RAG Agent',
|
|
345
|
-
model: 'openai/gpt-5.
|
|
345
|
+
model: 'openai/gpt-5.6-sol',
|
|
346
346
|
instructions: `
|
|
347
347
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
348
348
|
${ASTRA_PROMPT}
|
|
@@ -359,7 +359,7 @@ import { LIBSQL_PROMPT } from '@mastra/libsql'
|
|
|
359
359
|
export const ragAgent = new Agent({
|
|
360
360
|
id: 'rag-agent',
|
|
361
361
|
name: 'RAG Agent',
|
|
362
|
-
model: 'openai/gpt-5.
|
|
362
|
+
model: 'openai/gpt-5.6-sol',
|
|
363
363
|
instructions: `
|
|
364
364
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
365
365
|
${LIBSQL_PROMPT}
|
|
@@ -376,7 +376,7 @@ import { UPSTASH_PROMPT } from '@mastra/upstash'
|
|
|
376
376
|
export const ragAgent = new Agent({
|
|
377
377
|
id: 'rag-agent',
|
|
378
378
|
name: 'RAG Agent',
|
|
379
|
-
model: 'openai/gpt-5.
|
|
379
|
+
model: 'openai/gpt-5.6-sol',
|
|
380
380
|
instructions: `
|
|
381
381
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
382
382
|
${UPSTASH_PROMPT}
|
|
@@ -393,7 +393,7 @@ import { VECTORIZE_PROMPT } from '@mastra/vectorize'
|
|
|
393
393
|
export const ragAgent = new Agent({
|
|
394
394
|
id: 'rag-agent',
|
|
395
395
|
name: 'RAG Agent',
|
|
396
|
-
model: 'openai/gpt-5.
|
|
396
|
+
model: 'openai/gpt-5.6-sol',
|
|
397
397
|
instructions: `
|
|
398
398
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
399
399
|
${VECTORIZE_PROMPT}
|
|
@@ -410,7 +410,7 @@ import { MONGODB_PROMPT } from '@mastra/mongodb'
|
|
|
410
410
|
export const ragAgent = new Agent({
|
|
411
411
|
id: 'rag-agent',
|
|
412
412
|
name: 'RAG Agent',
|
|
413
|
-
model: 'openai/gpt-5.
|
|
413
|
+
model: 'openai/gpt-5.6-sol',
|
|
414
414
|
instructions: `
|
|
415
415
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
416
416
|
${MONGODB_PROMPT}
|
|
@@ -427,7 +427,7 @@ import { OPENSEARCH_PROMPT } from '@mastra/opensearch'
|
|
|
427
427
|
export const ragAgent = new Agent({
|
|
428
428
|
id: 'rag-agent',
|
|
429
429
|
name: 'RAG Agent',
|
|
430
|
-
model: 'openai/gpt-5.
|
|
430
|
+
model: 'openai/gpt-5.6-sol',
|
|
431
431
|
instructions: `
|
|
432
432
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
433
433
|
${OPENSEARCH_PROMPT}
|
|
@@ -444,7 +444,7 @@ import { S3VECTORS_PROMPT } from '@mastra/s3vectors'
|
|
|
444
444
|
export const ragAgent = new Agent({
|
|
445
445
|
id: 'rag-agent',
|
|
446
446
|
name: 'RAG Agent',
|
|
447
|
-
model: 'openai/gpt-5.
|
|
447
|
+
model: 'openai/gpt-5.6-sol',
|
|
448
448
|
instructions: `
|
|
449
449
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
450
450
|
${S3VECTORS_PROMPT}
|
|
@@ -455,10 +455,10 @@ export const ragAgent = new Agent({
|
|
|
455
455
|
|
|
456
456
|
### Re-ranking
|
|
457
457
|
|
|
458
|
-
Initial vector similarity search can sometimes miss
|
|
458
|
+
Initial vector similarity search can sometimes miss detailed relevance. Re-ranking is a more computationally expensive process, but more accurate algorithm that improves results by:
|
|
459
459
|
|
|
460
460
|
- Considering word order and exact matches
|
|
461
|
-
- Applying more
|
|
461
|
+
- Applying more advanced relevance scoring
|
|
462
462
|
- Using a method called cross-attention between query and documents
|
|
463
463
|
|
|
464
464
|
Here's how to use re-ranking:
|
|
@@ -476,7 +476,7 @@ const initialResults = await pgVector.query({
|
|
|
476
476
|
// Create a relevance scorer
|
|
477
477
|
const relevanceProvider = new MastraAgentRelevanceScorer(
|
|
478
478
|
'relevance-scorer',
|
|
479
|
-
'openai/gpt-5.
|
|
479
|
+
'openai/gpt-5.6-sol',
|
|
480
480
|
)
|
|
481
481
|
|
|
482
482
|
// Re-rank the results
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Storing embeddings in a vector database
|
|
4
4
|
|
|
5
|
-
After generating embeddings, you need to store them in a database that supports vector similarity search. Mastra provides a consistent interface for storing and querying embeddings across
|
|
5
|
+
After generating embeddings, you need to store them in a database that supports vector similarity search. Mastra provides a consistent interface for storing and querying embeddings across vector databases.
|
|
6
6
|
|
|
7
7
|
## Supported databases
|
|
8
8
|
|
|
@@ -571,7 +571,7 @@ The upsert operation:
|
|
|
571
571
|
|
|
572
572
|
Vector stores support rich metadata (any JSON-serializable fields) for filtering and organization. Since metadata is stored with no fixed schema, use consistent field naming to avoid unexpected query results.
|
|
573
573
|
|
|
574
|
-
> **Warning:** Metadata is
|
|
574
|
+
> **Warning:** Metadata is important for vector storage. Without it, you'd only have numerical embeddings with no way to return the original text or filter results. Always store at least the source text as metadata.
|
|
575
575
|
|
|
576
576
|
```ts
|
|
577
577
|
// Store embeddings with rich metadata for better organization and filtering
|
|
@@ -14,7 +14,7 @@ Storage powers:
|
|
|
14
14
|
|
|
15
15
|
## When to configure storage
|
|
16
16
|
|
|
17
|
-
Configure a persistent storage adapter when state must survive restarts
|
|
17
|
+
Configure a persistent storage adapter when state must survive restarts or be shared across processes. Persistent storage also keeps state visible in Studio across sessions. The default in-memory store is useful for tests and short local experiments, but it loses data when the process exits.
|
|
18
18
|
|
|
19
19
|
Use storage when your application needs any of these behaviors:
|
|
20
20
|
|
|
@@ -144,7 +144,7 @@ export const supportAgent = new Agent({
|
|
|
144
144
|
id: 'support-agent',
|
|
145
145
|
name: 'Support agent',
|
|
146
146
|
instructions: 'Answer customer support questions.',
|
|
147
|
-
model: 'openai/gpt-5.
|
|
147
|
+
model: 'openai/gpt-5.6-sol',
|
|
148
148
|
memory: new Memory({
|
|
149
149
|
storage: new PostgresStore({
|
|
150
150
|
id: 'support-agent-storage',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# MongoDB storage
|
|
4
4
|
|
|
5
|
-
The MongoDB storage implementation provides a
|
|
5
|
+
The MongoDB storage implementation provides a high-capacity storage solution using MongoDB databases with support for both document storage and vector operations.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -210,7 +210,7 @@ export const mongodbAgent = new Agent({
|
|
|
210
210
|
name: 'mongodb-agent',
|
|
211
211
|
instructions:
|
|
212
212
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
213
|
-
model: 'openai/gpt-5.
|
|
213
|
+
model: 'openai/gpt-5.6-sol',
|
|
214
214
|
memory: new Memory({
|
|
215
215
|
storage: new MongoDBStore({
|
|
216
216
|
id: 'mongodb-storage',
|
|
@@ -470,7 +470,7 @@ export const mongodbAgent = new Agent({
|
|
|
470
470
|
name: 'mongodb-agent',
|
|
471
471
|
instructions:
|
|
472
472
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
473
|
-
model: 'openai/gpt-5.
|
|
473
|
+
model: 'openai/gpt-5.6-sol',
|
|
474
474
|
memory: new Memory({
|
|
475
475
|
storage: new MongoDBStore({
|
|
476
476
|
id: 'mongodb-storage',
|
|
@@ -535,7 +535,7 @@ export const mongodbVoyageAgent = new Agent({
|
|
|
535
535
|
id: 'mongodb-voyage-agent',
|
|
536
536
|
name: 'MongoDB VoyageAI Agent',
|
|
537
537
|
instructions: 'You are an AI agent with semantic recall powered by VoyageAI and MongoDB.',
|
|
538
|
-
model: 'openai/gpt-5.
|
|
538
|
+
model: 'openai/gpt-5.6-sol',
|
|
539
539
|
memory: new Memory({
|
|
540
540
|
storage: new MongoDBStore({
|
|
541
541
|
id: 'mongodb-storage',
|
|
@@ -559,7 +559,7 @@ export const mongodbVoyageAgent = new Agent({
|
|
|
559
559
|
})
|
|
560
560
|
```
|
|
561
561
|
|
|
562
|
-
For
|
|
562
|
+
For detailed VoyageAI embedding examples including specialized models, multimodal embeddings, and retrieval optimization, see the [VoyageAI embeddings documentation](https://mastra.ai/models/embeddings).
|
|
563
563
|
|
|
564
564
|
## Related
|
|
565
565
|
|
package/dist/index.cjs
CHANGED
|
@@ -10,7 +10,7 @@ let _mastra_core_agent = require("@mastra/core/agent");
|
|
|
10
10
|
let _mastra_core_evals = require("@mastra/core/evals");
|
|
11
11
|
let _mastra_core_storage_domains_skills = require("@mastra/core/storage/domains/skills");
|
|
12
12
|
//#region package.json
|
|
13
|
-
var version = "1.15.
|
|
13
|
+
var version = "1.15.1-alpha.0";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/vector/filter.ts
|
|
16
16
|
/**
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { MessageList } from "@mastra/core/agent";
|
|
|
9
9
|
import { saveScorePayloadSchema } from "@mastra/core/evals";
|
|
10
10
|
import { skillSnapshotFieldValuesEqual } from "@mastra/core/storage/domains/skills";
|
|
11
11
|
//#region package.json
|
|
12
|
-
var version = "1.15.
|
|
12
|
+
var version = "1.15.1-alpha.0";
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/vector/filter.ts
|
|
15
15
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mongodb",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.1-alpha.0",
|
|
4
4
|
"description": "MongoDB provider for Mastra - includes vector store capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@lukeed/uuid": "^2.0.1",
|
|
23
23
|
"cloudflare": "^5.2.0",
|
|
24
|
-
"mongodb": "^7.
|
|
24
|
+
"mongodb": "^7.5.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "22.20.1",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"tsx": "^4.23.1",
|
|
33
33
|
"typescript": "^6.0.3",
|
|
34
34
|
"vitest": "4.1.10",
|
|
35
|
-
"@internal/lint": "0.0.
|
|
36
|
-
"@internal/
|
|
37
|
-
"@mastra/core": "1.
|
|
38
|
-
"@internal/
|
|
35
|
+
"@internal/lint": "0.0.118",
|
|
36
|
+
"@internal/storage-test-utils": "0.0.114",
|
|
37
|
+
"@mastra/core": "1.55.0-alpha.3",
|
|
38
|
+
"@internal/types-builder": "0.0.93"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@mastra/core": ">=1.51.0-0 <2.0.0-0"
|