@promptbook/cli 0.61.0-13 → 0.61.0-14

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 (103) hide show
  1. package/esm/index.es.js +69 -32
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/types.index.d.ts +6 -3
  4. package/esm/typings/src/commands/MODEL/ModelCommand.d.ts +2 -2
  5. package/esm/typings/src/config.d.ts +4 -0
  6. package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +13 -0
  7. package/esm/typings/src/conversion/utils/stringifyPipelineJson.test.d.ts +1 -0
  8. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +10 -1
  9. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +1 -1
  10. package/esm/typings/src/execution/LlmExecutionTools.d.ts +7 -7
  11. package/esm/typings/src/execution/PipelineExecutor.d.ts +1 -1
  12. package/esm/typings/src/execution/PromptResult.d.ts +14 -56
  13. package/esm/typings/src/execution/PromptResultUsage.d.ts +26 -0
  14. package/esm/typings/src/execution/UncertainNumber.d.ts +18 -0
  15. package/esm/typings/src/execution/utils/addUsage.d.ts +1 -1
  16. package/esm/typings/src/execution/utils/computeUsageCounts.d.ts +1 -1
  17. package/esm/typings/src/execution/utils/uncertainNumber.d.ts +1 -1
  18. package/esm/typings/src/execution/utils/usageToWorktime.d.ts +2 -2
  19. package/esm/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +10 -2
  20. package/esm/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +2 -1
  21. package/esm/typings/src/llm-providers/_common/utils/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +1 -1
  22. package/esm/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +3 -3
  23. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -2
  24. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +4 -4
  25. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +4 -4
  26. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +6 -6
  27. package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +9 -7
  28. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +6 -6
  29. package/esm/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
  30. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +9 -7
  31. package/esm/typings/src/scripting/javascript/utils/unknownToString.d.ts +2 -1
  32. package/esm/typings/src/types/ModelRequirements.d.ts +53 -14
  33. package/esm/typings/src/types/ModelVariant.d.ts +14 -0
  34. package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +2 -4
  35. package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
  36. package/esm/typings/src/types/Prompt.d.ts +45 -1
  37. package/esm/typings/src/types/typeAliases.d.ts +11 -0
  38. package/esm/typings/src/utils/normalization/parseKeywords.d.ts +2 -1
  39. package/esm/typings/src/utils/organization/{TODO.d.ts → TODO_any.d.ts} +1 -1
  40. package/esm/typings/src/utils/organization/TODO_object.d.ts +6 -0
  41. package/esm/typings/src/utils/organization/TODO_unknown.d.ts +6 -0
  42. package/esm/typings/src/utils/organization/really_any.d.ts +1 -1
  43. package/esm/typings/src/utils/organization/really_unknown.d.ts +6 -0
  44. package/esm/typings/src/utils/validators/email/isValidEmail.d.ts +2 -1
  45. package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +2 -1
  46. package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +2 -1
  47. package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +2 -1
  48. package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +2 -1
  49. package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -1
  50. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +2 -1
  51. package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -1
  52. package/package.json +2 -2
  53. package/umd/index.umd.js +69 -32
  54. package/umd/index.umd.js.map +1 -1
  55. package/umd/typings/src/_packages/types.index.d.ts +6 -3
  56. package/umd/typings/src/commands/MODEL/ModelCommand.d.ts +2 -2
  57. package/umd/typings/src/config.d.ts +4 -0
  58. package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +13 -0
  59. package/umd/typings/src/conversion/utils/stringifyPipelineJson.test.d.ts +1 -0
  60. package/umd/typings/src/conversion/validation/_importPipeline.d.ts +10 -1
  61. package/umd/typings/src/conversion/validation/validatePipeline.d.ts +1 -1
  62. package/umd/typings/src/execution/LlmExecutionTools.d.ts +7 -7
  63. package/umd/typings/src/execution/PipelineExecutor.d.ts +1 -1
  64. package/umd/typings/src/execution/PromptResult.d.ts +14 -56
  65. package/umd/typings/src/execution/PromptResultUsage.d.ts +26 -0
  66. package/umd/typings/src/execution/UncertainNumber.d.ts +18 -0
  67. package/umd/typings/src/execution/utils/addUsage.d.ts +1 -1
  68. package/umd/typings/src/execution/utils/computeUsageCounts.d.ts +1 -1
  69. package/umd/typings/src/execution/utils/uncertainNumber.d.ts +1 -1
  70. package/umd/typings/src/execution/utils/usageToWorktime.d.ts +2 -2
  71. package/umd/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +10 -2
  72. package/umd/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +2 -1
  73. package/umd/typings/src/llm-providers/_common/utils/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +1 -1
  74. package/umd/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +3 -3
  75. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -2
  76. package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +4 -4
  77. package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +4 -4
  78. package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +6 -6
  79. package/umd/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +9 -7
  80. package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +6 -6
  81. package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
  82. package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +9 -7
  83. package/umd/typings/src/scripting/javascript/utils/unknownToString.d.ts +2 -1
  84. package/umd/typings/src/types/ModelRequirements.d.ts +53 -14
  85. package/umd/typings/src/types/ModelVariant.d.ts +14 -0
  86. package/umd/typings/src/types/PipelineJson/PersonaJson.d.ts +2 -4
  87. package/umd/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
  88. package/umd/typings/src/types/Prompt.d.ts +45 -1
  89. package/umd/typings/src/types/typeAliases.d.ts +11 -0
  90. package/umd/typings/src/utils/normalization/parseKeywords.d.ts +2 -1
  91. package/umd/typings/src/utils/organization/{TODO.d.ts → TODO_any.d.ts} +1 -1
  92. package/umd/typings/src/utils/organization/TODO_object.d.ts +6 -0
  93. package/umd/typings/src/utils/organization/TODO_unknown.d.ts +6 -0
  94. package/umd/typings/src/utils/organization/really_any.d.ts +1 -1
  95. package/umd/typings/src/utils/organization/really_unknown.d.ts +6 -0
  96. package/umd/typings/src/utils/validators/email/isValidEmail.d.ts +2 -1
  97. package/umd/typings/src/utils/validators/filePath/isValidFilePath.d.ts +2 -1
  98. package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +2 -1
  99. package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +2 -1
  100. package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +2 -1
  101. package/umd/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -1
  102. package/umd/typings/src/utils/validators/url/isValidUrl.d.ts +2 -1
  103. package/umd/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -1
