@crewdle/web-sdk-types 1.0.36 → 1.0.38

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.
@@ -27,9 +27,10 @@ export interface ISDK {
27
27
  /**
28
28
  * Validate a key.
29
29
  * @param key The key to validate.
30
+ * @param origin The origin of the request.
30
31
  * @returns A promise that resolves with the vendor ID.
31
32
  */
32
- validateKey(key: string): Promise<string>;
33
+ validateKey(key: string, origin?: string): Promise<string>;
33
34
  /**
34
35
  * Join a cluster.
35
36
  * @param clusterId The ID of the cluster to join.
@@ -2,7 +2,7 @@ import { KeyValueDatabaseConnectorConstructor } from '../../key-value-database';
2
2
  import { ILoggingConnector } from '.';
3
3
  import { DocumentParserConnectorConstructor, ObjectStoreConnectorConstructor } from '../../object-storage';
4
4
  import { PeerConnectionConnectorConstructor } from '../connection';
5
- import { AISearchConnectorConstructor, GenerativeAIEngineType, GenerativeAIFileConnectorConstructor, GenerativeAIRagConnectorConstructor, GenerativeAIWorkerConnectorConstructor, NLPLibraryConnectorConstructor, QueryFileConnectorConstructor, SearchConnectorConstructor } from '../../generative-ai';
5
+ import { AISearchConnectorConstructor, GenerativeAIEngineType, GenerativeAIFileConnectorConstructor, GenerativeAIRagConnectorConstructor, GenerativeAIRagType, GenerativeAIWorkerConnectorConstructor, NLPLibraryConnectorConstructor, QueryFileConnectorConstructor, SearchConnectorConstructor } from '../../generative-ai';
6
6
  import { VectorDatabaseConnectorConstructor } from '../../vector-database';
7
7
  import { GraphDatabaseConnectorConstructor } from '../../graph-database';
8
8
  import { ExternalStorageConnectionConnectorConstructor, ExternalStorageType } from '../../external-storage';
@@ -81,7 +81,7 @@ export interface ISDKOptions {
81
81
  /**
82
82
  * The custom RAG connector to use for RAG tasks.
83
83
  */
84
- ragConnector?: GenerativeAIRagConnectorConstructor;
84
+ ragConnectors?: Map<GenerativeAIRagType, GenerativeAIRagConnectorConstructor>;
85
85
  /**
86
86
  * The maximum number of outgoing subscriptions.
87
87
  */
@@ -62,7 +62,8 @@ export declare enum GenerativeAITaskType {
62
62
  export declare enum GenerativeAIEngineType {
63
63
  Llamacpp = "llamacpp",
64
64
  Transformers = "transformers",
65
- OpenAI = "openai"
65
+ OpenAI = "openai",
66
+ Anthropic = "anthropic"
66
67
  }
67
68
  /**
68
69
  * The generative AI model interface.
@@ -63,4 +63,5 @@ export var GenerativeAIEngineType;
63
63
  GenerativeAIEngineType["Llamacpp"] = "llamacpp";
64
64
  GenerativeAIEngineType["Transformers"] = "transformers";
65
65
  GenerativeAIEngineType["OpenAI"] = "openai";
66
+ GenerativeAIEngineType["Anthropic"] = "anthropic";
66
67
  })(GenerativeAIEngineType || (GenerativeAIEngineType = {}));
@@ -6,7 +6,7 @@ export interface IIndex {
6
6
  /**
7
7
  * The content of the index.
8
8
  */
9
- content: string;
9
+ content: number[] | string;
10
10
  /**
11
11
  * The start index of the content.
12
12
  */
@@ -127,10 +127,26 @@ export interface IGenerativeAIInferenceTool {
127
127
  * The temperature for the tool.
128
128
  */
129
129
  temperature?: number;
130
+ /**
131
+ * The grammar for the tool.
132
+ */
133
+ grammar?: any;
130
134
  /**
131
135
  * The collection ID for the tool.
132
136
  */
133
137
  collectionId?: string;
138
+ /**
139
+ * The form skill questions for the tool.
140
+ */
141
+ questions?: IGenerativeAIInferenceQuestion[];
142
+ /**
143
+ * Whether to emit the tool call result.
144
+ */
145
+ shouldEmit?: boolean;
146
+ /**
147
+ * The tools for the tool.
148
+ */
149
+ tools?: IGenerativeAIInferenceTool[];
134
150
  }
135
151
  /**
136
152
  * The enum for the generative AI inference tool type.
@@ -148,7 +164,28 @@ export declare enum GenerativeAIInferenceToolType {
148
164
  Search = "search",
149
165
  WebScraper = "web-scraper",
150
166
  WebScraperRaw = "web-scraper-raw",
151
- WriteFile = "write-file"
167
+ WriteFile = "write-file",
168
+ FormSkillGetQuestion = "form-skill-get-question",
169
+ FormSkillSetAnswer = "form-skill-set-answer",
170
+ FormSkillSubmitForm = "form-skill-submit-form"
171
+ }
172
+ /**
173
+ * The interface for the generative AI inference form skill question.
174
+ * @category AI
175
+ */
176
+ export interface IGenerativeAIInferenceQuestion {
177
+ /**
178
+ * The question.
179
+ */
180
+ question: string;
181
+ /**
182
+ * The validation for the question.
183
+ */
184
+ validation: string;
185
+ /**
186
+ * Whether the question is required.
187
+ */
188
+ required: boolean;
152
189
  }
153
190
  /**
154
191
  * The interface for the generative AI inference tool parameter.
@@ -16,4 +16,7 @@ export var GenerativeAIInferenceToolType;
16
16
  GenerativeAIInferenceToolType["WebScraper"] = "web-scraper";
17
17
  GenerativeAIInferenceToolType["WebScraperRaw"] = "web-scraper-raw";
18
18
  GenerativeAIInferenceToolType["WriteFile"] = "write-file";
19
+ GenerativeAIInferenceToolType["FormSkillGetQuestion"] = "form-skill-get-question";
20
+ GenerativeAIInferenceToolType["FormSkillSetAnswer"] = "form-skill-set-answer";
21
+ GenerativeAIInferenceToolType["FormSkillSubmitForm"] = "form-skill-submit-form";
19
22
  })(GenerativeAIInferenceToolType || (GenerativeAIInferenceToolType = {}));
@@ -14,6 +14,12 @@ export interface IGenerativeAIToolCallCreateJobParameters extends IGenerativeAIC
14
14
  * The tool to be processed.
15
15
  */
16
16
  tool: IGenerativeAIInferenceTool;
17
+ /**
18
+ * The internal context for the AI job.
19
+ */
20
+ internalContext?: {
21
+ [key: string]: string;
22
+ };
17
23
  /**
18
24
  * The arguments for the tool.
19
25
  */
@@ -15,6 +15,12 @@ export interface IGenerativeAIToolCallJob extends IGenerativeAIJob {
15
15
  * The tool to be processed.
16
16
  */
17
17
  tool: IGenerativeAIInferenceTool;
18
+ /**
19
+ * The internal context for the AI job.
20
+ */
21
+ internalContext?: {
22
+ [key: string]: string;
23
+ };
18
24
  /**
19
25
  * Runs the job.
20
26
  * @returns A promise that resolves with the result of the job.
@@ -13,4 +13,10 @@ export interface IGenerativeAIToolCallResult extends IGenerativeAIJobResult {
13
13
  * The output of the tool.
14
14
  */
15
15
  output: string;
16
+ /**
17
+ * The internal context for the AI job.
18
+ */
19
+ internalContext?: {
20
+ [key: string]: string;
21
+ };
16
22
  }
@@ -14,6 +14,12 @@ export interface IGenerativeAIToolCallWorkerParameters extends IGenerativeAIWork
14
14
  * The tool to be processed.
15
15
  */
16
16
  tool: IGenerativeAIInferenceTool;
17
+ /**
18
+ * The internal context for the AI job.
19
+ */
20
+ internalContext?: {
21
+ [key: string]: string;
22
+ };
17
23
  /**
18
24
  * The arguments for the tool.
19
25
  */
@@ -1,5 +1,10 @@
1
+ import { IIndex } from '../IIndex';
1
2
  import { IGenerativeAIFile } from '../jobs';
2
3
  import { ISearchResult } from '../search';
4
+ export declare enum GenerativeAIRagType {
5
+ Pinecone = "pinecone",
6
+ Crewdle = "crewdle"
7
+ }
3
8
  /**
4
9
  * Generative AI Rag Connector Interface
5
10
  * @category AI
@@ -7,42 +12,50 @@ import { ISearchResult } from '../search';
7
12
  export interface IGenerativeAIRagConnector {
8
13
  /**
9
14
  * Create a collection.
15
+ * @param instanceId The instance id to create the collection.
10
16
  * @param collectionId The collection id to create.
11
17
  * @returns A promise that resolves when the collection is created.
12
18
  */
13
- createCollection(collectionId: string): Promise<void>;
19
+ createCollection(instanceId: string, collectionId: string): Promise<void>;
14
20
  /**
15
21
  * Delete a collection.
22
+ * @param instanceId The instance id to delete the collection.
16
23
  * @param collectionId The collection id to delete.
24
+ * @param deleteInstance Whether to delete the instance as well.
17
25
  * @returns A promise that resolves when the collection is deleted.
18
26
  */
19
- deleteCollection(collectionId: string): Promise<void>;
27
+ deleteCollection(instanceId: string, collectionId: string, deleteInstance: boolean): Promise<void>;
20
28
  /**
21
29
  * Query a collection.
30
+ * @param instanceId The instance id to query.
22
31
  * @param collectionId The collection id to query.
23
32
  * @param query The query to run.
33
+ * @param topK The number of results to return.
24
34
  * @returns The search results.
25
35
  */
26
- queryCollection(collectionId: string, query: string): Promise<ISearchResult[]>;
36
+ queryCollection(instanceId: string, collectionId: string, query: string | number[], topK: number): Promise<ISearchResult[]>;
27
37
  /**
28
38
  * Delete a file.
39
+ * @param instanceId The instance id of the file to delete.
29
40
  * @param collectionId The collection id of the file to delete.
30
41
  * @param fileId The file id to delete.
31
42
  * @returns A promise that resolves when the file is deleted.
32
43
  */
33
- deleteFile(collectionId: string, fileId: string): Promise<void>;
44
+ deleteFile(instanceId: string, collectionId: string, fileId: string): Promise<void>;
34
45
  /**
35
46
  * Ingest a file.
47
+ * @param instanceId The instance id to ingest the file.
36
48
  * @param collectionId The collection id to ingest the file.
37
49
  * @param fileName The name of the file to ingest.
38
50
  * @param content The content of the file to ingest.
39
51
  * @returns A promise that resolves when the file is ingested.
40
52
  */
41
- ingestFile(collectionId: string, fileName: string, content: string): Promise<void>;
53
+ ingestFile(instanceId: string, collectionId: string, fileName: string, content: string | IIndex[]): Promise<void>;
42
54
  /**
43
55
  * List files in a collection.
56
+ * @param instanceId The instance id to list files.
44
57
  * @param collectionId The collection id to list files.
45
58
  * @returns The list of files.
46
59
  */
47
- listFiles(collectionId: string): Promise<IGenerativeAIFile[]>;
60
+ listFiles(instanceId: string, collectionId: string): Promise<IGenerativeAIFile[]>;
48
61
  }
@@ -1 +1,5 @@
1
- export {};
1
+ export var GenerativeAIRagType;
2
+ (function (GenerativeAIRagType) {
3
+ GenerativeAIRagType["Pinecone"] = "pinecone";
4
+ GenerativeAIRagType["Crewdle"] = "crewdle";
5
+ })(GenerativeAIRagType || (GenerativeAIRagType = {}));
@@ -6,8 +6,9 @@ export interface IAISearchConnector {
6
6
  /**
7
7
  * Searches for the query.
8
8
  * @param query The query to search for.
9
+ * @param modelId The model id to use for the search.
9
10
  * @param apiKey The API key to use for the search.
10
11
  * @returns A promise that resolves with the search result.
11
12
  */
12
- search(query: string): Promise<string>;
13
+ search(query: string, modelId: string): Promise<string>;
13
14
  }
@@ -7,6 +7,14 @@ export interface ISearchResult {
7
7
  * The content of the search result.
8
8
  */
9
9
  content: string;
10
+ /**
11
+ * The start index of the search
12
+ */
13
+ start?: number;
14
+ /**
15
+ * The length of the search result.
16
+ */
17
+ length?: number;
10
18
  /**
11
19
  * The relevance of the search result.
12
20
  * The relevance is a number between 0 and 1, where 1 is the most relevant.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewdle/web-sdk-types",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
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",