@promptbook/remote-client 0.84.0-9 → 0.84.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 (43) hide show
  1. package/README.md +21 -9
  2. package/esm/index.es.js +62 -9
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/cli.index.d.ts +4 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +12 -2
  6. package/esm/typings/src/_packages/deepseek.index.d.ts +8 -0
  7. package/esm/typings/src/_packages/types.index.d.ts +2 -0
  8. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  9. package/esm/typings/src/_packages/wizzard.index.d.ts +4 -0
  10. package/esm/typings/src/cli/cli-commands/about.d.ts +4 -1
  11. package/esm/typings/src/cli/cli-commands/hello.d.ts +3 -1
  12. package/esm/typings/src/cli/cli-commands/list-models.d.ts +3 -1
  13. package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +13 -0
  14. package/esm/typings/src/cli/cli-commands/make.d.ts +3 -1
  15. package/esm/typings/src/cli/cli-commands/prettify.d.ts +3 -1
  16. package/esm/typings/src/cli/cli-commands/run.d.ts +3 -1
  17. package/esm/typings/src/cli/cli-commands/runInteractiveChatbot.d.ts +1 -1
  18. package/esm/typings/src/cli/cli-commands/test-command.d.ts +3 -1
  19. package/esm/typings/src/config.d.ts +27 -1
  20. package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +1 -1
  21. package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
  22. package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +3 -1
  23. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +9 -0
  24. package/esm/typings/src/llm-providers/deepseek/DeepseekExecutionToolsOptions.d.ts +9 -0
  25. package/esm/typings/src/llm-providers/deepseek/createDeepseekExecutionTools.d.ts +14 -0
  26. package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +14 -0
  27. package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +15 -0
  28. package/esm/typings/src/pipeline/book-notation.d.ts +3 -2
  29. package/esm/typings/src/pipeline/prompt-notation.d.ts +18 -5
  30. package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +1 -1
  31. package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +5 -2
  32. package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.test.d.ts +1 -0
  33. package/esm/typings/src/utils/editable/utils/isFlatPipeline.test.d.ts +1 -0
  34. package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +3 -0
  35. package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +3 -0
  36. package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +3 -0
  37. package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +3 -0
  38. package/esm/typings/src/utils/files/mimeTypeToExtension.d.ts +10 -0
  39. package/esm/typings/src/utils/files/mimeTypeToExtension.test.d.ts +1 -0
  40. package/esm/typings/src/wizzard/wizzard.d.ts +7 -1
  41. package/package.json +9 -16
  42. package/umd/index.umd.js +62 -9
  43. package/umd/index.umd.js.map +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <!-- ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten -->
2
2
 
3
- # Promptbook
3
+ # Promptbook
4
4
 
5
5
 
6
6
 
@@ -14,19 +14,16 @@
14
14
 
15
15
 
16
16
 
17
- ## New Features
17
+ ## 🌟 New Features
18
18
 
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)**
19
21
  - 💙 Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
20
22
  - 🖤 Run books from CLI - `npx ptbk run path/to/your/book`
