@promptbook/markitdown 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 +43 -43
- 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 +2 -14
- package/umd/index.umd.js +43 -43
- 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
|
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
26
26
|
* @generated
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
29
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.95.0';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -862,7 +862,7 @@ async function getScraperIntermediateSource(source, options) {
|
|
|
862
862
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
863
863
|
*/
|
|
864
864
|
|
|
865
|
-
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"}];
|
|
865
|
+
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"}];
|
|
866
866
|
|
|
867
867
|
/**
|
|
868
868
|
* Checks if value is valid email
|
|
@@ -1019,7 +1019,7 @@ function prettifyMarkdown(content) {
|
|
|
1019
1019
|
});
|
|
1020
1020
|
}
|
|
1021
1021
|
catch (error) {
|
|
1022
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
1022
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
1023
1023
|
console.error('There was an error with prettifying the markdown, using the original as the fallback', {
|
|
1024
1024
|
error,
|
|
1025
1025
|
html: content,
|
|
@@ -1301,7 +1301,7 @@ function checkSerializableAsJson(options) {
|
|
|
1301
1301
|
else {
|
|
1302
1302
|
for (const [subName, subValue] of Object.entries(value)) {
|
|
1303
1303
|
if (subValue === undefined) {
|
|
1304
|
-
// Note: undefined in object is serializable - it is just
|
|
1304
|
+
// Note: undefined in object is serializable - it is just omitted
|
|
1305
1305
|
continue;
|
|
1306
1306
|
}
|
|
1307
1307
|
checkSerializableAsJson({ name: `${name}.${subName}`, value: subValue, message });
|
|
@@ -1991,7 +1991,7 @@ class SimplePipelineCollection {
|
|
|
1991
1991
|
|
|
1992
1992
|
Note: You have probably forgotten to run "ptbk make" to update the collection
|
|
1993
1993
|
Note: Pipelines with the same URL are not allowed
|
|
1994
|
-
Only
|
|
1994
|
+
Only exception is when the pipelines are identical
|
|
1995
1995
|
|
|
1996
1996
|
`));
|
|
1997
1997
|
}
|
|
@@ -2759,12 +2759,12 @@ function countUsage(llmTools) {
|
|
|
2759
2759
|
get title() {
|
|
2760
2760
|
return `${llmTools.title} (+usage)`;
|
|
2761
2761
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2762
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2762
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
2763
2763
|
},
|
|
2764
2764
|
get description() {
|
|
2765
2765
|
return `${llmTools.description} (+usage)`;
|
|
2766
2766
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2767
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2767
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
2768
2768
|
},
|
|
2769
2769
|
checkConfiguration() {
|
|
2770
2770
|
return /* not await */ llmTools.checkConfiguration();
|
|
@@ -2991,13 +2991,13 @@ function joinLlmExecutionTools(...llmExecutionTools) {
|
|
|
2991
2991
|
|
|
2992
2992
|
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.
|
|
2993
2993
|
`);
|
|
2994
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
2994
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
2995
2995
|
console.warn(warningMessage);
|
|
2996
2996
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
2997
2997
|
/*
|
|
2998
2998
|
return {
|
|
2999
2999
|
async listModels() {
|
|
3000
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
3000
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
3001
3001
|
console.warn(
|
|
3002
3002
|
spaceTrim(
|
|
3003
3003
|
(block) => `
|
|
@@ -3273,17 +3273,17 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
3273
3273
|
* Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
|
|
3274
3274
|
*/
|
|
3275
3275
|
const all = [];
|
|
3276
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
3276
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersMetadataRegister.list()) {
|
|
3277
3277
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
3278
3278
|
continue;
|
|
3279
3279
|
}
|
|
3280
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
3280
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
3281
3281
|
}
|
|
3282
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
3282
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersRegister.list()) {
|
|
3283
3283
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
3284
3284
|
continue;
|
|
3285
3285
|
}
|
|
3286
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
3286
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
3287
3287
|
}
|
|
3288
3288
|
for (const { metadata } of availableScrapers) {
|
|
3289
3289
|
all.push(metadata);
|
|
@@ -3295,8 +3295,8 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
3295
3295
|
const isInstalled = $scrapersRegister
|
|
3296
3296
|
.list()
|
|
3297
3297
|
.find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
3298
|
-
const
|
|
3299
|
-
return { ...metadata, isMetadataAviailable, isInstalled,
|
|
3298
|
+
const isAvailableInTools = availableScrapers.some(({ metadata: { packageName, className } }) => metadata.packageName === packageName && metadata.className === className);
|
|
3299
|
+
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
3300
3300
|
});
|
|
3301
3301
|
if (metadata.length === 0) {
|
|
3302
3302
|
return spaceTrim(`
|
|
@@ -3309,7 +3309,7 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
3309
3309
|
return spaceTrim((block) => `
|
|
3310
3310
|
Available scrapers are:
|
|
3311
3311
|
${block(metadata
|
|
3312
|
-
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes,
|
|
3312
|
+
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
3313
3313
|
const more = [];
|
|
3314
3314
|
// TODO: [🧠] Maybe use `documentationUrl`
|
|
3315
3315
|
if (isMetadataAviailable) {
|
|
@@ -3318,16 +3318,16 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
3318
3318
|
if (isInstalled) {
|
|
3319
3319
|
more.push(`🟩 Installed`);
|
|
3320
3320
|
} // not else
|
|
3321
|
-
if (
|
|
3321
|
+
if (isAvailableInTools) {
|
|
3322
3322
|
more.push(`🟦 Available in tools`);
|
|
3323
3323
|
} // not else
|
|
3324
3324
|
if (!isMetadataAviailable && isInstalled) {
|
|
3325
3325
|
more.push(`When no metadata registered but scraper is installed, it is an unexpected behavior`);
|
|
3326
3326
|
} // not else
|
|
3327
|
-
if (!isInstalled &&
|
|
3327
|
+
if (!isInstalled && isAvailableInTools) {
|
|
3328
3328
|
more.push(`When the scraper is not installed but available in tools, it is an unexpected compatibility behavior`);
|
|
3329
3329
|
} // not else
|
|
3330
|
-
if (!
|
|
3330
|
+
if (!isAvailableInBrowser) {
|
|
3331
3331
|
more.push(`Not usable in browser`);
|
|
3332
3332
|
}
|
|
3333
3333
|
const moreText = more.length === 0 ? '' : ` *(${more.join('; ')})*`;
|
|
@@ -3667,7 +3667,7 @@ TODO: [🧊] This is how it can look in future
|
|
|
3667
3667
|
/**
|
|
3668
3668
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
3669
3669
|
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
3670
|
-
* TODO: [🪂] More than max things can run in parallel by
|
|
3670
|
+
* TODO: [🪂] More than max things can run in parallel by accident [1,[2a,2b,_],[3a,3b,_]]
|
|
3671
3671
|
* TODO: [🧠][❎] Do here proper M:N mapping
|
|
3672
3672
|
* [x] One source can make multiple pieces
|
|
3673
3673
|
* [ ] One piece can have multiple sources
|
|
@@ -5339,10 +5339,10 @@ function knowledgePiecesToString(knowledgePieces) {
|
|
|
5339
5339
|
*/
|
|
5340
5340
|
async function getKnowledgeForTask(options) {
|
|
5341
5341
|
const { tools, preparedPipeline, task, parameters } = options;
|
|
5342
|
-
const
|
|
5343
|
-
const
|
|
5342
|
+
const firstKnowledgePiece = preparedPipeline.knowledgePieces[0];
|
|
5343
|
+
const firstKnowledgeIndex = firstKnowledgePiece === null || firstKnowledgePiece === void 0 ? void 0 : firstKnowledgePiece.index[0];
|
|
5344
5344
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
5345
|
-
if (
|
|
5345
|
+
if (firstKnowledgePiece === undefined || firstKnowledgeIndex === undefined) {
|
|
5346
5346
|
return ''; // <- Note: Np knowledge present, return empty string
|
|
5347
5347
|
}
|
|
5348
5348
|
try {
|
|
@@ -5353,7 +5353,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5353
5353
|
title: 'Knowledge Search',
|
|
5354
5354
|
modelRequirements: {
|
|
5355
5355
|
modelVariant: 'EMBEDDING',
|
|
5356
|
-
modelName:
|
|
5356
|
+
modelName: firstKnowledgeIndex.modelName,
|
|
5357
5357
|
},
|
|
5358
5358
|
content: task.content,
|
|
5359
5359
|
parameters,
|
|
@@ -5361,7 +5361,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5361
5361
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
5362
5362
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
5363
5363
|
const { index } = knowledgePiece;
|
|
5364
|
-
const knowledgePieceIndex = index.find((i) => i.modelName ===
|
|
5364
|
+
const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowledgeIndex.modelName);
|
|
5365
5365
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model
|
|
5366
5366
|
if (knowledgePieceIndex === undefined) {
|
|
5367
5367
|
return {
|
|
@@ -5382,8 +5382,8 @@ async function getKnowledgeForTask(options) {
|
|
|
5382
5382
|
task,
|
|
5383
5383
|
taskEmbeddingPrompt,
|
|
5384
5384
|
taskEmbeddingResult,
|
|
5385
|
-
|
|
5386
|
-
|
|
5385
|
+
firstKnowledgePiece,
|
|
5386
|
+
firstKnowledgeIndex,
|
|
5387
5387
|
knowledgePiecesWithRelevance,
|
|
5388
5388
|
knowledgePiecesSorted,
|
|
5389
5389
|
knowledgePiecesLimited,
|
|
@@ -5452,7 +5452,7 @@ async function getReservedParametersForTask(options) {
|
|
|
5452
5452
|
* @private internal utility of `createPipelineExecutor`
|
|
5453
5453
|
*/
|
|
5454
5454
|
async function executeTask(options) {
|
|
5455
|
-
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled,
|
|
5455
|
+
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
|
|
5456
5456
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
5457
5457
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
|
|
5458
5458
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
@@ -5540,7 +5540,7 @@ async function executeTask(options) {
|
|
|
5540
5540
|
cacheDirname,
|
|
5541
5541
|
intermediateFilesStrategy,
|
|
5542
5542
|
isAutoInstalled,
|
|
5543
|
-
|
|
5543
|
+
isNotPreparedWarningSuppressed,
|
|
5544
5544
|
});
|
|
5545
5545
|
await onProgress({
|
|
5546
5546
|
outputParameters: {
|
|
@@ -5635,7 +5635,7 @@ async function executePipeline(options) {
|
|
|
5635
5635
|
}
|
|
5636
5636
|
return exportJson({
|
|
5637
5637
|
name: `executionReport`,
|
|
5638
|
-
message: `
|
|
5638
|
+
message: `Unsuccessful PipelineExecutorResult (with missing parameter {${parameter.name}}) PipelineExecutorResult`,
|
|
5639
5639
|
order: [],
|
|
5640
5640
|
value: {
|
|
5641
5641
|
isSuccessful: false,
|
|
@@ -5672,7 +5672,7 @@ async function executePipeline(options) {
|
|
|
5672
5672
|
return exportJson({
|
|
5673
5673
|
name: 'pipelineExecutorResult',
|
|
5674
5674
|
message: spaceTrim$1((block) => `
|
|
5675
|
-
|
|
5675
|
+
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
5676
5676
|
|
|
5677
5677
|
${block(pipelineIdentification)}
|
|
5678
5678
|
`),
|
|
@@ -5813,7 +5813,7 @@ async function executePipeline(options) {
|
|
|
5813
5813
|
}
|
|
5814
5814
|
return exportJson({
|
|
5815
5815
|
name: 'pipelineExecutorResult',
|
|
5816
|
-
message: `
|
|
5816
|
+
message: `Unsuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult`,
|
|
5817
5817
|
order: [],
|
|
5818
5818
|
value: {
|
|
5819
5819
|
isSuccessful: false,
|
|
@@ -5864,7 +5864,7 @@ async function executePipeline(options) {
|
|
|
5864
5864
|
* @public exported from `@promptbook/core`
|
|
5865
5865
|
*/
|
|
5866
5866
|
function createPipelineExecutor(options) {
|
|
5867
|
-
const { pipeline, tools, maxExecutionAttempts = DEFAULT_MAX_EXECUTION_ATTEMPTS, maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT, csvSettings = DEFAULT_CSV_SETTINGS, isVerbose = DEFAULT_IS_VERBOSE,
|
|
5867
|
+
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;
|
|
5868
5868
|
validatePipeline(pipeline);
|
|
5869
5869
|
const pipelineIdentification = (() => {
|
|
5870
5870
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -5881,7 +5881,7 @@ function createPipelineExecutor(options) {
|
|
|
5881
5881
|
if (isPipelinePrepared(pipeline)) {
|
|
5882
5882
|
preparedPipeline = pipeline;
|
|
5883
5883
|
}
|
|
5884
|
-
else if (
|
|
5884
|
+
else if (isNotPreparedWarningSuppressed !== true) {
|
|
5885
5885
|
console.warn(spaceTrim$1((block) => `
|
|
5886
5886
|
Pipeline is not prepared
|
|
5887
5887
|
|
|
@@ -5914,7 +5914,7 @@ function createPipelineExecutor(options) {
|
|
|
5914
5914
|
maxParallelCount,
|
|
5915
5915
|
csvSettings,
|
|
5916
5916
|
isVerbose,
|
|
5917
|
-
|
|
5917
|
+
isNotPreparedWarningSuppressed,
|
|
5918
5918
|
rootDirname,
|
|
5919
5919
|
cacheDirname,
|
|
5920
5920
|
intermediateFilesStrategy,
|
|
@@ -5923,7 +5923,7 @@ function createPipelineExecutor(options) {
|
|
|
5923
5923
|
assertsError(error);
|
|
5924
5924
|
return exportJson({
|
|
5925
5925
|
name: 'pipelineExecutorResult',
|
|
5926
|
-
message: `
|
|
5926
|
+
message: `Unsuccessful PipelineExecutorResult, last catch`,
|
|
5927
5927
|
order: [],
|
|
5928
5928
|
value: {
|
|
5929
5929
|
isSuccessful: false,
|
|
@@ -5961,7 +5961,7 @@ const markdownScraperMetadata = $deepFreeze({
|
|
|
5961
5961
|
className: 'MarkdownScraper',
|
|
5962
5962
|
mimeTypes: ['text/markdown', 'text/plain'],
|
|
5963
5963
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
5964
|
-
|
|
5964
|
+
isAvailableInBrowser: true,
|
|
5965
5965
|
// <- 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
|
|
5966
5966
|
requiredExecutables: [],
|
|
5967
5967
|
}); /* <- Note: [🤛] */
|
|
@@ -5971,7 +5971,7 @@ const markdownScraperMetadata = $deepFreeze({
|
|
|
5971
5971
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
5972
5972
|
*
|
|
5973
5973
|
* @public exported from `@promptbook/core`
|
|
5974
|
-
* @public exported from `@promptbook/
|
|
5974
|
+
* @public exported from `@promptbook/wizard`
|
|
5975
5975
|
* @public exported from `@promptbook/cli`
|
|
5976
5976
|
*/
|
|
5977
5977
|
$scrapersMetadataRegister.register(markdownScraperMetadata);
|
|
@@ -6070,7 +6070,7 @@ class MarkdownScraper {
|
|
|
6070
6070
|
}
|
|
6071
6071
|
// ---
|
|
6072
6072
|
if (!llmTools.callEmbeddingModel) {
|
|
6073
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
6073
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
6074
6074
|
console.error('No callEmbeddingModel function provided');
|
|
6075
6075
|
}
|
|
6076
6076
|
else {
|
|
@@ -6096,7 +6096,7 @@ class MarkdownScraper {
|
|
|
6096
6096
|
if (!(error instanceof PipelineExecutionError)) {
|
|
6097
6097
|
throw error;
|
|
6098
6098
|
}
|
|
6099
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
6099
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
6100
6100
|
console.error(error, "<- Note: This error is not critical to prepare the pipeline, just knowledge pieces won't have embeddings");
|
|
6101
6101
|
}
|
|
6102
6102
|
return {
|
|
@@ -6132,7 +6132,7 @@ const markitdownScraperMetadata = $deepFreeze({
|
|
|
6132
6132
|
// 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
6133
6133
|
],
|
|
6134
6134
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
6135
|
-
|
|
6135
|
+
isAvailableInBrowser: false,
|
|
6136
6136
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
6137
6137
|
requiredExecutables: [],
|
|
6138
6138
|
}); /* <- Note: [🤛] */
|
|
@@ -6142,7 +6142,7 @@ const markitdownScraperMetadata = $deepFreeze({
|
|
|
6142
6142
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6143
6143
|
*
|
|
6144
6144
|
* @public exported from `@promptbook/core`
|
|
6145
|
-
* @public exported from `@promptbook/
|
|
6145
|
+
* @public exported from `@promptbook/wizard`
|
|
6146
6146
|
* @public exported from `@promptbook/cli`
|
|
6147
6147
|
*/
|
|
6148
6148
|
$scrapersMetadataRegister.register(markitdownScraperMetadata);
|
|
@@ -6279,7 +6279,7 @@ const createMarkitdownScraper = Object.assign((tools, options) => {
|
|
|
6279
6279
|
*
|
|
6280
6280
|
* @public exported from `@promptbook/markitdown`
|
|
6281
6281
|
* @public exported from `@promptbook/pdf`
|
|
6282
|
-
* @public exported from `@promptbook/
|
|
6282
|
+
* @public exported from `@promptbook/wizard`
|
|
6283
6283
|
* @public exported from `@promptbook/cli`
|
|
6284
6284
|
*/
|
|
6285
6285
|
const _MarkitdownScraperRegistration = $scrapersRegister.register(createMarkitdownScraper);
|