@mastra/mongodb 1.25.0-alpha.0 → 1.25.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/dist/docs/SKILL.md
CHANGED
|
@@ -435,6 +435,8 @@ When using PostgreSQL as your vector store, you can optimize semantic recall per
|
|
|
435
435
|
|
|
436
436
|
PostgreSQL supports both IVFFlat and HNSW indexes. By default, Mastra creates an IVFFlat index, but HNSW indexes typically provide better performance, especially with OpenAI embeddings which use inner product distance.
|
|
437
437
|
|
|
438
|
+
Semantic recall always filters by thread or resource. PgVector uses the vector index for these searches only with HNSW on pgvector 0.8.0 or newer. With IVFFlat, each search compares the query against every message in the thread or resource.
|
|
439
|
+
|
|
438
440
|
```typescript
|
|
439
441
|
import { Memory } from '@mastra/memory'
|
|
440
442
|
import { PostgresStore, PgVector } from '@mastra/pg'
|
|
@@ -251,7 +251,11 @@ const results = await pgVector.query({
|
|
|
251
251
|
})
|
|
252
252
|
```
|
|
253
253
|
|
|
254
|
-
|
|
254
|
+
With an HNSW index on pgvector 0.8.0 or newer, PostgreSQL searches the index and skips rows that don't match the filter. When the index search can't fill `topK`, pgVector reruns the query as an exact search.
|
|
255
|
+
|
|
256
|
+
With IVFFlat, or HNSW on older pgvector versions, pgVector compares the query vector against every matching row. Results are exact, but the work grows with the number of matching rows.
|
|
257
|
+
|
|
258
|
+
Indexing the metadata fields you filter on speeds up both cases and gives PostgreSQL the row counts it needs to choose between them.
|
|
255
259
|
|
|
256
260
|
### Vector Query Tool
|
|
257
261
|
|
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
|
// package.json
|
|
13
|
-
var version = "1.25.0
|
|
13
|
+
var version = "1.25.0";
|
|
14
14
|
// src/vector/filter.ts
|
|
15
15
|
/**
|
|
16
16
|
* Translator for MongoDB filter queries.
|
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
|
// package.json
|
|
12
|
-
var version = "1.25.0
|
|
12
|
+
var version = "1.25.0";
|
|
13
13
|
// src/vector/filter.ts
|
|
14
14
|
/**
|
|
15
15
|
* Translator for MongoDB filter queries.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mongodb",
|
|
3
|
-
"version": "1.25.0
|
|
3
|
+
"version": "1.25.0",
|
|
4
4
|
"description": "MongoDB provider for Mastra - includes vector store capabilities",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"tsx": "^4.23.15",
|
|
33
33
|
"typescript": "^7.0.2",
|
|
34
34
|
"vitest": "4.1.12",
|
|
35
|
-
"@internal/
|
|
36
|
-
"@internal/
|
|
37
|
-
"@internal/
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@mastra/memory": "1.40.0
|
|
35
|
+
"@internal/core": "0.1.4",
|
|
36
|
+
"@internal/lint": "0.0.147",
|
|
37
|
+
"@internal/storage-test-utils": "0.0.143",
|
|
38
|
+
"@internal/types-builder": "0.0.122",
|
|
39
|
+
"@mastra/core": "1.81.0",
|
|
40
|
+
"@mastra/memory": "1.40.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@mastra/core": ">=1.76.0-0 <2.0.0-0"
|