@promptbook/documents 0.81.0-8 → 0.81.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 (95) hide show
  1. package/README.md +25 -8
  2. package/esm/index.es.js +259 -166
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/books/index.d.ts +38 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +12 -4
  6. package/esm/typings/src/_packages/markdown-utils.index.d.ts +2 -2
  7. package/esm/typings/src/_packages/node.index.d.ts +0 -2
  8. package/esm/typings/src/_packages/templates.index.d.ts +2 -2
  9. package/esm/typings/src/_packages/types.index.d.ts +4 -0
  10. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  11. package/esm/typings/src/_packages/wizzard.index.d.ts +44 -0
  12. package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
  13. package/esm/typings/src/cli/cli-commands/run.d.ts +2 -2
  14. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +11 -0
  15. package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
  16. package/esm/typings/src/commands/index.d.ts +1 -1
  17. package/esm/typings/src/config.d.ts +3 -3
  18. package/esm/typings/src/conversion/compilePipeline.d.ts +1 -4
  19. package/esm/typings/src/conversion/{precompilePipeline.d.ts → parsePipeline.d.ts} +3 -3
  20. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -3
  21. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +7 -7
  22. package/esm/typings/src/errors/utils/getErrorReportUrl.d.ts +1 -1
  23. package/esm/typings/src/execution/PipelineExecutor.d.ts +2 -2
  24. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +2 -2
  25. package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +9 -4
  26. package/esm/typings/src/formfactors/image-generator/ImageGeneratorFormfactorDefinition.d.ts +24 -0
  27. package/esm/typings/src/formfactors/index.d.ts +31 -9
  28. package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +1 -1
  29. package/esm/typings/src/high-level-abstractions/index.d.ts +3 -3
  30. package/esm/typings/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +3 -0
  31. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
  32. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
  33. package/esm/typings/src/llm-providers/_common/register/{$provideLlmToolsForCli.d.ts → $provideLlmToolsForWizzardOrCli.d.ts} +2 -2
  34. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
  35. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  36. package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +2 -2
  37. package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +2 -2
  38. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -0
  39. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +2 -0
  40. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +1 -0
  41. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -0
  42. package/esm/typings/src/llm-providers/google/register-configuration.d.ts +1 -0
  43. package/esm/typings/src/llm-providers/google/register-constructor.d.ts +1 -0
  44. package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +1 -1
  45. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -0
  46. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +2 -0
  47. package/esm/typings/src/llm-providers/vercel/playground/playground.d.ts +1 -1
  48. package/esm/typings/src/other/templates/getBookTemplates.d.ts +22 -0
  49. package/esm/typings/src/personas/preparePersona.d.ts +4 -4
  50. package/esm/typings/src/pipeline/PipelineString.d.ts +0 -3
  51. package/esm/typings/src/pipeline/book-notation.d.ts +14 -0
  52. package/esm/typings/src/pipeline/isValidPipelineString.d.ts +13 -0
  53. package/esm/typings/src/pipeline/isValidPipelineString.test.d.ts +4 -0
  54. package/esm/typings/src/pipeline/validatePipelineString.d.ts +14 -0
  55. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +3 -1
  56. package/esm/typings/src/prepare/preparePipeline.d.ts +2 -0
  57. package/esm/typings/src/prepare/prepareTasks.d.ts +1 -1
  58. package/esm/typings/src/scrapers/_common/Converter.d.ts +1 -0
  59. package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -1
  60. package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +3 -0
  61. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +2 -0
  62. package/esm/typings/src/scrapers/_common/utils/scraperFetch.d.ts +3 -0
  63. package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -0
  64. package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -0
  65. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -0
  66. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -0
  67. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -0
  68. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -0
  69. package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -0
  70. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
  71. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -0
  72. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +2 -1
  73. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +3 -1
  74. package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -0
  75. package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -0
  76. package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.test.d.ts +1 -1
  77. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +2 -1
  78. package/esm/typings/src/types/typeAliases.d.ts +16 -2
  79. package/esm/typings/src/utils/markdown/flattenMarkdown.d.ts +1 -1
  80. package/esm/typings/src/utils/markdown/{removeContentComments.d.ts → removeMarkdownComments.d.ts} +2 -2
  81. package/esm/typings/src/utils/organization/$sideEffect.d.ts +9 -0
  82. package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +1 -1
  83. package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +2 -2
  84. package/esm/typings/src/utils/validators/filePath/isRootPath.d.ts +12 -0
  85. package/esm/typings/src/utils/validators/filePath/isRootPath.test.d.ts +4 -0
  86. package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +3 -0
  87. package/esm/typings/src/wizzard/$getCompiledBook.d.ts +16 -0
  88. package/esm/typings/src/wizzard/wizzard.d.ts +52 -8
  89. package/package.json +2 -2
  90. package/umd/index.umd.js +259 -166
  91. package/umd/index.umd.js.map +1 -1
  92. package/esm/typings/src/other/templates/getBookTemplate.d.ts +0 -21
  93. package/esm/typings/src/scripting/javascript/utils/unknownToString.d.ts +0 -8
  94. /package/esm/typings/src/conversion/{precompilePipeline.test.d.ts → parsePipeline.test.d.ts} +0 -0
  95. /package/esm/typings/src/utils/markdown/{removeContentComments.test.d.ts → removeMarkdownComments.test.d.ts} +0 -0
package/esm/index.es.js CHANGED
@@ -25,7 +25,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
25
25
  * @generated
26
26
  * @see https://github.com/webgptorg/promptbook
27
27
  */
