@promptbook/website-crawler 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
|
@@ -29,7 +29,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
29
29
|
* @generated
|
|
30
30
|
* @see https://github.com/webgptorg/promptbook
|
|
31
31
|
*/
|
|
32
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
32
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.95.0';
|
|
33
33
|
/**
|
|
34
34
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
35
35
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -504,7 +504,7 @@ const websiteScraperMetadata = $deepFreeze({
|
|
|
504
504
|
className: 'WebsiteScraper',
|
|
505
505
|
mimeTypes: ['text/html'],
|
|
506
506
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
507
|
-
|
|
507
|
+
isAvailableInBrowser: false,
|
|
508
508
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
509
509
|
requiredExecutables: [],
|
|
510
510
|
}); /* <- Note: [🤛] */
|
|
@@ -514,7 +514,7 @@ const websiteScraperMetadata = $deepFreeze({
|
|
|
514
514
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
515
515
|
*
|
|
516
516
|
* @public exported from `@promptbook/core`
|
|
517
|
-
* @public exported from `@promptbook/
|
|
517
|
+
* @public exported from `@promptbook/wizard`
|
|
518
518
|
* @public exported from `@promptbook/cli`
|
|
519
519
|
*/
|
|
520
520
|
$scrapersMetadataRegister.register(websiteScraperMetadata);
|
|
@@ -1041,7 +1041,7 @@ async function getScraperIntermediateSource(source, options) {
|
|
|
1041
1041
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
1042
1042
|
*/
|
|
1043
1043
|
|
|
1044
|
-
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"}];
|
|
1044
|
+
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"}];
|
|
1045
1045
|
|
|
1046
1046
|
/**
|
|
1047
1047
|
* Checks if value is valid email
|
|
@@ -1198,7 +1198,7 @@ function prettifyMarkdown(content) {
|
|
|
1198
1198
|
});
|
|
1199
1199
|
}
|
|
1200
1200
|
catch (error) {
|
|
1201
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
1201
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
1202
1202
|
console.error('There was an error with prettifying the markdown, using the original as the fallback', {
|
|
1203
1203
|
error,
|
|
1204
1204
|
html: content,
|
|
@@ -1453,7 +1453,7 @@ function checkSerializableAsJson(options) {
|
|
|
1453
1453
|
else {
|
|
1454
1454
|
for (const [subName, subValue] of Object.entries(value)) {
|
|
1455
1455
|
if (subValue === undefined) {
|
|
1456
|
-
// Note: undefined in object is serializable - it is just
|
|
1456
|
+
// Note: undefined in object is serializable - it is just omitted
|
|
1457
1457
|
continue;
|
|
1458
1458
|
}
|
|
1459
1459
|
checkSerializableAsJson({ name: `${name}.${subName}`, value: subValue, message });
|
|
@@ -2143,7 +2143,7 @@ class SimplePipelineCollection {
|
|
|
2143
2143
|
|
|
2144
2144
|
Note: You have probably forgotten to run "ptbk make" to update the collection
|
|
2145
2145
|
Note: Pipelines with the same URL are not allowed
|
|
2146
|
-
Only
|
|
2146
|
+
Only exception is when the pipelines are identical
|
|
2147
2147
|
|
|
2148
2148
|
`));
|
|
2149
2149
|
}
|
|
@@ -2888,12 +2888,12 @@ function countUsage(llmTools) {
|
|
|
2888
2888
|
get title() {
|
|
2889
2889
|
return `${llmTools.title} (+usage)`;
|
|
2890
2890
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2891
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2891
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
2892
2892
|
},
|
|
2893
2893
|
get description() {
|
|
2894
2894
|
return `${llmTools.description} (+usage)`;
|
|
2895
2895
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2896
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2896
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
2897
2897
|
},
|
|
2898
2898
|
checkConfiguration() {
|
|
2899
2899
|
return /* not await */ llmTools.checkConfiguration();
|
|
@@ -3120,13 +3120,13 @@ function joinLlmExecutionTools(...llmExecutionTools) {
|
|
|
3120
3120
|
|
|
3121
3121
|
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.
|
|
3122
3122
|
`);
|
|
3123
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
3123
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
3124
3124
|
console.warn(warningMessage);
|
|
3125
3125
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
3126
3126
|
/*
|
|
3127
3127
|
return {
|
|
3128
3128
|
async listModels() {
|
|
3129
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
3129
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
3130
3130
|
console.warn(
|
|
3131
3131
|
spaceTrim(
|
|
3132
3132
|
(block) => `
|
|
@@ -3262,17 +3262,17 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
3262
3262
|
* Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
|
|
3263
3263
|
*/
|
|
3264
3264
|
const all = [];
|
|
3265
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
3265
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersMetadataRegister.list()) {
|
|
3266
3266
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
3267
3267
|
continue;
|
|
3268
3268
|
}
|
|
3269
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
3269
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
3270
3270
|
}
|
|
3271
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
3271
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersRegister.list()) {
|
|
3272
3272
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
3273
3273
|
continue;
|
|
3274
3274
|
}
|
|
3275
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
3275
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
3276
3276
|
}
|
|
3277
3277
|
for (const { metadata } of availableScrapers) {
|
|
3278
3278
|
all.push(metadata);
|
|
@@ -3284,8 +3284,8 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
3284
3284
|
const isInstalled = $scrapersRegister
|
|
3285
3285
|
.list()
|
|
3286
3286
|
.find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
3287
|
-
const
|
|
3288
|
-
return { ...metadata, isMetadataAviailable, isInstalled,
|
|
3287
|
+
const isAvailableInTools = availableScrapers.some(({ metadata: { packageName, className } }) => metadata.packageName === packageName && metadata.className === className);
|
|
3288
|
+
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
3289
3289
|
});
|
|
3290
3290
|
if (metadata.length === 0) {
|
|
3291
3291
|
return spaceTrim$1(`
|
|
@@ -3298,7 +3298,7 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
3298
3298
|
return spaceTrim$1((block) => `
|
|
3299
3299
|
Available scrapers are:
|
|
3300
3300
|
${block(metadata
|
|
3301
|
-
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes,
|
|
3301
|
+
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
3302
3302
|
const more = [];
|
|
3303
3303
|
// TODO: [🧠] Maybe use `documentationUrl`
|
|
3304
3304
|
if (isMetadataAviailable) {
|
|
@@ -3307,16 +3307,16 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
3307
3307
|
if (isInstalled) {
|
|
3308
3308
|
more.push(`🟩 Installed`);
|
|
3309
3309
|
} // not else
|
|
3310
|
-
if (
|
|
3310
|
+
if (isAvailableInTools) {
|
|
3311
3311
|
more.push(`🟦 Available in tools`);
|
|
3312
3312
|
} // not else
|
|
3313
3313
|
if (!isMetadataAviailable && isInstalled) {
|
|
3314
3314
|
more.push(`When no metadata registered but scraper is installed, it is an unexpected behavior`);
|
|
3315
3315
|
} // not else
|
|
3316
|
-
if (!isInstalled &&
|
|
3316
|
+
if (!isInstalled && isAvailableInTools) {
|
|
3317
3317
|
more.push(`When the scraper is not installed but available in tools, it is an unexpected compatibility behavior`);
|
|
3318
3318
|
} // not else
|
|
3319
|
-
if (!
|
|
3319
|
+
if (!isAvailableInBrowser) {
|
|
3320
3320
|
more.push(`Not usable in browser`);
|
|
3321
3321
|
}
|
|
3322
3322
|
const moreText = more.length === 0 ? '' : ` *(${more.join('; ')})*`;
|
|
@@ -3681,7 +3681,7 @@ TODO: [🧊] This is how it can look in future
|
|
|
3681
3681
|
/**
|
|
3682
3682
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
3683
3683
|
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
3684
|
-
* TODO: [🪂] More than max things can run in parallel by
|
|
3684
|
+
* TODO: [🪂] More than max things can run in parallel by accident [1,[2a,2b,_],[3a,3b,_]]
|
|
3685
3685
|
* TODO: [🧠][❎] Do here proper M:N mapping
|
|
3686
3686
|
* [x] One source can make multiple pieces
|
|
3687
3687
|
* [ ] One piece can have multiple sources
|
|
@@ -5353,10 +5353,10 @@ function knowledgePiecesToString(knowledgePieces) {
|
|
|
5353
5353
|
*/
|
|
5354
5354
|
async function getKnowledgeForTask(options) {
|
|
5355
5355
|
const { tools, preparedPipeline, task, parameters } = options;
|
|
5356
|
-
const
|
|
5357
|
-
const
|
|
5356
|
+
const firstKnowledgePiece = preparedPipeline.knowledgePieces[0];
|
|
5357
|
+
const firstKnowledgeIndex = firstKnowledgePiece === null || firstKnowledgePiece === void 0 ? void 0 : firstKnowledgePiece.index[0];
|
|
5358
5358
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
5359
|
-
if (
|
|
5359
|
+
if (firstKnowledgePiece === undefined || firstKnowledgeIndex === undefined) {
|
|
5360
5360
|
return ''; // <- Note: Np knowledge present, return empty string
|
|
5361
5361
|
}
|
|
5362
5362
|
try {
|
|
@@ -5367,7 +5367,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5367
5367
|
title: 'Knowledge Search',
|
|
5368
5368
|
modelRequirements: {
|
|
5369
5369
|
modelVariant: 'EMBEDDING',
|
|
5370
|
-
modelName:
|
|
5370
|
+
modelName: firstKnowledgeIndex.modelName,
|
|
5371
5371
|
},
|
|
5372
5372
|
content: task.content,
|
|
5373
5373
|
parameters,
|
|
@@ -5375,7 +5375,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5375
5375
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
5376
5376
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
5377
5377
|
const { index } = knowledgePiece;
|
|
5378
|
-
const knowledgePieceIndex = index.find((i) => i.modelName ===
|
|
5378
|
+
const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowledgeIndex.modelName);
|
|
5379
5379
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model
|
|
5380
5380
|
if (knowledgePieceIndex === undefined) {
|
|
5381
5381
|
return {
|
|
@@ -5396,8 +5396,8 @@ async function getKnowledgeForTask(options) {
|
|
|
5396
5396
|
task,
|
|
5397
5397
|
taskEmbeddingPrompt,
|
|
5398
5398
|
taskEmbeddingResult,
|
|
5399
|
-
|
|
5400
|
-
|
|
5399
|
+
firstKnowledgePiece,
|
|
5400
|
+
firstKnowledgeIndex,
|
|
5401
5401
|
knowledgePiecesWithRelevance,
|
|
5402
5402
|
knowledgePiecesSorted,
|
|
5403
5403
|
knowledgePiecesLimited,
|
|
@@ -5466,7 +5466,7 @@ async function getReservedParametersForTask(options) {
|
|
|
5466
5466
|
* @private internal utility of `createPipelineExecutor`
|
|
5467
5467
|
*/
|
|
5468
5468
|
async function executeTask(options) {
|
|
5469
|
-
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled,
|
|
5469
|
+
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
|
|
5470
5470
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
5471
5471
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
|
|
5472
5472
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
@@ -5554,7 +5554,7 @@ async function executeTask(options) {
|
|
|
5554
5554
|
cacheDirname,
|
|
5555
5555
|
intermediateFilesStrategy,
|
|
5556
5556
|
isAutoInstalled,
|
|
5557
|
-
|
|
5557
|
+
isNotPreparedWarningSuppressed,
|
|
5558
5558
|
});
|
|
5559
5559
|
await onProgress({
|
|
5560
5560
|
outputParameters: {
|
|
@@ -5649,7 +5649,7 @@ async function executePipeline(options) {
|
|
|
5649
5649
|
}
|
|
5650
5650
|
return exportJson({
|
|
5651
5651
|
name: `executionReport`,
|
|
5652
|
-
message: `
|
|
5652
|
+
message: `Unsuccessful PipelineExecutorResult (with missing parameter {${parameter.name}}) PipelineExecutorResult`,
|
|
5653
5653
|
order: [],
|
|
5654
5654
|
value: {
|
|
5655
5655
|
isSuccessful: false,
|
|
@@ -5686,7 +5686,7 @@ async function executePipeline(options) {
|
|
|
5686
5686
|
return exportJson({
|
|
5687
5687
|
name: 'pipelineExecutorResult',
|
|
5688
5688
|
message: spaceTrim((block) => `
|
|
5689
|
-
|
|
5689
|
+
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
5690
5690
|
|
|
5691
5691
|
${block(pipelineIdentification)}
|
|
5692
5692
|
`),
|
|
@@ -5827,7 +5827,7 @@ async function executePipeline(options) {
|
|
|
5827
5827
|
}
|
|
5828
5828
|
return exportJson({
|
|
5829
5829
|
name: 'pipelineExecutorResult',
|
|
5830
|
-
message: `
|
|
5830
|
+
message: `Unsuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult`,
|
|
5831
5831
|
order: [],
|
|
5832
5832
|
value: {
|
|
5833
5833
|
isSuccessful: false,
|
|
@@ -5878,7 +5878,7 @@ async function executePipeline(options) {
|
|
|
5878
5878
|
* @public exported from `@promptbook/core`
|
|
5879
5879
|
*/
|
|
5880
5880
|
function createPipelineExecutor(options) {
|
|
5881
|
-
const { pipeline, tools, maxExecutionAttempts = DEFAULT_MAX_EXECUTION_ATTEMPTS, maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT, csvSettings = DEFAULT_CSV_SETTINGS, isVerbose = DEFAULT_IS_VERBOSE,
|
|
5881
|
+
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;
|
|
5882
5882
|
validatePipeline(pipeline);
|
|
5883
5883
|
const pipelineIdentification = (() => {
|
|
5884
5884
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -5895,7 +5895,7 @@ function createPipelineExecutor(options) {
|
|
|
5895
5895
|
if (isPipelinePrepared(pipeline)) {
|
|
5896
5896
|
preparedPipeline = pipeline;
|
|
5897
5897
|
}
|
|
5898
|
-
else if (
|
|
5898
|
+
else if (isNotPreparedWarningSuppressed !== true) {
|
|
5899
5899
|
console.warn(spaceTrim((block) => `
|
|
5900
5900
|
Pipeline is not prepared
|
|
5901
5901
|
|
|
@@ -5928,7 +5928,7 @@ function createPipelineExecutor(options) {
|
|
|
5928
5928
|
maxParallelCount,
|
|
5929
5929
|
csvSettings,
|
|
5930
5930
|
isVerbose,
|
|
5931
|
-
|
|
5931
|
+
isNotPreparedWarningSuppressed,
|
|
5932
5932
|
rootDirname,
|
|
5933
5933
|
cacheDirname,
|
|
5934
5934
|
intermediateFilesStrategy,
|
|
@@ -5937,7 +5937,7 @@ function createPipelineExecutor(options) {
|
|
|
5937
5937
|
assertsError(error);
|
|
5938
5938
|
return exportJson({
|
|
5939
5939
|
name: 'pipelineExecutorResult',
|
|
5940
|
-
message: `
|
|
5940
|
+
message: `Unsuccessful PipelineExecutorResult, last catch`,
|
|
5941
5941
|
order: [],
|
|
5942
5942
|
value: {
|
|
5943
5943
|
isSuccessful: false,
|
|
@@ -5975,7 +5975,7 @@ const markdownScraperMetadata = $deepFreeze({
|
|
|
5975
5975
|
className: 'MarkdownScraper',
|
|
5976
5976
|
mimeTypes: ['text/markdown', 'text/plain'],
|
|
5977
5977
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
5978
|
-
|
|
5978
|
+
isAvailableInBrowser: true,
|
|
5979
5979
|
// <- 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
|
|
5980
5980
|
requiredExecutables: [],
|
|
5981
5981
|
}); /* <- Note: [🤛] */
|
|
@@ -5985,7 +5985,7 @@ const markdownScraperMetadata = $deepFreeze({
|
|
|
5985
5985
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
5986
5986
|
*
|
|
5987
5987
|
* @public exported from `@promptbook/core`
|
|
5988
|
-
* @public exported from `@promptbook/
|
|
5988
|
+
* @public exported from `@promptbook/wizard`
|
|
5989
5989
|
* @public exported from `@promptbook/cli`
|
|
5990
5990
|
*/
|
|
5991
5991
|
$scrapersMetadataRegister.register(markdownScraperMetadata);
|
|
@@ -6084,7 +6084,7 @@ class MarkdownScraper {
|
|
|
6084
6084
|
}
|
|
6085
6085
|
// ---
|
|
6086
6086
|
if (!llmTools.callEmbeddingModel) {
|
|
6087
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
6087
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
6088
6088
|
console.error('No callEmbeddingModel function provided');
|
|
6089
6089
|
}
|
|
6090
6090
|
else {
|
|
@@ -6110,7 +6110,7 @@ class MarkdownScraper {
|
|
|
6110
6110
|
if (!(error instanceof PipelineExecutionError)) {
|
|
6111
6111
|
throw error;
|
|
6112
6112
|
}
|
|
6113
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
6113
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
6114
6114
|
console.error(error, "<- Note: This error is not critical to prepare the pipeline, just knowledge pieces won't have embeddings");
|
|
6115
6115
|
}
|
|
6116
6116
|
return {
|
|
@@ -6269,7 +6269,7 @@ const createWebsiteScraper = Object.assign((tools, options) => {
|
|
|
6269
6269
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6270
6270
|
*
|
|
6271
6271
|
* @public exported from `@promptbook/website-crawler`
|
|
6272
|
-
* @public exported from `@promptbook/
|
|
6272
|
+
* @public exported from `@promptbook/wizard`
|
|
6273
6273
|
* @public exported from `@promptbook/cli`
|
|
6274
6274
|
*/
|
|
6275
6275
|
const _WebsiteScraperRegistration = $scrapersRegister.register(createWebsiteScraper);
|