@promptbook/cli 0.68.0-1 → 0.68.0-3
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 +2 -2
- package/esm/index.es.js +15 -15
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +1 -1
- package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.d.ts +1 -1
- package/esm/typings/src/conversion/utils/renameParameter.d.ts +2 -2
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +1 -1
- package/esm/typings/src/prepare/prepareTemplates.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +3 -3
- package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +9 -9
- package/esm/typings/src/types/PipelineString.d.ts +1 -1
- package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +15 -15
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -350,7 +350,7 @@ flowchart LR
|
|
|
350
350
|
end;
|
|
351
351
|
```
|
|
352
352
|
|
|
353
|
-
- [More template samples](./samples/
|
|
353
|
+
- [More template samples](./samples/pipelines/)
|
|
354
354
|
- [Read more about `.ptbk.md` file format here](https://github.com/webgptorg/promptbook/discussions/categories/concepts?discussions_q=is%3Aopen+label%3A.ptbk.md+category%3AConcepts)
|
|
355
355
|
|
|
356
356
|
_Note: We are using [postprocessing functions](#postprocessing-functions) like `unwrapResult` that can be used to postprocess the result._
|
|
@@ -467,7 +467,7 @@ If you have a question [start a discussion](https://github.com/webgptorg/promptb
|
|
|
467
467
|
|
|
468
468
|
### Why not just use the OpenAI SDK / Anthropic Claude SDK / ...?
|
|
469
469
|
|
|
470
|
-
Different levels of abstraction. OpenAI library is for direct use of OpenAI API. This library is for a higher level of abstraction. It
|
|
470
|
+
Different levels of abstraction. OpenAI library is for direct use of OpenAI API. This library is for a higher level of abstraction. It define pipelines that are independent of the underlying library, LLM model, or even LLM provider.
|
|
471
471
|
|
|
472
472
|
### How is it different from the Langchain library?
|
|
473
473
|
|
package/esm/index.es.js
CHANGED
|
@@ -20,7 +20,7 @@ import OpenAI from 'openai';
|
|
|
20
20
|
/**
|
|
21
21
|
* The version of the Promptbook library
|
|
22
22
|
*/
|
|
23
|
-
var PROMPTBOOK_VERSION = '0.68.0-
|
|
23
|
+
var PROMPTBOOK_VERSION = '0.68.0-2';
|
|
24
24
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
25
25
|
|
|
26
26
|
/*! *****************************************************************************
|
|
@@ -1040,7 +1040,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
1040
1040
|
});
|
|
1041
1041
|
}
|
|
1042
1042
|
|
|
1043
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.68.0-
|
|
1043
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.68.0-2",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{blockType:"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",promptbookVersion:"0.68.0-2",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{blockType:"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",promptbookVersion:"0.68.0-2",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{blockType:"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",promptbookVersion:"0.68.0-2",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:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",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- 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"}];
|
|
1044
1044
|
|
|
1045
1045
|
/**
|
|
1046
1046
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -1291,7 +1291,7 @@ function validatePipeline(pipeline) {
|
|
|
1291
1291
|
// Note: Testing that parameter is either input or result of some template
|
|
1292
1292
|
if (!parameter.isInput &&
|
|
1293
1293
|
!pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
|
|
1294
|
-
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is declared but not defined\n\n You can do one of these:\n
|
|
1294
|
+
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of {").concat(parameter.name, "}\n 2) Add template that results in -> {").concat(parameter.name, "}\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1295
1295
|
}
|
|
1296
1296
|
};
|
|
1297
1297
|
try {
|
|
@@ -2218,7 +2218,7 @@ function extractVariables(script) {
|
|
|
2218
2218
|
*/
|
|
2219
2219
|
|
|
2220
2220
|
/**
|
|
2221
|
-
* Parses the
|
|
2221
|
+
* Parses the template and returns the set of all used parameters
|
|
2222
2222
|
*
|
|
2223
2223
|
* @param template the template with used parameters
|
|
2224
2224
|
* @returns the set of parameter names
|
|
@@ -3381,7 +3381,7 @@ function createPipelineExecutor(options) {
|
|
|
3381
3381
|
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n No script execution tools are available\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
3382
3382
|
}
|
|
3383
3383
|
if (!currentTemplate.contentLanguage) {
|
|
3384
|
-
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script language is not defined for
|
|
3384
|
+
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT TEMPLATE \"".concat(currentTemplate.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3385
3385
|
}
|
|
3386
3386
|
// TODO: DRY [1]
|
|
3387
3387
|
scriptPipelineExecutionErrors = [];
|
|
@@ -4726,7 +4726,7 @@ var blockCommandParser = {
|
|
|
4726
4726
|
$applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
|
|
4727
4727
|
// TODO: !!!!!! Test multiple / no block type
|
|
4728
4728
|
if ($templateJson.isBlockTypeSet === true) {
|
|
4729
|
-
throw new ParseError("Block type is already defined in the
|
|
4729
|
+
throw new ParseError(spaceTrim$1("\n Block type is already defined in the template.\n It can be defined only once.\n "));
|
|
4730
4730
|
}
|
|
4731
4731
|
$templateJson.isBlockTypeSet = true;
|
|
4732
4732
|
// TODO: !!!!!! Rearrange better - but at bottom and unwrap from function
|
|
@@ -4906,7 +4906,7 @@ var expectCommandParser = {
|
|
|
4906
4906
|
/**
|
|
4907
4907
|
* Description of the FORMAT command
|
|
4908
4908
|
*/
|
|
4909
|
-
description: spaceTrim$1("\n Expect command describes the desired output of the
|
|
4909
|
+
description: spaceTrim$1("\n Expect command describes the desired output of the template (after post-processing)\n It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.\n "),
|
|
4910
4910
|
/**
|
|
4911
4911
|
* Link to discussion
|
|
4912
4912
|
*/
|
|
@@ -5141,7 +5141,7 @@ var formatCommandParser = {
|
|
|
5141
5141
|
/**
|
|
5142
5142
|
* Description of the FORMAT command
|
|
5143
5143
|
*/
|
|
5144
|
-
description: spaceTrim$1("\n Format command describes the desired output of the
|
|
5144
|
+
description: spaceTrim$1("\n Format command describes the desired output of the template (after post-processing)\n It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.\n "),
|
|
5145
5145
|
/**
|
|
5146
5146
|
* Link to discussion
|
|
5147
5147
|
*/
|
|
@@ -5215,7 +5215,7 @@ var jokerCommandParser = {
|
|
|
5215
5215
|
/**
|
|
5216
5216
|
* Description of the JOKER command
|
|
5217
5217
|
*/
|
|
5218
|
-
description: "Joker parameter is used instead of executing the
|
|
5218
|
+
description: "Joker parameter is used instead of executing the template result if jokers value meets the expectations requirements",
|
|
5219
5219
|
/**
|
|
5220
5220
|
* Link to discussion
|
|
5221
5221
|
*/
|
|
@@ -5294,7 +5294,7 @@ var modelCommandParser = {
|
|
|
5294
5294
|
/**
|
|
5295
5295
|
* Description of the MODEL command
|
|
5296
5296
|
*/
|
|
5297
|
-
description: "Tells which
|
|
5297
|
+
description: "Tells which `modelRequirements` (for example which model) to use for the prompt template execution",
|
|
5298
5298
|
/**
|
|
5299
5299
|
* Link to discussion
|
|
5300
5300
|
*/
|
|
@@ -5426,7 +5426,7 @@ var parameterCommandParser = {
|
|
|
5426
5426
|
/**
|
|
5427
5427
|
* Description of the PARAMETER command
|
|
5428
5428
|
*/
|
|
5429
|
-
description: "Describes one parameter of the
|
|
5429
|
+
description: "Describes one parameter of the template",
|
|
5430
5430
|
/**
|
|
5431
5431
|
* Link to discussion
|
|
5432
5432
|
*/
|
|
@@ -5868,7 +5868,7 @@ var urlCommandParser = {
|
|
|
5868
5868
|
spaceTrim(
|
|
5869
5869
|
`
|
|
5870
5870
|
URL must not contain hash
|
|
5871
|
-
Hash is used for identification of the
|
|
5871
|
+
Hash is used for identification of the template in the pipeline
|
|
5872
5872
|
`,
|
|
5873
5873
|
),
|
|
5874
5874
|
);
|
|
@@ -6768,7 +6768,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
6768
6768
|
}
|
|
6769
6769
|
var _loop_2 = function (section) {
|
|
6770
6770
|
var e_3, _d;
|
|
6771
|
-
// TODO: Parse
|
|
6771
|
+
// TODO: Parse template description (the content out of the codeblock and lists)
|
|
6772
6772
|
var listItems_2 = extractAllListItemsFromMarkdown(section.content);
|
|
6773
6773
|
var _e = extractOneBlockFromMarkdown(section.content), language = _e.language, content = _e.content;
|
|
6774
6774
|
// TODO: [🎾][1] DRY description
|
|
@@ -6855,7 +6855,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
6855
6855
|
// TODO: [🍧] !!!!!! Should be done in BLOCK command
|
|
6856
6856
|
if ($templateJson.blockType === 'SCRIPT_TEMPLATE') {
|
|
6857
6857
|
if (!language) {
|
|
6858
|
-
throw new ParseError(spaceTrim(function (block) { return "\n You must specify the language of the script in the
|
|
6858
|
+
throw new ParseError(spaceTrim(function (block) { return "\n You must specify the language of the script in the SCRIPT TEMPLATE\n\n ".concat(block(getPipelineIdentification()), "\n "); }));
|
|
6859
6859
|
}
|
|
6860
6860
|
if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
|
|
6861
6861
|
throw new ParseError(spaceTrim(function (block) { return "\n Script language ".concat(language, " is not supported.\n\n Supported languages are:\n ").concat(block(SUPPORTED_SCRIPT_LANGUAGES.join(', ')), "\n\n "); }));
|
|
@@ -6874,7 +6874,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
6874
6874
|
(block) => `
|
|
6875
6875
|
Model requirements are defined for the block type ${
|
|
6876
6876
|
$templateJson.blockType
|
|
6877
|
-
} which is not a
|
|
6877
|
+
} which is not a PROMPT TEMPLATE
|
|
6878
6878
|
|
|
6879
6879
|
This should be avoided by the \`modelCommandParser\`
|
|
6880
6880
|
|