@crewdle/web-sdk-types 1.0.17 → 1.0.18

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.
Files changed (52) hide show
  1. package/dist/ai/GenerativeAI.d.ts +14 -25
  2. package/dist/ai/GenerativeAIContext.d.ts +3 -11
  3. package/dist/ai/GenerativeAIWorkerConnector.d.ts +45 -18
  4. package/dist/ai/GenerativeAIWorkerConnector.js +17 -1
  5. package/dist/ai/GenerativeAIWorkerConnectorConstructor.d.ts +2 -2
  6. package/dist/ai/NLPLibraryConnector.d.ts +14 -0
  7. package/dist/ai/NLPLibraryConnectorConstructor.d.ts +2 -0
  8. package/dist/ai/index.d.ts +2 -3
  9. package/dist/ai/index.js +2 -3
  10. package/dist/core/cluster/Cluster.d.ts +22 -0
  11. package/dist/core/sdk/SDKOptions.d.ts +16 -2
  12. package/dist/core/stream/ContentType.d.ts +9 -1
  13. package/dist/core/stream/ContentType.js +8 -0
  14. package/dist/graph-database/GraphDatabase.d.ts +35 -0
  15. package/dist/graph-database/GraphDatabase.js +1 -0
  16. package/dist/graph-database/GraphDatabaseConnector.d.ts +27 -0
  17. package/dist/graph-database/GraphDatabaseConnector.js +1 -0
  18. package/dist/graph-database/GraphDatabaseConnectorConstructor.d.ts +6 -0
  19. package/dist/graph-database/GraphDatabaseConnectorConstructor.js +1 -0
  20. package/dist/graph-database/index.d.ts +3 -0
  21. package/dist/graph-database/index.js +3 -0
  22. package/dist/index.d.ts +2 -0
  23. package/dist/index.js +2 -0
  24. package/dist/job/Job.d.ts +8 -8
  25. package/dist/job/Job.js +2 -2
  26. package/dist/job/JobDispatcher.d.ts +1 -1
  27. package/dist/job/JobWorker.d.ts +1 -1
  28. package/dist/job/JobWorkerConnector.d.ts +12 -6
  29. package/dist/object-storage/DocumentParserConnector.d.ts +9 -0
  30. package/dist/object-storage/DocumentParserConnector.js +1 -0
  31. package/dist/object-storage/DocumentParserConnectorConstructor.d.ts +2 -0
  32. package/dist/object-storage/DocumentParserConnectorConstructor.js +1 -0
  33. package/dist/object-storage/FileOptions.d.ts +4 -0
  34. package/dist/object-storage/FilePayload.d.ts +2 -2
  35. package/dist/object-storage/ObjectStoreBucket.d.ts +4 -2
  36. package/dist/object-storage/index.d.ts +2 -0
  37. package/dist/vector-database/VectorDatabase.d.ts +41 -0
  38. package/dist/vector-database/VectorDatabase.js +1 -0
  39. package/dist/vector-database/VectorDatabaseConnector.d.ts +33 -0
  40. package/dist/vector-database/VectorDatabaseConnector.js +1 -0
  41. package/dist/{ai → vector-database}/VectorDatabaseConnectorConstructor.d.ts +1 -1
  42. package/dist/vector-database/VectorDatabaseConnectorConstructor.js +1 -0
  43. package/dist/vector-database/VectorDatabaseSearchResult.d.ts +19 -0
  44. package/dist/vector-database/VectorDatabaseSearchResult.js +1 -0
  45. package/dist/vector-database/index.d.ts +4 -0
  46. package/dist/vector-database/index.js +4 -0
  47. package/package.json +1 -1
  48. package/dist/ai/GenerativeAIModelType.d.ts +0 -14
  49. package/dist/ai/GenerativeAIModelType.js +0 -15
  50. package/dist/ai/VectorDatabaseConnector.d.ts +0 -25
  51. /package/dist/ai/{VectorDatabaseConnector.js → NLPLibraryConnector.js} +0 -0
  52. /package/dist/ai/{VectorDatabaseConnectorConstructor.js → NLPLibraryConnectorConstructor.js} +0 -0
@@ -1,3 +1,4 @@
1
+ import { IVectorDatabaseSearchResult } from '../vector-database';
1
2
  import { IJobParameters, IJobResult } from '../job';
2
3
  /**
3
4
  * The AI prompt source Enum
@@ -38,10 +39,6 @@ export interface IPromptOptions {
38
39
  * The instructions for the AI job.
39
40
  */
40
41
  instructions?: string;
