@relevanceai/sdk 1.2.0 → 1.3.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.
@@ -454,6 +454,38 @@ class VectorApiClient extends BaseClient_1._GenericClient {
454
454
  options
455
455
  });
456
456
  }
457
+ async centroidsmetadatagetapiservicesclustercentroidsmetadataget(input, options) {
458
+ return this.SendRequest({
459
+ input,
460
+ method: 'get',
461
+ path: '/services/cluster/centroids/metadata',
462
+ options
463
+ });
464
+ }
465
+ async centroidsmetadatapostapiservicesclustercentroidsmetadatapost(input, options) {
466
+ return this.SendRequest({
467
+ input,
468
+ method: 'post',
469
+ path: '/services/cluster/centroids/metadata',
470
+ options
471
+ });
472
+ }
473
+ async centroidslistclosesttocenterservicesclustercentroidslistclosesttocenterpost(input, options) {
474
+ return this.SendRequest({
475
+ input,
476
+ method: 'post',
477
+ path: '/services/cluster/centroids/list_closest_to_center',
478
+ options
479
+ });
480
+ }
481
+ async centroidslistfurthestfromcenterservicesclustercentroidslistfurthestfromcenterpost(input, options) {
482
+ return this.SendRequest({
483
+ input,
484
+ method: 'post',
485
+ path: '/services/cluster/centroids/list_furthest_from_center',
486
+ options
487
+ });
488
+ }
457
489
  async clusteraggregateapiservicesclusteraggregatepost(input, options) {
458
490
  return this.SendRequest({
459
491
  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) {
@@ -1,15 +1,74 @@
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
- class _QueryBuilder {
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: [] };
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();
13
72
  this.shouldPerformTextQuery = false;
14
73
  }
15
74
  build() {
@@ -88,11 +147,6 @@ class _QueryBuilder {
88
147
  this.body.pageSize = value;
89
148
  return this;
90
149
  }
91
- rawFilter(filter) {
92
- var _a;
93
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push(filter);
94
- return this;
95
- }
96
150
  includeFields(fields) {
97
151
  this.body.includeFields = fields;
98
152
  }
@@ -102,47 +156,6 @@ class _QueryBuilder {
102
156
  includeVectors(whetherToInclude) {
103
157
  this.body.includeVectors = whetherToInclude;
104
158
  }
105
- filter(type, key, value, ...options) {
106
- var _a;
107
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({
108
- [type]: {
109
- key,
110
- value,
111
- ...options
112
- }
113
- });
114
- return this;
115
- }
116
- match(field, value) {
117
- var _a;
118
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ match: { key: field, value } });
119
- return this;
120
- }
121
- wildcard(field, value) {
122
- var _a;
123
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ wildcard: { key: field, value } });
124
- return this;
125
- }
126
- selfreference(fielda, fieldb, operation) {
127
- var _a;
128
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ selfreference: { a: fielda, b: fieldb, operation } });
129
- return this;
130
- }
131
- range(field, options) {
132
- var _a;
133
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ range: { key: field, ...options } });
134
- return this;
135
- }
136
- or(filters) {
137
- var _a;
138
- (_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 : []; }) });
139
- return this;
140
- }
141
- not(filter) {
142
- var _a, _b, _c;
143
- (_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 : [] });
144
- return this;
145
- }
146
159
  aggregate(field, options) {
147
160
  var _a, _b, _c;
148
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 : [] });
@@ -738,6 +738,54 @@ var VectorApiClient = /** @class */ (function (_super) {
738
738
  });
739
739
  });
740
740
  };
