@promptbook/legacy-documents 0.75.0-2 → 0.75.0-4

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.
Files changed (50) hide show
  1. package/README.md +27 -17
  2. package/esm/index.es.js +46 -45
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +10 -4
  5. package/esm/typings/src/_packages/types.index.d.ts +8 -6
  6. package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +1 -1
  7. package/esm/typings/src/commands/SECTION/SectionCommand.d.ts +1 -1
  8. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +0 -2
  9. package/esm/typings/src/config.d.ts +9 -2
  10. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
  11. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +2 -2
  12. package/esm/typings/src/conversion/utils/extractParameterNamesFromTask.d.ts +3 -3
  13. package/esm/typings/src/conversion/utils/renameParameter.d.ts +2 -2
  14. package/esm/typings/src/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
  15. package/esm/typings/src/execution/ScriptExecutionTools.d.ts +1 -1
  16. package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +2 -2
  17. package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +3 -0
  18. package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +32 -2
  19. package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +14 -0
  20. package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +2 -2
  21. package/esm/typings/src/formfactors/index.d.ts +72 -10
  22. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +2 -2
  23. package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +12 -2
  24. package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +12 -2
  25. package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +5 -4
  26. package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +2 -2
  27. package/esm/typings/src/pipeline/PipelineJson/{TaskJsonCommon.d.ts → CommonTaskJson.d.ts} +13 -13
  28. package/esm/typings/src/pipeline/PipelineJson/DialogTaskJson.d.ts +2 -2
  29. package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +2 -0
  30. package/esm/typings/src/pipeline/PipelineJson/PersonaJson.d.ts +1 -1
  31. package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +2 -2
  32. package/esm/typings/src/pipeline/PipelineJson/PromptTaskJson.d.ts +2 -2
  33. package/esm/typings/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +2 -2
  34. package/esm/typings/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +2 -2
  35. package/esm/typings/src/pipeline/PipelineJson/TaskJson.d.ts +1 -1
  36. package/esm/typings/src/pipeline/PipelineString.d.ts +1 -1
  37. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +1 -1
  38. package/esm/typings/src/prepare/prepareTasks.d.ts +5 -5
  39. package/esm/typings/src/types/Prompt.d.ts +3 -3
  40. package/esm/typings/src/types/SectionType.d.ts +21 -0
  41. package/esm/typings/src/types/TaskProgress.d.ts +1 -1
  42. package/esm/typings/src/types/TaskType.d.ts +15 -0
  43. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  44. package/esm/typings/src/utils/organization/TODO_remove_as.d.ts +6 -0
  45. package/esm/typings/src/utils/parameters/extractParameterNames.d.ts +1 -1
  46. package/package.json +2 -2
  47. package/umd/index.umd.js +46 -45
  48. package/umd/index.umd.js.map +1 -1
  49. package/esm/typings/src/commands/SECTION/SectionType.d.ts +0 -13
  50. /package/esm/typings/{promptbook-collection → books}/index.d.ts +0 -0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ![Promptbook logo - cube with letters P and B](./other/design/logo-h1.png) Promptbook
4
4
 
5
- Build responsible, controlled and transparent applications on top of LLM models!
5
+ It's time for a paradigm shift! The future of software is in plain English, French or Latin.
6
6
 
7
7
 
8
8
 
@@ -53,25 +53,24 @@ Read knowledge from legacy documents like `.doc`, `.rtf`,…
53
53
 
54
54
  Rest of the documentation is common for **entire promptbook ecosystem**:
55
55
 
56
- ## 🤍 The Promptbook Whitepaper
57
56
 
58
- If you have a simple, single prompt for ChatGPT, GPT-4, Anthropic Claude, Google Gemini, Llama 3, or whatever, it doesn't matter how you integrate it. Whether it's calling a REST API directly, using the SDK, hardcoding the prompt into the source code, or importing a text file, the process remains the same.
59
57
 
