@promptbook/editable 0.84.0-13 → 0.84.0-15

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/LICENSE.md ADDED
@@ -0,0 +1 @@
1
+ [Functional Source License, Version 1.1, ALv2 Future License](https://github.com/getsentry/fsl.software/blob/main/FSL-1.1-ALv2.template.md)
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
 
@@ -16,10 +16,10 @@
16
16
 
17
17
  ## ❄ New Features
18
18
 
19
+ - 🐋 **Support of [DeepSeek models](https://www.deepseek.com/)**
19
20
  - 💙 Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
20
21
  - 🖤 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/)**
22
+ - 📚 Support of `.docx`, `.doc` and `.pdf` documents as knowledge
23
23
 
24
24
 
25
25
 
package/esm/index.es.js CHANGED
@@ -17,7 +17,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
17
17
  * @generated
18
18
  * @see https://github.com/webgptorg/promptbook
19
19
  */
20
- var PROMPTBOOK_ENGINE_VERSION = '0.84.0-12';
20
+ var PROMPTBOOK_ENGINE_VERSION = '0.84.0-14';
21
21
  /**
22
22
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
23
23
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -188,6 +188,12 @@ var ADMIN_GITHUB_NAME = 'hejny';
188
188
  * @public exported from `@promptbook/core`
189
189
  */
190
190
  var DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
191
+ /**
192
+ * When the pipeline is flat and no name of return parameter is provided, this name is used
193
+ *
194
+ * @public exported from `@promptbook/core`
195
+ */
196
+ var DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
191
197
  // <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
192
198
  /**
193
199
  * The maximum number of iterations for a loops
@@ -3932,12 +3938,15 @@ function isFlatPipeline(pipelineString) {
3932
3938
  pipelineString = removeMarkdownComments(pipelineString);
3933
3939
  pipelineString = spaceTrim(pipelineString);
3934
3940
  var isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
3935
- var isLastLineReturnStatement = pipelineString.split('\n').pop().split('`').join('').startsWith('->');
3936
- // TODO: Also (double)check
3941
+ //const isLastLineReturnStatement = pipelineString.split('\n').pop()!.split('`').join('').startsWith('->');
3942
+ var isBacktickBlockUsed = pipelineString.includes('```');
3943
+ var isQuoteBlocksUsed = /^>\s+/m.test(pipelineString);
3944
+ var isBlocksUsed = isBacktickBlockUsed || isQuoteBlocksUsed;
3945
+ // TODO: [🧉] Also (double)check
3937
3946
  // > const usedCommands
3938
3947
  // > const isBlocksUsed
3939
3948
  // > const returnStatementCount
3940
- var isFlat = !isMarkdownBeginningWithHeadline && isLastLineReturnStatement;
3949
+ var isFlat = !isMarkdownBeginningWithHeadline && !isBlocksUsed; /* && isLastLineReturnStatement */
3941
3950
  return isFlat;
3942
3951
  }
3943
3952
 
@@ -3951,9 +3960,26 @@ function deflatePipeline(pipelineString) {
3951
3960
  return pipelineString;
3952
3961
  }
3953
3962
  var pipelineStringLines = pipelineString.split('\n');
3954
- var returnStatement = pipelineStringLines.pop();
3963
+ var potentialReturnStatement = pipelineStringLines.pop();
3964
+ var returnStatement;
3965
+ if (/(-|=)>\s*\{.*\}/.test(potentialReturnStatement)) {
3966
+ // Note: Last line is return statement
3967
+ returnStatement = potentialReturnStatement;
3968
+ }
3969
+ else {
3970
+ // Note: Last line is not a return statement
3971
+ returnStatement = "-> {".concat(DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, "}");
3972
+ pipelineStringLines.push(potentialReturnStatement);
3973
+ }
3955
3974
  var prompt = spaceTrim(pipelineStringLines.join('\n'));
3956
- pipelineString = validatePipelineString(spaceTrim(function (block) { return "\n # ".concat(DEFAULT_BOOK_TITLE, "\n\n ## Prompt\n\n ```\n ").concat(block(prompt), "\n ```\n\n ").concat(returnStatement, "\n "); }));
3975
+ var quotedPrompt;
3976
+ if (prompt.split('\n').length <= 1) {
3977
+ quotedPrompt = "> ".concat(prompt);
3978
+ }
3979
+ else {
3980
+ quotedPrompt = spaceTrim(function (block) { return "\n ```\n ".concat(block(prompt.split('`').join('\\`')), "\n ```\n "); });
3981
+ }
3982
+ pipelineString = validatePipelineString(spaceTrim(function (block) { return "\n # ".concat(DEFAULT_BOOK_TITLE, "\n\n ## Prompt\n\n ").concat(block(quotedPrompt), "\n\n ").concat(returnStatement, "\n "); }));
3957
3983
  // <- TODO: Maybe use book` notation
3958
3984
  return pipelineString;
3959
3985
  }