@promptbook/core 0.63.0 → 0.63.2
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 +37 -4
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +6 -6
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +3 -2
- package/esm/typings/src/utils/clonePipeline.d.ts +13 -0
- package/package.json +1 -1
- package/umd/index.umd.js +37 -4
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -9,7 +9,7 @@ import moment from 'moment';
|
|
|
9
9
|
/**
|
|
10
10
|
* The version of the Promptbook library
|
|
11
11
|
*/
|
|
12
|
-
var PROMPTBOOK_VERSION = '0.63.
|
|
12
|
+
var PROMPTBOOK_VERSION = '0.63.1';
|
|
13
13
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
14
14
|
|
|
15
15
|
/*! *****************************************************************************
|
|
@@ -1624,7 +1624,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
1624
1624
|
});
|
|
1625
1625
|
}
|
|
1626
1626
|
|
|
1627
|
-
var PipelineCollection = [{
|
|
1627
|
+
var PipelineCollection = [{pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md",title:"Prepare Knowledge from Markdown",promptbookVersion:"0.63.1",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",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> {knowledgeContent}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.1",usage:{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}}}}]},{pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md",title:"Prepare Keywords",promptbookVersion:"0.63.1",parameters:[{name:"knowledgePieceContent",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> {knowledgePieceContent}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.1",usage:{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}}}}]},{pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md",title:"Prepare Title",promptbookVersion:"0.63.1",parameters:[{name:"knowledgePieceContent",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> {knowledgePieceContent}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.1",usage:{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}}}}]},{pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",sourceFile:"./promptbook-collection/prepare-persona.ptbk.md",title:"Prepare Keywords",promptbookVersion:"0.63.1",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.63.1",usage:{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}}}}]}];
|
|
1628
1628
|
|
|
1629
1629
|
var defaultDiacriticsRemovalMap = [
|
|
1630
1630
|
{
|
|
@@ -2187,7 +2187,8 @@ function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
|
2187
2187
|
/**
|
|
2188
2188
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
2189
2189
|
*
|
|
2190
|
-
*
|
|
2190
|
+
* Note: Internal utility of `joinLlmExecutionTools` but exposed type
|
|
2191
|
+
* @public exported from `@promptbook/types`
|
|
2191
2192
|
*/
|
|
2192
2193
|
var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
2193
2194
|
/**
|
|
@@ -2320,6 +2321,9 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
|
2320
2321
|
.map(function (error, i) { return "".concat(i + 1, ") **").concat(error.name || 'Error', ":** ").concat(error.message); })
|
|
2321
2322
|
.join('\n')), "\n\n "); }));
|
|
2322
2323
|
}
|
|
2324
|
+
else if (this.llmExecutionTools.length === 0) {
|
|
2325
|
+
throw new PipelineExecutionError("You have not provided any `LlmExecutionTools`");
|
|
2326
|
+
}
|
|
2323
2327
|
else {
|
|
2324
2328
|
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.llmExecutionTools
|
|
2325
2329
|
.map(function (tools) { return "- ".concat(tools.title, " ").concat(tools.description || ''); })
|
|
@@ -4006,6 +4010,35 @@ function prepareTemplates(pipeline, options) {
|
|
|
4006
4010
|
* TODO: [🧠][🥜]
|
|
4007
4011
|
*/
|
|
4008
4012
|
|
|
4013
|
+
/**
|
|
4014
|
+
* @@@
|
|
4015
|
+
*
|
|
4016
|
+
* Note: It is usefull @@@
|
|
4017
|
+
*
|
|
4018
|
+
* @param pipeline
|
|
4019
|
+
* @public exported from `@promptbook/utils`
|
|
4020
|
+
*/
|
|
4021
|
+
function clonePipeline(pipeline) {
|
|
4022
|
+
// Note: Not using spread operator (...) because @@@
|
|
4023
|
+
var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, promptbookVersion = pipeline.promptbookVersion, description = pipeline.description, parameters = pipeline.parameters, promptTemplates = pipeline.promptTemplates, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
|
|
4024
|
+
return {
|
|
4025
|
+
pipelineUrl: pipelineUrl,
|
|
4026
|
+
sourceFile: sourceFile,
|
|
4027
|
+
title: title,
|
|
4028
|
+
promptbookVersion: promptbookVersion,
|
|
4029
|
+
description: description,
|
|
4030
|
+
parameters: parameters,
|
|
4031
|
+
promptTemplates: promptTemplates,
|
|
4032
|
+
knowledgeSources: knowledgeSources,
|
|
4033
|
+
knowledgePieces: knowledgePieces,
|
|
4034
|
+
personas: personas,
|
|
4035
|
+
preparations: preparations,
|
|
4036
|
+
};
|
|
4037
|
+
}
|
|
4038
|
+
/**
|
|
4039
|
+
* TODO: [🍙] Make some standart order of json properties
|
|
4040
|
+
*/
|
|
4041
|
+
|
|
4009
4042
|
/**
|
|
4010
4043
|
* Prepare pipeline from string (markdown) format to JSON format
|
|
4011
4044
|
*
|
|
@@ -4082,7 +4115,7 @@ function preparePipeline(pipeline, options) {
|
|
|
4082
4115
|
// ----- /Templates preparation -----
|
|
4083
4116
|
// Note: Count total usage
|
|
4084
4117
|
currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
|
|
4085
|
-
return [2 /*return*/, __assign(__assign({}, pipeline), { promptTemplates: promptTemplatesPrepared, knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: preparations })];
|
|
4118
|
+
return [2 /*return*/, __assign(__assign({}, clonePipeline(pipeline)), { promptTemplates: promptTemplatesPrepared, knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: preparations })];
|
|
4086
4119
|
}
|
|
4087
4120
|
});
|
|
4088
4121
|
});
|