@promptbook/cli 0.74.0-11 → 0.74.0-13

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 CHANGED
@@ -70,7 +70,7 @@ import { OpenAiExecutionTools } from '@promptbook/openai';
70
70
 
71
71
  // ▶ Get single Pipeline
72
72
  const promptbook = await getPipelineCollection().getPipelineByUrl(
73
- `https://promptbook.studio/my-collection/write-article.ptbk.md`,
73
+ `https://promptbook.studio/my-collection/write-article.book.md`,
74
74
  );
75
75
 
76
76
  // ▶ Create executor - the function that will execute the Pipeline
@@ -97,7 +97,7 @@ There is also a javascript and json format available.
97
97
  ## Prettify
98
98
 
99
99
  ```bash
100
- npx ptbk prettify promptbook/**/*.ptbk.md
100
+ npx ptbk prettify promptbook/**/*.book.md
101
101
  ```
102
102
 
103
103
  This will prettify all promptbooks in `promptbook` directory and adds Mermaid graphs to them.
@@ -205,7 +205,7 @@ Following is the documentation and blueprint of the Book language.
205
205
 
206
206
  File is designed to be easy to read and write. It is strict subset of markdown. It is designed to be understandable by both humans and machines and without specific knowledge of the language.
207
207
 
208
- It has file with `.ptbk.md` or `.book` extension with `UTF-8` non BOM encoding.
208
+ It has file with `.book.md` or `.book` extension with `UTF-8` non BOM encoding.
209
209
 
210
210
  As it is source code, it can leverage all the features of version control systems like git and does not suffer from the problems of binary formats, proprietary formats, or no-code solutions.
211
211
 
@@ -298,11 +298,6 @@ Or you can install them separately:
298
298
 
299
299
  ## 📚 Dictionary
300
300
 
301
-
302
-
303
-
304
-
305
-
306
301
  ### 📚 Dictionary
307
302
 
308
303
  The following glossary is used to clarify certain concepts:
@@ -318,8 +313,6 @@ The following glossary is used to clarify certain concepts:
318
313
  - **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.
319
314
  - **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.
320
315
 
321
-
322
-
323
316
  _Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
324
317
 
325
318
  #### Promptbook core
