@promptbook/vercel 0.78.4 → 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.
Files changed (36) hide show
  1. package/README.md +4 -0
  2. package/esm/index.es.js +225 -143
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/books/index.d.ts +6 -6
  5. package/esm/typings/src/_packages/core.index.d.ts +4 -2
  6. package/esm/typings/src/_packages/types.index.d.ts +10 -0
  7. package/esm/typings/src/_packages/utils.index.d.ts +4 -0
  8. package/esm/typings/src/cli/cli-commands/runInteractiveChatbot.d.ts +32 -0
  9. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +5 -2
  10. package/esm/typings/src/config.d.ts +0 -25
  11. package/esm/typings/src/constants.d.ts +35 -0
  12. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
  13. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -0
  14. package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +6 -1
  15. package/esm/typings/src/formfactors/index.d.ts +12 -2
  16. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +6 -1
  17. package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +20 -0
  18. package/esm/typings/src/high-level-abstractions/implicit-formfactor/ImplicitFormfactorHla.d.ts +10 -0
  19. package/esm/typings/src/high-level-abstractions/index.d.ts +44 -0
  20. package/esm/typings/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +10 -0
  21. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
  22. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
  23. package/esm/typings/src/prepare/prepareTasks.d.ts +1 -0
  24. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  25. package/esm/typings/src/utils/normalization/orderJson.d.ts +21 -0
  26. package/esm/typings/src/utils/normalization/orderJson.test.d.ts +4 -0
  27. package/esm/typings/src/utils/organization/keepTypeImported.d.ts +9 -0
  28. package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +1 -1
  29. package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +20 -2
  30. package/esm/typings/src/utils/serialization/deepClone.test.d.ts +1 -0
  31. package/esm/typings/src/utils/serialization/exportJson.d.ts +29 -0
  32. package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +2 -1
  33. package/package.json +2 -2
  34. package/umd/index.umd.js +225 -143
  35. package/umd/index.umd.js.map +1 -1
  36. package/esm/typings/src/utils/serialization/$asDeeplyFrozenSerializableJson.d.ts +0 -17
package/umd/index.umd.js CHANGED
@@ -21,7 +21,7 @@
21
21
  *
22
22
  * @see https://github.com/webgptorg/promptbook
23
23
  */
24
- var PROMPTBOOK_ENGINE_VERSION = '0.78.3';
24
+ var PROMPTBOOK_ENGINE_VERSION = '0.79.0';
25
25
  /**
26
26
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
27
27
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -163,7 +163,7 @@
163
163
  }(Error));
164
164
 
165
165
  /**
166
- * @@@
166
+ * Freezes the given object and all its nested objects recursively
167
167
  *
168
168
  * Note: `$` is used to indicate that this function is not a pure function - it mutates given object
169
169
  * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
@@ -173,6 +173,9 @@
173
173
  */
174
174
  function $deepFreeze(objectValue) {
175
175
  var e_1, _a;
176
+ if (Array.isArray(objectValue)) {
177
+ return Object.freeze(objectValue.map(function (item) { return $deepFreeze(item); }));
178
+ }
176
179
  var propertyNames = Object.getOwnPropertyNames(objectValue);
177
180
  try {
178
181
  for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
@@ -190,7 +193,8 @@
190
193
  }
191
194
  finally { if (e_1) throw e_1.error; }
192
195
  }
193
- return Object.freeze(objectValue);
196
+ Object.freeze(objectValue);
197
+ return objectValue;
194
198
  }
195
199
  /**
196
200
  * TODO: [🧠] Is there a way how to meaningfully test this utility
@@ -291,24 +295,6 @@
291
295
  * @private within the repository - too low-level in comparison with other `MAX_...`
292
296
  */
293
297
  var LOOP_LIMIT = 1000;
294
- /**
295
- * Nonce which is used for replacing things in strings
296
- *
297
- * @private within the repository
298
- */
299
- var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
300
- /**
301
- * @@@
302
- *
303
- * @private within the repository
304
- */
305
- var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
306
- /**
307
- * @@@
308
- *
309
- * @private within the repository
310
- */
311
- var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
312
298
  // <- TODO: [🧜‍♂️]
313
299
  /**
314
300
  * @@@
@@ -322,26 +308,21 @@
322
308
  skipEmptyLines: true,
323
309
  });
324
310
  /**
325
- * TODO: Extract `constants.ts` from `config.ts`
326
311
  * Note: [💞] Ignore a discrepancy between file name and entity name
327
312
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
328
313
  */
