@promptbook/markdown-utils 0.81.0-8 → 0.82.0-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 (110) hide show
  1. package/README.md +25 -4
  2. package/esm/index.es.js +222 -137
  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/remote-client.index.d.ts +7 -3
  9. package/esm/typings/src/_packages/remote-server.index.d.ts +2 -2
  10. package/esm/typings/src/_packages/templates.index.d.ts +2 -2
  11. package/esm/typings/src/_packages/types.index.d.ts +34 -30
  12. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  13. package/esm/typings/src/_packages/wizzard.index.d.ts +44 -0
  14. package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
  15. package/esm/typings/src/cli/cli-commands/run.d.ts +2 -2
  16. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +11 -0
  17. package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
  18. package/esm/typings/src/commands/index.d.ts +1 -1
  19. package/esm/typings/src/config.d.ts +3 -3
  20. package/esm/typings/src/conversion/compilePipeline.d.ts +1 -4
  21. package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +18 -0
  22. package/esm/typings/src/conversion/{precompilePipeline.d.ts → parsePipeline.d.ts} +3 -3
  23. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -3
  24. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +7 -7
  25. package/esm/typings/src/errors/utils/getErrorReportUrl.d.ts +1 -1
  26. package/esm/typings/src/execution/PipelineExecutor.d.ts +2 -2
  27. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +2 -2
  28. package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +9 -4
  29. package/esm/typings/src/formfactors/image-generator/ImageGeneratorFormfactorDefinition.d.ts +24 -0
  30. package/esm/typings/src/formfactors/index.d.ts +31 -9
  31. package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +1 -1
  32. package/esm/typings/src/high-level-abstractions/index.d.ts +3 -3
  33. package/esm/typings/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +3 -0
  34. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
  35. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
  36. package/esm/typings/src/llm-providers/_common/register/{$provideLlmToolsForCli.d.ts → $provideLlmToolsForWizzardOrCli.d.ts} +2 -2
  37. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
  38. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +1 -1
  39. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  40. package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +2 -2
  41. package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +2 -2
  42. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -0
  43. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +2 -0
  44. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +1 -0
  45. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -0
  46. package/esm/typings/src/llm-providers/google/register-configuration.d.ts +1 -0
  47. package/esm/typings/src/llm-providers/google/register-constructor.d.ts +1 -0
  48. package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +1 -1
  49. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -0
  50. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +2 -0
  51. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
  52. package/esm/typings/src/llm-providers/vercel/playground/playground.d.ts +1 -1
  53. package/esm/typings/src/other/templates/getBookTemplates.d.ts +22 -0
  54. package/esm/typings/src/personas/preparePersona.d.ts +4 -4
  55. package/esm/typings/src/pipeline/PipelineString.d.ts +0 -3
  56. package/esm/typings/src/pipeline/book-notation.d.ts +14 -0
  57. package/esm/typings/src/pipeline/isValidPipelineString.d.ts +13 -0
  58. package/esm/typings/src/pipeline/isValidPipelineString.test.d.ts +4 -0
  59. package/esm/typings/src/pipeline/validatePipelineString.d.ts +14 -0
  60. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +3 -1
  61. package/esm/typings/src/prepare/preparePipeline.d.ts +4 -2
  62. package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +14 -0
  63. package/esm/typings/src/prepare/prepareTasks.d.ts +1 -1
  64. package/esm/typings/src/{llm-providers/remote → remote-server}/interfaces/PromptbookServer_Error.d.ts +1 -1
  65. package/esm/typings/src/{llm-providers/remote → remote-server}/interfaces/PromptbookServer_ListModels_Request.d.ts +4 -4
  66. package/esm/typings/src/{llm-providers/remote → remote-server}/interfaces/PromptbookServer_ListModels_Response.d.ts +1 -1
  67. package/esm/typings/src/{llm-providers/remote → remote-server}/interfaces/PromptbookServer_Prompt_Progress.d.ts +1 -1
  68. package/esm/typings/src/{llm-providers/remote → remote-server}/interfaces/PromptbookServer_Prompt_Request.d.ts +5 -5
  69. package/esm/typings/src/{llm-providers/remote → remote-server}/interfaces/PromptbookServer_Prompt_Response.d.ts +1 -1
  70. package/esm/typings/src/{llm-providers/remote → remote-server}/interfaces/RemoteLlmExecutionToolsOptions.d.ts +7 -7
  71. package/esm/typings/src/{llm-providers/remote → remote-server}/interfaces/RemoteServerOptions.d.ts +10 -10
  72. package/esm/typings/src/scrapers/_common/Converter.d.ts +1 -0
  73. package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -1
  74. package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +3 -0
  75. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +2 -0
  76. package/esm/typings/src/scrapers/_common/utils/scraperFetch.d.ts +3 -0
  77. package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -0
  78. package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -0
  79. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -0
  80. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -0
  81. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -0
  82. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -0
  83. package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -0
  84. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
  85. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -0
  86. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +2 -1
  87. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +3 -1
  88. package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -0
  89. package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -0
  90. package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.test.d.ts +1 -1
  91. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +2 -1
  92. package/esm/typings/src/types/typeAliases.d.ts +16 -2
  93. package/esm/typings/src/utils/markdown/flattenMarkdown.d.ts +1 -1
  94. package/esm/typings/src/utils/markdown/{removeContentComments.d.ts → removeMarkdownComments.d.ts} +2 -2
  95. package/esm/typings/src/utils/organization/$sideEffect.d.ts +9 -0
  96. package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +1 -1
  97. package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +2 -2
  98. package/esm/typings/src/utils/validators/filePath/isRootPath.d.ts +12 -0
  99. package/esm/typings/src/utils/validators/filePath/isRootPath.test.d.ts +4 -0
  100. package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +3 -0
  101. package/esm/typings/src/wizzard/$getCompiledBook.d.ts +16 -0
  102. package/esm/typings/src/wizzard/wizzard.d.ts +52 -8
  103. package/package.json +1 -1
  104. package/umd/index.umd.js +222 -137
  105. package/umd/index.umd.js.map +1 -1
  106. package/esm/typings/src/other/templates/getBookTemplate.d.ts +0 -21
  107. package/esm/typings/src/scripting/javascript/utils/unknownToString.d.ts +0 -8
  108. /package/esm/typings/src/conversion/{precompilePipeline.test.d.ts → parsePipeline.test.d.ts} +0 -0
  109. /package/esm/typings/src/{llm-providers/remote → remote-server}/startRemoteServer.d.ts +0 -0
  110. /package/esm/typings/src/utils/markdown/{removeContentComments.test.d.ts → removeMarkdownComments.test.d.ts} +0 -0