741
+ VectorApiClient.prototype.centroidsmetadatagetapiservicesclustercentroidsmetadataget = function (input, options) {
742
+ return __awaiter(this, void 0, void 0, function () {
743
+ return __generator(this, function (_a) {
744
+ return [2 /*return*/, this.SendRequest({
745
+ input: input,
746
+ method: 'get',
747
+ path: '/services/cluster/centroids/metadata',
748
+ options: options
749
+ })];
750
+ });
751
+ });
752
+ };
753
+ VectorApiClient.prototype.centroidsmetadatapostapiservicesclustercentroidsmetadatapost = 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/metadata',
760
+ options: options
761
+ })];
762
+ });
763
+ });
764
+ };
765
+ VectorApiClient.prototype.centroidslistclosesttocenterservicesclustercentroidslistclosesttocenterpost = 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: 'post',
771
+ path: '/services/cluster/centroids/list_closest_to_center',
772
+ options: options
773
+ })];
774
+ });
775
+ });
776
+ };
777
+ VectorApiClient.prototype.centroidslistfurthestfromcenterservicesclustercentroidslistfurthestfromcenterpost = 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/list_furthest_from_center',
784
+ options: options
785
+ })];
786
+ });
787
+ });
788
+ };
741
789
  VectorApiClient.prototype.clusteraggregateapiservicesclusteraggregatepost = function (input, options) {
742
790
  return __awaiter(this, void 0, void 0, function () {
743
791
  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 }; }
@@ -1,3 +1,18 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
1
16
  var __assign = (this && this.__assign) || function () {
2
17
  __assign = Object.assign || function(t) {
3
18
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -25,10 +40,72 @@ import { Dataset } from './Dataset';
25
40
  export function QueryBuilder() {
26
41
  return new _QueryBuilder();
27
42
  }
28
- var _QueryBuilder = /** @class */ (function () {
29
- function _QueryBuilder() {
43
+ export function FilterBuilder() {
44
+ return new _FilterBuilder();
45
+ }
46
+ var _FilterBuilder = /** @class */ (function () {
47
+ function _FilterBuilder() {
30
48
  this.body = { filters: [], fieldsToAggregate: [], fieldsToAggregateStats: [] };
31
- this.shouldPerformTextQuery = false;
49
+ }
50
+ _FilterBuilder.prototype.buildFilters = function () {
51
+ return this.body.filters;
52
+ };
53
+ _FilterBuilder.prototype.rawFilter = function (filter) {
54
+ var _a;
55
+ (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push(filter);
56
+ return this;
57
+ };
58
+ _FilterBuilder.prototype.filter = function (type, key, value) {
59
+ var _a;
60
+ var _b;
61
+ var options = [];
62
+ for (var _i = 3; _i < arguments.length; _i++) {
63
+ options[_i - 3] = arguments[_i];
64
+ }
65
+ (_b = this.body.filters) === null || _b === void 0 ? void 0 : _b.push((_a = {},
66
+ _a[type] = __assign({ key: key, value: value }, options),
67
+ _a));
68
+ return this;
69
+ };
70
+ _FilterBuilder.prototype.match = function (field, value) {
71
+ var _a;
72
+ (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ match: { key: field, value: value } });
73
+ return this;
74
+ };
75
+ _FilterBuilder.prototype.wildcard = function (field, value) {
76
+ var _a;
77
+ (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ wildcard: { key: field, value: value } });
78
+ return this;
79
+ };
80
+ _FilterBuilder.prototype.selfreference = function (fielda, fieldb, operation) {
81
+ var _a;
82
+ (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ selfreference: { a: fielda, b: fieldb, operation: operation } });
83
+ return this;
84
+ };
85
+ _FilterBuilder.prototype.range = function (field, options) {
86
+ var _a;
87
+ (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ range: __assign({ key: field }, options) });
88
+ return this;
89
+ };
90
+ _FilterBuilder.prototype.or = function (filters) {
91
+ var _a;
92
+ (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ or: filters.map(function (f) { var _a; return (_a = f.body.filters) !== null && _a !== void 0 ? _a : []; }) });
93
+ return this;
94
+ };
95
+ _FilterBuilder.prototype.not = function (filter) {
96
+ var _a, _b, _c;
97
+ (_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 : [] });
98
+ return this;
99
+ };
100
+ return _FilterBuilder;
101
+ }());
102
+ export { _FilterBuilder };
103
+ var _QueryBuilder = /** @class */ (function (_super) {
104
+ __extends(_QueryBuilder, _super);
105
+ function _QueryBuilder() {
106
+ var _this = _super.call(this) || this;
107
+ _this.shouldPerformTextQuery = false;
108
+ return _this;
32
109
  }
33
110
  _QueryBuilder.prototype.build = function () {
34
111
  if (!this.shouldPerformTextQuery)
@@ -121,11 +198,6 @@ var _QueryBuilder = /** @class */ (function () {
121
198
  this.body.pageSize = value;
122
199
  return this;
123
200
  };
124
- _QueryBuilder.prototype.rawFilter = function (filter) {
125
- var _a;
126
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push(filter);
127
- return this;
128
- };
129
201
  _QueryBuilder.prototype.includeFields = function (fields) {
130
202
  this.body.includeFields = fields;
131
203
  };
@@ -135,48 +207,6 @@ var _QueryBuilder = /** @class */ (function () {
135
207
  _QueryBuilder.prototype.includeVectors = function (whetherToInclude) {
136
208
  this.body.includeVectors = whetherToInclude;
137
209
  };
138
- _QueryBuilder.prototype.filter = function (type, key, value) {
139
- var _a;
140
- var _b;
141
- var options = [];
142
- for (var _i = 3; _i < arguments.length; _i++) {
143
- options[_i - 3] = arguments[_i];
144
- }
145
- (_b = this.body.filters) === null || _b === void 0 ? void 0 : _b.push((_a = {},
146
- _a[type] = __assign({ key: key, value: value }, options),
147
- _a));
148
- return this;
149
- };
150
- _QueryBuilder.prototype.match = function (field, value) {
151
- var _a;
152
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ match: { key: field, value: value } });
153
- return this;
154
- };
155
- _QueryBuilder.prototype.wildcard = function (field, value) {
156
- var _a;
157
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ wildcard: { key: field, value: value } });
158
- return this;
159
- };
160
- _QueryBuilder.prototype.selfreference = function (fielda, fieldb, operation) {
161
- var _a;
162
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ selfreference: { a: fielda, b: fieldb, operation: operation } });
163
- return this;
164
- };
165
- _QueryBuilder.prototype.range = function (field, options) {
166
- var _a;
167
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ range: __assign({ key: field }, options) });
168
- return this;
169
- };
170
- _QueryBuilder.prototype.or = function (filters) {
171
- var _a;
172
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ or: filters.map(function (f) { var _a; return (_a = f.body.filters) !== null && _a !== void 0 ? _a : []; }) });
173
- return this;
174
- };
175
- _QueryBuilder.prototype.not = function (filter) {
176
- var _a, _b, _c;
177
- (_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 : [] });
178
- return this;
179
- };
180
210
  _QueryBuilder.prototype.aggregate = function (field, options) {
181
211
  var _a, _b, _c;
182
212
  (_a = this.body.fieldsToAggregate) === null || _a === void 0 ? void 0 : _a.push(__assign(__assign({ 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 : [] }));
@@ -188,7 +218,7 @@ var _QueryBuilder = /** @class */ (function () {
188
218
  return this;
189
219
  };
190
220
  return _QueryBuilder;
191
- }());
221
+ }(_FilterBuilder));
192
222
  export { _QueryBuilder };
