@promptbook/remote-client 0.82.0-0 → 0.82.0-2
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/esm/index.es.js +374 -359
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/remote-client.index.d.ts +9 -3
- package/esm/typings/src/_packages/remote-server.index.d.ts +8 -2
- package/esm/typings/src/_packages/types.index.d.ts +16 -26
- package/esm/typings/src/collection/PipelineCollection.d.ts +2 -0
- package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +6 -3
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +3 -7
- package/esm/typings/src/other/templates/getBookTemplates.d.ts +5 -3
- package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +5 -2
- package/esm/typings/src/remote-server/createRemoteClient.d.ts +10 -0
- package/esm/typings/src/remote-server/{interfaces → socket-types/_common}/PromptbookServer_Error.d.ts +3 -3
- package/esm/typings/src/remote-server/socket-types/_common/PromptbookServer_Progress.d.ts +10 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +49 -0
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +17 -0
- package/esm/typings/src/remote-server/{interfaces → socket-types/listModels}/PromptbookServer_ListModels_Response.d.ts +4 -2
- package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Request.d.ts +17 -0
- package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Response.d.ts +12 -0
- package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts +17 -0
- package/esm/typings/src/remote-server/{interfaces → socket-types/prompt}/PromptbookServer_Prompt_Response.d.ts +3 -3
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +3 -2
- package/esm/typings/src/remote-server/types/RemoteClientOptions.d.ts +32 -0
- package/esm/typings/src/types/Arrayable.d.ts +1 -0
- package/esm/typings/src/types/NonEmptyArray.d.ts +8 -0
- package/package.json +2 -2
- package/umd/index.umd.js +377 -362
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/remote-server/interfaces/PromptbookServer_ListModels_Request.d.ts +0 -38
- package/esm/typings/src/remote-server/interfaces/PromptbookServer_Prompt_Progress.d.ts +0 -12
- package/esm/typings/src/remote-server/interfaces/PromptbookServer_Prompt_Request.d.ts +0 -45
- package/esm/typings/src/remote-server/interfaces/RemoteLlmExecutionToolsOptions.d.ts +0 -54
- /package/esm/typings/src/remote-server/{interfaces → types}/RemoteServerOptions.d.ts +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto-js'), require('crypto-js/enc-hex'), require('papaparse'), require('path')
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto-js', 'crypto-js/enc-hex', 'papaparse', 'path'
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-client"] = {}, global.spaceTrim, global.cryptoJs, global.hexEncoder, global.papaparse, global.path
|
|
5
|
-
})(this, (function (exports, spaceTrim, cryptoJs, hexEncoder, papaparse, path
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('socket.io-client'), require('crypto-js'), require('crypto-js/enc-hex'), require('papaparse'), require('path')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'socket.io-client', 'crypto-js', 'crypto-js/enc-hex', 'papaparse', 'path'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-client"] = {}, global.spaceTrim, global.socket_ioClient, global.cryptoJs, global.hexEncoder, global.papaparse, global.path));
|
|
5
|
+
})(this, (function (exports, spaceTrim, socket_ioClient, cryptoJs, hexEncoder, papaparse, path) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
26
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.82.0-1';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -149,24 +149,155 @@
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
/**
|
|
152
|
-
*
|
|
152
|
+
* This error indicates problems parsing the format value
|
|
153
153
|
*
|
|
154
|
-
*
|
|
154
|
+
* For example, when the format value is not a valid JSON or CSV
|
|
155
|
+
* This is not thrown directly but in extended classes
|
|
155
156
|
*
|
|
156
|
-
*
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
* @public exported from `@promptbook/core`
|
|
158
|
+
*/
|
|
159
|
+
var AbstractFormatError = /** @class */ (function (_super) {
|
|
160
|
+
__extends(AbstractFormatError, _super);
|
|
161
|
+
// Note: To allow instanceof do not put here error `name`
|
|
162
|
+
// public readonly name = 'AbstractFormatError';
|
|
163
|
+
function AbstractFormatError(message) {
|
|
164
|
+
var _this = _super.call(this, message) || this;
|
|
165
|
+
Object.setPrototypeOf(_this, AbstractFormatError.prototype);
|
|
166
|
+
return _this;
|
|
167
|
+
}
|
|
168
|
+
return AbstractFormatError;
|
|
169
|
+
}(Error));
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* This error indicates problem with parsing of CSV
|
|
159
173
|
*
|
|
160
|
-
* @public exported from `@promptbook/
|
|
174
|
+
* @public exported from `@promptbook/core`
|
|
161
175
|
*/
|
|
162
|
-
function
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
176
|
+
var CsvFormatError = /** @class */ (function (_super) {
|
|
177
|
+
__extends(CsvFormatError, _super);
|
|
178
|
+
function CsvFormatError(message) {
|
|
179
|
+
var _this = _super.call(this, message) || this;
|
|
180
|
+
_this.name = 'CsvFormatError';
|
|
181
|
+
Object.setPrototypeOf(_this, CsvFormatError.prototype);
|
|
182
|
+
return _this;
|
|
183
|
+
}
|
|
184
|
+
return CsvFormatError;
|
|
185
|
+
}(AbstractFormatError));
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
189
|
+
*
|
|
190
|
+
* @public exported from `@promptbook/core`
|
|
191
|
+
*/
|
|
192
|
+
var CollectionError = /** @class */ (function (_super) {
|
|
193
|
+
__extends(CollectionError, _super);
|
|
194
|
+
function CollectionError(message) {
|
|
195
|
+
var _this = _super.call(this, message) || this;
|
|
196
|
+
_this.name = 'CollectionError';
|
|
197
|
+
Object.setPrototypeOf(_this, CollectionError.prototype);
|
|
198
|
+
return _this;
|
|
199
|
+
}
|
|
200
|
+
return CollectionError;
|
|
201
|
+
}(Error));
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
205
|
+
*
|
|
206
|
+
* @public exported from `@promptbook/core`
|
|
207
|
+
*/
|
|
208
|
+
var EnvironmentMismatchError = /** @class */ (function (_super) {
|
|
209
|
+
__extends(EnvironmentMismatchError, _super);
|
|
210
|
+
function EnvironmentMismatchError(message) {
|
|
211
|
+
var _this = _super.call(this, message) || this;
|
|
212
|
+
_this.name = 'EnvironmentMismatchError';
|
|
213
|
+
Object.setPrototypeOf(_this, EnvironmentMismatchError.prototype);
|
|
214
|
+
return _this;
|
|
215
|
+
}
|
|
216
|
+
return EnvironmentMismatchError;
|
|
217
|
+
}(Error));
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
221
|
+
*
|
|
222
|
+
* @public exported from `@promptbook/core`
|
|
223
|
+
* Note: Do not throw this error, its reserved for `checkExpectations` and `createPipelineExecutor` and public ONLY to be serializable through remote server
|
|
224
|
+
* Note: Always thrown in `checkExpectations` and catched in `createPipelineExecutor` and rethrown as `PipelineExecutionError`
|
|
225
|
+
* Note: This is a kindof subtype of PipelineExecutionError
|
|
226
|
+
*/
|
|
227
|
+
var ExpectError = /** @class */ (function (_super) {
|
|
228
|
+
__extends(ExpectError, _super);
|
|
229
|
+
function ExpectError(message) {
|
|
230
|
+
var _this = _super.call(this, message) || this;
|
|
231
|
+
_this.name = 'ExpectError';
|
|
232
|
+
Object.setPrototypeOf(_this, ExpectError.prototype);
|
|
233
|
+
return _this;
|
|
234
|
+
}
|
|
235
|
+
return ExpectError;
|
|
236
|
+
}(Error));
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* This error indicates that the promptbook can not retrieve knowledge from external sources
|
|
240
|
+
*
|
|
241
|
+
* @public exported from `@promptbook/core`
|
|
242
|
+
*/
|
|
243
|
+
var KnowledgeScrapeError = /** @class */ (function (_super) {
|
|
244
|
+
__extends(KnowledgeScrapeError, _super);
|
|
245
|
+
function KnowledgeScrapeError(message) {
|
|
246
|
+
var _this = _super.call(this, message) || this;
|
|
247
|
+
_this.name = 'KnowledgeScrapeError';
|
|
248
|
+
Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
|
|
249
|
+
return _this;
|
|
250
|
+
}
|
|
251
|
+
return KnowledgeScrapeError;
|
|
252
|
+
}(Error));
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* This error type indicates that some limit was reached
|
|
256
|
+
*
|
|
257
|
+
* @public exported from `@promptbook/core`
|
|
258
|
+
*/
|
|
259
|
+
var LimitReachedError = /** @class */ (function (_super) {
|
|
260
|
+
__extends(LimitReachedError, _super);
|
|
261
|
+
function LimitReachedError(message) {
|
|
262
|
+
var _this = _super.call(this, message) || this;
|
|
263
|
+
_this.name = 'LimitReachedError';
|
|
264
|
+
Object.setPrototypeOf(_this, LimitReachedError.prototype);
|
|
265
|
+
return _this;
|
|
266
|
+
}
|
|
267
|
+
return LimitReachedError;
|
|
268
|
+
}(Error));
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* This error type indicates that some tools are missing for pipeline execution or preparation
|
|
272
|
+
*
|
|
273
|
+
* @public exported from `@promptbook/core`
|
|
274
|
+
*/
|
|
275
|
+
var MissingToolsError = /** @class */ (function (_super) {
|
|
276
|
+
__extends(MissingToolsError, _super);
|
|
277
|
+
function MissingToolsError(message) {
|
|
278
|
+
var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: You have probbably forgot to provide some tools for pipeline execution or preparation\n\n "); })) || this;
|
|
279
|
+
_this.name = 'MissingToolsError';
|
|
280
|
+
Object.setPrototypeOf(_this, MissingToolsError.prototype);
|
|
281
|
+
return _this;
|
|
282
|
+
}
|
|
283
|
+
return MissingToolsError;
|
|
284
|
+
}(Error));
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* This error indicates that promptbook not found in the collection
|
|
288
|
+
*
|
|
289
|
+
* @public exported from `@promptbook/core`
|
|
290
|
+
*/
|
|
291
|
+
var NotFoundError = /** @class */ (function (_super) {
|
|
292
|
+
__extends(NotFoundError, _super);
|
|
293
|
+
function NotFoundError(message) {
|
|
294
|
+
var _this = _super.call(this, message) || this;
|
|
295
|
+
_this.name = 'NotFoundError';
|
|
296
|
+
Object.setPrototypeOf(_this, NotFoundError.prototype);
|
|
297
|
+
return _this;
|
|
298
|
+
}
|
|
299
|
+
return NotFoundError;
|
|
300
|
+
}(Error));
|
|
170
301
|
|
|
171
302
|
/**
|
|
172
303
|
* This error type indicates that some part of the code is not implemented yet
|
|
@@ -203,6 +334,54 @@
|
|
|
203
334
|
* TODO: Maybe split `ParseError` and `ApplyError`
|
|
204
335
|
*/
|
|
205
336
|
|
|
337
|
+
/**
|
|
338
|
+
* This error indicates errors during the execution of the pipeline
|
|
339
|
+
*
|
|
340
|
+
* @public exported from `@promptbook/core`
|
|
341
|
+
*/
|
|
342
|
+
var PipelineExecutionError = /** @class */ (function (_super) {
|
|
343
|
+
__extends(PipelineExecutionError, _super);
|
|
344
|
+
function PipelineExecutionError(message) {
|
|
345
|
+
var _this = _super.call(this, message) || this;
|
|
346
|
+
_this.name = 'PipelineExecutionError';
|
|
347
|
+
Object.setPrototypeOf(_this, PipelineExecutionError.prototype);
|
|
348
|
+
return _this;
|
|
349
|
+
}
|
|
350
|
+
return PipelineExecutionError;
|
|
351
|
+
}(Error));
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
|
|
355
|
+
*
|
|
356
|
+
* @public exported from `@promptbook/core`
|
|
357
|
+
*/
|
|
358
|
+
var PipelineLogicError = /** @class */ (function (_super) {
|
|
359
|
+
__extends(PipelineLogicError, _super);
|
|
360
|
+
function PipelineLogicError(message) {
|
|
361
|
+
var _this = _super.call(this, message) || this;
|
|
362
|
+
_this.name = 'PipelineLogicError';
|
|
363
|
+
Object.setPrototypeOf(_this, PipelineLogicError.prototype);
|
|
364
|
+
return _this;
|
|
365
|
+
}
|
|
366
|
+
return PipelineLogicError;
|
|
367
|
+
}(Error));
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* This error indicates errors in referencing promptbooks between each other
|
|
371
|
+
*
|
|
372
|
+
* @public exported from `@promptbook/core`
|
|
373
|
+
*/
|
|
374
|
+
var PipelineUrlError = /** @class */ (function (_super) {
|
|
375
|
+
__extends(PipelineUrlError, _super);
|
|
376
|
+
function PipelineUrlError(message) {
|
|
377
|
+
var _this = _super.call(this, message) || this;
|
|
378
|
+
_this.name = 'PipelineUrlError';
|
|
379
|
+
Object.setPrototypeOf(_this, PipelineUrlError.prototype);
|
|
380
|
+
return _this;
|
|
381
|
+
}
|
|
382
|
+
return PipelineUrlError;
|
|
383
|
+
}(Error));
|
|
384
|
+
|
|
206
385
|
/**
|
|
207
386
|
* Returns the same value that is passed as argument.
|
|
208
387
|
* No side effects.
|
|
@@ -313,6 +492,155 @@
|
|
|
313
492
|
return UnexpectedError;
|
|
314
493
|
}(Error));
|
|
315
494
|
|
|
495
|
+
/**
|
|
496
|
+
* Index of all custom errors
|
|
497
|
+
*
|
|
498
|
+
* @public exported from `@promptbook/core`
|
|
499
|
+
*/
|
|
500
|
+
var PROMPTBOOK_ERRORS = {
|
|
501
|
+
AbstractFormatError: AbstractFormatError,
|
|
502
|
+
CsvFormatError: CsvFormatError,
|
|
503
|
+
CollectionError: CollectionError,
|
|
504
|
+
EnvironmentMismatchError: EnvironmentMismatchError,
|
|
505
|
+
ExpectError: ExpectError,
|
|
506
|
+
KnowledgeScrapeError: KnowledgeScrapeError,
|
|
507
|
+
LimitReachedError: LimitReachedError,
|
|
508
|
+
MissingToolsError: MissingToolsError,
|
|
509
|
+
NotFoundError: NotFoundError,
|
|
510
|
+
NotYetImplementedError: NotYetImplementedError,
|
|
511
|
+
ParseError: ParseError,
|
|
512
|
+
PipelineExecutionError: PipelineExecutionError,
|
|
513
|
+
PipelineLogicError: PipelineLogicError,
|
|
514
|
+
PipelineUrlError: PipelineUrlError,
|
|
515
|
+
UnexpectedError: UnexpectedError,
|
|
516
|
+
// TODO: [🪑]> VersionMismatchError,
|
|
517
|
+
};
|
|
518
|
+
/**
|
|
519
|
+
* Index of all javascript errors
|
|
520
|
+
*
|
|
521
|
+
* @private for internal usage
|
|
522
|
+
*/
|
|
523
|
+
var COMMON_JAVASCRIPT_ERRORS = {
|
|
524
|
+
Error: Error,
|
|
525
|
+
EvalError: EvalError,
|
|
526
|
+
RangeError: RangeError,
|
|
527
|
+
ReferenceError: ReferenceError,
|
|
528
|
+
SyntaxError: SyntaxError,
|
|
529
|
+
TypeError: TypeError,
|
|
530
|
+
URIError: URIError,
|
|
531
|
+
AggregateError: AggregateError,
|
|
532
|
+
/*
|
|
533
|
+
Note: Not widely supported
|
|
534
|
+
> InternalError,
|
|
535
|
+
> ModuleError,
|
|
536
|
+
> HeapError,
|
|
537
|
+
> WebAssemblyCompileError,
|
|
538
|
+
> WebAssemblyRuntimeError,
|
|
539
|
+
*/
|
|
540
|
+
};
|
|
541
|
+
/**
|
|
542
|
+
* Index of all errors
|
|
543
|
+
*
|
|
544
|
+
* @private for internal usage
|
|
545
|
+
*/
|
|
546
|
+
var ALL_ERRORS = __assign(__assign({}, PROMPTBOOK_ERRORS), COMMON_JAVASCRIPT_ERRORS);
|
|
547
|
+
/**
|
|
548
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
549
|
+
*/
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Deserializes the error object
|
|
553
|
+
*
|
|
554
|
+
* @public exported from `@promptbook/utils`
|
|
555
|
+
*/
|
|
556
|
+
function deserializeError(error) {
|
|
557
|
+
var ErrorClass = ALL_ERRORS[error.name];
|
|
558
|
+
if (ErrorClass === undefined) {
|
|
559
|
+
return new Error("".concat(error.name, ": ").concat(error.message));
|
|
560
|
+
}
|
|
561
|
+
return new ErrorClass(error.message);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Creates a connection to the remote proxy server.
|
|
566
|
+
*
|
|
567
|
+
* Note: This function creates a connection to the remote server and returns a socket but responsibility of closing the connection is on the caller
|
|
568
|
+
*
|
|
569
|
+
* @private internal utility function
|
|
570
|
+
*/
|
|
571
|
+
function createRemoteClient(options) {
|
|
572
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
573
|
+
var remoteUrl, path;
|
|
574
|
+
return __generator(this, function (_a) {
|
|
575
|
+
remoteUrl = options.remoteUrl, path = options.path;
|
|
576
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
577
|
+
var socket = socket_ioClient.io(remoteUrl, {
|
|
578
|
+
retries: CONNECTION_RETRIES_LIMIT,
|
|
579
|
+
timeout: CONNECTION_TIMEOUT_MS,
|
|
580
|
+
path: path,
|
|
581
|
+
// path: `${this.remoteUrl.pathname}/socket.io`,
|
|
582
|
+
transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
|
|
583
|
+
});
|
|
584
|
+
// console.log('Connecting to', this.options.remoteUrl.href, { socket });
|
|
585
|
+
socket.on('connect', function () {
|
|
586
|
+
resolve(socket);
|
|
587
|
+
});
|
|
588
|
+
// TODO: [💩] Better timeout handling
|
|
589
|
+
setTimeout(function () {
|
|
590
|
+
reject(new Error("Timeout while connecting to ".concat(remoteUrl)));
|
|
591
|
+
}, CONNECTION_TIMEOUT_MS);
|
|
592
|
+
})];
|
|
593
|
+
});
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Prepare pipeline on remote server
|
|
599
|
+
*
|
|
600
|
+
* @see https://github.com/webgptorg/promptbook/discussions/196
|
|
601
|
+
*
|
|
602
|
+
* Note: This function does not validate logic of the pipeline
|
|
603
|
+
* Note: This function acts as part of compilation process
|
|
604
|
+
* Note: When the pipeline is already prepared, it returns the same pipeline
|
|
605
|
+
*
|
|
606
|
+
* @public exported from `@promptbook/remote-client`
|
|
607
|
+
*/
|
|
608
|
+
function preparePipelineOnRemoteServer(pipeline, options) {
|
|
609
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
610
|
+
var socket, preparedPipeline;
|
|
611
|
+
return __generator(this, function (_a) {
|
|
612
|
+
switch (_a.label) {
|
|
613
|
+
case 0:
|
|
614
|
+
return [4 /*yield*/, createRemoteClient(options)];
|
|
615
|
+
case 1:
|
|
616
|
+
socket = _a.sent();
|
|
617
|
+
socket.emit('preparePipeline-request', {
|
|
618
|
+
identification: options.identification,
|
|
619
|
+
pipeline: pipeline,
|
|
620
|
+
} /* <- Note: [🤛] */);
|
|
621
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
622
|
+
socket.on('preparePipeline-response', function (response) {
|
|
623
|
+
resolve(response.preparedPipeline);
|
|
624
|
+
socket.disconnect();
|
|
625
|
+
});
|
|
626
|
+
socket.on('error', function (error) {
|
|
627
|
+
reject(deserializeError(error));
|
|
628
|
+
socket.disconnect();
|
|
629
|
+
});
|
|
630
|
+
})];
|
|
631
|
+
case 2:
|
|
632
|
+
preparedPipeline = _a.sent();
|
|
633
|
+
socket.disconnect();
|
|
634
|
+
// TODO: !!!!!! do $exportJson
|
|
635
|
+
return [2 /*return*/, preparedPipeline];
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* TODO: !!!! Do not return Promise<PipelineJson> But PreparePipelineTask
|
|
642
|
+
*/
|
|
643
|
+
|
|
316
644
|
/**
|
|
317
645
|
* All available task types
|
|
318
646
|
*
|
|
@@ -1465,59 +1793,23 @@
|
|
|
1465
1793
|
$taskJson.expectations[unit].max = command.amount;
|
|
1466
1794
|
}
|
|
1467
1795
|
},
|
|
1468
|
-
/**
|
|
1469
|
-
* Converts the FORMAT command back to string
|
|
1470
|
-
*
|
|
1471
|
-
* Note: This is used in `pipelineJsonToString` utility
|
|
1472
|
-
*/
|
|
1473
|
-
stringify: function (command) {
|
|
1474
|
-
return "---"; // <- TODO: [🛋] Implement
|
|
1475
|
-
},
|
|
1476
|
-
/**
|
|
1477
|
-
* Reads the FORMAT command from the `TaskJson`
|
|
1478
|
-
*
|
|
1479
|
-
* Note: This is used in `pipelineJsonToString` utility
|
|
1480
|
-
*/
|
|
1481
|
-
takeFromTaskJson: function ($taskJson) {
|
|
1482
|
-
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
1483
|
-
},
|
|
1484
|
-
};
|
|
1485
|
-
|
|
1486
|
-
/**
|
|
1487
|
-
* This error indicates problems parsing the format value
|
|
1488
|
-
*
|
|
1489
|
-
* For example, when the format value is not a valid JSON or CSV
|
|
1490
|
-
* This is not thrown directly but in extended classes
|
|
1491
|
-
*
|
|
1492
|
-
* @public exported from `@promptbook/core`
|
|
1493
|
-
*/
|
|
1494
|
-
var AbstractFormatError = /** @class */ (function (_super) {
|
|
1495
|
-
__extends(AbstractFormatError, _super);
|
|
1496
|
-
// Note: To allow instanceof do not put here error `name`
|
|
1497
|
-
// public readonly name = 'AbstractFormatError';
|
|
1498
|
-
function AbstractFormatError(message) {
|
|
1499
|
-
var _this = _super.call(this, message) || this;
|
|
1500
|
-
Object.setPrototypeOf(_this, AbstractFormatError.prototype);
|
|
1501
|
-
return _this;
|
|
1502
|
-
}
|
|
1503
|
-
return AbstractFormatError;
|
|
1504
|
-
}(Error));
|
|
1505
|
-
|
|
1506
|
-
/**
|
|
1507
|
-
* This error indicates problem with parsing of CSV
|
|
1508
|
-
*
|
|
1509
|
-
* @public exported from `@promptbook/core`
|
|
1510
|
-
*/
|
|
1511
|
-
var CsvFormatError = /** @class */ (function (_super) {
|
|
1512
|
-
__extends(CsvFormatError, _super);
|
|
1513
|
-
function CsvFormatError(message) {
|
|
1514
|
-
var _this = _super.call(this, message) || this;
|
|
1515
|
-
_this.name = 'CsvFormatError';
|
|
1516
|
-
Object.setPrototypeOf(_this, CsvFormatError.prototype);
|
|
1517
|
-
return _this;
|
|
1518
|
-
}
|
|
1519
|
-
return CsvFormatError;
|
|
1520
|
-
}(AbstractFormatError));
|
|
1796
|
+
/**
|
|
1797
|
+
* Converts the FORMAT command back to string
|
|
1798
|
+
*
|
|
1799
|
+
* Note: This is used in `pipelineJsonToString` utility
|
|
1800
|
+
*/
|
|
1801
|
+
stringify: function (command) {
|
|
1802
|
+
return "---"; // <- TODO: [🛋] Implement
|
|
1803
|
+
},
|
|
1804
|
+
/**
|
|
1805
|
+
* Reads the FORMAT command from the `TaskJson`
|
|
1806
|
+
*
|
|
1807
|
+
* Note: This is used in `pipelineJsonToString` utility
|
|
1808
|
+
*/
|
|
1809
|
+
takeFromTaskJson: function ($taskJson) {
|
|
1810
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
1811
|
+
},
|
|
1812
|
+
};
|
|
1521
1813
|
|
|
1522
1814
|
/**
|
|
1523
1815
|
* @@@
|
|
@@ -5238,7 +5530,7 @@
|
|
|
5238
5530
|
* Note: This function acts as compilation process
|
|
5239
5531
|
*
|
|
5240
5532
|
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
5241
|
-
* @param options -
|
|
5533
|
+
* @param options - Configuration of the remote server
|
|
5242
5534
|
* @returns {Promptbook} compiled in JSON format (.book.json)
|
|
5243
5535
|
* @throws {ParseError} if the promptbook string is not valid
|
|
5244
5536
|
* @public exported from `@promptbook/remote-client`
|
|
@@ -5250,7 +5542,7 @@
|
|
|
5250
5542
|
switch (_a.label) {
|
|
5251
5543
|
case 0:
|
|
5252
5544
|
pipelineJson = parsePipeline(pipelineString);
|
|
5253
|
-
return [4 /*yield*/, preparePipelineOnRemoteServer(pipelineJson)];
|
|
5545
|
+
return [4 /*yield*/, preparePipelineOnRemoteServer(pipelineJson, options)];
|
|
5254
5546
|
case 1:
|
|
5255
5547
|
pipelineJson = _a.sent();
|
|
5256
5548
|
// Note: No need to use `$exportJson` because `parsePipeline` and `preparePipeline` already do that
|
|
@@ -5259,238 +5551,9 @@
|
|
|
5259
5551
|
});
|
|
5260
5552
|
});
|
|
5261
5553
|
}
|
|
5262
|
-
|
|
5263
|
-
/**
|
|
5264
|
-
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
5265
|
-
*
|
|
5266
|
-
* @public exported from `@promptbook/core`
|
|
5267
|
-
*/
|
|
5268
|
-
var CollectionError = /** @class */ (function (_super) {
|
|
5269
|
-
__extends(CollectionError, _super);
|
|
5270
|
-
function CollectionError(message) {
|
|
5271
|
-
var _this = _super.call(this, message) || this;
|
|
5272
|
-
_this.name = 'CollectionError';
|
|
5273
|
-
Object.setPrototypeOf(_this, CollectionError.prototype);
|
|
5274
|
-
return _this;
|
|
5275
|
-
}
|
|
5276
|
-
return CollectionError;
|
|
5277
|
-
}(Error));
|
|
5278
|
-
|
|
5279
|
-
/**
|
|
5280
|
-
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
5281
|
-
*
|
|
5282
|
-
* @public exported from `@promptbook/core`
|
|
5283
|
-
*/
|
|
5284
|
-
var EnvironmentMismatchError = /** @class */ (function (_super) {
|
|
5285
|
-
__extends(EnvironmentMismatchError, _super);
|
|
5286
|
-
function EnvironmentMismatchError(message) {
|
|
5287
|
-
var _this = _super.call(this, message) || this;
|
|
5288
|
-
_this.name = 'EnvironmentMismatchError';
|
|
5289
|
-
Object.setPrototypeOf(_this, EnvironmentMismatchError.prototype);
|
|
5290
|
-
return _this;
|
|
5291
|
-
}
|
|
5292
|
-
return EnvironmentMismatchError;
|
|
5293
|
-
}(Error));
|
|
5294
|
-
|
|
5295
|
-
/**
|
|
5296
|
-
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
5297
|
-
*
|
|
5298
|
-
* @public exported from `@promptbook/core`
|
|
5299
|
-
* Note: Do not throw this error, its reserved for `checkExpectations` and `createPipelineExecutor` and public ONLY to be serializable through remote server
|
|
5300
|
-
* Note: Always thrown in `checkExpectations` and catched in `createPipelineExecutor` and rethrown as `PipelineExecutionError`
|
|
5301
|
-
* Note: This is a kindof subtype of PipelineExecutionError
|
|
5302
|
-
*/
|
|
5303
|
-
var ExpectError = /** @class */ (function (_super) {
|
|
5304
|
-
__extends(ExpectError, _super);
|
|
5305
|
-
function ExpectError(message) {
|
|
5306
|
-
var _this = _super.call(this, message) || this;
|
|
5307
|
-
_this.name = 'ExpectError';
|
|
5308
|
-
Object.setPrototypeOf(_this, ExpectError.prototype);
|
|
5309
|
-
return _this;
|
|
5310
|
-
}
|
|
5311
|
-
return ExpectError;
|
|
5312
|
-
}(Error));
|
|
5313
|
-
|
|
5314
|
-
/**
|
|
5315
|
-
* This error indicates that the promptbook can not retrieve knowledge from external sources
|
|
5316
|
-
*
|
|
5317
|
-
* @public exported from `@promptbook/core`
|
|
5318
|
-
*/
|
|
5319
|
-
var KnowledgeScrapeError = /** @class */ (function (_super) {
|
|
5320
|
-
__extends(KnowledgeScrapeError, _super);
|
|
5321
|
-
function KnowledgeScrapeError(message) {
|
|
5322
|
-
var _this = _super.call(this, message) || this;
|
|
5323
|
-
_this.name = 'KnowledgeScrapeError';
|
|
5324
|
-
Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
|
|
5325
|
-
return _this;
|
|
5326
|
-
}
|
|
5327
|
-
return KnowledgeScrapeError;
|
|
5328
|
-
}(Error));
|
|
5329
|
-
|
|
5330
|
-
/**
|
|
5331
|
-
* This error type indicates that some limit was reached
|
|
5332
|
-
*
|
|
5333
|
-
* @public exported from `@promptbook/core`
|
|
5334
|
-
*/
|
|
5335
|
-
var LimitReachedError = /** @class */ (function (_super) {
|
|
5336
|
-
__extends(LimitReachedError, _super);
|
|
5337
|
-
function LimitReachedError(message) {
|
|
5338
|
-
var _this = _super.call(this, message) || this;
|
|
5339
|
-
_this.name = 'LimitReachedError';
|
|
5340
|
-
Object.setPrototypeOf(_this, LimitReachedError.prototype);
|
|
5341
|
-
return _this;
|
|
5342
|
-
}
|
|
5343
|
-
return LimitReachedError;
|
|
5344
|
-
}(Error));
|
|
5345
|
-
|
|
5346
|
-
/**
|
|
5347
|
-
* This error type indicates that some tools are missing for pipeline execution or preparation
|
|
5348
|
-
*
|
|
5349
|
-
* @public exported from `@promptbook/core`
|
|
5350
|
-
*/
|
|
5351
|
-
var MissingToolsError = /** @class */ (function (_super) {
|
|
5352
|
-
__extends(MissingToolsError, _super);
|
|
5353
|
-
function MissingToolsError(message) {
|
|
5354
|
-
var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: You have probbably forgot to provide some tools for pipeline execution or preparation\n\n "); })) || this;
|
|
5355
|
-
_this.name = 'MissingToolsError';
|
|
5356
|
-
Object.setPrototypeOf(_this, MissingToolsError.prototype);
|
|
5357
|
-
return _this;
|
|
5358
|
-
}
|
|
5359
|
-
return MissingToolsError;
|
|
5360
|
-
}(Error));
|
|
5361
|
-
|
|
5362
|
-
/**
|
|
5363
|
-
* This error indicates that promptbook not found in the collection
|
|
5364
|
-
*
|
|
5365
|
-
* @public exported from `@promptbook/core`
|
|
5366
|
-
*/
|
|
5367
|
-
var NotFoundError = /** @class */ (function (_super) {
|
|
5368
|
-
__extends(NotFoundError, _super);
|
|
5369
|
-
function NotFoundError(message) {
|
|
5370
|
-
var _this = _super.call(this, message) || this;
|
|
5371
|
-
_this.name = 'NotFoundError';
|
|
5372
|
-
Object.setPrototypeOf(_this, NotFoundError.prototype);
|
|
5373
|
-
return _this;
|
|
5374
|
-
}
|
|
5375
|
-
return NotFoundError;
|
|
5376
|
-
}(Error));
|
|
5377
|
-
|
|
5378
|
-
/**
|
|
5379
|
-
* This error indicates errors during the execution of the pipeline
|
|
5380
|
-
*
|
|
5381
|
-
* @public exported from `@promptbook/core`
|
|
5382
|
-
*/
|
|
5383
|
-
var PipelineExecutionError = /** @class */ (function (_super) {
|
|
5384
|
-
__extends(PipelineExecutionError, _super);
|
|
5385
|
-
function PipelineExecutionError(message) {
|
|
5386
|
-
var _this = _super.call(this, message) || this;
|
|
5387
|
-
_this.name = 'PipelineExecutionError';
|
|
5388
|
-
Object.setPrototypeOf(_this, PipelineExecutionError.prototype);
|
|
5389
|
-
return _this;
|
|
5390
|
-
}
|
|
5391
|
-
return PipelineExecutionError;
|
|
5392
|
-
}(Error));
|
|
5393
|
-
|
|
5394
|
-
/**
|
|
5395
|
-
* This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
|
|
5396
|
-
*
|
|
5397
|
-
* @public exported from `@promptbook/core`
|
|
5398
|
-
*/
|
|
5399
|
-
var PipelineLogicError = /** @class */ (function (_super) {
|
|
5400
|
-
__extends(PipelineLogicError, _super);
|
|
5401
|
-
function PipelineLogicError(message) {
|
|
5402
|
-
var _this = _super.call(this, message) || this;
|
|
5403
|
-
_this.name = 'PipelineLogicError';
|
|
5404
|
-
Object.setPrototypeOf(_this, PipelineLogicError.prototype);
|
|
5405
|
-
return _this;
|
|
5406
|
-
}
|
|
5407
|
-
return PipelineLogicError;
|
|
5408
|
-
}(Error));
|
|
5409
|
-
|
|
5410
|
-
/**
|
|
5411
|
-
* This error indicates errors in referencing promptbooks between each other
|
|
5412
|
-
*
|
|
5413
|
-
* @public exported from `@promptbook/core`
|
|
5414
|
-
*/
|
|
5415
|
-
var PipelineUrlError = /** @class */ (function (_super) {
|
|
5416
|
-
__extends(PipelineUrlError, _super);
|
|
5417
|
-
function PipelineUrlError(message) {
|
|
5418
|
-
var _this = _super.call(this, message) || this;
|
|
5419
|
-
_this.name = 'PipelineUrlError';
|
|
5420
|
-
Object.setPrototypeOf(_this, PipelineUrlError.prototype);
|
|
5421
|
-
return _this;
|
|
5422
|
-
}
|
|
5423
|
-
return PipelineUrlError;
|
|
5424
|
-
}(Error));
|
|
5425
|
-
|
|
5426
|
-
/**
|
|
5427
|
-
* Index of all custom errors
|
|
5428
|
-
*
|
|
5429
|
-
* @public exported from `@promptbook/core`
|
|
5430
|
-
*/
|
|
5431
|
-
var PROMPTBOOK_ERRORS = {
|
|
5432
|
-
AbstractFormatError: AbstractFormatError,
|
|
5433
|
-
CsvFormatError: CsvFormatError,
|
|
5434
|
-
CollectionError: CollectionError,
|
|
5435
|
-
EnvironmentMismatchError: EnvironmentMismatchError,
|
|
5436
|
-
ExpectError: ExpectError,
|
|
5437
|
-
KnowledgeScrapeError: KnowledgeScrapeError,
|
|
5438
|
-
LimitReachedError: LimitReachedError,
|
|
5439
|
-
MissingToolsError: MissingToolsError,
|
|
5440
|
-
NotFoundError: NotFoundError,
|
|
5441
|
-
NotYetImplementedError: NotYetImplementedError,
|
|
5442
|
-
ParseError: ParseError,
|
|
5443
|
-
PipelineExecutionError: PipelineExecutionError,
|
|
5444
|
-
PipelineLogicError: PipelineLogicError,
|
|
5445
|
-
PipelineUrlError: PipelineUrlError,
|
|
5446
|
-
UnexpectedError: UnexpectedError,
|
|
5447
|
-
// TODO: [🪑]> VersionMismatchError,
|
|
5448
|
-
};
|
|
5449
|
-
/**
|
|
5450
|
-
* Index of all javascript errors
|
|
5451
|
-
*
|
|
5452
|
-
* @private for internal usage
|
|
5453
|
-
*/
|
|
5454
|
-
var COMMON_JAVASCRIPT_ERRORS = {
|
|
5455
|
-
Error: Error,
|
|
5456
|
-
EvalError: EvalError,
|
|
5457
|
-
RangeError: RangeError,
|
|
5458
|
-
ReferenceError: ReferenceError,
|
|
5459
|
-
SyntaxError: SyntaxError,
|
|
5460
|
-
TypeError: TypeError,
|
|
5461
|
-
URIError: URIError,
|
|
5462
|
-
AggregateError: AggregateError,
|
|
5463
|
-
/*
|
|
5464
|
-
Note: Not widely supported
|
|
5465
|
-
> InternalError,
|
|
5466
|
-
> ModuleError,
|
|
5467
|
-
> HeapError,
|
|
5468
|
-
> WebAssemblyCompileError,
|
|
5469
|
-
> WebAssemblyRuntimeError,
|
|
5470
|
-
*/
|
|
5471
|
-
};
|
|
5472
|
-
/**
|
|
5473
|
-
* Index of all errors
|
|
5474
|
-
*
|
|
5475
|
-
* @private for internal usage
|
|
5476
|
-
*/
|
|
5477
|
-
var ALL_ERRORS = __assign(__assign({}, PROMPTBOOK_ERRORS), COMMON_JAVASCRIPT_ERRORS);
|
|
5478
|
-
/**
|
|
5479
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
5480
|
-
*/
|
|
5481
|
-
|
|
5482
5554
|
/**
|
|
5483
|
-
*
|
|
5484
|
-
*
|
|
5485
|
-
* @public exported from `@promptbook/utils`
|
|
5555
|
+
* TODO: !!!! Do not return Promise<PipelineJson> But PreparePipelineTask
|
|
5486
5556
|
*/
|
|
5487
|
-
function deserializeError(error) {
|
|
5488
|
-
var ErrorClass = ALL_ERRORS[error.name];
|
|
5489
|
-
if (ErrorClass === undefined) {
|
|
5490
|
-
return new Error("".concat(error.name, ": ").concat(error.message));
|
|
5491
|
-
}
|
|
5492
|
-
return new ErrorClass(error.message);
|
|
5493
|
-
}
|
|
5494
5557
|
|
|
5495
5558
|
/**
|
|
5496
5559
|
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
@@ -5529,7 +5592,7 @@
|
|
|
5529
5592
|
var socket;
|
|
5530
5593
|
return __generator(this, function (_a) {
|
|
5531
5594
|
switch (_a.label) {
|
|
5532
|
-
case 0: return [4 /*yield*/, this.
|
|
5595
|
+
case 0: return [4 /*yield*/, createRemoteClient(this.options)];
|
|
5533
5596
|
case 1:
|
|
5534
5597
|
socket = _a.sent();
|
|
5535
5598
|
socket.disconnect();
|
|
@@ -5546,24 +5609,12 @@
|
|
|
5546
5609
|
var socket, promptResult;
|
|
5547
5610
|
return __generator(this, function (_a) {
|
|
5548
5611
|
switch (_a.label) {
|
|
5549
|
-
case 0: return [4 /*yield*/, this.
|
|
5612
|
+
case 0: return [4 /*yield*/, createRemoteClient(this.options)];
|
|
5550
5613
|
case 1:
|
|
5551
5614
|
socket = _a.sent();
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
userId: this.options.userId,
|
|
5556
|
-
llmToolsConfiguration: this.options.llmToolsConfiguration,
|
|
5557
|
-
} /* <- Note: [🤛] */);
|
|
5558
|
-
}
|
|
5559
|
-
else {
|
|
5560
|
-
socket.emit('listModels-request', {
|
|
5561
|
-
isAnonymous: false,
|
|
5562
|
-
appId: this.options.appId,
|
|
5563
|
-
userId: this.options.userId,
|
|
5564
|
-
customOptions: this.options.customOptions,
|
|
5565
|
-
} /* <- Note: [🤛] */);
|
|
5566
|
-
}
|
|
5615
|
+
socket.emit('listModels-request', {
|
|
5616
|
+
identification: this.options.identification,
|
|
5617
|
+
} /* <- Note: [🤛] */);
|
|
5567
5618
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
5568
5619
|
socket.on('listModels-response', function (response) {
|
|
5569
5620
|
resolve(response.models);
|
|
@@ -5582,29 +5633,6 @@
|
|
|
5582
5633
|
});
|
|
5583
5634
|
});
|
|
5584
5635
|
};
|
|
5585
|
-
/**
|
|
5586
|
-
* Creates a connection to the remote proxy server.
|
|
5587
|
-
*/
|
|
5588
|
-
RemoteLlmExecutionTools.prototype.makeConnection = function () {
|
|
5589
|
-
var _this = this;
|
|
5590
|
-
return new Promise(function (resolve, reject) {
|
|
5591
|
-
var socket = socket_ioClient.io(_this.options.remoteUrl, {
|
|
5592
|
-
retries: CONNECTION_RETRIES_LIMIT,
|
|
5593
|
-
timeout: CONNECTION_TIMEOUT_MS,
|
|
5594
|
-
path: _this.options.path,
|
|
5595
|
-
// path: `${this.remoteUrl.pathname}/socket.io`,
|
|
5596
|
-
transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
|
|
5597
|
-
});
|
|
5598
|
-
// console.log('Connecting to', this.options.remoteUrl.href, { socket });
|
|
5599
|
-
socket.on('connect', function () {
|
|
5600
|
-
resolve(socket);
|
|
5601
|
-
});
|
|
5602
|
-
// TODO: [💩] Better timeout handling
|
|
5603
|
-
setTimeout(function () {
|
|
5604
|
-
reject(new Error("Timeout while connecting to ".concat(_this.options.remoteUrl)));
|
|
5605
|
-
}, CONNECTION_TIMEOUT_MS);
|
|
5606
|
-
});
|
|
5607
|
-
};
|
|
5608
5636
|
/**
|
|
5609
5637
|
* Calls remote proxy server to use a chat model
|
|
5610
5638
|
*/
|
|
@@ -5641,26 +5669,13 @@
|
|
|
5641
5669
|
var socket, promptResult;
|
|
5642
5670
|
return __generator(this, function (_a) {
|
|
5643
5671
|
switch (_a.label) {
|
|
5644
|
-
case 0: return [4 /*yield*/, this.
|
|
5672
|
+
case 0: return [4 /*yield*/, createRemoteClient(this.options)];
|
|
5645
5673
|
case 1:
|
|
5646
5674
|
socket = _a.sent();
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
llmToolsConfiguration: this.options.llmToolsConfiguration,
|
|
5652
|
-
prompt: prompt,
|
|
5653
|
-
} /* <- Note: [🤛] */);
|
|
5654
|
-
}
|
|
5655
|
-
else {
|
|
5656
|
-
socket.emit('prompt-request', {
|
|
5657
|
-
isAnonymous: false,
|
|
5658
|
-
appId: this.options.appId,
|
|
5659
|
-
userId: this.options.userId,
|
|
5660
|
-
customOptions: this.options.customOptions,
|
|
5661
|
-
prompt: prompt,
|
|
5662
|
-
} /* <- Note: [🤛] */);
|
|
5663
|
-
}
|
|
5675
|
+
socket.emit('prompt-request', {
|
|
5676
|
+
identification: this.options.identification,
|
|
5677
|
+
prompt: prompt,
|
|
5678
|
+
} /* <- Note: [🤛] */);
|
|
5664
5679
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
5665
5680
|
socket.on('prompt-response', function (response) {
|
|
5666
5681
|
resolve(response.promptResult);
|