@promptbook/remote-server 0.85.0-9 → 0.86.0-10
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 +71 -77
- 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 +71 -77
- 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)
|
|
@@ -59,7 +60,7 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
59
60
|
|
|
60
61
|
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**!
|
|
61
62
|
|
|
62
|
-
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!
|
|
63
|
+
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!
|
|
63
64
|
|
|
64
65
|
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.
|
|
65
66
|
|
|
@@ -88,41 +89,24 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
|
|
|
88
89
|
<thead>
|
|
89
90
|
<tr>
|
|
90
91
|
<th>Project</th>
|
|
91
|
-
<th>
|
|
92
|
-
<th>Link</th>
|
|
92
|
+
<th>About</th>
|
|
93
93
|
</tr>
|
|
94
94
|
</thead>
|
|
95
95
|
<tbody>
|
|
96
96
|
<tr>
|
|
97
|
-
<td>
|
|
98
|
-
<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>
|
|
99
|
-
<td rowspan=2>https://github.com/webgptorg/book</td>
|
|
100
|
-
</tr>
|
|
101
|
-
<tr>
|
|
102
|
-
<td>Book language</td>
|
|
97
|
+
<td><a href="https://github.com/webgptorg/book">Book language</a></td>
|
|
103
98
|
<td>
|
|
104
|
-
Book is a markdown-like language to define core entities like
|
|
99
|
+
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>
|
|
100
|
+
There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension
|
|
105
101
|
</td>
|
|
106
102
|
</tr>
|
|
107
103
|
<tr>
|
|
108
|
-
<td>Promptbook
|
|
109
|
-
<td>Promptbook implementation in TypeScript released as multiple NPM packages</td>
|
|
110
|
-
<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>
|
|
104
|
+
<td><a href="https://github.com/webgptorg/promptbook">Promptbook Engine</a></td>
|
|
105
|
+
<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>
|
|
111
106
|
</tr>
|
|
112
107
|
<tr>
|
|
113
|
-
<td>Promptbook
|
|
108
|
+
<td><a href="https://promptbook.studio">Promptbook Studio</a></td>
|
|
114
109
|
<td>Studio to write Books and instantly publish them as miniapps</td>
|
|
115
|
-
<td>
|
|
116
|
-
https://promptbook.studio<br/>
|
|
117
|
-
https://github.com/hejny/promptbook-studio</td>
|
|
118
|
-
</tr><tr>
|
|
119
|
-
<td>Hello World</td>
|
|
120
|
-
<td>Simple starter kit with Books integrated into the sample applications</td>
|
|
121
|
-
<td>
|
|
122
|
-
https://github.com/webgptorg/hello-world<br/>
|
|
123
|
-
https://github.com/webgptorg/hello-world-node-js<br/>
|
|
124
|
-
https://github.com/webgptorg/hello-world-next-js
|
|
125
|
-
</td>
|
|
126
110
|
</tr>
|
|
127
111
|
</tbody>
|
|
128
112
|
</table>
|
package/esm/index.es.js
CHANGED
|
@@ -31,7 +31,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
31
31
|
* @generated
|
|
32
32
|
* @see https://github.com/webgptorg/promptbook
|
|
33
33
|
*/
|
|
34
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
34
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.86.0-9';
|
|
35
35
|
/**
|
|
36
36
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
37
37
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1491,57 +1491,6 @@ function isValidPromptbookVersion(version) {
|
|
|
1491
1491
|
return true;
|
|
1492
1492
|
}
|
|
1493
1493
|
|
|
1494
|
-
/**
|
|
1495
|
-
* Checks if an URL is reserved for private networks or localhost.
|
|
1496
|
-
*
|
|
1497
|
-
* Note: There are two simmilar functions:
|
|
1498
|
-
* - `isUrlOnPrivateNetwork` which tests full URL
|
|
1499
|
-
* - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
|
|
1500
|
-
*
|
|
1501
|
-
* @public exported from `@promptbook/utils`
|
|
1502
|
-
*/
|
|
1503
|
-
function isHostnameOnPrivateNetwork(hostname) {
|
|
1504
|
-
if (hostname === 'example.com' ||
|
|
1505
|
-
hostname === 'localhost' ||
|
|
1506
|
-
hostname.endsWith('.localhost') ||
|
|
1507
|
-
hostname.endsWith('.local') ||
|
|
1508
|
-
hostname.endsWith('.test') ||
|
|
1509
|
-
hostname === '127.0.0.1' ||
|
|
1510
|
-
hostname === '::1') {
|
|
1511
|
-
return true;
|
|
1512
|
-
}
|
|
1513
|
-
if (hostname.includes(':')) {
|
|
1514
|
-
// IPv6
|
|
1515
|
-
var ipParts = hostname.split(':');
|
|
1516
|
-
return ipParts[0] === 'fc00' || ipParts[0] === 'fd00' || ipParts[0] === 'fe80';
|
|
1517
|
-
}
|
|
1518
|
-
else {
|
|
1519
|
-
// IPv4
|
|
1520
|
-
var ipParts = hostname.split('.').map(function (part) { return Number.parseInt(part, 10); });
|
|
1521
|
-
return (ipParts[0] === 10 ||
|
|
1522
|
-
(ipParts[0] === 172 && ipParts[1] >= 16 && ipParts[1] <= 31) ||
|
|
1523
|
-
(ipParts[0] === 192 && ipParts[1] === 168));
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
/**
|
|
1528
|
-
* Checks if an IP address or hostname is reserved for private networks or localhost.
|
|
1529
|
-
*
|
|
1530
|
-
* Note: There are two simmilar functions:
|
|
1531
|
-
* - `isUrlOnPrivateNetwork` *(this one)* which tests full URL
|
|
1532
|
-
* - `isHostnameOnPrivateNetwork` which tests just hostname
|
|
1533
|
-
*
|
|
1534
|
-
* @param {string} ipAddress - The IP address to check.
|
|
1535
|
-
* @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
|
|
1536
|
-
* @public exported from `@promptbook/utils`
|
|
1537
|
-
*/
|
|
1538
|
-
function isUrlOnPrivateNetwork(url) {
|
|
1539
|
-
if (typeof url === 'string') {
|
|
1540
|
-
url = new URL(url);
|
|
1541
|
-
}
|
|
1542
|
-
return isHostnameOnPrivateNetwork(url.hostname);
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
1494
|
/**
|
|
1546
1495
|
* Tests if given string is valid URL.
|
|
1547
1496
|
*
|
|
@@ -1584,16 +1533,19 @@ function isValidPipelineUrl(url) {
|
|
|
1584
1533
|
if (!isValidUrl(url)) {
|
|
1585
1534
|
return false;
|
|
1586
1535
|
}
|
|
1587
|
-
if (!url.startsWith('https://')) {
|
|
1536
|
+
if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [👣] */) {
|
|
1588
1537
|
return false;
|
|
1589
1538
|
}
|
|
1590
1539
|
if (url.includes('#')) {
|
|
1591
1540
|
// TODO: [🐠]
|
|
1592
1541
|
return false;
|
|
1593
1542
|
}
|
|
1543
|
+
/*
|
|
1544
|
+
Note: [👣][🧠] Is it secure to allow pipeline URLs on private and unsecured networks?
|
|
1594
1545
|
if (isUrlOnPrivateNetwork(url)) {
|
|
1595
1546
|
return false;
|
|
1596
1547
|
}
|
|
1548
|
+
*/
|
|
1597
1549
|
return true;
|
|
1598
1550
|
}
|
|
1599
1551
|
/**
|
|
@@ -2065,7 +2017,7 @@ function createTask(options) {
|
|
|
2065
2017
|
* TODO: [🐚] Split into more files and make `PrepareTask` & `RemoteTask` + split the function
|
|
2066
2018
|
*/
|
|
2067
2019
|
|
|
2068
|
-
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"}];
|
|
2020
|
+
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"}];
|
|
2069
2021
|
|
|
2070
2022
|
/**
|
|
2071
2023
|
* Checks if value is valid email
|
|
@@ -3220,7 +3172,7 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
3220
3172
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
3221
3173
|
_b = createPipelineExecutor;
|
|
3222
3174
|
_c = {};
|
|
3223
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book
|
|
3175
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book')];
|
|
3224
3176
|
case 1:
|
|
3225
3177
|
preparePersonaExecutor = _b.apply(void 0, [(_c.pipeline = _d.sent(),
|
|
3226
3178
|
_c.tools = tools,
|
|
@@ -4438,7 +4390,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
4438
4390
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
4439
4391
|
_c = createPipelineExecutor;
|
|
4440
4392
|
_d = {};
|
|
4441
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book
|
|
4393
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book')];
|
|
4442
4394
|
case 1:
|
|
4443
4395
|
prepareTitleExecutor = _c.apply(void 0, [(_d.pipeline = _e.sent(),
|
|
4444
4396
|
_d.tools = tools,
|
|
@@ -7017,6 +6969,46 @@ function startRemoteServer(options) {
|
|
|
7017
6969
|
}
|
|
7018
6970
|
});
|
|
7019
6971
|
}); });
|
|
6972
|
+
// TODO: [🧠] Is it secure / good idea to expose source codes of hosted books
|
|
6973
|
+
app.get("".concat(rootPath, "/books/*"), function (request, response) { return __awaiter(_this, void 0, void 0, function () {
|
|
6974
|
+
var pipelines, fullUrl, pipelineUrl, pipeline, source, error_1;
|
|
6975
|
+
return __generator(this, function (_a) {
|
|
6976
|
+
switch (_a.label) {
|
|
6977
|
+
case 0:
|
|
6978
|
+
_a.trys.push([0, 3, , 4]);
|
|
6979
|
+
if (collection === null) {
|
|
6980
|
+
response.status(500).send('No collection nor books available');
|
|
6981
|
+
return [2 /*return*/];
|
|
6982
|
+
}
|
|
6983
|
+
return [4 /*yield*/, collection.listPipelines()];
|
|
6984
|
+
case 1:
|
|
6985
|
+
pipelines = _a.sent();
|
|
6986
|
+
fullUrl = request.protocol + '://' + request.get('host') + request.originalUrl;
|
|
6987
|
+
pipelineUrl = pipelines.find(function (pipelineUrl) { return pipelineUrl.endsWith(request.originalUrl); }) || fullUrl;
|
|
6988
|
+
return [4 /*yield*/, collection.getPipelineByUrl(pipelineUrl)];
|
|
6989
|
+
case 2:
|
|
6990
|
+
pipeline = _a.sent();
|
|
6991
|
+
source = pipeline.sources[0];
|
|
6992
|
+
if (source === undefined || source.type !== 'BOOK') {
|
|
6993
|
+
throw new Error('Pipeline source is not a book');
|
|
6994
|
+
}
|
|
6995
|
+
response
|
|
6996
|
+
.type('text/markdown')
|
|
6997
|
+
.send(source.content);
|
|
6998
|
+
return [3 /*break*/, 4];
|
|
6999
|
+
case 3:
|
|
7000
|
+
error_1 = _a.sent();
|
|
7001
|
+
if (!(error_1 instanceof Error)) {
|
|
7002
|
+
throw error_1;
|
|
7003
|
+
}
|
|
7004
|
+
response
|
|
7005
|
+
.status(404)
|
|
7006
|
+
.send({ error: serializeError(error_1) });
|
|
7007
|
+
return [3 /*break*/, 4];
|
|
7008
|
+
case 4: return [2 /*return*/];
|
|
7009
|
+
}
|
|
7010
|
+
});
|
|
7011
|
+
}); });
|
|
7020
7012
|
app.get("".concat(rootPath, "/executions"), function (request, response) { return __awaiter(_this, void 0, void 0, function () {
|
|
7021
7013
|
return __generator(this, function (_a) {
|
|
7022
7014
|
response.send(runningExecutionTasks);
|
|
@@ -7029,7 +7021,9 @@ function startRemoteServer(options) {
|
|
|
7029
7021
|
taskId = request.params.taskId;
|
|
7030
7022
|
execution = runningExecutionTasks.find(function (executionTask) { return executionTask.taskId === taskId; });
|
|
7031
7023
|
if (execution === undefined) {
|
|
7032
|
-
response
|
|
7024
|
+
response
|
|
7025
|
+
.status(404)
|
|
7026
|
+
.send("Execution \"".concat(taskId, "\" not found"));
|
|
7033
7027
|
return [2 /*return*/];
|
|
7034
7028
|
}
|
|
7035
7029
|
response.send(execution.currentValue);
|
|
@@ -7037,7 +7031,7 @@ function startRemoteServer(options) {
|
|
|
7037
7031
|
});
|
|
7038
7032
|
}); });
|
|
7039
7033
|
app.post("".concat(rootPath, "/executions/new"), function (request, response) { return __awaiter(_this, void 0, void 0, function () {
|
|
7040
|
-
var _a, inputParameters, identification, pipelineUrl, pipeline, tools, pipelineExecutor, executionTask,
|
|
7034
|
+
var _a, inputParameters, identification, pipelineUrl, pipeline, tools, pipelineExecutor, executionTask, error_2;
|
|
7041
7035
|
return __generator(this, function (_b) {
|
|
7042
7036
|
switch (_b.label) {
|
|
7043
7037
|
case 0:
|
|
@@ -7065,11 +7059,11 @@ function startRemoteServer(options) {
|
|
|
7065
7059
|
response.send(executionTask);
|
|
7066
7060
|
return [3 /*break*/, 5];
|
|
7067
7061
|
case 4:
|
|
7068
|
-
|
|
7069
|
-
if (!(
|
|
7070
|
-
throw
|
|
7062
|
+
error_2 = _b.sent();
|
|
7063
|
+
if (!(error_2 instanceof Error)) {
|
|
7064
|
+
throw error_2;
|
|
7071
7065
|
}
|
|
7072
|
-
response.status(400).send({ error: serializeError(
|
|
7066
|
+
response.status(400).send({ error: serializeError(error_2) });
|
|
7073
7067
|
return [3 /*break*/, 5];
|
|
7074
7068
|
case 5: return [2 /*return*/];
|
|
7075
7069
|
}
|
|
@@ -7090,7 +7084,7 @@ function startRemoteServer(options) {
|
|
|
7090
7084
|
}
|
|
7091
7085
|
// -----------
|
|
7092
7086
|
socket.on('prompt-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
|
|
7093
|
-
var identification, prompt, tools, llm, _a, promptResult, _b,
|
|
7087
|
+
var identification, prompt, tools, llm, _a, promptResult, _b, error_3;
|
|
7094
7088
|
return __generator(this, function (_c) {
|
|
7095
7089
|
switch (_c.label) {
|
|
7096
7090
|
case 0:
|
|
@@ -7159,11 +7153,11 @@ function startRemoteServer(options) {
|
|
|
7159
7153
|
socket.emit('prompt-response', { promptResult: promptResult } /* <- Note: [🤛] */);
|
|
7160
7154
|
return [3 /*break*/, 15];
|
|
7161
7155
|
case 13:
|
|
7162
|
-
|
|
7163
|
-
if (!(
|
|
7164
|
-
throw
|
|
7156
|
+
error_3 = _c.sent();
|
|
7157
|
+
if (!(error_3 instanceof Error)) {
|
|
7158
|
+
throw error_3;
|
|
7165
7159
|
}
|
|
7166
|
-
socket.emit('error', serializeError(
|
|
7160
|
+
socket.emit('error', serializeError(error_3) /* <- Note: [🤛] */);
|
|
7167
7161
|
return [3 /*break*/, 15];
|
|
7168
7162
|
case 14:
|
|
7169
7163
|
socket.disconnect();
|
|
@@ -7175,7 +7169,7 @@ function startRemoteServer(options) {
|
|
|
7175
7169
|
// -----------
|
|
7176
7170
|
// TODO: [👒] Listing models (and checking configuration) probbably should go through REST API not Socket.io
|
|
7177
7171
|
socket.on('listModels-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
|
|
7178
|
-
var identification, tools, llm, models,
|
|
7172
|
+
var identification, tools, llm, models, error_4;
|
|
7179
7173
|
return __generator(this, function (_a) {
|
|
7180
7174
|
switch (_a.label) {
|
|
7181
7175
|
case 0:
|
|
@@ -7196,11 +7190,11 @@ function startRemoteServer(options) {
|
|
|
7196
7190
|
socket.emit('listModels-response', { models: models } /* <- Note: [🤛] */);
|
|
7197
7191
|
return [3 /*break*/, 6];
|
|
7198
7192
|
case 4:
|
|
7199
|
-
|
|
7200
|
-
if (!(
|
|
7201
|
-
throw
|
|
7193
|
+
error_4 = _a.sent();
|
|
7194
|
+
if (!(error_4 instanceof Error)) {
|
|
7195
|
+
throw error_4;
|
|
7202
7196
|
}
|
|
7203
|
-
socket.emit('error', serializeError(
|
|
7197
|
+
socket.emit('error', serializeError(error_4));
|
|
7204
7198
|
return [3 /*break*/, 6];
|
|
7205
7199
|
case 5:
|
|
7206
7200
|
socket.disconnect();
|
|
@@ -7212,7 +7206,7 @@ function startRemoteServer(options) {
|
|
|
7212
7206
|
// -----------
|
|
7213
7207
|
// TODO: [👒] Listing models (and checking configuration) probbably should go through REST API not Socket.io
|
|
7214
7208
|
socket.on('preparePipeline-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
|
|
7215
|
-
var identification, pipeline, tools, preparedPipeline,
|
|
7209
|
+
var identification, pipeline, tools, preparedPipeline, error_5;
|
|
7216
7210
|
return __generator(this, function (_a) {
|
|
7217
7211
|
switch (_a.label) {
|
|
7218
7212
|
case 0:
|
|
@@ -7232,11 +7226,11 @@ function startRemoteServer(options) {
|
|
|
7232
7226
|
socket.emit('preparePipeline-response', { preparedPipeline: preparedPipeline } /* <- Note: [🤛] */);
|
|
7233
7227
|
return [3 /*break*/, 6];
|
|
7234
7228
|
case 4:
|
|
7235
|
-
|
|
7236
|
-
if (!(
|
|
7237
|
-
throw
|
|
7229
|
+
error_5 = _a.sent();
|
|
7230
|
+
if (!(error_5 instanceof Error)) {
|
|
7231
|
+
throw error_5;
|
|
7238
7232
|
}
|
|
7239
|
-
socket.emit('error', serializeError(
|
|
7233
|
+
socket.emit('error', serializeError(error_5));
|
|
7240
7234
|
return [3 /*break*/, 6];
|
|
7241
7235
|
case 5:
|
|
7242
7236
|
socket.disconnect();
|