41
- /**
42
- * Whether to use RAG for the AI job.
43
- */
44
- useRAG?: boolean;
45
42
  /**
46
43
  * The context for the AI job.
47
44
  */
@@ -54,23 +51,15 @@ export interface IPromptOptions {
54
51
  * The temperature for the LLM.
55
52
  */
56
53
  temperature?: number;
57
- /**
58
- * The maximum number of contents to include in the context.
59
- */
60
- maxContents?: number;
61
- /**
62
- * The number of chunks to include in one content.
63
- */
64
- maxChunks?: number;
65
- /**
66
- * The starting index of the RAG for search.
67
- */
68
- ragStartingIndex?: number;
69
- /**
70
- * The minimum relevance of the RAG contents.
71
- */
72
- minRelevance?: number;
73
54
  }
55
+ /**
56
+ * The AI prompt type text
57
+ */
58
+ export type PromptTypeText = string | string[];
59
+ /**
60
+ * The AI prompt type vector
61
+ */
62
+ export type PromptTypeVector = number[];
74
63
  /**
75
64
  * The AI prompt result Interface
76
65
  * Represents the result of an AI prompt.
@@ -80,7 +69,11 @@ export interface IPromptResult {
80
69
  /**
81
70
  * The output of the AI job.
82
71
  */
83
- output: string;
72
+ output?: PromptTypeText | PromptTypeVector;
73
+ /**
74
+ * The relevant context used by the AI job.
75
+ */
76
+ context?: IVectorDatabaseSearchResult[];
84
77
  /**
85
78
  * The tokens used by the AI job.
86
79
  */
@@ -89,10 +82,6 @@ export interface IPromptResult {
89
82
  * The tokens generated by the AI job.
90
83
  */
91
84
  outputTokens?: number;
92
- /**
93
- * The number of contents in the RAG.
94
- */
95
- contentSize?: number;
96
85
  }
97
86
  /**
98
87
  * The AI job parameters Interface
@@ -1,5 +1,4 @@
1
1
  import { IPromptOptions, IPromptResult } from '.';
2
- import { GenerativeAIModelType } from './GenerativeAIModelType';
3
2
  /**
4
3
  * Represents a context for a Generative AI service.
5
4
  * @category AI
@@ -20,17 +19,10 @@ export interface IGenerativeAIContext {
20
19
  */
21
20
  prompt(prompt: string, options?: IPromptOptions): Promise<IPromptResult>;
22
21
  /**
23
- * Upload a model to the AI service.
24
- * @param model The model file to upload.
25
- * @returns A promise that resolves when the model is uploaded.
22
+ * Get the data bucket IDs.
23
+ * @returns An array of data bucket IDs.
26
24
  */
27
- uploadModel(model: File, type?: GenerativeAIModelType): Promise<void>;
28
- /**
29
- * Delete a model from the AI service.
30
- * @param modelId The optional ID of the model to delete.
31
- * @returns A promise that resolves when the model is deleted.
32
- */
33
- deleteModel(modelId?: string): Promise<void>;
25
+ getDataBucketIds(): Promise<string[]>;
34
26
  /**
35
27
  * Close the Generative AI Context.
36
28
  */
@@ -1,5 +1,37 @@
1
- import { IJobRequest, IJobWorkerConnector, JobResponse } from '../job';
1
+ import { IJobWorkerConnector, IJobWorkerOptions } from '../job';
2
2
  import { IJobParametersAI, IJobResultAI } from './GenerativeAI';
3
+ /**
4
+ * The generative AI model input types.
5
+ * @category AI
6
+ */
7
+ export declare enum GenerativeAIModelInputType {
8
+ Text = "text"
9
+ }
10
+ /**
11
+ * The generative AI model output types.
12
+ * @category AI
13
+ */
14
+ export declare enum GenerativeAIModelOutputType {
15
+ Text = "text",
16
+ Vector = "vector"
17
+ }
18
+ /**
19
+ * The generative AI model interface.
20
+ * @category AI
21
+ */
22
+ export interface IGenerativeAIModel {
23
+ id: string;
24
+ inputType: GenerativeAIModelInputType;
25
+ outputType: GenerativeAIModelOutputType;
26
+ sourceUrl: string;
27
+ }
28
+ /**
29
+ * The generative AI worker options.
30
+ * @category AI
31
+ */
32
+ export interface IGenerativeAIWorkerOptions extends IJobWorkerOptions {
33
+ model: IGenerativeAIModel;
34
+ }
3
35
  /**
4
36
  * The generative AI worker connector interface.
5
37
  * @category Connector
@@ -7,33 +39,28 @@ import { IJobParametersAI, IJobResultAI } from './GenerativeAI';
7
39
  export interface IGenerativeAIWorkerConnector extends IJobWorkerConnector<IJobParametersAI, IJobResultAI> {
8
40
  /**
9
41
  * Initialize the machine learning model.
10
- * @param llmModel The path to the LLM model.
11
- * @param similarityModel The path to the similarity model.
42
+ * @param workflowId The workflow ID.
43
+ * @param models A map of model IDs and pathnames.
12
44
  * @returns A promise that resolves when the model has been initialized.
13
45
  */