21
- - 📚 Support of `.docx`, `.doc` and `.pdf` documents
22
- - ✨ **Support of [OpenAI o1 model](https://openai.com/o1/)**
23
+ - 📚 Support of `.docx`, `.doc` and `.pdf` documents as knowledge
23
24
 
24
25
 
25
26
 
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
-
30
27
  ## 📦 Package `@promptbook/remote-client`
31
28
 
32
29
  - Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
@@ -263,8 +260,9 @@ Or you can install them separately:
263
260
  - **[@promptbook/anthropic-claude](https://www.npmjs.com/package/@promptbook/anthropic-claude)** - Execution tools for Anthropic Claude API, wrapper around Anthropic Claude SDK
264
261
  - **[@promptbook/vercel](https://www.npmjs.com/package/@promptbook/vercel)** - Adapter for Vercel functionalities
265
262
  - **[@promptbook/google](https://www.npmjs.com/package/@promptbook/google)** - Integration with Google's Gemini API
263
+ - **[@promptbook/deepseek](https://www.npmjs.com/package/@promptbook/deepseek)** - Integration with [DeepSeek API](https://www.deepseek.com/)
266
264
  - **[@promptbook/azure-openai](https://www.npmjs.com/package/@promptbook/azure-openai)** - Execution tools for Azure OpenAI API
267
- - **[@promptbook/langtail](https://www.npmjs.com/package/@promptbook/langtail)** - Execution tools for Langtail API, wrapper around Langtail SDK
265
+
268
266
  - **[@promptbook/fake-llm](https://www.npmjs.com/package/@promptbook/fake-llm)** - Mocked execution tools for testing the library and saving the tokens
269
267
  - **[@promptbook/remote-client](https://www.npmjs.com/package/@promptbook/remote-client)** - Remote client for remote execution of promptbooks
270
268
  - **[@promptbook/remote-server](https://www.npmjs.com/package/@promptbook/remote-server)** - Remote server for remote execution of promptbooks
@@ -434,6 +432,20 @@ See [TODO.md](./TODO.md)
434
432
 
435
433
 
436
434
 
435
+ ## 🤝 Partners
436
+
437
+ <div style="display: flex; align-items: center; gap: 20px;">
438
+
439
+ <a href="https://promptbook.studio/">
440
+ <img src="./other/design/promptbook-studio-logo.png" alt="Partner 3" height="100">
441
+ </a>
442
+
443
+ <a href="https://technologickainkubace.org/en/about-technology-incubation/about-the-project/">
444
+ <img src="./other/partners/CI-Technology-Incubation.png" alt="Technology Incubation" height="100">
445
+ </a>
446
+
447
+ </div>
448
+
437
449
  ## 🖋️ Contributing
438
450
 
439
451
  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).
package/esm/index.es.js CHANGED
@@ -19,7 +19,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
19
19
  * @generated
20
20
  * @see https://github.com/webgptorg/promptbook
21
21
  */
22
- var PROMPTBOOK_ENGINE_VERSION = '0.84.0-8';
22
+ var PROMPTBOOK_ENGINE_VERSION = '0.84.0-21';
23
23
  /**
24
24
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
25
25
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -430,6 +430,12 @@ var DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
430
430
  * @public exported from `@promptbook/core`
431
431
  */
432
432
  var DEFAULT_TASK_TITLE = "Task";
433
+ /**
434
+ * When the pipeline is flat and no name of return parameter is provided, this name is used
435
+ *
436
+ * @public exported from `@promptbook/core`
437
+ */
438
+ var DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
433
439
  /**
434
440
  * Timeout for the connections in milliseconds
435
441
  *
@@ -645,7 +651,7 @@ function preparePipelineOnRemoteServer(pipeline, options) {
645
651
  });
646
652
  }
647
653
  /**
648
- * TODO: !!!! Do not return Promise<PipelineJson> But PreparePipelineTask
654
+ * TODO: [🐚] Do not return Promise<PipelineJson> But PreparePipelineTask
649
655
  */
650
656
 
651
657
  /**
@@ -4448,7 +4454,10 @@ var QuickChatbotHla = {
4448
4454
  description: 'Chatbot response',
4449
4455
  isInput: false,
4450
4456
  isOutput: true,
4451
- exampleValues: ['Hello, I am a Pavol`s virtual avatar. How can I help you?'],
4457
+ exampleValues: [
4458
+ 'Hello, how can I help you?',
4459
+ // <- TODO: [🧠] Make this dynamic, async, prepare-phase HLAs
4460
+ ],
4452
4461
  });
4453
4462
  // TODO: Use spaceTrim in multiline strings
4454
4463
  $pipelineJson.tasks.push({
@@ -4508,6 +4517,21 @@ var HIGH_LEVEL_ABSTRACTIONS = [
4508
4517
  * Note: [💞] Ignore a discrepancy between file name and entity name
4509
4518
  */
4510
4519
 
4520
+ /**
4521
+ * Checks if value is valid email
4522
+ *
4523
+ * @public exported from `@promptbook/utils`
4524
+ */
4525
+ function isValidEmail(email) {
4526
+ if (typeof email !== 'string') {
4527
+ return false;
4528
+ }
4529
+ if (email.split('\n').length > 1) {
4530
+ return false;
4531
+ }
4532
+ return /^.+@.+\..+$/.test(email);
4533
+ }
4534
+
4511
4535
  /**
4512
4536
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
4513
4537
  * It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
@@ -4521,6 +4545,15 @@ function validatePipelineString(pipelineString) {
4521
4545
  if (isValidJsonString(pipelineString)) {
4522
4546
  throw new ParseError('Expected a book, but got a JSON string');
4523
4547
  }
4548
+ else if (isValidUrl(pipelineString)) {
4549
+ throw new ParseError("Expected a book, but got just the URL \"".concat(pipelineString, "\""));
4550
+ }
4551
+ else if (isValidFilePath(pipelineString)) {
4552
+ throw new ParseError("Expected a book, but got just the file path \"".concat(pipelineString, "\""));
4553
+ }
4554
+ else if (isValidEmail(pipelineString)) {
4555
+ throw new ParseError("Expected a book, but got just the email \"".concat(pipelineString, "\""));
4556
+ }
4524
4557
  // <- TODO: Implement the validation + add tests when the pipeline logic considered as invalid
4525
4558
  return pipelineString;
4526
4559
  }
@@ -4556,12 +4589,15 @@ function isFlatPipeline(pipelineString) {
4556
4589
  pipelineString = removeMarkdownComments(pipelineString);
4557
4590
  pipelineString = spaceTrim$1(pipelineString);
4558
4591
  var isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
4559
- var isLastLineReturnStatement = pipelineString.split('\n').pop().split('`').join('').startsWith('->');
4560
- // TODO: Also (double)check
4592
+ //const isLastLineReturnStatement = pipelineString.split('\n').pop()!.split('`').join('').startsWith('->');
4593
+ var isBacktickBlockUsed = pipelineString.includes('```');
4594
+ var isQuoteBlocksUsed = /^>\s+/m.test(pipelineString);
4595
+ var isBlocksUsed = isBacktickBlockUsed || isQuoteBlocksUsed;
4596
+ // TODO: [🧉] Also (double)check
4561
4597
  // > const usedCommands
4562
4598
  // > const isBlocksUsed
4563
4599
  // > const returnStatementCount
4564
- var isFlat = !isMarkdownBeginningWithHeadline && isLastLineReturnStatement;
4600
+ var isFlat = !isMarkdownBeginningWithHeadline && !isBlocksUsed; /* && isLastLineReturnStatement */
4565
4601
  return isFlat;
4566
4602
  }
4567
4603
 
@@ -4575,9 +4611,26 @@ function deflatePipeline(pipelineString) {
4575
4611
  return pipelineString;
4576
4612
  }
4577
4613
  var pipelineStringLines = pipelineString.split('\n');
4578
- var returnStatement = pipelineStringLines.pop();
4614
+ var potentialReturnStatement = pipelineStringLines.pop();
4615
+ var returnStatement;
4616
+ if (/(-|=)>\s*\{.*\}/.test(potentialReturnStatement)) {
4617
+ // Note: Last line is return statement
4618
+ returnStatement = potentialReturnStatement;
4619
+ }
4620
+ else {
4621
+ // Note: Last line is not a return statement
4622
+ returnStatement = "-> {".concat(DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, "}");
4623
+ pipelineStringLines.push(potentialReturnStatement);
4624
+ }
4579
4625
  var prompt = spaceTrim$1(pipelineStringLines.join('\n'));
4580
- pipelineString = validatePipelineString(spaceTrim$1(function (block) { return "\n # ".concat(DEFAULT_BOOK_TITLE, "\n\n ## Prompt\n\n ```\n ").concat(block(prompt), "\n ```\n\n ").concat(returnStatement, "\n "); }));
4626
+ var quotedPrompt;
4627
+ if (prompt.split('\n').length <= 1) {
4628
+ quotedPrompt = "> ".concat(prompt);
4629
+ }
4630
+ else {
4631
+ quotedPrompt = spaceTrim$1(function (block) { return "\n ```\n ".concat(block(prompt.split('`').join('\\`')), "\n ```\n "); });
4632
+ }
4633
+ pipelineString = validatePipelineString(spaceTrim$1(function (block) { return "\n # ".concat(DEFAULT_BOOK_TITLE, "\n\n ## Prompt\n\n ").concat(block(quotedPrompt), "\n\n ").concat(returnStatement, "\n "); }));
4581
4634
  // <- TODO: Maybe use book` notation
4582
4635
  return pipelineString;
4583
4636
  }
@@ -5583,7 +5636,7 @@ function compilePipelineOnRemoteServer(pipelineString, options) {
5583
5636
  });
5584
5637
  }
5585
5638
  /**
5586
- * TODO: !!!! Do not return Promise<PipelineJson> But PreparePipelineTask
5639
+ * TODO: [🐚] Do not return Promise<PipelineJson> But PreparePipelineTask
5587
5640
  */
5588
5641
 
5589
5642
  /**