package/umd/index.umd.js CHANGED
@@ -24,7 +24,7 @@
24
24
  * @generated
25
25
  * @see https://github.com/webgptorg/promptbook
26
26
  */
27
- var PROMPTBOOK_ENGINE_VERSION = '0.81.0-7';
27
+ var PROMPTBOOK_ENGINE_VERSION = '0.81.0-23';
28
28
  /**
29
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
30
30
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -360,7 +360,27 @@
360
360
  * TODO: [🏢] Make this logic part of `JsonFormatDefinition` or `isValidJsonString`
361
361
  */
362
362
 
363
- 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"}];
363
+ 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- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\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- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\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 task:\n\n> {book}\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Title starts with emoticon",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 task:\n\n> {book}\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Title starts with emoticon\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book.md"}];
364
+
365
+ /**
366
+ * Function `validatePipelineString` will validate the if the string is a valid pipeline string
367
+ * 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.
368
+ *
369
+ * @param {string} pipelineString the candidate for a pipeline string
370
+ * @returns {PipelineString} the same string as input, but validated as valid
371
+ * @throws {ParseError} if the string is not a valid pipeline string
372
+ * @public exported from `@promptbook/core`
373
+ */
374
+ function validatePipelineString(pipelineString) {
375
+ if (isValidJsonString(pipelineString)) {
376
+ throw new ParseError('Expected a book, but got a JSON string');
377
+ }
378
+ // <- TODO: Implement the validation + add tests when the pipeline logic considered as invalid
379
+ return pipelineString;
380
+ }
381
+ /**
382
+ * TODO: [🧠][🈴] Where is the best location for this file
383
+ */
364
384
 
365
385
  /**
366
386
  * Prettify the html code
@@ -419,7 +439,7 @@
419
439
  if (bookVersion !== "undefined") {
420
440
  commands.push("BOOK VERSION ".concat(bookVersion));
421
441
  }
422
- // TODO: [main] !!!!! This increases size of the bundle and is probbably not necessary
442
+ // TODO: [main] !!5 This increases size of the bundle and is probbably not necessary
423
443
  pipelineString = prettifyMarkdown(pipelineString);
424
444
  try {
425
445
  for (var _g = __values(parameters.filter(function (_a) {
@@ -567,12 +587,12 @@
567
587
  pipelineString += '```' + contentLanguage;
568
588
  pipelineString += '\n';
569
589
  pipelineString += spaceTrim__default["default"](content);
570
- // <- TODO: [main] !!! Escape
590
+ // <- TODO: [main] !!3 Escape
571
591
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
572
592
  pipelineString += '\n';
573
593
  pipelineString += '```';
574
594
  pipelineString += '\n\n';
575
- pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use taskParameterJsonToString
595
+ pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!3 If the parameter here has description, add it and use taskParameterJsonToString
576
596
  }
577
597
  }
578
598
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -582,7 +602,7 @@
582
602
  }
583
603
  finally { if (e_3) throw e_3.error; }
584
604
  }
585
- return pipelineString;
605
+ return validatePipelineString(pipelineString);
586
606
  }
587
607
  /**
588
608
  * @private internal utility of `pipelineJsonToString`
@@ -654,7 +674,7 @@
654
674
  *
655
675
  * @public exported from `@promptbook/core`
656
676
  */
657
- var DEFAULT_TITLE = "Untitled";
677
+ var DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
658
678
  // <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
659
679
  /**
660
680
  * The maximum number of iterations for a loops
@@ -806,7 +826,7 @@
806
826
  /**
807
827
  * Make error report URL for the given error
808
828
  *
809
- * @private !!!!!!
829
+ * @private private within the repository
810
830
  */
