@crewdle/web-sdk-types 1.0.16 → 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.
- package/dist/ai/GenerativeAI.d.ts +20 -30
- package/dist/ai/GenerativeAI.js +1 -0
- package/dist/ai/GenerativeAIContext.d.ts +7 -0
- 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 -2
- package/dist/ai/index.js +2 -2
- package/dist/core/cluster/Cluster.d.ts +23 -1
- package/dist/core/sdk/SDKOptions.d.ts +16 -2
- 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 +9 -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/File.d.ts +43 -0
- package/dist/object-storage/File.js +1 -0
- package/dist/object-storage/FileOptions.d.ts +14 -0
- package/dist/object-storage/FileOptions.js +1 -0
- package/dist/object-storage/FilePayload.d.ts +2 -2
- package/dist/object-storage/FileStatus.d.ts +1 -0
- package/dist/object-storage/FileStatus.js +1 -0
- package/dist/object-storage/ObjectStoreBucket.d.ts +7 -4
- package/dist/object-storage/ObjectStoreConnector.d.ts +13 -5
- package/dist/object-storage/ReadableStream.d.ts +16 -0
- package/dist/object-storage/ReadableStream.js +1 -0
- package/dist/object-storage/WritableStream.d.ts +15 -0
- package/dist/object-storage/WritableStream.js +1 -0
- package/dist/object-storage/event/SyncCompleteEvent.d.ts +4 -0
- package/dist/object-storage/index.d.ts +6 -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/VectorDatabaseConnector.d.ts +0 -25
- /package/dist/ai/{VectorDatabaseConnector.js → NLPLibraryConnector.js} +0 -0
- /package/dist/ai/{VectorDatabaseConnectorConstructor.js → NLPLibraryConnectorConstructor.js} +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { IVectorDatabaseSearchResult } from '../vector-database';
|
|
1
2
|
import { IJobParameters, IJobResult } from '../job';
|
|
2
3
|
/**
|
|
3
4
|
* The AI prompt source Enum
|
|
5
|
+
* @category AI
|
|
4
6
|
*/
|
|
5
7
|
export declare enum PromptSource {
|
|
6
8
|
/**
|
|
@@ -15,7 +17,7 @@ export declare enum PromptSource {
|
|
|
15
17
|
/**
|
|
16
18
|
* The AI prompt history Interface
|
|
17
19
|
* Represents the history of a prompt.
|
|
18
|
-
* @
|
|
20
|
+
* @category AI
|
|
19
21
|
*/
|
|
20
22
|
export interface IPromptHistory {
|
|
21
23
|
/**
|
|
@@ -30,17 +32,13 @@ export interface IPromptHistory {
|
|
|
30
32
|
/**
|
|
31
33
|
* The AI prompt options Interface
|
|
32
34
|
* Represents the options for an AI prompt.
|
|
33
|
-
* @
|
|
35
|
+
* @category AI
|
|
34
36
|
*/
|
|
35
37
|
export interface IPromptOptions {
|
|
36
38
|
/**
|
|
37
39
|
* The instructions for the AI job.
|
|
38
40
|
*/
|
|
39
41
|
instructions?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Whether to use RAG for the AI job.
|
|
42
|
-
*/
|
|
43
|
-
useRAG?: boolean;
|
|
44
42
|
/**
|
|
45
43
|
* The context for the AI job.
|
|
46
44
|
*/
|
|
@@ -53,33 +51,29 @@ export interface IPromptOptions {
|
|
|
53
51
|
* The temperature for the LLM.
|
|
54
52
|
*/
|
|
55
53
|
temperature?: number;
|
|
56
|
-
/**
|
|
57
|
-
* The maximum number of contents to include in the context.
|
|
58
|
-
*/
|
|
59
|
-
maxContents?: number;
|
|
60
|
-
/**
|
|
61
|
-
* The number of chunks to include in one content.
|
|
62
|
-
*/
|
|
63
|
-
maxChunks?: number;
|
|
64
|
-
/**
|
|
65
|
-
* The starting index of the RAG for search.
|
|
66
|
-
*/
|
|
67
|
-
ragStartingIndex?: number;
|
|
68
|
-
/**
|
|
69
|
-
* The minimum relevance of the RAG contents.
|
|
70
|
-
*/
|
|
71
|
-
minRelevance?: number;
|
|
72
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[];
|
|
73
63
|
/**
|
|
74
64
|
* The AI prompt result Interface
|
|
75
65
|
* Represents the result of an AI prompt.
|
|
76
|
-
* @
|
|
66
|
+
* @category AI
|
|
77
67
|
*/
|
|
78
68
|
export interface IPromptResult {
|
|
79
69
|
/**
|
|
80
70
|
* The output of the AI job.
|
|
81
71
|
*/
|
|
82
|
-
output
|
|
72
|
+
output?: PromptTypeText | PromptTypeVector;
|
|
73
|
+
/**
|
|
74
|
+
* The relevant context used by the AI job.
|
|
75
|
+
*/
|
|
76
|
+
context?: IVectorDatabaseSearchResult[];
|
|
83
77
|
/**
|
|
84
78
|
* The tokens used by the AI job.
|
|
85
79
|
*/
|
|
@@ -88,15 +82,11 @@ export interface IPromptResult {
|
|
|
88
82
|
* The tokens generated by the AI job.
|
|
89
83
|
*/
|
|
90
84
|
outputTokens?: number;
|
|
91
|
-
/**
|
|
92
|
-
* The number of contents in the RAG.
|
|
93
|
-
*/
|
|
94
|
-
contentSize?: number;
|
|
95
85
|
}
|
|
96
86
|
/**
|
|
97
87
|
* The AI job parameters Interface
|
|
98
88
|
* Parameters for AI job type.
|
|
99
|
-
* @
|
|
89
|
+
* @category AI
|
|
100
90
|
*/
|
|
101
91
|
export interface IJobParametersAI extends IJobParameters, IPromptOptions {
|
|
102
92
|
/**
|
|
@@ -107,7 +97,7 @@ export interface IJobParametersAI extends IJobParameters, IPromptOptions {
|
|
|
107
97
|
/**
|
|
108
98
|
* The AI job result Interface
|
|
109
99
|
* Represents the result of an AI job.
|
|
110
|
-
* @
|
|
100
|
+
* @category AI
|
|
111
101
|
*/
|
|
112
102
|
export interface IJobResultAI extends IJobResult, IPromptResult {
|
|
113
103
|
/**
|
package/dist/ai/GenerativeAI.js
CHANGED
|
@@ -7,15 +7,22 @@ export interface IGenerativeAIContext {
|
|
|
7
7
|
/**
|
|
8
8
|
* Stream the response from the AI service.
|
|
9
9
|
* @param prompt The prompt to start processing.
|
|
10
|
+
* @param options Optional parameters for the prompt.
|
|
10
11
|
* @returns An async generator that yields the response.
|
|
11
12
|
*/
|
|
12
13
|
stream(prompt: string, options?: IPromptOptions): AsyncGenerator<IPromptResult>;
|
|
13
14
|
/**
|
|
14
15
|
* Process the response from the AI service.
|
|
15
16
|
* @param prompt The prompt to start processing.
|
|
17
|
+
* @param options Optional parameters for the prompt.
|
|
16
18
|
* @returns A promise that resolves with the response.
|
|
17
19
|
*/
|
|
18
20
|
prompt(prompt: string, options?: IPromptOptions): Promise<IPromptResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Get the data bucket IDs.
|
|
23
|
+
* @returns An array of data bucket IDs.
|
|
24
|
+
*/
|
|
25
|
+
getDataBucketIds(): Promise<string[]>;
|
|
19
26
|
/**
|
|
20
27
|
* Close the Generative AI Context.
|
|
21
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
|
@@ -3,5 +3,5 @@ export * from './GenerativeAIContext';
|
|
|
3
3
|
export * from './GenerativeAIWorker';
|
|
4
4
|
export * from './GenerativeAIWorkerConnector';
|
|
5
5
|
export * from './GenerativeAIWorkerConnectorConstructor';
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
6
|
+
export * from './NLPLibraryConnector';
|
|
7
|
+
export * from './NLPLibraryConnectorConstructor';
|
package/dist/ai/index.js
CHANGED
|
@@ -3,5 +3,5 @@ export * from './GenerativeAIContext';
|
|
|
3
3
|
export * from './GenerativeAIWorker';
|
|
4
4
|
export * from './GenerativeAIWorkerConnector';
|
|
5
5
|
export * from './GenerativeAIWorkerConnectorConstructor';
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
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.
|
|
@@ -25,7 +27,7 @@ export interface ICluster extends IClusterEventEmitter {
|
|
|
25
27
|
/**
|
|
26
28
|
* Open a object store bucket.
|
|
27
29
|
* @param name The name of the Object Store bucket.
|
|
28
|
-
* @param
|
|
30
|
+
* @param options The {@link IObjectStoreBucketOptions | options} of the Object Store bucket.
|
|
29
31
|
* @throws {@link SDKClientErrorCodes.ObjectStoreAlreadyExists} if the data stream is already open.
|
|
30
32
|
* @throws {@link SDKClientErrorCodes.ObjectStoreNameNotString} if the name is not a string.
|
|
31
33
|
* @returns A promise that resolves with the data stream.
|
|
@@ -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,
|
|
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
|
*/
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { IReadableStream } from './ReadableStream';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a file in the object storage.
|
|
4
|
+
* @category Object Storage
|
|
5
|
+
*/
|
|
6
|
+
export interface IFile {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the file.
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* The size of the file in bytes.
|
|
13
|
+
*/
|
|
14
|
+
size: number;
|
|
15
|
+
/**
|
|
16
|
+
* The MIME type of the file.
|
|
17
|
+
*/
|
|
18
|
+
type: string;
|
|
19
|
+
/**
|
|
20
|
+
* The last modified timestamp of the file.
|
|
21
|
+
*/
|
|
22
|
+
lastModified: number;
|
|
23
|
+
/**
|
|
24
|
+
* Returns a promise that resolves to an ArrayBuffer containing the file's data.
|
|
25
|
+
*/
|
|
26
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
27
|
+
/**
|
|
28
|
+
* Returns a promise that resolves to a string containing the file's data.
|
|
29
|
+
*/
|
|
30
|
+
text(): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Returns a readable stream for streaming the file's data.
|
|
33
|
+
*/
|
|
34
|
+
stream(): IReadableStream;
|
|
35
|
+
/**
|
|
36
|
+
* Returns a new Blob object that contains a subset of the file's data.
|
|
37
|
+
* @param start - The start position (inclusive) of the subset. Defaults to 0.
|
|
38
|
+
* @param end - The end position (exclusive) of the subset. Defaults to the end of the file.
|
|
39
|
+
* @param contentType - The MIME type of the subset. Defaults to the original file's type.
|
|
40
|
+
* @returns A Blob object representing the subset of the file's data.
|
|
41
|
+
*/
|
|
42
|
+
slice(start?: number, end?: number, contentType?: string): Blob;
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the options for reading or writing a file.
|
|
3
|
+
* @category Object Storage
|
|
4
|
+
*/
|
|
5
|
+
export interface IFileOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Specifies whether encryption should be skipped for the file.
|
|
8
|
+
*/
|
|
9
|
+
skipEncryption?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Specifies whether the file should be fetched from a URL.
|
|
12
|
+
*/
|
|
13
|
+
fetchUrl?: string;
|
|
14
|
+
}
|
|
@@ -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
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDataStream } from '../core/stream';
|
|
2
|
-
import { ObjectDescriptor, Payload } from '.';
|
|
2
|
+
import { IFile, IFileOptions, ObjectDescriptor, Payload } from '.';
|
|
3
3
|
import { StorageEvent } from './event';
|
|
4
4
|
import { IObjectStoreListOptions } from './ObjectStoreListOptions';
|
|
5
5
|
/**
|
|
@@ -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.
|
|
@@ -43,9 +45,10 @@ export interface IObjectStoreBucket extends IDataStream {
|
|
|
43
45
|
/**
|
|
44
46
|
* Get an object from the bucket.
|
|
45
47
|
* @param path The path of the object.
|
|
48
|
+
* @param options The optional options for getting the object.
|
|
46
49
|
* @returns The object.
|
|
47
50
|
*/
|
|
48
|
-
get(path: string): Promise<
|
|
51
|
+
get(path: string, options?: IFileOptions): Promise<IFile>;
|
|
49
52
|
/**
|
|
50
53
|
* List the objects and folders of the bucket.
|
|
51
54
|
* @param path The path of the folder.
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { IFileDescriptor, IFolderDescriptor, ObjectDescriptor, ObjectKind } from '.';
|
|
1
|
+
import { IFileDescriptor, IFolderDescriptor, IWritableStream, ObjectDescriptor, ObjectKind, IFileOptions, IFile } from '.';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Represents a connector for interacting with an object store.
|
|
4
4
|
* @category Connector
|
|
5
5
|
*/
|
|
6
6
|
export interface IObjectStoreConnector {
|
|
7
7
|
/**
|
|
8
8
|
* Gets a file.
|
|
9
9
|
* @param path The path to the file.
|
|
10
|
+
* @param options The options for writing the file.
|
|
10
11
|
* @returns A promise that resolves with the file.
|
|
11
12
|
*/
|
|
12
|
-
get(path: string): Promise<
|
|
13
|
+
get(path: string, options?: IFileOptions): Promise<IFile>;
|
|
13
14
|
/**
|
|
14
15
|
* Lists the objects in a folder.
|
|
15
16
|
* @param path The path to the folder.
|
|
@@ -27,10 +28,17 @@ export interface IObjectStoreConnector {
|
|
|
27
28
|
* Writes a file.
|
|
28
29
|
* @param file The file to write.
|
|
29
30
|
* @param path The path to write the file to.
|
|
30
|
-
* @param
|
|
31
|
+
* @param options The options for writing the file.
|
|
31
32
|
* @returns A promise that resolves with the file descriptor.
|
|
32
33
|
*/
|
|
33
|
-
writeFile(file: File, path?: string,
|
|
34
|
+
writeFile(file: File, path?: string, options?: IFileOptions): Promise<IFileDescriptor>;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a writable stream for a file.
|
|
37
|
+
* @param path The path to the file.
|
|
38
|
+
* @param options The options for creating the writable stream.
|
|
39
|
+
* @returns A promise that resolves with an {@link IWritableStream}.
|
|
40
|
+
*/
|
|
41
|
+
createWritableStream(path: string, options?: IFileOptions): Promise<IWritableStream>;
|
|
34
42
|
/**
|
|
35
43
|
* Moves an object.
|
|
36
44
|
* @param path The path to the object.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a readable stream that provides a way to read data asynchronously.
|
|
3
|
+
* @category Object Storage
|
|
4
|
+
*/
|
|
5
|
+
export interface IReadableStream {
|
|
6
|
+
/**
|
|
7
|
+
* Reads the next chunk of data from the stream.
|
|
8
|
+
* @returns A promise that resolves to a Uint8Array containing the data read from the stream, or null if the end of the stream has been reached.
|
|
9
|
+
*/
|
|
10
|
+
read(): Promise<Uint8Array | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Closes the stream and releases any resources associated with it.
|
|
13
|
+
* @returns A promise that resolves when the stream is successfully closed.
|
|
14
|
+
*/
|
|
15
|
+
close(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a writable stream.
|
|
3
|
+
* @category Object Storage
|
|
4
|
+
*/
|
|
5
|
+
export interface IWritableStream {
|
|
6
|
+
/**
|
|
7
|
+
* Writes data to the stream.
|
|
8
|
+
* @param chunk The data to write as an ArrayBuffer.
|
|
9
|
+
*/
|
|
10
|
+
write(chunk: ArrayBuffer): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Closes the stream.
|
|
13
|
+
*/
|
|
14
|
+
close(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export * from './event';
|
|
2
|
+
export { IDocumentParserConnector } from './DocumentParserConnector';
|
|
3
|
+
export { DocumentParserConnectorConstructor } from './DocumentParserConnectorConstructor';
|
|
4
|
+
export { IFile } from './File';
|
|
2
5
|
export { FileStatus } from './FileStatus';
|
|
3
6
|
export { IFileDescriptor } from './FileDescriptor';
|
|
4
7
|
export { IFilePayload } from './FilePayload';
|
|
8
|
+
export { IFileOptions } from './FileOptions';
|
|
5
9
|
export { IFolderDescriptor } from './FolderDescriptor';
|
|
6
10
|
export { IFolderPayload } from './FolderPayload';
|
|
7
11
|
export { IMovePayload } from './MovePayload';
|
|
@@ -14,3 +18,5 @@ export { IObjectStoreListOptions } from './ObjectStoreListOptions';
|
|
|
14
18
|
export { ObjectStoreConnectorConstructor } from './ObjectStoreConnectorConstructor';
|
|
15
19
|
export { Payload } from './Payload';
|
|
16
20
|
export { PayloadAction } from './PayloadAction';
|
|
21
|
+
export { IReadableStream } from './ReadableStream';
|
|
22
|
+
export { IWritableStream } from './WritableStream';
|
|
@@ -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,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
|