@promptbook/core 0.94.0 → 0.98.0-2

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 (61) hide show
  1. package/README.md +6 -2
  2. package/esm/index.es.js +96 -78
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/types.index.d.ts +2 -2
  5. package/esm/typings/src/_packages/{wizzard.index.d.ts → wizard.index.d.ts} +2 -2
  6. package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -1
  7. package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -1
  8. package/esm/typings/src/conversion/archive/loadArchive.d.ts +1 -1
  9. package/esm/typings/src/conversion/archive/saveArchive.d.ts +2 -2
  10. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +1 -1
  11. package/esm/typings/src/dialogs/callback/CallbackInterfaceTools.d.ts +1 -1
  12. package/esm/typings/src/execution/AbstractTaskResult.d.ts +2 -2
  13. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +1 -1
  14. package/esm/typings/src/execution/execution-report/ExecutionPromptReportJson.d.ts +2 -2
  15. package/esm/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +1 -1
  16. package/esm/typings/src/llm-providers/_common/register/{$provideLlmToolsForWizzardOrCli.d.ts → $provideLlmToolsForWizardOrCli.d.ts} +2 -2
  17. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -1
  18. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -1
  19. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +1 -1
  20. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -1
  21. package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +1 -1
  22. package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +1 -1
  23. package/esm/typings/src/llm-providers/google/register-configuration.d.ts +1 -1
  24. package/esm/typings/src/llm-providers/google/register-constructor.d.ts +1 -1
  25. package/esm/typings/src/llm-providers/ollama/register-configuration.d.ts +1 -1
  26. package/esm/typings/src/llm-providers/ollama/register-constructor.d.ts +1 -1
  27. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +1 -1
  28. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -2
  29. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +2 -2
  30. package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +1 -1
  31. package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -1
  32. package/esm/typings/src/scrapers/_boilerplate/register-constructor.d.ts +1 -1
  33. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +2 -2
  34. package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +1 -1
  35. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +1 -1
  36. package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
  37. package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -1
  38. package/esm/typings/src/scrapers/document/register-metadata.d.ts +2 -2
  39. package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -1
  40. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -1
  41. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +2 -2
  42. package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -4
  43. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -1
  44. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +2 -2
  45. package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +1 -1
  46. package/esm/typings/src/scrapers/markitdown/register-constructor.d.ts +1 -1
  47. package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +2 -2
  48. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
  49. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -1
  50. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +2 -2
  51. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -1
  52. package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -1
  53. package/esm/typings/src/scrapers/website/register-metadata.d.ts +2 -2
  54. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  55. package/esm/typings/src/utils/files/listAllFiles.d.ts +1 -1
  56. package/esm/typings/src/version.d.ts +1 -1
  57. package/esm/typings/src/{wizzard → wizard}/$getCompiledBook.d.ts +2 -2
  58. package/esm/typings/src/{wizzard/wizzard.d.ts → wizard/wizard.d.ts} +6 -6
  59. package/package.json +1 -13
  60. package/umd/index.umd.js +96 -78
  61. package/umd/index.umd.js.map +1 -1
package/README.md CHANGED
@@ -25,6 +25,10 @@ Write AI applications using plain human language across multiple models and plat
25
25
 
26
26
 
27
27
 
28
+ <blockquote style="color: #ff8811">
29
+ <b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
30
+ </blockquote>
31
+
28
32
  ## 📦 Package `@promptbook/core`
29
33
 
30
34
  - Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
@@ -287,13 +291,13 @@ Or you can install them separately:
287
291
 