193
223
  var DiscoveryClient = /** @class */ (function () {
194
224
  function DiscoveryClient(config) {
@@ -112,6 +112,14 @@ export declare type insertclustercentroidsapiservicesclustercentroidsinsertpostI
112
112
  export declare type insertclustercentroidsapiservicesclustercentroidsinsertpostOutput = operations['insert_cluster_centroids_api_services_cluster_centroids_insert_post']['responses']['200']['content']['application/json'];
113
113
  export declare type clustercentroidsgetapiservicesclustercentroidsdocumentspostInput = operations['cluster_centroids_get_api_services_cluster_centroids_documents_post']['requestBody']['content']['application/json'];
114
114
  export declare type clustercentroidsgetapiservicesclustercentroidsdocumentspostOutput = operations['cluster_centroids_get_api_services_cluster_centroids_documents_post']['responses']['200']['content']['application/json'];
115
+ export declare type centroidsmetadatagetapiservicesclustercentroidsmetadatagetInput = {};
116
+ export declare type centroidsmetadatagetapiservicesclustercentroidsmetadatagetOutput = operations['centroids_metadata_get_api_services_cluster_centroids_metadata_get']['responses']['200']['content']['application/json'];
117
+ export declare type centroidsmetadatapostapiservicesclustercentroidsmetadatapostInput = operations['centroids_metadata_post_api_services_cluster_centroids_metadata_post']['requestBody']['content']['application/json'];
118
+ export declare type centroidsmetadatapostapiservicesclustercentroidsmetadatapostOutput = operations['centroids_metadata_post_api_services_cluster_centroids_metadata_post']['responses']['200']['content']['application/json'];
119
+ export declare type centroidslistclosesttocenterservicesclustercentroidslistclosesttocenterpostInput = operations['centroids_list_closest_to_center_services_cluster_centroids_list_closest_to_center_post']['requestBody']['content']['application/json'];
120
+ export declare type centroidslistclosesttocenterservicesclustercentroidslistclosesttocenterpostOutput = operations['centroids_list_closest_to_center_services_cluster_centroids_list_closest_to_center_post']['responses']['200']['content']['application/json'];
121
+ export declare type centroidslistfurthestfromcenterservicesclustercentroidslistfurthestfromcenterpostInput = operations['centroids_list_furthest_from_center_services_cluster_centroids_list_furthest_from_center_post']['requestBody']['content']['application/json'];
122
+ export declare type centroidslistfurthestfromcenterservicesclustercentroidslistfurthestfromcenterpostOutput = operations['centroids_list_furthest_from_center_services_cluster_centroids_list_furthest_from_center_post']['responses']['200']['content']['application/json'];
115
123
  export declare type clusteraggregateapiservicesclusteraggregatepostInput = operations['cluster_aggregate_api_services_cluster_aggregate_post']['requestBody']['content']['application/json'];
116
124
  export declare type clusteraggregateapiservicesclusteraggregatepostOutput = operations['cluster_aggregate_api_services_cluster_aggregate_post']['responses']['200']['content']['application/json'];
117
125
  export declare type clusterfacetsapiservicesclusterfacetsgetInput = {};
@@ -220,6 +228,10 @@ export declare class VectorApiClient extends _GenericClient {
220
228
  clustercentroidsgetapiservicesclustercentroidsgetget(input: CommandInput<clustercentroidsgetapiservicesclustercentroidsgetgetInput>, options?: _GenericMethodOptions): Promise<CommandOutput<clustercentroidsgetapiservicesclustercentroidsgetgetOutput>>;
221
229
  insertclustercentroidsapiservicesclustercentroidsinsertpost(input: CommandInput<insertclustercentroidsapiservicesclustercentroidsinsertpostInput>, options?: _GenericMethodOptions): Promise<CommandOutput<insertclustercentroidsapiservicesclustercentroidsinsertpostOutput>>;
222
230
  clustercentroidsgetapiservicesclustercentroidsdocumentspost(input: CommandInput<clustercentroidsgetapiservicesclustercentroidsdocumentspostInput>, options?: _GenericMethodOptions): Promise<CommandOutput<clustercentroidsgetapiservicesclustercentroidsdocumentspostOutput>>;
231
+ centroidsmetadatagetapiservicesclustercentroidsmetadataget(input: CommandInput<centroidsmetadatagetapiservicesclustercentroidsmetadatagetInput>, options?: _GenericMethodOptions): Promise<CommandOutput<centroidsmetadatagetapiservicesclustercentroidsmetadatagetOutput>>;
232
+ centroidsmetadatapostapiservicesclustercentroidsmetadatapost(input: CommandInput<centroidsmetadatapostapiservicesclustercentroidsmetadatapostInput>, options?: _GenericMethodOptions): Promise<CommandOutput<centroidsmetadatapostapiservicesclustercentroidsmetadatapostOutput>>;
233
+ centroidslistclosesttocenterservicesclustercentroidslistclosesttocenterpost(input: CommandInput<centroidslistclosesttocenterservicesclustercentroidslistclosesttocenterpostInput>, options?: _GenericMethodOptions): Promise<CommandOutput<centroidslistclosesttocenterservicesclustercentroidslistclosesttocenterpostOutput>>;
234
+ centroidslistfurthestfromcenterservicesclustercentroidslistfurthestfromcenterpost(input: CommandInput<centroidslistfurthestfromcenterservicesclustercentroidslistfurthestfromcenterpostInput>, options?: _GenericMethodOptions): Promise<CommandOutput<centroidslistfurthestfromcenterservicesclustercentroidslistfurthestfromcenterpostOutput>>;
223
235
  clusteraggregateapiservicesclusteraggregatepost(input: CommandInput<clusteraggregateapiservicesclusteraggregatepostInput>, options?: _GenericMethodOptions): Promise<CommandOutput<clusteraggregateapiservicesclusteraggregatepostOutput>>;
224
236
  clusterfacetsapiservicesclusterfacetsget(input: CommandInput<clusterfacetsapiservicesclusterfacetsgetInput>, options?: _GenericMethodOptions): Promise<CommandOutput<clusterfacetsapiservicesclusterfacetsgetOutput>>;
225
237
  tagapiservicestaggertagpost(input: CommandInput<tagapiservicestaggertagpostInput>, options?: _GenericMethodOptions): Promise<CommandOutput<tagapiservicestaggertagpostOutput>>;
@@ -164,6 +164,10 @@ export interface paths {
164
164
  * {'field' : 'price', 'filter_type' : 'numeric', "condition":">=", "condition_value":90}
165
165
  * 7. **"ids"**: for filtering by document ids.
166
166
  * {'field' : 'ids', 'filter_type' : 'ids', "condition":"==", "condition_value":["1", "10"]}
167
+ * 8. **"or"**: for filtering with multiple conditions
168
+ * {'filter_type' : 'or',
169
+ * "condition_value": [{'field' : 'price', 'filter_type' : 'numeric', "condition":"<=", "condition_value":90},
170
+ * {'field' : 'price', 'filter_type' : 'numeric', "condition":">=", "condition_value":150}]}
167
171
  *
168
172
  * These are the available conditions:
169
173
  *
@@ -650,7 +654,7 @@ export interface paths {
650
654
  post: operations["aggregate_v2_api_services_aggregate_aggregate_post"];
651
655
  };
652
656
  "/services/cluster/centroids/list": {
653
- /** Retrieve the cluster centroid */
657
+ /** Retrieves a list of cluster centroids */
654
658
  get: operations["cluster_centroids_api_services_cluster_centroids_list_get"];
655
659
  };
656
660
  "/services/cluster/centroids/get": {
@@ -665,6 +669,20 @@ export interface paths {
665
669
  /** Retrieve the cluster centroids by IDs */
666
670
  post: operations["cluster_centroids_get_api_services_cluster_centroids_documents_post"];
667
671
  };
672
+ "/services/cluster/centroids/metadata": {
673
+ /** Retrieves metadata about a dataset. notably description, data source, etc */
674
+ get: operations["centroids_metadata_get_api_services_cluster_centroids_metadata_get"];
675
+ /** You can store the metadata about your cluster here. */
676
+ post: operations["centroids_metadata_post_api_services_cluster_centroids_metadata_post"];
677
+ };
678
+ "/services/cluster/centroids/list_closest_to_center": {
679
+ /** List of documents closest from the centre. */
680
+ post: operations["centroids_list_closest_to_center_services_cluster_centroids_list_closest_to_center_post"];
681
+ };
682
+ "/services/cluster/centroids/list_furthest_from_center": {
683
+ /** List of documents from from the centre. */
684
+ post: operations["centroids_list_furthest_from_center_services_cluster_centroids_list_furthest_from_center_post"];
685
+ };
668
686
  "/services/cluster/aggregate": {
669
687
  /**
670
688
  * Takes an aggregation query and gets the aggregate of each cluster in a collection. This helps you interpret each cluster and what is in them.
@@ -1347,16 +1365,101 @@ export interface components {
1347
1365
  };
1348
1366
  /** Base class for all abstractmodels */
1349
1367
  CentroidInsertBody: {
1350
- /** The dataset ID. */
1368
+ /** Unique name of dataset */
1351
1369
  dataset_id: string;
1352
1370
  /** Cluster centers with the key being the index number */
1353
1371
  cluster_centers: {
1354
1372
  [key: string]: unknown;
1373
+ }[];
1374
+ /** It can either be an array of strings (automatically equally weighted) (e.g. ['check_vector_', 'yellow_vector_']). */
1375
+ vector_field: string;
1376
+ /** Include the inserted IDs in the response */
1377
+ include_inserted_ids?: boolean;
1378
+ /** Alias used to name a vector field. Belongs in field_{alias}_vector_ */
1379
+ alias?: string;
1380
+ };
1381
+ /** Base class for all abstractmodels */
1382
+ CentroidMetadata: {
1383
+ /** Unique name of dataset */
1384
+ dataset_id: string;
1385
+ /** Metadata for a dataset, e.g. {'description': 'dataset for searching products'} */
1386
+ metadata: {
1387
+ [key: string]: unknown;
1355
1388
  };
1356
- /** Clustered vector field */
1357
- vector_field: boolean;
1358
- /** Alias is used to name a cluster */
1389
+ /** It can either be an array of strings (automatically equally weighted) (e.g. ['check_vector_', 'yellow_vector_']). */
1390
+ vector_field: string;
1391
+ /** Alias used to name a vector field. Belongs in field_{alias}_vector_ */
1392
+ alias?: string;
1393
+ };
1394
+ /** Base class for all abstractmodels */
1395
+ CentroidsClosestToCenter: {
1396
+ /** Unique name of dataset */
1397
+ dataset_id: string;
1398
+ /** It can either be an array of strings (automatically equally weighted) (e.g. ['check_vector_', 'yellow_vector_']). */
1399
+ vector_field: string;
1400
+ /** Alias used to name a vector field. Belongs in field_{alias}_vector_ */
1401
+ alias?: string;
1402
+ /** List of cluster IDs */
1403
+ cluster_ids?: string[];
1404
+ /** Fields to include in the search results, empty array/list means all fields. */
1405
+ select_fields?: string[];
1406
+ /** Used for approximate search to speed up search. The higher the number, faster the search but potentially less accurate. */
1407
+ approx?: number;
1408
+ /** Whether to sum the multiple vectors similarity search score as 1 or seperate */
1409
+ sum_fields?: boolean;
1410
+ /** Size of each page of results */
1411
+ page_size?: number;
1412
+ /** Page of the results */
1413
+ page?: number;
1414
+ /** Similarity Metric, choose from ['cosine', 'l1', 'l2', 'dp'] */
1415
+ similarity_metric?: string;
1416
+ /** Query for filtering the search results */
1417
+ filters?: unknown[];
1418
+ /** Fields to include in the facets, if [] then all */
1419
+ facets?: unknown[];
1420
+ /** Minimum score for similarity metric */
1421
+ min_score?: number;
1422
+ /** Include vectors in the search results */
1423
+ include_vector?: boolean;
1424
+ /** Include the total count of results in the search results */
1425
+ include_count?: boolean;
1426
+ /** Include facets in the search results */
1427
+ include_facets?: boolean;
1428
+ };
1429
+ /** Base class for all abstractmodels */
1430
+ CentroidsFurthestFromCenter: {
1431
+ /** Unique name of dataset */
1432
+ dataset_id: string;
1433
+ /** It can either be an array of strings (automatically equally weighted) (e.g. ['check_vector_', 'yellow_vector_']). */
1434
+ vector_field: string;
1435
+ /** Alias used to name a vector field. Belongs in field_{alias}_vector_ */
1359
1436
  alias?: string;
1437
+ /** List of cluster IDs */
1438
+ cluster_ids?: string[];
1439
+ /** Fields to include in the search results, empty array/list means all fields. */
1440
+ select_fields?: string[];
1441
+ /** Used for approximate search to speed up search. The higher the number, faster the search but potentially less accurate. */
1442
+ approx?: number;
1443
+ /** Whether to sum the multiple vectors similarity search score as 1 or seperate */
1444
+ sum_fields?: boolean;
1445
+ /** Size of each page of results */
1446
+ page_size?: number;
1447
+ /** Page of the results */
1448
+ page?: number;
1449
+ /** Similarity Metric, choose from ['cosine', 'l1', 'l2', 'dp'] */
1450
+ similarity_metric?: string;
1451
+ /** Query for filtering the search results */
1452
+ filters?: unknown[];
1453
+ /** Fields to include in the facets, if [] then all */
1454
+ facets?: unknown[];
1455
+ /** Minimum score for similarity metric */
1456
+ min_score?: number;
1457
+ /** Include vectors in the search results */
1458
+ include_vector?: boolean;
1459
+ /** Include the total count of results in the search results */
1460
+ include_count?: boolean;
1461
+ /** Include facets in the search results */
1462
+ include_facets?: boolean;
1360
1463
  };
1361
1464
  /** Base class for all abstractmodels */
1362
1465
  ChunkSearchQuery: {
@@ -2927,6 +3030,10 @@ export interface operations {
2927
3030
  * {'field' : 'price', 'filter_type' : 'numeric', "condition":">=", "condition_value":90}
2928
3031
  * 7. **"ids"**: for filtering by document ids.
2929
3032
  * {'field' : 'ids', 'filter_type' : 'ids', "condition":"==", "condition_value":["1", "10"]}
3033
+ * 8. **"or"**: for filtering with multiple conditions
3034
+ * {'filter_type' : 'or',
3035
+ * "condition_value": [{'field' : 'price', 'filter_type' : 'numeric', "condition":"<=", "condition_value":90},
3036
+ * {'field' : 'price', 'filter_type' : 'numeric', "condition":">=", "condition_value":150}]}
2930
3037
  *
2931
3038
  * These are the available conditions:
2932
3039
  *
@@ -4252,7 +4359,7 @@ export interface operations {
4252
4359
  };
4253
4360
  };
4254
4361
  };
4255
- /** Retrieve the cluster centroid */
4362
+ /** Retrieves a list of cluster centroids */
4256
4363
  cluster_centroids_api_services_cluster_centroids_list_get: {
4257
4364
  parameters: {
4258
4365
  query: {
@@ -4382,6 +4489,121 @@ export interface operations {
4382
4489
  };
4383
4490
  };
4384
4491
  };
4492
+ /** Retrieves metadata about a dataset. notably description, data source, etc */
4493
+ centroids_metadata_get_api_services_cluster_centroids_metadata_get: {
4494
+ parameters: {
4495
+ query: {
4496
+ /** Unique name of dataset */
4497
+ dataset_id: string;
4498
+ /** It can either be an array of strings (automatically equally weighted) (e.g. ['check_vector_', 'yellow_vector_']). */
4499
+ vector_field: string;
4500
+ /** Alias used to name a vector field. Belongs in field_{alias}_vector_ */
4501
+ alias?: string;
4502
+ };
4503
+ header: {
4504
+ /** Authorization credentials. Header authorization should be in the form of **"project:api_key"** */
4505
+ Authorization: string;
4506
+ };
4507
+ };
4508
+ responses: {
4509
+ /** Successful Response */
4510
+ 200: {
4511
+ content: {
4512
+ "application/json": unknown;
4513
+ };
4514
+ };
4515
+ /** Validation Error */
4516
+ 422: {
4517
+ content: {
4518
+ "application/json": components["schemas"]["HTTPValidationError"];
4519
+ };
4520
+ };
4521
+ };
4522
+ };
4523
+ /** You can store the metadata about your cluster here. */
4524
+ centroids_metadata_post_api_services_cluster_centroids_metadata_post: {
4525
+ parameters: {
4526
+ header: {
4527
+ /** Authorization credentials. Header authorization should be in the form of **"project:api_key"** */
4528
+ Authorization: string;
4529
+ };
4530
+ };
4531
+ responses: {
4532
+ /** Successful Response */
4533
+ 200: {
4534
+ content: {
4535
+ "application/json": unknown;
4536
+ };
4537
+ };
4538
+ /** Validation Error */
4539
+ 422: {
4540
+ content: {
4541
+ "application/json": components["schemas"]["HTTPValidationError"];
4542
+ };
4543
+ };
4544
+ };
4545
+ requestBody: {
4546
+ content: {
4547
+ "application/json": components["schemas"]["CentroidMetadata"];
4548
+ };
4549
+ };
4550
+ };
4551
+ /** List of documents closest from the centre. */
4552
+ centroids_list_closest_to_center_services_cluster_centroids_list_closest_to_center_post: {
4553
+ parameters: {
4554
+ header: {
4555
+ /** Authorization credentials. Header authorization should be in the form of **"project:api_key"** */
4556
+ Authorization: string;
4557
+ };
4558
+ };
4559
+ responses: {
4560
+ /** Successful Response */
4561
+ 200: {
4562
+ content: {
4563
+ "application/json": unknown;
4564
+ };
4565
+ };
4566
+ /** Validation Error */
4567
+ 422: {
4568
+ content: {
4569
+ "application/json": components["schemas"]["HTTPValidationError"];
4570
+ };
4571
+ };
4572
+ };
4573
+ requestBody: {
4574
+ content: {
4575
+ "application/json": components["schemas"]["CentroidsClosestToCenter"];
4576
+ };
4577
+ };
4578
+ };
4579
+ /** List of documents from from the centre. */
4580
+ centroids_list_furthest_from_center_services_cluster_centroids_list_furthest_from_center_post: {
4581
+ parameters: {
4582
+ header: {
4583
+ /** Authorization credentials. Header authorization should be in the form of **"project:api_key"** */
4584
+ Authorization: string;
4585
+ };
4586
+ };
4587
+ responses: {
4588
+ /** Successful Response */
4589
+ 200: {
4590
+ content: {
4591
+ "application/json": unknown;
4592
+ };
4593
+ };
4594
+ /** Validation Error */
4595
+ 422: {
4596
+ content: {
4597
+ "application/json": components["schemas"]["HTTPValidationError"];
4598
+ };
4599
+ };
4600
+ };
4601
+ requestBody: {
4602
+ content: {
4603
+ "application/json": components["schemas"]["CentroidsFurthestFromCenter"];
4604
+ };
4605
+ };
4606
+ };
4385
4607
  /**
4386
4608
  * Takes an aggregation query and gets the aggregate of each cluster in a collection. This helps you interpret each cluster and what is in them.
4387
4609
  *
@@ -4,6 +4,7 @@ import { DeleteDocumentOutput, DeleteWhereOutput, GetDocumentOutput, SimpleSearc
4
4
  import { _GenericMethodOptions } from "../../shared/BaseClient";
5
5
  interface searchOptions {
6
6
  debounce?: number;
7
+ rawPayload?: any;
7
8
  }
8
9
  export declare class Dataset {
9
10
  client: DiscoveryClient;
@@ -4,8 +4,49 @@ import { operations, components } from '../../generated/_DiscoveryApiSchemaTypes
4
4
  import { Dataset } from './Dataset';
5
5
  declare type bodyType = operations['SimpleSearchPost']['requestBody']['content']['application/json'];
6
6
  export declare function QueryBuilder(): _QueryBuilder;
7
- export declare class _QueryBuilder {
7
+ export declare function FilterBuilder(): _FilterBuilder;
8
+ export declare class _FilterBuilder {
8
9
  body: bodyType;
10
+ constructor();
11
+ buildFilters(): {
12
+ match?: {
13
+ key: string;
14
+ value: string | number | boolean | unknown[];
15
+ } | undefined;
16
+ range?: {
17
+ key: string;
18
+ greaterThan?: unknown;
19
+ lessThan?: unknown;
20
+ } | undefined;
21
+ wildcard?: {
22
+ key: string;
23
+ value: string | string[];
24
+ } | undefined;
25
+ fieldExists?: {
26
+ key: string;
27
+ } | undefined;
28
+ selfreference?: {
29
+ a: string;
30
+ b: string;
31
+ operation: "<=" | ">=" | "<" | ">" | "==" | "!=";
32
+ } | undefined;
33
+ or?: (any | any[])[] | undefined;
34
+ not?: any | any[] | undefined;
35
+ chunk?: {
36
+ path: string;
37
+ filters: any[];
38
+ } | undefined;
39
+ }[] | undefined;
40
+ rawFilter(filter: components['schemas']['filterListItem']): this;
41
+ filter(type: string, key: string, value: string, ...options: any): this;
42
+ match(field: string, value: any): this;
43
+ wildcard(field: string, value: any): this;
44
+ selfreference(fielda: string, fieldb: string, operation: "<=" | ">=" | "<" | ">" | "==" | "!="): this;
45
+ range(field: string, options: Omit<components['schemas']['filterListItem']['range'], 'key'>): this;
46
+ or(filters: _FilterBuilder[]): this;
47
+ not(filter: _FilterBuilder): this;
48
+ }
49
+ export declare class _QueryBuilder extends _FilterBuilder {
9
50
  defaultQueryValue?: string;
10
51
  shouldPerformTextQuery: boolean;
11
52
  constructor();
@@ -308,17 +349,9 @@ export declare class _QueryBuilder {
308
349
  minimumRelevance(value: bodyType['minimumRelevance']): this;
309
350
  page(value: bodyType['page']): this;
310
351
  pageSize(value: bodyType['pageSize']): this;
311
- rawFilter(filter: components['schemas']['filterListItem']): this;
312
352
  includeFields(fields: bodyType['includeFields']): void;
313
353
  excludeFields(fields: bodyType['excludeFields']): void;
314
354
  includeVectors(whetherToInclude: bodyType['includeVectors']): void;
315
- filter(type: string, key: string, value: string, ...options: any): this;
316
- match(field: string, value: any): this;
317
- wildcard(field: string, value: any): this;
318
- selfreference(fielda: string, fieldb: string, operation: "<=" | ">=" | "<" | ">" | "==" | "!="): this;
319
- range(field: string, options: Omit<components['schemas']['filterListItem']['range'], 'key'>): this;
320
- or(filters: _QueryBuilder[]): this;
321
- not(filter: _QueryBuilder): this;
322
355
  aggregate(field: string, options?: {
323
356
  options?: any;
324
357
  aggregates?: _QueryBuilder;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relevanceai/sdk",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Javascript client for RelevanceAI APIs. Browser, Node.js and typescript support.",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "types": "./dist-types/index.d.ts",