14
- initialize(llmModel?: string, similarityModel?: string): Promise<void>;
15
- /**
16
- * Add content to the machine learning model.
17
- * @param name The name of the content.
18
- * @param content The content to add.
19
- * @returns A promise that resolves when the content has been added.
20
- */
21
- addContent(name: string, content: string): Promise<void>;
46
+ initialize(workflowId: string, models: Map<string, string>): Promise<void>;
22
47
  /**
23
- * Remove content from the machine learning model.
24
- * @param name The name of the content.
48
+ * Close the machine learning model.
49
+ * @returns A promise that resolves when the model has been closed.
25
50
  */
26
- removeContent(name: string): void;
51
+ close(): Promise<void>;
27
52
  /**
28
53
  * Process a job.
29
- * @param job The job to process.
54
+ * @param parameters The job parameters.
55
+ * @param options The job options.
30
56
  * @returns A promise that resolves with the job result.
31
57
  */
32
- processJob(job: IJobRequest<IJobParametersAI>): Promise<JobResponse<IJobResultAI>>;
58
+ processJob(parameters: IJobParametersAI, options?: IGenerativeAIWorkerOptions): Promise<IJobResultAI>;
33
59
  /**
34
60
  * Stream a job.
35
- * @param job The job to stream.
61
+ * @param parameters The job parameters.
62
+ * @param options The job options.
36
63
  * @returns An async generator that yields the job result.
37
64
  */
38
- processJobStream(job: IJobRequest<IJobParametersAI>): AsyncGenerator<JobResponse<IJobResultAI>>;
65
+ processJobStream(parameters: IJobParametersAI, options?: IGenerativeAIWorkerOptions): AsyncGenerator<IJobResultAI>;
39
66
  }
@@ -1 +1,17 @@
1
- export {};
1
+ /**
2
+ * The generative AI model input types.
3
+ * @category AI
4
+ */
5
+ export var GenerativeAIModelInputType;
6
+ (function (GenerativeAIModelInputType) {
7
+ GenerativeAIModelInputType["Text"] = "text";
8
+ })(GenerativeAIModelInputType || (GenerativeAIModelInputType = {}));
9
+ /**
10
+ * The generative AI model output types.
11
+ * @category AI
12
+ */
13
+ export var GenerativeAIModelOutputType;
14
+ (function (GenerativeAIModelOutputType) {
15
+ GenerativeAIModelOutputType["Text"] = "text";
16
+ GenerativeAIModelOutputType["Vector"] = "vector";
17
+ })(GenerativeAIModelOutputType || (GenerativeAIModelOutputType = {}));
@@ -1,6 +1,6 @@
1
- import { IGenerativeAIWorkerConnector, VectorDatabaseConnectorConstructor } from '.';
1
+ import { IGenerativeAIWorkerConnector } from '.';
2
2
  /**
3
3
  * The generative AI worker connector constructor type.
4
4
  * @category AI
5
5
  */
6
- export type GenerativeAIWorkerConnectorConstructor = new (vectorDatabaseConnector: VectorDatabaseConnectorConstructor) => IGenerativeAIWorkerConnector;
6
+ export type GenerativeAIWorkerConnectorConstructor = new () => IGenerativeAIWorkerConnector;
@@ -0,0 +1,14 @@
1
+ export interface INLPLibraryConnector {
2
+ /**
3
+ * Splits the text into sentences.
4
+ * @param text The text to split.
5
+ * @returns A promise that resolves with the sentences.
6
+ */
7
+ getSentences(text: string): Promise<string[]>;
8
+ /**
9
+ * Extracts the entities from the text.
10
+ * @param text The text to extract from.
11
+ * @returns A promise that resolves with the entities.
12
+ */
13
+ getEntities(text: string): Promise<string[]>;
14
+ }
@@ -0,0 +1,2 @@
1
+ import { INLPLibraryConnector } from './NLPLibraryConnector';
2
+ export type NLPLibraryConnectorConstructor = new () => INLPLibraryConnector;
@@ -1,8 +1,7 @@
1
1
  export * from './GenerativeAI';
