@mastra/couchbase 1.0.2 → 1.0.3-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
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @mastra/couchbase
|
|
2
2
|
|
|
3
|
+
## 1.0.3-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dependencies updates: ([#17148](https://github.com/mastra-ai/mastra/pull/17148))
|
|
8
|
+
- Updated dependency [`couchbase@^4.7.0` ↗︎](https://www.npmjs.com/package/couchbase/v/4.7.0) (from `^4.6.1`, in `dependencies`)
|
|
9
|
+
- Updated dependencies [[`575f815`](https://github.com/mastra-ai/mastra/commit/575f815c5c3567b71c0b83cbb7fa98c8253a9d9c), [`306909a`](https://github.com/mastra-ai/mastra/commit/306909a693de77d709b38706e2673c9547d24a28), [`5191af8`](https://github.com/mastra-ai/mastra/commit/5191af80c799eea25357c545fc05d91b3883531d), [`43bd3d4`](https://github.com/mastra-ai/mastra/commit/43bd3d421987463fdf35386a45199c49499ed069), [`e6fa79e`](https://github.com/mastra-ai/mastra/commit/e6fa79ec72a2ddffdd25e85270398951e9d552a4), [`904bcdf`](https://github.com/mastra-ai/mastra/commit/904bcdf7b8004aa7be823f9f70ca63580e47e470), [`7f5ee1d`](https://github.com/mastra-ai/mastra/commit/7f5ee1dca46daee8d2817f2ebe49e6335da81956), [`1e9aab5`](https://github.com/mastra-ai/mastra/commit/1e9aab50ff11e6e88fde4d7cbf512c44a9fe8d61), [`bf8eb6d`](https://github.com/mastra-ai/mastra/commit/bf8eb6d0ec213a403eb9265a594ad283c44ab3dc), [`493a328`](https://github.com/mastra-ai/mastra/commit/493a328f4346a1deeb9f1e2e44c8f2a3a4d7591b), [`029a414`](https://github.com/mastra-ai/mastra/commit/029a4141719793bd3e898a39eb5a0466a55f5f3a), [`b147b29`](https://github.com/mastra-ai/mastra/commit/b147b2907f0cd1aa812efe6d6e3f58d22e66fc88), [`d371ac1`](https://github.com/mastra-ai/mastra/commit/d371ac1d9820afaaf7cfdbc380a475946a994d8f), [`cf182b7`](https://github.com/mastra-ai/mastra/commit/cf182b7fb495767946d9840ef29f19cfa906f31f), [`a049c2a`](https://github.com/mastra-ai/mastra/commit/a049c2a9dfb41d0ee2e7a28874a88cd64fd5669f), [`b147b29`](https://github.com/mastra-ai/mastra/commit/b147b2907f0cd1aa812efe6d6e3f58d22e66fc88), [`2a96528`](https://github.com/mastra-ai/mastra/commit/2a9652848dfa3c5a2426f952e9d93554c26fd90f), [`2656d9c`](https://github.com/mastra-ai/mastra/commit/2656d9c2976d4f3354253bfbbbf9b88a1b2bbf34), [`63e3fe1`](https://github.com/mastra-ai/mastra/commit/63e3fe13cc1ea96f91d7c68aea92f400faf9e4da), [`1d4ce8d`](https://github.com/mastra-ai/mastra/commit/1d4ce8daaa54511f325c1b609d31b8e54009d677), [`8c68372`](https://github.com/mastra-ai/mastra/commit/8c68372e85fe0b066ec12c58bd29ffb93e54c552)]:
|
|
10
|
+
- @mastra/core@1.42.0-alpha.4
|
|
11
|
+
|
|
3
12
|
## 1.0.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-couchbase
|
|
|
3
3
|
description: Documentation for @mastra/couchbase. Use when working with @mastra/couchbase APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/couchbase"
|
|
6
|
-
version: "1.0.
|
|
6
|
+
version: "1.0.3-alpha.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -16,11 +16,11 @@ Read the individual reference documents for detailed explanations and code examp
|
|
|
16
16
|
|
|
17
17
|
### Docs
|
|
18
18
|
|
|
19
|
-
- [Storing
|
|
19
|
+
- [Storing embeddings in a vector database](references/docs-rag-vector-databases.md) - Guide on vector storage options in Mastra, including embedded and dedicated vector databases for similarity search.
|
|
20
20
|
|
|
21
21
|
### Reference
|
|
22
22
|
|
|
23
|
-
- [Reference: Couchbase
|
|
23
|
+
- [Reference: Couchbase vector store](references/reference-vectors-couchbase.md) - Documentation for the CouchbaseVector class in Mastra, which provides vector search using Couchbase Vector Search.
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Storing
|
|
1
|
+
# Storing embeddings in a vector database
|
|
2
2
|
|
|
3
3
|
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 various vector databases.
|
|
4
4
|
|
|
5
|
-
## Supported
|
|
5
|
+
## Supported databases
|
|
6
6
|
|
|
7
7
|
**MongoDB**:
|
|
8
8
|
|
|
@@ -234,7 +234,7 @@ await store.upsert({
|
|
|
234
234
|
})
|
|
235
235
|
```
|
|
236
236
|
|
|
237
|
-
**
|
|
237
|
+
**Elasticsearch**:
|
|
238
238
|
|
|
239
239
|
```ts
|
|
240
240
|
import { ElasticSearchVector } from '@mastra/elasticsearch'
|
|
@@ -337,7 +337,7 @@ await store.upsert({
|
|
|
337
337
|
})
|
|
338
338
|
```
|
|
339
339
|
|
|
340
|
-
## Using
|
|
340
|
+
## Using vector storage
|
|
341
341
|
|
|
342
342
|
Once initialized, all vector stores share the same interface for creating indexes, upserting embeddings, and querying.
|
|
343
343
|
|
|
@@ -355,11 +355,11 @@ await store.createIndex({
|
|
|
355
355
|
|
|
356
356
|
The dimension size must match the output dimension of your chosen embedding model. Common dimension sizes are:
|
|
357
357
|
|
|
358
|
-
- OpenAI text-embedding-3-small
|
|
359
|
-
- Cohere embed-multilingual-v3
|
|
360
|
-
- Google gemini-embedding-001
|
|
358
|
+
- `OpenAI text-embedding-3-small`: 1536 dimensions (or custom, e.g., 256)
|
|
359
|
+
- `Cohere embed-multilingual-v3`: 1024 dimensions
|
|
360
|
+
- `Google gemini-embedding-001`: 768 dimensions (or custom)
|
|
361
361
|
|
|
362
|
-
> **Warning:** Index dimensions
|
|
362
|
+
> **Warning:** Index dimensions can't be changed after creation. To use a different model, delete and recreate the index with the new dimension size.
|
|
363
363
|
|
|
364
364
|
### Naming Rules for Databases
|
|
365
365
|
|
|
@@ -490,7 +490,7 @@ Index names must:
|
|
|
490
490
|
- Example: `My_Index` is not valid (contains uppercase letters)
|
|
491
491
|
- Example: `_myindex` is not valid (begins with underscore)
|
|
492
492
|
|
|
493
|
-
**
|
|
493
|
+
**Elasticsearch**:
|
|
494
494
|
|
|
495
495
|
Index names must:
|
|
496
496
|
|
|
@@ -543,7 +543,7 @@ The upsert operation:
|
|
|
543
543
|
- Creates new vectors if they don't exist
|
|
544
544
|
- Automatically handles batching for large datasets
|
|
545
545
|
|
|
546
|
-
## Adding
|
|
546
|
+
## Adding metadata
|
|
547
547
|
|
|
548
548
|
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.
|
|
549
549
|
|
|
@@ -581,9 +581,9 @@ Key metadata considerations:
|
|
|
581
581
|
- Only include fields you plan to filter or sort by - extra fields add overhead
|
|
582
582
|
- Add timestamps (e.g., 'createdAt', 'lastUpdated') to track content freshness
|
|
583
583
|
|
|
584
|
-
## Deleting
|
|
584
|
+
## Deleting vectors
|
|
585
585
|
|
|
586
|
-
When building RAG applications, you often need to clean up stale vectors when documents are deleted or updated. Mastra provides the `deleteVectors` method that supports deleting vectors by metadata filters, making it
|
|
586
|
+
When building RAG applications, you often need to clean up stale vectors when documents are deleted or updated. Mastra provides the `deleteVectors` method that supports deleting vectors by metadata filters, making it straightforward to remove all embeddings associated with a specific document.
|
|
587
587
|
|
|
588
588
|
### Delete by Metadata Filter
|
|
589
589
|
|
|
@@ -637,7 +637,7 @@ await store.deleteVectors({
|
|
|
637
637
|
})
|
|
638
638
|
```
|
|
639
639
|
|
|
640
|
-
## Best
|
|
640
|
+
## Best practices
|
|
641
641
|
|
|
642
642
|
- Create indexes before bulk insertions
|
|
643
643
|
- Use batch operations for large insertions (the upsert method handles batching automatically)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Couchbase
|
|
1
|
+
# Couchbase vector store
|
|
2
2
|
|
|
3
3
|
The `CouchbaseVector` class provides vector search using [Couchbase Vector Search](https://docs.couchbase.com/server/current/vector-search/vector-search.html). It enables efficient similarity search and metadata filtering within your Couchbase collections.
|
|
4
4
|
|
|
@@ -33,7 +33,7 @@ yarn add @mastra/couchbase@latest
|
|
|
33
33
|
bun add @mastra/couchbase@latest
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
## Usage
|
|
36
|
+
## Usage example
|
|
37
37
|
|
|
38
38
|
```typescript
|
|
39
39
|
import { CouchbaseVector } from '@mastra/couchbase'
|
|
@@ -49,7 +49,7 @@ const store = new CouchbaseVector({
|
|
|
49
49
|
})
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
## Constructor
|
|
52
|
+
## Constructor options
|
|
53
53
|
|
|
54
54
|
**id** (`string`): Unique identifier for this vector store instance
|
|
55
55
|
|
|
@@ -69,7 +69,7 @@ const store = new CouchbaseVector({
|
|
|
69
69
|
|
|
70
70
|
## Methods
|
|
71
71
|
|
|
72
|
-
### createIndex()
|
|
72
|
+
### `createIndex()`
|
|
73
73
|
|
|
74
74
|
Creates a new vector index in Couchbase.
|
|
75
75
|
|
|
@@ -81,11 +81,11 @@ Creates a new vector index in Couchbase.
|
|
|
81
81
|
|
|
82
82
|
**metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search (Default: `cosine`)
|
|
83
83
|
|
|
84
|
-
### upsert()
|
|
84
|
+
### `upsert()`
|
|
85
85
|
|
|
86
86
|
Adds or updates vectors and their metadata in the collection.
|
|
87
87
|
|
|
88
|
-
> **Note:** You can upsert data before or after creating the index. The `upsert` method
|
|
88
|
+
> **Note:** You can upsert data before or after creating the index. The `upsert` method doesn't require the index to exist. Couchbase allows multiple Search indexes over the same collection.
|
|
89
89
|
|
|
90
90
|
**indexName** (`string`): Name of the index to insert into
|
|
91
91
|
|
|
@@ -95,11 +95,11 @@ Adds or updates vectors and their metadata in the collection.
|
|
|
95
95
|
|
|
96
96
|
**ids** (`string[]`): Optional vector IDs (auto-generated if not provided)
|
|
97
97
|
|
|
98
|
-
### query()
|
|
98
|
+
### `query()`
|
|
99
99
|
|
|
100
100
|
Searches for similar vectors.
|
|
101
101
|
|
|
102
|
-
> **Warning:** The `filter` and `includeVector` parameters
|
|
102
|
+
> **Warning:** The `filter` and `includeVector` parameters aren't currently supported. Filtering must be performed client-side after retrieving results, or by using the Couchbase SDK's Search capabilities directly. To retrieve the vector embedding, fetch the full document by ID using the Couchbase SDK.
|
|
103
103
|
|
|
104
104
|
**indexName** (`string`): Name of the index to search in
|
|
105
105
|
|
|
@@ -113,7 +113,7 @@ Searches for similar vectors.
|
|
|
113
113
|
|
|
114
114
|
**minScore** (`number`): Minimum similarity score threshold (Default: `0`)
|
|
115
115
|
|
|
116
|
-
### describeIndex()
|
|
116
|
+
### `describeIndex()`
|
|
117
117
|
|
|
118
118
|
Returns information about the index.
|
|
119
119
|
|
|
@@ -129,21 +129,21 @@ interface IndexStats {
|
|
|
129
129
|
}
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
### deleteIndex()
|
|
132
|
+
### `deleteIndex()`
|
|
133
133
|
|
|
134
134
|
Deletes an index and all its data.
|
|
135
135
|
|
|
136
136
|
**indexName** (`string`): Name of the index to delete
|
|
137
137
|
|
|
138
|
-
### listIndexes()
|
|
138
|
+
### `listIndexes()`
|
|
139
139
|
|
|
140
140
|
Lists all vector indexes in the Couchbase bucket.
|
|
141
141
|
|
|
142
142
|
Returns: `Promise<string[]>`
|
|
143
143
|
|
|
144
|
-
### updateVector()
|
|
144
|
+
### `updateVector()`
|
|
145
145
|
|
|
146
|
-
Updates a specific vector entry by its ID with new vector data and/or metadata. **Note:** Filter-based updates
|
|
146
|
+
Updates a specific vector entry by its ID with new vector data and/or metadata. **Note:** Filter-based updates aren't yet implemented for Couchbase.
|
|
147
147
|
|
|
148
148
|
**indexName** (`string`): Name of the index containing the vector
|
|
149
149
|
|
|
@@ -151,7 +151,7 @@ Updates a specific vector entry by its ID with new vector data and/or metadata.
|
|
|
151
151
|
|
|
152
152
|
**update** (`{ vector?: number[]; metadata?: Record<string, any>; }`): Object containing the vector and/or metadata to update
|
|
153
153
|
|
|
154
|
-
### deleteVector()
|
|
154
|
+
### `deleteVector()`
|
|
155
155
|
|
|
156
156
|
Deletes a single vector by its ID from the index.
|
|
157
157
|
|
|
@@ -159,19 +159,19 @@ Deletes a single vector by its ID from the index.
|
|
|
159
159
|
|
|
160
160
|
**id** (`string`): ID of the vector to delete
|
|
161
161
|
|
|
162
|
-
### deleteVectors()
|
|
162
|
+
### `deleteVectors()`
|
|
163
163
|
|
|
164
|
-
Deletes multiple vectors by their IDs. **Note:** Filter-based deletion
|
|
164
|
+
Deletes multiple vectors by their IDs. **Note:** Filter-based deletion isn't yet implemented for Couchbase.
|
|
165
165
|
|
|
166
166
|
**indexName** (`string`): Name of the index containing the vectors to delete
|
|
167
167
|
|
|
168
168
|
**ids** (`string[]`): Array of vector IDs to delete
|
|
169
169
|
|
|
170
|
-
### disconnect()
|
|
170
|
+
### `disconnect()`
|
|
171
171
|
|
|
172
172
|
Closes the Couchbase client connection. Should be called when done using the store.
|
|
173
173
|
|
|
174
|
-
## Response
|
|
174
|
+
## Response types
|
|
175
175
|
|
|
176
176
|
Query results are returned in this format:
|
|
177
177
|
|
|
@@ -184,7 +184,7 @@ interface QueryResult {
|
|
|
184
184
|
}
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
-
## Error
|
|
187
|
+
## Error handling
|
|
188
188
|
|
|
189
189
|
The store throws typed errors that can be caught:
|
|
190
190
|
|
|
@@ -210,7 +210,7 @@ try {
|
|
|
210
210
|
|
|
211
211
|
## Notes
|
|
212
212
|
|
|
213
|
-
- **Index Deletion Caveat:** Deleting a Search index
|
|
213
|
+
- **Index Deletion Caveat:** Deleting a Search index doesn't delete the vectors/documents in the associated Couchbase collection. Data remains unless explicitly removed.
|
|
214
214
|
- **Required Permissions:** The Couchbase user must have permissions to connect, read/write documents in the target collection (`kv` role), and manage Search Indexes (`search_admin` role on the relevant bucket/scope).
|
|
215
215
|
- **Index Definition Details & Document Structure:** The `createIndex` method constructs a Search Index definition that indexes the `embedding` field (as type `vector`) and the `content` field (as type `text`), targeting documents within the specified `scopeName.collectionName`. Each document stores the vector in the `embedding` field and metadata in the `metadata` field. If `metadata` contains a `text` property, its value is also copied to a top-level `content` field, which is indexed for text search.
|
|
216
216
|
- **Replication & Durability:** Consider using Couchbase's built-in replication and persistence features for data durability. Monitor index statistics regularly to ensure efficient search.
|
|
@@ -219,7 +219,7 @@ try {
|
|
|
219
219
|
|
|
220
220
|
- Index creation delays may impact immediate querying after creation.
|
|
221
221
|
- No hard enforcement of vector dimension at ingest time (dimension mismatches will error at query time).
|
|
222
|
-
- Vector insertion and index updates are eventually consistent; strong consistency
|
|
222
|
+
- Vector insertion and index updates are eventually consistent; strong consistency isn't guaranteed immediately after writes.
|
|
223
223
|
|
|
224
224
|
## Related
|
|
225
225
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/couchbase",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3-alpha.0",
|
|
4
4
|
"description": "Couchbase vector store provider for Mastra",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,20 +19,21 @@
|
|
|
19
19
|
"./package.json": "./package.json"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"couchbase": "^4.
|
|
22
|
+
"couchbase": "^4.7.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@types/node": "22.19.
|
|
26
|
-
"@vitest/coverage-v8": "4.
|
|
27
|
-
"@vitest/ui": "4.
|
|
28
|
-
"eslint": "^
|
|
25
|
+
"@types/node": "22.19.15",
|
|
26
|
+
"@vitest/coverage-v8": "4.1.5",
|
|
27
|
+
"@vitest/ui": "4.1.5",
|
|
28
|
+
"eslint": "^10.4.1",
|
|
29
29
|
"tsup": "^8.5.1",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"@
|
|
34
|
-
"@internal/
|
|
35
|
-
"@internal/
|
|
30
|
+
"tsx": "^4.22.4",
|
|
31
|
+
"typescript": "^6.0.3",
|
|
32
|
+
"vitest": "4.1.5",
|
|
33
|
+
"@internal/lint": "0.0.103",
|
|
34
|
+
"@internal/storage-test-utils": "0.0.99",
|
|
35
|
+
"@internal/types-builder": "0.0.78",
|
|
36
|
+
"@mastra/core": "1.42.0-alpha.4"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
38
39
|
"@mastra/core": ">=1.0.0-0 <2.0.0-0"
|