@mastra/s3vectors 1.1.3 → 1.1.4-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.
@@ -3,7 +3,7 @@ name: mastra-s3vectors
3
3
  description: Documentation for @mastra/s3vectors. Use when working with @mastra/s3vectors APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/s3vectors"
6
- version: "1.1.3"
6
+ version: "1.1.4-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.3",
2
+ "version": "1.1.4-alpha.0",
3
3
  "package": "@mastra/s3vectors",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -50,23 +50,25 @@ console.log(results)
50
50
 
51
51
  The `topK` parameter specifies the maximum number of most similar results to return from the vector search.
52
52
 
53
- Results include both the text content and a similarity score:
53
+ Each result includes an `id`, a similarity `score`, and the stored `metadata`. When you store chunk text in metadata, it's available as `metadata.text`:
54
54
 
55
55
  ```ts
56
56
  [
57
57
  {
58
- text: 'Climate change poses significant challenges...',
58
+ id: 'chunk-1',
59
59
  score: 0.89,
60
- metadata: { source: 'article1.txt' },
60
+ metadata: { text: 'Climate change poses significant challenges...', source: 'article1.txt' },
61
61
  },
62
62
  {
63
- text: 'Rising temperatures affect crop yields...',
63
+ id: 'chunk-2',
64
64
  score: 0.82,
65
- metadata: { source: 'article1.txt' },
65
+ metadata: { text: 'Rising temperatures affect crop yields...', source: 'article1.txt' },
66
66
  },
67
67
  ]
68
68
  ```
69
69
 
70
+ Results can also include `vector` when you set `includeVector: true`, and `document` when the store returns the original document (Chroma only).
71
+
70
72
  ## Advanced retrieval options
71
73
 
72
74
  ### Metadata Filtering
@@ -54,6 +54,29 @@ const results = await store.hybridQuery({
54
54
 
55
55
  See the [MongoDB vector reference](https://mastra.ai/reference/vectors/mongodb) for details on `createSearchIndex()`, `textQuery()`, and `hybridQuery()`.
56
56
 
57
+ ### Automated Embedding
58
+
59
+ MongoDB can generate the embeddings itself, so you don't need an embedding provider in your application. Create the index with `autoEmbed` and a Voyage AI model, write plain text, and search with a query string:
60
+
61
+ ```ts
62
+ await store.createIndex({
63
+ indexName: 'myCollection',
64
+ autoEmbed: { model: 'voyage-4' },
65
+ })
66
+ await store.upsert({
67
+ indexName: 'myCollection',
68
+ documents: chunks.map(chunk => chunk.text),
69
+ metadata: chunks.map(chunk => ({ text: chunk.text })),
70
+ })
71
+ const results = await store.query({
72
+ indexName: 'myCollection',
73
+ queryText: 'search terms',
74
+ topK: 10,
75
+ })
76
+ ```
77
+
78
+ Automated Embedding is a MongoDB Preview feature and needs a deployment where it's available. See the [MongoDB vector reference](https://mastra.ai/reference/vectors/mongodb) for the supported options and requirements.
79
+
57
80
  **PgVector**:
58
81
 
59
82
  ```ts
@@ -207,7 +230,7 @@ await store.upsert({
207
230
  **libSQL**:
208
231
 
209
232
  ```ts
210
- import { LibSQLVector } from '@mastra/core/vector/libsql'
233
+ import { LibSQLVector } from '@mastra/libsql'
211
234
 
212
235
  const store = new LibSQLVector({
213
236
  id: 'libsql-vector',
@@ -196,7 +196,7 @@ Query results are returned in this format:
196
196
  interface QueryResult {
197
197
  id: string
198
198
  score: number // 1/(1 + distance)
199
- metadata: Record<string, any>
199
+ metadata?: Record<string, any>
200
200
  vector?: number[] // Only included if includeVector is true
201
201
  }
202
202
  ```
@@ -244,17 +244,21 @@ S3 Vectors supports a strict subset of operators and value types. The Mastra fil
244
244
 
245
245
  ## Error handling
246
246
 
247
- The store throws typed errors that can be caught:
247
+ The store throws `MastraError` instances from `@mastra/core/error`:
248
248
 
249
249
  ```typescript
250
+ import { MastraError } from '@mastra/core/error'
251
+
250
252
  try {
251
253
  await store.query({
252
254
  indexName: 'index-name',
253
255
  queryVector: queryVector,
254
256
  })
255
257
  } catch (error) {
256
- if (error instanceof VectorStoreError) {
257
- console.log(error.code) // 'connection_failed' | 'invalid_dimension' | etc
258
+ if (error instanceof MastraError) {
259
+ console.log(error.id) // 'MASTRA_VECTOR_S3VECTORS_QUERY_FAILED'
260
+ console.log(error.domain) // 'STORAGE'
261
+ console.log(error.category) // 'USER' | 'THIRD_PARTY'
258
262
  console.log(error.details) // Additional error context
259
263
  }
260
264
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/s3vectors",
3
- "version": "1.1.3",
3
+ "version": "1.1.4-alpha.0",
4
4
  "description": "Amazon S3 Vectors store provider for Mastra",
5
5
  "type": "module",
6
6
  "files": [
@@ -36,10 +36,10 @@
36
36
  "tsx": "^4.23.1",
37
37
  "typescript": "^7.0.2",
38
38
  "vitest": "4.1.11",
39
- "@internal/lint": "0.0.135",
40
- "@internal/types-builder": "0.0.110",
41
- "@mastra/core": "1.69.0",
42
- "@internal/storage-test-utils": "0.0.131"
39
+ "@internal/storage-test-utils": "0.0.140",
40
+ "@internal/types-builder": "0.0.119",
41
+ "@mastra/core": "1.78.1-alpha.0",
42
+ "@internal/lint": "0.0.144"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@mastra/core": ">=1.0.0-0 <2.0.0-0"