329
314
 
330
315
  /**
331
- * This error type indicates that some limit was reached
316
+ * Orders JSON object by keys
332
317
  *
333
- * @public exported from `@promptbook/core`
318
+ * @returns The same type of object as the input re-ordered
319
+ * @public exported from `@promptbook/utils`
334
320
  */
335
- var LimitReachedError = /** @class */ (function (_super) {
336
- __extends(LimitReachedError, _super);
337
- function LimitReachedError(message) {
338
- var _this = _super.call(this, message) || this;
339
- _this.name = 'LimitReachedError';
340
- Object.setPrototypeOf(_this, LimitReachedError.prototype);
341
- return _this;
342
- }
343
- return LimitReachedError;
344
- }(Error));
321
+ function orderJson(options) {
322
+ var value = options.value, order = options.order;
323
+ var orderedValue = __assign(__assign({}, (order === undefined ? {} : Object.fromEntries(order.map(function (key) { return [key, undefined]; })))), value);
324
+ return orderedValue;
325
+ }
345
326
 
346
327
  /**
347
328
  * Make error report URL for the given error
@@ -377,85 +358,6 @@
377
358
  return UnexpectedError;
378
359
  }(Error));
379
360
 
380
- /**
381
- * Replaces parameters in template with values from parameters object
382
- *
383
- * @param template the template with parameters in {curly} braces
384
- * @param parameters the object with parameters
385
- * @returns the template with replaced parameters
386
- * @throws {PipelineExecutionError} if parameter is not defined, not closed, or not opened
387
- * @public exported from `@promptbook/utils`
388
- */
389
- function replaceParameters(template, parameters) {
390
- var e_1, _a;
391
- try {
392
- for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
393
- var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
394
- if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
395
- throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
396
- }
397
- else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
398
- // TODO: [🍵]
399
- throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
400
- }
401
- }
402
- }
403
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
404
- finally {
405
- try {
406
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
407
- }
408
- finally { if (e_1) throw e_1.error; }
409
- }
410
- var replacedTemplates = template;
411
- var match;
412
- var loopLimit = LOOP_LIMIT;
413
- var _loop_1 = function () {
414
- if (loopLimit-- < 0) {
415
- throw new LimitReachedError('Loop limit reached during parameters replacement in `replaceParameters`');
416
- }
417
- var precol = match.groups.precol;
418
- var parameterName = match.groups.parameterName;
419
- if (parameterName === '') {
420
- return "continue";
421
- }
422
- if (parameterName.indexOf('{') !== -1 || parameterName.indexOf('}') !== -1) {
423
- throw new PipelineExecutionError('Parameter is already opened or not closed');
424
- }
425
- if (parameters[parameterName] === undefined) {
426
- throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
427
- }
428
- var parameterValue = parameters[parameterName];
429
- if (parameterValue === undefined) {
430
- throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
431
- }
432
- parameterValue = parameterValue.toString();
433
- if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
434
- parameterValue = parameterValue
435
- .split('\n')
436
- .map(function (line, index) { return (index === 0 ? line : "".concat(precol).concat(line)); })
437
- .join('\n');
438
- }
439
- replacedTemplates =
440
- replacedTemplates.substring(0, match.index + precol.length) +
441
- parameterValue +
442
- replacedTemplates.substring(match.index + precol.length + parameterName.length + 2);
443
- };
444
- while ((match = /^(?<precol>.*){(?<parameterName>\w+)}(.*)/m /* <- Not global */
445
- .exec(replacedTemplates))) {
446
- _loop_1();
447
- }
448
- // [💫] Check if there are parameters that are not closed properly
449
- if (/{\w+$/.test(replacedTemplates)) {
450
- throw new PipelineExecutionError('Parameter is not closed');
451
- }
452
- // [💫] Check if there are parameters that are not opened properly
453
- if (/^\w+}/.test(replacedTemplates)) {
454
- throw new PipelineExecutionError('Parameter is not opened');
455
- }
456
- return replacedTemplates;
457
- }
458
-
459
361
  /**
460
362
  * Checks if the value is [🚉] serializable as JSON
461
363
  * If not, throws an UnexpectedError with a rich error message and tracking
@@ -476,8 +378,9 @@
476
378
  * @throws UnexpectedError if the value is not serializable as JSON
477
379
  * @public exported from `@promptbook/utils`
478
380
  */