28
- var PROMPTBOOK_ENGINE_VERSION = '0.81.0-7';
28
+ var PROMPTBOOK_ENGINE_VERSION = '0.81.0-24';
29
29
  /**
30
30
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
31
31
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -190,6 +190,12 @@ var ADMIN_EMAIL = 'me@pavolhejny.com';
190
190
  * @public exported from `@promptbook/core`
191
191
  */
192
192
  var ADMIN_GITHUB_NAME = 'hejny';
193
+ /**
194
+ * When the title is not provided, the default title is used
195
+ *
196
+ * @public exported from `@promptbook/core`
197
+ */
198
+ var DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
193
199
  // <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
194
200
  /**
195
201
  * The maximum number of iterations for a loops
@@ -339,7 +345,7 @@ var MissingToolsError = /** @class */ (function (_super) {
339
345
  /**
340
346
  * Make error report URL for the given error
341
347
  *
342
- * @private !!!!!!
348
+ * @private private within the repository
343
349
  */
344
350
  function getErrorReportUrl(error) {
345
351
  var report = {
@@ -945,21 +951,44 @@ function isValidFilePath(filename) {
945
951
  if (typeof filename !== 'string') {
946
952
  return false;
947
953
  }
954
+ if (filename.split('\n').length > 1) {
955
+ return false;
956
+ }
957
+ if (filename.split(' ').length >
958
+ 5 /* <- TODO: [🧠][🈷] Make some better non-arbitrary way how to distinct filenames from informational texts */) {
959
+ return false;
960
+ }
948
961
  var filenameSlashes = filename.split('\\').join('/');
949
962
  // Absolute Unix path: /hello.txt
950
963
  if (/^(\/)/i.test(filenameSlashes)) {
964
+ // console.log(filename, 'Absolute Unix path: /hello.txt');
951
965
  return true;
952
966
  }
953
967
  // Absolute Windows path: /hello.txt
954
968
  if (/^([A-Z]{1,2}:\/?)\//i.test(filenameSlashes)) {
969
+ // console.log(filename, 'Absolute Windows path: /hello.txt');
955
970
  return true;
956
971
  }
957
972
  // Relative path: ./hello.txt
958
973
  if (/^(\.\.?\/)+/i.test(filenameSlashes)) {
974
+ // console.log(filename, 'Relative path: ./hello.txt');
975
+ return true;
976
+ }
977
+ // Allow paths like foo/hello
978
+ if (/^[^/]+\/[^/]+/i.test(filenameSlashes)) {
979
+ // console.log(filename, 'Allow paths like foo/hello');
980
+ return true;
981
+ }
982
+ // Allow paths like hello.book
983
+ if (/^[^/]+\.[^/]+$/i.test(filenameSlashes)) {
984
+ // console.log(filename, 'Allow paths like hello.book');
959
985
  return true;
960
986
  }
961
987
  return false;
962
988
  }
989
+ /**
990
+ * TODO: [🍏] Implement for MacOs
991
+ */
963
992
 
964
993
  /**
965
994
  * Tests if given string is valid URL.
@@ -1085,7 +1114,67 @@ function getScraperIntermediateSource(source, options) {
1085
1114
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
1086
1115
  */
1087
1116
 
1088
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book.md`\n- INPUT PARAMETER `{availableModelNames}` List of available model names separated by comma (,)\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n\\`\\`\\`json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelRequirements}`\n"}],sourceFile:"./books/prepare-persona.book.md"}];
1117
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book.md`\n- INPUT PARAMETER `{availableModelNames}` List of available model names separated by comma (,)\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n\\`\\`\\`json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelRequirements}`\n"}],sourceFile:"./books/prepare-persona.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book.md",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book.md`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book.md"}];
1118
+
1119
+ /**
1120
+ * Function isValidJsonString will tell you if the string is valid JSON or not
1121
+ *
1122
+ * @public exported from `@promptbook/utils`
1123
+ */
1124
+ function isValidJsonString(value /* <- [👨‍⚖️] */) {
1125
+ try {
1126
+ JSON.parse(value);
1127
+ return true;
1128
+ }
1129
+ catch (error) {
1130
+ if (!(error instanceof Error)) {
1131
+ throw error;
1132
+ }
1133
+ if (error.message.includes('Unexpected token')) {
1134
+ return false;
1135
+ }
1136
+ return false;
1137
+ }
1138
+ }
1139
+
1140
+ /**
1141
+ * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
1142
+ *
1143
+ * @public exported from `@promptbook/core`
1144
+ */
1145
+ var ParseError = /** @class */ (function (_super) {
1146
+ __extends(ParseError, _super);
1147
+ function ParseError(message) {
1148
+ var _this = _super.call(this, message) || this;
1149
+ _this.name = 'ParseError';
1150
+ Object.setPrototypeOf(_this, ParseError.prototype);
1151
+ return _this;
1152
+ }
1153
+ return ParseError;
1154
+ }(Error));
1155
+ /**
1156
+ * TODO: Maybe split `ParseError` and `ApplyError`
1157
+ */
1158
+
1159
+ /**
1160
+ * Function `validatePipelineString` will validate the if the string is a valid pipeline string
1161
+ * 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.
1162
+ *
1163
+ * @param {string} pipelineString the candidate for a pipeline string
1164
+ * @returns {PipelineString} the same string as input, but validated as valid
1165
+ * @throws {ParseError} if the string is not a valid pipeline string
1166
+ * @public exported from `@promptbook/core`
1167
+ */
1168
+ function validatePipelineString(pipelineString) {
1169
+ if (isValidJsonString(pipelineString)) {
1170
+ throw new ParseError('Expected a book, but got a JSON string');
1171
+ }
1172
+ // <- TODO: Implement the validation + add tests when the pipeline logic considered as invalid
1173
+ return pipelineString;
1174
+ }
1175
+ /**
1176
+ * TODO: [🧠][🈴] Where is the best location for this file
1177
+ */
1089
1178
 
1090
1179
  /**
1091
1180
  * Prettify the html code
@@ -1153,7 +1242,7 @@ function pipelineJsonToString(pipelineJson) {
1153
1242
  if (bookVersion !== "undefined") {
1154
1243
  commands.push("BOOK VERSION ".concat(bookVersion));
1155
1244
  }
1156
- // TODO: [main] !!!!! This increases size of the bundle and is probbably not necessary
1245
+ // TODO: [main] !!5 This increases size of the bundle and is probbably not necessary
1157
1246
  pipelineString = prettifyMarkdown(pipelineString);
1158
1247
  try {
1159
1248
  for (var _g = __values(parameters.filter(function (_a) {
@@ -1301,12 +1390,12 @@ function pipelineJsonToString(pipelineJson) {
1301
1390
  pipelineString += '```' + contentLanguage;
1302
1391
  pipelineString += '\n';
1303
1392
  pipelineString += spaceTrim$1(content);
1304
- // <- TODO: [main] !!! Escape
1393
+ // <- TODO: [main] !!3 Escape
1305
1394
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
1306
1395
  pipelineString += '\n';
1307
1396
  pipelineString += '```';
1308
1397
  pipelineString += '\n\n';
1309
- pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use taskParameterJsonToString
1398
+ pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!3 If the parameter here has description, add it and use taskParameterJsonToString
1310
1399
  }
1311
1400
  }
1312
1401
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -1316,7 +1405,7 @@ function pipelineJsonToString(pipelineJson) {
1316
1405
  }
1317
1406
  finally { if (e_3) throw e_3.error; }
1318
1407
  }
1319
- return pipelineString;
1408
+ return validatePipelineString(pipelineString);
1320
1409
  }
1321
1410
  /**
1322
1411
  * @private internal utility of `pipelineJsonToString`
@@ -1477,7 +1566,7 @@ function checkSerializableAsJson(options) {
1477
1566
  if (!(error instanceof Error)) {
1478
1567
  throw error;
1479
1568
  }
1480
- throw new UnexpectedError(spaceTrim$1(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 "); }));
1569
+ throw new UnexpectedError(spaceTrim$1(function (block) { return "\n `".concat(name, "` is not serializable\n\n ").concat(block(error.stack || error.message), "\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
1481
1570
  }
1482
1571
  /*
1483
1572
  TODO: [0] Is there some more elegant way to check circular references?
@@ -1507,7 +1596,7 @@ function checkSerializableAsJson(options) {
1507
1596
  }
1508
1597
  /**
1509
1598
  * TODO: Can be return type more type-safe? like `asserts options.value is JsonValue`
1510
- * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
1599
+ * TODO: [🧠][main] !!3 In-memory cache of same values to prevent multiple checks
1511
1600
  * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
1512
1601
  */
1513
1602
 
@@ -1519,7 +1608,6 @@ function checkSerializableAsJson(options) {
1519
1608
  function deepClone(objectValue) {
1520
1609
  return JSON.parse(JSON.stringify(objectValue));
1521
1610
  /*
1522
- !!!!!!!!
1523
1611
  TODO: [🧠] Is there a better implementation?
1524
1612
  > const propertyNames = Object.getOwnPropertyNames(objectValue);
1525
1613
  > for (const propertyName of propertyNames) {
@@ -1631,25 +1719,6 @@ var RESERVED_PARAMETER_NAMES = exportJson({
1631
1719
  * Note: [💞] Ignore a discrepancy between file name and entity name
1632
1720
  */
1633
1721
 
1634
- /**
1635
- * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
1636
- *
1637
- * @public exported from `@promptbook/core`
1638
- */
1639
- var ParseError = /** @class */ (function (_super) {
1640
- __extends(ParseError, _super);
1641
- function ParseError(message) {
1642
- var _this = _super.call(this, message) || this;
1643
- _this.name = 'ParseError';
1644
- Object.setPrototypeOf(_this, ParseError.prototype);
1645
- return _this;
1646
- }
1647
- return ParseError;
1648
- }(Error));
1649
- /**
1650
- * TODO: Maybe split `ParseError` and `ApplyError`
1651
- */
1652
-
1653
1722
  /**
1654
1723
  * This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
1655
1724
  *
@@ -1704,7 +1773,7 @@ function isValidPromptbookVersion(version) {
1704
1773
  if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
1705
1774
  return false;
1706
1775
  }
1707
- // <- TODO: [main] !!! Check isValidPromptbookVersion against PROMPTBOOK_ENGINE_VERSIONS
1776
+ // <- TODO: [main] !!3 Check isValidPromptbookVersion against PROMPTBOOK_ENGINE_VERSIONS
1708
1777
  return true;
1709
1778
  }
1710
1779
 
@@ -1775,9 +1844,6 @@ function isValidPipelineUrl(url) {
1775
1844
  if (!url.startsWith('https://')) {
1776
1845
  return false;
1777
1846
  }
1778
- if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.book.md') || url.endsWith('.ptbk'))) {
1779
- return false;
1780
- }
1781
1847
  if (url.includes('#')) {
1782
1848
  // TODO: [🐠]
1783
1849
  return false;
@@ -1808,11 +1874,11 @@ function isValidPipelineUrl(url) {
1808
1874
  */
1809
1875
  function validatePipeline(pipeline) {
1810
1876
  if (IS_PIPELINE_LOGIC_VALIDATED) {
1811
- validatePipelineCore(pipeline);
1877
+ validatePipeline_InnerFunction(pipeline);
1812
1878
  }
1813
1879
  else {
1814
1880
  try {
1815
- validatePipelineCore(pipeline);
1881
+ validatePipeline_InnerFunction(pipeline);
1816
1882
  }
1817
1883
  catch (error) {
1818
1884
  if (!(error instanceof PipelineLogicError)) {
@@ -1826,7 +1892,7 @@ function validatePipeline(pipeline) {
1826
1892
  /**
1827
1893
  * @private internal function for `validatePipeline`
1828
1894
  */
1829
- function validatePipelineCore(pipeline) {
1895
+ function validatePipeline_InnerFunction(pipeline) {
1830
1896
  // TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
1831
1897
  var e_1, _a, e_2, _b, e_3, _c;
1832
1898
  var pipelineIdentification = (function () {
@@ -2050,11 +2116,11 @@ function validatePipelineCore(pipeline) {
2050
2116
  _loop_3();
2051
2117
  }
2052
2118
  // Note: Check that formfactor is corresponding to the pipeline interface
2053
- // TODO: !!!!!! Implement this
2119
+ // TODO: !!6 Implement this
2054
2120
  // pipeline.formfactorName
2055
2121
  }
2056
2122
  /**
2057
- * TODO: !! [🧞‍♀️] Do not allow joker + foreach
2123
+ * TODO: [🧞‍♀️] Do not allow joker + foreach
2058
2124
  * TODO: [🧠] Work with promptbookVersion
2059
2125
  * TODO: Use here some json-schema, Zod or something similar and change it to:
2060
2126
  * > /**
@@ -2066,11 +2132,11 @@ function validatePipelineCore(pipeline) {
2066
2132
  * > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
2067
2133
  */
2068
2134
  /**
2069
- * TODO: [🧳][main] !!!! Validate that all examples match expectations
2070
- * TODO: [🧳][🐝][main] !!!! Validate that knowledge is valid (non-void)
2071
- * TODO: [🧳][main] !!!! Validate that persona can be used only with CHAT variant
2072
- * TODO: [🧳][main] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
2073
- * TODO: [🧳][main] !!!! Validate that reserved parameter is not used as joker
2135
+ * TODO: [🧳][main] !!4 Validate that all examples match expectations
2136
+ * TODO: [🧳][🐝][main] !!4 Validate that knowledge is valid (non-void)
2137
+ * TODO: [🧳][main] !!4 Validate that persona can be used only with CHAT variant
2138
+ * TODO: [🧳][main] !!4 Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
2139
+ * TODO: [🧳][main] !!4 Validate that reserved parameter is not used as joker
2074
2140
  * TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
2075
2141
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
2076
2142
  */
@@ -2206,7 +2272,7 @@ var SimplePipelineCollection = /** @class */ (function () {
2206
2272
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
2207
2273
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
2208
2274
  var existing = this.collection.get(pipeline.pipelineUrl);
2209
- throw new PipelineUrlError(spaceTrim("\n Pipeline with URL \"".concat(pipeline.pipelineUrl, "\" is already in the collection \uD83C\uDF4E\n\n Conflicting files:\n ").concat(existing.sourceFile || 'Unknown', "\n ").concat(pipeline.sourceFile || 'Unknown', "\n\n Note: You have probably forgotten to run \"ptbk make\" to update the collection\n Note: Pipelines with the same URL are not allowed\n Only exepction is when the pipelines are identical\n\n ")));
2275
+ throw new PipelineUrlError(spaceTrim("\n Pipeline with URL ".concat(pipeline.pipelineUrl, " is already in the collection \uD83C\uDF4E\n\n Conflicting files:\n ").concat(existing.sourceFile || 'Unknown', "\n ").concat(pipeline.sourceFile || 'Unknown', "\n\n Note: You have probably forgotten to run \"ptbk make\" to update the collection\n Note: Pipelines with the same URL are not allowed\n Only exepction is when the pipelines are identical\n\n ")));
2210
2276
  }
2211
2277
  // Note: [🧠] Overwrite existing pipeline with the same URL
2212
2278
  this.collection.set(pipeline.pipelineUrl, pipeline);
@@ -2494,11 +2560,16 @@ function assertsExecutionSuccessful(executionResult) {
2494
2560
  /**
2495
2561
  * Determine if the pipeline is fully prepared
2496
2562
  *
2563
+ * @see https://github.com/webgptorg/promptbook/discussions/196
2564
+ *
2497
2565
  * @public exported from `@promptbook/core`
2498
2566
  */
2499
2567
  function isPipelinePrepared(pipeline) {
2500
2568
  // Note: Ignoring `pipeline.preparations` @@@
2501
2569
  // Note: Ignoring `pipeline.knowledgePieces` @@@
2570
+ if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
2571
+ return false;
2572
+ }
2502
2573
  if (!pipeline.personas.every(function (persona) { return persona.modelRequirements !== undefined; })) {
2503
2574
  return false;
2504
2575
  }
@@ -2514,7 +2585,7 @@ function isPipelinePrepared(pipeline) {
2514
2585
  return true;
2515
2586
  }
2516
2587
  /**
2517
- * TODO: [🔃][main] !! If the pipeline was prepared with different version or different set of models, prepare it once again
2588
+ * TODO: [🔃][main] If the pipeline was prepared with different version or different set of models, prepare it once again
2518
2589
  * TODO: [🐠] Maybe base this on `makeValidator`
2519
2590
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2520
2591
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -2523,6 +2594,81 @@ function isPipelinePrepared(pipeline) {
2523
2594
  * - [♨] Are tasks prepared
2524
2595
  */
2525
2596
 
2597
+ /**
2598
+ * Format either small or big number
2599
+ *
2600
+ * @public exported from `@promptbook/utils`
2601
+ */
2602
+ function numberToString(value) {
2603
+ if (value === 0) {
2604
+ return '0';
2605
+ }
2606
+ else if (Number.isNaN(value)) {
2607
+ return VALUE_STRINGS.nan;
2608
+ }
2609
+ else if (value === Infinity) {
2610
+ return VALUE_STRINGS.infinity;
2611
+ }
2612
+ else if (value === -Infinity) {
2613
+ return VALUE_STRINGS.negativeInfinity;
2614
+ }
2615
+ for (var exponent = 0; exponent < 15; exponent++) {
2616
+ var factor = Math.pow(10, exponent);
2617
+ var valueRounded = Math.round(value * factor) / factor;
2618
+ if (Math.abs(value - valueRounded) / value < SMALL_NUMBER) {
2619
+ return valueRounded.toFixed(exponent);
2620
+ }
2621
+ }
2622
+ return value.toString();
2623
+ }
2624
+
2625
+ /**
2626
+ * Function `valueToString` will convert the given value to string
2627
+ * This is useful and used in the `templateParameters` function
2628
+ *
2629
+ * Note: This function is not just calling `toString` method
2630
+ * It's more complex and can handle this conversion specifically for LLM models
2631
+ * See `VALUE_STRINGS`
2632
+ *
2633
+ * Note: There are 2 similar functions
2634
+ * - `valueToString` converts value to string for LLM models as human-readable string
2635
+ * - `asSerializable` converts value to string to preserve full information to be able to convert it back
2636
+ *
2637
+ * @public exported from `@promptbook/utils`
2638
+ */
2639
+ function valueToString(value) {
2640
+ try {
2641
+ if (value === '') {
2642
+ return VALUE_STRINGS.empty;
2643
+ }
2644
+ else if (value === null) {
2645
+ return VALUE_STRINGS.null;
2646
+ }
2647
+ else if (value === undefined) {
2648
+ return VALUE_STRINGS.undefined;
2649
+ }
2650
+ else if (typeof value === 'string') {
2651
+ return value;
2652
+ }
2653
+ else if (typeof value === 'number') {
2654
+ return numberToString(value);
2655
+ }
2656
+ else if (value instanceof Date) {
2657
+ return value.toISOString();
2658
+ }
2659
+ else {
2660
+ return JSON.stringify(value);
2661
+ }
2662
+ }
2663
+ catch (error) {
2664
+ if (!(error instanceof Error)) {
2665
+ throw error;
2666
+ }
2667
+ console.error(error);
2668
+ return VALUE_STRINGS.unserializable;
2669
+ }
2670
+ }
2671
+
2526
2672
  /**
2527
2673
  * Serializes an error into a [🚉] JSON-serializable object
2528
2674
  *
@@ -3204,10 +3350,10 @@ function preparePersona(personaDescription, tools, options) {
3204
3350
  });
3205
3351
  }
3206
3352
  /**
3207
- * TODO: [🔃][main] !! If the persona was prepared with different version or different set of models, prepare it once again
3208
- * TODO: [🏢] !! Check validity of `modelName` in pipeline
3209
- * TODO: [🏢] !! Check validity of `systemMessage` in pipeline
3210
- * TODO: [🏢] !! Check validity of `temperature` in pipeline
3353
+ * TODO: [🔃][main] If the persona was prepared with different version or different set of models, prepare it once again
3354
+ * TODO: [🏢] Check validity of `modelName` in pipeline
3355
+ * TODO: [🏢] Check validity of `systemMessage` in pipeline
3356
+ * TODO: [🏢] Check validity of `temperature` in pipeline
3211
3357
  */
3212
3358
 
3213
3359
  /**
@@ -3546,6 +3692,9 @@ var scraperFetch = function (url, init) { return __awaiter(void 0, void 0, void
3546
3692
  }
3547
3693
  });
3548
3694
  }); };
3695
+ /**
3696
+ * TODO: [🧠] Maybe rename because it is not used only for scrapers but also in `$getCompiledBook`
3697
+ */
3549
3698
 
3550
3699
  /**
3551
3700
  * @@@
@@ -3613,7 +3762,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3613
3762
  },
3614
3763
  }];
3615
3764
  case 2:
3616
- if (!(isValidFilePath(sourceContent) || /\.[a-z]{1,10}$/i.exec(sourceContent))) return [3 /*break*/, 4];
3765
+ if (!isValidFilePath(sourceContent)) return [3 /*break*/, 4];
3617
3766
  if (tools.fs === undefined) {
3618
3767
  throw new EnvironmentMismatchError('Can not import file knowledge without filesystem tools');
3619
3768
  // <- TODO: [🧠] What is the best error type here`
@@ -3628,7 +3777,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3628
3777
  return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
3629
3778
  case 3:
3630
3779
  if (!(_f.sent())) {
3631
- throw new NotFoundError(spaceTrim$1(function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(filename_1), "\n "); }));
3780
+ throw new NotFoundError(spaceTrim$1(function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(sourceContent), "\n\n Full file path:\n ").concat(block(filename_1), "\n "); }));
3632
3781
  }
3633
3782
  // TODO: [🧠][😿] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
3634
3783
  return [2 /*return*/, {
@@ -3741,7 +3890,7 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
3741
3890
  partialPieces = __spreadArray([], __read(partialPiecesUnchecked), false);
3742
3891
  return [2 /*return*/, "break"];
3743
3892
  }
3744
- console.warn(spaceTrim$1(function (block) { return "\n Cannot scrape knowledge from source despite the scraper `".concat(scraper.metadata.className, "` supports the mime type \"").concat(sourceHandler.mimeType, "\".\n \n The source:\n > ").concat(block(knowledgeSource.sourceContent
3893
+ console.warn(spaceTrim$1(function (block) { return "\n Cannot scrape knowledge from source despite the scraper `".concat(scraper.metadata.className, "` supports the mime type \"").concat(sourceHandler.mimeType, "\".\n\n The source:\n ").concat(block(knowledgeSource.sourceContent
3745
3894
  .split('\n')
3746
3895
  .map(function (line) { return "> ".concat(line); })
3747
3896
  .join('\n')), "\n\n ").concat(block($registeredScrapersMessage(scrapers)), "\n\n\n "); }));
@@ -3779,7 +3928,7 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
3779
3928
  return [7 /*endfinally*/];
3780
3929
  case 9:
3781
3930
  if (partialPieces === null) {
3782
- throw new KnowledgeScrapeError(spaceTrim$1(function (block) { return "\n Cannot scrape knowledge\n \n The source:\n > ".concat(block(knowledgeSource.sourceContent
3931
+ throw new KnowledgeScrapeError(spaceTrim$1(function (block) { return "\n Cannot scrape knowledge\n\n The source:\n > ".concat(block(knowledgeSource.sourceContent
3783
3932
  .split('\n')
3784
3933
  .map(function (line) { return "> ".concat(line); })
3785
3934
  .join('\n')), "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage(scrapers)), "\n\n\n "); }));
@@ -3870,7 +4019,7 @@ function prepareTasks(pipeline, tools, options) {
3870
4019
  * TODO: [😂] Adding knowledge should be convert to async high-level abstractions, simmilar thing with expectations to sync high-level abstractions
3871
4020
  * TODO: [🧠] Add context to each task (if missing)
3872
4021
  * TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
3873
- * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
4022
+ * TODO: [♨][main] !!3 Prepare index the examples and maybe tasks
3874
4023
  * TODO: Write tests for `preparePipeline`
3875
4024
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3876
4025
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -3880,6 +4029,8 @@ function prepareTasks(pipeline, tools, options) {
3880
4029
  /**
3881
4030
  * Prepare pipeline from string (markdown) format to JSON format
3882
4031
  *
4032
+ * @see https://github.com/webgptorg/promptbook/discussions/196
4033
+ *
3883
4034
  * Note: This function does not validate logic of the pipeline
3884
4035
  * Note: This function acts as part of compilation process
3885
4036
  * Note: When the pipeline is already prepared, it returns the same pipeline
@@ -3892,16 +4043,17 @@ function preparePipeline(pipeline, tools, options) {
3892
4043
  <- TODO: [🧠][🪑] `promptbookVersion` */
3893
4044
  knowledgeSources /*
3894
4045
  <- TODO: [🧊] `knowledgePieces` */, personas /*
3895
- <- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, tasksPrepared /* TODO: parameters: parametersPrepared*/;
4046
+ <- TODO: [🧊] `preparations` */, sources, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, title, collection, prepareTitleExecutor, _c, result, outputParameters, titleRaw, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, tasksPrepared /* TODO: parameters: parametersPrepared*/;
4047
+ var _d;
3896
4048
  var _this = this;
3897
- return __generator(this, function (_c) {
3898
- switch (_c.label) {
4049
+ return __generator(this, function (_e) {
4050
+ switch (_e.label) {
3899
4051
  case 0:
3900
4052
  if (isPipelinePrepared(pipeline)) {
3901
4053
  return [2 /*return*/, pipeline];
3902
4054
  }
3903
4055
  rootDirname = options.rootDirname, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ? DEFAULT_IS_VERBOSE : _b;
3904
- parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
4056
+ parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas, sources = pipeline.sources;
3905
4057
  if (tools === undefined || tools.llm === undefined) {
3906
4058
  throw new MissingToolsError('LLM tools are required for preparing the pipeline');
3907
4059
  }
@@ -3919,6 +4071,33 @@ function preparePipeline(pipeline, tools, options) {
3919
4071
  // <- TODO: [🧊]
3920
4072
  currentPreparation,
3921
4073
  ];
4074
+ title = pipeline.title;
4075
+ if (!(title === undefined || title === '' || title === DEFAULT_BOOK_TITLE)) return [3 /*break*/, 3];
4076
+ collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
4077
+ _c = createPipelineExecutor;
4078
+ _d = {};
4079
+ return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book.md')];
4080
+ case 1:
4081
+ prepareTitleExecutor = _c.apply(void 0, [(_d.pipeline = _e.sent(),
4082
+ _d.tools = tools,
4083
+ _d)]);
4084
+ return [4 /*yield*/, prepareTitleExecutor({
4085
+ book: sources.map(function (_a) {
4086
+ var content = _a.content;
4087
+ return content;
4088
+ }).join('\n\n'),
4089
+ })];
4090
+ case 2:
4091
+ result = _e.sent();
4092
+ assertsExecutionSuccessful(result);
4093
+ outputParameters = result.outputParameters;
4094
+ titleRaw = outputParameters.title;
4095
+ if (isVerbose) {
4096
+ console.info("The title is \"".concat(titleRaw, "\""));
4097
+ }
4098
+ title = titleRaw || DEFAULT_BOOK_TITLE;
4099
+ _e.label = 3;
4100
+ case 3:
3922
4101
  preparedPersonas = new Array(personas.length);
3923
4102
  return [4 /*yield*/, forEachAsync(personas, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (persona, index) { return __awaiter(_this, void 0, void 0, function () {
3924
4103
  var modelRequirements, preparedPersona;
@@ -3937,12 +4116,12 @@ function preparePipeline(pipeline, tools, options) {
3937
4116
  }
3938
4117
  });
3939
4118
  }); })];
3940
- case 1:
3941
- _c.sent();
4119
+ case 4:
4120
+ _e.sent();
3942
4121
  knowledgeSourcesPrepared = knowledgeSources.map(function (source) { return (__assign(__assign({}, source), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
3943
4122
  return [4 /*yield*/, prepareKnowledgePieces(knowledgeSources /* <- TODO: [🧊] {knowledgeSources, knowledgePieces} */, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), __assign(__assign({}, options), { rootDirname: rootDirname, maxParallelCount: maxParallelCount /* <- TODO: [🪂] */, isVerbose: isVerbose }))];
3944
- case 2:
3945
- partialknowledgePiecesPrepared = _c.sent();
4123
+ case 5:
4124
+ partialknowledgePiecesPrepared = _e.sent();
3946
4125
  knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
3947
4126
  return [4 /*yield*/, prepareTasks({
3948
4127
  parameters: parameters,
@@ -3953,8 +4132,8 @@ function preparePipeline(pipeline, tools, options) {
3953
4132
  maxParallelCount: maxParallelCount /* <- TODO: [🪂] */,
3954
4133
  isVerbose: isVerbose,
3955
4134
  })];
3956
- case 3:
3957
- tasksPrepared = (_c.sent()).tasksPrepared;
4135
+ case 6:
4136
+ tasksPrepared = (_e.sent()).tasksPrepared;
3958
4137
  // ----- /Tasks preparation -----
3959
4138
  // TODO: [😂] Use here all `AsyncHighLevelAbstraction`
3960
4139
  // Note: Count total usage
@@ -3965,7 +4144,7 @@ function preparePipeline(pipeline, tools, options) {
3965
4144
  order: ORDER_OF_PIPELINE_JSON,
3966
4145
  value: __assign(__assign({}, pipeline), {
3967
4146
  // <- TODO: Probbably deeply clone the pipeline because `$exportJson` freezes the subobjects
3968
- knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, tasks: __spreadArray([], __read(tasksPrepared), false),
4147
+ title: title, knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, tasks: __spreadArray([], __read(tasksPrepared), false),
3969
4148
  // <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
3970
4149
  personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }),
3971
4150
  })];
@@ -4036,7 +4215,7 @@ function extractVariablesFromScript(script) {
4036
4215
  if (!(error instanceof Error)) {
4037
4216
  throw error;
4038
4217
  }
4039
- throw new ParseError(spaceTrim(function (block) { return "\n Can not extract variables from the script\n\n ".concat(block(error.toString()), "}\n\n\n Found variables:\n\n ").concat(Array.from(variables)
4218
+ throw new ParseError(spaceTrim(function (block) { return "\n Can not extract variables from the script\n ".concat(block(error.stack || error.message), "\n\n Found variables:\n ").concat(Array.from(variables)
4040
4219
  .map(function (variableName, i) { return "".concat(i + 1, ") ").concat(variableName); })
4041
4220
  .join('\n'), "\n\n\n The script:\n\n ```javascript\n ").concat(block(originalScript), "\n ```\n "); }));
4042
4221
  }
@@ -4316,27 +4495,6 @@ var CsvFormatDefinition = {
4316
4495
  * TODO: [🏢] Allow to expect something inside CSV objects and other formats
4317
4496
  */
4318
4497
 
4319
- /**
4320
- * Function isValidJsonString will tell you if the string is valid JSON or not
4321
- *
4322
- * @public exported from `@promptbook/utils`
4323
- */
4324
- function isValidJsonString(value /* <- [👨‍⚖️] */) {
4325
- try {
4326
- JSON.parse(value);
4327
- return true;
4328
- }
4329
- catch (error) {
4330
- if (!(error instanceof Error)) {
4331
- throw error;
4332
- }
4333
- if (error.message.includes('Unexpected token')) {
4334
- return false;
4335
- }
4336
- return false;
4337
- }
4338
- }
4339
-
4340
4498
  /**
4341
4499
  * Definition for JSON format
4342
4500
  *
@@ -4655,81 +4813,6 @@ function extractJsonBlock(markdown) {
4655
4813
  * TODO: [🏢] Make this logic part of `JsonFormatDefinition` or `isValidJsonString`
4656
4814
  */
4657
4815
 
4658
- /**
4659
- * Format either small or big number
4660
- *
4661
- * @public exported from `@promptbook/utils`
4662
- */
4663
- function numberToString(value) {
4664
- if (value === 0) {
4665
- return '0';
4666
- }
4667
- else if (Number.isNaN(value)) {
4668
- return VALUE_STRINGS.nan;
4669
- }
4670
- else if (value === Infinity) {
4671
- return VALUE_STRINGS.infinity;
4672
- }
4673
- else if (value === -Infinity) {
4674
- return VALUE_STRINGS.negativeInfinity;
4675
- }
4676
- for (var exponent = 0; exponent < 15; exponent++) {
4677
- var factor = Math.pow(10, exponent);
4678
- var valueRounded = Math.round(value * factor) / factor;
4679
- if (Math.abs(value - valueRounded) / value < SMALL_NUMBER) {
4680
- return valueRounded.toFixed(exponent);
4681
- }
4682
- }
4683
- return value.toString();
4684
- }
4685
-
4686
- /**
4687
- * Function `valueToString` will convert the given value to string
4688
- * This is useful and used in the `templateParameters` function
4689
- *
4690
- * Note: This function is not just calling `toString` method
4691
- * It's more complex and can handle this conversion specifically for LLM models
4692
- * See `VALUE_STRINGS`
4693
- *
4694
- * Note: There are 2 similar functions
4695
- * - `valueToString` converts value to string for LLM models as human-readable string
4696
- * - `asSerializable` converts value to string to preserve full information to be able to convert it back
4697
- *
4698
- * @public exported from `@promptbook/utils`
4699
- */
4700
- function valueToString(value) {
4701
- try {
4702
- if (value === '') {
4703
- return VALUE_STRINGS.empty;
4704
- }
4705
- else if (value === null) {
4706
- return VALUE_STRINGS.null;
4707
- }
4708
- else if (value === undefined) {
4709
- return VALUE_STRINGS.undefined;
4710
- }
4711
- else if (typeof value === 'string') {
4712
- return value;
4713
- }
4714
- else if (typeof value === 'number') {
4715
- return numberToString(value);
4716
- }
4717
- else if (value instanceof Date) {
4718
- return value.toISOString();
4719
- }
4720
- else {
4721
- return JSON.stringify(value);
4722
- }
4723
- }
4724
- catch (error) {
4725
- if (!(error instanceof Error)) {
4726
- throw error;
4727
- }
4728
- console.error(error);
4729
- return VALUE_STRINGS.unserializable;
4730
- }
4731
- }
4732
-
4733
4816
  /**
4734
4817
  * Replaces parameters in template with values from parameters object
4735
4818
  *
@@ -4786,6 +4869,8 @@ function templateParameters(template, parameters) {
4786
4869
  throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
4787
4870
  }
4788
4871
  parameterValue = valueToString(parameterValue);
4872
+ // Escape curly braces in parameter values to prevent prompt-injection
4873
+ parameterValue = parameterValue.replace(/[{}]/g, '\\$&');
4789
4874
  if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
4790
4875
  parameterValue = parameterValue
4791
4876
  .split('\n')
@@ -5145,7 +5230,7 @@ function executeAttempts(options) {
5145
5230
  promptTitle: task.title,
5146
5231
  promptMessage: templateParameters(task.description || '', parameters),
5147
5232
  defaultValue: templateParameters(preparedContent, parameters),
5148
- // TODO: [🧠] !! Figure out how to define placeholder in .book.md file
5233
+ // TODO: [🧠] Figure out how to define placeholder in .book.md file
5149
5234
  placeholder: undefined,
5150
5235
  priority: priority,
5151
5236
  }))];
@@ -5845,7 +5930,10 @@ function executePipeline(options) {
5845
5930
  finally { if (e_2) throw e_2.error; }
5846
5931
  return [7 /*endfinally*/];
5847
5932
  case 19:
5848
- parametersToPass = inputParameters;
5933
+ parametersToPass = Object.fromEntries(Object.entries(inputParameters).map(function (_a) {
5934
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
5935
+ return [key, valueToString(value)];
5936
+ }));
5849
5937
  _g.label = 20;
5850
5938
  case 20:
5851
5939
  _g.trys.push([20, 25, , 28]);
@@ -6092,6 +6180,7 @@ var markdownScraperMetadata = $deepFreeze({
6092
6180
  mimeTypes: ['text/markdown', 'text/plain'],
6093
6181
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
6094
6182
  isAvilableInBrowser: true,
6183
+ // <- Note: [🌏] This is the only scraper which makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
6095
6184
  requiredExecutables: [],
6096
6185
  }); /* <- Note: [🤛] */
6097
6186
  /**
@@ -6100,6 +6189,7 @@ var markdownScraperMetadata = $deepFreeze({
6100
6189
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
6101
6190
  *
6102
6191
  * @public exported from `@promptbook/core`
6192
+ * @public exported from `@promptbook/wizzard`
6103
6193
  * @public exported from `@promptbook/cli`
6104
6194
  */
6105
6195
  $scrapersMetadataRegister.register(markdownScraperMetadata);
@@ -6185,12 +6275,12 @@ var MarkdownScraper = /** @class */ (function () {
6185
6275
  outputParameters = result.outputParameters;
6186
6276
  knowledgePiecesRaw = outputParameters.knowledgePieces;
6187
6277
  knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
6188
- // <- TODO: [main] !! Smarter split and filter out empty pieces
6278
+ // <- TODO: [main] Smarter split and filter out empty pieces
6189
6279
  if (isVerbose) {
6190
6280
  console.info('knowledgeTextPieces:', knowledgeTextPieces);
6191
6281
  }
6192
6282
  return [4 /*yield*/, Promise.all(
6193
- // TODO: [🪂] !! Do not send all at once but in chunks
6283
+ // TODO: [🪂] Do not send all at once but in chunks
6194
6284
  knowledgeTextPieces.map(function (knowledgeTextPiece, i) { return __awaiter(_this, void 0, void 0, function () {
6195
6285
  var name, title, knowledgePieceContent, keywords, index, titleResult, _a, titleRaw, keywordsResult, _b, keywordsRaw, embeddingResult, error_1;
6196
6286
  return __generator(this, function (_c) {
@@ -6289,6 +6379,7 @@ var documentScraperMetadata = $deepFreeze({
6289
6379
  mimeTypes: ['application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
6290
6380
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
6291
6381
  isAvilableInBrowser: false,
6382
+ // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
6292
6383
  requiredExecutables: ['Pandoc'],
6293
6384
  }); /* <- Note: [🤛] */
6294
6385
  /**
@@ -6297,6 +6388,7 @@ var documentScraperMetadata = $deepFreeze({
6297
6388
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
6298
6389
  *
6299
6390
  * @public exported from `@promptbook/core`
6391
+ * @public exported from `@promptbook/wizzard`
6300
6392
  * @public exported from `@promptbook/cli`
6301
6393
  */
6302
6394
  $scrapersMetadataRegister.register(documentScraperMetadata);
@@ -6458,6 +6550,7 @@ var createDocumentScraper = Object.assign(function (tools, options) {
6458
6550
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
6459
6551
  *
6460
6552
  * @public exported from `@promptbook/documents`
6553
+ * @public exported from `@promptbook/wizzard`
6461
6554
  * @public exported from `@promptbook/cli`
6462
6555
  */
6463
6556
  var _DocumentScraperRegistration = $scrapersRegister.register(createDocumentScraper);