@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/esm/index.es.js CHANGED
@@ -150,7 +150,7 @@ new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined'
150
150
  /**
151
151
  * The version of the Promptbook library
152
152
  */
153
- var PROMPTBOOK_VERSION = '0.61.0-12';
153
+ var PROMPTBOOK_VERSION = '0.61.0-13';
154
154
  // TODO: !!!! List here all the versions and annotate + put into script
155
155
 
156
156
  /**
@@ -268,6 +268,10 @@ var RESERVED_PARAMETER_NAMES = deepFreeze([
268
268
  // <- TODO: Add more like 'date', 'modelName',...
269
269
  // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
270
270
  ]);
271
+ /**
272
+ * Nonce which is used for replacing things in strings
273
+ */
274
+ var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
271
275
  /*
272
276
  TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
273
277
  */
@@ -465,7 +469,7 @@ function forEachAsync(array, options, callbackfunction) {
465
469
  });
466
470
  }
467
471
 
468
- 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"}];
472
+ 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"}];
469
473
 
470
474
  /**
471
475
  * Prettify the html code
@@ -1081,7 +1085,7 @@ function validatePipeline(pipeline) {
1081
1085
  * > * It checks:
1082
1086
  * > * - it has a valid structure
1083
1087
  * > * - ...
1084
- * > ex port function validatePipeline(promptbook: unknown): asserts promptbook is PipelineJson {
1088
+ * > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
1085
1089
  */
1086
1090
  /**
1087
1091
  * TODO: [🧠][🐣] !!!! Validate that all samples match expectations
@@ -3550,16 +3554,12 @@ var jokerCommandParser = {
3550
3554
  },
3551
3555
  };
3552
3556
 
3553
- var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
3554
3557
  /**
3555
- * TODO: [🧠][🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
3556
- * TODO: [🧠][💱] Add more model options: `stop_token`, `logit_bias`, `logprobs` (`top_logprobs`), `top_k`, `top_p`, `presence_penalty`, `frequency_penalty`, `bestOf`, `logitBias`, `logitBiasType`,...
3557
- * [💱] Probbably keep using just `temperature` in Promptbook (not `top_k` and `top_p`)
3558
- * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
3559
- * TODO: Maybe figure out better word than "variant"
3560
- * TODO: Add here more requirement options like max context size, max tokens, etc.
3561
- * TODO: [💕][🧠] Just selecting gpt3 or gpt4 level of model
3558
+ * @@@
3559
+ *
3560
+ * @private for `ModelVariant` and `modelCommandParser`
3562
3561
  */
3562
+ var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
3563
3563
 