@@ -380,8 +373,6 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
380
373
  - [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
381
374
  - [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
382
375
 
383
-
384
-
385
376
  ### Terms specific to Promptbook TypeScript implementation
386
377
 
387
378
  - Anonymous mode
@@ -1,8 +1,5 @@
1
1
  #!/usr/bin/env node
2
-
3
- // Disable deprecation warnings programmatically
4
- process.noDeprecation = true;
5
- // <- TODO: !!!!!! Is this try to get rid of deprecation warnings in node v23.2.0 working?
2
+ // <- TODO: !!!!!! Ensure correct version of Node.js is used
6
3
 
7
4
  // eslint-disable-next-line @typescript-eslint/no-var-requires
8
5
  const { _CLI } = require('../umd/index.umd.js');
package/esm/index.es.js CHANGED
@@ -37,7 +37,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
37
37
  *
38
38
  * @see https://github.com/webgptorg/promptbook
39
39
  */
40
- var PROMPTBOOK_ENGINE_VERSION = '0.74.0-10';
40
+ var PROMPTBOOK_ENGINE_VERSION = '0.74.0-12';
41
41
  /**
42
42
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
43
43
  */
@@ -716,13 +716,13 @@ function capitalize(word) {
716
716
  /**
717
717
  * Converts promptbook in JSON format to string format
718
718
  *
719
- * @param pipelineJson Promptbook in JSON format (.ptbk.json)
720
- * @returns Promptbook in string format (.ptbk.md)
719
+ * @param pipelineJson Promptbook in JSON format (.book.json)
720
+ * @returns Promptbook in string format (.book.md)
721
721
  * @public exported from `@promptbook/core`
722
722
  */
723
723
  function pipelineJsonToString(pipelineJson) {
724
724
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
725
- var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, promptbookVersion = pipelineJson.promptbookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
725
+ var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
726
726
  var pipelineString = "# ".concat(title);
727
727
  if (description) {
728
728
  pipelineString += '\n\n';
@@ -732,8 +732,10 @@ function pipelineJsonToString(pipelineJson) {
732
732
  if (pipelineUrl) {
733
733
  commands.push("PIPELINE URL ".concat(pipelineUrl));
734
734
  }
735
- commands.push("PROMPTBOOK VERSION ".concat(promptbookVersion));
736
- // TODO: [main] !!! This increase size of the bundle and is probbably not necessary
735
+ if (bookVersion !== "undefined") {
736
+ commands.push("BOOK VERSION ".concat(bookVersion));
737
+ }
738
+ // TODO: [main] !!!!!! This increase size of the bundle and is probbably not necessary
737
739
  pipelineString = prettifyMarkdown(pipelineString);
738
740
  try {
739
741
  for (var _g = __values(parameters.filter(function (_a) {
@@ -913,7 +915,7 @@ function templateParameterJsonToString(templateParameterJson) {
913
915
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
914
916
  * TODO: [🏛] Maybe make some markdown builder
915
917
  * TODO: [🏛] Escape all
916
- * TODO: [🧠] Should be in generated .ptbk.md file GENERATOR_WARNING
918
+ * TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
917
919
  */
918
920
 
919
921
  /**
@@ -1551,7 +1553,7 @@ function joinLlmExecutionTools() {
1551
1553
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
1552
1554
  */
1553
1555
 
1554
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",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}],templates:[{templateType:"PROMPT_TEMPLATE",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.ptbk.md"}];
1556
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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",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}],templates:[{templateType:"PROMPT_TEMPLATE",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"}];
1555
1557
 
1556
1558
  /**
1557
1559
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -1726,7 +1728,7 @@ function isValidPipelineUrl(url) {
1726
1728
  if (!url.startsWith('https://')) {
1727
1729
  return false;
1728
1730
  }
1729
- if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.ptbk.md') || url.endsWith('.ptbk'))) {
1731
+ if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.book.md') || url.endsWith('.ptbk'))) {
1730
1732
  return false;
1731
1733
  }
1732
1734
  if (url.includes('#')) {
@@ -1795,9 +1797,9 @@ function validatePipelineCore(pipeline) {
1795
1797
  // <- Note: [🚲]
1796
1798
  throw new PipelineLogicError(spaceTrim(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
1797
1799
  }
1798
- if (pipeline.promptbookVersion !== undefined && !isValidPromptbookVersion(pipeline.promptbookVersion)) {
1800
+ if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
1799
1801
  // <- Note: [🚲]
1800
- throw new PipelineLogicError(spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.promptbookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
1802
+ throw new PipelineLogicError(spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.bookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
1801
1803
  }
1802
1804
  // TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
1803
1805
  if (!Array.isArray(pipeline.parameters)) {
@@ -3751,7 +3753,7 @@ function executeAttempts(options) {
3751
3753
  promptTitle: template.title,
3752
3754
  promptMessage: replaceParameters(template.description || '', parameters),
3753
3755
  defaultValue: replaceParameters(preparedContent, parameters),
3754
- // TODO: [🧠] !! Figure out how to define placeholder in .ptbk.md file
3756
+ // TODO: [🧠] !! Figure out how to define placeholder in .book.md file
3755
3757
  placeholder: undefined,
3756
3758
  priority: priority,
3757
3759
  }))];
@@ -4317,7 +4319,7 @@ function executePipeline(options) {
4317
4319
  pipelineUrl: preparedPipeline.pipelineUrl,
4318
4320
  title: preparedPipeline.title,
4319
4321
  promptbookUsedVersion: PROMPTBOOK_ENGINE_VERSION,
4320
- promptbookRequestedVersion: preparedPipeline.promptbookVersion,
4322
+ promptbookRequestedVersion: preparedPipeline.bookVersion,
4321
4323
  description: preparedPipeline.description,
4322
4324
  promptExecutions: [],
4323
4325
  };
@@ -4666,7 +4668,7 @@ function preparePersona(personaDescription, tools, options) {
4666
4668
  collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
4667
4669
  _b = createPipelineExecutor;
4668
4670
  _c = {};
4669
- return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.ptbk.md')];
4671
+ return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book.md')];
4670
4672
  case 1:
4671
4673
  preparePersonaExecutor = _b.apply(void 0, [(_c.pipeline = _d.sent(),
4672
4674
  _c.tools = tools,
@@ -5423,12 +5425,12 @@ TODO: [🧊] This is how it can look in future
5423
5425
  */
5424
5426
  function clonePipeline(pipeline) {
5425
5427
  // Note: Not using spread operator (...) because @@@
5426
- var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, promptbookVersion = pipeline.promptbookVersion, description = pipeline.description, parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
5428
+ var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
5427
5429
  return {
5428
5430
  pipelineUrl: pipelineUrl,
5429
5431
  sourceFile: sourceFile,
5430
5432
  title: title,
5431
- promptbookVersion: promptbookVersion,
5433
+ bookVersion: bookVersion,
5432
5434
  description: description,
5433
5435
  parameters: parameters,
5434
5436
  templates: templates,
@@ -5640,7 +5642,7 @@ var knowledgeCommandParser = {
5640
5642
  throw new ParseError("Source not valid");
5641
5643
  }
5642
5644
  if (sourceContent.startsWith('../') || sourceContent.startsWith('/') || /^[A-Z]:[\\/]+/i.test(sourceContent)) {
5643
- throw new ParseError("Source cannot be outside of the .ptbk.md folder");
5645
+ throw new ParseError("Source cannot be outside of the .book.md folder");
5644
5646
  }
5645
5647
  return {
5646
5648
  type: 'KNOWLEDGE',
@@ -6290,7 +6292,7 @@ function validateParameterName(parameterName) {
6290
6292
  /**
6291
6293
  * Parses the foreach command
6292
6294
  *
6293
- * Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.ptbk.md` file
6295
+ * Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book.md` file
6294
6296
  *
6295
6297
  * @see `documentationUrl` for more details
6296
6298
  * @private within the commands folder
@@ -6440,7 +6442,7 @@ var foreachCommandParser = {
6440
6442
  },
6441
6443
  };
6442
6444
  /**
6443
- * TODO: [🍭] Make .ptbk.md file with examples of the FOREACH with wrong parsing and logic
6445
+ * TODO: [🍭] Make .book.md file with examples of the FOREACH with wrong parsing and logic
6444
6446
  */
6445
6447
 
6446
6448
  /**
@@ -7074,7 +7076,7 @@ var bookVersionCommandParser = {
7074
7076
  /**
7075
7077
  * Description of the BOOK_VERSION command
7076
7078
  */
7077
- description: "Which version of the Book language is the .ptbk.md using",
7079
+ description: "Which version of the Book language is the .book.md using",
7078
7080
  /**
7079
7081
  * Link to documentation
7080
7082
  */
@@ -7088,19 +7090,19 @@ var bookVersionCommandParser = {
7088
7090
  */
7089
7091
  parse: function (input) {
7090
7092
  var args = input.args;
7091
- var promptbookVersion = args.pop();
7092
- if (promptbookVersion === undefined) {
7093
+ var bookVersion = args.pop();
7094
+ if (bookVersion === undefined) {
7093
7095
  throw new ParseError("Version is required");
7094
7096
  }
7095
- if (!isValidPromptbookVersion(promptbookVersion)) {
7096
- throw new ParseError("Invalid Promptbook version \"".concat(promptbookVersion, "\""));
7097
+ if (!isValidPromptbookVersion(bookVersion)) {
7098
+ throw new ParseError("Invalid Promptbook version \"".concat(bookVersion, "\""));
7097
7099
  }
7098
7100
  if (args.length > 0 && !(((args.length === 1 && args[0]) || '').toUpperCase() === 'VERSION')) {
7099
7101
  throw new ParseError("Can not have more than one Promptbook version");
7100
7102
  }
7101
7103
  return {
7102
7104
  type: 'BOOK_VERSION',
7103
- promptbookVersion: promptbookVersion,
7105
+ bookVersion: bookVersion,
7104
7106
  };
7105
7107
  },
7106
7108
  /**
@@ -7110,7 +7112,7 @@ var bookVersionCommandParser = {
7110
7112
  */
7111
7113
  $applyToPipelineJson: function (command, $pipelineJson) {
7112
7114
  // TODO: Warn if the version is overridden
7113
- $pipelineJson.promptbookVersion = command.promptbookVersion;
7115
+ $pipelineJson.bookVersion = command.bookVersion;
7114
7116
  },
7115
7117
  /**
7116
7118
  * Converts the BOOK_VERSION command back to string
@@ -7163,9 +7165,9 @@ var urlCommandParser = {
7163
7165
  * Example usages of the URL command
7164
7166
  */
7165
7167
  examples: [
7166
- 'PIPELINE URL https://promptbook.studio/library/write-cv.ptbk.md',
7167
- 'URL https://promptbook.studio/library/write-cv.ptbk.md',
7168
- 'https://promptbook.studio/library/write-cv.ptbk.md',
7168
+ 'PIPELINE URL https://promptbook.studio/library/write-cv.book.md',
7169
+ 'URL https://promptbook.studio/library/write-cv.book.md',
7170
+ 'https://promptbook.studio/library/write-cv.book.md',
7169
7171
  ],
7170
7172
  /**
7171
7173
  * Parses the URL command
@@ -7366,7 +7368,7 @@ var instrumentCommandParser = {
7366
7368
  /**
7367
7369
  * Parses the boilerplate command
7368
7370
  *
7369
- * Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.ptbk.md` file
7371
+ * Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book.md` file
7370
7372
  *
7371
7373
  * @see `documentationUrl` for more details
7372
7374
  * @private within the commands folder
@@ -7420,7 +7422,7 @@ var boilerplateCommandParser = {
7420
7422
  * Note: `$` is used to indicate that this function mutates given `pipelineJson`
7421
7423
  */
7422
7424
  $applyToPipelineJson: function (command, $pipelineJson) {
7423
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7425
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7424
7426
  },
7425
7427
  /**
7426
7428
  * Apply the BOILERPLATE command to the `pipelineJson`
@@ -7428,7 +7430,7 @@ var boilerplateCommandParser = {
7428
7430
  * Note: `$` is used to indicate that this function mutates given `templateJson`
7429
7431
  */
7430
7432
  $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
7431
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7433
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7432
7434
  },
7433
7435
  /**
7434
7436
  * Converts the BOILERPLATE command back to string
@@ -7444,7 +7446,7 @@ var boilerplateCommandParser = {
7444
7446
  * Note: This is used in `pipelineJsonToString` utility
7445
7447
  */
7446
7448
  takeFromPipelineJson: function (pipelineJson) {
7447
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7449
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7448
7450
  },
7449
7451
  /**
7450
7452
  * Reads the BOILERPLATE command from the `TemplateJson`
@@ -7452,7 +7454,7 @@ var boilerplateCommandParser = {
7452
7454
  * Note: This is used in `pipelineJsonToString` utility
7453
7455
  */
7454
7456
  takeFromTemplateJson: function ($templateJson) {
7455
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7457
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7456
7458
  },
7457
7459
  };
7458
7460
 
@@ -7928,8 +7930,8 @@ function titleToName(value) {
7928
7930
  * Note: This function does not validate logic of the pipeline only the parsing
7929
7931
  * Note: This function acts as compilation process
7930
7932
  *
7931
- * @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
7932
- * @returns {Promptbook} compiled in JSON format (.ptbk.json)
7933
+ * @param pipelineString {Promptbook} in string markdown format (.book.md)
7934
+ * @returns {Promptbook} compiled in JSON format (.book.json)
7933
7935
  * @throws {ParseError} if the promptbook string is not valid
7934
7936
  * @public exported from `@promptbook/core`
7935
7937
  */
@@ -7938,7 +7940,7 @@ function pipelineStringToJsonSync(pipelineString) {
7938
7940
  var $pipelineJson = {
7939
7941
  title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
7940
7942
  pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
7941
- promptbookVersion: undefined /* <- Note: By default no explicit version */,
7943
+ bookVersion: undefined /* <- Note: By default no explicit version */,
7942
7944
  description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
7943
7945
  parameters: [],
7944
7946
  templates: [],
@@ -8321,10 +8323,10 @@ function pipelineStringToJsonSync(pipelineString) {
8321
8323
  * Note: This function does not validate logic of the pipeline only the parsing
8322
8324
  * Note: This function acts as compilation process
8323
8325
  *
8324
- * @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
8326
+ * @param pipelineString {Promptbook} in string markdown format (.book.md)
8325
8327
  * @param tools - Tools for the preparation and scraping - if not provided together with `llm`, the preparation will be skipped
8326
8328
  * @param options - Options and tools for the compilation
8327
- * @returns {Promptbook} compiled in JSON format (.ptbk.json)
8329
+ * @returns {Promptbook} compiled in JSON format (.book.json)
8328
8330
  * @throws {ParseError} if the promptbook string is not valid
8329
8331
  * @public exported from `@promptbook/core`
8330
8332
  */
@@ -9696,13 +9698,13 @@ function createCollectionFromDirectory(path, tools, options) {
9696
9698
  return [4 /*yield*/, listAllFiles(path, isRecursive, tools.fs)];
9697
9699
  case 1:
9698
9700
  fileNames = _b.sent();
9699
- // Note: First load all .ptbk.json and then .ptbk.md files
9700
- // .ptbk.json can be prepared so it is faster to load
9701
+ // Note: First load all .book.json and then .book.md files
9702
+ // .book.json can be prepared so it is faster to load
9701
9703
  fileNames.sort(function (a, b) {
9702
- if (a.endsWith('.ptbk.json') && b.endsWith('.ptbk.md')) {
9704
+ if (a.endsWith('.book.json') && b.endsWith('.book.md')) {
9703
9705
  return -1;
9704
9706
  }
9705
- if (a.endsWith('.ptbk.md') && b.endsWith('.ptbk.json')) {
9707
+ if (a.endsWith('.book.md') && b.endsWith('.book.json')) {
9706
9708
  return 1;
9707
9709
  }
9708
9710
  return 0;
@@ -9719,7 +9721,7 @@ function createCollectionFromDirectory(path, tools, options) {
9719
9721
  case 1:
9720
9722
  _e.trys.push([1, 8, , 9]);
9721
9723
  pipeline = null;
9722
- if (!fileName.endsWith('.ptbk.md')) return [3 /*break*/, 4];
9724
+ if (!fileName.endsWith('.book.md')) return [3 /*break*/, 4];
9723
9725
  return [4 /*yield*/, readFile(fileName, 'utf-8')];
9724
9726
  case 2:
9725
9727
  pipelineString = (_e.sent());
@@ -9731,7 +9733,7 @@ function createCollectionFromDirectory(path, tools, options) {
9731
9733
  pipeline = __assign(__assign({}, pipeline), { sourceFile: sourceFile });
9732
9734
  return [3 /*break*/, 7];
9733
9735
  case 4:
9734
- if (!fileName.endsWith('.ptbk.json')) return [3 /*break*/, 6];
9736
+ if (!fileName.endsWith('.book.json')) return [3 /*break*/, 6];
9735
9737
  _d = (_c = JSON).parse;
9736
9738
  return [4 /*yield*/, readFile(fileName, 'utf-8')];
9737
9739
  case 5:
@@ -9899,7 +9901,7 @@ function stringifyPipelineJson(pipeline) {
9899
9901
  return pipelineJsonStringified;
9900
9902
  }
9901
9903
  /**
9902
- * TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.ptbk.md
9904
+ * TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book.md
9903
9905
  * TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
9904
9906
  * TODO: [🧠] Maybe more elegant solution than replacing via regex
9905
9907
  * TODO: [🍙] Make some standard order of json properties
@@ -10629,7 +10631,7 @@ function prettifyPipelineString(pipelineString, options) {
10629
10631
  function initializePrettifyCommand(program) {
10630
10632
  var _this = this;
10631
10633
  var prettifyCommand = program.command('prettify');
10632
- prettifyCommand.description(spaceTrim$1("\n Iterates over `.ptbk.md` files and does multiple enhancing operations on them:\n\n 1) Adds Mermaid graph\n 2) Prettifies the markdown\n "));
10634
+ prettifyCommand.description(spaceTrim$1("\n Iterates over `.book.md` files and does multiple enhancing operations on them:\n\n 1) Adds Mermaid graph\n 2) Prettifies the markdown\n "));
10633
10635
  prettifyCommand.argument('<filesGlob>',
10634
10636
  // <- TODO: [🧟‍♂️] Unite path to promptbook collection argument
10635
10637
  'Pipelines to prettify as glob pattern');
@@ -10653,7 +10655,7 @@ function initializePrettifyCommand(program) {
10653
10655
  case 3:
10654
10656
  if (!!filenames_1_1.done) return [3 /*break*/, 10];
10655
10657
  filename = filenames_1_1.value;
10656
- if (!filename.endsWith('.ptbk.md') && isVerbose) {
10658
+ if (!filename.endsWith('.book.md') && isVerbose) {
10657
10659
  console.info(colors.gray("Skipping ".concat(filename)));
10658
10660
  return [3 /*break*/, 9];
10659
10661
  }
@@ -11052,7 +11054,7 @@ function initializeRunCommand(program) {
11052
11054
  runCommand.description(spaceTrim$1("\n Runs a pipeline\n "));
11053
11055
  // TODO: [🧅] DRY command arguments
11054
11056
  runCommand.argument('<path>',
11055
- // <- Note: [🧟‍♂️] This is NOT promptbook collection directory BUT direct path to .ptbk.md file
11057
+ // <- Note: [🧟‍♂️] This is NOT promptbook collection directory BUT direct path to .book.md file
11056
11058
  'Path to book file');
11057
11059
  runCommand.option('-r, --reload', "Call LLM models even if same prompt with result is in the cache", false);
11058
11060
  runCommand.option('-v, --verbose', "Is output verbose", false);
@@ -11084,7 +11086,7 @@ function initializeRunCommand(program) {
11084
11086
  filePathRaw,
11085
11087
  "".concat(filePathRaw, ".md"),
11086
11088
  "".concat(filePathRaw, ".book.md"),
11087
- "".concat(filePathRaw, ".ptbk.md"),
11089
+ "".concat(filePathRaw, ".book.md"),
11088
11090
  ];
11089
11091
  _m.label = 1;
11090
11092
  case 1:
@@ -11322,7 +11324,7 @@ function initializeRunCommand(program) {
11322
11324
  function initializeTestCommand(program) {
11323
11325
  var _this = this;
11324
11326
  var testCommand = program.command('test');
11325
- testCommand.description(spaceTrim$1("\n Iterates over `.ptbk.md` and `.ptbk.json` and checks if they are parsable and logically valid\n "));
11327
+ testCommand.description(spaceTrim$1("\n Iterates over `.book.md` and `.book.json` and checks if they are parsable and logically valid\n "));
11326
11328
  testCommand.argument('<filesGlob>',
11327
11329
  // <- TODO: [🧟‍♂️] Unite path to promptbook collection argument
11328
11330
  'Pipelines to test as glob pattern');
@@ -11372,7 +11374,7 @@ function initializeTestCommand(program) {
11372
11374
  case 6:
11373
11375
  _f.trys.push([6, 13, , 14]);
11374
11376
  pipeline = void 0;
11375
- if (!filename.endsWith('.ptbk.md')) return [3 /*break*/, 9];
11377
+ if (!filename.endsWith('.book.md')) return [3 /*break*/, 9];
11376
11378
  return [4 /*yield*/, readFile(filename, 'utf-8')];
11377
11379
  case 7:
11378
11380
  pipelineMarkdown = (_f.sent());
@@ -11384,7 +11386,7 @@ function initializeTestCommand(program) {
11384
11386
  }
11385
11387
  _f.label = 9;
11386
11388
  case 9:
11387
- if (!filename.endsWith('.ptbk.json')) return [3 /*break*/, 11];
11389
+ if (!filename.endsWith('.book.json')) return [3 /*break*/, 11];
11388
11390
  _c = (_b = JSON).parse;
11389
11391
  return [4 /*yield*/, readFile(filename, 'utf-8')];
11390
11392
  case 10:
@@ -11471,7 +11473,7 @@ function promptbookCli() {
11471
11473
  });
11472
11474
  }
11473
11475
  /**
11474
- * TODO: [🧠] Maybe `run` command the default, instead of `ptbk run ./foo.ptbk.md` -> `ptbk ./foo.ptbk.md`
11476
+ * TODO: [🧠] Maybe `run` command the default, instead of `ptbk run ./foo.book.md` -> `ptbk ./foo.book.md`
11475
11477
  * TODO: [🥠] Do not export, its just for CLI script
11476
11478
  * TODO: [🕌] When more functionalities, rename
11477
11479
  * Note: 11:11
@@ -14039,7 +14041,7 @@ var MarkdownScraper = /** @class */ (function () {
14039
14041
  collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
14040
14042
  _d = createPipelineExecutor;
14041
14043
  _g = {};
14042
- return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md')];
14044
+ return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md')];
14043
14045
  case 1:
14044
14046
  prepareKnowledgeFromMarkdownExecutor = _d.apply(void 0, [(_g.pipeline = _k.sent(),
14045
14047
  _g.tools = {
@@ -14048,7 +14050,7 @@ var MarkdownScraper = /** @class */ (function () {
14048
14050
  _g)]);
14049
14051
  _e = createPipelineExecutor;
14050
14052
  _h = {};
14051
- return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md')];
14053
+ return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-title.book.md')];
14052
14054
  case 2:
14053
14055
  prepareTitleExecutor = _e.apply(void 0, [(_h.pipeline = _k.sent(),
14054
14056
  _h.tools = {
@@ -14057,7 +14059,7 @@ var MarkdownScraper = /** @class */ (function () {
14057
14059
  _h)]);
14058
14060
  _f = createPipelineExecutor;
14059
14061
  _j = {};
14060
- return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md')];
14062
+ return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md')];
14061
14063
  case 3:
14062
14064
  prepareKeywordsExecutor = _f.apply(void 0, [(_j.pipeline = _k.sent(),
14063
14065
  _j.tools = {