@promptbook/core 0.61.0-19 → 0.61.0-20
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 +13 -8
- package/esm/index.es.js.map +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +13 -8
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -1445,7 +1445,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
1445
1445
|
});
|
|
1446
1446
|
}
|
|
1447
1447
|
|
|
1448
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-
|
|
1448
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-19",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",dependentParameterNames:["content"],resultingParameterName:"knowledge"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-19",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-19",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",dependentParameterNames:["content"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-19",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-19",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",expectations:{words:{min:1,max:8}},dependentParameterNames:["content"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-19",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-19",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:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",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}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-19",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"}];
|
|
1449
1449
|
|
|
1450
1450
|
var defaultDiacriticsRemovalMap = [
|
|
1451
1451
|
{
|
|
@@ -2439,7 +2439,7 @@ function union() {
|
|
|
2439
2439
|
/**
|
|
2440
2440
|
* The version of the Promptbook library
|
|
2441
2441
|
*/
|
|
2442
|
-
var PROMPTBOOK_VERSION = '0.61.0-
|
|
2442
|
+
var PROMPTBOOK_VERSION = '0.61.0-19';
|
|
2443
2443
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
2444
2444
|
|
|
2445
2445
|
/**
|
|
@@ -3093,7 +3093,7 @@ function createPipelineExecutor(options) {
|
|
|
3093
3093
|
});
|
|
3094
3094
|
});
|
|
3095
3095
|
}
|
|
3096
|
-
var executionReport, _a, _b, parameter, parametersToPass, resovedParameters_1,
|
|
3096
|
+
var executionReport, _a, _b, parameter, parametersToPass, resovedParameters_1, unresovedTemplates_1, resolving_1, loopLimit, _loop_1, error_1, usage_1, outputParameters, errors, _c, _d, parameter, usage;
|
|
3097
3097
|
var e_1, _e, e_2, _f;
|
|
3098
3098
|
return __generator(this, function (_g) {
|
|
3099
3099
|
switch (_g.label) {
|
|
@@ -3154,7 +3154,7 @@ function createPipelineExecutor(options) {
|
|
|
3154
3154
|
var name = _a.name;
|
|
3155
3155
|
return name;
|
|
3156
3156
|
});
|
|
3157
|
-
|
|
3157
|
+
unresovedTemplates_1 = __spreadArray([], __read(pipeline.promptTemplates), false);
|
|
3158
3158
|
resolving_1 = [];
|
|
3159
3159
|
loopLimit = LOOP_LIMIT;
|
|
3160
3160
|
_loop_1 = function () {
|
|
@@ -3166,11 +3166,16 @@ function createPipelineExecutor(options) {
|
|
|
3166
3166
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
3167
3167
|
throw new UnexpectedError('Loop limit reached during resolving parameters pipeline execution');
|
|
3168
3168
|
}
|
|
3169
|
-
currentTemplate =
|
|
3169
|
+
currentTemplate = unresovedTemplates_1.find(function (template) {
|
|
3170
3170
|
return template.dependentParameterNames.every(function (name) { return resovedParameters_1.includes(name); });
|
|
3171
3171
|
});
|
|
3172
3172
|
if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
|
|
3173
|
-
throw new UnexpectedError(spaceTrim$1("\n
|
|
3173
|
+
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Can not resolve some parameters\n\n Note: This should be catched in `validatePipeline`\n\n\n Unresolved parameters:\n ".concat(block(unresovedTemplates_1
|
|
3174
|
+
.map(function (_a) {
|
|
3175
|
+
var resultingParameterName = _a.resultingParameterName;
|
|
3176
|
+
return "- {".concat(resultingParameterName, "}");
|
|
3177
|
+
})
|
|
3178
|
+
.join('\n')), "\n\n Resolved parameters:\n ").concat(block(resovedParameters_1.map(function (name) { return "- {".concat(name, "}"); }).join('\n')), "\n "); }));
|
|
3174
3179
|
case 1:
|
|
3175
3180
|
if (!!currentTemplate) return [3 /*break*/, 3];
|
|
3176
3181
|
/* [5] */ return [4 /*yield*/, Promise.race(resolving_1)];
|
|
@@ -3178,7 +3183,7 @@ function createPipelineExecutor(options) {
|
|
|
3178
3183
|
/* [5] */ _h.sent();
|
|
3179
3184
|
return [3 /*break*/, 4];
|
|
3180
3185
|
case 3:
|
|
3181
|
-
|
|
3186
|
+
unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
|
|
3182
3187
|
work_1 = executeSingleTemplate(currentTemplate)
|
|
3183
3188
|
.then(function () {
|
|
3184
3189
|
resovedParameters_1 = __spreadArray(__spreadArray([], __read(resovedParameters_1), false), [currentTemplate.resultingParameterName], false);
|
|
@@ -3194,7 +3199,7 @@ function createPipelineExecutor(options) {
|
|
|
3194
3199
|
};
|
|
3195
3200
|
_g.label = 4;
|
|
3196
3201
|
case 4:
|
|
3197
|
-
if (!(
|
|
3202
|
+
if (!(unresovedTemplates_1.length > 0)) return [3 /*break*/, 6];
|
|
3198
3203
|
return [5 /*yield**/, _loop_1()];
|
|
3199
3204
|
case 5:
|
|
3200
3205
|
_g.sent();
|