@promptbook/node 0.85.0-9 → 0.86.0-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -25
- package/esm/index.es.js +28 -75
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/cli/promptbookCli.d.ts +1 -1
- package/esm/typings/src/collection/collectionToJson.test.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +3 -3
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +2 -2
- package/esm/typings/src/types/Prompt.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +2 -2
- package/esm/typings/src/utils/editable/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/wizzard/wizzard.d.ts +6 -6
- package/package.json +3 -3
- package/umd/index.umd.js +27 -74
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
## 🌟 New Features
|
|
18
18
|
|
|
19
|
+
- 📂 We have plugin for [VSCode](https://github.com/webgptorg/book-extension) to support `.book` file extension
|
|
19
20
|
- 💫 Support of [`o3-mini` model by OpenAI](https://openai.com/index/openai-o3-mini/)
|
|
20
21
|
- 🐋 **Support of [DeepSeek models](https://www.npmjs.com/package/@promptbook/deepseek)**
|
|
21
22
|
- 💙 Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
|
|
@@ -63,7 +64,7 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
63
64
|
|
|
64
65
|
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**!
|
|
65
66
|
|
|
66
|
-
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!
|
|
67
|
+
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!
|
|
67
68
|
|
|
68
69
|
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.
|
|
69
70
|
|
|
@@ -92,41 +93,24 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
|
|
|
92
93
|
<thead>
|
|
93
94
|
<tr>
|
|
94
95
|
<th>Project</th>
|
|
95
|
-
<th>
|
|
96
|
-
<th>Link</th>
|
|
96
|
+
<th>About</th>
|
|
97
97
|
</tr>
|
|
98
98
|
</thead>
|
|
99
99
|
<tbody>
|
|
100
100
|
<tr>
|
|
101
|
-
<td>
|
|
102
|
-
<td>Promptbook Core is a description and documentation of the basic concepts, ideas and inner workings of how Promptbook should be implemented, and defines what features must be describable by book language.</td>
|
|
103
|
-
<td rowspan=2>https://github.com/webgptorg/book</td>
|
|
104
|
-
</tr>
|
|
105
|
-
<tr>
|
|
106
|
-
<td>Book language</td>
|
|
101
|
+
<td><a href="https://github.com/webgptorg/book">Book language</a></td>
|
|
107
102
|
<td>
|
|
108
|
-
Book is a markdown-like language to define core entities like
|
|
103
|
+
Book is a markdown-like language to define core entities like personas, knowledge, tasks,.... It is designed to be understandable by non-programmers and non-technical people<hr>
|
|
104
|
+
There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension
|
|
109
105
|
</td>
|
|
110
106
|
</tr>
|
|
111
107
|
<tr>
|
|
112
|
-
<td>Promptbook
|
|
113
|
-
<td>Promptbook implementation in TypeScript released as multiple NPM packages</td>
|
|
114
|
-
<td>https://github.com/webgptorg/promptbook + <a href="https://www.npmjs.com/package/@promptbook/core#-packages-for-developers">Multiple packages published on NPM</a></td>
|
|
108
|
+
<td><a href="https://github.com/webgptorg/promptbook">Promptbook Engine</a></td>
|
|
109
|
+
<td>Promptbook implementation in TypeScript released as <a href="https://www.npmjs.com/package/@promptbook/core#-packages-for-developers">multiple NPM packages</a> and <a href="https://hub.docker.com/r/hejny/promptbook">Docker HUB</a></td>
|
|
115
110
|
</tr>
|
|
116
111
|
<tr>
|
|
117
|
-
<td>Promptbook
|
|
112
|
+
<td><a href="https://promptbook.studio">Promptbook Studio</a></td>
|
|
118
113
|
<td>Studio to write Books and instantly publish them as miniapps</td>
|
|
119
|
-
<td>
|
|
120
|
-
https://promptbook.studio<br/>
|
|
121
|
-
https://github.com/hejny/promptbook-studio</td>
|
|
122
|
-
</tr><tr>
|
|
123
|
-
<td>Hello World</td>
|
|
124
|
-
<td>Simple starter kit with Books integrated into the sample applications</td>
|
|
125
|
-
<td>
|
|
126
|
-
https://github.com/webgptorg/hello-world<br/>
|
|
127
|
-
https://github.com/webgptorg/hello-world-node-js<br/>
|
|
128
|
-
https://github.com/webgptorg/hello-world-next-js
|
|
129
|
-
</td>
|
|
130
114
|
</tr>
|
|
131
115
|
</tbody>
|
|
132
116
|
</table>
|
package/esm/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import colors from 'colors';
|
|
2
2
|
import { stat, access, constants, readFile, writeFile, readdir, mkdir, unlink } from 'fs/promises';
|
|
3
|
-
import { basename, join, dirname } from 'path';
|
|
3
|
+
import { basename, join, dirname, relative } from 'path';
|
|
4
4
|
import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
5
5
|
import { format } from 'prettier';
|
|
6
6
|
import parserHtml from 'prettier/parser-html';
|
|
@@ -29,7 +29,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
29
29
|
* @generated
|
|
30
30
|
* @see https://github.com/webgptorg/promptbook
|
|
31
31
|
*/
|
|
32
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
32
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.86.0-1';
|
|
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
|
|
@@ -337,7 +337,7 @@ true);
|
|
|
337
337
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
338
338
|
*/
|
|
339
339
|
|
|
340
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",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.md`\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.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",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.md`\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.md"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",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.md`\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.md"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the 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\nPick from the following models:\n\n- {availableModelNames}\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:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book.md`\n- INPUT PARAMETER `{availableModelNames}` List of available model names separated by comma (,)\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n\\`\\`\\`json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the 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\nPick from the following models:\n\n- {availableModelNames}\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`-> {modelRequirements}`\n"}],sourceFile:"./books/prepare-persona.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book.md",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.md`\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.md"}];
|
|
340
|
+
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:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the 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\nPick from the following models:\n\n- {availableModelNames}\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:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","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 `{availableModelNames}` List of available model names separated by comma (,)\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n\\`\\`\\`json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the 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\nPick from the following models:\n\n- {availableModelNames}\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`-> {modelRequirements}`\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"}];
|
|
341
341
|
|
|
342
342
|
/**
|
|
343
343
|
* Checks if value is valid email
|
|
@@ -1136,57 +1136,6 @@ function isValidPromptbookVersion(version) {
|
|
|
1136
1136
|
return true;
|
|
1137
1137
|
}
|
|
1138
1138
|
|
|
1139
|
-
/**
|
|
1140
|
-
* Checks if an URL is reserved for private networks or localhost.
|
|
1141
|
-
*
|
|
1142
|
-
* Note: There are two simmilar functions:
|
|
1143
|
-
* - `isUrlOnPrivateNetwork` which tests full URL
|
|
1144
|
-
* - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
|
|
1145
|
-
*
|
|
1146
|
-
* @public exported from `@promptbook/utils`
|
|
1147
|
-
*/
|
|
1148
|
-
function isHostnameOnPrivateNetwork(hostname) {
|
|
1149
|
-
if (hostname === 'example.com' ||
|
|
1150
|
-
hostname === 'localhost' ||
|
|
1151
|
-
hostname.endsWith('.localhost') ||
|
|
1152
|
-
hostname.endsWith('.local') ||
|
|
1153
|
-
hostname.endsWith('.test') ||
|
|
1154
|
-
hostname === '127.0.0.1' ||
|
|
1155
|
-
hostname === '::1') {
|
|
1156
|
-
return true;
|
|
1157
|
-
}
|
|
1158
|
-
if (hostname.includes(':')) {
|
|
1159
|
-
// IPv6
|
|
1160
|
-
var ipParts = hostname.split(':');
|
|
1161
|
-
return ipParts[0] === 'fc00' || ipParts[0] === 'fd00' || ipParts[0] === 'fe80';
|
|
1162
|
-
}
|
|
1163
|
-
else {
|
|
1164
|
-
// IPv4
|
|
1165
|
-
var ipParts = hostname.split('.').map(function (part) { return Number.parseInt(part, 10); });
|
|
1166
|
-
return (ipParts[0] === 10 ||
|
|
1167
|
-
(ipParts[0] === 172 && ipParts[1] >= 16 && ipParts[1] <= 31) ||
|
|
1168
|
-
(ipParts[0] === 192 && ipParts[1] === 168));
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
/**
|
|
1173
|
-
* Checks if an IP address or hostname is reserved for private networks or localhost.
|
|
1174
|
-
*
|
|
1175
|
-
* Note: There are two simmilar functions:
|
|
1176
|
-
* - `isUrlOnPrivateNetwork` *(this one)* which tests full URL
|
|
1177
|
-
* - `isHostnameOnPrivateNetwork` which tests just hostname
|
|
1178
|
-
*
|
|
1179
|
-
* @param {string} ipAddress - The IP address to check.
|
|
1180
|
-
* @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
|
|
1181
|
-
* @public exported from `@promptbook/utils`
|
|
1182
|
-
*/
|
|
1183
|
-
function isUrlOnPrivateNetwork(url) {
|
|
1184
|
-
if (typeof url === 'string') {
|
|
1185
|
-
url = new URL(url);
|
|
1186
|
-
}
|
|
1187
|
-
return isHostnameOnPrivateNetwork(url.hostname);
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
1139
|
/**
|
|
1191
1140
|
* Tests if given string is valid pipeline URL URL.
|
|
1192
1141
|
*
|
|
@@ -1200,16 +1149,19 @@ function isValidPipelineUrl(url) {
|
|
|
1200
1149
|
if (!isValidUrl(url)) {
|
|
1201
1150
|
return false;
|
|
1202
1151
|
}
|
|
1203
|
-
if (!url.startsWith('https://')) {
|
|
1152
|
+
if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [👣] */) {
|
|
1204
1153
|
return false;
|
|
1205
1154
|
}
|
|
1206
1155
|
if (url.includes('#')) {
|
|
1207
1156
|
// TODO: [🐠]
|
|
1208
1157
|
return false;
|
|
1209
1158
|
}
|
|
1159
|
+
/*
|
|
1160
|
+
Note: [👣][🧠] Is it secure to allow pipeline URLs on private and unsecured networks?
|
|
1210
1161
|
if (isUrlOnPrivateNetwork(url)) {
|
|
1211
1162
|
return false;
|
|
1212
1163
|
}
|
|
1164
|
+
*/
|
|
1213
1165
|
return true;
|
|
1214
1166
|
}
|
|
1215
1167
|
/**
|
|
@@ -5079,7 +5031,7 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
5079
5031
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
5080
5032
|
_b = createPipelineExecutor;
|
|
5081
5033
|
_c = {};
|
|
5082
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book
|
|
5034
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book')];
|
|
5083
5035
|
case 1:
|
|
5084
5036
|
preparePersonaExecutor = _b.apply(void 0, [(_c.pipeline = _d.sent(),
|
|
5085
5037
|
_c.tools = tools,
|
|
@@ -6036,7 +5988,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
6036
5988
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
6037
5989
|
_c = createPipelineExecutor;
|
|
6038
5990
|
_d = {};
|
|
6039
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book
|
|
5991
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book')];
|
|
6040
5992
|
case 1:
|
|
6041
5993
|
prepareTitleExecutor = _c.apply(void 0, [(_d.pipeline = _e.sent(),
|
|
6042
5994
|
_d.tools = tools,
|
|
@@ -6434,7 +6386,7 @@ var sectionCommandParser = {
|
|
|
6434
6386
|
/**
|
|
6435
6387
|
* Parses the boilerplate command
|
|
6436
6388
|
*
|
|
6437
|
-
* Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book
|
|
6389
|
+
* Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book` file
|
|
6438
6390
|
*
|
|
6439
6391
|
* @see `documentationUrl` for more details
|
|
6440
6392
|
* @private within the commands folder
|
|
@@ -6996,7 +6948,7 @@ function validateParameterName(parameterName) {
|
|
|
6996
6948
|
/**
|
|
6997
6949
|
* Parses the foreach command
|
|
6998
6950
|
*
|
|
6999
|
-
* Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book
|
|
6951
|
+
* Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book` file
|
|
7000
6952
|
*
|
|
7001
6953
|
* @see `documentationUrl` for more details
|
|
7002
6954
|
* @public exported from `@promptbook/editable`
|
|
@@ -7447,7 +7399,7 @@ var FORMFACTOR_DEFINITIONS = [
|
|
|
7447
7399
|
/**
|
|
7448
7400
|
* Parses the formfactor command
|
|
7449
7401
|
*
|
|
7450
|
-
* Note: @@@ This command is used as formfactor for new commands - it should NOT be used in any `.book
|
|
7402
|
+
* Note: @@@ This command is used as formfactor for new commands - it should NOT be used in any `.book` file
|
|
7451
7403
|
*
|
|
7452
7404
|
* @see `documentationUrl` for more details
|
|
7453
7405
|
* @public exported from `@promptbook/editable`
|
|
@@ -8108,9 +8060,9 @@ var urlCommandParser = {
|
|
|
8108
8060
|
* Example usages of the URL command
|
|
8109
8061
|
*/
|
|
8110
8062
|
examples: [
|
|
8111
|
-
'PIPELINE URL https://promptbook.studio/library/write-cv.book
|
|
8112
|
-
'URL https://promptbook.studio/library/write-cv.book
|
|
8113
|
-
'https://promptbook.studio/library/write-cv.book
|
|
8063
|
+
'PIPELINE URL https://promptbook.studio/library/write-cv.book',
|
|
8064
|
+
'URL https://promptbook.studio/library/write-cv.book',
|
|
8065
|
+
'https://promptbook.studio/library/write-cv.book',
|
|
8114
8066
|
],
|
|
8115
8067
|
/**
|
|
8116
8068
|
* Parses the URL command
|
|
@@ -11289,13 +11241,13 @@ function createCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
|
|
|
11289
11241
|
*
|
|
11290
11242
|
* Note: Works only in Node.js environment because it reads the file system
|
|
11291
11243
|
*
|
|
11292
|
-
* @param
|
|
11244
|
+
* @param rootPath - path to the directory with pipelines
|
|
11293
11245
|
* @param tools - Execution tools to be used for pipeline preparation if needed - If not provided, `$provideExecutionToolsForNode` will be used
|
|
11294
11246
|
* @param options - Options for the collection creation
|
|
11295
11247
|
* @returns PipelineCollection
|
|
11296
11248
|
* @public exported from `@promptbook/node`
|
|
11297
11249
|
*/
|
|
11298
|
-
function createCollectionFromDirectory(
|
|
11250
|
+
function createCollectionFromDirectory(rootPath, tools, options) {
|
|
11299
11251
|
return __awaiter(this, void 0, void 0, function () {
|
|
11300
11252
|
var madeLibraryFilePath, _a, _b, isRecursive, _c, isVerbose, _d, isLazyLoaded, _e, isCrashedOnError, rootUrl, collection;
|
|
11301
11253
|
var _this = this;
|
|
@@ -11312,7 +11264,7 @@ function createCollectionFromDirectory(path, tools, options) {
|
|
|
11312
11264
|
throw new EnvironmentMismatchError('Can not create collection without filesystem tools');
|
|
11313
11265
|
// <- TODO: [🧠] What is the best error type here`
|
|
11314
11266
|
}
|
|
11315
|
-
madeLibraryFilePath = join(
|
|
11267
|
+
madeLibraryFilePath = join(rootPath, "".concat(DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME
|
|
11316
11268
|
// <- TODO: [🦒] Allow to override (pass different value into the function)
|
|
11317
11269
|
, ".json"));
|
|
11318
11270
|
return [4 /*yield*/, isFileExisting(madeLibraryFilePath, tools.fs)];
|
|
@@ -11331,18 +11283,18 @@ function createCollectionFromDirectory(path, tools, options) {
|
|
|
11331
11283
|
switch (_b.label) {
|
|
11332
11284
|
case 0:
|
|
11333
11285
|
if (isVerbose) {
|
|
11334
|
-
console.info(colors.cyan("Creating pipeline collection from path ".concat(
|
|
11286
|
+
console.info(colors.cyan("Creating pipeline collection from path ".concat(rootPath.split('\\').join('/'))));
|
|
11335
11287
|
}
|
|
11336
|
-
return [4 /*yield*/, listAllFiles(
|
|
11288
|
+
return [4 /*yield*/, listAllFiles(rootPath, isRecursive, tools.fs)];
|
|
11337
11289
|
case 1:
|
|
11338
11290
|
fileNames = _b.sent();
|
|
11339
|
-
// Note: First load all
|
|
11340
|
-
//
|
|
11291
|
+
// Note: First load all `.book.json` and then `.book` / `.book` files
|
|
11292
|
+
// `.book.json` can be prepared so it is faster to load
|
|
11341
11293
|
fileNames.sort(function (a, b) {
|
|
11342
|
-
if (a.endsWith('.json') && b.endsWith('.
|
|
11294
|
+
if (a.endsWith('.json') && (b.endsWith('.book') || b.endsWith('.book'))) {
|
|
11343
11295
|
return -1;
|
|
11344
11296
|
}
|
|
11345
|
-
if (a.endsWith('.
|
|
11297
|
+
if ((a.endsWith('.book') || a.endsWith('.book')) && b.endsWith('.json')) {
|
|
11346
11298
|
return 1;
|
|
11347
11299
|
}
|
|
11348
11300
|
return 0;
|
|
@@ -11359,7 +11311,7 @@ function createCollectionFromDirectory(path, tools, options) {
|
|
|
11359
11311
|
case 1:
|
|
11360
11312
|
_f.trys.push([1, 8, , 9]);
|
|
11361
11313
|
pipeline = null;
|
|
11362
|
-
if (!fileName.endsWith('.book.
|
|
11314
|
+
if (!(fileName.endsWith('.book') || fileName.endsWith('.book'))) return [3 /*break*/, 4];
|
|
11363
11315
|
_c = validatePipelineString;
|
|
11364
11316
|
return [4 /*yield*/, readFile(fileName, 'utf-8')];
|
|
11365
11317
|
case 2:
|
|
@@ -11391,7 +11343,8 @@ function createCollectionFromDirectory(path, tools, options) {
|
|
|
11391
11343
|
if (pipeline !== null) {
|
|
11392
11344
|
if (rootUrl !== undefined) {
|
|
11393
11345
|
if (pipeline.pipelineUrl === undefined) {
|
|
11394
|
-
pipelineUrl = rootUrl + '/' + fileName.split('\\').join('/');
|
|
11346
|
+
pipelineUrl = rootUrl + '/' + relative(rootPath, fileName).split('\\').join('/');
|
|
11347
|
+
// console.log({ pipelineUrl, rootPath, rootUrl, fileName });
|
|
11395
11348
|
if (isVerbose) {
|
|
11396
11349
|
console.info(colors.yellow("Implicitly set pipeline URL to ".concat(pipelineUrl, " from ").concat(fileName
|
|
11397
11350
|
.split('\\')
|
|
@@ -11521,7 +11474,7 @@ function stringifyPipelineJson(pipeline) {
|
|
|
11521
11474
|
return pipelineJsonStringified;
|
|
11522
11475
|
}
|
|
11523
11476
|
/**
|
|
11524
|
-
* TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book
|
|
11477
|
+
* TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book
|
|
11525
11478
|
* TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
|
|
11526
11479
|
* TODO: [🧠] Maybe more elegant solution than replacing via regex
|
|
11527
11480
|
* TODO: [🍙] Make some standard order of json properties
|