@mastra/couchbase 0.0.0-redis-cloud-transporter-20250508203756 → 0.0.0-trigger-playground-ui-package-20250506151043
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 +2 -38
- package/dist/index.cjs +71 -80
- package/dist/index.js +71 -80
- package/package.json +3 -3
- package/src/vector/index.integration.test.ts +1 -62
- package/src/vector/index.ts +67 -78
package/CHANGELOG.md
CHANGED
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
# @mastra/couchbase
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- 9cd1a46: [MASTRA-3338] update naming scheme for embedding index based on vector store rules and added duplicate index checks
|
|
8
|
-
- Updated dependencies [e450778]
|
|
9
|
-
- Updated dependencies [8902157]
|
|
10
|
-
- Updated dependencies [ca0dc88]
|
|
11
|
-
- Updated dependencies [526c570]
|
|
12
|
-
- Updated dependencies [9cd1a46]
|
|
13
|
-
- Updated dependencies [b5d2de0]
|
|
14
|
-
- Updated dependencies [644f8ad]
|
|
15
|
-
- Updated dependencies [70dbf51]
|
|
16
|
-
- @mastra/core@0.0.0-redis-cloud-transporter-20250508203756
|
|
17
|
-
|
|
18
|
-
## 0.0.3-alpha.0
|
|
19
|
-
|
|
20
|
-
### Patch Changes
|
|
21
|
-
|
|
22
|
-
- Updated dependencies [526c570]
|
|
23
|
-
- Updated dependencies [b5d2de0]
|
|
24
|
-
- Updated dependencies [644f8ad]
|
|
25
|
-
- @mastra/core@0.9.3-alpha.0
|
|
26
|
-
|
|
27
|
-
## 0.0.2
|
|
3
|
+
## 0.0.0-trigger-playground-ui-package-20250506151043
|
|
28
4
|
|
|
29
5
|
### Patch Changes
|
|
30
6
|
|
|
@@ -43,20 +19,8 @@
|
|
|
43
19
|
- Updated dependencies [17826a9]
|
|
44
20
|
- Updated dependencies [7d8b7c7]
|
|
45
21
|
- Updated dependencies [fba031f]
|
|
46
|
-
- Updated dependencies [3a5f1e1]
|
|
47
22
|
- Updated dependencies [51e6923]
|
|
48
|
-
-
|
|
49
|
-
- @mastra/core@0.9.2
|
|
50
|
-
|
|
51
|
-
## 0.0.2-alpha.1
|
|
52
|
-
|
|
53
|
-
### Patch Changes
|
|
54
|
-
|
|
55
|
-
- Updated dependencies [6052aa6]
|
|
56
|
-
- Updated dependencies [7d8b7c7]
|
|
57
|
-
- Updated dependencies [3a5f1e1]
|
|
58
|
-
- Updated dependencies [8398d89]
|
|
59
|
-
- @mastra/core@0.9.2-alpha.6
|
|
23
|
+
- @mastra/core@0.0.0-trigger-playground-ui-package-20250506151043
|
|
60
24
|
|
|
61
25
|
## 0.0.2-alpha.0
|
|
62
26
|
|
package/dist/index.cjs
CHANGED
|
@@ -59,95 +59,86 @@ var CouchbaseVector = class extends vector.MastraVector {
|
|
|
59
59
|
if (!Number.isInteger(dimension) || dimension <= 0) {
|
|
60
60
|
throw new Error("Dimension must be a positive integer");
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
await this.scope.searchIndexes().upsertIndex({
|
|
63
|
+
name: indexName,
|
|
64
|
+
sourceName: this.bucketName,
|
|
65
|
+
type: "fulltext-index",
|
|
66
|
+
params: {
|
|
67
|
+
doc_config: {
|
|
68
|
+
docid_prefix_delim: "",
|
|
69
|
+
docid_regexp: "",
|
|
70
|
+
mode: "scope.collection.type_field",
|
|
71
|
+
type_field: "type"
|
|
72
|
+
},
|
|
73
|
+
mapping: {
|
|
74
|
+
default_analyzer: "standard",
|
|
75
|
+
default_datetime_parser: "dateTimeOptional",
|
|
76
|
+
default_field: "_all",
|
|
77
|
+
default_mapping: {
|
|
78
|
+
dynamic: true,
|
|
79
|
+
enabled: false
|
|
73
80
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
default_type: "_default",
|
|
82
|
+
docvalues_dynamic: true,
|
|
83
|
+
// [Doc](https://docs.couchbase.com/server/current/search/search-index-params.html#params) mentions this attribute is required for vector search to return the indexed field
|
|
84
|
+
index_dynamic: true,
|
|
85
|
+
store_dynamic: true,
|
|
86
|
+
// [Doc](https://docs.couchbase.com/server/current/search/search-index-params.html#params) mentions this attribute is required for vector search to return the indexed field
|
|
87
|
+
type_field: "_type",
|
|
88
|
+
types: {
|
|
89
|
+
[`${this.scopeName}.${this.collectionName}`]: {
|
|
79
90
|
dynamic: true,
|
|
80
|
-
enabled:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
]
|
|
112
|
-
},
|
|
113
|
-
content: {
|
|
114
|
-
enabled: true,
|
|
115
|
-
fields: [
|
|
116
|
-
{
|
|
117
|
-
index: true,
|
|
118
|
-
name: "content",
|
|
119
|
-
store: true,
|
|
120
|
-
type: "text"
|
|
121
|
-
}
|
|
122
|
-
]
|
|
123
|
-
}
|
|
91
|
+
enabled: true,
|
|
92
|
+
properties: {
|
|
93
|
+
embedding: {
|
|
94
|
+
enabled: true,
|
|
95
|
+
fields: [
|
|
96
|
+
{
|
|
97
|
+
dims: dimension,
|
|
98
|
+
index: true,
|
|
99
|
+
name: "embedding",
|
|
100
|
+
similarity: DISTANCE_MAPPING[metric],
|
|
101
|
+
type: "vector",
|
|
102
|
+
vector_index_optimized_for: "recall",
|
|
103
|
+
store: true,
|
|
104
|
+
// CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields
|
|
105
|
+
docvalues: true,
|
|
106
|
+
// CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields
|
|
107
|
+
include_term_vectors: true
|
|
108
|
+
// CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
content: {
|
|
113
|
+
enabled: true,
|
|
114
|
+
fields: [
|
|
115
|
+
{
|
|
116
|
+
index: true,
|
|
117
|
+
name: "content",
|
|
118
|
+
store: true,
|
|
119
|
+
type: "text"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
124
122
|
}
|
|
125
123
|
}
|
|
126
124
|
}
|
|
127
|
-
},
|
|
128
|
-
store: {
|
|
129
|
-
indexType: "scorch",
|
|
130
|
-
segmentVersion: 16
|
|
131
125
|
}
|
|
132
126
|
},
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
planParams: {
|
|
137
|
-
maxPartitionsPerPIndex: 64,
|
|
138
|
-
indexPartitions: 16,
|
|
139
|
-
numReplicas: 0
|
|
127
|
+
store: {
|
|
128
|
+
indexType: "scorch",
|
|
129
|
+
segmentVersion: 16
|
|
140
130
|
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
131
|
+
},
|
|
132
|
+
sourceUuid: "",
|
|
133
|
+
sourceParams: {},
|
|
134
|
+
sourceType: "gocbcore",
|
|
135
|
+
planParams: {
|
|
136
|
+
maxPartitionsPerPIndex: 64,
|
|
137
|
+
indexPartitions: 16,
|
|
138
|
+
numReplicas: 0
|
|
148
139
|
}
|
|
149
|
-
|
|
150
|
-
|
|
140
|
+
});
|
|
141
|
+
this.vector_dimension = dimension;
|
|
151
142
|
}
|
|
152
143
|
async upsert(params) {
|
|
153
144
|
const { vectors, metadata, ids } = params;
|
package/dist/index.js
CHANGED
|
@@ -57,95 +57,86 @@ var CouchbaseVector = class extends MastraVector {
|
|
|
57
57
|
if (!Number.isInteger(dimension) || dimension <= 0) {
|
|
58
58
|
throw new Error("Dimension must be a positive integer");
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
await this.scope.searchIndexes().upsertIndex({
|
|
61
|
+
name: indexName,
|
|
62
|
+
sourceName: this.bucketName,
|
|
63
|
+
type: "fulltext-index",
|
|
64
|
+
params: {
|
|
65
|
+
doc_config: {
|
|
66
|
+
docid_prefix_delim: "",
|
|
67
|
+
docid_regexp: "",
|
|
68
|
+
mode: "scope.collection.type_field",
|
|
69
|
+
type_field: "type"
|
|
70
|
+
},
|
|
71
|
+
mapping: {
|
|
72
|
+
default_analyzer: "standard",
|
|
73
|
+
default_datetime_parser: "dateTimeOptional",
|
|
74
|
+
default_field: "_all",
|
|
75
|
+
default_mapping: {
|
|
76
|
+
dynamic: true,
|
|
77
|
+
enabled: false
|
|
71
78
|
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
default_type: "_default",
|
|
80
|
+
docvalues_dynamic: true,
|
|
81
|
+
// [Doc](https://docs.couchbase.com/server/current/search/search-index-params.html#params) mentions this attribute is required for vector search to return the indexed field
|
|
82
|
+
index_dynamic: true,
|
|
83
|
+
store_dynamic: true,
|
|
84
|
+
// [Doc](https://docs.couchbase.com/server/current/search/search-index-params.html#params) mentions this attribute is required for vector search to return the indexed field
|
|
85
|
+
type_field: "_type",
|
|
86
|
+
types: {
|
|
87
|
+
[`${this.scopeName}.${this.collectionName}`]: {
|
|
77
88
|
dynamic: true,
|
|
78
|
-
enabled:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
]
|
|
110
|
-
},
|
|
111
|
-
content: {
|
|
112
|
-
enabled: true,
|
|
113
|
-
fields: [
|
|
114
|
-
{
|
|
115
|
-
index: true,
|
|
116
|
-
name: "content",
|
|
117
|
-
store: true,
|
|
118
|
-
type: "text"
|
|
119
|
-
}
|
|
120
|
-
]
|
|
121
|
-
}
|
|
89
|
+
enabled: true,
|
|
90
|
+
properties: {
|
|
91
|
+
embedding: {
|
|
92
|
+
enabled: true,
|
|
93
|
+
fields: [
|
|
94
|
+
{
|
|
95
|
+
dims: dimension,
|
|
96
|
+
index: true,
|
|
97
|
+
name: "embedding",
|
|
98
|
+
similarity: DISTANCE_MAPPING[metric],
|
|
99
|
+
type: "vector",
|
|
100
|
+
vector_index_optimized_for: "recall",
|
|
101
|
+
store: true,
|
|
102
|
+
// CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields
|
|
103
|
+
docvalues: true,
|
|
104
|
+
// CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields
|
|
105
|
+
include_term_vectors: true
|
|
106
|
+
// CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
content: {
|
|
111
|
+
enabled: true,
|
|
112
|
+
fields: [
|
|
113
|
+
{
|
|
114
|
+
index: true,
|
|
115
|
+
name: "content",
|
|
116
|
+
store: true,
|
|
117
|
+
type: "text"
|
|
118
|
+
}
|
|
119
|
+
]
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
}
|
|
125
|
-
},
|
|
126
|
-
store: {
|
|
127
|
-
indexType: "scorch",
|
|
128
|
-
segmentVersion: 16
|
|
129
123
|
}
|
|
130
124
|
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
planParams: {
|
|
135
|
-
maxPartitionsPerPIndex: 64,
|
|
136
|
-
indexPartitions: 16,
|
|
137
|
-
numReplicas: 0
|
|
125
|
+
store: {
|
|
126
|
+
indexType: "scorch",
|
|
127
|
+
segmentVersion: 16
|
|
138
128
|
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
129
|
+
},
|
|
130
|
+
sourceUuid: "",
|
|
131
|
+
sourceParams: {},
|
|
132
|
+
sourceType: "gocbcore",
|
|
133
|
+
planParams: {
|
|
134
|
+
maxPartitionsPerPIndex: 64,
|
|
135
|
+
indexPartitions: 16,
|
|
136
|
+
numReplicas: 0
|
|
146
137
|
}
|
|
147
|
-
|
|
148
|
-
|
|
138
|
+
});
|
|
139
|
+
this.vector_dimension = dimension;
|
|
149
140
|
}
|
|
150
141
|
async upsert(params) {
|
|
151
142
|
const { vectors, metadata, ids } = params;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/couchbase",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-trigger-playground-ui-package-20250506151043",
|
|
4
4
|
"description": "Couchbase vector store provider for Mastra",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"couchbase": "^4.4.5",
|
|
23
|
-
"@mastra/core": "0.0.0-
|
|
23
|
+
"@mastra/core": "0.0.0-trigger-playground-ui-package-20250506151043"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@microsoft/api-extractor": "^7.52.1",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"tsup": "^8.4.0",
|
|
33
33
|
"typescript": "^5.8.2",
|
|
34
34
|
"vitest": "^3.0.9",
|
|
35
|
-
"@internal/lint": "0.0.0-
|
|
35
|
+
"@internal/lint": "0.0.0-trigger-playground-ui-package-20250506151043"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
// The tests will automatically start and configure the required Couchbase container.
|
|
4
4
|
|
|
5
5
|
import { execSync } from 'child_process';
|
|
6
|
-
import { randomUUID } from 'crypto';
|
|
7
6
|
import axios from 'axios';
|
|
8
7
|
import type { Cluster, Bucket, Scope, Collection } from 'couchbase';
|
|
9
8
|
import { connect } from 'couchbase';
|
|
10
|
-
import { describe, it, expect, beforeAll, afterAll
|
|
9
|
+
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
11
10
|
import { CouchbaseVector, DISTANCE_MAPPING } from './index';
|
|
12
11
|
|
|
13
12
|
const containerName = 'mastra_couchbase_testing';
|
|
@@ -432,66 +431,6 @@ describe('Integration Testing CouchbaseVector', async () => {
|
|
|
432
431
|
}),
|
|
433
432
|
).rejects.toThrow('No vectors provided');
|
|
434
433
|
}, 50000);
|
|
435
|
-
|
|
436
|
-
it('should handle non-existent index queries', async () => {
|
|
437
|
-
await expect(
|
|
438
|
-
couchbase_client.query({ indexName: 'non-existent-index', queryVector: [1, 2, 3] }),
|
|
439
|
-
).rejects.toThrow();
|
|
440
|
-
}, 50000);
|
|
441
|
-
|
|
442
|
-
it('should handle duplicate index creation gracefully', async () => {
|
|
443
|
-
const duplicateIndexName = `duplicate-test-${randomUUID()}`;
|
|
444
|
-
const dimension = 768;
|
|
445
|
-
const infoSpy = vi.spyOn(couchbase_client['logger'], 'info');
|
|
446
|
-
const warnSpy = vi.spyOn(couchbase_client['logger'], 'warn');
|
|
447
|
-
|
|
448
|
-
try {
|
|
449
|
-
// Create index first time
|
|
450
|
-
await couchbase_client.createIndex({
|
|
451
|
-
indexName: duplicateIndexName,
|
|
452
|
-
dimension,
|
|
453
|
-
metric: 'cosine',
|
|
454
|
-
});
|
|
455
|
-
|
|
456
|
-
// Try to create with same dimensions - should not throw
|
|
457
|
-
await expect(
|
|
458
|
-
couchbase_client.createIndex({
|
|
459
|
-
indexName: duplicateIndexName,
|
|
460
|
-
dimension,
|
|
461
|
-
metric: 'cosine',
|
|
462
|
-
}),
|
|
463
|
-
).resolves.not.toThrow();
|
|
464
|
-
|
|
465
|
-
expect(infoSpy).toHaveBeenCalledWith(expect.stringContaining('already exists with'));
|
|
466
|
-
|
|
467
|
-
// Try to create with same dimensions and different metric - should not throw
|
|
468
|
-
await expect(
|
|
469
|
-
couchbase_client.createIndex({
|
|
470
|
-
indexName: duplicateIndexName,
|
|
471
|
-
dimension,
|
|
472
|
-
metric: 'euclidean',
|
|
473
|
-
}),
|
|
474
|
-
).resolves.not.toThrow();
|
|
475
|
-
|
|
476
|
-
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Attempted to create index with metric'));
|
|
477
|
-
|
|
478
|
-
// Try to create with different dimensions - should throw
|
|
479
|
-
await expect(
|
|
480
|
-
couchbase_client.createIndex({
|
|
481
|
-
indexName: duplicateIndexName,
|
|
482
|
-
dimension: dimension + 1,
|
|
483
|
-
metric: 'cosine',
|
|
484
|
-
}),
|
|
485
|
-
).rejects.toThrow(
|
|
486
|
-
`Index "${duplicateIndexName}" already exists with ${dimension} dimensions, but ${dimension + 1} dimensions were requested`,
|
|
487
|
-
);
|
|
488
|
-
} finally {
|
|
489
|
-
infoSpy.mockRestore();
|
|
490
|
-
warnSpy.mockRestore();
|
|
491
|
-
// Cleanup
|
|
492
|
-
await couchbase_client.deleteIndex(duplicateIndexName);
|
|
493
|
-
}
|
|
494
|
-
}, 50000);
|
|
495
434
|
});
|
|
496
435
|
|
|
497
436
|
describe('Vector Dimension Tracking', () => {
|
package/src/vector/index.ts
CHANGED
|
@@ -84,92 +84,81 @@ export class CouchbaseVector extends MastraVector {
|
|
|
84
84
|
throw new Error('Dimension must be a positive integer');
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
87
|
+
await this.scope.searchIndexes().upsertIndex({
|
|
88
|
+
name: indexName,
|
|
89
|
+
sourceName: this.bucketName,
|
|
90
|
+
type: 'fulltext-index',
|
|
91
|
+
params: {
|
|
92
|
+
doc_config: {
|
|
93
|
+
docid_prefix_delim: '',
|
|
94
|
+
docid_regexp: '',
|
|
95
|
+
mode: 'scope.collection.type_field',
|
|
96
|
+
type_field: 'type',
|
|
97
|
+
},
|
|
98
|
+
mapping: {
|
|
99
|
+
default_analyzer: 'standard',
|
|
100
|
+
default_datetime_parser: 'dateTimeOptional',
|
|
101
|
+
default_field: '_all',
|
|
102
|
+
default_mapping: {
|
|
103
|
+
dynamic: true,
|
|
104
|
+
enabled: false,
|
|
98
105
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
default_type: '_default',
|
|
107
|
+
docvalues_dynamic: true, // [Doc](https://docs.couchbase.com/server/current/search/search-index-params.html#params) mentions this attribute is required for vector search to return the indexed field
|
|
108
|
+
index_dynamic: true,
|
|
109
|
+
store_dynamic: true, // [Doc](https://docs.couchbase.com/server/current/search/search-index-params.html#params) mentions this attribute is required for vector search to return the indexed field
|
|
110
|
+
type_field: '_type',
|
|
111
|
+
types: {
|
|
112
|
+
[`${this.scopeName}.${this.collectionName}`]: {
|
|
104
113
|
dynamic: true,
|
|
105
|
-
enabled:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
content: {
|
|
134
|
-
enabled: true,
|
|
135
|
-
fields: [
|
|
136
|
-
{
|
|
137
|
-
index: true,
|
|
138
|
-
name: 'content',
|
|
139
|
-
store: true,
|
|
140
|
-
type: 'text',
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
},
|
|
114
|
+
enabled: true,
|
|
115
|
+
properties: {
|
|
116
|
+
embedding: {
|
|
117
|
+
enabled: true,
|
|
118
|
+
fields: [
|
|
119
|
+
{
|
|
120
|
+
dims: dimension,
|
|
121
|
+
index: true,
|
|
122
|
+
name: 'embedding',
|
|
123
|
+
similarity: DISTANCE_MAPPING[metric],
|
|
124
|
+
type: 'vector',
|
|
125
|
+
vector_index_optimized_for: 'recall',
|
|
126
|
+
store: true, // CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields
|
|
127
|
+
docvalues: true, // CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields
|
|
128
|
+
include_term_vectors: true, // CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
content: {
|
|
133
|
+
enabled: true,
|
|
134
|
+
fields: [
|
|
135
|
+
{
|
|
136
|
+
index: true,
|
|
137
|
+
name: 'content',
|
|
138
|
+
store: true,
|
|
139
|
+
type: 'text',
|
|
140
|
+
},
|
|
141
|
+
],
|
|
144
142
|
},
|
|
145
143
|
},
|
|
146
144
|
},
|
|
147
145
|
},
|
|
148
|
-
store: {
|
|
149
|
-
indexType: 'scorch',
|
|
150
|
-
segmentVersion: 16,
|
|
151
|
-
},
|
|
152
146
|
},
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
planParams: {
|
|
157
|
-
maxPartitionsPerPIndex: 64,
|
|
158
|
-
indexPartitions: 16,
|
|
159
|
-
numReplicas: 0,
|
|
147
|
+
store: {
|
|
148
|
+
indexType: 'scorch',
|
|
149
|
+
segmentVersion: 16,
|
|
160
150
|
},
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
151
|
+
},
|
|
152
|
+
sourceUuid: '',
|
|
153
|
+
sourceParams: {},
|
|
154
|
+
sourceType: 'gocbcore',
|
|
155
|
+
planParams: {
|
|
156
|
+
maxPartitionsPerPIndex: 64,
|
|
157
|
+
indexPartitions: 16,
|
|
158
|
+
numReplicas: 0,
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
this.vector_dimension = dimension;
|
|
173
162
|
}
|
|
174
163
|
|
|
175
164
|
async upsert(params: UpsertVectorParams): Promise<string[]> {
|