3564
3564
  /**
3565
3565
  * Parses the model command
@@ -5728,8 +5728,11 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
5728
5728
  rawRequest = {
5729
5729
  model: modelRequirements.modelName || this.getDefaultChatModel().modelName,
5730
5730
  max_tokens: modelRequirements.maxTokens || 4096,
5731
- // <- TODO: Make some global max cap for maxTokens
5732
- // <- TODO: !!!!!! Use here `systemMessage`, `temperature` and `seed`
5731
+ // <- TODO: [🌾] Make some global max cap for maxTokens
5732
+ temperature: modelRequirements.temperature,
5733
+ system: modelRequirements.systemMessage,
5734
+ // <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
5735
+ // <- Note: [🧆]
5733
5736
  messages: [
5734
5737
  {
5735
5738
  role: 'user',
@@ -5798,7 +5801,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
5798
5801
  const modelSettings = {
5799
5802
  model: rawResponse.model || model,
5800
5803
  max_tokens: modelRequirements.maxTokens || 2000, // <- Note: 2000 is for lagacy reasons
5801
- // <- TODO: Make some global max cap for maxTokens
5804
+ // <- TODO: [🌾] Make some global max cap for maxTokens
5802
5805
  // <- TODO: Use here `systemMessage`, `temperature` and `seed`
5803
5806
  };
5804
5807
 
@@ -5854,13 +5857,13 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
5854
5857
  AnthropicClaudeExecutionTools.prototype.getDefaultModel = function (defaultModelName) {
5855
5858
  var model = ANTHROPIC_CLAUDE_MODELS.find(function (_a) {
5856
5859
  var modelName = _a.modelName;
5857
- return modelName === defaultModelName;
5860
+ return modelName.startsWith(defaultModelName);
5858
5861
  });
5859
5862
  if (model === undefined) {
5860
5863
  throw new UnexpectedError(spaceTrim(function (block) {
5861
- 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) {
5864
+ 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) {
5862
5865
  var modelName = _a.modelName;
5863
- return "- ".concat(modelName);
5866
+ return "- \"".concat(modelName, "\"");
5864
5867
  }).join('\n')), "\n\n ");
5865
5868
  }));
5866
5869
  }
@@ -6327,20 +6330,29 @@ var OpenAiExecutionTools = /** @class */ (function () {
6327
6330
  modelSettings = {
6328
6331
  model: model,
6329
6332
  max_tokens: modelRequirements.maxTokens,
6330
- // <- TODO: Make some global max cap for maxTokens
6331
- // <- TODO: !!!!!! Use here `systemMessage`, `temperature` and `seed`
6333
+ // <- TODO: [🌾] Make some global max cap for maxTokens
6334
+ temperature: modelRequirements.temperature,
6335
+ // <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
6336
+ // <- Note: [🧆]
6332
6337
  };
6333
6338
  if (expectFormat === 'JSON') {
6334
6339
  modelSettings.response_format = {
6335
6340
  type: 'json_object',
6336
6341
  };
6337
6342
  }
6338
- rawRequest = __assign(__assign({}, modelSettings), { messages: [
6343
+ rawRequest = __assign(__assign({}, modelSettings), { messages: __spreadArray(__spreadArray([], __read((modelRequirements.systemMessage === undefined
6344
+ ? []
6345
+ : [
6346
+ {
6347
+ role: 'system',
6348
+ content: modelRequirements.systemMessage,
6349
+ },
6350
+ ])), false), [
6339
6351
  {
6340
6352
  role: 'user',
6341
6353
  content: content,
6342
6354
  },
6343
- ], user: this.options.user });
6355
+ ], false), user: this.options.user });
6344
6356
  start = getCurrentIsoDate();
6345
6357
  if (this.options.isVerbose) {
6346
6358
  console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
@@ -6400,9 +6412,11 @@ var OpenAiExecutionTools = /** @class */ (function () {
6400
6412
  model = modelRequirements.modelName || this.getDefaultCompletionModel().modelName;
6401
6413
  modelSettings = {
6402
6414
  model: model,
6403
- max_tokens: modelRequirements.maxTokens || 2000, // <- Note: 2000 is for lagacy reasons
6404
- // <- TODO: Make some global max cap for maxTokens
6405
- // <- TODO: !!!!!! Use here `systemMessage`, `temperature` and `seed`
6415
+ max_tokens: modelRequirements.maxTokens || 2000,
6416
+ // <- TODO: [🌾] Make some global max cap for maxTokens
6417
+ temperature: modelRequirements.temperature,
6418
+ // <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
6419
+ // <- Note: [🧆]
6406
6420
  };
6407
6421
  rawRequest = __assign(__assign({}, modelSettings), { prompt: content, user: this.options.user });
6408
6422
  start = getCurrentIsoDate();
@@ -6507,9 +6521,9 @@ var OpenAiExecutionTools = /** @class */ (function () {
6507
6521
  });
6508
6522
  if (model === undefined) {
6509
6523
  throw new UnexpectedError(spaceTrim(function (block) {
6510
- 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) {
6524
+ 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) {
6511
6525
  var modelName = _a.modelName;
6512
- return "- ".concat(modelName);
6526
+ return "- \"".concat(modelName, "\"");
6513
6527
  }).join('\n')), "\n\n ");
6514
6528
  }));
6515
6529
  }
@@ -6559,7 +6573,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
6559
6573
  /**
6560
6574
  * @@@
6561
6575
  *
6562
- * Note: This function is not cached, every call creates new instance of LlmExecutionTools
6576
+ * Note: This function is not cached, every call creates new instance of `LlmExecutionTools`
6563
6577
  *
6564
6578
  * It looks for environment variables:
6565
6579
  * - `process.env.OPENAI_API_KEY`
@@ -6567,20 +6581,22 @@ var OpenAiExecutionTools = /** @class */ (function () {
6567
6581
  *
6568
6582
  * @returns @@@
6569
6583
  */
6570
- function createLlmToolsFromEnv() {
6584
+ function createLlmToolsFromEnv(options) {
6585
+ if (options === void 0) { options = {}; }
6571
6586
  if (!isRunningInNode()) {
6572
6587
  throw new EnvironmentMismatchError('Function `createLlmToolsFromEnv` works only in Node.js environment');
6573
6588
  }
6589
+ var _a = options.isVerbose, isVerbose = _a === void 0 ? false : _a;
6574
6590
  var llmTools = [];
6575
6591
  if (typeof process.env.OPENAI_API_KEY === 'string') {
6576
6592
  llmTools.push(new OpenAiExecutionTools({
6577
- isVerbose: true,
6593
+ isVerbose: isVerbose,
6578
6594
  apiKey: process.env.OPENAI_API_KEY,
6579
6595
  }));
6580
6596
  }
6581
6597
  if (typeof process.env.ANTHROPIC_CLAUDE_API_KEY === 'string') {
6582
6598
  llmTools.push(new AnthropicClaudeExecutionTools({
6583
- isVerbose: true,
6599
+ isVerbose: isVerbose,
6584
6600
  apiKey: process.env.ANTHROPIC_CLAUDE_API_KEY,
6585
6601
  }));
6586
6602
  }
@@ -6785,6 +6801,27 @@ function getLlmToolsForCli() {
6785
6801
  * Note: [🟡] This code should never be published outside of `@promptbook/cli`
6786
6802
  */
6787
6803
 
6804
+ /**
6805
+ * Stringify the PipelineJson with proper formatting
6806
+ *
6807
+ * Note: [0] It can be used for more JSON types like whole collection of pipelines, single knowledge piece, etc.
6808
+ * Note: In contrast to JSON.stringify, this function ensures that **embedding index** is on single line
6809
+ */
6810
+ function stringifyPipelineJson(pipeline) {
6811
+ var pipelineJsonStringified = JSON.stringify(pipeline, null, 4);
6812
+ for (var i = 0; i < LOOP_LIMIT; i++) {
6813
+ pipelineJsonStringified = pipelineJsonStringified.replace(/(-?0\.\d+),[\n\s]+(-?0\.\d+)/gms, "$1".concat(REPLACING_NONCE, "$2"));
6814
+ }
6815
+ pipelineJsonStringified = pipelineJsonStringified.split(REPLACING_NONCE).join(', ');
6816
+ pipelineJsonStringified += '\n';
6817
+ return pipelineJsonStringified;
6818
+ }
6819
+ /**
6820
+ * TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
6821
+ * TODO: [🔼] Export alongside pipelineStringToJson
6822
+ * TODO: [🧠] Maybe more elegant solution than replacing via regex
6823
+ */
6824
+
6788
6825
  /**
6789
6826
  * Initializes `make` command for Promptbook CLI utilities
6790
6827
  *
@@ -6891,7 +6928,7 @@ function initializeMakeCommand(program) {
6891
6928
  case 16: return [4 /*yield*/, collectionToJson(collection)];
6892
6929
  case 17:
6893
6930
  collectionJson = _f.sent();
6894
- collectionJsonString = JSON.stringify(collectionJson);
6931
+ collectionJsonString = stringifyPipelineJson(collectionJson);
6895
6932
  saveFile = function (extension, content) { return __awaiter(_this, void 0, void 0, function () {
6896
6933
  var filePath;
6897
6934
  return __generator(this, function (_a) {
@@ -6916,7 +6953,7 @@ function initializeMakeCommand(program) {
6916
6953
  });
6917
6954
  }); };
6918
6955
  if (!formats.includes('json')) return [3 /*break*/, 19];
6919
- return [4 /*yield*/, saveFile('json', collectionJsonString + '\n')];
6956
+ return [4 /*yield*/, saveFile('json', collectionJsonString)];
6920
6957
  case 18:
6921
6958
  _f.sent();
6922
6959
  _f.label = 19;