@relevanceai/sdk 1.1.0 → 1.6.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/README.md +28 -19
- package/dist-cjs/generated/VectorApi.js +99 -3
- package/dist-cjs/services/discovery/Dataset.js +7 -4
- package/dist-cjs/services/discovery/index.js +94 -63
- package/dist-es/generated/VectorApi.js +147 -3
- package/dist-es/services/discovery/Dataset.js +7 -4
- package/dist-es/services/discovery/index.js +118 -85
- package/dist-types/generated/VectorApi.d.ts +45 -9
- package/dist-types/generated/_VectorApiSchemaTypes.d.ts +575 -18
- package/dist-types/services/discovery/Dataset.d.ts +1 -0
- package/dist-types/services/discovery/index.d.ts +50 -15
- package/package.json +1 -1
- package/dist-cjs/generated/Discovery.js +0 -82
- package/dist-cjs/generated/Vector.js +0 -634
- package/dist-cjs/generated/_DiscoverySchemaTypes.js +0 -6
- package/dist-cjs/generated/_VectorSchemaTypes.js +0 -6
- package/dist-cjs/generated/clients.js +0 -82
- package/dist-es/generated/Discovery.js +0 -179
- package/dist-es/generated/Vector.js +0 -1007
- package/dist-es/generated/_DiscoverySchemaTypes.js +0 -5
- package/dist-es/generated/_VectorSchemaTypes.js +0 -5
- package/dist-es/generated/clients.js +0 -179
- package/dist-types/generated/Discovery.d.ts +0 -32
- package/dist-types/generated/Vector.d.ts +0 -239
- package/dist-types/generated/_DiscoverySchemaTypes.d.ts +0 -911
- package/dist-types/generated/_VectorSchemaTypes.d.ts +0 -5017
- package/dist-types/generated/clients.d.ts +0 -942
package/README.md
CHANGED
|
@@ -56,18 +56,27 @@ import {QueryBuilder,DiscoveryClient,BulkInsertOutput} from "@relevanceai/sdk";
|
|
|
56
56
|
```javascript
|
|
57
57
|
const discovery = new DiscoveryClient({ });
|
|
58
58
|
const dataset = discovery.dataset('tshirts-prod');
|
|
59
|
-
// Here we create some demo data. Replace this with your real data
|
|
59
|
+
// Here we create some demo data. Replace this with your real data
|
|
60
|
+
const fakeVector = [];
|
|
61
|
+
for (let i = 0; i < 768; i++) fakeVector.push(1);
|
|
60
62
|
const tshirtsData = [];
|
|
61
|
-
for (let i = 0; i <
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
for (let i = 0; i < 10000; i++) {
|
|
64
|
+
tshirtsData.push({_id:`tshirt-${i}1`,color:'red',price:i/1000,'title_text@1-0_vector_':fakeVector});
|
|
65
|
+
tshirtsData.push({_id:`tshirt-${i}2`,color:'blue',price:i/1000});
|
|
66
|
+
tshirtsData.push({_id:`tshirt-${i}3`,color:'orange',price:i/1000});
|
|
65
67
|
}
|
|
66
|
-
const res = await dataset.insertDocuments(tshirtsData,{batchSize:
|
|
68
|
+
const res = await dataset.insertDocuments(tshirtsData,{batchSize:10000});
|
|
67
69
|
```
|
|
68
70
|
### insertDocuments will output:
|
|
69
71
|
```javascript
|
|
70
|
-
{"inserted":
|
|
72
|
+
{"inserted":30000,"failed_documents":[]}
|
|
73
|
+
```
|
|
74
|
+
## Text Search and Vector Search
|
|
75
|
+
```javascript
|
|
76
|
+
const builder = QueryBuilder();
|
|
77
|
+
builder.query('red').text().vector('title_text@1-0_vector_',0.5).minimumRelevance(0.1);
|
|
78
|
+
// .text() searches all fields. alternatively, use .text(field1).text(field2)... to search specific fields
|
|
79
|
+
const searchResults = await dataset.search(builder);
|
|
71
80
|
```
|
|
72
81
|
## Filter and retrieve items
|
|
73
82
|
```javascript
|
|
@@ -88,7 +97,7 @@ const filteredItems = await dataset.search(filters);
|
|
|
88
97
|
}
|
|
89
98
|
...
|
|
90
99
|
],
|
|
91
|
-
resultsSize:
|
|
100
|
+
resultsSize: 10200,
|
|
92
101
|
aggregations: {},
|
|
93
102
|
aggregates: {},
|
|
94
103
|
aggregateStats: {}
|
|
@@ -105,21 +114,21 @@ const aggregatesResult = await dataset.search(aggregates);
|
|
|
105
114
|
{
|
|
106
115
|
aggregates:{
|
|
107
116
|
color: {
|
|
108
|
-
results: { blue:
|
|
117
|
+
results: { blue: 10000, orange: 10000, red: 10000 },
|
|
109
118
|
aggregates: {}
|
|
110
119
|
},
|
|
111
120
|
price: {
|
|
112
121
|
results: {
|
|
113
|
-
'0':
|
|
114
|
-
'10':
|
|
115
|
-
'20':
|
|
116
|
-
'30':
|
|
117
|
-
'40':
|
|
118
|
-
'50':
|
|
119
|
-
'60':
|
|
120
|
-
'70':
|
|
121
|
-
'80':
|
|
122
|
-
'90':
|
|
122
|
+
'0': 0000,
|
|
123
|
+
'10': 3000,
|
|
124
|
+
'20': 3000,
|
|
125
|
+
'30': 3000,
|
|
126
|
+
'40': 3000,
|
|
127
|
+
'50': 3000,
|
|
128
|
+
'60': 3000,
|
|
129
|
+
'70': 3000,
|
|
130
|
+
'80': 3000,
|
|
131
|
+
'90': 3000
|
|
123
132
|
},
|
|
124
133
|
aggregates: {}
|
|
125
134
|
}
|
|
@@ -430,6 +430,14 @@ class VectorApiClient extends BaseClient_1._GenericClient {
|
|
|
430
430
|
options
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
|
+
async clustercentroidsapiv2servicesclustercentroidslistpost(input, options) {
|
|
434
|
+
return this.SendRequest({
|
|
435
|
+
input,
|
|
436
|
+
method: 'post',
|
|
437
|
+
path: '/services/cluster/centroids/list',
|
|
438
|
+
options
|
|
439
|
+
});
|
|
440
|
+
}
|
|
433
441
|
async clustercentroidsgetapiservicesclustercentroidsgetget(input, options) {
|
|
434
442
|
return this.SendRequest({
|
|
435
443
|
input,
|
|
@@ -438,7 +446,15 @@ class VectorApiClient extends BaseClient_1._GenericClient {
|
|
|
438
446
|
options
|
|
439
447
|
});
|
|
440
448
|
}
|
|
441
|
-
async
|
|
449
|
+
async clustercentroidsgetapiservicesclustercentroidsgetpost(input, options) {
|
|
450
|
+
return this.SendRequest({
|
|
451
|
+
input,
|
|
452
|
+
method: 'post',
|
|
453
|
+
path: '/services/cluster/centroids/get',
|
|
454
|
+
options
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
async insertclustercentroids2apiservicesclustercentroidsinsertpost(input, options) {
|
|
442
458
|
return this.SendRequest({
|
|
443
459
|
input,
|
|
444
460
|
method: 'post',
|
|
@@ -446,6 +462,38 @@ class VectorApiClient extends BaseClient_1._GenericClient {
|
|
|
446
462
|
options
|
|
447
463
|
});
|
|
448
464
|
}
|
|
465
|
+
async updatecentroidsapiv2servicesclustercentroidsupdatepost(input, options) {
|
|
466
|
+
return this.SendRequest({
|
|
467
|
+
input,
|
|
468
|
+
method: 'post',
|
|
469
|
+
path: '/services/cluster/centroids/update',
|
|
470
|
+
options
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
async deletecentroidsapiservicesclustercentroidscentroididdeleteget(input, options) {
|
|
474
|
+
return this.SendRequest({
|
|
475
|
+
input,
|
|
476
|
+
method: 'get',
|
|
477
|
+
path: '/services/cluster/centroids/{centroid_id}/delete',
|
|
478
|
+
options
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
async deletecentroidsapiservicesclustercentroidscentroididdeletepost(input, options) {
|
|
482
|
+
return this.SendRequest({
|
|
483
|
+
input,
|
|
484
|
+
method: 'post',
|
|
485
|
+
path: '/services/cluster/centroids/{centroid_id}/delete',
|
|
486
|
+
options
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
async clustercentroidsdeleteapiservicesclustercentroidsdeletepost(input, options) {
|
|
490
|
+
return this.SendRequest({
|
|
491
|
+
input,
|
|
492
|
+
method: 'post',
|
|
493
|
+
path: '/services/cluster/centroids/delete',
|
|
494
|
+
options
|
|
495
|
+
});
|
|
496
|
+
}
|
|
449
497
|
async clustercentroidsgetapiservicesclustercentroidsdocumentspost(input, options) {
|
|
450
498
|
return this.SendRequest({
|
|
451
499
|
input,
|
|
@@ -454,7 +502,39 @@ class VectorApiClient extends BaseClient_1._GenericClient {
|
|
|
454
502
|
options
|
|
455
503
|
});
|
|
456
504
|
}
|
|
457
|
-
async
|
|
505
|
+
async centroidsmetadatagetapiservicesclustercentroidsmetadataget(input, options) {
|
|
506
|
+
return this.SendRequest({
|
|
507
|
+
input,
|
|
508
|
+
method: 'get',
|
|
509
|
+
path: '/services/cluster/centroids/metadata',
|
|
510
|
+
options
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
async centroidsmetadatapostapiv2servicesclustercentroidsmetadatapost(input, options) {
|
|
514
|
+
return this.SendRequest({
|
|
515
|
+
input,
|
|
516
|
+
method: 'post',
|
|
517
|
+
path: '/services/cluster/centroids/metadata',
|
|
518
|
+
options
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
async centroidslistclosesttocenterv2servicesclustercentroidslistclosesttocenterpost(input, options) {
|
|
522
|
+
return this.SendRequest({
|
|
523
|
+
input,
|
|
524
|
+
method: 'post',
|
|
525
|
+
path: '/services/cluster/centroids/list_closest_to_center',
|
|
526
|
+
options
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
async centroidslistfurthestfromcenterv2servicesclustercentroidslistfurthestfromcenterpost(input, options) {
|
|
530
|
+
return this.SendRequest({
|
|
531
|
+
input,
|
|
532
|
+
method: 'post',
|
|
533
|
+
path: '/services/cluster/centroids/list_furthest_from_center',
|
|
534
|
+
options
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
async clusteraggregateapiv2servicesclusteraggregatepost(input, options) {
|
|
458
538
|
return this.SendRequest({
|
|
459
539
|
input,
|
|
460
540
|
method: 'post',
|
|
@@ -462,7 +542,7 @@ class VectorApiClient extends BaseClient_1._GenericClient {
|
|
|
462
542
|
options
|
|
463
543
|
});
|
|
464
544
|
}
|
|
465
|
-
async
|
|
545
|
+
async advancedclusterfacetsapiservicesclusterfacetsget(input, options) {
|
|
466
546
|
return this.SendRequest({
|
|
467
547
|
input,
|
|
468
548
|
method: 'get',
|
|
@@ -470,6 +550,22 @@ class VectorApiClient extends BaseClient_1._GenericClient {
|
|
|
470
550
|
options
|
|
471
551
|
});
|
|
472
552
|
}
|
|
553
|
+
async clusterlistservicesclusterlistget(input, options) {
|
|
554
|
+
return this.SendRequest({
|
|
555
|
+
input,
|
|
556
|
+
method: 'get',
|
|
557
|
+
path: '/services/cluster/list',
|
|
558
|
+
options
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
async clusterlistmultiservicesclusterlistpost(input, options) {
|
|
562
|
+
return this.SendRequest({
|
|
563
|
+
input,
|
|
564
|
+
method: 'post',
|
|
565
|
+
path: '/services/cluster/list',
|
|
566
|
+
options
|
|
567
|
+
});
|
|
568
|
+
}
|
|
473
569
|
async tagapiservicestaggertagpost(input, options) {
|
|
474
570
|
return this.SendRequest({
|
|
475
571
|
input,
|
|
@@ -27,8 +27,11 @@ class Dataset {
|
|
|
27
27
|
if (arg instanceof _1._QueryBuilder) {
|
|
28
28
|
payload = { ...payload, ...arg.build() };
|
|
29
29
|
}
|
|
30
|
-
else
|
|
30
|
+
else {
|
|
31
31
|
options = arg;
|
|
32
|
+
if (options.rawPayload)
|
|
33
|
+
payload = { ...payload, ...options.rawPayload };
|
|
34
|
+
}
|
|
32
35
|
}
|
|
33
36
|
const reqCallback = async () => await this.client.apiClient.SimpleSearchPost(payload, { dataset_id: this.name });
|
|
34
37
|
if (options.debounce && this.debounceTimer) {
|
|
@@ -92,7 +95,7 @@ class Dataset {
|
|
|
92
95
|
return finalResults;
|
|
93
96
|
}
|
|
94
97
|
async updateDocumentsWhere(filters, partialUpdates) {
|
|
95
|
-
return (await this.client.apiClient.UpdateWhere({ filters: filters.
|
|
98
|
+
return (await this.client.apiClient.UpdateWhere({ filters: filters.build().filters, updates: partialUpdates })).body;
|
|
96
99
|
}
|
|
97
100
|
async getDocument(documentId) {
|
|
98
101
|
return (await this.client.apiClient.GetDocument({ document_id: documentId })).body;
|
|
@@ -103,11 +106,11 @@ class Dataset {
|
|
|
103
106
|
async deleteDocuments(documentIds) {
|
|
104
107
|
var _a;
|
|
105
108
|
const filters = (0, _1.QueryBuilder)().match('_id', documentIds);
|
|
106
|
-
return (await this.client.apiClient.DeleteWhere({ filters: (_a = filters.
|
|
109
|
+
return (await this.client.apiClient.DeleteWhere({ filters: (_a = filters.build().filters) !== null && _a !== void 0 ? _a : [] })).body;
|
|
107
110
|
}
|
|
108
111
|
async deleteDocumentsWhere(filters) {
|
|
109
112
|
var _a;
|
|
110
|
-
return (await this.client.apiClient.DeleteWhere({ filters: (_a = filters.
|
|
113
|
+
return (await this.client.apiClient.DeleteWhere({ filters: (_a = filters.build().filters) !== null && _a !== void 0 ? _a : [] })).body;
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
116
|
exports.Dataset = Dataset;
|
|
@@ -1,41 +1,118 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DiscoveryClient = exports._QueryBuilder = exports.QueryBuilder = void 0;
|
|
3
|
+
exports.DiscoveryClient = exports._QueryBuilder = exports._FilterBuilder = exports.FilterBuilder = exports.QueryBuilder = void 0;
|
|
4
4
|
const __1 = require("../../");
|
|
5
5
|
const Dataset_1 = require("./Dataset");
|
|
6
6
|
function QueryBuilder() {
|
|
7
7
|
return new _QueryBuilder();
|
|
8
8
|
}
|
|
9
9
|
exports.QueryBuilder = QueryBuilder;
|
|
10
|
-
|
|
10
|
+
function FilterBuilder() {
|
|
11
|
+
return new _FilterBuilder();
|
|
12
|
+
}
|
|
13
|
+
exports.FilterBuilder = FilterBuilder;
|
|
14
|
+
class _FilterBuilder {
|
|
11
15
|
constructor() {
|
|
12
16
|
this.body = { filters: [], fieldsToAggregate: [], fieldsToAggregateStats: [] };
|
|
13
17
|
}
|
|
18
|
+
buildFilters() {
|
|
19
|
+
return this.body.filters;
|
|
20
|
+
}
|
|
21
|
+
rawFilter(filter) {
|
|
22
|
+
var _a;
|
|
23
|
+
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push(filter);
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
filter(type, key, value, ...options) {
|
|
27
|
+
var _a;
|
|
28
|
+
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({
|
|
29
|
+
[type]: {
|
|
30
|
+
key,
|
|
31
|
+
value,
|
|
32
|
+
...options
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
match(field, value) {
|
|
38
|
+
var _a;
|
|
39
|
+
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ match: { key: field, value } });
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
wildcard(field, value) {
|
|
43
|
+
var _a;
|
|
44
|
+
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ wildcard: { key: field, value } });
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
selfreference(fielda, fieldb, operation) {
|
|
48
|
+
var _a;
|
|
49
|
+
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ selfreference: { a: fielda, b: fieldb, operation } });
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
range(field, options) {
|
|
53
|
+
var _a;
|
|
54
|
+
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ range: { key: field, ...options } });
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
or(filters) {
|
|
58
|
+
var _a;
|
|
59
|
+
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ or: filters.map(f => { var _a; return (_a = f.body.filters) !== null && _a !== void 0 ? _a : []; }) });
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
not(filter) {
|
|
63
|
+
var _a, _b, _c;
|
|
64
|
+
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ not: (_c = (_b = filter.body) === null || _b === void 0 ? void 0 : _b.filters) !== null && _c !== void 0 ? _c : [] });
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports._FilterBuilder = _FilterBuilder;
|
|
69
|
+
class _QueryBuilder extends _FilterBuilder {
|
|
70
|
+
constructor() {
|
|
71
|
+
super();
|
|
72
|
+
this.shouldPerformTextQuery = false;
|
|
73
|
+
}
|
|
14
74
|
build() {
|
|
75
|
+
if (!this.shouldPerformTextQuery)
|
|
76
|
+
return this.body;
|
|
77
|
+
if (!this.defaultQueryValue)
|
|
78
|
+
throw new Error("Please set the search query by calling .query('my search query') before performing a text search.");
|
|
79
|
+
this.body.query = this.defaultQueryValue;
|
|
15
80
|
return this.body;
|
|
16
81
|
}
|
|
17
|
-
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.body.fieldsToSearch = arg;
|
|
22
|
-
else
|
|
23
|
-
this.body.queryConfig = arg;
|
|
24
|
-
}
|
|
82
|
+
query(query, fieldsToSearch) {
|
|
83
|
+
this.defaultQueryValue = query;
|
|
84
|
+
if (fieldsToSearch)
|
|
85
|
+
this.body.fieldsToSearch = fieldsToSearch;
|
|
25
86
|
return this;
|
|
26
87
|
}
|
|
27
|
-
|
|
28
|
-
|
|
88
|
+
queryConfig(weight, options) {
|
|
89
|
+
this.body.queryConfig = { weight, ...(options !== null && options !== void 0 ? options : {}) };
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
text(field, weight) {
|
|
93
|
+
this.shouldPerformTextQuery = true;
|
|
94
|
+
if (!field)
|
|
95
|
+
return this; // support searching all fields
|
|
96
|
+
if (!this.body.fieldsToSearch)
|
|
97
|
+
this.body.fieldsToSearch = [];
|
|
98
|
+
if (!weight)
|
|
99
|
+
this.body.fieldsToSearch.push(field);
|
|
100
|
+
else
|
|
101
|
+
this.body.fieldsToSearch.push({ key: field, weight });
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
vector(field, ...args) {
|
|
29
105
|
if (!Array.isArray(this.body.vectorSearchQuery))
|
|
30
106
|
this.body.vectorSearchQuery = [];
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
107
|
+
let payload = { field };
|
|
108
|
+
const inferredModelMatch = field.match(/_(.*)_.*vector_/); // title_text@1-0_vector_ -> text@1-0
|
|
109
|
+
if (inferredModelMatch && inferredModelMatch[1])
|
|
110
|
+
payload.model = inferredModelMatch[1]; // this can be overridden
|
|
34
111
|
for (const arg of args) {
|
|
35
112
|
if (typeof arg === 'number')
|
|
36
|
-
payload.weight = arg;
|
|
113
|
+
payload.weight = arg; // weight
|
|
37
114
|
else
|
|
38
|
-
payload = { ...payload, ...arg };
|
|
115
|
+
payload = { ...payload, ...arg }; // options
|
|
39
116
|
}
|
|
40
117
|
this.body.vectorSearchQuery.push(payload);
|
|
41
118
|
return this;
|
|
@@ -70,11 +147,6 @@ class _QueryBuilder {
|
|
|
70
147
|
this.body.pageSize = value;
|
|
71
148
|
return this;
|
|
72
149
|
}
|
|
73
|
-
rawFilter(filter) {
|
|
74
|
-
var _a;
|
|
75
|
-
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push(filter);
|
|
76
|
-
return this;
|
|
77
|
-
}
|
|
78
150
|
includeFields(fields) {
|
|
79
151
|
this.body.includeFields = fields;
|
|
80
152
|
}
|
|
@@ -84,47 +156,6 @@ class _QueryBuilder {
|
|
|
84
156
|
includeVectors(whetherToInclude) {
|
|
85
157
|
this.body.includeVectors = whetherToInclude;
|
|
86
158
|
}
|
|
87
|
-
filter(type, key, value, ...options) {
|
|
88
|
-
var _a;
|
|
89
|
-
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({
|
|
90
|
-
[type]: {
|
|
91
|
-
key,
|
|
92
|
-
value,
|
|
93
|
-
...options
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
return this;
|
|
97
|
-
}
|
|
98
|
-
match(field, value) {
|
|
99
|
-
var _a;
|
|
100
|
-
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ match: { key: field, value } });
|
|
101
|
-
return this;
|
|
102
|
-
}
|
|
103
|
-
wildcard(field, value) {
|
|
104
|
-
var _a;
|
|
105
|
-
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ wildcard: { key: field, value } });
|
|
106
|
-
return this;
|
|
107
|
-
}
|
|
108
|
-
selfreference(fielda, fieldb, operation) {
|
|
109
|
-
var _a;
|
|
110
|
-
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ selfreference: { a: fielda, b: fieldb, operation } });
|
|
111
|
-
return this;
|
|
112
|
-
}
|
|
113
|
-
range(field, options) {
|
|
114
|
-
var _a;
|
|
115
|
-
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ range: { key: field, ...options } });
|
|
116
|
-
return this;
|
|
117
|
-
}
|
|
118
|
-
or(filters) {
|
|
119
|
-
var _a;
|
|
120
|
-
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ or: filters.map(f => { var _a; return (_a = f.body.filters) !== null && _a !== void 0 ? _a : []; }) });
|
|
121
|
-
return this;
|
|
122
|
-
}
|
|
123
|
-
not(filter) {
|
|
124
|
-
var _a, _b, _c;
|
|
125
|
-
(_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ not: (_c = (_b = filter.body) === null || _b === void 0 ? void 0 : _b.filters) !== null && _c !== void 0 ? _c : [] });
|
|
126
|
-
return this;
|
|
127
|
-
}
|
|
128
159
|
aggregate(field, options) {
|
|
129
160
|
var _a, _b, _c;
|
|
130
161
|
(_a = this.body.fieldsToAggregate) === null || _a === void 0 ? void 0 : _a.push({ key: field, ...options, fieldsToAggregate: (_c = (_b = options === null || options === void 0 ? void 0 : options.aggregates) === null || _b === void 0 ? void 0 : _b.body.fieldsToAggregate) !== null && _c !== void 0 ? _c : [] });
|
|
@@ -702,6 +702,18 @@ var VectorApiClient = /** @class */ (function (_super) {
|
|
|
702
702
|
});
|
|
703
703
|
});
|
|
704
704
|
};
|
|
705
|
+
VectorApiClient.prototype.clustercentroidsapiv2servicesclustercentroidslistpost = function (input, options) {
|
|
706
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
707
|
+
return __generator(this, function (_a) {
|
|
708
|
+
return [2 /*return*/, this.SendRequest({
|
|
709
|
+
input: input,
|
|
710
|
+
method: 'post',
|
|
711
|
+
path: '/services/cluster/centroids/list',
|
|
712
|
+
options: options
|
|
713
|
+
})];
|
|
714
|
+
});
|
|
715
|
+
});
|
|
716
|
+
};
|
|
705
717
|
VectorApiClient.prototype.clustercentroidsgetapiservicesclustercentroidsgetget = function (input, options) {
|
|
706
718
|
return __awaiter(this, void 0, void 0, function () {
|
|
707
719
|
return __generator(this, function (_a) {
|
|
@@ -714,7 +726,19 @@ var VectorApiClient = /** @class */ (function (_super) {
|
|
|
714
726
|
});
|
|
715
727
|
});
|
|
716
728
|
};
|
|
717
|
-
VectorApiClient.prototype.
|
|
729
|
+
VectorApiClient.prototype.clustercentroidsgetapiservicesclustercentroidsgetpost = function (input, options) {
|
|
730
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
731
|
+
return __generator(this, function (_a) {
|
|
732
|
+
return [2 /*return*/, this.SendRequest({
|
|
733
|
+
input: input,
|
|
734
|
+
method: 'post',
|
|
735
|
+
path: '/services/cluster/centroids/get',
|
|
736
|
+
options: options
|
|
737
|
+
})];
|
|
738
|
+
});
|
|
739
|
+
});
|
|
740
|
+
};
|
|
741
|
+
VectorApiClient.prototype.insertclustercentroids2apiservicesclustercentroidsinsertpost = function (input, options) {
|
|
718
742
|
return __awaiter(this, void 0, void 0, function () {
|
|
719
743
|
return __generator(this, function (_a) {
|
|
720
744
|
return [2 /*return*/, this.SendRequest({
|
|
@@ -726,6 +750,54 @@ var VectorApiClient = /** @class */ (function (_super) {
|
|
|
726
750
|
});
|
|
727
751
|
});
|
|
728
752
|
};
|
|
753
|
+
VectorApiClient.prototype.updatecentroidsapiv2servicesclustercentroidsupdatepost = function (input, options) {
|
|
754
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
755
|
+
return __generator(this, function (_a) {
|
|
756
|
+
return [2 /*return*/, this.SendRequest({
|
|
757
|
+
input: input,
|
|
758
|
+
method: 'post',
|
|
759
|
+
path: '/services/cluster/centroids/update',
|
|
760
|
+
options: options
|
|
761
|
+
})];
|
|
762
|
+
});
|
|
763
|
+
});
|
|
764
|
+
};
|
|
765
|
+
VectorApiClient.prototype.deletecentroidsapiservicesclustercentroidscentroididdeleteget = function (input, options) {
|
|
766
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
767
|
+
return __generator(this, function (_a) {
|
|
768
|
+
return [2 /*return*/, this.SendRequest({
|
|
769
|
+
input: input,
|
|
770
|
+
method: 'get',
|
|
771
|
+
path: '/services/cluster/centroids/{centroid_id}/delete',
|
|
772
|
+
options: options
|
|
773
|
+
})];
|
|
774
|
+
});
|
|
775
|
+
});
|
|
776
|
+
};
|
|
777
|
+
VectorApiClient.prototype.deletecentroidsapiservicesclustercentroidscentroididdeletepost = function (input, options) {
|
|
778
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
779
|
+
return __generator(this, function (_a) {
|
|
780
|
+
return [2 /*return*/, this.SendRequest({
|
|
781
|
+
input: input,
|
|
782
|
+
method: 'post',
|
|
783
|
+
path: '/services/cluster/centroids/{centroid_id}/delete',
|
|
784
|
+
options: options
|
|
785
|
+
})];
|
|
786
|
+
});
|
|
787
|
+
});
|
|
788
|
+
};
|
|
789
|
+
VectorApiClient.prototype.clustercentroidsdeleteapiservicesclustercentroidsdeletepost = function (input, options) {
|
|
790
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
791
|
+
return __generator(this, function (_a) {
|
|
792
|
+
return [2 /*return*/, this.SendRequest({
|
|
793
|
+
input: input,
|
|
794
|
+
method: 'post',
|
|
795
|
+
path: '/services/cluster/centroids/delete',
|
|
796
|
+
options: options
|
|
797
|
+
})];
|
|
798
|
+
});
|
|
799
|
+
});
|
|
800
|
+
};
|
|
729
801
|
VectorApiClient.prototype.clustercentroidsgetapiservicesclustercentroidsdocumentspost = function (input, options) {
|
|
730
802
|
return __awaiter(this, void 0, void 0, function () {
|
|
731
803
|
return __generator(this, function (_a) {
|
|
@@ -738,7 +810,55 @@ var VectorApiClient = /** @class */ (function (_super) {
|
|
|
738
810
|
});
|
|
739
811
|
});
|
|
740
812
|
};
|
|
741
|
-
VectorApiClient.prototype.
|
|
813
|
+
VectorApiClient.prototype.centroidsmetadatagetapiservicesclustercentroidsmetadataget = function (input, options) {
|
|
814
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
815
|
+
return __generator(this, function (_a) {
|
|
816
|
+
return [2 /*return*/, this.SendRequest({
|
|
817
|
+
input: input,
|
|
818
|
+
method: 'get',
|
|
819
|
+
path: '/services/cluster/centroids/metadata',
|
|
820
|
+
options: options
|
|
821
|
+
})];
|
|
822
|
+
});
|
|
823
|
+
});
|
|
824
|
+
};
|
|
825
|
+
VectorApiClient.prototype.centroidsmetadatapostapiv2servicesclustercentroidsmetadatapost = function (input, options) {
|
|
826
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
827
|
+
return __generator(this, function (_a) {
|
|
828
|
+
return [2 /*return*/, this.SendRequest({
|
|
829
|
+
input: input,
|
|
830
|
+
method: 'post',
|
|
831
|
+
path: '/services/cluster/centroids/metadata',
|
|
832
|
+
options: options
|
|
833
|
+
})];
|
|
834
|
+
});
|
|
835
|
+
});
|
|
836
|
+
};
|
|
837
|
+
VectorApiClient.prototype.centroidslistclosesttocenterv2servicesclustercentroidslistclosesttocenterpost = function (input, options) {
|
|
838
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
839
|
+
return __generator(this, function (_a) {
|
|
840
|
+
return [2 /*return*/, this.SendRequest({
|
|
841
|
+
input: input,
|
|
842
|
+
method: 'post',
|
|
843
|
+
path: '/services/cluster/centroids/list_closest_to_center',
|
|
844
|
+
options: options
|
|
845
|
+
})];
|
|
846
|
+
});
|
|
847
|
+
});
|
|
848
|
+
};
|
|
849
|
+
VectorApiClient.prototype.centroidslistfurthestfromcenterv2servicesclustercentroidslistfurthestfromcenterpost = function (input, options) {
|
|
850
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
851
|
+
return __generator(this, function (_a) {
|
|
852
|
+
return [2 /*return*/, this.SendRequest({
|
|
853
|
+
input: input,
|
|
854
|
+
method: 'post',
|
|
855
|
+
path: '/services/cluster/centroids/list_furthest_from_center',
|
|
856
|
+
options: options
|
|
857
|
+
})];
|
|
858
|
+
});
|
|
859
|
+
});
|
|
860
|
+
};
|
|
861
|
+
VectorApiClient.prototype.clusteraggregateapiv2servicesclusteraggregatepost = function (input, options) {
|
|
742
862
|
return __awaiter(this, void 0, void 0, function () {
|
|
743
863
|
return __generator(this, function (_a) {
|
|
744
864
|
return [2 /*return*/, this.SendRequest({
|
|
@@ -750,7 +870,7 @@ var VectorApiClient = /** @class */ (function (_super) {
|
|
|
750
870
|
});
|
|
751
871
|
});
|
|
752
872
|
};
|
|
753
|
-
VectorApiClient.prototype.
|
|
873
|
+
VectorApiClient.prototype.advancedclusterfacetsapiservicesclusterfacetsget = function (input, options) {
|
|
754
874
|
return __awaiter(this, void 0, void 0, function () {
|
|
755
875
|
return __generator(this, function (_a) {
|
|
756
876
|
return [2 /*return*/, this.SendRequest({
|
|
@@ -762,6 +882,30 @@ var VectorApiClient = /** @class */ (function (_super) {
|
|
|
762
882
|
});
|
|
763
883
|
});
|
|
764
884
|
};
|
|
885
|
+
VectorApiClient.prototype.clusterlistservicesclusterlistget = function (input, options) {
|
|
886
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
887
|
+
return __generator(this, function (_a) {
|
|
888
|
+
return [2 /*return*/, this.SendRequest({
|
|
889
|
+
input: input,
|
|
890
|
+
method: 'get',
|
|
891
|
+
path: '/services/cluster/list',
|
|
892
|
+
options: options
|
|
893
|
+
})];
|
|
894
|
+
});
|
|
895
|
+
});
|
|
896
|
+
};
|
|
897
|
+
VectorApiClient.prototype.clusterlistmultiservicesclusterlistpost = function (input, options) {
|
|
898
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
899
|
+
return __generator(this, function (_a) {
|
|
900
|
+
return [2 /*return*/, this.SendRequest({
|
|
901
|
+
input: input,
|
|
902
|
+
method: 'post',
|
|
903
|
+
path: '/services/cluster/list',
|
|
904
|
+
options: options
|
|
905
|
+
})];
|
|
906
|
+
});
|
|
907
|
+
});
|
|
908
|
+
};
|
|
765
909
|
VectorApiClient.prototype.tagapiservicestaggertagpost = function (input, options) {
|
|
766
910
|
return __awaiter(this, void 0, void 0, function () {
|
|
767
911
|
return __generator(this, function (_a) {
|
|
@@ -105,8 +105,11 @@ var Dataset = /** @class */ (function () {
|
|
|
105
105
|
if (arg instanceof _QueryBuilder) {
|
|
106
106
|
payload = __assign(__assign({}, payload), arg.build());
|
|
107
107
|
}
|
|
108
|
-
else
|
|
108
|
+
else {
|
|
109
109
|
options = arg;
|
|
110
|
+
if (options.rawPayload)
|
|
111
|
+
payload = __assign(__assign({}, payload), options.rawPayload);
|
|
112
|
+
}
|
|
110
113
|
}
|
|
111
114
|
}
|
|
112
115
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -250,7 +253,7 @@ var Dataset = /** @class */ (function () {
|
|
|
250
253
|
return __awaiter(this, void 0, void 0, function () {
|
|
251
254
|
return __generator(this, function (_a) {
|
|
252
255
|
switch (_a.label) {
|
|
253
|
-
case 0: return [4 /*yield*/, this.client.apiClient.UpdateWhere({ filters: filters.
|
|
256
|
+
case 0: return [4 /*yield*/, this.client.apiClient.UpdateWhere({ filters: filters.build().filters, updates: partialUpdates })];
|
|
254
257
|
case 1: return [2 /*return*/, (_a.sent()).body];
|
|
255
258
|
}
|
|
256
259
|
});
|
|
@@ -284,7 +287,7 @@ var Dataset = /** @class */ (function () {
|
|
|
284
287
|
switch (_b.label) {
|
|
285
288
|
case 0:
|
|
286
289
|
filters = QueryBuilder().match('_id', documentIds);
|
|
287
|
-
return [4 /*yield*/, this.client.apiClient.DeleteWhere({ filters: (_a = filters.
|
|
290
|
+
return [4 /*yield*/, this.client.apiClient.DeleteWhere({ filters: (_a = filters.build().filters) !== null && _a !== void 0 ? _a : [] })];
|
|
288
291
|
case 1: return [2 /*return*/, (_b.sent()).body];
|
|
289
292
|
}
|
|
290
293
|
});
|
|
@@ -295,7 +298,7 @@ var Dataset = /** @class */ (function () {
|
|
|
295
298
|
return __awaiter(this, void 0, void 0, function () {
|
|
296
299
|
return __generator(this, function (_b) {
|
|
297
300
|
switch (_b.label) {
|
|
298
|
-
case 0: return [4 /*yield*/, this.client.apiClient.DeleteWhere({ filters: (_a = filters.
|
|
301
|
+
case 0: return [4 /*yield*/, this.client.apiClient.DeleteWhere({ filters: (_a = filters.build().filters) !== null && _a !== void 0 ? _a : [] })];
|
|
299
302
|
case 1: return [2 /*return*/, (_b.sent()).body];
|
|
300
303
|
}
|
|
301
304
|
});
|