@izzai/one-js 1.1.2 → 1.1.21
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/index.cjs +5989 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +838 -7
- package/dist/index.js +5971 -9
- package/dist/index.js.map +1 -0
- package/package.json +13 -4
- package/dist/customTypes/auth.d.ts +0 -4
- package/dist/customTypes/auth.js +0 -2
- package/dist/customTypes/chat.d.ts +0 -4
- package/dist/customTypes/chat.js +0 -2
- package/dist/customTypes/index.d.ts +0 -2
- package/dist/customTypes/index.js +0 -18
- package/dist/services/agent.d.ts +0 -5
- package/dist/services/agent.js +0 -18
- package/dist/services/base.d.ts +0 -14
- package/dist/services/base.js +0 -69
- package/dist/services/chat.d.ts +0 -12
- package/dist/services/chat.js +0 -57
- package/dist/services/datasource.d.ts +0 -5
- package/dist/services/datasource.js +0 -13
- package/dist/services/gpt.d.ts +0 -5
- package/dist/services/gpt.js +0 -17
- package/dist/services/index.d.ts +0 -12
- package/dist/services/index.js +0 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,841 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Lean version of AgentDocument
|
|
3
|
+
*
|
|
4
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `AgentDocument.toObject()`. To avoid conflicts with model names, use the type alias `AgentObject`.
|
|
5
|
+
* ```
|
|
6
|
+
* const agentObject = agent.toObject();
|
|
7
|
+
* ```
|
|
8
|
+
*/
|
|
9
|
+
type Agent = {
|
|
10
|
+
name: string;
|
|
11
|
+
steps: (AgentStep['_id'] | AgentStep)[];
|
|
12
|
+
isArchived?: boolean;
|
|
13
|
+
archiveDate?: string;
|
|
14
|
+
access: any;
|
|
15
|
+
_id: string;
|
|
16
|
+
createdAt?: string;
|
|
17
|
+
updatedAt?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Lean version of AgentStepLlmCapabilityDocument
|
|
21
|
+
*
|
|
22
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `AgentStepLlmDocument.toObject()`.
|
|
23
|
+
* ```
|
|
24
|
+
* const agentstepllmObject = agentstepllm.toObject();
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
type AgentStepLlmCapability = {
|
|
28
|
+
chat?: boolean;
|
|
29
|
+
embedding?: boolean;
|
|
30
|
+
function?: boolean;
|
|
31
|
+
speech?: boolean;
|
|
32
|
+
realTimeSpeech?: boolean;
|
|
33
|
+
vision?: boolean;
|
|
34
|
+
reranking?: boolean;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Lean version of AgentStepLlmDocument
|
|
38
|
+
*
|
|
39
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `AgentStepDocument.toObject()`.
|
|
40
|
+
* ```
|
|
41
|
+
* const agentstepObject = agentstep.toObject();
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
type AgentStepLlm = {
|
|
45
|
+
key?: string;
|
|
46
|
+
label?: string;
|
|
47
|
+
engine?: string;
|
|
48
|
+
capabilities?: AgentStepLlmCapability;
|
|
49
|
+
description?: string;
|
|
50
|
+
uuid?: string;
|
|
51
|
+
provider?: 'azure' | 'huggingface' | 'ollama' | 'anthropic' | 'bedrock' | 'gemini' | 'openai' | 'perplexity';
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Lean version of AgentStepDocument
|
|
55
|
+
*
|
|
56
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `AgentStepDocument.toObject()`. To avoid conflicts with model names, use the type alias `AgentStepObject`.
|
|
57
|
+
* ```
|
|
58
|
+
* const agentstepObject = agentstep.toObject();
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
type AgentStep = {
|
|
62
|
+
name: string;
|
|
63
|
+
type: 'userMessage' | 'outputParser' | 'tool' | 'systemMessage' | 'gpt' | 'datasource';
|
|
64
|
+
refPath?: 'SystemMessage' | 'Gpt' | 'Datasource';
|
|
65
|
+
content?: string;
|
|
66
|
+
llm?: AgentStepLlm;
|
|
67
|
+
tool?: 'jsonApi' | 'websiteMarkdown' | 'websiteHtml';
|
|
68
|
+
ref?: string;
|
|
69
|
+
isArchived?: boolean;
|
|
70
|
+
archiveDate?: string;
|
|
71
|
+
_id: string;
|
|
72
|
+
createdAt?: string;
|
|
73
|
+
updatedAt?: string;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Lean version of ChatLlmCapabilityDocument
|
|
77
|
+
*
|
|
78
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `ChatLlmDocument.toObject()`.
|
|
79
|
+
* ```
|
|
80
|
+
* const chatllmObject = chatllm.toObject();
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
type ChatLlmCapability = {
|
|
84
|
+
chat?: boolean;
|
|
85
|
+
embedding?: boolean;
|
|
86
|
+
function?: boolean;
|
|
87
|
+
speech?: boolean;
|
|
88
|
+
realTimeSpeech?: boolean;
|
|
89
|
+
vision?: boolean;
|
|
90
|
+
reranking?: boolean;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Lean version of ChatLlmDocument
|
|
94
|
+
*
|
|
95
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `ChatDocument.toObject()`.
|
|
96
|
+
* ```
|
|
97
|
+
* const chatObject = chat.toObject();
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
type ChatLlm = {
|
|
101
|
+
key?: string;
|
|
102
|
+
label?: string;
|
|
103
|
+
engine?: string;
|
|
104
|
+
capabilities?: ChatLlmCapability;
|
|
105
|
+
description?: string;
|
|
106
|
+
uuid?: string;
|
|
107
|
+
provider?: 'azure' | 'huggingface' | 'ollama' | 'anthropic' | 'bedrock' | 'gemini' | 'openai' | 'perplexity';
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Lean version of ChatDocument
|
|
111
|
+
*
|
|
112
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `ChatDocument.toObject()`. To avoid conflicts with model names, use the type alias `ChatObject`.
|
|
113
|
+
* ```
|
|
114
|
+
* const chatObject = chat.toObject();
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
type Chat = {
|
|
118
|
+
user: string;
|
|
119
|
+
label?: string;
|
|
120
|
+
summary?: string;
|
|
121
|
+
tokenLimit?: number;
|
|
122
|
+
token?: number;
|
|
123
|
+
totalToken?: number;
|
|
124
|
+
messageId?: string;
|
|
125
|
+
status?: string;
|
|
126
|
+
llm?: ChatLlm;
|
|
127
|
+
agent?: Agent['_id'] | Agent;
|
|
128
|
+
datasources?: (Datasource['_id'] | Datasource)[];
|
|
129
|
+
gpt?: Gpt['_id'] | Gpt;
|
|
130
|
+
outputParser?: string;
|
|
131
|
+
outputFormat?: 'JSON' | 'MARKDOWN' | 'TEXT' | 'SPEECH';
|
|
132
|
+
behavior: ('conversational' | 'explaining' | 'creative' | 'formal' | 'informal' | 'technical' | 'friendly' | 'professional' | 'humorous')[];
|
|
133
|
+
tags?: (Tag['_id'] | Tag)[];
|
|
134
|
+
useInternet?: boolean;
|
|
135
|
+
excludeReferences?: boolean;
|
|
136
|
+
systemMessage?: string;
|
|
137
|
+
imageChat?: boolean;
|
|
138
|
+
isFavourite?: boolean;
|
|
139
|
+
favouriteDate?: string;
|
|
140
|
+
isArchived?: boolean;
|
|
141
|
+
archiveDate?: string;
|
|
142
|
+
llmOptions?: any;
|
|
143
|
+
rtid?: string;
|
|
144
|
+
sdp?: string;
|
|
145
|
+
noPromptInjectionProtection?: boolean;
|
|
146
|
+
_id: string;
|
|
147
|
+
createdAt?: string;
|
|
148
|
+
updatedAt?: string;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Lean version of DatasourceTokensPerMinuteDocument
|
|
152
|
+
*
|
|
153
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
154
|
+
* ```
|
|
155
|
+
* const datasourceObject = datasource.toObject();
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
type DatasourceTokensPerMinute = {
|
|
159
|
+
count?: number;
|
|
160
|
+
internalCount?: number;
|
|
161
|
+
lastReset?: string;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Lean version of DatasourceBlobStorageDocument
|
|
165
|
+
*
|
|
166
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
167
|
+
* ```
|
|
168
|
+
* const datasourceObject = datasource.toObject();
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
type DatasourceBlobStorage = {
|
|
172
|
+
connectionString: string;
|
|
173
|
+
containerName: string;
|
|
174
|
+
accessID?: string;
|
|
175
|
+
secret?: string;
|
|
176
|
+
region?: string;
|
|
177
|
+
type?: 'azure' | 's3';
|
|
178
|
+
successCount?: number;
|
|
179
|
+
replacedCount?: number;
|
|
180
|
+
skippedCount?: number;
|
|
181
|
+
totalCount?: number;
|
|
182
|
+
completionPercentage?: number;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Lean version of DatasourceBraveSearchDocument
|
|
186
|
+
*
|
|
187
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
188
|
+
* ```
|
|
189
|
+
* const datasourceObject = datasource.toObject();
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
type DatasourceBraveSearch = {
|
|
193
|
+
apiKey: string;
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Lean version of DatasourceClickupDocument
|
|
197
|
+
*
|
|
198
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
199
|
+
* ```
|
|
200
|
+
* const datasourceObject = datasource.toObject();
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
type DatasourceClickup = {
|
|
204
|
+
apiKey: string;
|
|
205
|
+
teamId: string;
|
|
206
|
+
documentSupport?: boolean;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Lean version of DatasourceCognitiveSearchDocument
|
|
210
|
+
*
|
|
211
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
212
|
+
* ```
|
|
213
|
+
* const datasourceObject = datasource.toObject();
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
type DatasourceCognitiveSearch = {
|
|
217
|
+
endpoint: string;
|
|
218
|
+
indexerName: string;
|
|
219
|
+
indexName: string;
|
|
220
|
+
apiKey: string;
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Lean version of DatasourceMssqlDocument
|
|
224
|
+
*
|
|
225
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
226
|
+
* ```
|
|
227
|
+
* const datasourceObject = datasource.toObject();
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
type DatasourceMssql = {
|
|
231
|
+
host: string;
|
|
232
|
+
user?: string;
|
|
233
|
+
password?: string;
|
|
234
|
+
database: string;
|
|
235
|
+
port?: number;
|
|
236
|
+
schemaPath?: string;
|
|
237
|
+
schemaFiles: string[];
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Lean version of DatasourceMysqlDocument
|
|
241
|
+
*
|
|
242
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
243
|
+
* ```
|
|
244
|
+
* const datasourceObject = datasource.toObject();
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
type DatasourceMysql = {
|
|
248
|
+
host: string;
|
|
249
|
+
user?: string;
|
|
250
|
+
password?: string;
|
|
251
|
+
database: string;
|
|
252
|
+
port?: number;
|
|
253
|
+
schemaPath?: string;
|
|
254
|
+
schemaFiles: string[];
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* Lean version of DatasourceMongodbDocument
|
|
258
|
+
*
|
|
259
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
260
|
+
* ```
|
|
261
|
+
* const datasourceObject = datasource.toObject();
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
type DatasourceMongodb = {
|
|
265
|
+
host: string;
|
|
266
|
+
user?: string;
|
|
267
|
+
password?: string;
|
|
268
|
+
database: string;
|
|
269
|
+
port?: number;
|
|
270
|
+
schemaPath?: string;
|
|
271
|
+
schemaFiles: string[];
|
|
272
|
+
srv?: boolean;
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* Lean version of DatasourceCosmosdbDocument
|
|
276
|
+
*
|
|
277
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
278
|
+
* ```
|
|
279
|
+
* const datasourceObject = datasource.toObject();
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
type DatasourceCosmosdb = {
|
|
283
|
+
host: string;
|
|
284
|
+
user?: string;
|
|
285
|
+
password?: string;
|
|
286
|
+
database: string;
|
|
287
|
+
port?: number;
|
|
288
|
+
schemaPath?: string;
|
|
289
|
+
schemaFiles: string[];
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Lean version of DatasourcePostgreDocument
|
|
293
|
+
*
|
|
294
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
295
|
+
* ```
|
|
296
|
+
* const datasourceObject = datasource.toObject();
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
type DatasourcePostgre = {
|
|
300
|
+
host: string;
|
|
301
|
+
user?: string;
|
|
302
|
+
password?: string;
|
|
303
|
+
database: string;
|
|
304
|
+
port?: number;
|
|
305
|
+
schemaPath?: string;
|
|
306
|
+
schemaFiles: string[];
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* Lean version of DatasourceElasticSearchDocument
|
|
310
|
+
*
|
|
311
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
312
|
+
* ```
|
|
313
|
+
* const datasourceObject = datasource.toObject();
|
|
314
|
+
* ```
|
|
315
|
+
*/
|
|
316
|
+
type DatasourceElasticSearch = {
|
|
317
|
+
endpoint: string;
|
|
318
|
+
indexName: string;
|
|
319
|
+
username?: string;
|
|
320
|
+
password?: string;
|
|
321
|
+
apiKey?: string;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* Lean version of DatasourceEmailAuthDocument
|
|
325
|
+
*
|
|
326
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceEmailDocument.toObject()`.
|
|
327
|
+
* ```
|
|
328
|
+
* const datasourceemailObject = datasourceemail.toObject();
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
type DatasourceEmailAuth = {
|
|
332
|
+
type?: string;
|
|
333
|
+
user: string;
|
|
334
|
+
pass?: string;
|
|
335
|
+
clientId?: string;
|
|
336
|
+
clientSecret?: string;
|
|
337
|
+
refreshToken?: string;
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Lean version of DatasourceEmailDocument
|
|
341
|
+
*
|
|
342
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
343
|
+
* ```
|
|
344
|
+
* const datasourceObject = datasource.toObject();
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
type DatasourceEmail = {
|
|
348
|
+
service?: string;
|
|
349
|
+
host: string;
|
|
350
|
+
port: number;
|
|
351
|
+
secure?: boolean;
|
|
352
|
+
auth?: DatasourceEmailAuth;
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* Lean version of DatasourceGenericMcpDocument
|
|
356
|
+
*
|
|
357
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
358
|
+
* ```
|
|
359
|
+
* const datasourceObject = datasource.toObject();
|
|
360
|
+
* ```
|
|
361
|
+
*/
|
|
362
|
+
type DatasourceGenericMcp = {
|
|
363
|
+
url: string;
|
|
364
|
+
requestInit?: any;
|
|
365
|
+
toolNamePrefix?: string;
|
|
366
|
+
clientName?: string;
|
|
367
|
+
clientVersion?: string;
|
|
368
|
+
};
|
|
369
|
+
/**
|
|
370
|
+
* Lean version of DatasourceGithubDocument
|
|
371
|
+
*
|
|
372
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
373
|
+
* ```
|
|
374
|
+
* const datasourceObject = datasource.toObject();
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
377
|
+
type DatasourceGithub = {
|
|
378
|
+
apiKey: string;
|
|
379
|
+
readOnly?: boolean;
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* Lean version of DatasourceGoogleProgrammableSearchDocument
|
|
383
|
+
*
|
|
384
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
385
|
+
* ```
|
|
386
|
+
* const datasourceObject = datasource.toObject();
|
|
387
|
+
* ```
|
|
388
|
+
*/
|
|
389
|
+
type DatasourceGoogleProgrammableSearch = {
|
|
390
|
+
apiKey: string;
|
|
391
|
+
cx: string;
|
|
392
|
+
};
|
|
393
|
+
/**
|
|
394
|
+
* Lean version of DatasourceNotionDocument
|
|
395
|
+
*
|
|
396
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
397
|
+
* ```
|
|
398
|
+
* const datasourceObject = datasource.toObject();
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
401
|
+
type DatasourceNotion = {
|
|
402
|
+
authToken: string;
|
|
403
|
+
};
|
|
404
|
+
/**
|
|
405
|
+
* Lean version of DatasourceSerpApiDocument
|
|
406
|
+
*
|
|
407
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
408
|
+
* ```
|
|
409
|
+
* const datasourceObject = datasource.toObject();
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
412
|
+
type DatasourceSerpApi = {
|
|
413
|
+
apiKey: string;
|
|
414
|
+
};
|
|
415
|
+
/**
|
|
416
|
+
* Lean version of DatasourceSlackDocument
|
|
417
|
+
*
|
|
418
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
419
|
+
* ```
|
|
420
|
+
* const datasourceObject = datasource.toObject();
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
type DatasourceSlack = {
|
|
424
|
+
botToken: string;
|
|
425
|
+
teamId: string;
|
|
426
|
+
channelIds?: string[];
|
|
427
|
+
};
|
|
428
|
+
/**
|
|
429
|
+
* Lean version of DatasourceShopifyDocument
|
|
430
|
+
*
|
|
431
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
432
|
+
* ```
|
|
433
|
+
* const datasourceObject = datasource.toObject();
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
type DatasourceShopify = {
|
|
437
|
+
accessToken: string;
|
|
438
|
+
domain: string;
|
|
439
|
+
};
|
|
440
|
+
/**
|
|
441
|
+
* Lean version of DatasourceZenserpDocument
|
|
442
|
+
*
|
|
443
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`.
|
|
444
|
+
* ```
|
|
445
|
+
* const datasourceObject = datasource.toObject();
|
|
446
|
+
* ```
|
|
447
|
+
*/
|
|
448
|
+
type DatasourceZenserp = {
|
|
449
|
+
apiKey: string;
|
|
450
|
+
};
|
|
451
|
+
/**
|
|
452
|
+
* Lean version of DatasourceDocument
|
|
453
|
+
*
|
|
454
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `DatasourceDocument.toObject()`. To avoid conflicts with model names, use the type alias `DatasourceObject`.
|
|
455
|
+
* ```
|
|
456
|
+
* const datasourceObject = datasource.toObject();
|
|
457
|
+
* ```
|
|
458
|
+
*/
|
|
459
|
+
type Datasource = {
|
|
460
|
+
indexName?: string;
|
|
461
|
+
indexSize?: number;
|
|
462
|
+
displayName?: string;
|
|
463
|
+
immutable?: boolean;
|
|
464
|
+
type?: 'mssql' | 'mysql' | 'mongodb' | 'cosmosdb' | 'postgres' | 'semanticIndex' | 'cognitiveSearch' | 'blobStorage' | 'elasticSearch' | 'fetch' | 'slack' | 'clickup' | 'email' | 'genericMcp' | 'notion' | 'github' | 'shopify' | 'braveSearch' | 'googleProgrammableSearch' | 'serpApi' | 'zenserp' | 'auto';
|
|
465
|
+
status?: 'failed' | 'indexing' | 'pending' | 'ready';
|
|
466
|
+
isActive?: boolean;
|
|
467
|
+
isValid?: boolean;
|
|
468
|
+
isInitialized?: boolean;
|
|
469
|
+
initDate?: string;
|
|
470
|
+
reInitDate?: string;
|
|
471
|
+
failedInitialize?: string;
|
|
472
|
+
chunkSize?: number;
|
|
473
|
+
chunkOverlap?: number;
|
|
474
|
+
indexMode?: 'semantic' | 'manual';
|
|
475
|
+
tokensUsed?: number;
|
|
476
|
+
internalTokensUsed?: number;
|
|
477
|
+
isMerged?: boolean;
|
|
478
|
+
tokensPerMinute?: DatasourceTokensPerMinute;
|
|
479
|
+
storage?: Storage['_id'] | Storage;
|
|
480
|
+
percent?: number;
|
|
481
|
+
isArchived?: boolean;
|
|
482
|
+
archiveDate?: string;
|
|
483
|
+
description?: string;
|
|
484
|
+
failureCount?: number;
|
|
485
|
+
access: any;
|
|
486
|
+
_id: string;
|
|
487
|
+
createdAt?: string;
|
|
488
|
+
updatedAt?: string;
|
|
489
|
+
blobStorage?: DatasourceBlobStorage;
|
|
490
|
+
braveSearch?: DatasourceBraveSearch;
|
|
491
|
+
clickup?: DatasourceClickup;
|
|
492
|
+
cognitiveSearch?: DatasourceCognitiveSearch;
|
|
493
|
+
mssql?: DatasourceMssql;
|
|
494
|
+
mysql?: DatasourceMysql;
|
|
495
|
+
mongodb?: DatasourceMongodb;
|
|
496
|
+
cosmosdb?: DatasourceCosmosdb;
|
|
497
|
+
postgres?: DatasourcePostgre;
|
|
498
|
+
elasticSearch?: DatasourceElasticSearch;
|
|
499
|
+
email?: DatasourceEmail;
|
|
500
|
+
fetch?: any;
|
|
501
|
+
genericMcp?: DatasourceGenericMcp;
|
|
502
|
+
github?: DatasourceGithub;
|
|
503
|
+
googleProgrammableSearch?: DatasourceGoogleProgrammableSearch;
|
|
504
|
+
notion?: DatasourceNotion;
|
|
505
|
+
serpApi?: DatasourceSerpApi;
|
|
506
|
+
slack?: DatasourceSlack;
|
|
507
|
+
shopify?: DatasourceShopify;
|
|
508
|
+
zenserp?: DatasourceZenserp;
|
|
509
|
+
};
|
|
510
|
+
/**
|
|
511
|
+
* Lean version of GptLlmCapabilityDocument
|
|
512
|
+
*
|
|
513
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `GptLlmDocument.toObject()`.
|
|
514
|
+
* ```
|
|
515
|
+
* const gptllmObject = gptllm.toObject();
|
|
516
|
+
* ```
|
|
517
|
+
*/
|
|
518
|
+
type GptLlmCapability = {
|
|
519
|
+
chat?: boolean;
|
|
520
|
+
embedding?: boolean;
|
|
521
|
+
function?: boolean;
|
|
522
|
+
speech?: boolean;
|
|
523
|
+
realTimeSpeech?: boolean;
|
|
524
|
+
vision?: boolean;
|
|
525
|
+
reranking?: boolean;
|
|
526
|
+
};
|
|
527
|
+
/**
|
|
528
|
+
* Lean version of GptLlmDocument
|
|
529
|
+
*
|
|
530
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `GptDocument.toObject()`.
|
|
531
|
+
* ```
|
|
532
|
+
* const gptObject = gpt.toObject();
|
|
533
|
+
* ```
|
|
534
|
+
*/
|
|
535
|
+
type GptLlm = {
|
|
536
|
+
key?: string;
|
|
537
|
+
label?: string;
|
|
538
|
+
engine?: string;
|
|
539
|
+
capabilities?: GptLlmCapability;
|
|
540
|
+
description?: string;
|
|
541
|
+
uuid?: string;
|
|
542
|
+
provider?: 'azure' | 'huggingface' | 'ollama' | 'anthropic' | 'bedrock' | 'gemini' | 'openai' | 'perplexity';
|
|
543
|
+
};
|
|
544
|
+
/**
|
|
545
|
+
* Lean version of GptDocument
|
|
546
|
+
*
|
|
547
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `GptDocument.toObject()`. To avoid conflicts with model names, use the type alias `GptObject`.
|
|
548
|
+
* ```
|
|
549
|
+
* const gptObject = gpt.toObject();
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
type Gpt = {
|
|
553
|
+
user: string;
|
|
554
|
+
access: string[];
|
|
555
|
+
name: string;
|
|
556
|
+
description?: string;
|
|
557
|
+
llm?: GptLlm;
|
|
558
|
+
status?: 'active' | 'draft' | 'inactive';
|
|
559
|
+
datasource?: Datasource['_id'] | Datasource;
|
|
560
|
+
outputFormat?: 'JSON' | 'MARKDOWN' | 'TEXT' | 'SPEECH';
|
|
561
|
+
outputParser?: string;
|
|
562
|
+
behavior: ('conversational' | 'explaining' | 'creative' | 'formal' | 'informal' | 'technical' | 'friendly' | 'professional' | 'humorous')[];
|
|
563
|
+
useInternet?: boolean;
|
|
564
|
+
systemMessage?: string;
|
|
565
|
+
isArchived?: boolean;
|
|
566
|
+
archiveDate?: string;
|
|
567
|
+
llmOptions?: any;
|
|
568
|
+
_id: string;
|
|
569
|
+
createdAt?: string;
|
|
570
|
+
updatedAt?: string;
|
|
571
|
+
};
|
|
572
|
+
/**
|
|
573
|
+
* Lean version of MessageFileContentDocument
|
|
574
|
+
*
|
|
575
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `MessageDocument.toObject()`.
|
|
576
|
+
* ```
|
|
577
|
+
* const messageObject = message.toObject();
|
|
578
|
+
* ```
|
|
579
|
+
*/
|
|
580
|
+
type MessageFileContent = {
|
|
581
|
+
content?: string;
|
|
582
|
+
file?: string;
|
|
583
|
+
path?: string;
|
|
584
|
+
};
|
|
585
|
+
/**
|
|
586
|
+
* Lean version of MessageScratchPadDocument
|
|
587
|
+
*
|
|
588
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `MessageDocument.toObject()`.
|
|
589
|
+
* ```
|
|
590
|
+
* const messageObject = message.toObject();
|
|
591
|
+
* ```
|
|
592
|
+
*/
|
|
593
|
+
type MessageScratchPad = {
|
|
594
|
+
time?: string;
|
|
595
|
+
output?: any;
|
|
596
|
+
input?: string;
|
|
597
|
+
reason?: string;
|
|
598
|
+
};
|
|
599
|
+
/**
|
|
600
|
+
* Lean version of MessageLlmCapabilityDocument
|
|
601
|
+
*
|
|
602
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `MessageLlmDocument.toObject()`.
|
|
603
|
+
* ```
|
|
604
|
+
* const messagellmObject = messagellm.toObject();
|
|
605
|
+
* ```
|
|
606
|
+
*/
|
|
607
|
+
type MessageLlmCapability = {
|
|
608
|
+
chat?: boolean;
|
|
609
|
+
embedding?: boolean;
|
|
610
|
+
function?: boolean;
|
|
611
|
+
speech?: boolean;
|
|
612
|
+
realTimeSpeech?: boolean;
|
|
613
|
+
vision?: boolean;
|
|
614
|
+
reranking?: boolean;
|
|
615
|
+
};
|
|
616
|
+
/**
|
|
617
|
+
* Lean version of MessageLlmDocument
|
|
618
|
+
*
|
|
619
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `MessageDocument.toObject()`.
|
|
620
|
+
* ```
|
|
621
|
+
* const messageObject = message.toObject();
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
type MessageLlm = {
|
|
625
|
+
key?: string;
|
|
626
|
+
label?: string;
|
|
627
|
+
engine?: string;
|
|
628
|
+
capabilities?: MessageLlmCapability;
|
|
629
|
+
description?: string;
|
|
630
|
+
uuid?: string;
|
|
631
|
+
provider?: 'azure' | 'huggingface' | 'ollama' | 'anthropic' | 'bedrock' | 'gemini' | 'openai' | 'perplexity';
|
|
632
|
+
};
|
|
633
|
+
/**
|
|
634
|
+
* Lean version of MessageDocument
|
|
635
|
+
*
|
|
636
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `MessageDocument.toObject()`. To avoid conflicts with model names, use the type alias `MessageObject`.
|
|
637
|
+
* ```
|
|
638
|
+
* const messageObject = message.toObject();
|
|
639
|
+
* ```
|
|
640
|
+
*/
|
|
641
|
+
type Message = {
|
|
642
|
+
user: string;
|
|
643
|
+
chat?: Chat['_id'] | Chat;
|
|
644
|
+
date?: string;
|
|
645
|
+
content?: string;
|
|
646
|
+
fileContent: MessageFileContent[];
|
|
647
|
+
parsedContent?: any;
|
|
648
|
+
role?: 'function' | 'assistant' | 'user' | 'system' | 'tool';
|
|
649
|
+
outputFormat?: 'JSON' | 'MARKDOWN' | 'TEXT' | 'SPEECH';
|
|
650
|
+
related?: (Message['_id'] | Message)[];
|
|
651
|
+
activeVariant?: boolean;
|
|
652
|
+
outputParser?: any;
|
|
653
|
+
rawResponse?: any;
|
|
654
|
+
rawInfo?: any;
|
|
655
|
+
filePaths: string[];
|
|
656
|
+
token?: number;
|
|
657
|
+
tokenUsage?: any;
|
|
658
|
+
summarized?: boolean;
|
|
659
|
+
isPinned?: boolean;
|
|
660
|
+
pinnedDate?: string;
|
|
661
|
+
isArchived?: boolean;
|
|
662
|
+
archiveDate?: string;
|
|
663
|
+
image?: string;
|
|
664
|
+
isCustom?: boolean;
|
|
665
|
+
isSpeech?: boolean;
|
|
666
|
+
scratchPad: MessageScratchPad[];
|
|
667
|
+
llm?: MessageLlm;
|
|
668
|
+
processErrors: string[];
|
|
669
|
+
_id: string;
|
|
670
|
+
createdAt?: string;
|
|
671
|
+
updatedAt?: string;
|
|
672
|
+
};
|
|
673
|
+
/**
|
|
674
|
+
* Lean version of StorageAzureDocument
|
|
675
|
+
*
|
|
676
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `StorageDocument.toObject()`.
|
|
677
|
+
* ```
|
|
678
|
+
* const storageObject = storage.toObject();
|
|
679
|
+
* ```
|
|
680
|
+
*/
|
|
681
|
+
type StorageAzure = {
|
|
682
|
+
connectionString: string;
|
|
683
|
+
containerName: string;
|
|
684
|
+
};
|
|
685
|
+
/**
|
|
686
|
+
* Lean version of StorageS3Document
|
|
687
|
+
*
|
|
688
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `StorageDocument.toObject()`.
|
|
689
|
+
* ```
|
|
690
|
+
* const storageObject = storage.toObject();
|
|
691
|
+
* ```
|
|
692
|
+
*/
|
|
693
|
+
type StorageS3 = {
|
|
694
|
+
accessID: string;
|
|
695
|
+
secret: string;
|
|
696
|
+
bucketName: string;
|
|
697
|
+
region: string;
|
|
698
|
+
};
|
|
699
|
+
/**
|
|
700
|
+
* Lean version of StorageDocument
|
|
701
|
+
*
|
|
702
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `StorageDocument.toObject()`. To avoid conflicts with model names, use the type alias `StorageObject`.
|
|
703
|
+
* ```
|
|
704
|
+
* const storageObject = storage.toObject();
|
|
705
|
+
* ```
|
|
706
|
+
*/
|
|
707
|
+
type Storage = {
|
|
708
|
+
displayName: string;
|
|
709
|
+
type: 'azure' | 's3';
|
|
710
|
+
azure?: StorageAzure;
|
|
711
|
+
s3?: StorageS3;
|
|
712
|
+
immutable?: boolean;
|
|
713
|
+
isInitialized?: boolean;
|
|
714
|
+
failedInitialize?: string;
|
|
715
|
+
isArchived?: boolean;
|
|
716
|
+
archiveDate?: string;
|
|
717
|
+
_id: string;
|
|
718
|
+
createdAt?: string;
|
|
719
|
+
updatedAt?: string;
|
|
720
|
+
};
|
|
721
|
+
/**
|
|
722
|
+
* Lean version of TagDocument
|
|
723
|
+
*
|
|
724
|
+
* This has all Mongoose getters & functions removed. This type will be returned from `TagDocument.toObject()`. To avoid conflicts with model names, use the type alias `TagObject`.
|
|
725
|
+
* ```
|
|
726
|
+
* const tagObject = tag.toObject();
|
|
727
|
+
* ```
|
|
728
|
+
*/
|
|
729
|
+
type Tag = {
|
|
730
|
+
label: string;
|
|
731
|
+
color?: string;
|
|
732
|
+
categories: ('avatar' | 'chat')[];
|
|
733
|
+
users?: string[];
|
|
734
|
+
isArchived?: boolean;
|
|
735
|
+
archiveDate?: string;
|
|
736
|
+
_id: string;
|
|
737
|
+
createdAt?: string;
|
|
738
|
+
updatedAt?: string;
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
type OneAuth = {
|
|
742
|
+
email: string;
|
|
743
|
+
apiKey: string;
|
|
744
|
+
} | string;
|
|
745
|
+
|
|
746
|
+
type ChatWithMessages = Chat & {
|
|
747
|
+
messages: Message[];
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
declare class BaseService {
|
|
751
|
+
protected readonly instanceId: string;
|
|
752
|
+
protected readonly auth: OneAuth;
|
|
753
|
+
protected readonly baseUrl: string;
|
|
754
|
+
constructor(instanceId: string, auth: OneAuth, baseUrl: string);
|
|
755
|
+
private headers;
|
|
756
|
+
private _request;
|
|
757
|
+
protected sendPost(path: string, body: object | FormData): Promise<Response>;
|
|
758
|
+
protected sendPatch(path: string, body: object | FormData): Promise<Response>;
|
|
759
|
+
protected sendPut(path: string, body: object | FormData): Promise<Response>;
|
|
760
|
+
protected sendGet(path: string): Promise<Response>;
|
|
761
|
+
protected sendDelete(path: string): Promise<Response>;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
declare class GptService extends BaseService {
|
|
765
|
+
list(search?: string, limit?: number, offset?: number): Promise<Gpt[]>;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
declare class DatasourceService extends BaseService {
|
|
769
|
+
list(search?: string, limit?: number, offset?: number): Promise<Datasource[]>;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
interface IRealtimeChatBody {
|
|
773
|
+
rtid?: string;
|
|
774
|
+
sdp?: string;
|
|
775
|
+
}
|
|
776
|
+
interface IChatBody extends IRealtimeChatBody {
|
|
777
|
+
id?: string;
|
|
778
|
+
messageId?: string;
|
|
779
|
+
messageRequest?: string;
|
|
780
|
+
msg: string;
|
|
781
|
+
messageHistory?: Pick<Message, 'content' | 'role'>[];
|
|
782
|
+
datasources?: (Datasource | string)[];
|
|
783
|
+
gpt?: string | Gpt;
|
|
784
|
+
agent?: string | Agent;
|
|
785
|
+
llm?: ChatLlm;
|
|
786
|
+
temperature?: number;
|
|
787
|
+
topN?: number;
|
|
788
|
+
useInternet?: boolean;
|
|
789
|
+
behavior?: LlmBehaviorEnum[];
|
|
790
|
+
systemMessage?: string;
|
|
791
|
+
saveSystemMessage?: boolean;
|
|
792
|
+
debug?: boolean;
|
|
793
|
+
tokenLimit?: number;
|
|
794
|
+
outputFormat?: Chat['outputFormat'];
|
|
795
|
+
llmOptions?: any;
|
|
796
|
+
label?: string;
|
|
797
|
+
outputParser?: string;
|
|
798
|
+
excludeReferences?: boolean;
|
|
799
|
+
resetSystemMessage?: boolean;
|
|
800
|
+
additionalAssistantMessage?: string;
|
|
801
|
+
additionalSystemMessage?: string;
|
|
802
|
+
tags?: Chat['tags'];
|
|
803
|
+
regenerate?: boolean;
|
|
804
|
+
noPromptInjectionProtection?: boolean;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
declare enum LlmBehaviorEnum {
|
|
808
|
+
CONVERSATIONAL = "conversational",
|
|
809
|
+
EXPLAINING = "explaining",
|
|
810
|
+
CREATIVE = "creative",
|
|
811
|
+
FORMAL = "formal",
|
|
812
|
+
INFORMAL = "informal",
|
|
813
|
+
TECHNICAL = "technical",
|
|
814
|
+
FRIENDLY = "friendly",
|
|
815
|
+
PROFESSIONAL = "professional",
|
|
816
|
+
HUMOROUS = "humorous"
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
declare class ChatService extends BaseService {
|
|
820
|
+
chat(msg: string, options?: IChatBody, messageMode?: 'user-message'): Promise<Message>;
|
|
821
|
+
chat(msg: string, options?: IChatBody, messageMode?: 'ai-message'): Promise<Message>;
|
|
822
|
+
chat(msg: string, options?: IChatBody, messageMode?: 'all'): Promise<ChatWithMessages>;
|
|
823
|
+
chatWithFile(msg: string, file: Blob, fileName?: string, options?: IChatBody, messageMode?: 'user-message'): Promise<Message>;
|
|
824
|
+
chatWithFile(msg: string, file: Blob, fileName?: string, options?: IChatBody, messageMode?: 'ai-message'): Promise<Message>;
|
|
825
|
+
chatWithFile(msg: string, file: Blob, fileName?: string, options?: IChatBody, messageMode?: 'all'): Promise<ChatWithMessages>;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
declare class AgentService extends BaseService {
|
|
829
|
+
list(search?: string, limit?: number, offset?: number): Promise<Agent[]>;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
declare class One extends BaseService {
|
|
4
833
|
private _services?;
|
|
5
834
|
constructor(instanceId: string, auth: OneAuth, baseUrl?: string);
|
|
6
|
-
get agent():
|
|
7
|
-
get chat():
|
|
8
|
-
get datasource():
|
|
9
|
-
get gpt():
|
|
835
|
+
get agent(): AgentService;
|
|
836
|
+
get chat(): ChatService;
|
|
837
|
+
get datasource(): DatasourceService;
|
|
838
|
+
get gpt(): GptService;
|
|
10
839
|
}
|
|
840
|
+
|
|
841
|
+
export { One };
|