package/umd/index.umd.js CHANGED
@@ -154,7 +154,7 @@
154
154
  /**
155
155
  * The version of the Promptbook library
156
156
  */
157
- var PROMPTBOOK_VERSION = '0.61.0-12';
157
+ var PROMPTBOOK_VERSION = '0.61.0-13';
158
158
  // TODO: !!!! List here all the versions and annotate + put into script
159
159
 
160
160
  /**
@@ -272,6 +272,10 @@
272
272
  // <- TODO: Add more like 'date', 'modelName',...
273
273
  // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
274
274
  ]);
275
+ /**
276
+ * Nonce which is used for replacing things in strings
277
+ */
278
+ var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
275
279
  /*
276
280
  TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
277
281
  */
@@ -469,7 +473,7 @@
469
473
  });
470
474
  }
471
475
 
472
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-12",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",personaName:null,modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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> {content}",resultingParameterName:"knowledge"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-12",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.61.0-12",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",personaName:null,modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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> {content}",resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-12",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.61.0-12",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",expectations:{words:{min:1,max:8}},personaName:null,modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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> {content}",resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-12",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.61.0-12",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}],promptTemplates:[{name:"make-model-requirements",title:"Make modelRequirements",dependentParameterNames:["availableModelNames","personaDescription"],blockType:"PROMPT_TEMPLATE",expectFormat:"JSON",personaName:null,modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\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### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `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### Option `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"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-12",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
476
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-13",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",personaName:null,modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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> {content}",resultingParameterName:"knowledge"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-13",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.61.0-13",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",personaName:null,modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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> {content}",resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-13",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.61.0-13",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",expectations:{words:{min:1,max:8}},personaName:null,modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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> {content}",resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-13",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.61.0-13",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}],promptTemplates:[{name:"make-model-requirements",title:"Make modelRequirements",dependentParameterNames:["availableModelNames","personaDescription"],blockType:"PROMPT_TEMPLATE",expectFormat:"JSON",personaName:null,modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\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### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `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### Option `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"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-13",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
473
477
 
