@relevanceai/sdk 1.87.0 → 1.89.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.
@@ -622,6 +622,14 @@ class DiscoveryApiClient extends BaseClient_1._GenericClient {
622
622
  options
623
623
  });
624
624
  }
625
+ async UpsertWorkflowProgress(input, options) {
626
+ return this.SendRequest({
627
+ input,
628
+ method: 'post',
629
+ path: '/workflows/{workflow_id}/progress',
630
+ options
631
+ });
632
+ }
625
633
  async UpsertWorkflowStatus(input, options) {
626
634
  return this.SendRequest({
627
635
  input,
@@ -990,6 +990,18 @@ var DiscoveryApiClient = /** @class */ (function (_super) {
990
990
  });
991
991
  });
992
992
  };
993
+ DiscoveryApiClient.prototype.UpsertWorkflowProgress = function (input, options) {
994
+ return __awaiter(this, void 0, void 0, function () {
995
+ return __generator(this, function (_a) {
996
+ return [2 /*return*/, this.SendRequest({
997
+ input: input,
998
+ method: 'post',
999
+ path: '/workflows/{workflow_id}/progress',
1000
+ options: options
1001
+ })];
1002
+ });
1003
+ });
1004
+ };
993
1005
  DiscoveryApiClient.prototype.UpsertWorkflowStatus = function (input, options) {
994
1006
  return __awaiter(this, void 0, void 0, function () {
995
1007
  return __generator(this, function (_a) {
@@ -154,6 +154,8 @@ export declare type DeleteWorkflowStatusInput = operations['DeleteWorkflowStatus
154
154
  export declare type DeleteWorkflowStatusOutput = operations['DeleteWorkflowStatus']['responses']['200']['content']['application/json'];
155
155
  export declare type UpsertWorkflowMetadataInput = operations['UpsertWorkflowMetadata']['requestBody']['content']['application/json'];
156
156
  export declare type UpsertWorkflowMetadataOutput = operations['UpsertWorkflowMetadata']['responses']['200']['content']['application/json'];
157
+ export declare type UpsertWorkflowProgressInput = operations['UpsertWorkflowProgress']['requestBody']['content']['application/json'];
158
+ export declare type UpsertWorkflowProgressOutput = operations['UpsertWorkflowProgress']['responses']['200']['content']['application/json'];
157
159
  export declare type UpsertWorkflowStatusInput = operations['UpsertWorkflowStatus']['requestBody']['content']['application/json'];
158
160
  export declare type UpsertWorkflowStatusOutput = operations['UpsertWorkflowStatus']['responses']['200']['content']['application/json'];
159
161
  export declare type ListWorkflowTypesInput = {};
@@ -361,6 +363,7 @@ export declare class DiscoveryApiClient extends _GenericClient {
361
363
  GetWorkflowStatus(input: CommandInput<GetWorkflowStatusInput>, options?: _GenericMethodOptions): Promise<CommandOutput<GetWorkflowStatusOutput>>;
362
364
  DeleteWorkflowStatus(input: CommandInput<DeleteWorkflowStatusInput>, options?: _GenericMethodOptions): Promise<CommandOutput<DeleteWorkflowStatusOutput>>;
363
365
  UpsertWorkflowMetadata(input: CommandInput<UpsertWorkflowMetadataInput>, options?: _GenericMethodOptions): Promise<CommandOutput<UpsertWorkflowMetadataOutput>>;
366
+ UpsertWorkflowProgress(input: CommandInput<UpsertWorkflowProgressInput>, options?: _GenericMethodOptions): Promise<CommandOutput<UpsertWorkflowProgressOutput>>;
364
367
  UpsertWorkflowStatus(input: CommandInput<UpsertWorkflowStatusInput>, options?: _GenericMethodOptions): Promise<CommandOutput<UpsertWorkflowStatusOutput>>;
365
368
  ListWorkflowTypes(input: CommandInput<ListWorkflowTypesInput>, options?: _GenericMethodOptions): Promise<CommandOutput<ListWorkflowTypesOutput>>;
366
369
  GetWorkflowType(input: CommandInput<GetWorkflowTypeInput>, options?: _GenericMethodOptions): Promise<CommandOutput<GetWorkflowTypeOutput>>;
@@ -1306,6 +1306,19 @@ export interface paths {
1306
1306
  */
1307
1307
  post: operations["UpsertWorkflowMetadata"];
1308
1308
  };
1309
+ "/workflows/{workflow_id}/progress": {
1310
+ /**
1311
+ * ### Required permissions
1312
+ * > [
1313
+ * {
1314
+ * "actions": [
1315
+ * "datasets:write"
1316
+ * ]
1317
+ * }
1318
+ * ]
1319
+ */
1320
+ post: operations["UpsertWorkflowProgress"];
1321
+ };
1309
1322
  "/workflows/{workflow_id}/status": {
1310
1323
  /**
1311
1324
  * Update status for a workflow run
@@ -6828,6 +6841,26 @@ export interface components {
6828
6841
  /** @description Status of the workflow. Used for knowing when to send an email notification. */
6829
6842
  status?: "complete" | "inprogress" | "failed";
6830
6843
  job_status?: "InProgress" | "Completed" | "Failed";
6844
+ worker_status?: {
6845
+ [key: string]: {
6846
+ status?: "complete" | "inprogress" | "failed";
6847
+ completion_time?: string;
6848
+ creation_time?: string;
6849
+ };
6850
+ };
6851
+ n_workers?: number;
6852
+ steps?: {
6853
+ [key: string]: {
6854
+ worker_progress?: {
6855
+ [key: string]: {
6856
+ n_processed?: number;
6857
+ n_total?: number;
6858
+ };
6859
+ };
6860
+ n_processed?: number;
6861
+ n_total?: number;
6862
+ };
6863
+ };
6831
6864
  } & {
6832
6865
  [key: string]: unknown;
6833
6866
  })[];
@@ -6850,6 +6883,26 @@ export interface components {
6850
6883
  /** @description Status of the workflow. Used for knowing when to send an email notification. */
6851
6884
  status?: "complete" | "inprogress" | "failed";
6852
6885
  job_status?: "InProgress" | "Completed" | "Failed";
6886
+ worker_status?: {
6887
+ [key: string]: {
6888
+ status?: "complete" | "inprogress" | "failed";
6889
+ completion_time?: string;
6890
+ creation_time?: string;
6891
+ };
6892
+ };
6893
+ n_workers?: number;
6894
+ steps?: {
6895
+ [key: string]: {
6896
+ worker_progress?: {
6897
+ [key: string]: {
6898
+ n_processed?: number;
6899
+ n_total?: number;
6900
+ };
6901
+ };
6902
+ n_processed?: number;
6903
+ n_total?: number;
6904
+ };
6905
+ };
6853
6906
  } & {
6854
6907
  [key: string]: unknown;
6855
6908
  };
@@ -6862,6 +6915,13 @@ export interface components {
6862
6915
  };
6863
6916
  };
6864
6917
  UpsertWorkflowMetadataOutput: unknown;
6918
+ UpsertWorkflowProgressInput: {
6919
+ worker_number: number;
6920
+ step: string;
6921
+ n_processed?: number;
6922
+ n_total?: number;
6923
+ };
6924
+ UpsertWorkflowProgressOutput: unknown;
6865
6925
  UpsertWorkflowStatusInput: {
6866
6926
  /** @description Metadata of the workflow. Can be an object including any information you want to store. */
6867
6927
  metadata?: {
@@ -6878,6 +6938,7 @@ export interface components {
6878
6938
  * @default true
6879
6939
  */
6880
6940
  send_email?: boolean;
6941
+ worker_number?: number;
6881
6942
  };
6882
6943
  UpsertWorkflowStatusOutput: unknown;
6883
6944
  ListWorkflowTypesInput: unknown;
@@ -11432,7 +11493,12 @@ export interface operations {
11432
11493
  * > []
11433
11494
  */
11434
11495
  ListProjects: {
11435
- parameters: {};
11496
+ parameters: {
11497
+ query: {
11498
+ page?: number;
11499
+ page_size?: number;
11500
+ };
11501
+ };
11436
11502
  responses: {
11437
11503
  /** successful operation */
11438
11504
  200: {
@@ -13310,6 +13376,37 @@ export interface operations {
13310
13376
  };
13311
13377
  };
13312
13378
  };
13379
+ /**
13380
+ * ### Required permissions
13381
+ * > [
13382
+ * {
13383
+ * "actions": [
13384
+ * "datasets:write"
13385
+ * ]
13386
+ * }
13387
+ * ]
13388
+ */
13389
+ UpsertWorkflowProgress: {
13390
+ parameters: {
13391
+ path: {
13392
+ /** ID of workflow */
13393
+ workflow_id: string;
13394
+ };
13395
+ };
13396
+ responses: {
13397
+ /** successful operation */
13398
+ 200: {
13399
+ content: {
13400
+ "application/json": components["schemas"]["UpsertWorkflowProgressOutput"];
13401
+ };
13402
+ };
13403
+ };
13404
+ requestBody: {
13405
+ content: {
13406
+ "application/json": components["schemas"]["UpsertWorkflowProgressInput"];
13407
+ };
13408
+ };
13409
+ };
13313
13410
  /**
13314
13411
  * Update status for a workflow run
13315
13412
  *
@@ -13348,7 +13445,266 @@ export interface operations {
13348
13445
  * > []
13349
13446
  */
13350
13447
  ListWorkflowTypes: {
13351
- parameters: {};
13448
+ parameters: {
13449
+ query: {
13450
+ filters?: (Partial<{
13451
+ /** @description Match where document[field] is in value list. */
13452
+ match?: {
13453
+ /** @description If matching on text, match even if there are extra words / case insensitivity */
13454
+ fuzzy?: boolean;
13455
+ /** @description Field to match on. */
13456
+ key?: string;
13457
+ /** @description Field to match on. */
13458
+ field?: string;
13459
+ /** @description Can be either a single item or a list of items to match on. */
13460
+ value: string | boolean | number | unknown[];
13461
+ };
13462
+ /** @description Match where document._id is in value list. */
13463
+ matchIds?: {
13464
+ /** @description Can be either a single item or a list of items to match on. */
13465
+ value: string | boolean | number | unknown[];
13466
+ };
13467
+ /** @description Match documents where greaterThan < document[field] < lessThan. Supports numbers and date strings. */
13468
+ range?: {
13469
+ /** @description Field to match on. */
13470
+ key?: string;
13471
+ /** @description Field to match on. */
13472
+ field?: string;
13473
+ greaterThan?: unknown;
13474
+ lessThan?: unknown;
13475
+ greaterThanOrEqualTo?: unknown;
13476
+ lessThanOrEqualTo?: unknown;
13477
+ };
13478
+ /**
13479
+ * @description
13480
+ * Match documents where the field either contains the value as a substring, or matches a provided matching pattern.
13481
+ *
13482
+ * Possible matching patterns:
13483
+ *
13484
+ * * - documents where the field has any value
13485
+ * ? - documents where a single character from the field matches the provided values
13486
+ *
13487
+ * Example:
13488
+ *
13489
+ * {
13490
+ * wildcard: {
13491
+ * field: "title",
13492
+ * value: [ "Avenger*" ]
13493
+ * }
13494
+ * }
13495
+ */
13496
+ wildcard?: {
13497
+ /** @description Field to match on. */
13498
+ key?: string;
13499
+ /** @description Field to match on. */
13500
+ field?: string;
13501
+ /** @description single string or array of valid wildcard strings to match on, for example ['tele*'] */
13502
+ value: string | string[];
13503
+ };
13504
+ /** @description hybrid search query that must reach a certain value to filter */
13505
+ search?: {
13506
+ /**
13507
+ * @description Search for documents that contain this query string in your dataset. Use fieldsToSearch parameter to restrict which fields are searched.
13508
+ *
13509
+ * "tele" matches "Television", "This television is an excellent product…"
13510
+ *
13511
+ * Example: "tele"
13512
+ */
13513
+ query?: string;
13514
+ /** @description Configuration for traditional search query. */
13515
+ queryConfig?: {
13516
+ /**
13517
+ * @description Increases or decreases the impact of all traditional search matching when calculating a documents _relevance.
13518
+ * @default 1
13519
+ */
13520
+ weight?: number;
13521
+ /**
13522
+ * @description Increases or decreases the impact of sentence matching when calculating a documents _relevance.
13523
+ * For example, with query "A fox jumped", with high sentence weight, 'A fox jumped over the' would match before 'jumped a fox over fox'
13524
+ * @default 1
13525
+ */
13526
+ sentenceWeight?: number;
13527
+ /**
13528
+ * @description Increases or decreases the impact of fuzzy matching when calculating a documents _relevance.
13529
+ * For example, with query "rain", with 0 fuzzy weight, 'brain' would not match.
13530
+ * @default 1
13531
+ */
13532
+ fuzzyWeight?: number;
13533
+ };
13534
+ /**
13535
+ * @description Prioritise the result list of documents based on semantic similarity to "query" provided here.
13536
+ *
13537
+ * For example if field "animaltype_vector_" contains encoded vector values for "cat", lion, "dog","bird", and "query" is set to "kitten", documents with "cat", "lion" will be returned first in the results list.
13538
+ *
13539
+ * It can be an object or a list of objects.
13540
+ *
13541
+ *
13542
+ *
13543
+ * Example payloads:
13544
+ *
13545
+ * {"field":"animaltype_vector_","query":"kitten"}
13546
+ *
13547
+ * [
13548
+ *
13549
+ * {"field":"animaltype_vector_","query":"kitten","weight":1","model":"text"}, {"field":"animaltype_vector_","query":"https://www.dogimage.com/dogimage.png","model":"image","weight":2}
13550
+ *
13551
+ * ]
13552
+ */
13553
+ vectorSearchQuery?: {
13554
+ /** @description Vector name to search on. For example, title_vector_ */
13555
+ field: string;
13556
+ /** @description Query to transform to a vector and then search with. Default to query in the root body if not provided. */
13557
+ query?: string;
13558
+ /**
13559
+ * @description Model name to generate the vector with.
13560
+ * @default text
13561
+ */
13562
+ model?: string;
13563
+ /** @description Model url to use for encoding. If model and model_url are both set, model_url will override it. */
13564
+ model_url?: string;
13565
+ /**
13566
+ * @description Increases or decreases the impact of this vector fields match on documents relevance score.
13567
+ * @default 1
13568
+ */
13569
+ weight?: number;
13570
+ /** @description Instead of generating a vector by vectorising the query, use the vector provided here for vector search. */
13571
+ vector?: number[];
13572
+ chunkConfig?: {
13573
+ chunkField: string;
13574
+ page?: number;
13575
+ pageSize?: number;
13576
+ };
13577
+ } | {
13578
+ /** @description Vector name to search on. For example, title_vector_ */
13579
+ field: string;
13580
+ /** @description Query to transform to a vector and then search with. Default to query in the root body if not provided. */
13581
+ query?: string;
13582
+ /**
13583
+ * @description Model name to generate the vector with.
13584
+ * @default text
13585
+ */
13586
+ model?: string;
13587
+ /** @description Model url to use for encoding. If model and model_url are both set, model_url will override it. */
13588
+ model_url?: string;
13589
+ /**
13590
+ * @description Increases or decreases the impact of this vector fields match on documents relevance score.
13591
+ * @default 1
13592
+ */
13593
+ weight?: number;
13594
+ /** @description Instead of generating a vector by vectorising the query, use the vector provided here for vector search. */
13595
+ vector?: number[];
13596
+ chunkConfig?: {
13597
+ chunkField: string;
13598
+ page?: number;
13599
+ pageSize?: number;
13600
+ };
13601
+ }[];
13602
+ realtimeClustering?: {
13603
+ /** @default 4 */
13604
+ nClusters?: number;
13605
+ /** @default kmeans-realtime-4 */
13606
+ alias?: string;
13607
+ vectorField: string;
13608
+ /** @default _cluster_.{vector_field}.{alias} */
13609
+ outputField?: string;
13610
+ };
13611
+ /**
13612
+ * @description A list of fields to search using the "query" parameter.
13613
+ *
13614
+ * Each item can be field name as a string, or an object with 'field' as field name and optional parameters such as field weight.
13615
+ *
13616
+ * Default behaviour is to search all fields.
13617
+ *
13618
+ * Example: ["name",{"field":"favourite_color","weight":0.2}]
13619
+ */
13620
+ fieldsToSearch?: (string | {
13621
+ /** @description Field name to search. */
13622
+ key?: string;
13623
+ /** @description Field name to search. */
13624
+ field?: string;
13625
+ /**
13626
+ * @description Multiply the relevance contribution of a specific field when using traditional search.
13627
+ * @default 1
13628
+ */
13629
+ weight?: number;
13630
+ /** @description Enabled text search on chunk fields. Scoring will take the max similarity of any subitem within the chunk. */
13631
+ chunkField?: string;
13632
+ })[];
13633
+ /**
13634
+ * @description Only return documents with a _relevance above this threshold.
13635
+ *
13636
+ * Example: 0.3
13637
+ */
13638
+ minimumRelevance: number;
13639
+ };
13640
+ /** @description Match documents where field specified by 'field' exists in the document. for nested fields, use syntax: a.b.c */
13641
+ fieldExists?: {
13642
+ /** @description Field that must exist. */
13643
+ key?: string;
13644
+ /** @description Field that must exist. */
13645
+ field?: string;
13646
+ };
13647
+ /** @description Match documents where doc[field] % module == value */
13648
+ matchModulo?: {
13649
+ /** @default _id */
13650
+ field?: string;
13651
+ modulo: number;
13652
+ value: number;
13653
+ };
13654
+ /** @description Filter down to one document for each value of selected field. */
13655
+ dedupeByValue?: {
13656
+ /** @description Field to filter on. */
13657
+ field: string;
13658
+ };
13659
+ /** @description Match documents where document[a] <=/>=/</>/==/!=/stringEquals document[b]. Use stringEquals to compare strings. */
13660
+ selfreference?: {
13661
+ /** @description First field in comparison. */
13662
+ a: string;
13663
+ /** @description Second field in comparison. */
13664
+ b: string;
13665
+ /** @description Operator used to compare a and b. */
13666
+ operation: "<=" | ">=" | "<" | ">" | "==" | "!=" | "stringEquals";
13667
+ };
13668
+ /** @description Match documents where greaterThan < wordCount(document[field]) < lessThan. */
13669
+ wordCount?: {
13670
+ /** @description Field to match on. */
13671
+ field: string;
13672
+ /** @description Minimum word count. */
13673
+ greaterThan?: number;
13674
+ /** @description Maximum word count. */
13675
+ lessThan?: number;
13676
+ };
13677
+ /** @description Match documents where greaterThan < characterCount(document[field]) < lessThan. */
13678
+ characterCount?: {
13679
+ /** @description Field to match on. */
13680
+ field: string;
13681
+ /** @description Minimum character count. */
13682
+ greaterThan?: number;
13683
+ /** @description Maximum character count. */
13684
+ lessThan?: number;
13685
+ };
13686
+ /** @description Used to perform a logical OR of filters. each element of the OR list can itself be a list to perform a nested AND. {or:[[A,B],C]} is equivalent to (A AND B) OR C */
13687
+ or?: (definitions["simpleSearchAndFlatFilterItem"][] | definitions["simpleSearchAndFlatFilterItem"])[];
13688
+ /** @description Used to perform NOT filter. Can be a single filter or a list of filters to perform a !(AND). {not:[A,B]} is equivalent to !(A AND B) */
13689
+ not?: definitions["simpleSearchAndFlatFilterItem"][] | definitions["simpleSearchAndFlatFilterItem"];
13690
+ /** @description Filter based on data within a _chunk_ field. */
13691
+ chunk?: {
13692
+ /** @description The path of the chunk field to filter on. For example: description_sentences_chunk_ */
13693
+ path: string;
13694
+ filters: definitions["simpleSearchAndFlatFilterItem"][];
13695
+ };
13696
+ }> & Partial<{
13697
+ strict?: "must" | "should" | "must_or";
13698
+ condition?: string;
13699
+ field?: string;
13700
+ filter_type?: "text_match" | "word_match" | "term" | "terms" | "text" | "texts" | "match" | "contains" | "substring" | "class" | "category" | "exact_match" | "classes" | "categories" | "exists" | "traditional" | "fuzzy" | "regexp" | "ids" | "date" | "numeric" | "search" | "or" | "word_count" | "character_count" | "dedupe_by_value";
13701
+ condition_value?: unknown;
13702
+ fuzzy?: number;
13703
+ join?: boolean;
13704
+ }>)[];
13705
+ show_hidden?: boolean;
13706
+ };
13707
+ };
13352
13708
  responses: {
13353
13709
  /** successful operation */
13354
13710
  200: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relevanceai/sdk",
3
- "version": "1.87.0",
3
+ "version": "1.89.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",