@crewdle/web-sdk-types 1.0.15 → 1.0.17
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 +50 -21
- package/dist/ai/GenerativeAI.js +1 -0
- package/dist/ai/GenerativeAIContext.d.ts +18 -3
- package/dist/ai/GenerativeAIModelType.d.ts +14 -0
- package/dist/ai/GenerativeAIModelType.js +15 -0
- package/dist/ai/VectorDatabaseConnector.d.ts +4 -1
- package/dist/ai/index.d.ts +1 -0
- package/dist/ai/index.js +1 -0
- package/dist/core/cluster/Cluster.d.ts +1 -1
- package/dist/object-storage/File.d.ts +43 -0
- package/dist/object-storage/File.js +1 -0
- package/dist/object-storage/FileOptions.d.ts +10 -0
- package/dist/object-storage/FileOptions.js +1 -0
- package/dist/object-storage/FileStatus.d.ts +1 -0
- package/dist/object-storage/FileStatus.js +1 -0
- package/dist/object-storage/ObjectStoreBucket.d.ts +3 -2
- 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 +4 -0
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IJobParameters, IJobResult } from '../job';
|
|
2
2
|
/**
|
|
3
3
|
* The AI prompt source Enum
|
|
4
|
+
* @category AI
|
|
4
5
|
*/
|
|
5
6
|
export declare enum PromptSource {
|
|
6
7
|
/**
|
|
@@ -15,7 +16,7 @@ export declare enum PromptSource {
|
|
|
15
16
|
/**
|
|
16
17
|
* The AI prompt history Interface
|
|
17
18
|
* Represents the history of a prompt.
|
|
18
|
-
* @
|
|
19
|
+
* @category AI
|
|
19
20
|
*/
|
|
20
21
|
export interface IPromptHistory {
|
|
21
22
|
/**
|
|
@@ -27,6 +28,11 @@ export interface IPromptHistory {
|
|
|
27
28
|
*/
|
|
28
29
|
message: string;
|
|
29
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* The AI prompt options Interface
|
|
33
|
+
* Represents the options for an AI prompt.
|
|
34
|
+
* @category AI
|
|
35
|
+
*/
|
|
30
36
|
export interface IPromptOptions {
|
|
31
37
|
/**
|
|
32
38
|
* The instructions for the AI job.
|
|
@@ -39,37 +45,38 @@ export interface IPromptOptions {
|
|
|
39
45
|
/**
|
|
40
46
|
* The context for the AI job.
|
|
41
47
|
*/
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* The AI job parameters Interface
|
|
46
|
-
* Parameters for AI job type.
|
|
47
|
-
* @ignore
|
|
48
|
-
*/
|
|
49
|
-
export interface IJobParametersAI extends IJobParameters {
|
|
48
|
+
history?: IPromptHistory[];
|
|
50
49
|
/**
|
|
51
|
-
* The
|
|
50
|
+
* The maximum number of tokens to generate.
|
|
52
51
|
*/
|
|
53
|
-
|
|
52
|
+
maxTokens?: number;
|
|
54
53
|
/**
|
|
55
|
-
* The
|
|
54
|
+
* The temperature for the LLM.
|
|
56
55
|
*/
|
|
57
|
-
|
|
56
|
+
temperature?: number;
|
|
58
57
|
/**
|
|
59
|
-
*
|
|
58
|
+
* The maximum number of contents to include in the context.
|
|
60
59
|
*/
|
|
61
|
-
|
|
60
|
+
maxContents?: number;
|
|
62
61
|
/**
|
|
63
|
-
* The
|
|
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.
|
|
64
71
|
*/
|
|
65
|
-
|
|
72
|
+
minRelevance?: number;
|
|
66
73
|
}
|
|
67
74
|
/**
|
|
68
|
-
* The AI
|
|
69
|
-
* Represents the result of an AI
|
|
70
|
-
* @
|
|
75
|
+
* The AI prompt result Interface
|
|
76
|
+
* Represents the result of an AI prompt.
|
|
77
|
+
* @category AI
|
|
71
78
|
*/
|
|
72
|
-
export interface
|
|
79
|
+
export interface IPromptResult {
|
|
73
80
|
/**
|
|
74
81
|
* The output of the AI job.
|
|
75
82
|
*/
|
|
@@ -82,6 +89,28 @@ export interface IJobResultAI extends IJobResult {
|
|
|
82
89
|
* The tokens generated by the AI job.
|
|
83
90
|
*/
|
|
84
91
|
outputTokens?: number;
|
|
92
|
+
/**
|
|
93
|
+
* The number of contents in the RAG.
|
|
94
|
+
*/
|
|
95
|
+
contentSize?: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The AI job parameters Interface
|
|
99
|
+
* Parameters for AI job type.
|
|
100
|
+
* @category AI
|
|
101
|
+
*/
|
|
102
|
+
export interface IJobParametersAI extends IJobParameters, IPromptOptions {
|
|
103
|
+
/**
|
|
104
|
+
* The prompt for the AI job.
|
|
105
|
+
*/
|
|
106
|
+
prompt: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The AI job result Interface
|
|
110
|
+
* Represents the result of an AI job.
|
|
111
|
+
* @category AI
|
|
112
|
+
*/
|
|
113
|
+
export interface IJobResultAI extends IJobResult, IPromptResult {
|
|
85
114
|
/**
|
|
86
115
|
* The index of the output, in case of partial results.
|
|
87
116
|
*/
|
package/dist/ai/GenerativeAI.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { IPromptOptions } from '.';
|
|
1
|
+
import { IPromptOptions, IPromptResult } from '.';
|
|
2
|
+
import { GenerativeAIModelType } from './GenerativeAIModelType';
|
|
2
3
|
/**
|
|
3
4
|
* Represents a context for a Generative AI service.
|
|
4
5
|
* @category AI
|
|
@@ -7,15 +8,29 @@ export interface IGenerativeAIContext {
|
|
|
7
8
|
/**
|
|
8
9
|
* Stream the response from the AI service.
|
|
9
10
|
* @param prompt The prompt to start processing.
|
|
11
|
+
* @param options Optional parameters for the prompt.
|
|
10
12
|
* @returns An async generator that yields the response.
|
|
11
13
|
*/
|
|
12
|
-
stream(prompt: string, options?: IPromptOptions): AsyncGenerator<
|
|
14
|
+
stream(prompt: string, options?: IPromptOptions): AsyncGenerator<IPromptResult>;
|
|
13
15
|
/**
|
|
14
16
|
* Process the response from the AI service.
|
|
15
17
|
* @param prompt The prompt to start processing.
|
|
18
|
+
* @param options Optional parameters for the prompt.
|
|
16
19
|
* @returns A promise that resolves with the response.
|
|
17
20
|
*/
|
|
18
|
-
prompt(prompt: string, options?: IPromptOptions): Promise<
|
|
21
|
+
prompt(prompt: string, options?: IPromptOptions): Promise<IPromptResult>;
|
|
22
|
+
/**
|
|
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.
|
|
26
|
+
*/
|
|
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>;
|
|
19
34
|
/**
|
|
20
35
|
* Close the Generative AI Context.
|
|
21
36
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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 = {}));
|
|
@@ -7,8 +7,11 @@ export interface IVectorDatabaseConnector {
|
|
|
7
7
|
* Search for the k nearest vectors.
|
|
8
8
|
* @param vector The vector to search for.
|
|
9
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.
|
|
10
13
|
*/
|
|
11
|
-
search(vector: number[], k: number): number[];
|
|
14
|
+
search(vector: number[], k: number, minRelevance?: number, startingIndex?: number): number[];
|
|
12
15
|
/**
|
|
13
16
|
* Insert vectors into the database.
|
|
14
17
|
* @param vectors The vectors to insert.
|
package/dist/ai/index.d.ts
CHANGED
package/dist/ai/index.js
CHANGED
|
@@ -25,7 +25,7 @@ export interface ICluster extends IClusterEventEmitter {
|
|
|
25
25
|
/**
|
|
26
26
|
* Open a object store bucket.
|
|
27
27
|
* @param name The name of the Object Store bucket.
|
|
28
|
-
* @param
|
|
28
|
+
* @param options The {@link IObjectStoreBucketOptions | options} of the Object Store bucket.
|
|
29
29
|
* @throws {@link SDKClientErrorCodes.ObjectStoreAlreadyExists} if the data stream is already open.
|
|
30
30
|
* @throws {@link SDKClientErrorCodes.ObjectStoreNameNotString} if the name is not a string.
|
|
31
31
|
* @returns A promise that resolves with the data stream.
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
/**
|
|
@@ -43,9 +43,10 @@ export interface IObjectStoreBucket extends IDataStream {
|
|
|
43
43
|
/**
|
|
44
44
|
* Get an object from the bucket.
|
|
45
45
|
* @param path The path of the object.
|
|
46
|
+
* @param options The optional options for getting the object.
|
|
46
47
|
* @returns The object.
|
|
47
48
|
*/
|
|
48
|
-
get(path: string): Promise<
|
|
49
|
+
get(path: string, options?: IFileOptions): Promise<IFile>;
|
|
49
50
|
/**
|
|
50
51
|
* List the objects and folders of the bucket.
|
|
51
52
|
* @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,9 @@
|
|
|
1
1
|
export * from './event';
|
|
2
|
+
export { IFile } from './File';
|
|
2
3
|
export { FileStatus } from './FileStatus';
|
|
3
4
|
export { IFileDescriptor } from './FileDescriptor';
|
|
4
5
|
export { IFilePayload } from './FilePayload';
|
|
6
|
+
export { IFileOptions } from './FileOptions';
|
|
5
7
|
export { IFolderDescriptor } from './FolderDescriptor';
|
|
6
8
|
export { IFolderPayload } from './FolderPayload';
|
|
7
9
|
export { IMovePayload } from './MovePayload';
|
|
@@ -14,3 +16,5 @@ export { IObjectStoreListOptions } from './ObjectStoreListOptions';
|
|
|
14
16
|
export { ObjectStoreConnectorConstructor } from './ObjectStoreConnectorConstructor';
|
|
15
17
|
export { Payload } from './Payload';
|
|
16
18
|
export { PayloadAction } from './PayloadAction';
|
|
19
|
+
export { IReadableStream } from './ReadableStream';
|
|
20
|
+
export { IWritableStream } from './WritableStream';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewdle/web-sdk-types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
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",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"typescript": "^5.
|
|
26
|
+
"typescript": "^5.5.2"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"dist/"
|