@promptbook/core 0.69.0-13 → 0.69.0-15
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/esm/index.es.js +12 -17
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.test.d.ts +1 -0
- package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +0 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +12 -17
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -11,7 +11,7 @@ import moment from 'moment';
|
|
|
11
11
|
/**
|
|
12
12
|
* The version of the Promptbook library
|
|
13
13
|
*/
|
|
14
|
-
var PROMPTBOOK_VERSION = '0.69.0-
|
|
14
|
+
var PROMPTBOOK_VERSION = '0.69.0-14';
|
|
15
15
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
16
16
|
|
|
17
17
|
/*! *****************************************************************************
|
|
@@ -1203,7 +1203,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1203
1203
|
}
|
|
1204
1204
|
}
|
|
1205
1205
|
/**
|
|
1206
|
-
* TODO:
|
|
1206
|
+
* TODO: !!!!! [🧞♀️] Do not allow joker + foreach
|
|
1207
1207
|
* TODO: [🧠] Work with promptbookVersion
|
|
1208
1208
|
* TODO: Use here some json-schema, Zod or something similar and change it to:
|
|
1209
1209
|
* > /**
|
|
@@ -1830,7 +1830,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
1830
1830
|
});
|
|
1831
1831
|
}
|
|
1832
1832
|
|
|
1833
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.69.0-
|
|
1833
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.69.0-14",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",promptbookVersion:"0.69.0-14",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",promptbookVersion:"0.69.0-14",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",promptbookVersion:"0.69.0-14",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## 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"}];
|
|
1834
1834
|
|
|
1835
1835
|
var defaultDiacriticsRemovalMap = [
|
|
1836
1836
|
{
|
|
@@ -2433,9 +2433,10 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
|
2433
2433
|
});
|
|
2434
2434
|
Object.defineProperty(MultipleLlmExecutionTools.prototype, "description", {
|
|
2435
2435
|
get: function () {
|
|
2436
|
-
return this.llmExecutionTools
|
|
2437
|
-
|
|
2438
|
-
.
|
|
2436
|
+
return this.llmExecutionTools.map(function (_a, index) {
|
|
2437
|
+
var title = _a.title;
|
|
2438
|
+
return "".concat(index + 1, ") `").concat(title, "`");
|
|
2439
|
+
}).join('\n');
|
|
2439
2440
|
},
|
|
2440
2441
|
enumerable: false,
|
|
2441
2442
|
configurable: true
|
|
@@ -2633,7 +2634,7 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
|
2633
2634
|
throw new PipelineExecutionError("You have not provided any `LlmExecutionTools`");
|
|
2634
2635
|
}
|
|
2635
2636
|
else {
|
|
2636
|
-
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n You have not provided any `LlmExecutionTools` that support model variant \"".concat(prompt.modelRequirements.modelVariant, "\n\n Available `LlmExecutionTools`:\n ").concat(block(_this.
|
|
2637
|
+
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n You have not provided any `LlmExecutionTools` that support model variant \"".concat(prompt.modelRequirements.modelVariant, "\"\n\n Available `LlmExecutionTools`:\n ").concat(block(_this.description), "\n\n "); }));
|
|
2637
2638
|
}
|
|
2638
2639
|
}
|
|
2639
2640
|
});
|
|
@@ -6070,7 +6071,7 @@ var foreachCommandParser = {
|
|
|
6070
6071
|
/**
|
|
6071
6072
|
* Link to discussion
|
|
6072
6073
|
*/
|
|
6073
|
-
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions
|
|
6074
|
+
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/148',
|
|
6074
6075
|
/**
|
|
6075
6076
|
* Example usages of the FOREACH command
|
|
6076
6077
|
*/
|
|
@@ -6078,7 +6079,6 @@ var foreachCommandParser = {
|
|
|
6078
6079
|
'FOREACH Text Line `{customers}` -> `{customer}`',
|
|
6079
6080
|
'FOR Csv Row `{customers}` -> `{firstName}`, `{lastName}`',
|
|
6080
6081
|
'EACH Csv Cell `{customers}` -> `{cell}`',
|
|
6081
|
-
// <- TODO: [🍭] !!!!!! More
|
|
6082
6082
|
],
|
|
6083
6083
|
/**
|
|
6084
6084
|
* Parses the FOREACH command
|
|
@@ -6093,7 +6093,6 @@ var foreachCommandParser = {
|
|
|
6093
6093
|
return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(formatName);
|
|
6094
6094
|
});
|
|
6095
6095
|
if (formatDefinition === undefined) {
|
|
6096
|
-
console.info({ args: args, formatName: formatName });
|
|
6097
6096
|
throw new ParseError(spaceTrim(function (block) { return "\n Unsupported format \"".concat(formatName, "\"\n\n Available formats:\n ").concat(block(FORMAT_DEFINITIONS.map(function (formatDefinition) { return formatDefinition.formatName; })
|
|
6098
6097
|
.map(function (formatName) { return "- ".concat(formatName); })
|
|
6099
6098
|
.join('\n')), "\n "); }));
|
|
@@ -6103,7 +6102,6 @@ var foreachCommandParser = {
|
|
|
6103
6102
|
return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(cellName);
|
|
6104
6103
|
});
|
|
6105
6104
|
if (subvalueDefinition === undefined) {
|
|
6106
|
-
console.info({ args: args, cellName: cellName });
|
|
6107
6105
|
throw new ParseError(spaceTrim(function (block) { return "\n Unsupported cell name \"".concat(cellName, "\" for format \"").concat(formatName, "\"\n\n Available cell names for format \"").concat(formatDefinition.formatName, "\":\n ").concat(block(formatDefinition.subvalueDefinitions
|
|
6108
6106
|
.map(function (subvalueDefinition) { return subvalueDefinition.subvalueName; })
|
|
6109
6107
|
.map(function (subvalueName) { return "- ".concat(subvalueName); })
|
|
@@ -6111,14 +6109,12 @@ var foreachCommandParser = {
|
|
|
6111
6109
|
// <- TODO: [🏢] List all supported cell names for the format
|
|
6112
6110
|
}
|
|
6113
6111
|
if (assignSign !== '->') {
|
|
6114
|
-
console.info({ args: args, assignSign: assignSign });
|
|
6115
6112
|
throw new ParseError("FOREACH command must have '->' to assign the value to the parameter");
|
|
6116
6113
|
}
|
|
6117
|
-
// TODO:
|
|
6114
|
+
// TODO: !!! Replace with propper parameter name validation `validateParameterName`
|
|
6118
6115
|
if ((parameterNameWrapped === null || parameterNameWrapped === void 0 ? void 0 : parameterNameWrapped.substring(0, 1)) !== '{' ||
|
|
6119
6116
|
(parameterNameWrapped === null || parameterNameWrapped === void 0 ? void 0 : parameterNameWrapped.substring(parameterNameWrapped.length - 1, parameterNameWrapped.length)) !== '}') {
|
|
6120
|
-
|
|
6121
|
-
throw new ParseError("!!!!!! 1 Here will be error (with rules and precise error) from validateParameterName");
|
|
6117
|
+
throw new ParseError("Invalid parameter name \"".concat(parameterNameWrapped, "\" - must be wrapped in curly brackets: {parameterName}"));
|
|
6122
6118
|
}
|
|
6123
6119
|
var parameterName = parameterNameWrapped.substring(1, parameterNameWrapped.length - 1);
|
|
6124
6120
|
var subparameterNames = args
|
|
@@ -6147,7 +6143,7 @@ var foreachCommandParser = {
|
|
|
6147
6143
|
// TODO: !!!!!! Detect double use
|
|
6148
6144
|
// TODO: !!!!!! Detect usage with JOKER and don't allow it
|
|
6149
6145
|
$templateJson.foreach = { formatName: formatName, cellName: cellName, parameterName: parameterName, subparameterNames: subparameterNames };
|
|
6150
|
-
keepUnused($pipelineJson); // <- TODO:
|
|
6146
|
+
keepUnused($pipelineJson); // <- TODO: [🧠] Maybe register subparameter from foreach into parameters of the pipeline
|
|
6151
6147
|
// Note: [🍭] FOREACH apply has some sideeffects on different places in codebase
|
|
6152
6148
|
},
|
|
6153
6149
|
/**
|
|
@@ -6170,7 +6166,6 @@ var foreachCommandParser = {
|
|
|
6170
6166
|
},
|
|
6171
6167
|
};
|
|
6172
6168
|
/**
|
|
6173
|
-
* TODO: !!!!!! Remove console logs
|
|
6174
6169
|
* TODO: [🧠][🦥] Better (less confusing) name for "cell" / "subvalue" / "subparameter"
|
|
6175
6170
|
* TODO: [🍭] !!!!!! Make .ptbk.md file with examples of the FOREACH command and also with wrong parsing and logic
|
|
6176
6171
|
*/
|