288
292
  - ⭐ **[ptbk](https://www.npmjs.com/package/ptbk)** - Bundle of all packages, when you want to install everything and you don't care about the size
289
293
  - **[promptbook](https://www.npmjs.com/package/promptbook)** - Same as `ptbk`
290
- - ⭐🧙‍♂️ **[@promptbook/wizzard](https://www.npmjs.com/package/@promptbook/wizzard)** - Wizzard to just run the books in node without any struggle
294
+ - ⭐🧙‍♂️ **[@promptbook/wizard](https://www.npmjs.com/package/@promptbook/wizard)** - Wizard to just run the books in node without any struggle
291
295
  - **[@promptbook/core](https://www.npmjs.com/package/@promptbook/core)** - Core of the library, it contains the main logic for promptbooks
292
296
  - **[@promptbook/node](https://www.npmjs.com/package/@promptbook/node)** - Core of the library for Node.js environment
293
297
  - **[@promptbook/browser](https://www.npmjs.com/package/@promptbook/browser)** - Core of the library for browser environment
294
298
  - ⭐ **[@promptbook/utils](https://www.npmjs.com/package/@promptbook/utils)** - Utility functions used in the library but also useful for individual use in preprocessing and postprocessing LLM inputs and outputs
295
299
  - **[@promptbook/markdown-utils](https://www.npmjs.com/package/@promptbook/markdown-utils)** - Utility functions used for processing markdown
296
- - _(Not finished)_ **[@promptbook/wizzard](https://www.npmjs.com/package/@promptbook/wizzard)** - Wizard for creating+running promptbooks in single line
300
+ - _(Not finished)_ **[@promptbook/wizard](https://www.npmjs.com/package/@promptbook/wizard)** - Wizard for creating+running promptbooks in single line
297
301
  - **[@promptbook/javascript](https://www.npmjs.com/package/@promptbook/javascript)** - Execution tools for javascript inside promptbooks
298
302
  - **[@promptbook/openai](https://www.npmjs.com/package/@promptbook/openai)** - Execution tools for OpenAI API, wrapper around OpenAI SDK
299
303
  - **[@promptbook/anthropic-claude](https://www.npmjs.com/package/@promptbook/anthropic-claude)** - Execution tools for Anthropic Claude API, wrapper around Anthropic Claude SDK
package/esm/index.es.js CHANGED
@@ -27,7 +27,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
27
27
  * @generated
28
28
  * @see https://github.com/webgptorg/promptbook
29
29
  */
30
- const PROMPTBOOK_ENGINE_VERSION = '0.94.0';
30
+ const PROMPTBOOK_ENGINE_VERSION = '0.98.0-2';
31
31
  /**
32
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
33
33
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -419,11 +419,11 @@ const PLAYGROUND_APP_ID = 'playground';
419
419
  /*
420
420
  TODO: [🌃]
421
421
  /**
422
- * Id of application for the wizzard when using remote server
422
+ * Id of application for the wizard when using remote server
423
423
  *
424
424
  * @public exported from `@promptbook/core`
425
425
  * /
426
- ex-port const WIZZARD_APP_ID: string_app_id = 'wizzard';
426
+ ex-port const WIZARD_APP_ID: string_app_id = 'wizard';
427
427
  */
428
428
  /**
429
429
  * The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`
@@ -700,7 +700,7 @@ function prettifyMarkdown(content) {
700
700
  });
701
701
  }
702
702
  catch (error) {
703
- // TODO: [🟥] Detect browser / node and make it colorfull
703
+ // TODO: [🟥] Detect browser / node and make it colorful
704
704
  console.error('There was an error with prettifying the markdown, using the original as the fallback', {
705
705
  error,
706
706
  html: content,
@@ -982,7 +982,7 @@ function checkSerializableAsJson(options) {
982
982
  else {
983
983
  for (const [subName, subValue] of Object.entries(value)) {
984
984
  if (subValue === undefined) {
985
- // Note: undefined in object is serializable - it is just omited
985
+ // Note: undefined in object is serializable - it is just omitted
986
986
  continue;
987
987
  }
988
988
  checkSerializableAsJson({ name: `${name}.${subName}`, value: subValue, message });
@@ -1708,7 +1708,7 @@ class SimplePipelineCollection {
1708
1708
 
1709
1709
  Note: You have probably forgotten to run "ptbk make" to update the collection
1710
1710
  Note: Pipelines with the same URL are not allowed
1711
- Only exepction is when the pipelines are identical
1711
+ Only exception is when the pipelines are identical
1712
1712
 
1713
1713
  `));
1714
1714
  }
@@ -1893,7 +1893,7 @@ function createSubcollection(collection, predicate) {
1893
1893
  };
1894
1894
  }
1895
1895
 
1896
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",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`\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"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",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`\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"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",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`\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"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with 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\nHere are the available models:\n\n```json\n{availableModels}\n```\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:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with 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\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\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`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",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`\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"}];
1896
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",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`\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"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",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`\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"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",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`\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"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with 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\nHere are the available models:\n\n```json\n{availableModels}\n```\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:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with 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\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\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`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",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`\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"}];
1897
1897
 
1898
1898
  /**
1899
1899
  * This error type indicates that some tools are missing for pipeline execution or preparation
@@ -3357,13 +3357,13 @@ function joinLlmExecutionTools(...llmExecutionTools) {
3357
3357
 
3358
3358
  Technically, it's not an error, but it's probably not what you want because it does not make sense to use Promptbook without language models.
3359
3359
  `);
3360
- // TODO: [🟥] Detect browser / node and make it colorfull
3360
+ // TODO: [🟥] Detect browser / node and make it colorful
3361
3361
  console.warn(warningMessage);
3362
3362
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
3363
3363
  /*
3364
3364
  return {
3365
3365
  async listModels() {
3366
- // TODO: [🟥] Detect browser / node and make it colorfull
3366
+ // TODO: [🟥] Detect browser / node and make it colorful
3367
3367
  console.warn(
3368
3368
  spaceTrim(
3369
3369
  (block) => `
@@ -4570,10 +4570,10 @@ function knowledgePiecesToString(knowledgePieces) {
4570
4570
  */
4571
4571
  async function getKnowledgeForTask(options) {
4572
4572
  const { tools, preparedPipeline, task, parameters } = options;
4573
- const firstKnowlegePiece = preparedPipeline.knowledgePieces[0];
4574
- const firstKnowlegeIndex = firstKnowlegePiece === null || firstKnowlegePiece === void 0 ? void 0 : firstKnowlegePiece.index[0];
4573
+ const firstKnowledgePiece = preparedPipeline.knowledgePieces[0];
4574
+ const firstKnowledgeIndex = firstKnowledgePiece === null || firstKnowledgePiece === void 0 ? void 0 : firstKnowledgePiece.index[0];
4575
4575
  // <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
4576
- if (firstKnowlegePiece === undefined || firstKnowlegeIndex === undefined) {
4576
+ if (firstKnowledgePiece === undefined || firstKnowledgeIndex === undefined) {
4577
4577
  return ''; // <- Note: Np knowledge present, return empty string
4578
4578
  }
4579
4579
  try {
@@ -4584,7 +4584,7 @@ async function getKnowledgeForTask(options) {
4584
4584
  title: 'Knowledge Search',
4585
4585
  modelRequirements: {
4586
4586
  modelVariant: 'EMBEDDING',
4587
- modelName: firstKnowlegeIndex.modelName,
4587
+ modelName: firstKnowledgeIndex.modelName,
4588
4588
  },
4589
4589
  content: task.content,
4590
4590
  parameters,
@@ -4592,7 +4592,7 @@ async function getKnowledgeForTask(options) {
4592
4592
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
4593
4593
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
4594
4594
  const { index } = knowledgePiece;
4595
- const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowlegeIndex.modelName);
4595
+ const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowledgeIndex.modelName);
4596
4596
  // <- TODO: Do not use just first knowledge piece and first index to determine embedding model
4597
4597
  if (knowledgePieceIndex === undefined) {
4598
4598
  return {
@@ -4613,8 +4613,8 @@ async function getKnowledgeForTask(options) {
4613
4613
  task,
4614
4614
  taskEmbeddingPrompt,
4615
4615
  taskEmbeddingResult,
4616
- firstKnowlegePiece,
4617
- firstKnowlegeIndex,
4616
+ firstKnowledgePiece,
4617
+ firstKnowledgeIndex,
4618
4618
  knowledgePiecesWithRelevance,
4619
4619
  knowledgePiecesSorted,
4620
4620
  knowledgePiecesLimited,
@@ -4683,7 +4683,7 @@ async function getReservedParametersForTask(options) {
4683
4683
  * @private internal utility of `createPipelineExecutor`
4684
4684
  */
4685
4685
  async function executeTask(options) {
4686
- const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSupressed, } = options;
4686
+ const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
4687
4687
  const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
4688
4688
  // Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
4689
4689
  const usedParameterNames = extractParameterNamesFromTask(currentTask);
@@ -4771,7 +4771,7 @@ async function executeTask(options) {
4771
4771
  cacheDirname,
4772
4772
  intermediateFilesStrategy,
4773
4773
  isAutoInstalled,
4774
- isNotPreparedWarningSupressed,
4774
+ isNotPreparedWarningSuppressed,
4775
4775
  });
4776
4776
  await onProgress({
4777
4777
  outputParameters: {
@@ -4866,7 +4866,7 @@ async function executePipeline(options) {
4866
4866
  }
4867
4867
  return exportJson({
4868
4868
  name: `executionReport`,
4869
- message: `Unuccessful PipelineExecutorResult (with missing parameter {${parameter.name}}) PipelineExecutorResult`,
4869
+ message: `Unsuccessful PipelineExecutorResult (with missing parameter {${parameter.name}}) PipelineExecutorResult`,
4870
4870
  order: [],
4871
4871
  value: {
4872
4872
  isSuccessful: false,
@@ -4903,7 +4903,7 @@ async function executePipeline(options) {
4903
4903
  return exportJson({
4904
4904
  name: 'pipelineExecutorResult',
4905
4905
  message: spaceTrim$1((block) => `
4906
- Unuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
4906
+ Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
4907
4907
 
4908
4908
  ${block(pipelineIdentification)}
4909
4909
  `),
@@ -5044,7 +5044,7 @@ async function executePipeline(options) {
5044
5044
  }
5045
5045
  return exportJson({
5046
5046
  name: 'pipelineExecutorResult',
5047
- message: `Unuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult`,
5047
+ message: `Unsuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult`,
5048
5048
  order: [],
5049
5049
  value: {
5050
5050
  isSuccessful: false,
@@ -5095,7 +5095,7 @@ async function executePipeline(options) {
5095
5095
  * @public exported from `@promptbook/core`
5096
5096
  */
5097
5097
  function createPipelineExecutor(options) {
5098
- const { pipeline, tools, maxExecutionAttempts = DEFAULT_MAX_EXECUTION_ATTEMPTS, maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT, csvSettings = DEFAULT_CSV_SETTINGS, isVerbose = DEFAULT_IS_VERBOSE, isNotPreparedWarningSupressed = false, cacheDirname = DEFAULT_SCRAPE_CACHE_DIRNAME, intermediateFilesStrategy = DEFAULT_INTERMEDIATE_FILES_STRATEGY, isAutoInstalled = DEFAULT_IS_AUTO_INSTALLED, rootDirname = null, } = options;
5098
+ const { pipeline, tools, maxExecutionAttempts = DEFAULT_MAX_EXECUTION_ATTEMPTS, maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT, csvSettings = DEFAULT_CSV_SETTINGS, isVerbose = DEFAULT_IS_VERBOSE, isNotPreparedWarningSuppressed = false, cacheDirname = DEFAULT_SCRAPE_CACHE_DIRNAME, intermediateFilesStrategy = DEFAULT_INTERMEDIATE_FILES_STRATEGY, isAutoInstalled = DEFAULT_IS_AUTO_INSTALLED, rootDirname = null, } = options;
5099
5099
  validatePipeline(pipeline);
5100
5100
  const pipelineIdentification = (() => {
5101
5101
  // Note: This is a 😐 implementation of [🚞]
@@ -5112,7 +5112,7 @@ function createPipelineExecutor(options) {
5112
5112
  if (isPipelinePrepared(pipeline)) {
5113
5113
  preparedPipeline = pipeline;
5114
5114
  }
5115
- else if (isNotPreparedWarningSupressed !== true) {
5115
+ else if (isNotPreparedWarningSuppressed !== true) {
5116
5116
  console.warn(spaceTrim$1((block) => `
5117
5117
  Pipeline is not prepared
5118
5118
 
@@ -5145,7 +5145,7 @@ function createPipelineExecutor(options) {
5145
5145
  maxParallelCount,
5146
5146
  csvSettings,
5147
5147
  isVerbose,
5148
- isNotPreparedWarningSupressed,
5148
+ isNotPreparedWarningSuppressed,
5149
5149
  rootDirname,
5150
5150
  cacheDirname,
5151
5151
  intermediateFilesStrategy,
@@ -5154,7 +5154,7 @@ function createPipelineExecutor(options) {
5154
5154
  assertsError(error);
5155
5155
  return exportJson({
5156
5156
  name: 'pipelineExecutorResult',
5157
- message: `Unuccessful PipelineExecutorResult, last catch`,
5157
+ message: `Unsuccessful PipelineExecutorResult, last catch`,
5158
5158
  order: [],
5159
5159
  value: {
5160
5160
  isSuccessful: false,
@@ -5224,12 +5224,12 @@ function countUsage(llmTools) {
5224
5224
  get title() {
5225
5225
  return `${llmTools.title} (+usage)`;
5226
5226
  // <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
5227
- // <- TODO: [🧈][🧠] Does it make sence to suffix "(+usage)"?
5227
+ // <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
5228
5228
  },
5229
5229
  get description() {
5230
5230
  return `${llmTools.description} (+usage)`;
5231
5231
  // <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
5232
- // <- TODO: [🧈][🧠] Does it make sence to suffix "(+usage)"?
5232
+ // <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
5233
5233
  },
5234
5234
  checkConfiguration() {
5235
5235
  return /* not await */ llmTools.checkConfiguration();
@@ -5522,17 +5522,17 @@ function $registeredScrapersMessage(availableScrapers) {
5522
5522
  * Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
5523
5523
  */
5524
5524
  const all = [];
5525
- for (const { packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser, } of $scrapersMetadataRegister.list()) {
5525
+ for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersMetadataRegister.list()) {
5526
5526
  if (all.some((item) => item.packageName === packageName && item.className === className)) {
5527
5527
  continue;
5528
5528
  }
5529
- all.push({ packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser });
5529
+ all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
5530
5530
  }
5531
- for (const { packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser, } of $scrapersRegister.list()) {
5531
+ for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersRegister.list()) {
5532
5532
  if (all.some((item) => item.packageName === packageName && item.className === className)) {
5533
5533
  continue;
5534
5534
  }
5535
- all.push({ packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser });
5535
+ all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
5536
5536
  }
5537
5537
  for (const { metadata } of availableScrapers) {
5538
5538
  all.push(metadata);
@@ -5544,8 +5544,8 @@ function $registeredScrapersMessage(availableScrapers) {
5544
5544
  const isInstalled = $scrapersRegister
5545
5545
  .list()
5546
5546
  .find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
5547
- const isAvilableInTools = availableScrapers.some(({ metadata: { packageName, className } }) => metadata.packageName === packageName && metadata.className === className);
5548
- return { ...metadata, isMetadataAviailable, isInstalled, isAvilableInTools };
5547
+ const isAvailableInTools = availableScrapers.some(({ metadata: { packageName, className } }) => metadata.packageName === packageName && metadata.className === className);
5548
+ return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
5549
5549
  });
5550
5550
  if (metadata.length === 0) {
5551
5551
  return spaceTrim(`
@@ -5558,7 +5558,7 @@ function $registeredScrapersMessage(availableScrapers) {
5558
5558
  return spaceTrim((block) => `
5559
5559
  Available scrapers are:
5560
5560
  ${block(metadata
5561
- .map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvilableInBrowser, isAvilableInTools, }, i) => {
5561
+ .map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
5562
5562
  const more = [];
5563
5563
  // TODO: [🧠] Maybe use `documentationUrl`
5564
5564
  if (isMetadataAviailable) {
@@ -5567,16 +5567,16 @@ function $registeredScrapersMessage(availableScrapers) {
5567
5567
  if (isInstalled) {
5568
5568
  more.push(`🟩 Installed`);
5569
5569
  } // not else
5570
- if (isAvilableInTools) {
5570
+ if (isAvailableInTools) {
5571
5571
  more.push(`🟦 Available in tools`);
5572
5572
  } // not else
5573
5573
  if (!isMetadataAviailable && isInstalled) {
5574
5574
  more.push(`When no metadata registered but scraper is installed, it is an unexpected behavior`);
5575
5575
  } // not else
5576
- if (!isInstalled && isAvilableInTools) {
5576
+ if (!isInstalled && isAvailableInTools) {
5577
5577
  more.push(`When the scraper is not installed but available in tools, it is an unexpected compatibility behavior`);
5578
5578
  } // not else
5579
- if (!isAvilableInBrowser) {
5579
+ if (!isAvailableInBrowser) {
5580
5580
  more.push(`Not usable in browser`);
5581
5581
  }
5582
5582
  const moreText = more.length === 0 ? '' : ` *(${more.join('; ')})*`;
@@ -6042,7 +6042,7 @@ TODO: [🧊] This is how it can look in future
6042
6042
  /**
6043
6043
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
6044
6044
  * Put `knowledgePieces` into `PrepareKnowledgeOptions`
6045
- * TODO: [🪂] More than max things can run in parallel by acident [1,[2a,2b,_],[3a,3b,_]]
6045
+ * TODO: [🪂] More than max things can run in parallel by accident [1,[2a,2b,_],[3a,3b,_]]
6046
6046
  * TODO: [🧠][❎] Do here proper M:N mapping
6047
6047
  * [x] One source can make multiple pieces
6048
6048
  * [ ] One piece can have multiple sources
@@ -6930,7 +6930,7 @@ const expectCommandParser = {
6930
6930
  $taskJson.expectations[unit] = $taskJson.expectations[unit] || {};
6931
6931
  if (command.sign === 'MINIMUM' || command.sign === 'EXACTLY') {
6932
6932
  if ($taskJson.expectations[unit].min !== undefined) {
6933
- throw new ParseError(`Already defined minumum ${$taskJson.expectations[unit].min} ${command.unit.toLowerCase()}, now trying to redefine it to ${command.amount}`);
6933
+ throw new ParseError(`Already defined minimum ${$taskJson.expectations[unit].min} ${command.unit.toLowerCase()}, now trying to redefine it to ${command.amount}`);
6934
6934
  }
6935
6935
  $taskJson.expectations[unit].min = command.amount;
6936
6936
  } /* not else */
@@ -9944,7 +9944,7 @@ async function prettifyPipelineString(pipelineString, options) {
9944
9944
  */
9945
9945
 
9946
9946
  /**
9947
- * Delagates the user interaction to a async callback function
9947
+ * Delegates the user interaction to a async callback function
9948
9948
  * You need to provide your own implementation of this callback function and its bind to UI.
9949
9949
  *
9950
9950
  * @public exported from `@promptbook/core`
@@ -10746,12 +10746,12 @@ function cacheLlmTools(llmTools, options = {}) {
10746
10746
  get title() {
10747
10747
  return `${llmTools.title} (cached)`;
10748
10748
  // <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
10749
- // <- TODO: [🧈][🧠] Does it make sence to suffix "(cached)"?
10749
+ // <- TODO: [🧈][🧠] Does it make sense to suffix "(cached)"?
10750
10750
  },
10751
10751
  get description() {
10752
10752
  return `${llmTools.description} (cached)`;
10753
10753
  // <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
10754
- // <- TODO: [🧈][🧠] Does it make sence to suffix "(cached)"?
10754
+ // <- TODO: [🧈][🧠] Does it make sense to suffix "(cached)"?
10755
10755
  },
10756
10756
  listModels() {
10757
10757
  // TODO: [🧠] Should be model listing also cached?
@@ -10809,21 +10809,39 @@ function cacheLlmTools(llmTools, options = {}) {
10809
10809
  }
10810
10810
  // TODO: [🧠] !!5 How to do timing in mixed cache / non-cache situation
10811
10811
  // promptResult.timing: FromtoItems
10812
- await storage.setItem(key, {
10813
- date: $getCurrentDate(),
10814
- promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
10815
- bookVersion: BOOK_LANGUAGE_VERSION,
10816
- prompt: {
10817
- ...prompt,
10818
- parameters: Object.entries(parameters).length === Object.entries(relevantParameters).length
10819
- ? parameters
10820
- : {
10821
- ...relevantParameters,
10822
- note: `<- Note: Only relevant parameters are stored in the cache`,
10823
- },
10824
- },
10825
- promptResult,
10826
- });
10812
+ // Check if the result is valid and should be cached
10813
+ // A result is considered failed if:
10814
+ // 1. It has a content property that is null or undefined
10815
+ // 2. It has an error property that is truthy
10816
+ // 3. It has a success property that is explicitly false
10817
+ const isFailedResult = promptResult.content === null ||
10818
+ promptResult.content === undefined ||
10819
+ promptResult.error ||
10820
+ promptResult.success === false;
10821
+ if (!isFailedResult) {
10822
+ await storage.setItem(key, {
10823
+ date: $getCurrentDate(),
10824
+ promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
10825
+ bookVersion: BOOK_LANGUAGE_VERSION,
10826
+ prompt: {
10827
+ ...prompt,
10828
+ parameters: Object.entries(parameters).length === Object.entries(relevantParameters).length
10829
+ ? parameters
10830
+ : {
10831
+ ...relevantParameters,
10832
+ note: `<- Note: Only relevant parameters are stored in the cache`,
10833
+ },
10834
+ },
10835
+ promptResult,
10836
+ });
10837
+ }
10838
+ else if (isVerbose) {
10839
+ console.info('Not caching failed result for key:', key, {
10840
+ content: promptResult.content,
10841
+ error: promptResult.error,
10842
+ success: promptResult.success,
10843
+ });
10844
+ }
10827
10845
  return promptResult;
10828
10846
  };
10829
10847
  if (llmTools.callChatModel !== undefined) {
@@ -10896,7 +10914,7 @@ function limitTotalUsage(llmTools, options = {}) {
10896
10914
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
10897
10915
  *
10898
10916
  * @public exported from `@promptbook/core`
10899
- * @public exported from `@promptbook/wizzard`
10917
+ * @public exported from `@promptbook/wizard`
10900
10918
  * @public exported from `@promptbook/cli`
10901
10919
  */
10902
10920
  const _AnthropicClaudeMetadataRegistration = $llmToolsMetadataRegister.register({
@@ -10944,7 +10962,7 @@ const _AnthropicClaudeMetadataRegistration = $llmToolsMetadataRegister.register(
10944
10962
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
10945
10963
  *
10946
10964
  * @public exported from `@promptbook/core`
10947
- * @public exported from `@promptbook/wizzard`
10965
+ * @public exported from `@promptbook/wizard`
10948
10966
  * @public exported from `@promptbook/cli`
10949
10967
  */
10950
10968
  const _AzureOpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
@@ -11035,7 +11053,7 @@ const $isRunningInJest = new Function(`
11035
11053
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
11036
11054
  *
11037
11055
  * @public exported from `@promptbook/core`
11038
- * @public exported from `@promptbook/wizzard`
11056
+ * @public exported from `@promptbook/wizard`
11039
11057
  * @public exported from `@promptbook/cli`
11040
11058
  */
11041
11059
  const _DeepseekMetadataRegistration = $llmToolsMetadataRegister.register({
@@ -11086,7 +11104,7 @@ const _DeepseekMetadataRegistration = $llmToolsMetadataRegister.register({
11086
11104
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
11087
11105
  *
11088
11106
  * @public exported from `@promptbook/core`
11089
- * @public exported from `@promptbook/wizzard`
11107
+ * @public exported from `@promptbook/wizard`
11090
11108
  * @public exported from `@promptbook/cli`
11091
11109
  */
11092
11110
  const _GoogleMetadataRegistration = $llmToolsMetadataRegister.register({
@@ -11144,7 +11162,7 @@ const DEFAULT_OLLAMA_BASE_URL = 'http://localhost:11434/v1';
11144
11162
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
11145
11163
  *
11146
11164
  * @public exported from `@promptbook/core`
11147
- * @public exported from `@promptbook/wizzard`
11165
+ * @public exported from `@promptbook/wizard`
11148
11166
  * @public exported from `@promptbook/cli`
11149
11167
  */
11150
11168
  const _OllamaMetadataRegistration = $llmToolsMetadataRegister.register({
@@ -11189,7 +11207,7 @@ const _OllamaMetadataRegistration = $llmToolsMetadataRegister.register({
11189
11207
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
11190
11208
  *
11191
11209
  * @public exported from `@promptbook/core`
11192
- * @public exported from `@promptbook/wizzard`
11210
+ * @public exported from `@promptbook/wizard`
11193
11211
  * @public exported from `@promptbook/cli`
11194
11212
  */
11195
11213
  const _OpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
@@ -11231,7 +11249,7 @@ const _OpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
11231
11249
  * Note: [🏐] Configurations registrations are done in the metadata registration section, but the constructor registration is handled separately.
11232
11250
  *
11233
11251
  * @public exported from `@promptbook/core`
11234
- * @public exported from `@promptbook/wizzard`
11252
+ * @public exported from `@promptbook/wizard`
11235
11253
  * @public exported from `@promptbook/cli`
11236
11254
  */
11237
11255
  const _OpenAiAssistantMetadataRegistration = $llmToolsMetadataRegister.register({
@@ -11480,7 +11498,7 @@ const boilerplateScraperMetadata = $deepFreeze({
11480
11498
  // <- TODO: @@ Add compatible mime types with Boilerplate scraper
11481
11499
  ],
11482
11500
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
11483
- isAvilableInBrowser: false,
11501
+ isAvailableInBrowser: false,
11484
11502
  // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
11485
11503
  requiredExecutables: [
11486
11504
  /* @@ 'Pandoc' */
@@ -11492,7 +11510,7 @@ const boilerplateScraperMetadata = $deepFreeze({
11492
11510
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
11493
11511
  *
11494
11512
  * @public exported from `@promptbook/core`
11495
- * @public exported from `@promptbook/wizzard`
11513
+ * @public exported from `@promptbook/wizard`
11496
11514
  * @public exported from `@promptbook/cli`
11497
11515
  */
11498
11516
  const _BoilerplateScraperMetadataRegistration = $scrapersMetadataRegister.register(boilerplateScraperMetadata);
@@ -11511,7 +11529,7 @@ const legacyDocumentScraperMetadata = $deepFreeze({
11511
11529
  className: 'LegacyDocumentScraper',
11512
11530
  mimeTypes: ['application/msword', 'text/rtf'],
11513
11531
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
11514
- isAvilableInBrowser: false,
11532
+ isAvailableInBrowser: false,
11515
11533
  // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
11516
11534
  requiredExecutables: [
11517
11535
  'Pandoc',
@@ -11525,7 +11543,7 @@ const legacyDocumentScraperMetadata = $deepFreeze({
11525
11543
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
11526
11544
  *
11527
11545
  * @public exported from `@promptbook/core`
11528
- * @public exported from `@promptbook/wizzard`
11546
+ * @public exported from `@promptbook/wizard`
11529
11547
  * @public exported from `@promptbook/cli`
11530
11548
  */
11531
11549
  const _LegacyDocumentScraperMetadataRegistration = $scrapersMetadataRegister.register(legacyDocumentScraperMetadata);
@@ -11544,7 +11562,7 @@ const documentScraperMetadata = $deepFreeze({
11544
11562
  className: 'DocumentScraper',
11545
11563
  mimeTypes: ['application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
11546
11564
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
11547
- isAvilableInBrowser: false,
11565
+ isAvailableInBrowser: false,
11548
11566
  // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
11549
11567
  requiredExecutables: ['Pandoc'],
11550
11568
  }); /* <- Note: [🤛] */
@@ -11554,7 +11572,7 @@ const documentScraperMetadata = $deepFreeze({
11554
11572
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
11555
11573
  *
11556
11574
  * @public exported from `@promptbook/core`
11557
- * @public exported from `@promptbook/wizzard`
11575
+ * @public exported from `@promptbook/wizard`
11558
11576
  * @public exported from `@promptbook/cli`
11559
11577
  */
11560
11578
  const _DocumentScraperMetadataRegistration = $scrapersMetadataRegister.register(documentScraperMetadata);
@@ -11573,7 +11591,7 @@ const markdownScraperMetadata = $deepFreeze({
11573
11591
  className: 'MarkdownScraper',
11574
11592
  mimeTypes: ['text/markdown', 'text/plain'],
11575
11593
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
11576
- isAvilableInBrowser: true,
11594
+ isAvailableInBrowser: true,
11577
11595
  // <- 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
11578
11596
  requiredExecutables: [],
11579
11597
  }); /* <- Note: [🤛] */
@@ -11583,7 +11601,7 @@ const markdownScraperMetadata = $deepFreeze({
11583
11601
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
11584
11602
  *
11585
11603
  * @public exported from `@promptbook/core`
11586
- * @public exported from `@promptbook/wizzard`
11604
+ * @public exported from `@promptbook/wizard`
11587
11605
  * @public exported from `@promptbook/cli`
11588
11606
  */
11589
11607
  const _MarkdownScraperMetadataRegistration = $scrapersMetadataRegister.register(markdownScraperMetadata);
@@ -11607,7 +11625,7 @@ const markitdownScraperMetadata = $deepFreeze({
11607
11625
  // 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
11608
11626
  ],
11609
11627
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
11610
- isAvilableInBrowser: false,
11628
+ isAvailableInBrowser: false,
11611
11629
  // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
11612
11630
  requiredExecutables: [],
11613
11631
  }); /* <- Note: [🤛] */
@@ -11617,7 +11635,7 @@ const markitdownScraperMetadata = $deepFreeze({
11617
11635
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
11618
11636
  *
11619
11637
  * @public exported from `@promptbook/core`
11620
- * @public exported from `@promptbook/wizzard`
11638
+ * @public exported from `@promptbook/wizard`
11621
11639
  * @public exported from `@promptbook/cli`
11622
11640
  */
11623
11641
  const _MarkitdownScraperMetadataRegistration = $scrapersMetadataRegister.register(markitdownScraperMetadata);
@@ -11636,7 +11654,7 @@ const pdfScraperMetadata = $deepFreeze({
11636
11654
  className: 'PdfScraper',
11637
11655
  mimeTypes: ['application/pdf-DISABLED'],
11638
11656
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
11639
- isAvilableInBrowser: false,
11657
+ isAvailableInBrowser: false,
11640
11658
  // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
11641
11659
  requiredExecutables: [],
11642
11660
  }); /* <- Note: [🤛] */
@@ -11646,7 +11664,7 @@ const pdfScraperMetadata = $deepFreeze({
11646
11664
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
11647
11665
  *
11648
11666
  * @public exported from `@promptbook/core`
11649
- * @public exported from `@promptbook/wizzard`
11667
+ * @public exported from `@promptbook/wizard`
11650
11668
  * @public exported from `@promptbook/cli`
11651
11669
  */
11652
11670
  const _PdfScraperMetadataRegistration = $scrapersMetadataRegister.register(pdfScraperMetadata);
@@ -11665,7 +11683,7 @@ const websiteScraperMetadata = $deepFreeze({
11665
11683
  className: 'WebsiteScraper',
11666
11684
  mimeTypes: ['text/html'],
11667
11685
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
11668
- isAvilableInBrowser: false,
11686
+ isAvailableInBrowser: false,
11669
11687
  // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
11670
11688
  requiredExecutables: [],
11671
11689
  }); /* <- Note: [🤛] */
@@ -11675,7 +11693,7 @@ const websiteScraperMetadata = $deepFreeze({
11675
11693
  * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
11676
11694
  *
11677
11695
  * @public exported from `@promptbook/core`
11678
- * @public exported from `@promptbook/wizzard`
11696
+ * @public exported from `@promptbook/wizard`
11679
11697
  * @public exported from `@promptbook/cli`
11680
11698
  */
11681
11699
  const _WebsiteScraperMetadataRegistration = $scrapersMetadataRegister.register(websiteScraperMetadata);