@promptbook/markdown-utils 0.94.0 → 0.95.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.
- package/README.md +2 -10
- package/esm/index.es.js +41 -41
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +2 -2
- package/esm/typings/src/_packages/{wizzard.index.d.ts → wizard.index.d.ts} +2 -2
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -1
- package/esm/typings/src/conversion/archive/loadArchive.d.ts +1 -1
- package/esm/typings/src/conversion/archive/saveArchive.d.ts +2 -2
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +1 -1
- package/esm/typings/src/dialogs/callback/CallbackInterfaceTools.d.ts +1 -1
- package/esm/typings/src/execution/AbstractTaskResult.d.ts +2 -2
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +1 -1
- package/esm/typings/src/execution/execution-report/ExecutionPromptReportJson.d.ts +2 -2
- package/esm/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/{$provideLlmToolsForWizzardOrCli.d.ts → $provideLlmToolsForWizardOrCli.d.ts} +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/ollama/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/ollama/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +1 -1
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/document/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -4
- package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/markitdown/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +2 -2
- package/esm/typings/src/types/typeAliases.d.ts +1 -1
- package/esm/typings/src/utils/files/listAllFiles.d.ts +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/esm/typings/src/{wizzard → wizard}/$getCompiledBook.d.ts +2 -2
- package/esm/typings/src/{wizzard/wizzard.d.ts → wizard/wizard.d.ts} +6 -6
- package/package.json +1 -13
- package/umd/index.umd.js +41 -41
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -56,8 +56,6 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
56
56
|
|
|
57
57
|
During the computer revolution, we have seen [multiple generations of computer languages](https://github.com/webgptorg/promptbook/discussions/180), from the physical rewiring of the vacuum tubes through low-level machine code to the high-level languages like Python or JavaScript. And now, we're on the edge of the **next revolution**!
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
59
|
It's a revolution of writing software in **plain human language** that is understandable and executable by both humans and machines – and it's going to change everything!
|
|
62
60
|
|
|
63
61
|
The incredible growth in power of microprocessors and the Moore's Law have been the driving force behind the ever-more powerful languages, and it's been an amazing journey! Similarly, the large language models (like GPT or Claude) are the next big thing in language technology, and they're set to transform the way we interact with computers.
|
|
@@ -183,8 +181,6 @@ Join our growing community of developers and users:
|
|
|
183
181
|
|
|
184
182
|
_A concise, Markdown-based DSL for crafting AI workflows and automations._
|
|
185
183
|
|
|
186
|
-
|
|
187
|
-
|
|
188
184
|
### Introduction
|
|
189
185
|
|
|
190
186
|
Book is a Markdown-based language that simplifies the creation of AI applications, workflows, and automations. With human-readable commands, you can define inputs, outputs, personas, knowledge sources, and actions—without needing model-specific details.
|
|
@@ -234,8 +230,6 @@ Personas can have access to different knowledge, tools and actions. They can als
|
|
|
234
230
|
|
|
235
231
|
- [PERSONA](https://github.com/webgptorg/promptbook/blob/main/documents/commands/PERSONA.md)
|
|
236
232
|
|
|
237
|
-
|
|
238
|
-
|
|
239
233
|
### **3. How:** Knowledge, Instruments and Actions
|
|
240
234
|
|
|
241
235
|
The resources used by the personas are used to do the work.
|
|
@@ -283,13 +277,13 @@ Or you can install them separately:
|
|
|
283
277
|
|
|
284
278
|
- ⭐ **[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
|
|
285
279
|
- **[promptbook](https://www.npmjs.com/package/promptbook)** - Same as `ptbk`
|
|
286
|
-
- ⭐🧙♂️ **[@promptbook/
|
|
280
|
+
- ⭐🧙♂️ **[@promptbook/wizard](https://www.npmjs.com/package/@promptbook/wizard)** - Wizard to just run the books in node without any struggle
|
|
287
281
|
- **[@promptbook/core](https://www.npmjs.com/package/@promptbook/core)** - Core of the library, it contains the main logic for promptbooks
|
|
288
282
|
- **[@promptbook/node](https://www.npmjs.com/package/@promptbook/node)** - Core of the library for Node.js environment
|
|
289
283
|
- **[@promptbook/browser](https://www.npmjs.com/package/@promptbook/browser)** - Core of the library for browser environment
|
|
290
284
|
- ⭐ **[@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
|
|
291
285
|
- **[@promptbook/markdown-utils](https://www.npmjs.com/package/@promptbook/markdown-utils)** - Utility functions used for processing markdown
|
|
292
|
-
- _(Not finished)_ **[@promptbook/
|
|
286
|
+
- _(Not finished)_ **[@promptbook/wizard](https://www.npmjs.com/package/@promptbook/wizard)** - Wizard for creating+running promptbooks in single line
|
|
293
287
|
- **[@promptbook/javascript](https://www.npmjs.com/package/@promptbook/javascript)** - Execution tools for javascript inside promptbooks
|
|
294
288
|
- **[@promptbook/openai](https://www.npmjs.com/package/@promptbook/openai)** - Execution tools for OpenAI API, wrapper around OpenAI SDK
|
|
295
289
|
- **[@promptbook/anthropic-claude](https://www.npmjs.com/package/@promptbook/anthropic-claude)** - Execution tools for Anthropic Claude API, wrapper around Anthropic Claude SDK
|
|
@@ -335,8 +329,6 @@ The following glossary is used to clarify certain concepts:
|
|
|
335
329
|
|
|
336
330
|
_Note: This section is not a complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
337
331
|
|
|
338
|
-
|
|
339
|
-
|
|
340
332
|
### 💯 Core concepts
|
|
341
333
|
|
|
342
334
|
- [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
|
package/esm/index.es.js
CHANGED
|
@@ -25,7 +25,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
28
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.95.0';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -552,7 +552,7 @@ function extractJsonBlock(markdown) {
|
|
|
552
552
|
function keepUnused(...valuesToKeep) {
|
|
553
553
|
}
|
|
554
554
|
|
|
555
|
-
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"}];
|
|
555
|
+
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"}];
|
|
556
556
|
|
|
557
557
|
/**
|
|
558
558
|
* Checks if value is valid email
|
|
@@ -701,7 +701,7 @@ function prettifyMarkdown(content) {
|
|
|
701
701
|
});
|
|
702
702
|
}
|
|
703
703
|
catch (error) {
|
|
704
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
704
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
705
705
|
console.error('There was an error with prettifying the markdown, using the original as the fallback', {
|
|
706
706
|
error,
|
|
707
707
|
html: content,
|
|
@@ -974,7 +974,7 @@ function checkSerializableAsJson(options) {
|
|
|
974
974
|
else {
|
|
975
975
|
for (const [subName, subValue] of Object.entries(value)) {
|
|
976
976
|
if (subValue === undefined) {
|
|
977
|
-
// Note: undefined in object is serializable - it is just
|
|
977
|
+
// Note: undefined in object is serializable - it is just omitted
|
|
978
978
|
continue;
|
|
979
979
|
}
|
|
980
980
|
checkSerializableAsJson({ name: `${name}.${subName}`, value: subValue, message });
|
|
@@ -1664,7 +1664,7 @@ class SimplePipelineCollection {
|
|
|
1664
1664
|
|
|
1665
1665
|
Note: You have probably forgotten to run "ptbk make" to update the collection
|
|
1666
1666
|
Note: Pipelines with the same URL are not allowed
|
|
1667
|
-
Only
|
|
1667
|
+
Only exception is when the pipelines are identical
|
|
1668
1668
|
|
|
1669
1669
|
`));
|
|
1670
1670
|
}
|
|
@@ -2458,12 +2458,12 @@ function countUsage(llmTools) {
|
|
|
2458
2458
|
get title() {
|
|
2459
2459
|
return `${llmTools.title} (+usage)`;
|
|
2460
2460
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2461
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2461
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
2462
2462
|
},
|
|
2463
2463
|
get description() {
|
|
2464
2464
|
return `${llmTools.description} (+usage)`;
|
|
2465
2465
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2466
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2466
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
2467
2467
|
},
|
|
2468
2468
|
checkConfiguration() {
|
|
2469
2469
|
return /* not await */ llmTools.checkConfiguration();
|
|
@@ -2690,13 +2690,13 @@ function joinLlmExecutionTools(...llmExecutionTools) {
|
|
|
2690
2690
|
|
|
2691
2691
|
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.
|
|
2692
2692
|
`);
|
|
2693
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
2693
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
2694
2694
|
console.warn(warningMessage);
|
|
2695
2695
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
2696
2696
|
/*
|
|
2697
2697
|
return {
|
|
2698
2698
|
async listModels() {
|
|
2699
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
2699
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
2700
2700
|
console.warn(
|
|
2701
2701
|
spaceTrim(
|
|
2702
2702
|
(block) => `
|
|
@@ -2972,17 +2972,17 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
2972
2972
|
* Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
|
|
2973
2973
|
*/
|
|
2974
2974
|
const all = [];
|
|
2975
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
2975
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersMetadataRegister.list()) {
|
|
2976
2976
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
2977
2977
|
continue;
|
|
2978
2978
|
}
|
|
2979
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
2979
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
2980
2980
|
}
|
|
2981
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
2981
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersRegister.list()) {
|
|
2982
2982
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
2983
2983
|
continue;
|
|
2984
2984
|
}
|
|
2985
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
2985
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
2986
2986
|
}
|
|
2987
2987
|
for (const { metadata } of availableScrapers) {
|
|
2988
2988
|
all.push(metadata);
|
|
@@ -2994,8 +2994,8 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
2994
2994
|
const isInstalled = $scrapersRegister
|
|
2995
2995
|
.list()
|
|
2996
2996
|
.find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
2997
|
-
const
|
|
2998
|
-
return { ...metadata, isMetadataAviailable, isInstalled,
|
|
2997
|
+
const isAvailableInTools = availableScrapers.some(({ metadata: { packageName, className } }) => metadata.packageName === packageName && metadata.className === className);
|
|
2998
|
+
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
2999
2999
|
});
|
|
3000
3000
|
if (metadata.length === 0) {
|
|
3001
3001
|
return spaceTrim(`
|
|
@@ -3008,7 +3008,7 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
3008
3008
|
return spaceTrim((block) => `
|
|
3009
3009
|
Available scrapers are:
|
|
3010
3010
|
${block(metadata
|
|
3011
|
-
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes,
|
|
3011
|
+
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
3012
3012
|
const more = [];
|
|
3013
3013
|
// TODO: [🧠] Maybe use `documentationUrl`
|
|
3014
3014
|
if (isMetadataAviailable) {
|
|
@@ -3017,16 +3017,16 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
3017
3017
|
if (isInstalled) {
|
|
3018
3018
|
more.push(`🟩 Installed`);
|
|
3019
3019
|
} // not else
|
|
3020
|
-
if (
|
|
3020
|
+
if (isAvailableInTools) {
|
|
3021
3021
|
more.push(`🟦 Available in tools`);
|
|
3022
3022
|
} // not else
|
|
3023
3023
|
if (!isMetadataAviailable && isInstalled) {
|
|
3024
3024
|
more.push(`When no metadata registered but scraper is installed, it is an unexpected behavior`);
|
|
3025
3025
|
} // not else
|
|
3026
|
-
if (!isInstalled &&
|
|
3026
|
+
if (!isInstalled && isAvailableInTools) {
|
|
3027
3027
|
more.push(`When the scraper is not installed but available in tools, it is an unexpected compatibility behavior`);
|
|
3028
3028
|
} // not else
|
|
3029
|
-
if (!
|
|
3029
|
+
if (!isAvailableInBrowser) {
|
|
3030
3030
|
more.push(`Not usable in browser`);
|
|
3031
3031
|
}
|
|
3032
3032
|
const moreText = more.length === 0 ? '' : ` *(${more.join('; ')})*`;
|
|
@@ -3753,7 +3753,7 @@ TODO: [🧊] This is how it can look in future
|
|
|
3753
3753
|
/**
|
|
3754
3754
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
3755
3755
|
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
3756
|
-
* TODO: [🪂] More than max things can run in parallel by
|
|
3756
|
+
* TODO: [🪂] More than max things can run in parallel by accident [1,[2a,2b,_],[3a,3b,_]]
|
|
3757
3757
|
* TODO: [🧠][❎] Do here proper M:N mapping
|
|
3758
3758
|
* [x] One source can make multiple pieces
|
|
3759
3759
|
* [ ] One piece can have multiple sources
|
|
@@ -5323,10 +5323,10 @@ function knowledgePiecesToString(knowledgePieces) {
|
|
|
5323
5323
|
*/
|
|
5324
5324
|
async function getKnowledgeForTask(options) {
|
|
5325
5325
|
const { tools, preparedPipeline, task, parameters } = options;
|
|
5326
|
-
const
|
|
5327
|
-
const
|
|
5326
|
+
const firstKnowledgePiece = preparedPipeline.knowledgePieces[0];
|
|
5327
|
+
const firstKnowledgeIndex = firstKnowledgePiece === null || firstKnowledgePiece === void 0 ? void 0 : firstKnowledgePiece.index[0];
|
|
5328
5328
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
5329
|
-
if (
|
|
5329
|
+
if (firstKnowledgePiece === undefined || firstKnowledgeIndex === undefined) {
|
|
5330
5330
|
return ''; // <- Note: Np knowledge present, return empty string
|
|
5331
5331
|
}
|
|
5332
5332
|
try {
|
|
@@ -5337,7 +5337,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5337
5337
|
title: 'Knowledge Search',
|
|
5338
5338
|
modelRequirements: {
|
|
5339
5339
|
modelVariant: 'EMBEDDING',
|
|
5340
|
-
modelName:
|
|
5340
|
+
modelName: firstKnowledgeIndex.modelName,
|
|
5341
5341
|
},
|
|
5342
5342
|
content: task.content,
|
|
5343
5343
|
parameters,
|
|
@@ -5345,7 +5345,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5345
5345
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
5346
5346
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
5347
5347
|
const { index } = knowledgePiece;
|
|
5348
|
-
const knowledgePieceIndex = index.find((i) => i.modelName ===
|
|
5348
|
+
const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowledgeIndex.modelName);
|
|
5349
5349
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model
|
|
5350
5350
|
if (knowledgePieceIndex === undefined) {
|
|
5351
5351
|
return {
|
|
@@ -5366,8 +5366,8 @@ async function getKnowledgeForTask(options) {
|
|
|
5366
5366
|
task,
|
|
5367
5367
|
taskEmbeddingPrompt,
|
|
5368
5368
|
taskEmbeddingResult,
|
|
5369
|
-
|
|
5370
|
-
|
|
5369
|
+
firstKnowledgePiece,
|
|
5370
|
+
firstKnowledgeIndex,
|
|
5371
5371
|
knowledgePiecesWithRelevance,
|
|
5372
5372
|
knowledgePiecesSorted,
|
|
5373
5373
|
knowledgePiecesLimited,
|
|
@@ -5436,7 +5436,7 @@ async function getReservedParametersForTask(options) {
|
|
|
5436
5436
|
* @private internal utility of `createPipelineExecutor`
|
|
5437
5437
|
*/
|
|
5438
5438
|
async function executeTask(options) {
|
|
5439
|
-
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled,
|
|
5439
|
+
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
|
|
5440
5440
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
5441
5441
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
|
|
5442
5442
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
@@ -5524,7 +5524,7 @@ async function executeTask(options) {
|
|
|
5524
5524
|
cacheDirname,
|
|
5525
5525
|
intermediateFilesStrategy,
|
|
5526
5526
|
isAutoInstalled,
|
|
5527
|
-
|
|
5527
|
+
isNotPreparedWarningSuppressed,
|
|
5528
5528
|
});
|
|
5529
5529
|
await onProgress({
|
|
5530
5530
|
outputParameters: {
|
|
@@ -5619,7 +5619,7 @@ async function executePipeline(options) {
|
|
|
5619
5619
|
}
|
|
5620
5620
|
return exportJson({
|
|
5621
5621
|
name: `executionReport`,
|
|
5622
|
-
message: `
|
|
5622
|
+
message: `Unsuccessful PipelineExecutorResult (with missing parameter {${parameter.name}}) PipelineExecutorResult`,
|
|
5623
5623
|
order: [],
|
|
5624
5624
|
value: {
|
|
5625
5625
|
isSuccessful: false,
|
|
@@ -5656,7 +5656,7 @@ async function executePipeline(options) {
|
|
|
5656
5656
|
return exportJson({
|
|
5657
5657
|
name: 'pipelineExecutorResult',
|
|
5658
5658
|
message: spaceTrim$1((block) => `
|
|
5659
|
-
|
|
5659
|
+
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
5660
5660
|
|
|
5661
5661
|
${block(pipelineIdentification)}
|
|
5662
5662
|
`),
|
|
@@ -5797,7 +5797,7 @@ async function executePipeline(options) {
|
|
|
5797
5797
|
}
|
|
5798
5798
|
return exportJson({
|
|
5799
5799
|
name: 'pipelineExecutorResult',
|
|
5800
|
-
message: `
|
|
5800
|
+
message: `Unsuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult`,
|
|
5801
5801
|
order: [],
|
|
5802
5802
|
value: {
|
|
5803
5803
|
isSuccessful: false,
|
|
@@ -5848,7 +5848,7 @@ async function executePipeline(options) {
|
|
|
5848
5848
|
* @public exported from `@promptbook/core`
|
|
5849
5849
|
*/
|
|
5850
5850
|
function createPipelineExecutor(options) {
|
|
5851
|
-
const { pipeline, tools, maxExecutionAttempts = DEFAULT_MAX_EXECUTION_ATTEMPTS, maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT, csvSettings = DEFAULT_CSV_SETTINGS, isVerbose = DEFAULT_IS_VERBOSE,
|
|
5851
|
+
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;
|
|
5852
5852
|
validatePipeline(pipeline);
|
|
5853
5853
|
const pipelineIdentification = (() => {
|
|
5854
5854
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -5865,7 +5865,7 @@ function createPipelineExecutor(options) {
|
|
|
5865
5865
|
if (isPipelinePrepared(pipeline)) {
|
|
5866
5866
|
preparedPipeline = pipeline;
|
|
5867
5867
|
}
|
|
5868
|
-
else if (
|
|
5868
|
+
else if (isNotPreparedWarningSuppressed !== true) {
|
|
5869
5869
|
console.warn(spaceTrim$1((block) => `
|
|
5870
5870
|
Pipeline is not prepared
|
|
5871
5871
|
|
|
@@ -5898,7 +5898,7 @@ function createPipelineExecutor(options) {
|
|
|
5898
5898
|
maxParallelCount,
|
|
5899
5899
|
csvSettings,
|
|
5900
5900
|
isVerbose,
|
|
5901
|
-
|
|
5901
|
+
isNotPreparedWarningSuppressed,
|
|
5902
5902
|
rootDirname,
|
|
5903
5903
|
cacheDirname,
|
|
5904
5904
|
intermediateFilesStrategy,
|
|
@@ -5907,7 +5907,7 @@ function createPipelineExecutor(options) {
|
|
|
5907
5907
|
assertsError(error);
|
|
5908
5908
|
return exportJson({
|
|
5909
5909
|
name: 'pipelineExecutorResult',
|
|
5910
|
-
message: `
|
|
5910
|
+
message: `Unsuccessful PipelineExecutorResult, last catch`,
|
|
5911
5911
|
order: [],
|
|
5912
5912
|
value: {
|
|
5913
5913
|
isSuccessful: false,
|
|
@@ -5945,7 +5945,7 @@ const markdownScraperMetadata = $deepFreeze({
|
|
|
5945
5945
|
className: 'MarkdownScraper',
|
|
5946
5946
|
mimeTypes: ['text/markdown', 'text/plain'],
|
|
5947
5947
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
5948
|
-
|
|
5948
|
+
isAvailableInBrowser: true,
|
|
5949
5949
|
// <- 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
|
|
5950
5950
|
requiredExecutables: [],
|
|
5951
5951
|
}); /* <- Note: [🤛] */
|
|
@@ -5955,7 +5955,7 @@ const markdownScraperMetadata = $deepFreeze({
|
|
|
5955
5955
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
5956
5956
|
*
|
|
5957
5957
|
* @public exported from `@promptbook/core`
|
|
5958
|
-
* @public exported from `@promptbook/
|
|
5958
|
+
* @public exported from `@promptbook/wizard`
|
|
5959
5959
|
* @public exported from `@promptbook/cli`
|
|
5960
5960
|
*/
|
|
5961
5961
|
$scrapersMetadataRegister.register(markdownScraperMetadata);
|
|
@@ -6054,7 +6054,7 @@ class MarkdownScraper {
|
|
|
6054
6054
|
}
|
|
6055
6055
|
// ---
|
|
6056
6056
|
if (!llmTools.callEmbeddingModel) {
|
|
6057
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
6057
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
6058
6058
|
console.error('No callEmbeddingModel function provided');
|
|
6059
6059
|
}
|
|
6060
6060
|
else {
|
|
@@ -6080,7 +6080,7 @@ class MarkdownScraper {
|
|
|
6080
6080
|
if (!(error instanceof PipelineExecutionError)) {
|
|
6081
6081
|
throw error;
|
|
6082
6082
|
}
|
|
6083
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
6083
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
6084
6084
|
console.error(error, "<- Note: This error is not critical to prepare the pipeline, just knowledge pieces won't have embeddings");
|
|
6085
6085
|
}
|
|
6086
6086
|
return {
|
|
@@ -6118,7 +6118,7 @@ const createMarkdownScraper = Object.assign((tools, options) => {
|
|
|
6118
6118
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6119
6119
|
*
|
|
6120
6120
|
* @public exported from `@promptbook/markdown-utils`
|
|
6121
|
-
* @public exported from `@promptbook/
|
|
6121
|
+
* @public exported from `@promptbook/wizard`
|
|
6122
6122
|
* @public exported from `@promptbook/cli`
|
|
6123
6123
|
*/
|
|
6124
6124
|
const _MarkdownScraperRegistration = $scrapersRegister.register(createMarkdownScraper);
|