@promptbook/anthropic-claude 0.79.0 → 0.80.0-0
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/README.md +4 -0
- package/esm/index.es.js +199 -116
- package/esm/index.es.js.map +1 -1
- package/esm/typings/books/index.d.ts +6 -6
- package/esm/typings/src/_packages/core.index.d.ts +4 -2
- package/esm/typings/src/_packages/types.index.d.ts +10 -0
- package/esm/typings/src/_packages/utils.index.d.ts +4 -0
- package/esm/typings/src/cli/cli-commands/runInteractiveChatbot.d.ts +32 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +3 -0
- package/esm/typings/src/config.d.ts +0 -25
- package/esm/typings/src/constants.d.ts +35 -0
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -0
- package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +20 -0
- package/esm/typings/src/high-level-abstractions/implicit-formfactor/ImplicitFormfactorHla.d.ts +10 -0
- package/esm/typings/src/high-level-abstractions/index.d.ts +44 -0
- package/esm/typings/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +10 -0
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
- package/esm/typings/src/prepare/prepareTasks.d.ts +1 -0
- package/esm/typings/src/types/typeAliases.d.ts +1 -1
- package/esm/typings/src/utils/normalization/orderJson.d.ts +21 -0
- package/esm/typings/src/utils/normalization/orderJson.test.d.ts +4 -0
- package/esm/typings/src/utils/organization/keepTypeImported.d.ts +9 -0
- package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +1 -1
- package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +20 -2
- package/esm/typings/src/utils/serialization/deepClone.test.d.ts +1 -0
- package/esm/typings/src/utils/serialization/exportJson.d.ts +29 -0
- package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +2 -1
- package/package.json +2 -2
- package/umd/index.umd.js +199 -116
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/utils/serialization/$asDeeplyFrozenSerializableJson.d.ts +0 -17
package/README.md
CHANGED
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
+
<blockquote style="color: #ff8811">
|
|
27
|
+
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
28
|
+
</blockquote>
|
|
29
|
+
|
|
26
30
|
## 📦 Package `@promptbook/anthropic-claude`
|
|
27
31
|
|
|
28
32
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
package/esm/index.es.js
CHANGED
|
@@ -15,7 +15,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
15
15
|
*
|
|
16
16
|
* @see https://github.com/webgptorg/promptbook
|
|
17
17
|
*/
|
|
18
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
18
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.79.0';
|
|
19
19
|
/**
|
|
20
20
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
21
21
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -131,7 +131,19 @@ function __read(o, n) {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
|
-
*
|
|
134
|
+
* Orders JSON object by keys
|
|
135
|
+
*
|
|
136
|
+
* @returns The same type of object as the input re-ordered
|
|
137
|
+
* @public exported from `@promptbook/utils`
|
|
138
|
+
*/
|
|
139
|
+
function orderJson(options) {
|
|
140
|
+
var value = options.value, order = options.order;
|
|
141
|
+
var orderedValue = __assign(__assign({}, (order === undefined ? {} : Object.fromEntries(order.map(function (key) { return [key, undefined]; })))), value);
|
|
142
|
+
return orderedValue;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Freezes the given object and all its nested objects recursively
|
|
135
147
|
*
|
|
136
148
|
* Note: `$` is used to indicate that this function is not a pure function - it mutates given object
|
|
137
149
|
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
@@ -161,7 +173,8 @@ function $deepFreeze(objectValue) {
|
|
|
161
173
|
}
|
|
162
174
|
finally { if (e_1) throw e_1.error; }
|
|
163
175
|
}
|
|
164
|
-
|
|
176
|
+
Object.freeze(objectValue);
|
|
177
|
+
return objectValue;
|
|
165
178
|
}
|
|
166
179
|
/**
|
|
167
180
|
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
@@ -207,24 +220,6 @@ var CONNECTION_TIMEOUT_MS = 7 * 1000;
|
|
|
207
220
|
* @private within the repository - too low-level in comparison with other `MAX_...`
|
|
208
221
|
*/
|
|
209
222
|
var CONNECTION_RETRIES_LIMIT = 5;
|
|
210
|
-
/**
|
|
211
|
-
* Nonce which is used for replacing things in strings
|
|
212
|
-
*
|
|
213
|
-
* @private within the repository
|
|
214
|
-
*/
|
|
215
|
-
var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
|
|
216
|
-
/**
|
|
217
|
-
* @@@
|
|
218
|
-
*
|
|
219
|
-
* @private within the repository
|
|
220
|
-
*/
|
|
221
|
-
var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
222
|
-
/**
|
|
223
|
-
* @@@
|
|
224
|
-
*
|
|
225
|
-
* @private within the repository
|
|
226
|
-
*/
|
|
227
|
-
var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
|
|
228
223
|
// <- TODO: [🧜♂️]
|
|
229
224
|
/**
|
|
230
225
|
* @@@
|
|
@@ -238,7 +233,6 @@ Object.freeze({
|
|
|
238
233
|
skipEmptyLines: true,
|
|
239
234
|
});
|
|
240
235
|
/**
|
|
241
|
-
* TODO: Extract `constants.ts` from `config.ts`
|
|
242
236
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
243
237
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
244
238
|
*/
|
|
@@ -297,8 +291,9 @@ var UnexpectedError = /** @class */ (function (_super) {
|
|
|
297
291
|
* @throws UnexpectedError if the value is not serializable as JSON
|
|
298
292
|
* @public exported from `@promptbook/utils`
|
|
299
293
|
*/
|
|
300
|
-
function checkSerializableAsJson(
|
|
294
|
+
function checkSerializableAsJson(options) {
|
|
301
295
|
var e_1, _a;
|
|
296
|
+
var value = options.value, name = options.name, message = options.message;
|
|
302
297
|
if (value === undefined) {
|
|
303
298
|
throw new UnexpectedError("".concat(name, " is undefined"));
|
|
304
299
|
}
|
|
@@ -322,12 +317,12 @@ function checkSerializableAsJson(name, value) {
|
|
|
322
317
|
}
|
|
323
318
|
else if (typeof value === 'object' && Array.isArray(value)) {
|
|
324
319
|
for (var i = 0; i < value.length; i++) {
|
|
325
|
-
checkSerializableAsJson("".concat(name, "[").concat(i, "]"), value[i]);
|
|
320
|
+
checkSerializableAsJson({ name: "".concat(name, "[").concat(i, "]"), value: value[i], message: message });
|
|
326
321
|
}
|
|
327
322
|
}
|
|
328
323
|
else if (typeof value === 'object') {
|
|
329
324
|
if (value instanceof Date) {
|
|
330
|
-
throw new UnexpectedError(spaceTrim("\n
|
|
325
|
+
throw new UnexpectedError(spaceTrim(function (block) { return "\n `".concat(name, "` is Date\n\n Use `string_date_iso8601` instead\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
|
|
331
326
|
}
|
|
332
327
|
else if (value instanceof Map) {
|
|
333
328
|
throw new UnexpectedError("".concat(name, " is Map"));
|
|
@@ -339,7 +334,7 @@ function checkSerializableAsJson(name, value) {
|
|
|
339
334
|
throw new UnexpectedError("".concat(name, " is RegExp"));
|
|
340
335
|
}
|
|
341
336
|
else if (value instanceof Error) {
|
|
342
|
-
throw new UnexpectedError(spaceTrim("\n
|
|
337
|
+
throw new UnexpectedError(spaceTrim(function (block) { return "\n `".concat(name, "` is unserialized Error\n\n Use function `serializeError`\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n\n "); }));
|
|
343
338
|
}
|
|
344
339
|
else {
|
|
345
340
|
try {
|
|
@@ -349,7 +344,7 @@ function checkSerializableAsJson(name, value) {
|
|
|
349
344
|
// Note: undefined in object is serializable - it is just omited
|
|
350
345
|
continue;
|
|
351
346
|
}
|
|
352
|
-
checkSerializableAsJson("".concat(name, ".").concat(subName), subValue);
|
|
347
|
+
checkSerializableAsJson({ name: "".concat(name, ".").concat(subName), value: subValue, message: message });
|
|
353
348
|
}
|
|
354
349
|
}
|
|
355
350
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -366,7 +361,7 @@ function checkSerializableAsJson(name, value) {
|
|
|
366
361
|
if (!(error instanceof Error)) {
|
|
367
362
|
throw error;
|
|
368
363
|
}
|
|
369
|
-
throw new UnexpectedError(spaceTrim(function (block) { return "\n ".concat(name, " is not serializable\n\n ").concat(block(error.toString()), "\n "); }));
|
|
364
|
+
throw new UnexpectedError(spaceTrim(function (block) { return "\n `".concat(name, "` is not serializable\n\n ").concat(block(error.toString()), "\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
|
|
370
365
|
}
|
|
371
366
|
/*
|
|
372
367
|
TODO: [0] Is there some more elegant way to check circular references?
|
|
@@ -391,32 +386,70 @@ function checkSerializableAsJson(name, value) {
|
|
|
391
386
|
}
|
|
392
387
|
}
|
|
393
388
|
else {
|
|
394
|
-
throw new UnexpectedError("".concat(name, " is unknown"));
|
|
389
|
+
throw new UnexpectedError(spaceTrim(function (block) { return "\n `".concat(name, "` is unknown type\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
|
|
395
390
|
}
|
|
396
391
|
}
|
|
397
392
|
/**
|
|
398
|
-
* TODO:
|
|
393
|
+
* TODO: Can be return type more type-safe? like `asserts options.value is JsonValue`
|
|
399
394
|
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
400
395
|
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
401
396
|
*/
|
|
402
397
|
|
|
403
398
|
/**
|
|
404
|
-
* @@@
|
|
405
399
|
* @@@
|
|
406
400
|
*
|
|
407
|
-
*
|
|
401
|
+
* @public exported from `@promptbook/utils`
|
|
402
|
+
*/
|
|
403
|
+
function deepClone(objectValue) {
|
|
404
|
+
return JSON.parse(JSON.stringify(objectValue));
|
|
405
|
+
/*
|
|
406
|
+
!!!!!!!!
|
|
407
|
+
TODO: [🧠] Is there a better implementation?
|
|
408
|
+
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
409
|
+
> for (const propertyName of propertyNames) {
|
|
410
|
+
> const value = (objectValue as really_any)[propertyName];
|
|
411
|
+
> if (value && typeof value === 'object') {
|
|
412
|
+
> deepClone(value);
|
|
413
|
+
> }
|
|
414
|
+
> }
|
|
415
|
+
> return Object.assign({}, objectValue);
|
|
416
|
+
*/
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
420
|
+
*/
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Utility to export a JSON object from a function
|
|
408
424
|
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
425
|
+
* 1) Checks if the value is serializable as JSON
|
|
426
|
+
* 2) Makes a deep clone of the object
|
|
427
|
+
* 2) Orders the object properties
|
|
428
|
+
* 2) Deeply freezes the cloned object
|
|
429
|
+
*
|
|
430
|
+
* Note: This function does not mutates the given object
|
|
431
|
+
*
|
|
432
|
+
* @returns The same type of object as the input but read-only and re-ordered
|
|
433
|
+
* @public exported from `@promptbook/utils`
|
|
413
434
|
*/
|
|
414
|
-
function
|
|
415
|
-
|
|
416
|
-
|
|
435
|
+
function exportJson(options) {
|
|
436
|
+
var name = options.name, value = options.value, order = options.order, message = options.message;
|
|
437
|
+
checkSerializableAsJson({ name: name, value: value, message: message });
|
|
438
|
+
var orderedValue =
|
|
439
|
+
// TODO: Fix error "Type instantiation is excessively deep and possibly infinite."
|
|
440
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
441
|
+
// @ts-ignore
|
|
442
|
+
order === undefined
|
|
443
|
+
? deepClone(value)
|
|
444
|
+
: orderJson({
|
|
445
|
+
value: value,
|
|
446
|
+
// <- Note: checkSerializableAsJson asserts that the value is serializable as JSON
|
|
447
|
+
order: order,
|
|
448
|
+
});
|
|
449
|
+
$deepFreeze(orderedValue);
|
|
450
|
+
return orderedValue;
|
|
417
451
|
}
|
|
418
452
|
/**
|
|
419
|
-
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
420
453
|
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
421
454
|
*/
|
|
422
455
|
|
|
@@ -438,72 +471,75 @@ function computeUsage(value) {
|
|
|
438
471
|
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
439
472
|
* @public exported from `@promptbook/anthropic-claude`
|
|
440
473
|
*/
|
|
441
|
-
var ANTHROPIC_CLAUDE_MODELS =
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
474
|
+
var ANTHROPIC_CLAUDE_MODELS = exportJson({
|
|
475
|
+
name: 'ANTHROPIC_CLAUDE_MODELS',
|
|
476
|
+
value: [
|
|
477
|
+
{
|
|
478
|
+
modelVariant: 'CHAT',
|
|
479
|
+
modelTitle: 'Claude 3.5 Sonnet',
|
|
480
|
+
modelName: 'claude-3-5-sonnet-20240620',
|
|
481
|
+
pricing: {
|
|
482
|
+
prompt: computeUsage("$3.00 / 1M tokens"),
|
|
483
|
+
output: computeUsage("$15.00 / 1M tokens"),
|
|
484
|
+
},
|
|
449
485
|
},
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
486
|
+
{
|
|
487
|
+
modelVariant: 'CHAT',
|
|
488
|
+
modelTitle: 'Claude 3 Opus',
|
|
489
|
+
modelName: 'claude-3-opus-20240229',
|
|
490
|
+
pricing: {
|
|
491
|
+
prompt: computeUsage("$15.00 / 1M tokens"),
|
|
492
|
+
output: computeUsage("$75.00 / 1M tokens"),
|
|
493
|
+
},
|
|
458
494
|
},
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
495
|
+
{
|
|
496
|
+
modelVariant: 'CHAT',
|
|
497
|
+
modelTitle: 'Claude 3 Sonnet',
|
|
498
|
+
modelName: 'claude-3-sonnet-20240229',
|
|
499
|
+
pricing: {
|
|
500
|
+
prompt: computeUsage("$3.00 / 1M tokens"),
|
|
501
|
+
output: computeUsage("$15.00 / 1M tokens"),
|
|
502
|
+
},
|
|
467
503
|
},
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
504
|
+
{
|
|
505
|
+
modelVariant: 'CHAT',
|
|
506
|
+
modelTitle: 'Claude 3 Haiku',
|
|
507
|
+
modelName: ' claude-3-haiku-20240307',
|
|
508
|
+
pricing: {
|
|
509
|
+
prompt: computeUsage("$0.25 / 1M tokens"),
|
|
510
|
+
output: computeUsage("$1.25 / 1M tokens"),
|
|
511
|
+
},
|
|
476
512
|
},
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
513
|
+
{
|
|
514
|
+
modelVariant: 'CHAT',
|
|
515
|
+
modelTitle: 'Claude 2.1',
|
|
516
|
+
modelName: 'claude-2.1',
|
|
517
|
+
pricing: {
|
|
518
|
+
prompt: computeUsage("$8.00 / 1M tokens"),
|
|
519
|
+
output: computeUsage("$24.00 / 1M tokens"),
|
|
520
|
+
},
|
|
485
521
|
},
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
522
|
+
{
|
|
523
|
+
modelVariant: 'CHAT',
|
|
524
|
+
modelTitle: 'Claude 2',
|
|
525
|
+
modelName: 'claude-2.0',
|
|
526
|
+
pricing: {
|
|
527
|
+
prompt: computeUsage("$8.00 / 1M tokens"),
|
|
528
|
+
output: computeUsage("$24.00 / 1M tokens"),
|
|
529
|
+
},
|
|
494
530
|
},
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
531
|
+
{
|
|
532
|
+
modelVariant: 'CHAT',
|
|
533
|
+
modelTitle: ' Claude Instant 1.2',
|
|
534
|
+
modelName: 'claude-instant-1.2',
|
|
535
|
+
pricing: {
|
|
536
|
+
prompt: computeUsage("$0.80 / 1M tokens"),
|
|
537
|
+
output: computeUsage("$2.40 / 1M tokens"),
|
|
538
|
+
},
|
|
503
539
|
},
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
540
|
+
// TODO: [main] !!! Claude 1 and 2 has also completion versions - ask Hoagy
|
|
541
|
+
],
|
|
542
|
+
});
|
|
507
543
|
/**
|
|
508
544
|
* Note: [🤖] Add models of new variant
|
|
509
545
|
* TODO: [🧠][main] !!! Add embedding models OR Anthropic has only chat+completion models?
|
|
@@ -541,6 +577,48 @@ function $getCurrentDate() {
|
|
|
541
577
|
return new Date().toISOString();
|
|
542
578
|
}
|
|
543
579
|
|
|
580
|
+
/**
|
|
581
|
+
* Nonce which is used for replacing things in strings
|
|
582
|
+
*
|
|
583
|
+
* @private within the repository
|
|
584
|
+
*/
|
|
585
|
+
var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
|
|
586
|
+
/**
|
|
587
|
+
* @@@
|
|
588
|
+
*
|
|
589
|
+
* @private within the repository
|
|
590
|
+
*/
|
|
591
|
+
var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
592
|
+
/**
|
|
593
|
+
* @@@
|
|
594
|
+
*
|
|
595
|
+
* @private within the repository
|
|
596
|
+
*/
|
|
597
|
+
var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
|
|
598
|
+
/**
|
|
599
|
+
* The names of the parameters that are reserved for special purposes
|
|
600
|
+
*
|
|
601
|
+
* @public exported from `@promptbook/core`
|
|
602
|
+
*/
|
|
603
|
+
exportJson({
|
|
604
|
+
name: 'RESERVED_PARAMETER_NAMES',
|
|
605
|
+
message: "The names of the parameters that are reserved for special purposes",
|
|
606
|
+
value: [
|
|
607
|
+
'content',
|
|
608
|
+
'context',
|
|
609
|
+
'knowledge',
|
|
610
|
+
'examples',
|
|
611
|
+
'modelName',
|
|
612
|
+
'currentDate',
|
|
613
|
+
// <- TODO: list here all command names
|
|
614
|
+
// <- TODO: Add more like 'date', 'modelName',...
|
|
615
|
+
// <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
|
|
616
|
+
],
|
|
617
|
+
});
|
|
618
|
+
/**
|
|
619
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
620
|
+
*/
|
|
621
|
+
|
|
544
622
|
/**
|
|
545
623
|
* This error type indicates that some limit was reached
|
|
546
624
|
*
|
|
@@ -1201,18 +1279,23 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
1201
1279
|
// eslint-disable-next-line prefer-const
|
|
1202
1280
|
complete = $getCurrentDate();
|
|
1203
1281
|
usage = computeAnthropicClaudeUsage(rawPromptContent || '', resultContent || '', rawResponse);
|
|
1204
|
-
return [2 /*return*/,
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1282
|
+
return [2 /*return*/, exportJson({
|
|
1283
|
+
name: 'promptResult',
|
|
1284
|
+
message: "Result of `AzureOpenAiExecutionTools.callChatModel`",
|
|
1285
|
+
order: [],
|
|
1286
|
+
value: {
|
|
1287
|
+
content: resultContent,
|
|
1288
|
+
modelName: rawResponse.model,
|
|
1289
|
+
timing: {
|
|
1290
|
+
start: start,
|
|
1291
|
+
complete: complete,
|
|
1292
|
+
},
|
|
1293
|
+
usage: usage,
|
|
1294
|
+
rawPromptContent: rawPromptContent,
|
|
1295
|
+
rawRequest: rawRequest,
|
|
1296
|
+
rawResponse: rawResponse,
|
|
1297
|
+
// <- [🗯]
|
|
1210
1298
|
},
|
|
1211
|
-
usage: usage,
|
|
1212
|
-
rawPromptContent: rawPromptContent,
|
|
1213
|
-
rawRequest: rawRequest,
|
|
1214
|
-
rawResponse: rawResponse,
|
|
1215
|
-
// <- [🗯]
|
|
1216
1299
|
})];
|
|
1217
1300
|
}
|
|
1218
1301
|
});
|
|
@@ -1282,7 +1365,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
1282
1365
|
|
|
1283
1366
|
|
|
1284
1367
|
|
|
1285
|
-
return $
|
|
1368
|
+
return $exportJson({ name: 'promptResult',message: Result of \`AzureOpenAiExecutionTools callChatModel\`, order: [],value:{
|
|
1286
1369
|
content: resultContent,
|
|
1287
1370
|
modelName: rawResponse.model || model,
|
|
1288
1371
|
timing: {
|
|
@@ -1665,7 +1748,7 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
1665
1748
|
isAnonymous: true,
|
|
1666
1749
|
userId: this.options.userId,
|
|
1667
1750
|
llmToolsConfiguration: this.options.llmToolsConfiguration,
|
|
1668
|
-
} /* <-
|
|
1751
|
+
} /* <- Note: [🤛] */);
|
|
1669
1752
|
}
|
|
1670
1753
|
else {
|
|
1671
1754
|
socket.emit('listModels-request', {
|
|
@@ -1673,7 +1756,7 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
1673
1756
|
appId: this.options.appId,
|
|
1674
1757
|
userId: this.options.userId,
|
|
1675
1758
|
customOptions: this.options.customOptions,
|
|
1676
|
-
} /* <-
|
|
1759
|
+
} /* <- Note: [🤛] */);
|
|
1677
1760
|
}
|
|
1678
1761
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
1679
1762
|
socket.on('listModels-response', function (response) {
|
|
@@ -1761,7 +1844,7 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
1761
1844
|
userId: this.options.userId,
|
|
1762
1845
|
llmToolsConfiguration: this.options.llmToolsConfiguration,
|
|
1763
1846
|
prompt: prompt,
|
|
1764
|
-
} /* <-
|
|
1847
|
+
} /* <- Note: [🤛] */);
|
|
1765
1848
|
}
|
|
1766
1849
|
else {
|
|
1767
1850
|
socket.emit('prompt-request', {
|
|
@@ -1770,7 +1853,7 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
1770
1853
|
userId: this.options.userId,
|
|
1771
1854
|
customOptions: this.options.customOptions,
|
|
1772
1855
|
prompt: prompt,
|
|
1773
|
-
} /* <-
|
|
1856
|
+
} /* <- Note: [🤛] */);
|
|
1774
1857
|
}
|
|
1775
1858
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
1776
1859
|
socket.on('prompt-response', function (response) {
|
|
@@ -1793,7 +1876,7 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
1793
1876
|
return RemoteLlmExecutionTools;
|
|
1794
1877
|
}());
|
|
1795
1878
|
/**
|
|
1796
|
-
* TODO: Maybe use `$
|
|
1879
|
+
* TODO: Maybe use `$exportJson`
|
|
1797
1880
|
* TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
|
|
1798
1881
|
* TODO: [🍓] Allow to list compatible models with each variant
|
|
1799
1882
|
* TODO: [🗯] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
|