479
- function checkSerializableAsJson(name, value) {
381
+ function checkSerializableAsJson(options) {
480
382
  var e_1, _a;
383
+ var value = options.value, name = options.name, message = options.message;
481
384
  if (value === undefined) {
482
385
  throw new UnexpectedError("".concat(name, " is undefined"));
483
386
  }
@@ -501,12 +404,12 @@
501
404
  }
502
405
  else if (typeof value === 'object' && Array.isArray(value)) {
503
406
  for (var i = 0; i < value.length; i++) {
504
- checkSerializableAsJson("".concat(name, "[").concat(i, "]"), value[i]);
407
+ checkSerializableAsJson({ name: "".concat(name, "[").concat(i, "]"), value: value[i], message: message });
505
408
  }
506
409
  }
507
410
  else if (typeof value === 'object') {
508
411
  if (value instanceof Date) {
509
- throw new UnexpectedError(spaceTrim__default["default"]("\n ".concat(name, " is Date\n\n Use `string_date_iso8601` instead\n ")));
412
+ throw new UnexpectedError(spaceTrim__default["default"](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 "); }));
510
413
  }
511
414
  else if (value instanceof Map) {
512
415
  throw new UnexpectedError("".concat(name, " is Map"));
@@ -518,7 +421,7 @@
518
421
  throw new UnexpectedError("".concat(name, " is RegExp"));
519
422
  }
520
423
  else if (value instanceof Error) {
521
- throw new UnexpectedError(spaceTrim__default["default"]("\n ".concat(name, " is unserialized Error\n\n Use function `serializeError`\n ")));
424
+ throw new UnexpectedError(spaceTrim__default["default"](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 "); }));
522
425
  }
523
426
  else {
524
427
  try {
@@ -528,7 +431,7 @@
528
431
  // Note: undefined in object is serializable - it is just omited
529
432
  continue;
530
433
  }
531
- checkSerializableAsJson("".concat(name, ".").concat(subName), subValue);
434
+ checkSerializableAsJson({ name: "".concat(name, ".").concat(subName), value: subValue, message: message });
532
435
  }
533
436
  }
534
437
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -545,7 +448,7 @@
545
448
  if (!(error instanceof Error)) {
546
449
  throw error;
547
450
  }
548
- throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n ".concat(name, " is not serializable\n\n ").concat(block(error.toString()), "\n "); }));
451
+ throw new UnexpectedError(spaceTrim__default["default"](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 "); }));
549
452
  }
550
453
  /*
551
454
  TODO: [0] Is there some more elegant way to check circular references?
@@ -570,35 +473,210 @@
570
473
  }
571
474
  }
572
475
  else {
573
- throw new UnexpectedError("".concat(name, " is unknown"));
476
+ throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n `".concat(name, "` is unknown type\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
574
477
  }
575
478
  }
576
479
  /**
577
- * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
480
+ * TODO: Can be return type more type-safe? like `asserts options.value is JsonValue`
578
481
  * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
579
482
  * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
580
483
  */
581
484
 
582
485
  /**
583
- * @@@
584
486
  * @@@
585
487
  *
586
- * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
488
+ * @public exported from `@promptbook/utils`
489
+ */
490
+ function deepClone(objectValue) {
491
+ return JSON.parse(JSON.stringify(objectValue));
492
+ /*
493
+ !!!!!!!!
494
+ TODO: [🧠] Is there a better implementation?
495
+ > const propertyNames = Object.getOwnPropertyNames(objectValue);
496
+ > for (const propertyName of propertyNames) {
497
+ > const value = (objectValue as really_any)[propertyName];
498
+ > if (value && typeof value === 'object') {
499
+ > deepClone(value);
500
+ > }
501
+ > }
502
+ > return Object.assign({}, objectValue);
503
+ */
504
+ }
505
+ /**
506
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
507
+ */
508
+
509
+ /**
510
+ * Utility to export a JSON object from a function
587
511
  *
588
- * @param name - Name of the object for debugging purposes
589
- * @param objectValue - Object to be deeply frozen
590
- * @returns The same object as the input, but deeply frozen
591
- * @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
512
+ * 1) Checks if the value is serializable as JSON
513
+ * 2) Makes a deep clone of the object
514
+ * 2) Orders the object properties
515
+ * 2) Deeply freezes the cloned object
516
+ *
517
+ * Note: This function does not mutates the given object
518
+ *
519
+ * @returns The same type of object as the input but read-only and re-ordered
520
+ * @public exported from `@promptbook/utils`
592
521
  */
593
- function $asDeeplyFrozenSerializableJson(name, objectValue) {
594
- checkSerializableAsJson(name, objectValue);
595
- return $deepFreeze(objectValue);
522
+ function exportJson(options) {
523
+ var name = options.name, value = options.value, order = options.order, message = options.message;
524
+ checkSerializableAsJson({ name: name, value: value, message: message });
525
+ var orderedValue =
526
+ // TODO: Fix error "Type instantiation is excessively deep and possibly infinite."
527
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
528
+ // @ts-ignore
529
+ order === undefined
530
+ ? deepClone(value)
531
+ : orderJson({
532
+ value: value,
533
+ // <- Note: checkSerializableAsJson asserts that the value is serializable as JSON
534
+ order: order,
535
+ });
536
+ $deepFreeze(orderedValue);
537
+ return orderedValue;
596
538
  }
597
539
  /**
598
- * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
599
540
  * TODO: [🧠] Is there a way how to meaningfully test this utility
600
541
  */
601
542
 
543
+ /**
544
+ * Nonce which is used for replacing things in strings
545
+ *
546
+ * @private within the repository
547
+ */
548
+ var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
549
+ /**
550
+ * @@@
551
+ *
552
+ * @private within the repository
553
+ */
554
+ var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
555
+ /**
556
+ * @@@
557
+ *
558
+ * @private within the repository
559
+ */
560
+ var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
561
+ /**
562
+ * The names of the parameters that are reserved for special purposes
563
+ *
564
+ * @public exported from `@promptbook/core`
565
+ */
566
+ exportJson({
567
+ name: 'RESERVED_PARAMETER_NAMES',
568
+ message: "The names of the parameters that are reserved for special purposes",
569
+ value: [
570
+ 'content',
571
+ 'context',
572
+ 'knowledge',
573
+ 'examples',
574
+ 'modelName',
575
+ 'currentDate',
576
+ // <- TODO: list here all command names
577
+ // <- TODO: Add more like 'date', 'modelName',...
578
+ // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
579
+ ],
580
+ });
581
+ /**
582
+ * Note: [💞] Ignore a discrepancy between file name and entity name
583
+ */
584
+
585
+ /**
586
+ * This error type indicates that some limit was reached
587
+ *
588
+ * @public exported from `@promptbook/core`
589
+ */
590
+ var LimitReachedError = /** @class */ (function (_super) {
591
+ __extends(LimitReachedError, _super);
592
+ function LimitReachedError(message) {
593
+ var _this = _super.call(this, message) || this;
594
+ _this.name = 'LimitReachedError';
595
+ Object.setPrototypeOf(_this, LimitReachedError.prototype);
596
+ return _this;
597
+ }
598
+ return LimitReachedError;
599
+ }(Error));
600
+
601
+ /**
602
+ * Replaces parameters in template with values from parameters object
603
+ *
604
+ * @param template the template with parameters in {curly} braces
605
+ * @param parameters the object with parameters
606
+ * @returns the template with replaced parameters
607
+ * @throws {PipelineExecutionError} if parameter is not defined, not closed, or not opened
608
+ * @public exported from `@promptbook/utils`
609
+ */
610
+ function replaceParameters(template, parameters) {
611
+ var e_1, _a;
612
+ try {
613
+ for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
614
+ var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
615
+ if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
616
+ throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
617
+ }
618
+ else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
619
+ // TODO: [🍵]
620
+ throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
621
+ }
622
+ }
623
+ }
624
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
625
+ finally {
626
+ try {
627
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
628
+ }
629
+ finally { if (e_1) throw e_1.error; }
630
+ }
631
+ var replacedTemplates = template;
632
+ var match;
633
+ var loopLimit = LOOP_LIMIT;
634
+ var _loop_1 = function () {
635
+ if (loopLimit-- < 0) {
636
+ throw new LimitReachedError('Loop limit reached during parameters replacement in `replaceParameters`');
637
+ }
638
+ var precol = match.groups.precol;
639
+ var parameterName = match.groups.parameterName;
640
+ if (parameterName === '') {
641
+ return "continue";
642
+ }
643
+ if (parameterName.indexOf('{') !== -1 || parameterName.indexOf('}') !== -1) {
644
+ throw new PipelineExecutionError('Parameter is already opened or not closed');
645
+ }
646
+ if (parameters[parameterName] === undefined) {
647
+ throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
648
+ }
649
+ var parameterValue = parameters[parameterName];
650
+ if (parameterValue === undefined) {
651
+ throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
652
+ }
653
+ parameterValue = parameterValue.toString();
654
+ if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
655
+ parameterValue = parameterValue
656
+ .split('\n')
657
+ .map(function (line, index) { return (index === 0 ? line : "".concat(precol).concat(line)); })
658
+ .join('\n');
659
+ }
660
+ replacedTemplates =
661
+ replacedTemplates.substring(0, match.index + precol.length) +
662
+ parameterValue +
663
+ replacedTemplates.substring(match.index + precol.length + parameterName.length + 2);
664
+ };
665
+ while ((match = /^(?<precol>.*){(?<parameterName>\w+)}(.*)/m /* <- Not global */
666
+ .exec(replacedTemplates))) {
667
+ _loop_1();
668
+ }
669
+ // [💫] Check if there are parameters that are not closed properly
670
+ if (/{\w+$/.test(replacedTemplates)) {
671
+ throw new PipelineExecutionError('Parameter is not closed');
672
+ }
673
+ // [💫] Check if there are parameters that are not opened properly
674
+ if (/^\w+}/.test(replacedTemplates)) {
675
+ throw new PipelineExecutionError('Parameter is not opened');
676
+ }
677
+ return replacedTemplates;
678
+ }
679
+
602
680
  /**
603
681
  * Function `asSerializable` will convert values which are not serializable to serializable values
604
682
  * It walks deeply through the object and converts all values
@@ -678,7 +756,7 @@
678
756
  return modelVariant === 'CHAT';
679
757
  })) === null || _a === void 0 ? void 0 : _a.modelName);
680
758
  if (!modelName) {
681
- throw new PipelineExecutionError(spaceTrim__default["default"]("\n Can not determine which model to use.\n\n You need to provide at least one of:\n 1) In `createExecutionToolsFromVercelProvider` options, provide `availableModels` with at least one model\n 2) In `prompt.modelRequirements`, provide `modelName` with the name of the model to use\n \n "));
759
+ throw new PipelineExecutionError(spaceTrim__default["default"]("\n Can not determine which model to use.\n\n You need to provide at least one of:\n 1) In `createExecutionToolsFromVercelProvider` options, provide `availableModels` with at least one model\n 2) In `prompt.modelRequirements`, provide `modelName` with the name of the model to use\n\n "));
682
760
  }
683
761
  return [4 /*yield*/, vercelProvider.chat(modelName, __assign({ user: (userId === null || userId === void 0 ? void 0 : userId.toString()) || undefined }, additionalChatSettings))];
684
762
  case 1:
@@ -741,18 +819,22 @@
741
819
  }
742
820
  complete = $getCurrentDate();
743
821
  usage = UNCERTAIN_USAGE;
744
- return [2 /*return*/, $asDeeplyFrozenSerializableJson('createExecutionToolsFromVercelProvider ChatPromptResult', {
745
- content: rawResponse.text,
746
- modelName: modelName,
747
- timing: {
748
- start: start,
749
- complete: complete,
822
+ return [2 /*return*/, exportJson({
823
+ name: 'promptResult',
824
+ message: "Result of `createExecutionToolsFromVercelProvider.callChatModel`",
825
+ value: {
826
+ content: rawResponse.text,
827
+ modelName: modelName,
828
+ timing: {
829
+ start: start,
830
+ complete: complete,
831
+ },
832
+ usage: usage,
833
+ rawPromptContent: rawPromptContent,
834
+ rawRequest: rawRequest,
835
+ rawResponse: asSerializable(rawResponse),
836
+ // <- [🗯]
750
837
  },
751
- usage: usage,
752
- rawPromptContent: rawPromptContent,
753
- rawRequest: rawRequest,
754
- rawResponse: asSerializable(rawResponse),
755
- // <- [🗯]
756
838
  })];
757
839
  }
758
840
  });