474
478
  /**
475
479
  * Prettify the html code
@@ -1085,7 +1089,7 @@
1085
1089
  * > * It checks:
1086
1090
  * > * - it has a valid structure
1087
1091
  * > * - ...
1088
- * > ex port function validatePipeline(promptbook: unknown): asserts promptbook is PipelineJson {
1092
+ * > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
1089
1093
  */
1090
1094
  /**
1091
1095
  * TODO: [🧠][🐣] !!!! Validate that all samples match expectations
@@ -3554,16 +3558,12 @@
3554
3558
  },
3555
3559
  };
3556
3560
 
3557
- var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
3558
3561
  /**
3559
- * TODO: [🧠][🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
3560
- * TODO: [🧠][💱] Add more model options: `stop_token`, `logit_bias`, `logprobs` (`top_logprobs`), `top_k`, `top_p`, `presence_penalty`, `frequency_penalty`, `bestOf`, `logitBias`, `logitBiasType`,...
3561
- * [💱] Probbably keep using just `temperature` in Promptbook (not `top_k` and `top_p`)
3562
- * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
3563
- * TODO: Maybe figure out better word than "variant"
3564
- * TODO: Add here more requirement options like max context size, max tokens, etc.
3565
- * TODO: [💕][🧠] Just selecting gpt3 or gpt4 level of model
3562
+ * @@@
3563
+ *
3564
+ * @private for `ModelVariant` and `modelCommandParser`
3566
3565
  */
3566
+ var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
3567
3567
 