2
2
  export * from './GenerativeAIContext';
3
- export * from './GenerativeAIModelType';
4
3
  export * from './GenerativeAIWorker';
5
4
  export * from './GenerativeAIWorkerConnector';
6
5
  export * from './GenerativeAIWorkerConnectorConstructor';
7
- export * from './VectorDatabaseConnector';
8
- export * from './VectorDatabaseConnectorConstructor';
6
+ export * from './NLPLibraryConnector';
7
+ export * from './NLPLibraryConnectorConstructor';
package/dist/ai/index.js CHANGED
@@ -1,8 +1,7 @@
1
1
  export * from './GenerativeAI';
2
2
  export * from './GenerativeAIContext';
3
- export * from './GenerativeAIModelType';
4
3
  export * from './GenerativeAIWorker';
5
4
  export * from './GenerativeAIWorkerConnector';
6
5
  export * from './GenerativeAIWorkerConnectorConstructor';
7
- export * from './VectorDatabaseConnector';
8
- export * from './VectorDatabaseConnectorConstructor';
6
+ export * from './NLPLibraryConnector';
7
+ export * from './NLPLibraryConnectorConstructor';
@@ -1,9 +1,11 @@
1
+ import { IGraphDatabase } from '../../graph-database';
1
2
  import { IClusterEventEmitter } from '.';
2
3
  import { IGenerativeAIContext, IGenerativeAIWorker } from '../../ai';
3
4
  import { IKeyValueDatabase, IDatabaseLayout, ILayoutBuilder } from '../../key-value-database';
4
5
  import { ILocalMediaStream, ILocalDynamicMediaStream, IRemoteMediaStream, MediaStreamSource } from '../../media-stream';
5
6
  import { IObjectStoreBucket, IObjectStoreBucketOptions } from '../../object-storage';
6
7
  import { IPubSubTopic } from '../../pubsub';
8
+ import { IVectorDatabase } from '../../vector-database';
7
9
  import { LocalNode, Node } from '../node';
8
10
  /**
9
11
  * The cluster interface.
@@ -51,6 +53,16 @@ export interface ICluster extends IClusterEventEmitter {
51
53
  * @param label The label of the generative AI Worker.
52
54
  */
53
55
  openGenerativeAIWorker(label: string): Promise<IGenerativeAIWorker>;
56
+ /**
57
+ * Open a vector database.
58
+ * @param label The label of the vector database.
59
+ */
60
+ openVectorDatabase(label: string): IVectorDatabase;
61
+ /**
62
+ * Open a graph database.
63
+ * @param label The label of the graph database.
64
+ */
65
+ openGraphDatabase(label: string): IGraphDatabase;
54
66
  /**
55
67
  * Publish a local media stream.
56
68
  * @param label The label of the media stream.
@@ -102,6 +114,16 @@ export interface ICluster extends IClusterEventEmitter {
102
114
  * @param strategy The strategy to use to filter the media streams.
103
115
  */
104
116
  getRemoteMediaStreams(strategy?: (item: IRemoteMediaStream) => boolean): IRemoteMediaStream[];
117
+ /**
118
+ * Get an array of opened vector databases.
119
+ * @param strategy The strategy to use to filter the vector databases.
120
+ */
121
+ getVectorDatabases(strategy?: (item: IVectorDatabase) => boolean): IVectorDatabase[];
122
+ /**
123
+ * Get an array of opened graph databases.
124
+ * @param strategy The strategy to use to filter the graph databases.
125
+ */
126
+ getGraphDatabases(strategy?: (item: IGraphDatabase) => boolean): IGraphDatabase[];
105
127
  /**
106
128
  * Get the local node for this cluster.
107
129
  */
@@ -1,8 +1,10 @@
1
1
  import { KeyValueDatabaseConnectorConstructor } from '../../key-value-database';
2
2
  import { ILoggingConnector } from '.';
3
- import { ObjectStoreConnectorConstructor } from '../../object-storage';
3
+ import { DocumentParserConnectorConstructor, ObjectStoreConnectorConstructor } from '../../object-storage';
4
4
  import { PeerConnectionConnectorConstructor } from '../connection';
5
- import { GenerativeAIWorkerConnectorConstructor, VectorDatabaseConnectorConstructor } from '../../ai';
5
+ import { GenerativeAIWorkerConnectorConstructor, NLPLibraryConnectorConstructor } from '../../ai';
6
+ import { VectorDatabaseConnectorConstructor } from '../../vector-database';
7
+ import { GraphDatabaseConnectorConstructor } from '../../graph-database';
6
8
  /**
7
9
  * Options to configure the SDK.
8
10
  * @category Core
@@ -43,6 +45,18 @@ export interface ISDKOptions {
43
45
  * The custom vector database connector to use for vector database tasks.
44
46
  */
