@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.
@@ -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,9 +4,52 @@ 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;
9
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 {
50
+ defaultQueryValue?: string;
51
+ shouldPerformTextQuery: boolean;
52
+ constructor();
10
53
  build(): {
11
54
  query?: string | undefined;
12
55
  queryConfig?: {
@@ -294,29 +337,21 @@ export declare class _QueryBuilder {
294
337
  weight?: number | undefined;
295
338
  }[] | undefined;
296
339
  };
297
- text(query: string, queryConfig?: bodyType['queryConfig']): _QueryBuilder;
298
- text(query: string, fieldsToSearch?: bodyType['fieldsToSearch']): _QueryBuilder;
299
- text(query: string, fieldsToSearch?: bodyType['fieldsToSearch'], queryConfig?: bodyType['queryConfig']): _QueryBuilder;
300
- vector(field: string, model: string, weight?: number): _QueryBuilder;
301
- vector(field: string, model: string, options?: components['schemas']['vectorSearchQuery']): _QueryBuilder;
302
- vector(field: string, model: string, weight?: number, options?: components['schemas']['vectorSearchQuery']): _QueryBuilder;
340
+ query(query: string, fieldsToSearch?: bodyType['fieldsToSearch']): this;
341
+ queryConfig(weight: number, options?: bodyType['queryConfig']): this;
342
+ text(field?: string): _QueryBuilder;
343
+ vector(field: string, weight?: number): _QueryBuilder;
344
+ vector(field: string, options?: components['schemas']['vectorSearchQuery']): _QueryBuilder;
345
+ vector(field: string, weight?: number, options?: components['schemas']['vectorSearchQuery']): _QueryBuilder;
303
346
  sort(field: string, direction: 'asc' | 'desc'): this;
304
347
  textSort(field: string, direction: 'asc' | 'desc'): this;
305
348
  rawOption(key: string, value: any): this;
306
349
  minimumRelevance(value: bodyType['minimumRelevance']): this;
307
350
  page(value: bodyType['page']): this;
308
351
  pageSize(value: bodyType['pageSize']): this;
309
- rawFilter(filter: components['schemas']['filterListItem']): this;
310
352
  includeFields(fields: bodyType['includeFields']): void;
311
353
  excludeFields(fields: bodyType['excludeFields']): void;
312
354
  includeVectors(whetherToInclude: bodyType['includeVectors']): void;
313
- filter(type: string, key: string, value: string, ...options: any): this;
314
- match(field: string, value: any): this;
315
- wildcard(field: string, value: any): this;
316
- selfreference(fielda: string, fieldb: string, operation: "<=" | ">=" | "<" | ">" | "==" | "!="): this;
317
- range(field: string, options: Omit<components['schemas']['filterListItem']['range'], 'key'>): this;
318
- or(filters: _QueryBuilder[]): this;
319
- not(filter: _QueryBuilder): this;
320
355
  aggregate(field: string, options?: {
321
356
  options?: any;
322
357
  aggregates?: _QueryBuilder;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relevanceai/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.6.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",
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DiscoveryClient = void 0;
4
- const BaseClient_1 = require("../shared/BaseClient");
5
- class DiscoveryClient extends BaseClient_1._GenericClient {
6
- constructor(config) {
7
- super({ ...config, service_name: 'Discovery' });
8
- }
9
- async Insert(input, options) {
10
- return this.SendRequest({
11
- input,
12
- method: 'post',
13
- path: '/datasets/{dataset_id}/documents/insert',
14
- options
15
- });
16
- }
17
- async BulkInsert(input, options) {
18
- return this.SendRequest({
19
- input,
20
- method: 'post',
21
- path: '/datasets/{dataset_id}/documents/bulk_insert',
22
- options
23
- });
24
- }
25
- async BlobAccessURLs(input, options) {
26
- return this.SendRequest({
27
- input,
28
- method: 'post',
29
- path: '/datasets/{dataset_id}/blob_access_urls',
30
- options
31
- });
32
- }
33
- async ParseBlob(input, options) {
34
- return this.SendRequest({
35
- input,
36
- method: 'post',
37
- path: '/datasets/{dataset_id}/parse_blob',
38
- options
39
- });
40
- }
41
- async Update(input, options) {
42
- return this.SendRequest({
43
- input,
44
- method: 'post',
45
- path: '/datasets/{dataset_id}/documents/update',
46
- options
47
- });
48
- }
49
- async BulkUpdate(input, options) {
50
- return this.SendRequest({
51
- input,
52
- method: 'post',
53
- path: '/datasets/{dataset_id}/documents/bulk_update',
54
- options
55
- });
56
- }
57
- async UpdateWhere(input, options) {
58
- return this.SendRequest({
59
- input,
60
- method: 'post',
61
- path: '/datasets/{dataset_id}/documents/update_where',
62
- options
63
- });
64
- }
65
- async SimpleSearchPost(input, options) {
66
- return this.SendRequest({
67
- input,
68
- method: 'post',
69
- path: '/datasets/{dataset_id}/simple_search',
70
- options
71
- });
72
- }
73
- async SimpleSearchGet(input, options) {
74
- return this.SendRequest({
75
- input,
76
- method: 'get',
77
- path: '/datasets/{dataset_id}/simple_search',
78
- options
79
- });
80
- }
81
- }
82
- exports.DiscoveryClient = DiscoveryClient;