3568
3568
  /**
3569
3569
  * Parses the model command
@@ -5732,8 +5732,11 @@
5732
5732
  rawRequest = {
5733
5733
  model: modelRequirements.modelName || this.getDefaultChatModel().modelName,
5734
5734
  max_tokens: modelRequirements.maxTokens || 4096,
5735
- // <- TODO: Make some global max cap for maxTokens
5736
- // <- TODO: !!!!!! Use here `systemMessage`, `temperature` and `seed`
5735
+ // <- TODO: [🌾] Make some global max cap for maxTokens
5736
+ temperature: modelRequirements.temperature,
5737
+ system: modelRequirements.systemMessage,
5738
+ // <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
5739
+ // <- Note: [🧆]
5737
5740
  messages: [
5738
5741
  {
5739
5742
  role: 'user',
@@ -5802,7 +5805,7 @@
5802
5805
  const modelSettings = {
5803
5806
  model: rawResponse.model || model,
5804
5807
  max_tokens: modelRequirements.maxTokens || 2000, // <- Note: 2000 is for lagacy reasons
5805
- // <- TODO: Make some global max cap for maxTokens
5808
+ // <- TODO: [🌾] Make some global max cap for maxTokens
5806
5809
  // <- TODO: Use here `systemMessage`, `temperature` and `seed`
5807
5810
  };
5808
5811
 
@@ -5858,13 +5861,13 @@
5858
5861
  AnthropicClaudeExecutionTools.prototype.getDefaultModel = function (defaultModelName) {
5859
5862
  var model = ANTHROPIC_CLAUDE_MODELS.find(function (_a) {
5860
5863
  var modelName = _a.modelName;
5861
- return modelName === defaultModelName;
5864
+ return modelName.startsWith(defaultModelName);
5862
5865
  });
5863
5866
  if (model === undefined) {
5864
5867
  throw new UnexpectedError(spaceTrim__default["default"](function (block) {
5865
- return "\n Cannot find model in OpenAI models with name ".concat(defaultModelName, " which should be used as default.\n\n Available models:\n ").concat(block(ANTHROPIC_CLAUDE_MODELS.map(function (_a) {
5868
+ return "\n Cannot find model in OpenAI models with name \"".concat(defaultModelName, "\" which should be used as default.\n\n Available models:\n ").concat(block(ANTHROPIC_CLAUDE_MODELS.map(function (_a) {
5866
5869
  var modelName = _a.modelName;
5867
- return "- ".concat(modelName);
5870
+ return "- \"".concat(modelName, "\"");
5868
5871
  }).join('\n')), "\n\n ");
5869
5872
  }));
5870
5873
  }
@@ -6331,20 +6334,29 @@
6331
6334
  modelSettings = {
6332
6335
  model: model,
6333
6336
  max_tokens: modelRequirements.maxTokens,
6334
- // <- TODO: Make some global max cap for maxTokens
6335
- // <- TODO: !!!!!! Use here `systemMessage`, `temperature` and `seed`
6337
+ // <- TODO: [🌾] Make some global max cap for maxTokens
6338
+ temperature: modelRequirements.temperature,
6339
+ // <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
6340
+ // <- Note: [🧆]
6336
6341
  };
6337
6342
  if (expectFormat === 'JSON') {
6338
6343
  modelSettings.response_format = {
6339
6344
  type: 'json_object',
6340
6345
  };
6341
6346
  }
6342
- rawRequest = __assign(__assign({}, modelSettings), { messages: [
6347
+ rawRequest = __assign(__assign({}, modelSettings), { messages: __spreadArray(__spreadArray([], __read((modelRequirements.systemMessage === undefined
6348
+ ? []
6349
+ : [
6350
+ {
6351
+ role: 'system',
6352
+ content: modelRequirements.systemMessage,
6353
+ },
6354
+ ])), false), [
6343
6355
  {
6344
6356
  role: 'user',
6345
6357
  content: content,
6346
6358
  },
6347
- ], user: this.options.user });
6359
+ ], false), user: this.options.user });
6348
6360
  start = getCurrentIsoDate();
6349
6361
  if (this.options.isVerbose) {
6350
6362
  console.info(colors__default["default"].bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
@@ -6404,9 +6416,11 @@
6404
6416
  model = modelRequirements.modelName || this.getDefaultCompletionModel().modelName;
6405
6417
  modelSettings = {
6406
6418
  model: model,
6407
- max_tokens: modelRequirements.maxTokens || 2000, // <- Note: 2000 is for lagacy reasons
6408
- // <- TODO: Make some global max cap for maxTokens
6409
- // <- TODO: !!!!!! Use here `systemMessage`, `temperature` and `seed`
6419
+ max_tokens: modelRequirements.maxTokens || 2000,
6420
+ // <- TODO: [🌾] Make some global max cap for maxTokens
6421
+ temperature: modelRequirements.temperature,
6422
+ // <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
6423
+ // <- Note: [🧆]
6410
6424
  };
6411
6425
  rawRequest = __assign(__assign({}, modelSettings), { prompt: content, user: this.options.user });
6412
6426
  start = getCurrentIsoDate();
@@ -6511,9 +6525,9 @@
6511
6525
  });
6512
6526
  if (model === undefined) {
6513
6527
  throw new UnexpectedError(spaceTrim__default["default"](function (block) {
6514
- return "\n Cannot find model in OpenAI models with name ".concat(defaultModelName, " which should be used as default.\n\n Available models:\n ").concat(block(OPENAI_MODELS.map(function (_a) {
6528
+ return "\n Cannot find model in OpenAI models with name \"".concat(defaultModelName, "\" which should be used as default.\n\n Available models:\n ").concat(block(OPENAI_MODELS.map(function (_a) {
6515
6529
  var modelName = _a.modelName;
6516
- return "- ".concat(modelName);
6530
+ return "- \"".concat(modelName, "\"");
6517
6531
  }).join('\n')), "\n\n ");
6518
6532
  }));
6519
6533
  }
@@ -6563,7 +6577,7 @@
6563
6577
  /**
6564
6578
  * @@@
6565
6579
  *
6566
- * Note: This function is not cached, every call creates new instance of LlmExecutionTools
6580
+ * Note: This function is not cached, every call creates new instance of `LlmExecutionTools`
6567
6581
  *
6568
6582
  * It looks for environment variables:
6569
6583
  * - `process.env.OPENAI_API_KEY`
@@ -6571,20 +6585,22 @@
6571
6585
  *
6572
6586
  * @returns @@@
6573
6587
  */
