@crewdle/web-sdk-types 1.0.17 → 1.0.19
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.
- package/dist/ai/GenerativeAI.d.ts +14 -25
- package/dist/ai/GenerativeAIContext.d.ts +3 -11
- package/dist/ai/GenerativeAIWorkerConnector.d.ts +45 -18
- package/dist/ai/GenerativeAIWorkerConnector.js +17 -1
- package/dist/ai/GenerativeAIWorkerConnectorConstructor.d.ts +2 -2
- package/dist/ai/NLPLibraryConnector.d.ts +14 -0
- package/dist/ai/NLPLibraryConnectorConstructor.d.ts +2 -0
- package/dist/ai/index.d.ts +2 -3
- package/dist/ai/index.js +2 -3
- package/dist/core/cluster/Cluster.d.ts +25 -1
- package/dist/core/sdk/SDK.d.ts +3 -1
- package/dist/core/sdk/SDKCloseOptions.d.ts +9 -0
- package/dist/core/sdk/SDKCloseOptions.js +1 -0
- package/dist/core/sdk/SDKOptions.d.ts +16 -2
- package/dist/core/sdk/index.d.ts +1 -0
- package/dist/core/stream/ContentType.d.ts +9 -1
- package/dist/core/stream/ContentType.js +8 -0
- package/dist/graph-database/GraphDatabase.d.ts +35 -0
- package/dist/graph-database/GraphDatabase.js +1 -0
- package/dist/graph-database/GraphDatabaseConnector.d.ts +27 -0
- package/dist/graph-database/GraphDatabaseConnector.js +1 -0
- package/dist/graph-database/GraphDatabaseConnectorConstructor.d.ts +6 -0
- package/dist/graph-database/GraphDatabaseConnectorConstructor.js +1 -0
- package/dist/graph-database/index.d.ts +3 -0
- package/dist/graph-database/index.js +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/job/Job.d.ts +8 -8
- package/dist/job/Job.js +2 -2
- package/dist/job/JobDispatcher.d.ts +1 -1
- package/dist/job/JobWorker.d.ts +1 -1
- package/dist/job/JobWorkerConnector.d.ts +12 -6
- package/dist/object-storage/DocumentParserConnector.d.ts +20 -0
- package/dist/object-storage/DocumentParserConnector.js +1 -0
- package/dist/object-storage/DocumentParserConnectorConstructor.d.ts +2 -0
- package/dist/object-storage/DocumentParserConnectorConstructor.js +1 -0
- package/dist/object-storage/FileOptions.d.ts +4 -0
- package/dist/object-storage/FilePayload.d.ts +2 -2
- package/dist/object-storage/ObjectStoreBucket.d.ts +4 -2
- package/dist/object-storage/index.d.ts +2 -0
- package/dist/vector-database/VectorDatabase.d.ts +41 -0
- package/dist/vector-database/VectorDatabase.js +1 -0
- package/dist/vector-database/VectorDatabaseConnector.d.ts +33 -0
- package/dist/vector-database/VectorDatabaseConnector.js +1 -0
- package/dist/{ai → vector-database}/VectorDatabaseConnectorConstructor.d.ts +1 -1
- package/dist/vector-database/VectorDatabaseConnectorConstructor.js +1 -0
- package/dist/vector-database/VectorDatabaseSearchResult.d.ts +19 -0
- package/dist/vector-database/VectorDatabaseSearchResult.js +1 -0
- package/dist/vector-database/index.d.ts +4 -0
- package/dist/vector-database/index.js +4 -0
- package/package.json +1 -1
- package/dist/ai/GenerativeAIModelType.d.ts +0 -14
- package/dist/ai/GenerativeAIModelType.js +0 -15
- package/dist/ai/VectorDatabaseConnector.d.ts +0 -25
- /package/dist/ai/{VectorDatabaseConnector.js → NLPLibraryConnector.js} +0 -0
- /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
|
|
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
|
-
*
|
|
24
|
-
* @
|
|
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
|
-
|
|
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 {
|
|
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
|
|
11
|
-
* @param
|
|
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(
|
|
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
|
-
*
|
|
24
|
-
* @
|
|
48
|
+
* Close the machine learning model.
|
|
49
|
+
* @returns A promise that resolves when the model has been closed.
|
|
25
50
|
*/
|
|
26
|
-
|
|
51
|
+
close(): Promise<void>;
|
|
27
52
|
/**
|
|
28
53
|
* Process a job.
|
|
29
|
-
* @param
|
|
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(
|
|
58
|
+
processJob(parameters: IJobParametersAI, options?: IGenerativeAIWorkerOptions): Promise<IJobResultAI>;
|
|
33
59
|
/**
|
|
34
60
|
* Stream a job.
|
|
35
|
-
* @param
|
|
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(
|
|
65
|
+
processJobStream(parameters: IJobParametersAI, options?: IGenerativeAIWorkerOptions): AsyncGenerator<IJobResultAI>;
|
|
39
66
|
}
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
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
|
|
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 (
|
|
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
|
+
}
|
package/dist/ai/index.d.ts
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 './
|
|
8
|
-
export * from './
|
|
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 './
|
|
8
|
-
export * from './
|
|
6
|
+
export * from './NLPLibraryConnector';
|
|
7
|
+
export * from './NLPLibraryConnectorConstructor';
|
|
@@ -1,10 +1,13 @@
|
|
|
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';
|
|
10
|
+
import { ISDKCloseOptions } from '../sdk';
|
|
8
11
|
/**
|
|
9
12
|
* The cluster interface.
|
|
10
13
|
* @category Core
|
|
@@ -12,8 +15,9 @@ import { LocalNode, Node } from '../node';
|
|
|
12
15
|
export interface ICluster extends IClusterEventEmitter {
|
|
13
16
|
/**
|
|
14
17
|
* Leave the cluster.
|
|
18
|
+
* @param options The options to close the SDK with.
|
|
15
19
|
*/
|
|
16
|
-
leave(): void;
|
|
20
|
+
leave(options?: ISDKCloseOptions): void;
|
|
17
21
|
/**
|
|
18
22
|
* Open a pub/sub topic.
|
|
19
23
|
* @param name The name of the PubSub Topic.
|
|
@@ -51,6 +55,16 @@ export interface ICluster extends IClusterEventEmitter {
|
|
|
51
55
|
* @param label The label of the generative AI Worker.
|
|
52
56
|
*/
|
|
53
57
|
openGenerativeAIWorker(label: string): Promise<IGenerativeAIWorker>;
|
|
58
|
+
/**
|
|
59
|
+
* Open a vector database.
|
|
60
|
+
* @param label The label of the vector database.
|
|
61
|
+
*/
|
|
62
|
+
openVectorDatabase(label: string): IVectorDatabase;
|
|
63
|
+
/**
|
|
64
|
+
* Open a graph database.
|
|
65
|
+
* @param label The label of the graph database.
|
|
66
|
+
*/
|
|
67
|
+
openGraphDatabase(label: string): IGraphDatabase;
|
|
54
68
|
/**
|
|
55
69
|
* Publish a local media stream.
|
|
56
70
|
* @param label The label of the media stream.
|
|
@@ -102,6 +116,16 @@ export interface ICluster extends IClusterEventEmitter {
|
|
|
102
116
|
* @param strategy The strategy to use to filter the media streams.
|
|
103
117
|
*/
|
|
104
118
|
getRemoteMediaStreams(strategy?: (item: IRemoteMediaStream) => boolean): IRemoteMediaStream[];
|
|
119
|
+
/**
|
|
120
|
+
* Get an array of opened vector databases.
|
|
121
|
+
* @param strategy The strategy to use to filter the vector databases.
|
|
122
|
+
*/
|
|
123
|
+
getVectorDatabases(strategy?: (item: IVectorDatabase) => boolean): IVectorDatabase[];
|
|
124
|
+
/**
|
|
125
|
+
* Get an array of opened graph databases.
|
|
126
|
+
* @param strategy The strategy to use to filter the graph databases.
|
|
127
|
+
*/
|
|
128
|
+
getGraphDatabases(strategy?: (item: IGraphDatabase) => boolean): IGraphDatabase[];
|
|
105
129
|
/**
|
|
106
130
|
* Get the local node for this cluster.
|
|
107
131
|
*/
|
package/dist/core/sdk/SDK.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ICluster } from '../cluster';
|
|
2
2
|
import { IAgentCredentials, IAuthAgent } from '../node/agent';
|
|
3
3
|
import { IAuthUser, IUserCredentials } from '../node/user';
|
|
4
|
+
import { ISDKCloseOptions } from './SDKCloseOptions';
|
|
4
5
|
/**
|
|
5
6
|
* The SDK interface.
|
|
6
7
|
* @category Core
|
|
@@ -8,8 +9,9 @@ import { IAuthUser, IUserCredentials } from '../node/user';
|
|
|
8
9
|
export interface ISDK {
|
|
9
10
|
/**
|
|
10
11
|
* Close the SDK.
|
|
12
|
+
* @param options The options to close the SDK with.
|
|
11
13
|
*/
|
|
12
|
-
close(): Promise<void>;
|
|
14
|
+
close(options?: ISDKCloseOptions): Promise<void>;
|
|
13
15
|
/**
|
|
14
16
|
* Authenticate a user.
|
|
15
17
|
* @param credentials The credentials to authenticate the user with.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,
|
|
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
|
*/
|
package/dist/core/sdk/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { ILoggingConnector } from './LoggingConnector';
|
|
2
2
|
export { LoggingConnectorEvent } from './LoggingConnectorEvent';
|
|
3
3
|
export { ISDK } from './SDK';
|
|
4
|
+
export { ISDKCloseOptions } from './SDKCloseOptions';
|
|
4
5
|
export { ISDKOptions } from './SDKOptions';
|
|
5
6
|
export { Unsubscribe } from './Unsubscribe';
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
6
|
+
* @category Job
|
|
7
7
|
*/
|
|
8
8
|
export interface IJobDispatcher<T extends IJobParameters, U extends IJobResult> extends IDataStream {
|
|
9
9
|
/**
|
package/dist/job/JobWorker.d.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import { IJobParameters,
|
|
1
|
+
import { IJobParameters, IJobResult } from './Job';
|
|
2
|
+
export interface IJobWorkerOptions {
|
|
3
|
+
}
|
|
2
4
|
/**
|
|
3
5
|
* The Job Worker Connector interface.
|
|
4
|
-
* @
|
|
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
|
|
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(
|
|
15
|
+
processJob(parameters: T, options?: IJobWorkerOptions): Promise<U>;
|
|
12
16
|
/**
|
|
13
17
|
* Process a job stream.
|
|
14
|
-
* @param
|
|
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(
|
|
22
|
+
processJobStream(parameters: T, options?: IJobWorkerOptions): AsyncGenerator<U>;
|
|
17
23
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* Get the supported file types.
|
|
11
|
+
* @returns The supported file types.
|
|
12
|
+
*/
|
|
13
|
+
getSupportedFileTypes(): string[];
|
|
14
|
+
/**
|
|
15
|
+
* Check if the connector supports a file.
|
|
16
|
+
* @param file The file to check.
|
|
17
|
+
* @returns Whether the connector supports the file.
|
|
18
|
+
*/
|
|
19
|
+
supports(file: IFile): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
-
|
|
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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 {};
|
package/package.json
CHANGED
|
@@ -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
|
-
}
|
|
File without changes
|
/package/dist/ai/{VectorDatabaseConnectorConstructor.js → NLPLibraryConnectorConstructor.js}
RENAMED
|
File without changes
|