45
47
  vectorDatabaseConnector?: VectorDatabaseConnectorConstructor;
48
+ /**
49
+ * The custom graph database connector to use for graph database tasks.
50
+ */
51
+ graphDatabaseConnector?: GraphDatabaseConnectorConstructor;
52
+ /**
53
+ * The custom document parser connector to use for parsing documents.
54
+ */
55
+ documentParserConnector?: DocumentParserConnectorConstructor;
56
+ /**
57
+ * The custom natural language processing connector to use for natural language processing tasks.
58
+ */
59
+ nlpLibraryConnector?: NLPLibraryConnectorConstructor;
46
60
  /**
47
61
  * The maximum number of outgoing subscriptions.
48
62
  */
@@ -30,5 +30,13 @@ export declare enum ContentType {
30
30
  /**
31
31
  * @ignore
32
32
  */
33
- Job = "job"
33
+ Job = "job",
34
+ /**
35
+ * @ignore
36
+ */
37
+ VectorDatabase = "vectordatabase",
38
+ /**
39
+ * @ignore
40
+ */
41
+ GraphDatabase = "graphdatabase"
34
42
  }
@@ -33,4 +33,12 @@ export var ContentType;
33
33
  * @ignore
34
34
  */
35
35
  ContentType["Job"] = "job";
36
+ /**
37
+ * @ignore
38
+ */
39
+ ContentType["VectorDatabase"] = "vectordatabase";
40
+ /**
41
+ * @ignore
42
+ */
43
+ ContentType["GraphDatabase"] = "graphdatabase";
36
44
  })(ContentType || (ContentType = {}));