6574
- function createLlmToolsFromEnv() {
6588
+ function createLlmToolsFromEnv(options) {
6589
+ if (options === void 0) { options = {}; }
6575
6590
  if (!isRunningInNode()) {
6576
6591
  throw new EnvironmentMismatchError('Function `createLlmToolsFromEnv` works only in Node.js environment');
6577
6592
  }
6593
+ var _a = options.isVerbose, isVerbose = _a === void 0 ? false : _a;
6578
6594
  var llmTools = [];
6579
6595
  if (typeof process.env.OPENAI_API_KEY === 'string') {
6580
6596
  llmTools.push(new OpenAiExecutionTools({
6581
- isVerbose: true,
6597
+ isVerbose: isVerbose,
6582
6598
  apiKey: process.env.OPENAI_API_KEY,
6583
6599
  }));
6584
6600
  }
6585
6601
  if (typeof process.env.ANTHROPIC_CLAUDE_API_KEY === 'string') {
6586
6602
  llmTools.push(new AnthropicClaudeExecutionTools({
6587
- isVerbose: true,
6603
+ isVerbose: isVerbose,
6588
6604
  apiKey: process.env.ANTHROPIC_CLAUDE_API_KEY,
6589
6605
  }));
6590
6606
  }
@@ -6789,6 +6805,27 @@
6789
6805
  * Note: [🟡] This code should never be published outside of `@promptbook/cli`
6790
6806
  */
6791
6807
 
6808
+ /**
6809
+ * Stringify the PipelineJson with proper formatting
6810
+ *
6811
+ * Note: [0] It can be used for more JSON types like whole collection of pipelines, single knowledge piece, etc.
6812
+ * Note: In contrast to JSON.stringify, this function ensures that **embedding index** is on single line
6813
+ */
6814
+ function stringifyPipelineJson(pipeline) {
6815
+ var pipelineJsonStringified = JSON.stringify(pipeline, null, 4);
6816
+ for (var i = 0; i < LOOP_LIMIT; i++) {
6817
+ pipelineJsonStringified = pipelineJsonStringified.replace(/(-?0\.\d+),[\n\s]+(-?0\.\d+)/gms, "$1".concat(REPLACING_NONCE, "$2"));
6818
+ }
6819
+ pipelineJsonStringified = pipelineJsonStringified.split(REPLACING_NONCE).join(', ');
6820
+ pipelineJsonStringified += '\n';
6821
+ return pipelineJsonStringified;
6822
+ }
6823
+ /**
6824
+ * TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
6825
+ * TODO: [🔼] Export alongside pipelineStringToJson
6826
+ * TODO: [🧠] Maybe more elegant solution than replacing via regex
6827
+ */
6828
+
6792
6829
  /**
6793
6830
  * Initializes `make` command for Promptbook CLI utilities
6794
6831
  *
@@ -6895,7 +6932,7 @@
6895
6932
  case 16: return [4 /*yield*/, collectionToJson(collection)];
6896
6933
  case 17:
6897
6934
  collectionJson = _f.sent();
6898
- collectionJsonString = JSON.stringify(collectionJson);
6935
+ collectionJsonString = stringifyPipelineJson(collectionJson);
6899
6936
  saveFile = function (extension, content) { return __awaiter(_this, void 0, void 0, function () {
6900
6937
  var filePath;
6901
6938
  return __generator(this, function (_a) {
@@ -6920,7 +6957,7 @@
6920
6957
  });
6921
6958
  }); };
6922
6959
  if (!formats.includes('json')) return [3 /*break*/, 19];
6923
- return [4 /*yield*/, saveFile('json', collectionJsonString + '\n')];
6960
+ return [4 /*yield*/, saveFile('json', collectionJsonString)];
6924
6961
  case 18:
6925
6962
  _f.sent();
6926
6963
  _f.label = 19;