@promptbook/cli 0.85.0 → 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 +15 -27
- package/esm/index.es.js +151 -151
- 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 +1 -1
- 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 +1 -1
- package/umd/index.umd.js +151 -151
- 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)
|
|
@@ -24,6 +25,10 @@
|
|
|
24
25
|
|
|
25
26
|
|
|
26
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
|
+
|
|
27
32
|
## 📦 Package `@promptbook/cli`
|
|
28
33
|
|
|
29
34
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
|
@@ -66,7 +71,7 @@ import { OpenAiExecutionTools } from '@promptbook/openai';
|
|
|
66
71
|
|
|
67
72
|
// ▶ Get single Pipeline
|
|
68
73
|
const promptbook = await getPipelineCollection().getPipelineByUrl(
|
|
69
|
-
`https://promptbook.studio/my-collection/write-article.book
|
|
74
|
+
`https://promptbook.studio/my-collection/write-article.book`,
|
|
70
75
|
);
|
|
71
76
|
|
|
72
77
|
// ▶ Create executor - the function that will execute the Pipeline
|
|
@@ -90,7 +95,7 @@ There is also a javascript and json format available.
|
|
|
90
95
|
## Prettify
|
|
91
96
|
|
|
92
97
|
```bash
|
|
93
|
-
npx ptbk prettify 'promptbook/**/*.book
|
|
98
|
+
npx ptbk prettify 'promptbook/**/*.book'
|
|
94
99
|
```
|
|
95
100
|
|
|
96
101
|
This will prettify all promptbooks in `promptbook` directory and adds Mermaid graphs to them.
|
|
@@ -109,7 +114,7 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
109
114
|
|
|
110
115
|
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**!
|
|
111
116
|
|
|
112
|
-
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!
|
|
117
|
+
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!
|
|
113
118
|
|
|
114
119
|
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.
|
|
115
120
|
|
|
@@ -138,41 +143,24 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
|
|
|
138
143
|
<thead>
|
|
139
144
|
<tr>
|
|
140
145
|
<th>Project</th>
|
|
141
|
-
<th>
|
|
142
|
-
<th>Link</th>
|
|
146
|
+
<th>About</th>
|
|
143
147
|
</tr>
|
|
144
148
|
</thead>
|
|
145
149
|
<tbody>
|
|
146
150
|
<tr>
|
|
147
|
-
<td>
|
|
148
|
-
<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>
|
|
149
|
-
<td rowspan=2>https://github.com/webgptorg/book</td>
|
|
150
|
-
</tr>
|
|
151
|
-
<tr>
|
|
152
|
-
<td>Book language</td>
|
|
151
|
+
<td><a href="https://github.com/webgptorg/book">Book language</a></td>
|
|
153
152
|
<td>
|
|
154
|
-
Book is a markdown-like language to define core entities like
|
|
153
|
+
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>
|
|
154
|
+
There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension
|
|
155
155
|
</td>
|
|
156
156
|
</tr>
|
|
157
157
|
<tr>
|
|
158
|
-
<td>Promptbook
|
|
159
|
-
<td>Promptbook implementation in TypeScript released as multiple NPM packages</td>
|
|
160
|
-
<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>
|
|
158
|
+
<td><a href="https://github.com/webgptorg/promptbook">Promptbook Engine</a></td>
|
|
159
|
+
<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>
|
|
161
160
|
</tr>
|
|
162
161
|
<tr>
|
|
163
|
-
<td>Promptbook
|
|
162
|
+
<td><a href="https://promptbook.studio">Promptbook Studio</a></td>
|
|
164
163
|
<td>Studio to write Books and instantly publish them as miniapps</td>
|
|
165
|
-
<td>
|
|
166
|
-
https://promptbook.studio<br/>
|
|
167
|
-
https://github.com/hejny/promptbook-studio</td>
|
|
168
|
-
</tr><tr>
|
|
169
|
-
<td>Hello World</td>
|
|
170
|
-
<td>Simple starter kit with Books integrated into the sample applications</td>
|
|
171
|
-
<td>
|
|
172
|
-
https://github.com/webgptorg/hello-world<br/>
|
|
173
|
-
https://github.com/webgptorg/hello-world-node-js<br/>
|
|
174
|
-
https://github.com/webgptorg/hello-world-next-js
|
|
175
|
-
</td>
|
|
176
164
|
</tr>
|
|
177
165
|
</tbody>
|
|
178
166
|
</table>
|
package/esm/index.es.js
CHANGED
|
@@ -43,7 +43,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
43
43
|
* @generated
|
|
44
44
|
* @see https://github.com/webgptorg/promptbook
|
|
45
45
|
*/
|
|
46
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
46
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.86.0-1';
|
|
47
47
|
/**
|
|
48
48
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
49
49
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -993,7 +993,7 @@ function stringifyPipelineJson(pipeline) {
|
|
|
993
993
|
return pipelineJsonStringified;
|
|
994
994
|
}
|
|
995
995
|
/**
|
|
996
|
-
* TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book
|
|
996
|
+
* TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book
|
|
997
997
|
* TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
|
|
998
998
|
* TODO: [🧠] Maybe more elegant solution than replacing via regex
|
|
999
999
|
* TODO: [🍙] Make some standard order of json properties
|
|
@@ -3665,7 +3665,7 @@ function collectionToJson(collection) {
|
|
|
3665
3665
|
* TODO: [🧠] Maybe clear `sourceFile` or clear when exposing through API or remote server
|
|
3666
3666
|
*/
|
|
3667
3667
|
|
|
3668
|
-
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"}];
|
|
3668
|
+
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"}];
|
|
3669
3669
|
|
|
3670
3670
|
/**
|
|
3671
3671
|
* Checks if value is valid email
|
|
@@ -7135,7 +7135,7 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
7135
7135
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
7136
7136
|
_b = createPipelineExecutor;
|
|
7137
7137
|
_c = {};
|
|
7138
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book
|
|
7138
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book')];
|
|
7139
7139
|
case 1:
|
|
7140
7140
|
preparePersonaExecutor = _b.apply(void 0, [(_c.pipeline = _d.sent(),
|
|
7141
7141
|
_c.tools = tools,
|
|
@@ -7662,7 +7662,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
7662
7662
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
7663
7663
|
_c = createPipelineExecutor;
|
|
7664
7664
|
_d = {};
|
|
7665
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book
|
|
7665
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book')];
|
|
7666
7666
|
case 1:
|
|
7667
7667
|
prepareTitleExecutor = _c.apply(void 0, [(_d.pipeline = _e.sent(),
|
|
7668
7668
|
_d.tools = tools,
|
|
@@ -8060,7 +8060,7 @@ var sectionCommandParser = {
|
|
|
8060
8060
|
/**
|
|
8061
8061
|
* Parses the boilerplate command
|
|
8062
8062
|
*
|
|
8063
|
-
* Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book
|
|
8063
|
+
* Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book` file
|
|
8064
8064
|
*
|
|
8065
8065
|
* @see `documentationUrl` for more details
|
|
8066
8066
|
* @private within the commands folder
|
|
@@ -8622,7 +8622,7 @@ function validateParameterName(parameterName) {
|
|
|
8622
8622
|
/**
|
|
8623
8623
|
* Parses the foreach command
|
|
8624
8624
|
*
|
|
8625
|
-
* Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book
|
|
8625
|
+
* Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book` file
|
|
8626
8626
|
*
|
|
8627
8627
|
* @see `documentationUrl` for more details
|
|
8628
8628
|
* @public exported from `@promptbook/editable`
|
|
@@ -9073,7 +9073,7 @@ var FORMFACTOR_DEFINITIONS = [
|
|
|
9073
9073
|
/**
|
|
9074
9074
|
* Parses the formfactor command
|
|
9075
9075
|
*
|
|
9076
|
-
* Note: @@@ This command is used as formfactor for new commands - it should NOT be used in any `.book
|
|
9076
|
+
* Note: @@@ This command is used as formfactor for new commands - it should NOT be used in any `.book` file
|
|
9077
9077
|
*
|
|
9078
9078
|
* @see `documentationUrl` for more details
|
|
9079
9079
|
* @public exported from `@promptbook/editable`
|
|
@@ -9734,9 +9734,9 @@ var urlCommandParser = {
|
|
|
9734
9734
|
* Example usages of the URL command
|
|
9735
9735
|
*/
|
|
9736
9736
|
examples: [
|
|
9737
|
-
'PIPELINE URL https://promptbook.studio/library/write-cv.book
|
|
9738
|
-
'URL https://promptbook.studio/library/write-cv.book
|
|
9739
|
-
'https://promptbook.studio/library/write-cv.book
|
|
9737
|
+
'PIPELINE URL https://promptbook.studio/library/write-cv.book',
|
|
9738
|
+
'URL https://promptbook.studio/library/write-cv.book',
|
|
9739
|
+
'https://promptbook.studio/library/write-cv.book',
|
|
9740
9740
|
],
|
|
9741
9741
|
/**
|
|
9742
9742
|
* Parses the URL command
|
|
@@ -12028,13 +12028,13 @@ function createCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12028
12028
|
return [4 /*yield*/, listAllFiles(rootPath, isRecursive, tools.fs)];
|
|
12029
12029
|
case 1:
|
|
12030
12030
|
fileNames = _b.sent();
|
|
12031
|
-
// Note: First load all `.book.json` and then `.book` / `.book
|
|
12031
|
+
// Note: First load all `.book.json` and then `.book` / `.book` files
|
|
12032
12032
|
// `.book.json` can be prepared so it is faster to load
|
|
12033
12033
|
fileNames.sort(function (a, b) {
|
|
12034
|
-
if (a.endsWith('.json') && (b.endsWith('.book') || b.endsWith('.book
|
|
12034
|
+
if (a.endsWith('.json') && (b.endsWith('.book') || b.endsWith('.book'))) {
|
|
12035
12035
|
return -1;
|
|
12036
12036
|
}
|
|
12037
|
-
if ((a.endsWith('.book') || a.endsWith('.book
|
|
12037
|
+
if ((a.endsWith('.book') || a.endsWith('.book')) && b.endsWith('.json')) {
|
|
12038
12038
|
return 1;
|
|
12039
12039
|
}
|
|
12040
12040
|
return 0;
|
|
@@ -12051,7 +12051,7 @@ function createCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12051
12051
|
case 1:
|
|
12052
12052
|
_f.trys.push([1, 8, , 9]);
|
|
12053
12053
|
pipeline = null;
|
|
12054
|
-
if (!(fileName.endsWith('.book') || fileName.endsWith('.book
|
|
12054
|
+
if (!(fileName.endsWith('.book') || fileName.endsWith('.book'))) return [3 /*break*/, 4];
|
|
12055
12055
|
_c = validatePipelineString;
|
|
12056
12056
|
return [4 /*yield*/, readFile(fileName, 'utf-8')];
|
|
12057
12057
|
case 2:
|
|
@@ -12589,7 +12589,7 @@ function $initializePrettifyCommand(program) {
|
|
|
12589
12589
|
case 3:
|
|
12590
12590
|
if (!!filenames_1_1.done) return [3 /*break*/, 10];
|
|
12591
12591
|
filename = filenames_1_1.value;
|
|
12592
|
-
if (!filename.endsWith('.book
|
|
12592
|
+
if (!filename.endsWith('.book') && isVerbose) {
|
|
12593
12593
|
console.info(colors.gray("Skipping ".concat(filename)));
|
|
12594
12594
|
return [3 /*break*/, 9];
|
|
12595
12595
|
}
|
|
@@ -13000,7 +13000,7 @@ function $getCompiledBook(tools, pipelineSource, options) {
|
|
|
13000
13000
|
if (!isValidFilePath(pipelineSource)) return [3 /*break*/, 10];
|
|
13001
13001
|
filePathRaw = pipelineSource;
|
|
13002
13002
|
filePath = null;
|
|
13003
|
-
filePathCandidates = [filePathRaw, "".concat(filePathRaw, ".md"), "".concat(filePathRaw, ".book
|
|
13003
|
+
filePathCandidates = [filePathRaw, "".concat(filePathRaw, ".md"), "".concat(filePathRaw, ".book"), "".concat(filePathRaw, ".book")];
|
|
13004
13004
|
filePathCandidates = __spreadArray(__spreadArray([], __read(filePathCandidates), false), __read(filePathCandidates.map(function (path) { return path.split('\\').join('/'); })), false);
|
|
13005
13005
|
_c.label = 1;
|
|
13006
13006
|
case 1:
|
|
@@ -13130,7 +13130,7 @@ function $getCompiledBook(tools, pipelineSource, options) {
|
|
|
13130
13130
|
case 19:
|
|
13131
13131
|
pipelineJson = _c.sent();
|
|
13132
13132
|
return [2 /*return*/, pipelineJson];
|
|
13133
|
-
case 20: /* not else */ throw new NotFoundError(spaceTrim(function (block) { return "\n Book not found:\n ".concat(block(pipelineSource), "\n\n Pipelines can be loaded from:\n 1) As a file ./books/write-cv.book
|
|
13133
|
+
case 20: /* not else */ throw new NotFoundError(spaceTrim(function (block) { return "\n Book not found:\n ".concat(block(pipelineSource), "\n\n Pipelines can be loaded from:\n 1) As a file ./books/write-cv.book\n 2) As a URL https://promptbook.studio/hejny/write-cv.book found in ./books folder recursively\n 2) As a URL https://promptbook.studio/hejny/write-cv.book fetched from the internet\n 3) As a string\n\n\n "); }));
|
|
13134
13134
|
}
|
|
13135
13135
|
});
|
|
13136
13136
|
});
|
|
@@ -13586,135 +13586,6 @@ function $initializeRunCommand(program) {
|
|
|
13586
13586
|
* TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
|
|
13587
13587
|
*/
|
|
13588
13588
|
|
|
13589
|
-
/**
|
|
13590
|
-
* Initializes `test` command for Promptbook CLI utilities
|
|
13591
|
-
*
|
|
13592
|
-
* Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
|
|
13593
|
-
*
|
|
13594
|
-
* @private internal function of `promptbookCli`
|
|
13595
|
-
*/
|
|
13596
|
-
function $initializeTestCommand(program) {
|
|
13597
|
-
var _this = this;
|
|
13598
|
-
var testCommand = program.command('test');
|
|
13599
|
-
testCommand.description(spaceTrim("\n Iterates over `.book.md` and `.book.json` and checks if they are parsable and logically valid\n "));
|
|
13600
|
-
testCommand.argument('<filesGlob>',
|
|
13601
|
-
// <- TODO: [🧟♂️] Unite path to promptbook collection argument
|
|
13602
|
-
'Pipelines to test as glob pattern');
|
|
13603
|
-
testCommand.option('-i, --ignore <glob>', "Ignore as glob pattern");
|
|
13604
|
-
testCommand.option('-r, --reload', "Call LLM models even if same prompt with result is in the cache ", false);
|
|
13605
|
-
testCommand.option('-v, --verbose', "Is output verbose", false);
|
|
13606
|
-
testCommand.action(function (filesGlob, _a) {
|
|
13607
|
-
var ignore = _a.ignore, isCacheReloaded = _a.reload, isVerbose = _a.verbose;
|
|
13608
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
13609
|
-
var prepareAndScrapeOptions, fs, llm, executables, tools, filenames, filenames_1, filenames_1_1, filename, pipeline, pipelineMarkdown, _b, _c, _d, error_1, e_1_1;
|
|
13610
|
-
var _e, e_1, _f;
|
|
13611
|
-
return __generator(this, function (_g) {
|
|
13612
|
-
switch (_g.label) {
|
|
13613
|
-
case 0:
|
|
13614
|
-
prepareAndScrapeOptions = {
|
|
13615
|
-
isVerbose: isVerbose,
|
|
13616
|
-
isCacheReloaded: isCacheReloaded,
|
|
13617
|
-
};
|
|
13618
|
-
fs = $provideFilesystemForNode(prepareAndScrapeOptions);
|
|
13619
|
-
return [4 /*yield*/, $provideLlmToolsForWizzardOrCli(prepareAndScrapeOptions)];
|
|
13620
|
-
case 1:
|
|
13621
|
-
llm = _g.sent();
|
|
13622
|
-
return [4 /*yield*/, $provideExecutablesForNode(prepareAndScrapeOptions)];
|
|
13623
|
-
case 2:
|
|
13624
|
-
executables = _g.sent();
|
|
13625
|
-
_e = {
|
|
13626
|
-
llm: llm,
|
|
13627
|
-
fs: fs
|
|
13628
|
-
};
|
|
13629
|
-
return [4 /*yield*/, $provideScrapersForNode({ fs: fs, llm: llm, executables: executables }, prepareAndScrapeOptions)];
|
|
13630
|
-
case 3:
|
|
13631
|
-
tools = (_e.scrapers = _g.sent(),
|
|
13632
|
-
_e.script = [
|
|
13633
|
-
/*new JavascriptExecutionTools(options)*/
|
|
13634
|
-
],
|
|
13635
|
-
_e);
|
|
13636
|
-
return [4 /*yield*/, glob(filesGlob, { ignore: ignore })];
|
|
13637
|
-
case 4:
|
|
13638
|
-
filenames = _g.sent();
|
|
13639
|
-
_g.label = 5;
|
|
13640
|
-
case 5:
|
|
13641
|
-
_g.trys.push([5, 17, 18, 19]);
|
|
13642
|
-
filenames_1 = __values(filenames), filenames_1_1 = filenames_1.next();
|
|
13643
|
-
_g.label = 6;
|
|
13644
|
-
case 6:
|
|
13645
|
-
if (!!filenames_1_1.done) return [3 /*break*/, 16];
|
|
13646
|
-
filename = filenames_1_1.value;
|
|
13647
|
-
_g.label = 7;
|
|
13648
|
-
case 7:
|
|
13649
|
-
_g.trys.push([7, 14, , 15]);
|
|
13650
|
-
pipeline = void 0;
|
|
13651
|
-
if (!filename.endsWith('.book.md')) return [3 /*break*/, 10];
|
|
13652
|
-
_b = validatePipelineString;
|
|
13653
|
-
return [4 /*yield*/, readFile(filename, 'utf-8')];
|
|
13654
|
-
case 8:
|
|
13655
|
-
pipelineMarkdown = _b.apply(void 0, [_g.sent()]);
|
|
13656
|
-
return [4 /*yield*/, compilePipeline(pipelineMarkdown, tools)];
|
|
13657
|
-
case 9:
|
|
13658
|
-
pipeline = _g.sent();
|
|
13659
|
-
if (isVerbose) {
|
|
13660
|
-
console.info(colors.green("Parsed ".concat(filename)));
|
|
13661
|
-
}
|
|
13662
|
-
_g.label = 10;
|
|
13663
|
-
case 10:
|
|
13664
|
-
if (!filename.endsWith('.book.json')) return [3 /*break*/, 12];
|
|
13665
|
-
_d = (_c = JSON).parse;
|
|
13666
|
-
return [4 /*yield*/, readFile(filename, 'utf-8')];
|
|
13667
|
-
case 11:
|
|
13668
|
-
pipeline = _d.apply(_c, [_g.sent()]);
|
|
13669
|
-
return [3 /*break*/, 13];
|
|
13670
|
-
case 12:
|
|
13671
|
-
if (isVerbose) {
|
|
13672
|
-
console.info(colors.gray("Skipping ".concat(filename)));
|
|
13673
|
-
}
|
|
13674
|
-
return [3 /*break*/, 15];
|
|
13675
|
-
case 13:
|
|
13676
|
-
validatePipeline(pipeline);
|
|
13677
|
-
console.info(colors.green("Validated ".concat(filename)));
|
|
13678
|
-
return [3 /*break*/, 15];
|
|
13679
|
-
case 14:
|
|
13680
|
-
error_1 = _g.sent();
|
|
13681
|
-
if (!(error_1 instanceof Error)) {
|
|
13682
|
-
throw error_1;
|
|
13683
|
-
}
|
|
13684
|
-
console.info(colors.red("Pipeline is not valid ".concat(filename)));
|
|
13685
|
-
console.error(colors.bgRed(error_1.name /* <- 11:11 */));
|
|
13686
|
-
console.error(colors.red(error_1.stack || error_1.message));
|
|
13687
|
-
return [2 /*return*/, process.exit(1)];
|
|
13688
|
-
case 15:
|
|
13689
|
-
filenames_1_1 = filenames_1.next();
|
|
13690
|
-
return [3 /*break*/, 6];
|
|
13691
|
-
case 16: return [3 /*break*/, 19];
|
|
13692
|
-
case 17:
|
|
13693
|
-
e_1_1 = _g.sent();
|
|
13694
|
-
e_1 = { error: e_1_1 };
|
|
13695
|
-
return [3 /*break*/, 19];
|
|
13696
|
-
case 18:
|
|
13697
|
-
try {
|
|
13698
|
-
if (filenames_1_1 && !filenames_1_1.done && (_f = filenames_1.return)) _f.call(filenames_1);
|
|
13699
|
-
}
|
|
13700
|
-
finally { if (e_1) throw e_1.error; }
|
|
13701
|
-
return [7 /*endfinally*/];
|
|
13702
|
-
case 19:
|
|
13703
|
-
console.info(colors.green("All pipelines are valid"));
|
|
13704
|
-
return [2 /*return*/, process.exit(0)];
|
|
13705
|
-
}
|
|
13706
|
-
});
|
|
13707
|
-
});
|
|
13708
|
-
});
|
|
13709
|
-
}
|
|
13710
|
-
/**
|
|
13711
|
-
* TODO: [😶] Unite floder listing
|
|
13712
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
13713
|
-
* Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
|
|
13714
|
-
* TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
|
|
13715
|
-
* Note: This is named "test-command.ts" to avoid name collision with jest unit test files
|
|
13716
|
-
*/
|
|
13717
|
-
|
|
13718
13589
|
/**
|
|
13719
13590
|
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
13720
13591
|
*
|
|
@@ -14288,6 +14159,135 @@ function $initializeStartServerCommand(program) {
|
|
|
14288
14159
|
* Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
|
|
14289
14160
|
*/
|
|
14290
14161
|
|
|
14162
|
+
/**
|
|
14163
|
+
* Initializes `test` command for Promptbook CLI utilities
|
|
14164
|
+
*
|
|
14165
|
+
* Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
|
|
14166
|
+
*
|
|
14167
|
+
* @private internal function of `promptbookCli`
|
|
14168
|
+
*/
|
|
14169
|
+
function $initializeTestCommand(program) {
|
|
14170
|
+
var _this = this;
|
|
14171
|
+
var testCommand = program.command('test');
|
|
14172
|
+
testCommand.description(spaceTrim("\n Iterates over `.book.md` and `.book.json` and checks if they are parsable and logically valid\n "));
|
|
14173
|
+
testCommand.argument('<filesGlob>',
|
|
14174
|
+
// <- TODO: [🧟♂️] Unite path to promptbook collection argument
|
|
14175
|
+
'Pipelines to test as glob pattern');
|
|
14176
|
+
testCommand.option('-i, --ignore <glob>', "Ignore as glob pattern");
|
|
14177
|
+
testCommand.option('-r, --reload', "Call LLM models even if same prompt with result is in the cache ", false);
|
|
14178
|
+
testCommand.option('-v, --verbose', "Is output verbose", false);
|
|
14179
|
+
testCommand.action(function (filesGlob, _a) {
|
|
14180
|
+
var ignore = _a.ignore, isCacheReloaded = _a.reload, isVerbose = _a.verbose;
|
|
14181
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
14182
|
+
var prepareAndScrapeOptions, fs, llm, executables, tools, filenames, filenames_1, filenames_1_1, filename, pipeline, pipelineMarkdown, _b, _c, _d, error_1, e_1_1;
|
|
14183
|
+
var _e, e_1, _f;
|
|
14184
|
+
return __generator(this, function (_g) {
|
|
14185
|
+
switch (_g.label) {
|
|
14186
|
+
case 0:
|
|
14187
|
+
prepareAndScrapeOptions = {
|
|
14188
|
+
isVerbose: isVerbose,
|
|
14189
|
+
isCacheReloaded: isCacheReloaded,
|
|
14190
|
+
};
|
|
14191
|
+
fs = $provideFilesystemForNode(prepareAndScrapeOptions);
|
|
14192
|
+
return [4 /*yield*/, $provideLlmToolsForWizzardOrCli(prepareAndScrapeOptions)];
|
|
14193
|
+
case 1:
|
|
14194
|
+
llm = _g.sent();
|
|
14195
|
+
return [4 /*yield*/, $provideExecutablesForNode(prepareAndScrapeOptions)];
|
|
14196
|
+
case 2:
|
|
14197
|
+
executables = _g.sent();
|
|
14198
|
+
_e = {
|
|
14199
|
+
llm: llm,
|
|
14200
|
+
fs: fs
|
|
14201
|
+
};
|
|
14202
|
+
return [4 /*yield*/, $provideScrapersForNode({ fs: fs, llm: llm, executables: executables }, prepareAndScrapeOptions)];
|
|
14203
|
+
case 3:
|
|
14204
|
+
tools = (_e.scrapers = _g.sent(),
|
|
14205
|
+
_e.script = [
|
|
14206
|
+
/*new JavascriptExecutionTools(options)*/
|
|
14207
|
+
],
|
|
14208
|
+
_e);
|
|
14209
|
+
return [4 /*yield*/, glob(filesGlob, { ignore: ignore })];
|
|
14210
|
+
case 4:
|
|
14211
|
+
filenames = _g.sent();
|
|
14212
|
+
_g.label = 5;
|
|
14213
|
+
case 5:
|
|
14214
|
+
_g.trys.push([5, 17, 18, 19]);
|
|
14215
|
+
filenames_1 = __values(filenames), filenames_1_1 = filenames_1.next();
|
|
14216
|
+
_g.label = 6;
|
|
14217
|
+
case 6:
|
|
14218
|
+
if (!!filenames_1_1.done) return [3 /*break*/, 16];
|
|
14219
|
+
filename = filenames_1_1.value;
|
|
14220
|
+
_g.label = 7;
|
|
14221
|
+
case 7:
|
|
14222
|
+
_g.trys.push([7, 14, , 15]);
|
|
14223
|
+
pipeline = void 0;
|
|
14224
|
+
if (!filename.endsWith('.book')) return [3 /*break*/, 10];
|
|
14225
|
+
_b = validatePipelineString;
|
|
14226
|
+
return [4 /*yield*/, readFile(filename, 'utf-8')];
|
|
14227
|
+
case 8:
|
|
14228
|
+
pipelineMarkdown = _b.apply(void 0, [_g.sent()]);
|
|
14229
|
+
return [4 /*yield*/, compilePipeline(pipelineMarkdown, tools)];
|
|
14230
|
+
case 9:
|
|
14231
|
+
pipeline = _g.sent();
|
|
14232
|
+
if (isVerbose) {
|
|
14233
|
+
console.info(colors.green("Parsed ".concat(filename)));
|
|
14234
|
+
}
|
|
14235
|
+
_g.label = 10;
|
|
14236
|
+
case 10:
|
|
14237
|
+
if (!filename.endsWith('.book.json')) return [3 /*break*/, 12];
|
|
14238
|
+
_d = (_c = JSON).parse;
|
|
14239
|
+
return [4 /*yield*/, readFile(filename, 'utf-8')];
|
|
14240
|
+
case 11:
|
|
14241
|
+
pipeline = _d.apply(_c, [_g.sent()]);
|
|
14242
|
+
return [3 /*break*/, 13];
|
|
14243
|
+
case 12:
|
|
14244
|
+
if (isVerbose) {
|
|
14245
|
+
console.info(colors.gray("Skipping ".concat(filename)));
|
|
14246
|
+
}
|
|
14247
|
+
return [3 /*break*/, 15];
|
|
14248
|
+
case 13:
|
|
14249
|
+
validatePipeline(pipeline);
|
|
14250
|
+
console.info(colors.green("Validated ".concat(filename)));
|
|
14251
|
+
return [3 /*break*/, 15];
|
|
14252
|
+
case 14:
|
|
14253
|
+
error_1 = _g.sent();
|
|
14254
|
+
if (!(error_1 instanceof Error)) {
|
|
14255
|
+
throw error_1;
|
|
14256
|
+
}
|
|
14257
|
+
console.info(colors.red("Pipeline is not valid ".concat(filename)));
|
|
14258
|
+
console.error(colors.bgRed(error_1.name /* <- 11:11 */));
|
|
14259
|
+
console.error(colors.red(error_1.stack || error_1.message));
|
|
14260
|
+
return [2 /*return*/, process.exit(1)];
|
|
14261
|
+
case 15:
|
|
14262
|
+
filenames_1_1 = filenames_1.next();
|
|
14263
|
+
return [3 /*break*/, 6];
|
|
14264
|
+
case 16: return [3 /*break*/, 19];
|
|
14265
|
+
case 17:
|
|
14266
|
+
e_1_1 = _g.sent();
|
|
14267
|
+
e_1 = { error: e_1_1 };
|
|
14268
|
+
return [3 /*break*/, 19];
|
|
14269
|
+
case 18:
|
|
14270
|
+
try {
|
|
14271
|
+
if (filenames_1_1 && !filenames_1_1.done && (_f = filenames_1.return)) _f.call(filenames_1);
|
|
14272
|
+
}
|
|
14273
|
+
finally { if (e_1) throw e_1.error; }
|
|
14274
|
+
return [7 /*endfinally*/];
|
|
14275
|
+
case 19:
|
|
14276
|
+
console.info(colors.green("All pipelines are valid"));
|
|
14277
|
+
return [2 /*return*/, process.exit(0)];
|
|
14278
|
+
}
|
|
14279
|
+
});
|
|
14280
|
+
});
|
|
14281
|
+
});
|
|
14282
|
+
}
|
|
14283
|
+
/**
|
|
14284
|
+
* TODO: [😶] Unite floder listing
|
|
14285
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14286
|
+
* Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
|
|
14287
|
+
* TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
|
|
14288
|
+
* Note: This is named "test-command.ts" to avoid name collision with jest unit test files
|
|
14289
|
+
*/
|
|
14290
|
+
|
|
14291
14291
|
/**
|
|
14292
14292
|
* Runs CLI utilities of Promptbook package
|
|
14293
14293
|
*
|
|
@@ -14325,7 +14325,7 @@ function promptbookCli() {
|
|
|
14325
14325
|
});
|
|
14326
14326
|
}
|
|
14327
14327
|
/**
|
|
14328
|
-
* TODO: [🧠] Maybe `run` command the default, instead of `ptbk run ./foo.book
|
|
14328
|
+
* TODO: [🧠] Maybe `run` command the default, instead of `ptbk run ./foo.book` -> `ptbk ./foo.book`
|
|
14329
14329
|
* TODO: [🥠] Do not export, its just for CLI script
|
|
14330
14330
|
* TODO: [🕌] When more functionalities, rename
|
|
14331
14331
|
* Note: 11:11
|
|
@@ -17176,7 +17176,7 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
17176
17176
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
17177
17177
|
_d = createPipelineExecutor;
|
|
17178
17178
|
_g = {};
|
|
17179
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book
|
|
17179
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book')];
|
|
17180
17180
|
case 1:
|
|
17181
17181
|
prepareKnowledgeFromMarkdownExecutor = _d.apply(void 0, [(_g.pipeline = _k.sent(),
|
|
17182
17182
|
_g.tools = {
|
|
@@ -17185,7 +17185,7 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
17185
17185
|
_g)]);
|
|
17186
17186
|
_e = createPipelineExecutor;
|
|
17187
17187
|
_h = {};
|
|
17188
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-title.book
|
|
17188
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-title.book')];
|
|
17189
17189
|
case 2:
|
|
17190
17190
|
prepareTitleExecutor = _e.apply(void 0, [(_h.pipeline = _k.sent(),
|
|
17191
17191
|
_h.tools = {
|
|
@@ -17194,7 +17194,7 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
17194
17194
|
_h)]);
|
|
17195
17195
|
_f = createPipelineExecutor;
|
|
17196
17196
|
_j = {};
|
|
17197
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-keywords.book
|
|
17197
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-keywords.book')];
|
|
17198
17198
|
case 3:
|
|
17199
17199
|
prepareKeywordsExecutor = _f.apply(void 0, [(_j.pipeline = _k.sent(),
|
|
17200
17200
|
_j.tools = {
|