60
- But often you will struggle with the **limitations of LLMs**, such as **hallucinations, off-topic responses, poor quality output, language and prompt drift, word repetition repetition repetition repetition or misuse, lack of context, or just plain w𝒆𝐢rd resp0nses**. When this happens, you generally have three options:
61
58
 
62
- 1. **Fine-tune** the model to your specifications or even train your own.
63
- 2. **Prompt-engineer** the prompt to the best shape you can achieve.
64
- 3. Orchestrate **multiple prompts** in a [pipeline](https://github.com/webgptorg/promptbook/discussions/64) to get the best result.
59
+ ## 🤍 The Book Abstract
60
+
61
+ > It's time for a paradigm shift! **The future of software is in plain English**, French or Latin.
62
+
63
+ During the computer revolution, we have seen [multiple generations of computer languages](https://github.com/webgptorg/promptbook/discussions/180), from the physical rewiring of the vacuum tubes through low-level machine code to the high-level languages like Python or JavaScript. And now, we're on the edge of the **next revolution**!
64
+
65
+ 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!
66
+
67
+ 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.
68
+
69
+ This shift is going to happen, whether we are ready for it or not. Our mission is to make it excellently, not just good.
70
+
71
+ > **Join us in this journey!**
65
72
 
66
- In all of these situations, but especially in 3., the **✨ Promptbook can make your life waaaaaaaaaay easier**.
67
73
 
68
- - [**Separates concerns**](https://github.com/webgptorg/promptbook/discussions/32) between prompt-engineer and programmer, between code files and prompt files, and between prompts and their execution logic. For this purpose, it introduces a new language called [the **💙 Book**](https://github.com/webgptorg/book).
69
- - Book allows you to **focus on the business** logic without having to write code or deal with the technicalities of LLMs.
70
- - **Forget** about **low-level details** like choosing the right model, tokens, context size, `temperature`, `top-k`, `top-p`, or kernel sampling. **Just write your intent** and [**persona**](https://github.com/webgptorg/promptbook/discussions/22) who should be responsible for the task and let the library do the rest.
71
- - We have built-in **orchestration** of [pipeline](https://github.com/webgptorg/promptbook/discussions/64) execution and many tools to make the process easier, more reliable, and more efficient, such as caching, [compilation+preparation](https://github.com/webgptorg/promptbook/discussions/78), [just-in-time fine-tuning](https://github.com/webgptorg/promptbook/discussions/33), [expectation-aware generation](https://github.com/webgptorg/promptbook/discussions/37), [agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39), and more.
72
- - Sometimes even the best prompts with the best framework like Promptbook `:)` can't avoid the problems. In this case, the library has built-in **[anomaly detection](https://github.com/webgptorg/promptbook/discussions/40) and logging** to help you find and fix the problems.
73
- - Versioning is build in. You can test multiple **A/B versions** of pipelines and see which one works best.
74
- - Promptbook is designed to use [**RAG** (Retrieval-Augmented Generation)](https://github.com/webgptorg/promptbook/discussions/41) and other advanced techniques to bring the context of your business to generic LLM. You can use **knowledge** to improve the quality of the output.
75
74
 
76
75
 
77
76
 
@@ -183,7 +182,9 @@ Reserved words:
183
182
 
184
183
  #### Parameter notation
185
184
 
186
- ### Template
185
+ ### Task
186
+
187
+ ### Task type
187
188
 
188
189
  Todo todo
189
190
 
@@ -244,6 +245,11 @@ Or you can install them separately:
244
245
 
245
246
  ## 📚 Dictionary
246
247
 
248
+
249
+
250
+
251
+
252
+
247
253
  ### 📚 Dictionary
248
254
 
249
255
  The following glossary is used to clarify certain concepts:
@@ -259,6 +265,8 @@ The following glossary is used to clarify certain concepts:
259
265
  - **Retrieval-augmented generation** is a machine learning paradigm where a model generates text by retrieving relevant information from a large database of text. This approach combines the benefits of generative models and retrieval models.
260
266
  - **Longtail** refers to non-common or rare events, items, or entities that are not well-represented in the training data of machine learning models. Longtail items are often challenging for models to predict accurately.
261
267
 
268
+
269
+
262
270
  _Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
263
271
 
264
272
  #### Promptbook core
@@ -295,7 +303,7 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
295
303
 
296
304
  - [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
297
305
  - [📯 Pipeline](https://github.com/webgptorg/promptbook/discussions/64)
298
- - [🎺 Pipeline templates](https://github.com/webgptorg/promptbook/discussions/88)
306
+ - [🙇‍♂️ Tasks and pipeline sections](https://github.com/webgptorg/promptbook/discussions/88)
299
307
  - [🤼 Personas](https://github.com/webgptorg/promptbook/discussions/22)
300
308
  - [⭕ Parameters](https://github.com/webgptorg/promptbook/discussions/83)
301
309
  - [🚀 Pipeline execution](https://github.com/webgptorg/promptbook/discussions/84)
@@ -319,6 +327,8 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
319
327
  - [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
320
328
  - [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
321
329
 
330
+
331
+
322
332
  ### Terms specific to Promptbook TypeScript implementation
323
333
 
324
334
  - Anonymous mode
package/esm/index.es.js CHANGED
@@ -23,7 +23,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
23
23
  *
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- var PROMPTBOOK_ENGINE_VERSION = '0.75.0-1';
26
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.0-3';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -400,7 +400,7 @@ var DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [🤹‍♂️]
400
400
  *
401
401
  * @public exported from `@promptbook/core`
402
402
  */
403
- var DEFAULT_SCRAPE_CACHE_DIRNAME = '/.promptbook/scrape-cache';
403
+ var DEFAULT_SCRAPE_CACHE_DIRNAME = './.promptbook/scrape-cache';
404
404
  /**
405
405
  * Nonce which is used for replacing things in strings
406
406
  *
@@ -1231,7 +1231,7 @@ function getScraperIntermediateSource(source, options) {
1231
1231
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
1232
1232
  */
1233
1233
 
1234
- 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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.book.md"},{title:"Prepare 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- Title should be concise and clear\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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.book.md"}];
1234
+ 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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare 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- Title should be concise and clear\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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-persona.book.md"}];
1235
1235
 
1236
1236
  /**
1237
1237
  * Prettify the html code
@@ -1306,7 +1306,7 @@ function pipelineJsonToString(pipelineJson) {
1306
1306
  return isInput;
1307
1307
  })), _h = _g.next(); !_h.done; _h = _g.next()) {
1308
1308
  var parameter = _h.value;
1309
- commands.push("INPUT PARAMETER ".concat(templateParameterJsonToString(parameter)));
1309
+ commands.push("INPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
1310
1310
  }
1311
1311
  }
1312
1312
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -1322,7 +1322,7 @@ function pipelineJsonToString(pipelineJson) {
1322
1322
  return isOutput;
1323
1323
  })), _k = _j.next(); !_k.done; _k = _j.next()) {
1324
1324
  var parameter = _k.value;
1325
- commands.push("OUTPUT PARAMETER ".concat(templateParameterJsonToString(parameter)));
1325
+ commands.push("OUTPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
1326
1326
  }
1327
1327
  }
1328
1328
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -1336,12 +1336,12 @@ function pipelineJsonToString(pipelineJson) {
1336
1336
  pipelineString += commands.map(function (command) { return "- ".concat(command); }).join('\n');
1337
1337
  try {
1338
1338
  for (var tasks_1 = __values(tasks), tasks_1_1 = tasks_1.next(); !tasks_1_1.done; tasks_1_1 = tasks_1.next()) {
1339
- var template = tasks_1_1.value;
1339
+ var task = tasks_1_1.value;
1340
1340
  var
1341
1341
  /* Note: Not using:> name, */
1342
- title_1 = template.title, description_1 = template.description,
1342
+ title_1 = task.title, description_1 = task.description,
1343
1343
  /* Note: dependentParameterNames, */
1344
- jokers = template.jokerParameterNames, taskType = template.taskType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
1344
+ jokers = task.jokerParameterNames, taskType = task.taskType, content = task.content, postprocessing = task.postprocessingFunctionNames, expectations = task.expectations, format = task.format, resultingParameterName = task.resultingParameterName;
1345
1345
  pipelineString += '\n\n';
1346
1346
  pipelineString += "## ".concat(title_1);
1347
1347
  if (description_1) {
@@ -1351,9 +1351,10 @@ function pipelineJsonToString(pipelineJson) {
1351
1351
  var commands_1 = [];
1352
1352
  var contentLanguage = 'text';
1353
1353
  if (taskType === 'PROMPT_TASK') {
1354
- var modelRequirements = template.modelRequirements;
1354
+ var modelRequirements = task.modelRequirements;
1355
1355
  var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
1356
- commands_1.push("EXECUTE PROMPT TEMPLATE");
1356
+ // Note: Do nothing, it is default
1357
+ // commands.push(`PROMPT`);
1357
1358
  if (modelVariant) {
1358
1359
  commands_1.push("MODEL VARIANT ".concat(capitalize(modelVariant)));
1359
1360
  }
@@ -1366,16 +1367,16 @@ function pipelineJsonToString(pipelineJson) {
1366
1367
  // Note: Nothing special here
1367
1368
  }
1368
1369
  else if (taskType === 'SCRIPT_TASK') {
1369
- commands_1.push("SCRIPT TEMPLATE");
1370
- if (template.contentLanguage) {
1371
- contentLanguage = template.contentLanguage;
1370
+ commands_1.push("SCRIPT");
1371
+ if (task.contentLanguage) {
1372
+ contentLanguage = task.contentLanguage;
1372
1373
  }
1373
1374
  else {
1374
1375
  contentLanguage = '';
1375
1376
  }
1376
1377
  }
1377
1378
  else if (taskType === 'DIALOG_TASK') {
1378
- commands_1.push("DIALOG TEMPLATE");
1379
+ commands_1.push("DIALOG");
1379
1380
  // Note: Nothing special here
1380
1381
  } // <- }else if([🅱]
1381
1382
  if (jokers) {
@@ -1450,7 +1451,7 @@ function pipelineJsonToString(pipelineJson) {
1450
1451
  pipelineString += '\n';
1451
1452
  pipelineString += '```';
1452
1453
  pipelineString += '\n\n';
1453
- pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use templateParameterJsonToString
1454
+ pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use taskParameterJsonToString
1454
1455
  }
1455
1456
  }
1456
1457
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -1465,8 +1466,8 @@ function pipelineJsonToString(pipelineJson) {
1465
1466
  /**
1466
1467
  * @private internal utility of `pipelineJsonToString`
1467
1468
  */
1468
- function templateParameterJsonToString(templateParameterJson) {
1469
- var name = templateParameterJson.name, description = templateParameterJson.description;
1469
+ function taskParameterJsonToString(taskParameterJson) {
1470
+ var name = taskParameterJson.name, description = taskParameterJson.description;
1470
1471
  var parameterString = "{".concat(name, "}");
1471
1472
  if (description) {
1472
1473
  parameterString = "".concat(parameterString, " ").concat(description);
@@ -1474,7 +1475,7 @@ function templateParameterJsonToString(templateParameterJson) {
1474
1475
  return parameterString;
1475
1476
  }
1476
1477
  /**
1477
- * TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `templateParameterJsonToString` , use `stringifyCommand`
1478
+ * TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `taskParameterJsonToString` , use `stringifyCommand`
1478
1479
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
1479
1480
  * TODO: [🏛] Maybe make some markdown builder
1480
1481
  * TODO: [🏛] Escape all
@@ -1843,20 +1844,20 @@ function validatePipelineCore(pipeline) {
1843
1844
  }
1844
1845
  finally { if (e_3) throw e_3.error; }
1845
1846
  }
1846
- var unresovedTemplates = __spreadArray([], __read(pipeline.tasks), false);
1847
+ var unresovedTasks = __spreadArray([], __read(pipeline.tasks), false);
1847
1848
  var loopLimit = LOOP_LIMIT;
1848
1849
  var _loop_3 = function () {
1849
1850
  if (loopLimit-- < 0) {
1850
1851
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1851
1852
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Loop limit reached during detection of circular dependencies in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
1852
1853
  }
1853
- var currentlyResovedTemplates = unresovedTemplates.filter(function (task) {
1854
+ var currentlyResovedTasks = unresovedTasks.filter(function (task) {
1854
1855
  return task.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1855
1856
  });
1856
- if (currentlyResovedTemplates.length === 0) {
1857
+ if (currentlyResovedTasks.length === 0) {
1857
1858
  throw new PipelineLogicError(
1858
1859
  // TODO: [🐎] DRY
1859
- spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates
1860
+ spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTasks
1860
1861
  .map(function (_a) {
1861
1862
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
1862
1863
  return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
@@ -1875,13 +1876,13 @@ function validatePipelineCore(pipeline) {
1875
1876
  .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
1876
1877
  .join('\n')), "\n\n\n "); }));
1877
1878
  }
1878
- resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
1879
+ resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTasks.map(function (_a) {
1879
1880
  var resultingParameterName = _a.resultingParameterName;
1880
1881
  return resultingParameterName;
1881
1882
  })), false);
1882
- unresovedTemplates = unresovedTemplates.filter(function (task) { return !currentlyResovedTemplates.includes(task); });
1883
+ unresovedTasks = unresovedTasks.filter(function (task) { return !currentlyResovedTasks.includes(task); });
1883
1884
  };
1884
- while (unresovedTemplates.length > 0) {
1885
+ while (unresovedTasks.length > 0) {
1885
1886
  _loop_3();
1886
1887
  }
1887
1888
  // TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
@@ -1943,7 +1944,7 @@ var PipelineUrlError = /** @class */ (function (_super) {
1943
1944
  /**
1944
1945
  * Parses the task and returns the list of all parameter names
1945
1946
  *
1946
- * @param template the task with parameters in {curly} braces
1947
+ * @param template the string template with parameters in {curly} braces
1947
1948
  * @returns the list of parameter names
1948
1949
  * @public exported from `@promptbook/utils`
1949
1950
  */
@@ -1977,13 +1978,13 @@ function unpreparePipeline(pipeline) {
1977
1978
  var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, tasks = pipeline.tasks;
1978
1979
  personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
1979
1980
  knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
1980
- tasks = tasks.map(function (template) {
1981
- var dependentParameterNames = template.dependentParameterNames;
1982
- var parameterNames = extractParameterNames(template.preparedContent || '');
1981
+ tasks = tasks.map(function (task) {
1982
+ var dependentParameterNames = task.dependentParameterNames;
1983
+ var parameterNames = extractParameterNames(task.preparedContent || '');
1983
1984
  dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
1984
- var templateUnprepared = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames });
1985
- delete templateUnprepared.preparedContent;
1986
- return templateUnprepared;
1985
+ var taskUnprepared = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames });
1986
+ delete taskUnprepared.preparedContent;
1987
+ return taskUnprepared;
1987
1988
  });
1988
1989
  return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1989
1990
  }
@@ -2276,7 +2277,7 @@ function isPipelinePrepared(pipeline) {
2276
2277
  * TODO: [🐠] Maybe base this on `makeValidator`
2277
2278
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2278
2279
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2279
- * - [🏍] ? Is context in each template
2280
+ * - [🏍] ? Is context in each task
2280
2281
  * - [♨] Are examples prepared
2281
2282
  * - [♨] Are tasks prepared
2282
2283
  */
@@ -3588,10 +3589,10 @@ function prepareTasks(pipeline, tools, options) {
3588
3589
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
3589
3590
  tasks = pipeline.tasks, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
3590
3591
  tasksPrepared = new Array(tasks.length);
3591
- return [4 /*yield*/, forEachAsync(tasks, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (template, index) { return __awaiter(_this, void 0, void 0, function () {
3592
- var dependentParameterNames, preparedContent, preparedTemplate;
3592
+ return [4 /*yield*/, forEachAsync(tasks, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (task, index) { return __awaiter(_this, void 0, void 0, function () {
3593
+ var dependentParameterNames, preparedContent, preparedTask;
3593
3594
  return __generator(this, function (_a) {
3594
- dependentParameterNames = template.dependentParameterNames;
3595
+ dependentParameterNames = task.dependentParameterNames;
3595
3596
  preparedContent = undefined;
3596
3597
  if (knowledgePiecesCount > 0 && !dependentParameterNames.includes('knowledge')) {
3597
3598
  preparedContent = spaceTrim("\n {content}\n\n ## Knowledge\n\n {knowledge}\n ");
@@ -3600,8 +3601,8 @@ function prepareTasks(pipeline, tools, options) {
3600
3601
  'knowledge',
3601
3602
  ], false);
3602
3603
  }
3603
- preparedTemplate = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
3604
- tasksPrepared[index] = preparedTemplate;
3604
+ preparedTask = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
3605
+ tasksPrepared[index] = preparedTask;
3605
3606
  return [2 /*return*/];
3606
3607
  });
3607
3608
  }); })];
@@ -3613,8 +3614,8 @@ function prepareTasks(pipeline, tools, options) {
3613
3614
  });
3614
3615
  }
3615
3616
  /**
3616
- * TODO: [🧠] Add context to each template (if missing)
3617
- * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
3617
+ * TODO: [🧠] Add context to each task (if missing)
3618
+ * TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
3618
3619
  * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
3619
3620
  * TODO: Write tests for `preparePipeline`
3620
3621
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
@@ -3700,7 +3701,7 @@ function preparePipeline(pipeline, tools, options) {
3700
3701
  })];
3701
3702
  case 3:
3702
3703
  tasksPrepared = (_c.sent()).tasksPrepared;
3703
- // ----- /Templates preparation -----
3704
+ // ----- /Tasks preparation -----
3704
3705
  // Note: Count total usage
3705
3706
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
3706
3707
  return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
@@ -3769,16 +3770,16 @@ function extractVariables(script) {
3769
3770
  */
3770
3771
 
3771
3772
  /**
3772
- * Parses the template and returns the set of all used parameters
3773
+ * Parses the task and returns the set of all used parameters
3773
3774
  *
3774
- * @param template the template with used parameters
3775
+ * @param task the task with used parameters
3775
3776
  * @returns the set of parameter names
3776
3777
  * @throws {ParseError} if the script is invalid
3777
3778
  * @public exported from `@promptbook/utils`
3778
3779
  */
3779
- function extractParameterNamesFromTask(template) {
3780
+ function extractParameterNamesFromTask(task) {
3780
3781
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
3781
- var title = template.title, description = template.description, taskType = template.taskType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
3782
+ var title = task.title, description = task.description, taskType = task.taskType, content = task.content, preparedContent = task.preparedContent, jokerParameterNames = task.jokerParameterNames, foreach = task.foreach;
3782
3783
  var parameterNames = new Set();
3783
3784
  try {
3784
3785
  for (var _e = __values(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(extractParameterNames(title)), false), __read(extractParameterNames(description || '')), false), __read(extractParameterNames(content)), false), __read(extractParameterNames(preparedContent || '')), false)), _f = _e.next(); !_f.done; _f = _e.next()) {