@promptbook/cli 0.84.0-16 โ†’ 0.84.0-18

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 CHANGED
@@ -16,7 +16,8 @@
16
16
 
17
17
  ## ๐ŸŒŸ New Features
18
18
 
19
- - ๐Ÿ‹ **Support of [DeepSeek models](https://www.deepseek.com/)**
19
+ - ๐Ÿ’ซ Support of [`o3-mini` model by OpenAI](https://openai.com/index/openai-o3-mini/)
20
+ - ๐Ÿ‹ **Support of [DeepSeek models](https://www.npmjs.com/package/@promptbook/deepseek)**
20
21
  - ๐Ÿ’™ Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
21
22
  - ๐Ÿ–ค Run books from CLI - `npx ptbk run path/to/your/book`
22
23
  - ๐Ÿ“š Support of `.docx`, `.doc` and `.pdf` documents as knowledge
@@ -492,6 +493,10 @@ See [TODO.md](./TODO.md)
492
493
 
493
494
 
494
495
 
496
+ ## ๐Ÿค Partners
497
+
498
+ [![Technology Incubation](./other/partners/CI-Technology-Incubation.png)](https://technologickainkubace.org/en/about-technology-incubation/about-the-project/)
499
+
495
500
  ## ๐Ÿ–‹๏ธ Contributing
496
501
 
497
502
  I am open to pull requests, feedback, and suggestions. Or if you like this utility, you can [โ˜• buy me a coffee](https://www.buymeacoffee.com/hejny) or [donate via cryptocurrencies](https://github.com/hejny/hejny/blob/main/documents/crypto.md).
@@ -11,5 +11,6 @@ const { _CLI } = require('../umd/index.umd.js');
11
11
  _CLI._initialize_promptbookCli();
12
12
 
13
13
  /**
14
+ * TODO: !!! During the build check that this file exists
14
15
  * TODO: [๐Ÿ•Œ] When more functionalities, rename
15
16
  */
package/esm/index.es.js CHANGED
@@ -38,7 +38,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
38
38
  * @generated
39
39
  * @see https://github.com/webgptorg/promptbook
40
40
  */
41
- var PROMPTBOOK_ENGINE_VERSION = '0.84.0-15';
41
+ var PROMPTBOOK_ENGINE_VERSION = '0.84.0-17';
42
42
  /**
43
43
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
44
44
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -235,6 +235,12 @@ var DEFAULT_TASK_TITLE = "Task";
235
235
  * @public exported from `@promptbook/core`
236
236
  */
237
237
  var DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
238
+ /**
239
+ * Maximum file size limit
240
+ *
241
+ * @public exported from `@promptbook/core`
242
+ */
243
+ var DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
238
244
  /**
239
245
  * Warning message for the generated sections and files files
240
246
  *
@@ -6527,11 +6533,10 @@ var scraperFetch = function (url, init) { return __awaiter(void 0, void 0, void
6527
6533
  function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
6528
6534
  var _a;
6529
6535
  return __awaiter(this, void 0, void 0, function () {
6530
- var _b, fetch, knowledgeSourceContent, name, _c, _d, rootDirname, url, response_1, mimeType, basename, hash, rootDirname_1, filepath, _f, _g, _h, _j, _k, filename_1, fileExtension, mimeType;
6531
- return __generator(this, function (_l) {
6532
- switch (_l.label) {
6536
+ var _b, fetch, knowledgeSourceContent, name, _c, _d, rootDirname, url, response_1, mimeType, basename, hash, rootDirname_1, filepath, fileContent, _f, _g, filename_1, fileExtension, mimeType;
6537
+ return __generator(this, function (_h) {
6538
+ switch (_h.label) {
6533
6539
  case 0:
6534
- console.log('!!! makeKnowledgeSourceHandler', knowledgeSource);
6535
6540
  _b = tools.fetch, fetch = _b === void 0 ? scraperFetch : _b;
6536
6541
  knowledgeSourceContent = knowledgeSource.knowledgeSourceContent;
6537
6542
  name = knowledgeSource.name;
@@ -6543,7 +6548,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
6543
6548
  url = knowledgeSourceContent;
6544
6549
  return [4 /*yield*/, fetch(url)];
6545
6550
  case 1:
6546
- response_1 = _l.sent();
6551
+ response_1 = _h.sent();
6547
6552
  mimeType = ((_a = response_1.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.split(';')[0]) || 'text/html';
6548
6553
  if (tools.fs === undefined || !url.endsWith('.pdf' /* <- TODO: [๐Ÿ’ต] */)) {
6549
6554
  return [2 /*return*/, {
@@ -6593,17 +6598,19 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
6593
6598
  filepath = join.apply(void 0, __spreadArray(__spreadArray([], __read(nameToSubfolderPath(hash /* <- TODO: [๐ŸŽŽ] Maybe add some SHA256 prefix */)), false), ["".concat(basename.substring(0, MAX_FILENAME_LENGTH), ".").concat(mimeTypeToExtension(mimeType))], false));
6594
6599
  return [4 /*yield*/, tools.fs.mkdir(dirname(join(rootDirname_1, filepath)), { recursive: true })];
6595
6600
  case 2:
6596
- _l.sent();
6597
- _g = (_f = tools.fs).writeFile;
6598
- _h = [join(rootDirname_1, filepath)];
6599
- _k = (_j = Buffer).from;
6601
+ _h.sent();
6602
+ _g = (_f = Buffer).from;
6600
6603
  return [4 /*yield*/, response_1.arrayBuffer()];
6601
- case 3: return [4 /*yield*/, _g.apply(_f, _h.concat([_k.apply(_j, [_l.sent()])]))];
6604
+ case 3:
6605
+ fileContent = _g.apply(_f, [_h.sent()]);
6606
+ if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
6607
+ throw new LimitReachedError("File is too large (".concat(Math.round(fileContent.length / 1024 / 1024), "MB). Maximum allowed size is ").concat(Math.round(DEFAULT_MAX_FILE_SIZE / 1024 / 1024), "MB."));
6608
+ }
6609
+ return [4 /*yield*/, tools.fs.writeFile(join(rootDirname_1, filepath), fileContent)];
6602
6610
  case 4:
6603
- _l.sent();
6611
+ _h.sent();
6604
6612
  // TODO: [๐Ÿ’ต] Check the file security
6605
- // TODO: !!!!!!!! Check the file size (if it is not too big)
6606
- // TODO: !!!!!!!! Delete the file after the scraping is done
6613
+ // TODO: [๐Ÿงน][๐Ÿง ] Delete the file after the scraping is done
6607
6614
  return [2 /*return*/, makeKnowledgeSourceHandler({ name: name, knowledgeSourceContent: filepath }, tools, __assign(__assign({}, options), { rootDirname: rootDirname_1 }))];
6608
6615
  case 5:
6609
6616
  if (!isValidFilePath(knowledgeSourceContent)) return [3 /*break*/, 7];
@@ -6620,7 +6627,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
6620
6627
  mimeType = extensionToMimeType(fileExtension || '');
6621
6628
  return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
6622
6629
  case 6:
6623
- if (!(_l.sent())) {
6630
+ if (!(_h.sent())) {
6624
6631
  throw new NotFoundError(spaceTrim(function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(knowledgeSourceContent), "\n\n Full file path:\n ").concat(block(filename_1), "\n "); }));
6625
6632
  }
6626
6633
  // TODO: [๐Ÿง ][๐Ÿ˜ฟ] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
@@ -14658,6 +14665,30 @@ var OPENAI_MODELS = exportJson({
14658
14665
  },
14659
14666
  /**/
14660
14667
  /**/
14668
+ {
14669
+ modelVariant: 'CHAT',
14670
+ modelTitle: 'o1',
14671
+ modelName: 'o1',
14672
+ pricing: {
14673
+ prompt: computeUsage("$3.00 / 1M tokens"),
14674
+ output: computeUsage("$12.00 / 1M tokens"),
14675
+ // <- TODO: !!! Unsure, check the pricing
14676
+ },
14677
+ },
14678
+ /**/
14679
+ /**/
14680
+ {
14681
+ modelVariant: 'CHAT',
14682
+ modelTitle: 'o3-mini',
14683
+ modelName: 'o3-mini',
14684
+ pricing: {
14685
+ prompt: computeUsage("$3.00 / 1M tokens"),
14686
+ output: computeUsage("$12.00 / 1M tokens"),
14687
+ // <- TODO: !!! Unsure, check the pricing
14688
+ },
14689
+ },
14690
+ /**/
14691
+ /**/
14661
14692
  {
14662
14693
  modelVariant: 'CHAT',
14663
14694
  modelTitle: 'o1-mini-2024-09-12',
@@ -15286,7 +15317,7 @@ var createDeepseekExecutionTools = Object.assign(function (options) {
15286
15317
  // TODO: [๐Ÿ•˜] Maybe list models in same way as in other providers - in separate file with metadata
15287
15318
  'deepseek-chat',
15288
15319
  'deepseek-reasoner',
15289
- // <- TODO: !!!!!! Picking of default model
15320
+ // <- TODO: How picking of the default model looks like in `createExecutionToolsFromVercelProvider`
15290
15321
  ].map(function (modelName) { return ({ modelName: modelName, modelVariant: 'CHAT' }); }) }, options));
15291
15322
  }, {
15292
15323
  packageName: '@promptbook/deepseek',
@@ -17112,7 +17143,7 @@ var MarkitdownScraper = /** @class */ (function () {
17112
17143
  // Note: Module `markitdown-ts` has no types available, so it is imported using `require`
17113
17144
  // eslint-disable-next-line @typescript-eslint/no-var-requires
17114
17145
  var MarkItDown = require('markitdown-ts').MarkItDown;
17115
- // <- TODO: 'Use Markitdown directly not through this package
17146
+ // <- TODO: [๐Ÿ€] Use Markitdown directly not through this package
17116
17147
  this.markitdown = new MarkItDown();
17117
17148
  }
17118
17149
  Object.defineProperty(MarkitdownScraper.prototype, "metadata", {
@@ -17157,7 +17188,7 @@ var MarkitdownScraper = /** @class */ (function () {
17157
17188
  case 2:
17158
17189
  if (!!(_f.sent())) return [3 /*break*/, 5];
17159
17190
  src = source.filename || source.url || null;
17160
- // console.log('!!!', { src, source, cacheFilehandler });
17191
+ // console.log('!!', { src, source, cacheFilehandler });
17161
17192
  if (src === null) {
17162
17193
  throw new UnexpectedError('Source has no filename or url');
17163
17194
  }
@@ -17170,12 +17201,12 @@ var MarkitdownScraper = /** @class */ (function () {
17170
17201
  result = _f.sent();
17171
17202
  if (result === null || result === undefined) {
17172
17203
  throw new Error("Markitdown could not convert the \"".concat(source.source, "\""));
17173
- // <- TODO: !!! Make MarkitdownError
17204
+ // <- TODO: [๐Ÿ€] Make MarkitdownError
17174
17205
  }
17175
- // console.log('!!!', { result, cacheFilehandler });
17206
+ // console.log('!!', { result, cacheFilehandler });
17176
17207
  return [4 /*yield*/, this.tools.fs.writeFile(cacheFilehandler.filename, result.text_content)];
17177
17208
  case 4:
17178
- // console.log('!!!', { result, cacheFilehandler });
17209
+ // console.log('!!', { result, cacheFilehandler });
17179
17210
  _f.sent();
17180
17211
  _f.label = 5;
17181
17212
  case 5: return [2 /*return*/, cacheFilehandler];