@@ -0,0 +1,35 @@
1
+ import { IDataStream } from '../core';
2
+ /**
3
+ * The interface for the graph database.
4
+ * @category Graph Database
5
+ */
6
+ export interface IGraphDatabase extends IDataStream {
7
+ /**
8
+ * Get the name of the database.
9
+ */
10
+ getName(): string;
11
+ /**
12
+ * Get the owner ID of the database.
13
+ */
14
+ getOwnerId(): string;
15
+ /**
16
+ * Close the database.
17
+ */
18
+ close(): void;
19
+ /**
20
+ * Add a node to the database.
21
+ * @param node The node to add.
22
+ */
23
+ addNode(node: string): void;
24
+ /**
25
+ * Add an edge to the database.
26
+ * @param from The node to add the edge from.
27
+ * @param to The node to add the edge to.
28
+ */
29
+ addEdge(from: string, to: string): void;
30
+ /**
31
+ * Get the neighbors of a node.
32
+ * @param node The node to get the neighbors of.
33
+ */
34
+ getNeighbors(node: string): string[];
35
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The graph database connector interface.
3
+ * @category Connector
4
+ */
5
+ export interface IGraphDatabaseConnector {
6
+ /**
7
+ * Add a node to the database.
8
+ * @param node The node to add.
9
+ */
10
+ addNode(node: string): void;
11
+ /**
12
+ * Add an edge to the database.
13
+ * @param from The node to add the edge from.
14
+ * @param to The node to add the edge to.
15
+ */
16
+ addEdge(from: string, to: string): void;
17
+ /**
18
+ * Get the neighbors of a node.
19
+ * @param node The node to get the neighbors of.
20
+ */
21
+ getNeighbors(node: string): string[];
22
+ /**
23
+ * Get the size of the database
24
+ * @returns The size of the database.
25
+ */
26
+ getSize(): number;
27
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { IGraphDatabaseConnector } from './GraphDatabaseConnector';
2
+ /**
3
+ * The graph database connector constructor type.
4
+ * @category Graph Database
5
+ */
6
+ export type GraphDatabaseConnectorConstructor = new () => IGraphDatabaseConnector;
@@ -0,0 +1,3 @@
1
+ export * from './GraphDatabase';
2
+ export * from './GraphDatabaseConnector';
3
+ export * from './GraphDatabaseConnectorConstructor';
@@ -0,0 +1,3 @@
1
+ export * from './GraphDatabase';
2
+ export * from './GraphDatabaseConnector';
3
+ export * from './GraphDatabaseConnectorConstructor';
package/dist/index.d.ts CHANGED
@@ -5,3 +5,5 @@ export * from './object-storage';
5
5
  export * from './pubsub';
6
6
  export * from './job';
7
7
  export * from './ai';
8
+ export * from './vector-database';
9
+ export * from './graph-database';
package/dist/index.js CHANGED
@@ -5,3 +5,5 @@ export * from './object-storage';
5
5
  export * from './pubsub';
6
6
  export * from './job';
7
7
  export * from './ai';
8
+ export * from './vector-database';
9
+ export * from './graph-database';
package/dist/job/Job.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * Base IJobParameters Interface
3
3
  * Allows providing parameters specific to the job type.
4
- * @ignore
4
+ * @category Job
5
5
  */
6
6
  export interface IJobParameters {
7
7
  }
8
8
  /**
9
9
  * Job request Interface
10
10
  * Represents a job to be executed by the JobService.
11
- * @ignore
11
+ * @category Job
12
12
  */
13
13
  export interface IJobRequest<T extends IJobParameters> {
14
14
  /**
@@ -31,7 +31,7 @@ export interface IJobRequest<T extends IJobParameters> {
31
31
  /**
32
32
  * JobType Enum
33
33
  * Represents the type of a job.
34
- * @ignore
34
+ * @category Job
35
35
  */
36
36
  export declare enum JobType {
37
37
  /**
@@ -46,7 +46,7 @@ export declare enum JobType {
46
46
  /**
47
47
  * JobStatus Enum
48
48
  * Represents the status of a job.
49
- * @ignore
49
+ * @category Job
50
50
  */
51
51
  export declare enum JobStatus {
52
52
  /**
@@ -73,14 +73,14 @@ export declare enum JobStatus {
73
73
  /**
74
74
  * Base job result Interface
75
75
  * Represents the result of a job.
76
- * @ignore
76
+ * @category Job
77
77
  */
78
78
  export interface IJobResult {
79
79
  }
80
80
  /**
81
81
  * Job response Interface
82
82
  * Represents the response from a job.
83
- * @ignore
83
+ * @category Job
84
84
  */
85
85
  export interface IJobResultResponse<T extends IJobResult> {
86
86
  /**
@@ -99,7 +99,7 @@ export interface IJobResultResponse<T extends IJobResult> {
99
99
  /**
100
100
  * Job failed response Interface
101
101
  * Represents a failed job response.
102
- * @ignore
102
+ * @category Job
103
103
  */
104
104
  export interface IJobFailedResponse {
105
105
  /**
@@ -118,6 +118,6 @@ export interface IJobFailedResponse {
118
118
  /**
119
119
  * Job response type
120
120
  * Represents the response type from a job.
121
- * @ignore
121
+ * @category Job
122
122
  */
123
123
  export type JobResponse<T extends IJobResult> = IJobResultResponse<T> | IJobFailedResponse;
package/dist/job/Job.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * JobType Enum
3
3
  * Represents the type of a job.
4
- * @ignore
4
+ * @category Job
5
5
  */
6
6
  export var JobType;
7
7
  (function (JobType) {
@@ -17,7 +17,7 @@ export var JobType;
17
17
  /**
18
18
  * JobStatus Enum
19
19
  * Represents the status of a job.
20
- * @ignore
20
+ * @category Job
21
21
  */
22
22
  export var JobStatus;
23
23
  (function (JobStatus) {
@@ -3,7 +3,7 @@ import { IDataStream } from '../core/stream';
3
3
  import { IJobParameters, IJobRequest, IJobResult, JobResponse } from './Job';
4
4
  /**
5
5
  * The Job Dispatcher interface.
6
- * @ignore
6
+ * @category Job
7
7
  */
8
8
  export interface IJobDispatcher<T extends IJobParameters, U extends IJobResult> extends IDataStream {
9
9
  /**
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The Job Worker interface.
3
- * @ignore
3
+ * @category Job
4
4
  */
5
5
  export interface IJobWorker {
6
6
  /**
@@ -1,17 +1,23 @@
1
- import { IJobParameters, IJobRequest, IJobResult, JobResponse } from './Job';
1
+ import { IJobParameters, IJobResult } from './Job';
2
+ export interface IJobWorkerOptions {
3
+ }
2
4
  /**
3
5
  * The Job Worker Connector interface.
4
- * @ignore
6
+ * @category Connector
5
7
  */
6
8
  export interface IJobWorkerConnector<T extends IJobParameters, U extends IJobResult> {
7
9
  /**
8
10
  * Process a job.
9
- * @param job The job to process.
11
+ * @param parameters The job parameters.
12
+ * @param options The job options.
13
+ * @returns A promise that resolves with the job result.
10
14
  */
11
- processJob(job: IJobRequest<T>): Promise<JobResponse<U>>;
15
+ processJob(parameters: T, options?: IJobWorkerOptions): Promise<U>;
12
16
  /**
13
17
  * Process a job stream.
14
- * @param job The job to process.
18
+ * @param parameters The job parameters.
19
+ * @param options The job options.
20
+ * @returns An async generator that yields job results.
15
21
  */
16
- processJobStream(job: IJobRequest<T>): AsyncGenerator<JobResponse<U>>;
22
+ processJobStream(parameters: T, options?: IJobWorkerOptions): AsyncGenerator<U>;
17
23
  }
@@ -0,0 +1,9 @@
1
+ import { IFile } from './File';
2
+ export interface IDocumentParserConnector {
3
+ /**
4
+ * Parses a document.
5
+ * @param file The file to parse.
6
+ * @returns A promise that resolves with the parsed document.
7
+ */
8
+ parse(file: IFile): Promise<string>;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { IDocumentParserConnector } from './DocumentParserConnector';
2
+ export type DocumentParserConnectorConstructor = new () => IDocumentParserConnector;
@@ -7,4 +7,8 @@ export interface IFileOptions {
7
7
  * Specifies whether encryption should be skipped for the file.
8
8
  */
9
9
  skipEncryption?: boolean;
10
+ /**
11
+ * Specifies whether the file should be fetched from a URL.
12
+ */
13
+ fetchUrl?: string;
10
14
  }
@@ -1,4 +1,4 @@
1
- import { PayloadAction } from '.';
1
+ import { IFileOptions, PayloadAction } from '.';
2
2
  /**
3
3
  * The file payload interface.
4
4
  * @category Object Storage
@@ -19,5 +19,5 @@ export interface IFilePayload {
19
19
  /**
20
20
  * The flag to skip encryption.
21
21
  */
22
- skipEncryption?: boolean;
22
+ options?: IFileOptions;
23
23
  }
@@ -21,13 +21,15 @@ export interface IObjectStoreBucket extends IDataStream {
21
21
  close(): void;
22
22
  /**
23
23
  * Subscribe to the bucket events.
24
+ * @param label The label of the subscriber.
24
25
  * @param callback The callback function.
25
26
  */
26
- subscribe(callback: (data: StorageEvent) => void): void;
27
+ subscribe(label: string, callback: (data: StorageEvent) => void): void;
27
28
  /**
28
29
  * Unsubscribe from the bucket.
30
+ * @param label The label of the subscriber.
29
31
  */
30
- unsubscribe(): void;
32
+ unsubscribe(label: string): void;
31
33
  /**
32
34
  * Publish an action to the bucket.
33
35
  * @param payload The object store payload.
@@ -1,4 +1,6 @@
1
1
  export * from './event';
2
+ export { IDocumentParserConnector } from './DocumentParserConnector';
3
+ export { DocumentParserConnectorConstructor } from './DocumentParserConnectorConstructor';
2
4
  export { IFile } from './File';
3
5
  export { FileStatus } from './FileStatus';
4
6
  export { IFileDescriptor } from './FileDescriptor';
@@ -0,0 +1,41 @@
1
+ import { IDataStream } from '../core';
2
+ import { IVectorDatabaseSearchResult } from './VectorDatabaseSearchResult';
3
+ /**
4
+ * The interface for the vector database.
5
+ * @category Vector Database
6
+ */
7
+ export interface IVectorDatabase extends IDataStream {
8
+ /**
9
+ * Get the name of the database.
10
+ */
11
+ getName(): string;
12
+ /**
13
+ * Get the owner ID of the database.
14
+ */
15
+ getOwnerId(): string;
16
+ /**
17
+ * Close the database.
18
+ */
19
+ close(): void;
20
+ /**
21
+ * Search for the k nearest vectors.
22
+ * @param vector The vector to search for.
23
+ * @param k The number of nearest vectors to return.
24
+ * @param minRelevance The minimum relevance of the vectors.
25
+ * @param contentSize The size of the content to return (vector +/- contentSize, default 0).
26
+ * @returns An array of search results.
27
+ */
28
+ search(vector: number[], k: number, minRelevance?: number, contentSize?: number): IVectorDatabaseSearchResult[];
29
+ /**
30
+ * Insert vectors into the database.
31
+ * @param name The name of the content.
32
+ * @param content The content of the vectors.
33
+ * @param vectors The vectors to insert.
34
+ */
35
+ insert(name: string, content: string[], vectors: number[][]): void;
36
+ /**
37
+ * Remove vectors from the database.
38
+ * @param name The name of the content.
39
+ */
40
+ remove(name: string): void;
41
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,33 @@
1
+ import { IVectorDatabaseSearchResult } from './VectorDatabaseSearchResult';
2
+ /**
3
+ * The vector database connector interface.
4
+ * @category Connector
5
+ */
6
+ export interface IVectorDatabaseConnector {
7
+ /**
8
+ * Search for the k nearest vectors.
9
+ * @param vector The vector to search for.
10
+ * @param k The number of nearest vectors to return.
11
+ * @param minRelevance The minimum relevance of the vectors.
12
+ * @param contentSize The size of the content to return (vector +/- contentSize, default 0).
13
+ * @returns An array of search results.
14
+ */
15
+ search(vector: number[], k: number, minRelevance?: number, contentSize?: number): IVectorDatabaseSearchResult[];
16
+ /**
17
+ * Insert vectors into the database.
18
+ * @param name The name of the content.
19
+ * @param content The content of the vectors.
20
+ * @param vectors The vectors to insert.
21
+ */
22
+ insert(name: string, content: string[], vectors: number[][]): void;
23
+ /**
24
+ * Remove vectors from the database.
25
+ * @param name The name of the content.
26
+ */
27
+ remove(name: string): void;
28
+ /**
29
+ * Get the content of the database.
30
+ * @returns The content of the database.
31
+ */
32
+ getBuffer(): ArrayBuffer;
33
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { IVectorDatabaseConnector } from '.';
2
2
  /**
3
3
  * The vector database connector constructor type.
4
- * @category AI
4
+ * @category Vector Database
5
5
  */
6
6
  export type VectorDatabaseConnectorConstructor = new () => IVectorDatabaseConnector;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Represents a search result from the vector database.
3
+ * @category Vector Database
4
+ */
5
+ export interface IVectorDatabaseSearchResult {
6
+ /**
7
+ * The content of the search result.
8
+ */
9
+ content: string;
10
+ /**
11
+ * The relevance of the search result.
12
+ * The relevance is a number between 0 and 1, where 1 is the most relevant.
13
+ */
14
+ relevance: number;
15
+ /**
16
+ * The path name of the document containing the search result.
17
+ */
18
+ pathName: string;
19
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './VectorDatabase';
2
+ export * from './VectorDatabaseConnector';
3
+ export * from './VectorDatabaseConnectorConstructor';
4
+ export * from './VectorDatabaseSearchResult';
@@ -0,0 +1,4 @@
1
+ export * from './VectorDatabase';
2
+ export * from './VectorDatabaseConnector';
3
+ export * from './VectorDatabaseConnectorConstructor';
4
+ export * from './VectorDatabaseSearchResult';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewdle/web-sdk-types",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "The Crewdle Mist Web SDK public types and interfaces",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,14 +0,0 @@
1
- /**
2
- * Represents the types of generative AI models.
3
- * @category AI
4
- */
5
- export declare enum GenerativeAIModelType {
6
- /**
7
- * The main model to run with the inference engine.
8
- */
9
- Main = "main",
10
- /**
11
- * The simalirity model to run to build the vector database.
12
- */
13
- Similarity = "similarity"
14
- }
@@ -1,15 +0,0 @@
1
- /**
2
- * Represents the types of generative AI models.
3
- * @category AI
4
- */
5
- export var GenerativeAIModelType;
6
- (function (GenerativeAIModelType) {
7
- /**
8
- * The main model to run with the inference engine.
9
- */
10
- GenerativeAIModelType["Main"] = "main";
11
- /**
12
- * The simalirity model to run to build the vector database.
13
- */
14
- GenerativeAIModelType["Similarity"] = "similarity";
15
- })(GenerativeAIModelType || (GenerativeAIModelType = {}));
@@ -1,25 +0,0 @@
1
- /**
2
- * The vector database connector interface.
3
- * @category Connector
4
- */
5
- export interface IVectorDatabaseConnector {
6
- /**
7
- * Search for the k nearest vectors.
8
- * @param vector The vector to search for.
9
- * @param k The number of nearest vectors to return.
10
- * @param minRelevance The minimum relevance of the vectors.
11
- * @param startingIndex The starting index of the vectors.
12
- * @returns The labels of the k nearest vectors.
13
- */
14
- search(vector: number[], k: number, minRelevance?: number, startingIndex?: number): number[];
15
- /**
16
- * Insert vectors into the database.
17
- * @param vectors The vectors to insert.
18
- */
19
- insert(vectors: number[][]): void;
20
- /**
21
- * Remove vectors from the database.
22
- * @param ids The IDs of the vectors to remove.
23
- */
24
- remove(ids: number[]): void;
25
- }