@relevanceai/sdk 1.149.0 → 2.0.1

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.
@@ -1 +1 @@
1
- export * from "./DiscoveryApi";
1
+ export * from "./VecDBApi";
@@ -1 +1,2 @@
1
1
  export * from './generated';
2
+ export * from './services';
@@ -0,0 +1 @@
1
+ export * from './vecdb';
@@ -0,0 +1,52 @@
1
+ /// <reference types="node" />
2
+ import { VecDBClient, _QueryBuilder } from ".";
3
+ import { DeleteDocumentOutput, DeleteWhereOutput, GetDocumentOutput, SimpleSearchPostOutput, BulkInsertOutput, UpdateWhereOutput, BulkUpdateOutput } from "../..";
4
+ import { _GenericMethodOptions } from "../../shared/BaseClient";
5
+ interface searchOptions {
6
+ debounce?: number;
7
+ rawPayload?: any;
8
+ }
9
+ export declare class Dataset {
10
+ client: VecDBClient;
11
+ name: string;
12
+ config: any;
13
+ debounceTimer?: NodeJS.Timeout;
14
+ constructor(client: VecDBClient, name: string, options: any);
15
+ get datasetName(): string;
16
+ createIfNotExist(): Promise<boolean>;
17
+ recreateIfExists(): Promise<boolean>;
18
+ insertDocument(document: any, options?: _GenericMethodOptions): Promise<unknown>;
19
+ search(): Promise<SimpleSearchPostOutput>;
20
+ search(query?: _QueryBuilder): Promise<SimpleSearchPostOutput>;
21
+ search(options?: searchOptions): Promise<SimpleSearchPostOutput>;
22
+ search(query?: _QueryBuilder, options?: searchOptions): Promise<SimpleSearchPostOutput>;
23
+ insertDocuments(documents: any, encoders?: any, options?: _GenericMethodOptions & {
24
+ batchSize?: number;
25
+ retryCount?: number;
26
+ progressCallback?: (progress: BulkInsertOutput[]) => any;
27
+ }): Promise<BulkInsertOutput>;
28
+ _GenericBulkOperation<InputItem, OutputItem>({ data, batchSize, fn, retryCount }: {
29
+ data: InputItem[];
30
+ fn: (data: InputItem[]) => Promise<OutputItem>;
31
+ batchSize?: number;
32
+ retryCount?: number;
33
+ progressCallback?: (progress: OutputItem[]) => any;
34
+ }): Promise<OutputItem[]>;
35
+ updateDocument(documentId: string, partialUpdates: any): Promise<{
36
+ status: string;
37
+ message: string;
38
+ }>;
39
+ updateDocuments(updates: any, options?: _GenericMethodOptions & {
40
+ batchSize?: number;
41
+ retryCount?: number;
42
+ progressCallback?: (progress: BulkUpdateOutput[]) => any;
43
+ }): Promise<BulkUpdateOutput>;
44
+ updateDocumentsWhere(filters: _QueryBuilder, partialUpdates: {
45
+ [id: string]: any;
46
+ }): Promise<UpdateWhereOutput>;
47
+ getDocument(documentId: string): Promise<GetDocumentOutput>;
48
+ deleteDocument(documentId: string): Promise<DeleteDocumentOutput>;
49
+ deleteDocuments(documentIds: [string]): Promise<DeleteWhereOutput>;
50
+ deleteDocumentsWhere(filters: _QueryBuilder): Promise<DeleteWhereOutput>;
51
+ }
52
+ export {};
@@ -0,0 +1,44 @@
1
+ import { VecDBApiClient } from '../../';
2
+ import { _ClientInput } from '../../shared/BaseClient';
3
+ import { components } from '../../generated/_VecDBApiSchemaTypes';
4
+ import { Dataset } from './Dataset';
5
+ declare type bodyType = any;
6
+ export declare function QueryBuilder(): _QueryBuilder;
7
+ export declare function FilterBuilder(): _FilterBuilder;
8
+ export declare class _FilterBuilder {
9
+ body: bodyType;
10
+ constructor();
11
+ buildFilters(): any;
12
+ rawFilter(filter: components['schemas']['simpleSearchAndFlatFilterItem']): this;
13
+ filter(type: string, key: string, value: string, ...options: any): this;
14
+ match(field: string, value: any): this;
15
+ wildcard(field: string, value: any): this;
16
+ range(field: string, options: Omit<components['schemas']['simpleSearchAndFlatFilterItem']['range'], 'field'>): this;
17
+ or(filters: _FilterBuilder[]): this;
18
+ }
19
+ export declare class _QueryBuilder extends _FilterBuilder {
20
+ defaultQueryValue?: string;
21
+ shouldPerformTextQuery: boolean;
22
+ constructor();
23
+ build(): any;
24
+ vector(field: string, weight?: number): _QueryBuilder;
25
+ vector(field: string, options?: any): _QueryBuilder;
26
+ vector(field: string, weight?: number, options?: any): _QueryBuilder;
27
+ sort(field: string, direction: 'asc' | 'desc'): this;
28
+ rawOption(key: string, value: any): this;
29
+ minimumRelevance(value: bodyType['minimumRelevance']): this;
30
+ page(value: bodyType['page']): this;
31
+ pageSize(value: bodyType['pageSize']): this;
32
+ includeFields(fields: bodyType['includeFields']): this;
33
+ ask(query: string, field: string, options: {
34
+ preset?: any;
35
+ titleReferenceField?: string;
36
+ urlReferenceField?: string;
37
+ }): this;
38
+ }
39
+ export declare class VecDBClient {
40
+ apiClient: VecDBApiClient;
41
+ constructor(config?: _ClientInput);
42
+ dataset(name: string, options?: any): Dataset;
43
+ }
44
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relevanceai/sdk",
3
- "version": "1.149.0",
3
+ "version": "2.0.1",
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",
@@ -12,7 +12,8 @@
12
12
  "build": "tsc -p tsconfig.json && tsc -p tsconfig.es.json && tsc -p tsconfig.types.json",
13
13
  "generate": "ts-node ./src/shared/generate.ts",
14
14
  "test": "jest",
15
- "prepare": "npm run build"
15
+ "prepare": "npm run build",
16
+ "sample": "ts-node ./test/sample.test.mjs"
16
17
  },
17
18
  "repository": {
18
19
  "type": "git",