@promptbook/core 0.75.2 → 0.75.3

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 CHANGED
@@ -22,7 +22,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
22
22
  *
23
23
  * @see https://github.com/webgptorg/promptbook
24
24
  */
25
- var PROMPTBOOK_ENGINE_VERSION = '0.75.1';
25
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.2';
26
26
  /**
27
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
28
28
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -5114,16 +5114,16 @@ function $registeredScrapersMessage() {
5114
5114
  * Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
5115
5115
  */
5116
5116
  var all = [];
5117
- var _loop_1 = function (packageName, className) {
5117
+ var _loop_1 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
5118
5118
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
5119
5119
  return "continue";
5120
5120
  }
5121
- all.push({ packageName: packageName, className: className });
5121
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
5122
5122
  };
5123
5123
  try {
5124
5124
  for (var _c = __values($scrapersMetadataRegister.list()), _d = _c.next(); !_d.done; _d = _c.next()) {
5125
- var _e = _d.value, packageName = _e.packageName, className = _e.className;
5126
- _loop_1(packageName, className);
5125
+ var _e = _d.value, packageName = _e.packageName, className = _e.className, mimeTypes = _e.mimeTypes, documentationUrl = _e.documentationUrl, isAvilableInBrowser = _e.isAvilableInBrowser;
5126
+ _loop_1(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
5127
5127
  }
5128
5128
  }
5129
5129
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -5133,16 +5133,16 @@ function $registeredScrapersMessage() {
5133
5133
  }
5134
5134
  finally { if (e_1) throw e_1.error; }
5135
5135
  }
5136
- var _loop_2 = function (packageName, className) {
5136
+ var _loop_2 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
5137
5137
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
5138
5138
  return "continue";
5139
5139
  }
5140
- all.push({ packageName: packageName, className: className });
5140
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
5141
5141
  };
5142
5142
  try {
5143
5143
  for (var _f = __values($scrapersRegister.list()), _g = _f.next(); !_g.done; _g = _f.next()) {
5144
- var _h = _g.value, packageName = _h.packageName, className = _h.className;
5145
- _loop_2(packageName, className);
5144
+ var _h = _g.value, packageName = _h.packageName, className = _h.className, mimeTypes = _h.mimeTypes, documentationUrl = _h.documentationUrl, isAvilableInBrowser = _h.isAvilableInBrowser;
5145
+ _loop_2(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
5146
5146
  }
5147
5147
  }
5148
5148
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -5172,29 +5172,33 @@ function $registeredScrapersMessage() {
5172
5172
  }
5173
5173
  return spaceTrim(function (block) { return "\n Available scrapers are:\n ".concat(block(metadata
5174
5174
  .map(function (_a, i) {
5175
- var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled;
5175
+ var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled, mimeTypes = _a.mimeTypes, isAvilableInBrowser = _a.isAvilableInBrowser;
5176
5176
  var more;
5177
+ // TODO: Use documentationUrl
5177
5178
  if (just(false)) {
5178
5179
  more = '';
5179
5180
  }
5180
5181
  else if (!isMetadataAviailable && !isInstalled) {
5181
5182
  // TODO: [�][�] Maybe do allow to do auto-install if package not registered and not found
5182
- more = "(not installed and no metadata, looks like a unexpected behavior)";
5183
+ more = "*(not installed and no metadata, looks like a unexpected behavior)*";
5183
5184
  }
5184
5185
  else if (isMetadataAviailable && !isInstalled) {
5185
5186
  // TODO: [�][�]
5186
- more = "(not installed)";
5187
+ more = "*(not installed)*";
5187
5188
  }
5188
5189
  else if (!isMetadataAviailable && isInstalled) {
5189
- more = "(no metadata, looks like a unexpected behavior)";
5190
+ more = "*(no metadata, looks like a unexpected behavior)*";
5190
5191
  }
5191
5192
  else if (isMetadataAviailable && isInstalled) {
5192
5193
  more = "(installed)";
5193
5194
  }
5194
5195
  else {
5195
- more = "(unknown state, looks like a unexpected behavior)";
5196
+ more = "*(unknown state, looks like a unexpected behavior)*";
5196
5197
  }
5197
- return "".concat(i + 1, ") `").concat(className, "` from `").concat(packageName, "` ").concat(more);
5198
+ if (!isAvilableInBrowser) {
5199
+ more += " *(not available in browser)*";
5200
+ }
5201
+ return "".concat(i + 1, ") `").concat(className, "` from `").concat(packageName, "` compatible to scrape ").concat(mimeTypes.join(', '), " ").concat(more);
5198
5202
  })
5199
5203
  .join('\n')), "\n "); });
5200
5204
  }
