@promptbook/pdf 0.94.0-7 → 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 +8 -21
- package/esm/index.es.js +46 -46
- 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 +25 -14
- package/umd/index.umd.js +46 -46
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -25,10 +25,6 @@ Write AI applications using plain human language across multiple models and plat
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
<blockquote style="color: #ff8811">
|
|
29
|
-
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
30
|
-
</blockquote>
|
|
31
|
-
|
|
32
28
|
## 📦 Package `@promptbook/pdf`
|
|
33
29
|
|
|
34
30
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
|
@@ -58,17 +54,15 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
58
54
|
|
|
59
55
|
## 🤍 The Book Abstract
|
|
60
56
|
|
|
61
|
-
**It's time for a paradigm shift! The future of software is in plain English, French or Latin.**
|
|
57
|
+
**It's time for a paradigm shift! The future of software is written in plain English, French, or Latin.**
|
|
62
58
|
|
|
63
59
|
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**!
|
|
64
60
|
|
|
65
|
-
|
|
66
|
-
|
|
67
61
|
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!
|
|
68
62
|
|
|
69
63
|
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.
|
|
70
64
|
|
|
71
|
-
This shift
|
|
65
|
+
This shift will happen whether we're ready or not. Our mission is to make it excellent, not just good.
|
|
72
66
|
|
|
73
67
|
**Join us in this journey!**
|
|
74
68
|
|
|
@@ -189,9 +183,6 @@ Join our growing community of developers and users:
|
|
|
189
183
|
|
|
190
184
|
_A concise, Markdown-based DSL for crafting AI workflows and automations._
|
|
191
185
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
186
|
### Introduction
|
|
196
187
|
|
|
197
188
|
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.
|
|
@@ -219,7 +210,7 @@ Book is a Markdown-based language that simplifies the creation of AI application
|
|
|
219
210
|
→ {article}
|
|
220
211
|
```
|
|
221
212
|
|
|
222
|
-
Each part of the book defines one of
|
|
213
|
+
Each part of the book defines one of three circles:
|
|
223
214
|
|
|
224
215
|
### **1. What:** Workflows, Tasks and Parameters
|
|
225
216
|
|
|
@@ -241,8 +232,6 @@ Personas can have access to different knowledge, tools and actions. They can als
|
|
|
241
232
|
|
|
242
233
|
- [PERSONA](https://github.com/webgptorg/promptbook/blob/main/documents/commands/PERSONA.md)
|
|
243
234
|
|
|
244
|
-
|
|
245
|
-
|
|
246
235
|
### **3. How:** Knowledge, Instruments and Actions
|
|
247
236
|
|
|
248
237
|
The resources used by the personas are used to do the work.
|
|
@@ -257,9 +246,9 @@ The resources used by the personas are used to do the work.
|
|
|
257
246
|
|
|
258
247
|
Book language is based on markdown. It is subset of markdown. It is designed to be easy to read and write. It is designed to be understandable by both humans and machines and without specific knowledge of the language.
|
|
259
248
|
|
|
260
|
-
The file has `.book` extension
|
|
249
|
+
The file has a `.book` extension and uses UTF-8 encoding without BOM.
|
|
261
250
|
|
|
262
|
-
|
|
251
|
+
Books have two variants: flat — just a prompt without structure, and full — with tasks, commands, and prompts.
|
|
263
252
|
|
|
264
253
|
As it is source code, it can leverage all the features of version control systems like git and does not suffer from the problems of binary formats, proprietary formats, or no-code solutions.
|
|
265
254
|
|
|
@@ -290,13 +279,13 @@ Or you can install them separately:
|
|
|
290
279
|
|
|
291
280
|
- ⭐ **[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
|
|
292
281
|
- **[promptbook](https://www.npmjs.com/package/promptbook)** - Same as `ptbk`
|
|
293
|
-
- ⭐🧙♂️ **[@promptbook/
|
|
282
|
+
- ⭐🧙♂️ **[@promptbook/wizard](https://www.npmjs.com/package/@promptbook/wizard)** - Wizard to just run the books in node without any struggle
|
|
294
283
|
- **[@promptbook/core](https://www.npmjs.com/package/@promptbook/core)** - Core of the library, it contains the main logic for promptbooks
|
|
295
284
|
- **[@promptbook/node](https://www.npmjs.com/package/@promptbook/node)** - Core of the library for Node.js environment
|
|
296
285
|
- **[@promptbook/browser](https://www.npmjs.com/package/@promptbook/browser)** - Core of the library for browser environment
|
|
297
286
|
- ⭐ **[@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
|
|
298
287
|
- **[@promptbook/markdown-utils](https://www.npmjs.com/package/@promptbook/markdown-utils)** - Utility functions used for processing markdown
|
|
299
|
-
- _(Not finished)_ **[@promptbook/
|
|
288
|
+
- _(Not finished)_ **[@promptbook/wizard](https://www.npmjs.com/package/@promptbook/wizard)** - Wizard for creating+running promptbooks in single line
|
|
300
289
|
- **[@promptbook/javascript](https://www.npmjs.com/package/@promptbook/javascript)** - Execution tools for javascript inside promptbooks
|
|
301
290
|
- **[@promptbook/openai](https://www.npmjs.com/package/@promptbook/openai)** - Execution tools for OpenAI API, wrapper around OpenAI SDK
|
|
302
291
|
- **[@promptbook/anthropic-claude](https://www.npmjs.com/package/@promptbook/anthropic-claude)** - Execution tools for Anthropic Claude API, wrapper around Anthropic Claude SDK
|
|
@@ -340,9 +329,7 @@ The following glossary is used to clarify certain concepts:
|
|
|
340
329
|
- **Retrieval-augmented generation** is a machine learning paradigm where a model generates text by retrieving relevant information from a large database of text. This approach combines the benefits of generative models and retrieval models.
|
|
341
330
|
- **Longtail** refers to non-common or rare events, items, or entities that are not well-represented in the training data of machine learning models. Longtail items are often challenging for models to predict accurately.
|
|
342
331
|
|
|
343
|
-
_Note: This section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
344
|
-
|
|
345
|
-
|
|
332
|
+
_Note: This section is not a complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
346
333
|
|
|
347
334
|
### 💯 Core concepts
|
|
348
335
|
|
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
|
|
@@ -875,7 +875,7 @@ async function getScraperIntermediateSource(source, options) {
|
|
|
875
875
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
876
876
|
*/
|
|
877
877
|
|
|
878
|
-
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"}];
|
|
878
|
+
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"}];
|
|
879
879
|
|
|
880
880
|
/**
|
|
881
881
|
* Checks if value is valid email
|
|
@@ -1032,7 +1032,7 @@ function prettifyMarkdown(content) {
|
|
|
1032
1032
|
});
|
|
1033
1033
|
}
|
|
1034
1034
|
catch (error) {
|
|
1035
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
1035
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
1036
1036
|
console.error('There was an error with prettifying the markdown, using the original as the fallback', {
|
|
1037
1037
|
error,
|
|
1038
1038
|
html: content,
|
|
@@ -1314,7 +1314,7 @@ function checkSerializableAsJson(options) {
|
|
|
1314
1314
|
else {
|
|
1315
1315
|
for (const [subName, subValue] of Object.entries(value)) {
|
|
1316
1316
|
if (subValue === undefined) {
|
|
1317
|
-
// Note: undefined in object is serializable - it is just
|
|
1317
|
+
// Note: undefined in object is serializable - it is just omitted
|
|
1318
1318
|
continue;
|
|
1319
1319
|
}
|
|
1320
1320
|
checkSerializableAsJson({ name: `${name}.${subName}`, value: subValue, message });
|
|
@@ -2004,7 +2004,7 @@ class SimplePipelineCollection {
|
|
|
2004
2004
|
|
|
2005
2005
|
Note: You have probably forgotten to run "ptbk make" to update the collection
|
|
2006
2006
|
Note: Pipelines with the same URL are not allowed
|
|
2007
|
-
Only
|
|
2007
|
+
Only exception is when the pipelines are identical
|
|
2008
2008
|
|
|
2009
2009
|
`));
|
|
2010
2010
|
}
|
|
@@ -2772,12 +2772,12 @@ function countUsage(llmTools) {
|
|
|
2772
2772
|
get title() {
|
|
2773
2773
|
return `${llmTools.title} (+usage)`;
|
|
2774
2774
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2775
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2775
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
2776
2776
|
},
|
|
2777
2777
|
get description() {
|
|
2778
2778
|
return `${llmTools.description} (+usage)`;
|
|
2779
2779
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2780
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2780
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
2781
2781
|
},
|
|
2782
2782
|
checkConfiguration() {
|
|
2783
2783
|
return /* not await */ llmTools.checkConfiguration();
|
|
@@ -3004,13 +3004,13 @@ function joinLlmExecutionTools(...llmExecutionTools) {
|
|
|
3004
3004
|
|
|
3005
3005
|
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.
|
|
3006
3006
|
`);
|
|
3007
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
3007
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
3008
3008
|
console.warn(warningMessage);
|
|
3009
3009
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
3010
3010
|
/*
|
|
3011
3011
|
return {
|
|
3012
3012
|
async listModels() {
|
|
3013
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
3013
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
3014
3014
|
console.warn(
|
|
3015
3015
|
spaceTrim(
|
|
3016
3016
|
(block) => `
|
|
@@ -3286,17 +3286,17 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
3286
3286
|
* Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
|
|
3287
3287
|
*/
|
|
3288
3288
|
const all = [];
|
|
3289
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
3289
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersMetadataRegister.list()) {
|
|
3290
3290
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
3291
3291
|
continue;
|
|
3292
3292
|
}
|
|
3293
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
3293
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
3294
3294
|
}
|
|
3295
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
3295
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersRegister.list()) {
|
|
3296
3296
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
3297
3297
|
continue;
|
|
3298
3298
|
}
|
|
3299
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
3299
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
3300
3300
|
}
|
|
3301
3301
|
for (const { metadata } of availableScrapers) {
|
|
3302
3302
|
all.push(metadata);
|
|
@@ -3308,8 +3308,8 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
3308
3308
|
const isInstalled = $scrapersRegister
|
|
3309
3309
|
.list()
|
|
3310
3310
|
.find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
3311
|
-
const
|
|
3312
|
-
return { ...metadata, isMetadataAviailable, isInstalled,
|
|
3311
|
+
const isAvailableInTools = availableScrapers.some(({ metadata: { packageName, className } }) => metadata.packageName === packageName && metadata.className === className);
|
|
3312
|
+
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
3313
3313
|
});
|
|
3314
3314
|
if (metadata.length === 0) {
|
|
3315
3315
|
return spaceTrim(`
|
|
@@ -3322,7 +3322,7 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
3322
3322
|
return spaceTrim((block) => `
|
|
3323
3323
|
Available scrapers are:
|
|
3324
3324
|
${block(metadata
|
|
3325
|
-
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes,
|
|
3325
|
+
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
3326
3326
|
const more = [];
|
|
3327
3327
|
// TODO: [🧠] Maybe use `documentationUrl`
|
|
3328
3328
|
if (isMetadataAviailable) {
|
|
@@ -3331,16 +3331,16 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
3331
3331
|
if (isInstalled) {
|
|
3332
3332
|
more.push(`🟩 Installed`);
|
|
3333
3333
|
} // not else
|
|
3334
|
-
if (
|
|
3334
|
+
if (isAvailableInTools) {
|
|
3335
3335
|
more.push(`🟦 Available in tools`);
|
|
3336
3336
|
} // not else
|
|
3337
3337
|
if (!isMetadataAviailable && isInstalled) {
|
|
3338
3338
|
more.push(`When no metadata registered but scraper is installed, it is an unexpected behavior`);
|
|
3339
3339
|
} // not else
|
|
3340
|
-
if (!isInstalled &&
|
|
3340
|
+
if (!isInstalled && isAvailableInTools) {
|
|
3341
3341
|
more.push(`When the scraper is not installed but available in tools, it is an unexpected compatibility behavior`);
|
|
3342
3342
|
} // not else
|
|
3343
|
-
if (!
|
|
3343
|
+
if (!isAvailableInBrowser) {
|
|
3344
3344
|
more.push(`Not usable in browser`);
|
|
3345
3345
|
}
|
|
3346
3346
|
const moreText = more.length === 0 ? '' : ` *(${more.join('; ')})*`;
|
|
@@ -3680,7 +3680,7 @@ TODO: [🧊] This is how it can look in future
|
|
|
3680
3680
|
/**
|
|
3681
3681
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
3682
3682
|
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
3683
|
-
* TODO: [🪂] More than max things can run in parallel by
|
|
3683
|
+
* TODO: [🪂] More than max things can run in parallel by accident [1,[2a,2b,_],[3a,3b,_]]
|
|
3684
3684
|
* TODO: [🧠][❎] Do here proper M:N mapping
|
|
3685
3685
|
* [x] One source can make multiple pieces
|
|
3686
3686
|
* [ ] One piece can have multiple sources
|
|
@@ -5352,10 +5352,10 @@ function knowledgePiecesToString(knowledgePieces) {
|
|
|
5352
5352
|
*/
|
|
5353
5353
|
async function getKnowledgeForTask(options) {
|
|
5354
5354
|
const { tools, preparedPipeline, task, parameters } = options;
|
|
5355
|
-
const
|
|
5356
|
-
const
|
|
5355
|
+
const firstKnowledgePiece = preparedPipeline.knowledgePieces[0];
|
|
5356
|
+
const firstKnowledgeIndex = firstKnowledgePiece === null || firstKnowledgePiece === void 0 ? void 0 : firstKnowledgePiece.index[0];
|
|
5357
5357
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
5358
|
-
if (
|
|
5358
|
+
if (firstKnowledgePiece === undefined || firstKnowledgeIndex === undefined) {
|
|
5359
5359
|
return ''; // <- Note: Np knowledge present, return empty string
|
|
5360
5360
|
}
|
|
5361
5361
|
try {
|
|
@@ -5366,7 +5366,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5366
5366
|
title: 'Knowledge Search',
|
|
5367
5367
|
modelRequirements: {
|
|
5368
5368
|
modelVariant: 'EMBEDDING',
|
|
5369
|
-
modelName:
|
|
5369
|
+
modelName: firstKnowledgeIndex.modelName,
|
|
5370
5370
|
},
|
|
5371
5371
|
content: task.content,
|
|
5372
5372
|
parameters,
|
|
@@ -5374,7 +5374,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5374
5374
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
5375
5375
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
5376
5376
|
const { index } = knowledgePiece;
|
|
5377
|
-
const knowledgePieceIndex = index.find((i) => i.modelName ===
|
|
5377
|
+
const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowledgeIndex.modelName);
|
|
5378
5378
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model
|
|
5379
5379
|
if (knowledgePieceIndex === undefined) {
|
|
5380
5380
|
return {
|
|
@@ -5395,8 +5395,8 @@ async function getKnowledgeForTask(options) {
|
|
|
5395
5395
|
task,
|
|
5396
5396
|
taskEmbeddingPrompt,
|
|
5397
5397
|
taskEmbeddingResult,
|
|
5398
|
-
|
|
5399
|
-
|
|
5398
|
+
firstKnowledgePiece,
|
|
5399
|
+
firstKnowledgeIndex,
|
|
5400
5400
|
knowledgePiecesWithRelevance,
|
|
5401
5401
|
knowledgePiecesSorted,
|
|
5402
5402
|
knowledgePiecesLimited,
|
|
@@ -5465,7 +5465,7 @@ async function getReservedParametersForTask(options) {
|
|
|
5465
5465
|
* @private internal utility of `createPipelineExecutor`
|
|
5466
5466
|
*/
|
|
5467
5467
|
async function executeTask(options) {
|
|
5468
|
-
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled,
|
|
5468
|
+
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
|
|
5469
5469
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
5470
5470
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
|
|
5471
5471
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
@@ -5553,7 +5553,7 @@ async function executeTask(options) {
|
|
|
5553
5553
|
cacheDirname,
|
|
5554
5554
|
intermediateFilesStrategy,
|
|
5555
5555
|
isAutoInstalled,
|
|
5556
|
-
|
|
5556
|
+
isNotPreparedWarningSuppressed,
|
|
5557
5557
|
});
|
|
5558
5558
|
await onProgress({
|
|
5559
5559
|
outputParameters: {
|
|
@@ -5648,7 +5648,7 @@ async function executePipeline(options) {
|
|
|
5648
5648
|
}
|
|
5649
5649
|
return exportJson({
|
|
5650
5650
|
name: `executionReport`,
|
|
5651
|
-
message: `
|
|
5651
|
+
message: `Unsuccessful PipelineExecutorResult (with missing parameter {${parameter.name}}) PipelineExecutorResult`,
|
|
5652
5652
|
order: [],
|
|
5653
5653
|
value: {
|
|
5654
5654
|
isSuccessful: false,
|
|
@@ -5685,7 +5685,7 @@ async function executePipeline(options) {
|
|
|
5685
5685
|
return exportJson({
|
|
5686
5686
|
name: 'pipelineExecutorResult',
|
|
5687
5687
|
message: spaceTrim$1((block) => `
|
|
5688
|
-
|
|
5688
|
+
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
5689
5689
|
|
|
5690
5690
|
${block(pipelineIdentification)}
|
|
5691
5691
|
`),
|
|
@@ -5826,7 +5826,7 @@ async function executePipeline(options) {
|
|
|
5826
5826
|
}
|
|
5827
5827
|
return exportJson({
|
|
5828
5828
|
name: 'pipelineExecutorResult',
|
|
5829
|
-
message: `
|
|
5829
|
+
message: `Unsuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult`,
|
|
5830
5830
|
order: [],
|
|
5831
5831
|
value: {
|
|
5832
5832
|
isSuccessful: false,
|
|
@@ -5877,7 +5877,7 @@ async function executePipeline(options) {
|
|
|
5877
5877
|
* @public exported from `@promptbook/core`
|
|
5878
5878
|
*/
|
|
5879
5879
|
function createPipelineExecutor(options) {
|
|
5880
|
-
const { pipeline, tools, maxExecutionAttempts = DEFAULT_MAX_EXECUTION_ATTEMPTS, maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT, csvSettings = DEFAULT_CSV_SETTINGS, isVerbose = DEFAULT_IS_VERBOSE,
|
|
5880
|
+
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;
|
|
5881
5881
|
validatePipeline(pipeline);
|
|
5882
5882
|
const pipelineIdentification = (() => {
|
|
5883
5883
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -5894,7 +5894,7 @@ function createPipelineExecutor(options) {
|
|
|
5894
5894
|
if (isPipelinePrepared(pipeline)) {
|
|
5895
5895
|
preparedPipeline = pipeline;
|
|
5896
5896
|
}
|
|
5897
|
-
else if (
|
|
5897
|
+
else if (isNotPreparedWarningSuppressed !== true) {
|
|
5898
5898
|
console.warn(spaceTrim$1((block) => `
|
|
5899
5899
|
Pipeline is not prepared
|
|
5900
5900
|
|
|
@@ -5927,7 +5927,7 @@ function createPipelineExecutor(options) {
|
|
|
5927
5927
|
maxParallelCount,
|
|
5928
5928
|
csvSettings,
|
|
5929
5929
|
isVerbose,
|
|
5930
|
-
|
|
5930
|
+
isNotPreparedWarningSuppressed,
|
|
5931
5931
|
rootDirname,
|
|
5932
5932
|
cacheDirname,
|
|
5933
5933
|
intermediateFilesStrategy,
|
|
@@ -5936,7 +5936,7 @@ function createPipelineExecutor(options) {
|
|
|
5936
5936
|
assertsError(error);
|
|
5937
5937
|
return exportJson({
|
|
5938
5938
|
name: 'pipelineExecutorResult',
|
|
5939
|
-
message: `
|
|
5939
|
+
message: `Unsuccessful PipelineExecutorResult, last catch`,
|
|
5940
5940
|
order: [],
|
|
5941
5941
|
value: {
|
|
5942
5942
|
isSuccessful: false,
|
|
@@ -5974,7 +5974,7 @@ const markdownScraperMetadata = $deepFreeze({
|
|
|
5974
5974
|
className: 'MarkdownScraper',
|
|
5975
5975
|
mimeTypes: ['text/markdown', 'text/plain'],
|
|
5976
5976
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
5977
|
-
|
|
5977
|
+
isAvailableInBrowser: true,
|
|
5978
5978
|
// <- 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
|
|
5979
5979
|
requiredExecutables: [],
|
|
5980
5980
|
}); /* <- Note: [🤛] */
|
|
@@ -5984,7 +5984,7 @@ const markdownScraperMetadata = $deepFreeze({
|
|
|
5984
5984
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
5985
5985
|
*
|
|
5986
5986
|
* @public exported from `@promptbook/core`
|
|
5987
|
-
* @public exported from `@promptbook/
|
|
5987
|
+
* @public exported from `@promptbook/wizard`
|
|
5988
5988
|
* @public exported from `@promptbook/cli`
|
|
5989
5989
|
*/
|
|
5990
5990
|
$scrapersMetadataRegister.register(markdownScraperMetadata);
|
|
@@ -6083,7 +6083,7 @@ class MarkdownScraper {
|
|
|
6083
6083
|
}
|
|
6084
6084
|
// ---
|
|
6085
6085
|
if (!llmTools.callEmbeddingModel) {
|
|
6086
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
6086
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
6087
6087
|
console.error('No callEmbeddingModel function provided');
|
|
6088
6088
|
}
|
|
6089
6089
|
else {
|
|
@@ -6109,7 +6109,7 @@ class MarkdownScraper {
|
|
|
6109
6109
|
if (!(error instanceof PipelineExecutionError)) {
|
|
6110
6110
|
throw error;
|
|
6111
6111
|
}
|
|
6112
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
6112
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
6113
6113
|
console.error(error, "<- Note: This error is not critical to prepare the pipeline, just knowledge pieces won't have embeddings");
|
|
6114
6114
|
}
|
|
6115
6115
|
return {
|
|
@@ -6145,7 +6145,7 @@ const markitdownScraperMetadata = $deepFreeze({
|
|
|
6145
6145
|
// 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
6146
6146
|
],
|
|
6147
6147
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
6148
|
-
|
|
6148
|
+
isAvailableInBrowser: false,
|
|
6149
6149
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
6150
6150
|
requiredExecutables: [],
|
|
6151
6151
|
}); /* <- Note: [🤛] */
|
|
@@ -6155,7 +6155,7 @@ const markitdownScraperMetadata = $deepFreeze({
|
|
|
6155
6155
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6156
6156
|
*
|
|
6157
6157
|
* @public exported from `@promptbook/core`
|
|
6158
|
-
* @public exported from `@promptbook/
|
|
6158
|
+
* @public exported from `@promptbook/wizard`
|
|
6159
6159
|
* @public exported from `@promptbook/cli`
|
|
6160
6160
|
*/
|
|
6161
6161
|
$scrapersMetadataRegister.register(markitdownScraperMetadata);
|
|
@@ -6292,7 +6292,7 @@ const createMarkitdownScraper = Object.assign((tools, options) => {
|
|
|
6292
6292
|
*
|
|
6293
6293
|
* @public exported from `@promptbook/markitdown`
|
|
6294
6294
|
* @public exported from `@promptbook/pdf`
|
|
6295
|
-
* @public exported from `@promptbook/
|
|
6295
|
+
* @public exported from `@promptbook/wizard`
|
|
6296
6296
|
* @public exported from `@promptbook/cli`
|
|
6297
6297
|
*/
|
|
6298
6298
|
const _MarkitdownScraperRegistration = $scrapersRegister.register(createMarkitdownScraper);
|
|
@@ -6313,7 +6313,7 @@ const pdfScraperMetadata = $deepFreeze({
|
|
|
6313
6313
|
className: 'PdfScraper',
|
|
6314
6314
|
mimeTypes: ['application/pdf-DISABLED'],
|
|
6315
6315
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
6316
|
-
|
|
6316
|
+
isAvailableInBrowser: false,
|
|
6317
6317
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
6318
6318
|
requiredExecutables: [],
|
|
6319
6319
|
}); /* <- Note: [🤛] */
|
|
@@ -6323,7 +6323,7 @@ const pdfScraperMetadata = $deepFreeze({
|
|
|
6323
6323
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6324
6324
|
*
|
|
6325
6325
|
* @public exported from `@promptbook/core`
|
|
6326
|
-
* @public exported from `@promptbook/
|
|
6326
|
+
* @public exported from `@promptbook/wizard`
|
|
6327
6327
|
* @public exported from `@promptbook/cli`
|
|
6328
6328
|
*/
|
|
6329
6329
|
$scrapersMetadataRegister.register(pdfScraperMetadata);
|
|
@@ -6398,7 +6398,7 @@ const createPdfScraper = Object.assign((tools, options) => {
|
|
|
6398
6398
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6399
6399
|
*
|
|
6400
6400
|
* @public exported from `@promptbook/pdf`
|
|
6401
|
-
* @public exported from `@promptbook/
|
|
6401
|
+
* @public exported from `@promptbook/wizard`
|
|
6402
6402
|
* @public exported from `@promptbook/cli`
|
|
6403
6403
|
*/
|
|
6404
6404
|
const _PdfScraperRegistration = $scrapersRegister.register(createPdfScraper);
|