811
831
  function getErrorReportUrl(error) {
812
832
  var report = {
@@ -927,7 +947,7 @@
927
947
  if (!(error instanceof Error)) {
928
948
  throw error;
929
949
  }
930
- throw new UnexpectedError(spaceTrim__default["default"](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 "); }));
950
+ throw new UnexpectedError(spaceTrim__default["default"](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 "); }));
931
951
  }
932
952
  /*
933
953
  TODO: [0] Is there some more elegant way to check circular references?
@@ -957,7 +977,7 @@
957
977
  }
958
978
  /**
959
979
  * TODO: Can be return type more type-safe? like `asserts options.value is JsonValue`
960
- * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
980
+ * TODO: [🧠][main] !!3 In-memory cache of same values to prevent multiple checks
961
981
  * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
962
982
  */
963
983
 
@@ -969,7 +989,6 @@
969
989
  function deepClone(objectValue) {
970
990
  return JSON.parse(JSON.stringify(objectValue));
971
991
  /*
972
- !!!!!!!!
973
992
  TODO: [🧠] Is there a better implementation?
974
993
  > const propertyNames = Object.getOwnPropertyNames(objectValue);
975
994
  > for (const propertyName of propertyNames) {
@@ -1135,7 +1154,7 @@
1135
1154
  if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
1136
1155
  return false;
1137
1156
  }
1138
- // <- TODO: [main] !!! Check isValidPromptbookVersion against PROMPTBOOK_ENGINE_VERSIONS
1157
+ // <- TODO: [main] !!3 Check isValidPromptbookVersion against PROMPTBOOK_ENGINE_VERSIONS
1139
1158
  return true;
1140
1159
  }
1141
1160
 
@@ -1235,9 +1254,6 @@
1235
1254
  if (!url.startsWith('https://')) {
1236
1255
  return false;
1237
1256
  }
1238
- if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.book.md') || url.endsWith('.ptbk'))) {
1239
- return false;
1240
- }
1241
1257
  if (url.includes('#')) {
1242
1258
  // TODO: [🐠]
1243
1259
  return false;
@@ -1268,11 +1284,11 @@
1268
1284
  */
1269
1285
  function validatePipeline(pipeline) {
1270
1286
  if (IS_PIPELINE_LOGIC_VALIDATED) {
1271
- validatePipelineCore(pipeline);
1287
+ validatePipeline_InnerFunction(pipeline);
1272
1288
  }
1273
1289
  else {
1274
1290
  try {
1275
- validatePipelineCore(pipeline);
1291
+ validatePipeline_InnerFunction(pipeline);
1276
1292
  }
1277
1293
  catch (error) {
1278
1294
  if (!(error instanceof PipelineLogicError)) {
@@ -1286,7 +1302,7 @@
1286
1302
  /**
1287
1303
  * @private internal function for `validatePipeline`
1288
1304
  */
1289
- function validatePipelineCore(pipeline) {
1305
+ function validatePipeline_InnerFunction(pipeline) {
1290
1306
  // TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
1291
1307
  var e_1, _a, e_2, _b, e_3, _c;
1292
1308
  var pipelineIdentification = (function () {
@@ -1510,11 +1526,11 @@
1510
1526
  _loop_3();
1511
1527
  }
1512
1528
  // Note: Check that formfactor is corresponding to the pipeline interface
1513
- // TODO: !!!!!! Implement this
1529
+ // TODO: !!6 Implement this
1514
1530
  // pipeline.formfactorName
1515
1531
  }
1516
1532
  /**
1517
- * TODO: !! [🧞‍♀️] Do not allow joker + foreach
1533
+ * TODO: [🧞‍♀️] Do not allow joker + foreach
1518
1534
  * TODO: [🧠] Work with promptbookVersion
1519
1535
  * TODO: Use here some json-schema, Zod or something similar and change it to:
1520
1536
  * > /**
@@ -1526,11 +1542,11 @@
1526
1542
  * > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
1527
1543
  */
1528
1544
  /**
1529
- * TODO: [🧳][main] !!!! Validate that all examples match expectations
1530
- * TODO: [🧳][🐝][main] !!!! Validate that knowledge is valid (non-void)
1531
- * TODO: [🧳][main] !!!! Validate that persona can be used only with CHAT variant
1532
- * TODO: [🧳][main] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
1533
- * TODO: [🧳][main] !!!! Validate that reserved parameter is not used as joker
1545
+ * TODO: [🧳][main] !!4 Validate that all examples match expectations
1546
+ * TODO: [🧳][🐝][main] !!4 Validate that knowledge is valid (non-void)
1547
+ * TODO: [🧳][main] !!4 Validate that persona can be used only with CHAT variant
1548
+ * TODO: [🧳][main] !!4 Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
1549
+ * TODO: [🧳][main] !!4 Validate that reserved parameter is not used as joker
1534
1550
  * TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
1535
1551
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
1536
1552
  */
@@ -1666,7 +1682,7 @@
1666
1682
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
1667
1683
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
1668
1684
  var existing = this.collection.get(pipeline.pipelineUrl);
1669
- throw new PipelineUrlError(spaceTrim.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 ")));
1685
+ throw new PipelineUrlError(spaceTrim.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 ")));
1670
1686
  }
1671
1687
  // Note: [🧠] Overwrite existing pipeline with the same URL
1672
1688
  this.collection.set(pipeline.pipelineUrl, pipeline);
@@ -2002,11 +2018,16 @@
2002
2018
  /**
2003
2019
  * Determine if the pipeline is fully prepared
2004
2020
  *
2021
+ * @see https://github.com/webgptorg/promptbook/discussions/196
2022
+ *
2005
2023
  * @public exported from `@promptbook/core`
2006
2024
  */
2007
2025
  function isPipelinePrepared(pipeline) {
2008
2026
  // Note: Ignoring `pipeline.preparations` @@@
2009
2027
  // Note: Ignoring `pipeline.knowledgePieces` @@@
2028
+ if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
2029
+ return false;
2030
+ }
2010
2031
  if (!pipeline.personas.every(function (persona) { return persona.modelRequirements !== undefined; })) {
2011
2032
  return false;
2012
2033
  }
@@ -2022,7 +2043,7 @@
2022
2043
  return true;
2023
2044
  }
2024
2045
  /**
2025
- * TODO: [🔃][main] !! If the pipeline was prepared with different version or different set of models, prepare it once again
2046
+ * TODO: [🔃][main] If the pipeline was prepared with different version or different set of models, prepare it once again
2026
2047
  * TODO: [🐠] Maybe base this on `makeValidator`
2027
2048
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2028
2049
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -2031,6 +2052,81 @@
2031
2052
  * - [♨] Are tasks prepared
2032
2053
  */
2033
2054
 
2055
+ /**
2056
+ * Format either small or big number
2057
+ *
2058
+ * @public exported from `@promptbook/utils`
2059
+ */
2060
+ function numberToString(value) {
2061
+ if (value === 0) {
2062
+ return '0';
2063
+ }
2064
+ else if (Number.isNaN(value)) {
2065
+ return VALUE_STRINGS.nan;
2066
+ }
2067
+ else if (value === Infinity) {
2068
+ return VALUE_STRINGS.infinity;
2069
+ }
2070
+ else if (value === -Infinity) {
2071
+ return VALUE_STRINGS.negativeInfinity;
2072
+ }
2073
+ for (var exponent = 0; exponent < 15; exponent++) {
2074
+ var factor = Math.pow(10, exponent);
2075
+ var valueRounded = Math.round(value * factor) / factor;
2076
+ if (Math.abs(value - valueRounded) / value < SMALL_NUMBER) {
2077
+ return valueRounded.toFixed(exponent);
2078
+ }
2079
+ }
2080
+ return value.toString();
2081
+ }
2082
+
2083
+ /**
2084
+ * Function `valueToString` will convert the given value to string
2085
+ * This is useful and used in the `templateParameters` function
2086
+ *
2087
+ * Note: This function is not just calling `toString` method
2088
+ * It's more complex and can handle this conversion specifically for LLM models
2089
+ * See `VALUE_STRINGS`
2090
+ *
2091
+ * Note: There are 2 similar functions
2092
+ * - `valueToString` converts value to string for LLM models as human-readable string
2093
+ * - `asSerializable` converts value to string to preserve full information to be able to convert it back
2094
+ *
2095
+ * @public exported from `@promptbook/utils`
2096
+ */
2097
+ function valueToString(value) {
2098
+ try {
2099
+ if (value === '') {
2100
+ return VALUE_STRINGS.empty;
2101
+ }
2102
+ else if (value === null) {
2103
+ return VALUE_STRINGS.null;
2104
+ }
2105
+ else if (value === undefined) {
2106
+ return VALUE_STRINGS.undefined;
2107
+ }
2108
+ else if (typeof value === 'string') {
2109
+ return value;
2110
+ }
2111
+ else if (typeof value === 'number') {
2112
+ return numberToString(value);
2113
+ }
2114
+ else if (value instanceof Date) {
2115
+ return value.toISOString();
2116
+ }
2117
+ else {
2118
+ return JSON.stringify(value);
2119
+ }
2120
+ }
2121
+ catch (error) {
2122
+ if (!(error instanceof Error)) {
2123
+ throw error;
2124
+ }
2125
+ console.error(error);
2126
+ return VALUE_STRINGS.unserializable;
2127
+ }
2128
+ }
2129
+
2034
2130
  /**
2035
2131
  * Serializes an error into a [🚉] JSON-serializable object
2036
2132
  *
@@ -2712,10 +2808,10 @@
2712
2808
  });
2713
2809
  }
2714
2810
  /**
2715
- * TODO: [🔃][main] !! If the persona was prepared with different version or different set of models, prepare it once again
2716
- * TODO: [🏢] !! Check validity of `modelName` in pipeline
2717
- * TODO: [🏢] !! Check validity of `systemMessage` in pipeline
2718
- * TODO: [🏢] !! Check validity of `temperature` in pipeline
2811
+ * TODO: [🔃][main] If the persona was prepared with different version or different set of models, prepare it once again
2812
+ * TODO: [🏢] Check validity of `modelName` in pipeline
2813
+ * TODO: [🏢] Check validity of `systemMessage` in pipeline
2814
+ * TODO: [🏢] Check validity of `temperature` in pipeline
2719
2815
  */
2720
2816
 
2721
2817
  /**
@@ -3410,21 +3506,44 @@
3410
3506
  if (typeof filename !== 'string') {
3411
3507
  return false;
3412
3508
  }
3509
+ if (filename.split('\n').length > 1) {
3510
+ return false;
3511
+ }
3512
+ if (filename.split(' ').length >
3513
+ 5 /* <- TODO: [🧠][🈷] Make some better non-arbitrary way how to distinct filenames from informational texts */) {
3514
+ return false;
3515
+ }
3413
3516
  var filenameSlashes = filename.split('\\').join('/');
3414
3517
  // Absolute Unix path: /hello.txt
3415
3518
  if (/^(\/)/i.test(filenameSlashes)) {
3519
+ // console.log(filename, 'Absolute Unix path: /hello.txt');
3416
3520
  return true;
3417
3521
  }
3418
3522
  // Absolute Windows path: /hello.txt
3419
3523
  if (/^([A-Z]{1,2}:\/?)\//i.test(filenameSlashes)) {
3524
+ // console.log(filename, 'Absolute Windows path: /hello.txt');
3420
3525
  return true;
3421
3526
  }
3422
3527
  // Relative path: ./hello.txt
3423
3528
  if (/^(\.\.?\/)+/i.test(filenameSlashes)) {
3529
+ // console.log(filename, 'Relative path: ./hello.txt');
3530
+ return true;
3531
+ }
3532
+ // Allow paths like foo/hello
3533
+ if (/^[^/]+\/[^/]+/i.test(filenameSlashes)) {
3534
+ // console.log(filename, 'Allow paths like foo/hello');
3535
+ return true;
3536
+ }
3537
+ // Allow paths like hello.book
3538
+ if (/^[^/]+\.[^/]+$/i.test(filenameSlashes)) {
3539
+ // console.log(filename, 'Allow paths like hello.book');
3424
3540
  return true;
3425
3541
  }
3426
3542
  return false;
3427
3543
  }
3544
+ /**
3545
+ * TODO: [🍏] Implement for MacOs
3546
+ */
3428
3547
 
3429
3548
  /**
3430
3549
  * The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
@@ -3449,6 +3568,9 @@
3449
3568
  }
3450
3569
  });
3451
3570
  }); };
3571
+ /**
3572
+ * TODO: [🧠] Maybe rename because it is not used only for scrapers but also in `$getCompiledBook`
3573
+ */
3452
3574
 
3453
3575
  /**
3454
3576
  * @@@
@@ -3516,7 +3638,7 @@
3516
3638
  },
3517
3639
  }];
3518
3640
  case 2:
3519
- if (!(isValidFilePath(sourceContent) || /\.[a-z]{1,10}$/i.exec(sourceContent))) return [3 /*break*/, 4];
3641
+ if (!isValidFilePath(sourceContent)) return [3 /*break*/, 4];
3520
3642
  if (tools.fs === undefined) {
3521
3643
  throw new EnvironmentMismatchError('Can not import file knowledge without filesystem tools');
3522
3644
  // <- TODO: [🧠] What is the best error type here`
@@ -3531,7 +3653,7 @@
3531
3653
  return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
3532
3654
  case 3:
3533
3655
  if (!(_f.sent())) {
3534
- throw new NotFoundError(spaceTrim__default["default"](function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(filename_1), "\n "); }));
3656
+ throw new NotFoundError(spaceTrim__default["default"](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 "); }));
3535
3657
  }
3536
3658
  // TODO: [🧠][😿] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
3537
3659
  return [2 /*return*/, {
@@ -3644,7 +3766,7 @@
3644
3766
  partialPieces = __spreadArray([], __read(partialPiecesUnchecked), false);
3645
3767
  return [2 /*return*/, "break"];
3646
3768
  }
3647
- console.warn(spaceTrim__default["default"](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
3769
+ console.warn(spaceTrim__default["default"](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
3648
3770
  .split('\n')
3649
3771
  .map(function (line) { return "> ".concat(line); })
3650
3772
  .join('\n')), "\n\n ").concat(block($registeredScrapersMessage(scrapers)), "\n\n\n "); }));
@@ -3682,7 +3804,7 @@
3682
3804
  return [7 /*endfinally*/];
3683
3805
  case 9:
3684
3806
  if (partialPieces === null) {
3685
- throw new KnowledgeScrapeError(spaceTrim__default["default"](function (block) { return "\n Cannot scrape knowledge\n \n The source:\n > ".concat(block(knowledgeSource.sourceContent
3807
+ throw new KnowledgeScrapeError(spaceTrim__default["default"](function (block) { return "\n Cannot scrape knowledge\n\n The source:\n > ".concat(block(knowledgeSource.sourceContent
3686
3808
  .split('\n')
3687
3809
  .map(function (line) { return "> ".concat(line); })
3688
3810
  .join('\n')), "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage(scrapers)), "\n\n\n "); }));
@@ -3773,7 +3895,7 @@
3773
3895
  * TODO: [😂] Adding knowledge should be convert to async high-level abstractions, simmilar thing with expectations to sync high-level abstractions
3774
3896
  * TODO: [🧠] Add context to each task (if missing)
3775
3897
  * TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
3776
- * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
3898
+ * TODO: [♨][main] !!3 Prepare index the examples and maybe tasks
3777
3899
  * TODO: Write tests for `preparePipeline`
3778
3900
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3779
3901
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -3781,7 +3903,9 @@
3781
3903
  */
3782
3904
 
3783
3905
  /**
3784
- * Prepare pipeline from string (markdown) format to JSON format
3906
+ * Prepare pipeline locally
3907
+ *
3908
+ * @see https://github.com/webgptorg/promptbook/discussions/196
3785
3909
  *
3786
3910
  * Note: This function does not validate logic of the pipeline
3787
3911
  * Note: This function acts as part of compilation process
@@ -3795,16 +3919,17 @@
3795
3919
  <- TODO: [🧠][🪑] `promptbookVersion` */
3796
3920
  knowledgeSources /*
3797
3921
  <- TODO: [🧊] `knowledgePieces` */, personas /*
3798
- <- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, tasksPrepared /* TODO: parameters: parametersPrepared*/;
3922
+ <- TODO: [🧊] `preparations` */, sources, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, title, collection, prepareTitleExecutor, _c, result, outputParameters, titleRaw, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, tasksPrepared /* TODO: parameters: parametersPrepared*/;
3923
+ var _d;
3799
3924
  var _this = this;
3800
- return __generator(this, function (_c) {
3801
- switch (_c.label) {
3925
+ return __generator(this, function (_e) {
3926
+ switch (_e.label) {
3802
3927
  case 0:
3803
3928
  if (isPipelinePrepared(pipeline)) {
3804
3929
  return [2 /*return*/, pipeline];
3805
3930
  }
3806
3931
  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;
3807
- parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
3932
+ parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas, sources = pipeline.sources;
3808
3933
  if (tools === undefined || tools.llm === undefined) {
3809
3934
  throw new MissingToolsError('LLM tools are required for preparing the pipeline');
3810
3935
  }
@@ -3822,6 +3947,33 @@
3822
3947
  // <- TODO: [🧊]
3823
3948
  currentPreparation,
3824
3949
  ];
3950
+ title = pipeline.title;
3951
+ if (!(title === undefined || title === '' || title === DEFAULT_BOOK_TITLE)) return [3 /*break*/, 3];
3952
+ collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
3953
+ _c = createPipelineExecutor;
3954
+ _d = {};
3955
+ return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book.md')];
3956
+ case 1:
3957
+ prepareTitleExecutor = _c.apply(void 0, [(_d.pipeline = _e.sent(),
3958
+ _d.tools = tools,
3959
+ _d)]);
3960
+ return [4 /*yield*/, prepareTitleExecutor({
3961
+ book: sources.map(function (_a) {
3962
+ var content = _a.content;
3963
+ return content;
3964
+ }).join('\n\n'),
3965
+ })];
3966
+ case 2:
3967
+ result = _e.sent();
3968
+ assertsExecutionSuccessful(result);
3969
+ outputParameters = result.outputParameters;
3970
+ titleRaw = outputParameters.title;
3971
+ if (isVerbose) {
3972
+ console.info("The title is \"".concat(titleRaw, "\""));
3973
+ }
3974
+ title = titleRaw || DEFAULT_BOOK_TITLE;
3975
+ _e.label = 3;
3976
+ case 3:
3825
3977
  preparedPersonas = new Array(personas.length);
3826
3978
  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 () {
3827
3979
  var modelRequirements, preparedPersona;
@@ -3840,12 +3992,12 @@
3840
3992
  }
3841
3993
  });
3842
3994
  }); })];
3843
- case 1:
3844
- _c.sent();
3995
+ case 4:
3996
+ _e.sent();
3845
3997
  knowledgeSourcesPrepared = knowledgeSources.map(function (source) { return (__assign(__assign({}, source), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
3846
3998
  return [4 /*yield*/, prepareKnowledgePieces(knowledgeSources /* <- TODO: [🧊] {knowledgeSources, knowledgePieces} */, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), __assign(__assign({}, options), { rootDirname: rootDirname, maxParallelCount: maxParallelCount /* <- TODO: [🪂] */, isVerbose: isVerbose }))];
3847
- case 2:
3848
- partialknowledgePiecesPrepared = _c.sent();
3999
+ case 5:
4000
+ partialknowledgePiecesPrepared = _e.sent();
3849
4001
  knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
3850
4002
  return [4 /*yield*/, prepareTasks({
3851
4003
  parameters: parameters,
@@ -3856,8 +4008,8 @@
3856
4008
  maxParallelCount: maxParallelCount /* <- TODO: [🪂] */,
3857
4009
  isVerbose: isVerbose,
3858
4010
  })];
3859
- case 3:
3860
- tasksPrepared = (_c.sent()).tasksPrepared;
4011
+ case 6:
4012
+ tasksPrepared = (_e.sent()).tasksPrepared;
3861
4013
  // ----- /Tasks preparation -----
3862
4014
  // TODO: [😂] Use here all `AsyncHighLevelAbstraction`
3863
4015
  // Note: Count total usage
@@ -3868,7 +4020,7 @@
3868
4020
  order: ORDER_OF_PIPELINE_JSON,
3869
4021
  value: __assign(__assign({}, pipeline), {
3870
4022
  // <- TODO: Probbably deeply clone the pipeline because `$exportJson` freezes the subobjects
3871
- knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, tasks: __spreadArray([], __read(tasksPrepared), false),
4023
+ title: title, knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, tasks: __spreadArray([], __read(tasksPrepared), false),
3872
4024
  // <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
3873
4025
  personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }),
3874
4026
  })];
@@ -3877,7 +4029,7 @@
3877
4029
  });
3878
4030
  }
3879
4031
  /**
3880
- * TODO: Write tests for `preparePipeline`
4032
+ * TODO: Write tests for `preparePipeline` and `preparePipelineOnRemoteServer`
3881
4033
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3882
4034
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
3883
4035
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
@@ -3939,7 +4091,7 @@
3939
4091
  if (!(error instanceof Error)) {
3940
4092
  throw error;
3941
4093
  }
3942
- throw new ParseError(spaceTrim.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)
4094
+ throw new ParseError(spaceTrim.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)
3943
4095
  .map(function (variableName, i) { return "".concat(i + 1, ") ").concat(variableName); })
3944
4096
  .join('\n'), "\n\n\n The script:\n\n ```javascript\n ").concat(block(originalScript), "\n ```\n "); }));
3945
4097
  }
@@ -4421,81 +4573,6 @@
4421
4573
  return mappedParameters;
4422
4574
  }
4423
4575
 
4424
- /**
4425
- * Format either small or big number
4426
- *
4427
- * @public exported from `@promptbook/utils`
4428
- */
4429
- function numberToString(value) {
4430
- if (value === 0) {
4431
- return '0';
4432
- }
4433
- else if (Number.isNaN(value)) {
4434
- return VALUE_STRINGS.nan;
4435
- }
4436
- else if (value === Infinity) {
4437
- return VALUE_STRINGS.infinity;
4438
- }
4439
- else if (value === -Infinity) {
4440
- return VALUE_STRINGS.negativeInfinity;
4441
- }
4442
- for (var exponent = 0; exponent < 15; exponent++) {
4443
- var factor = Math.pow(10, exponent);
4444
- var valueRounded = Math.round(value * factor) / factor;
4445
- if (Math.abs(value - valueRounded) / value < SMALL_NUMBER) {
4446
- return valueRounded.toFixed(exponent);
4447
- }
4448
- }
4449
- return value.toString();
4450
- }
4451
-
4452
- /**
4453
- * Function `valueToString` will convert the given value to string
4454
- * This is useful and used in the `templateParameters` function
4455
- *
4456
- * Note: This function is not just calling `toString` method
4457
- * It's more complex and can handle this conversion specifically for LLM models
4458
- * See `VALUE_STRINGS`
4459
- *
4460
- * Note: There are 2 similar functions
4461
- * - `valueToString` converts value to string for LLM models as human-readable string
4462
- * - `asSerializable` converts value to string to preserve full information to be able to convert it back
4463
- *
4464
- * @public exported from `@promptbook/utils`
4465
- */
4466
- function valueToString(value) {
4467
- try {
4468
- if (value === '') {
4469
- return VALUE_STRINGS.empty;
4470
- }
4471
- else if (value === null) {
4472
- return VALUE_STRINGS.null;
4473
- }
4474
- else if (value === undefined) {
4475
- return VALUE_STRINGS.undefined;
4476
- }
4477
- else if (typeof value === 'string') {
4478
- return value;
4479
- }
4480
- else if (typeof value === 'number') {
4481
- return numberToString(value);
4482
- }
4483
- else if (value instanceof Date) {
4484
- return value.toISOString();
4485
- }
4486
- else {
4487
- return JSON.stringify(value);
4488
- }
4489
- }
4490
- catch (error) {
4491
- if (!(error instanceof Error)) {
4492
- throw error;
4493
- }
4494
- console.error(error);
4495
- return VALUE_STRINGS.unserializable;
4496
- }
4497
- }
4498
-
4499
4576
  /**
4500
4577
  * Replaces parameters in template with values from parameters object
4501
4578
  *
@@ -4552,6 +4629,8 @@
4552
4629
  throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
4553
4630
  }
4554
4631
  parameterValue = valueToString(parameterValue);
4632
+ // Escape curly braces in parameter values to prevent prompt-injection
4633
+ parameterValue = parameterValue.replace(/[{}]/g, '\\$&');
4555
4634
  if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
4556
4635
  parameterValue = parameterValue
4557
4636
  .split('\n')
@@ -4911,7 +4990,7 @@
4911
4990
  promptTitle: task.title,
4912
4991
  promptMessage: templateParameters(task.description || '', parameters),
4913
4992
  defaultValue: templateParameters(preparedContent, parameters),
4914
- // TODO: [🧠] !! Figure out how to define placeholder in .book.md file
4993
+ // TODO: [🧠] Figure out how to define placeholder in .book.md file
4915
4994
  placeholder: undefined,
4916
4995
  priority: priority,
4917
4996
  }))];
@@ -5611,7 +5690,10 @@
5611
5690
  finally { if (e_2) throw e_2.error; }
5612
5691
  return [7 /*endfinally*/];
5613
5692
  case 19:
5614
- parametersToPass = inputParameters;
5693
+ parametersToPass = Object.fromEntries(Object.entries(inputParameters).map(function (_a) {
5694
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
5695
+ return [key, valueToString(value)];
5696
+ }));
5615
5697
  _g.label = 20;
5616
5698
  case 20:
5617
5699
  _g.trys.push([20, 25, , 28]);
@@ -5898,6 +5980,7 @@
5898
5980
  mimeTypes: ['text/markdown', 'text/plain'],
5899
5981
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
5900
5982
  isAvilableInBrowser: true,
5983
+ // <- 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
5901
5984
  requiredExecutables: [],
5902
5985
  }); /* <- Note: [🤛] */
5903
5986
  /**
@@ -5906,6 +5989,7 @@
5906
5989
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
5907
5990
  *
5908
5991
  * @public exported from `@promptbook/core`
5992
+ * @public exported from `@promptbook/wizzard`
5909
5993
  * @public exported from `@promptbook/cli`
5910
5994
  */
5911
5995
  $scrapersMetadataRegister.register(markdownScraperMetadata);
@@ -5991,12 +6075,12 @@
5991
6075
  outputParameters = result.outputParameters;
5992
6076
  knowledgePiecesRaw = outputParameters.knowledgePieces;
5993
6077
  knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
5994
- // <- TODO: [main] !! Smarter split and filter out empty pieces
6078
+ // <- TODO: [main] Smarter split and filter out empty pieces
5995
6079
  if (isVerbose) {
5996
6080
  console.info('knowledgeTextPieces:', knowledgeTextPieces);
5997
6081
  }
5998
6082
  return [4 /*yield*/, Promise.all(
5999
- // TODO: [🪂] !! Do not send all at once but in chunks
6083
+ // TODO: [🪂] Do not send all at once but in chunks
6000
6084
  knowledgeTextPieces.map(function (knowledgeTextPiece, i) { return __awaiter(_this, void 0, void 0, function () {
6001
6085
  var name, title, knowledgePieceContent, keywords, index, titleResult, _a, titleRaw, keywordsResult, _b, keywordsRaw, embeddingResult, error_1;
6002
6086
  return __generator(this, function (_c) {
@@ -6101,6 +6185,7 @@
6101
6185
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
6102
6186
  *
6103
6187
  * @public exported from `@promptbook/markdown-utils`
6188
+ * @public exported from `@promptbook/wizzard`
6104
6189
  * @public exported from `@promptbook/cli`
6105
6190
  */
6106
6191
  var _MarkdownScraperRegistration = $scrapersRegister.register(createMarkdownScraper);
@@ -6110,13 +6195,13 @@
6110
6195
  */
6111
6196
 
6112
6197
  /**
6113
- * Removes HTML or Markdown comments from a string.
6198
+ * Removes Markdown (or HTML) comments
6114
6199
  *
6115
6200
  * @param {string} content - The string to remove comments from.
6116
6201
  * @returns {string} The input string with all comments removed.
6117
6202
  * @public exported from `@promptbook/markdown-utils`
6118
6203
  */
6119
- function removeContentComments(content) {
6204
+ function removeMarkdownComments(content) {
6120
6205
  return spaceTrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
6121
6206
  }
6122
6207
 
@@ -6135,7 +6220,7 @@
6135
6220
  return content.replace(sectionRegex, contentToInsert);
6136
6221
  }
6137
6222
  // Note: Following is the case when the section is not found in the file so we add it there
6138
- var placeForSection = removeContentComments(content).match(/^##.*$/im);
6223
+ var placeForSection = removeMarkdownComments(content).match(/^##.*$/im);
6139
6224
  if (placeForSection !== null) {
6140
6225
  var _a = __read(placeForSection, 1), heading_1 = _a[0];
6141
6226
  return content.replace(heading_1, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(contentToInsert), "\n\n ").concat(block(heading_1), "\n "); }));
@@ -6315,7 +6400,7 @@
6315
6400
  return;
6316
6401
  }
6317
6402
  if (!section.startsWith('#')) {
6318
- section = "# ".concat(DEFAULT_TITLE, "\n\n").concat(section);
6403
+ section = "# ".concat(DEFAULT_BOOK_TITLE, "\n\n").concat(section);
6319
6404
  }
6320
6405
  sections.push(section);
6321
6406
  buffer = [];
@@ -6370,7 +6455,7 @@
6370
6455
  /**
6371
6456
  * Normalizes the markdown by flattening the structure
6372
6457
  *
6373
- * - It always have h1 - if there is no h1 in the markdown, it will be added "# Untitled"
6458
+ * - It always have h1 - if there is no h1 in the markdown, it will be added `DEFAULT_BOOK_TITLE`
6374
6459
  * - All other headings are normalized to h2
6375
6460
  *
6376
6461
  * @public exported from `@promptbook/markdown-utils`
@@ -6379,7 +6464,7 @@
6379
6464
  var e_1, _a;
6380
6465
  var sections = splitMarkdownIntoSections(markdown);
6381
6466
  if (sections.length === 0) {
6382
- return "# ".concat(DEFAULT_TITLE);
6467
+ return "# ".concat(DEFAULT_BOOK_TITLE);
6383
6468
  }
6384
6469
  var flattenedMarkdown = '';
6385
6470
  var parsedSections = sections.map(parseMarkdownSection);
@@ -6390,7 +6475,7 @@
6390
6475
  }
6391
6476
  else {
6392
6477
  parsedSections.unshift(firstSection);
6393
- flattenedMarkdown += "# ".concat(DEFAULT_TITLE) + "\n\n"; // <- [🧠] Maybe 3 new lines?
6478
+ flattenedMarkdown += "# ".concat(DEFAULT_BOOK_TITLE) + "\n\n"; // <- [🧠] Maybe 3 new lines?
6394
6479
  }
6395
6480
  try {
6396
6481
  for (var parsedSections_1 = __values(parsedSections), parsedSections_1_1 = parsedSections_1.next(); !parsedSections_1_1.done; parsedSections_1_1 = parsedSections_1.next()) {
@@ -6449,7 +6534,7 @@
6449
6534
  exports.extractOneBlockFromMarkdown = extractOneBlockFromMarkdown;
6450
6535
  exports.flattenMarkdown = flattenMarkdown;
6451
6536
  exports.parseMarkdownSection = parseMarkdownSection;
6452
- exports.removeContentComments = removeContentComments;
6537
+ exports.removeMarkdownComments = removeMarkdownComments;
6453
6538
  exports.removeMarkdownFormatting = removeMarkdownFormatting;
6454
6539
  exports.splitMarkdownIntoSections = splitMarkdownIntoSections;
6455
6540