@@ -5579,7 +5583,10 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
5579
5583
  return [7 /*endfinally*/];
5580
5584
  case 9:
5581
5585
  if (partialPieces === null) {
5582
- throw new KnowledgeScrapeError(spaceTrim(function (block) { return "\n Cannot scrape knowledge from source: ".concat(knowledgeSource.sourceContent, "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage()), "\n\n\n "); }));
5586
+ throw new KnowledgeScrapeError(spaceTrim(function (block) { return "\n Cannot scrape knowledge from source:\n \n > ".concat(block(knowledgeSource.sourceContent
5587
+ .split('\n')
5588
+ .map(function (line) { return "> ".concat(line); })
5589
+ .join('\n')), "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage()), "\n\n\n "); }));
5583
5590
  }
5584
5591
  pieces = partialPieces.map(function (partialPiece) { return (__assign(__assign({}, partialPiece), { sources: [
5585
5592
  {
@@ -10113,7 +10120,56 @@ function getPipelineInterface(pipeline) {
10113
10120
  * @public exported from `@promptbook/core`
10114
10121
  */
10115
10122
  function isPipelineInterfacesEqual(pipelineInterface1, pipelineInterface2) {
10116
- return JSON.stringify(Object.keys(pipelineInterface1)) === JSON.stringify(Object.keys(pipelineInterface2));
10123
+ var e_1, _a, e_2, _b;
10124
+ try {
10125
+ for (var _c = __values(['inputParameters', 'outputParameters']), _d = _c.next(); !_d.done; _d = _c.next()) {
10126
+ var whichParameters = _d.value;
10127
+ var parameters1 = pipelineInterface1[whichParameters]; // <- Note: `isPipelineInterfacesEqual` is just temporary solution, no need to fix this
10128
+ var parameters2 = pipelineInterface2[whichParameters];
10129
+ if (parameters1.length !== parameters2.length) {
10130
+ return false;
10131
+ }
10132
+ var _loop_1 = function (parameter) {
10133
+ var matchingParameter = parameters2.find(function (_a) {
10134
+ var name = _a.name;
10135
+ return name === parameter.name;
10136
+ });
10137
+ if (!matchingParameter) {
10138
+ return { value: false };
10139
+ }
10140
+ // Note: Do not compare description, it is not relevant for compatibility
10141
+ if (matchingParameter.isInput !== parameter.isInput) {
10142
+ return { value: false };
10143
+ }
10144
+ if (matchingParameter.isOutput !== parameter.isOutput) {
10145
+ return { value: false };
10146
+ }
10147
+ };
10148
+ try {
10149
+ for (var parameters1_1 = (e_2 = void 0, __values(parameters1)), parameters1_1_1 = parameters1_1.next(); !parameters1_1_1.done; parameters1_1_1 = parameters1_1.next()) {
10150
+ var parameter = parameters1_1_1.value;
10151
+ var state_1 = _loop_1(parameter);
10152
+ if (typeof state_1 === "object")
10153
+ return state_1.value;
10154
+ }
10155
+ }
10156
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
10157
+ finally {
10158
+ try {
10159
+ if (parameters1_1_1 && !parameters1_1_1.done && (_b = parameters1_1.return)) _b.call(parameters1_1);
10160
+ }
10161
+ finally { if (e_2) throw e_2.error; }
10162
+ }
10163
+ }
10164
+ }
10165
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
10166
+ finally {
10167
+ try {
10168
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
10169
+ }
10170
+ finally { if (e_1) throw e_1.error; }
10171
+ }
10172
+ return true;
10117
10173
  }
10118
10174
 
10119
10175
  /**