@promptbook/cli 0.61.0-27 โ 0.61.0-28
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 +30 -18
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/execution/PromptResult.d.ts +15 -0
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +2 -2
- package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +30 -18
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/src/execution/PromptResult.d.ts +15 -0
- package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
- package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +2 -2
- package/umd/typings/src/prepare/preparePipeline.d.ts +1 -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-
|
|
153
|
+
var PROMPTBOOK_VERSION = '0.61.0-27';
|
|
154
154
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
155
155
|
|
|
156
156
|
/**
|
|
@@ -747,7 +747,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
747
747
|
});
|
|
748
748
|
}
|
|
749
749
|
|
|
750
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-
|
|
750
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-27",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.61.0-27",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-27",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.61.0-27",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-27",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.61.0-27",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-27",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-27",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"}];
|
|
751
751
|
|
|
752
752
|
/**
|
|
753
753
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -3530,7 +3530,7 @@ function prepareTemplates(pipeline, options) {
|
|
|
3530
3530
|
case 0:
|
|
3531
3531
|
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
|
|
3532
3532
|
promptTemplates = pipeline.promptTemplates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
3533
|
-
// TODO:
|
|
3533
|
+
// TODO: !!!!! Apply samples to each template (if missing and is for the template defined)
|
|
3534
3534
|
TODO_USE(parameters);
|
|
3535
3535
|
promptTemplatesPrepared = new Array(promptTemplates.length);
|
|
3536
3536
|
return [4 /*yield*/, forEachAsync(promptTemplates, { maxParallelCount: maxParallelCount /* <- TODO: [๐ช] When there are subtasks, this maximul limit can be broken */ }, function (template, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -3639,7 +3639,7 @@ function preparePipeline(pipeline, options) {
|
|
|
3639
3639
|
* TODO: Write tests for `preparePipeline`
|
|
3640
3640
|
* TODO: [๐] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
3641
3641
|
* TODO: [๐ง] In future one preparation can take data from previous preparation and save tokens and time
|
|
3642
|
-
* TODO: [๐]
|
|
3642
|
+
* TODO: [๐] !!!!! Use here countTotalUsage
|
|
3643
3643
|
* TODO: [๐ ] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
3644
3644
|
*/
|
|
3645
3645
|
|
|
@@ -6234,7 +6234,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
6234
6234
|
*/
|
|
6235
6235
|
AnthropicClaudeExecutionTools.prototype.callChatModel = function (prompt) {
|
|
6236
6236
|
return __awaiter(this, void 0, void 0, function () {
|
|
6237
|
-
var content, parameters, modelRequirements, modelName, rawRequest, start, complete, rawResponse, resultContent, usage;
|
|
6237
|
+
var content, parameters, modelRequirements, modelName, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
|
|
6238
6238
|
return __generator(this, function (_a) {
|
|
6239
6239
|
switch (_a.label) {
|
|
6240
6240
|
case 0:
|
|
@@ -6247,6 +6247,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
6247
6247
|
throw new PipelineExecutionError('Use callChatModel only for CHAT variant');
|
|
6248
6248
|
}
|
|
6249
6249
|
modelName = modelRequirements.modelName || this.getDefaultChatModel().modelName;
|
|
6250
|
+
rawPromptContent = replaceParameters(content, __assign(__assign({}, parameters), { modelName: modelName }));
|
|
6250
6251
|
rawRequest = {
|
|
6251
6252
|
model: modelRequirements.modelName || this.getDefaultChatModel().modelName,
|
|
6252
6253
|
max_tokens: modelRequirements.maxTokens || 4096,
|
|
@@ -6258,7 +6259,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
6258
6259
|
messages: [
|
|
6259
6260
|
{
|
|
6260
6261
|
role: 'user',
|
|
6261
|
-
content:
|
|
6262
|
+
content: rawPromptContent,
|
|
6262
6263
|
},
|
|
6263
6264
|
],
|
|
6264
6265
|
// TODO: Is here some equivalent of user identification?> user: this.options.user,
|
|
@@ -6295,8 +6296,10 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
6295
6296
|
complete: complete,
|
|
6296
6297
|
},
|
|
6297
6298
|
usage: usage,
|
|
6299
|
+
rawPromptContent: rawPromptContent,
|
|
6300
|
+
rawRequest: rawRequest,
|
|
6298
6301
|
rawResponse: rawResponse,
|
|
6299
|
-
// <- [
|
|
6302
|
+
// <- [๐ฏ]
|
|
6300
6303
|
}];
|
|
6301
6304
|
}
|
|
6302
6305
|
});
|
|
@@ -6329,7 +6332,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
6329
6332
|
|
|
6330
6333
|
const rawRequest: xxxx.Completions.CompletionCreateParamsNonStreaming = {
|
|
6331
6334
|
...modelSettings,
|
|
6332
|
-
prompt:
|
|
6335
|
+
prompt: rawPromptContent,
|
|
6333
6336
|
user: this.options.user,
|
|
6334
6337
|
};
|
|
6335
6338
|
const start: string_date_iso8601 = getCurrentIsoDate();
|
|
@@ -6368,7 +6371,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
6368
6371
|
},
|
|
6369
6372
|
usage,
|
|
6370
6373
|
rawResponse,
|
|
6371
|
-
// <- [
|
|
6374
|
+
// <- [๐ฏ]
|
|
6372
6375
|
};
|
|
6373
6376
|
}
|
|
6374
6377
|
*/
|
|
@@ -6836,7 +6839,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
6836
6839
|
*/
|
|
6837
6840
|
OpenAiExecutionTools.prototype.callChatModel = function (prompt) {
|
|
6838
6841
|
return __awaiter(this, void 0, void 0, function () {
|
|
6839
|
-
var content, parameters, modelRequirements, expectFormat, modelName, modelSettings, rawRequest, start, complete, rawResponse, resultContent, usage;
|
|
6842
|
+
var content, parameters, modelRequirements, expectFormat, modelName, modelSettings, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
|
|
6840
6843
|
return __generator(this, function (_a) {
|
|
6841
6844
|
switch (_a.label) {
|
|
6842
6845
|
case 0:
|
|
@@ -6862,6 +6865,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
6862
6865
|
type: 'json_object',
|
|
6863
6866
|
};
|
|
6864
6867
|
}
|
|
6868
|
+
rawPromptContent = replaceParameters(content, __assign(__assign({}, parameters), { modelName: modelName }));
|
|
6865
6869
|
rawRequest = __assign(__assign({}, modelSettings), { messages: __spreadArray(__spreadArray([], __read((modelRequirements.systemMessage === undefined
|
|
6866
6870
|
? []
|
|
6867
6871
|
: [
|
|
@@ -6872,7 +6876,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
6872
6876
|
])), false), [
|
|
6873
6877
|
{
|
|
6874
6878
|
role: 'user',
|
|
6875
|
-
content:
|
|
6879
|
+
content: rawPromptContent,
|
|
6876
6880
|
},
|
|
6877
6881
|
], false), user: this.options.user });
|
|
6878
6882
|
start = getCurrentIsoDate();
|
|
@@ -6907,8 +6911,10 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
6907
6911
|
complete: complete,
|
|
6908
6912
|
},
|
|
6909
6913
|
usage: usage,
|
|
6914
|
+
rawPromptContent: rawPromptContent,
|
|
6915
|
+
rawRequest: rawRequest,
|
|
6910
6916
|
rawResponse: rawResponse,
|
|
6911
|
-
// <- [
|
|
6917
|
+
// <- [๐ฏ]
|
|
6912
6918
|
}];
|
|
6913
6919
|
}
|
|
6914
6920
|
});
|
|
@@ -6919,7 +6925,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
6919
6925
|
*/
|
|
6920
6926
|
OpenAiExecutionTools.prototype.callCompletionModel = function (prompt) {
|
|
6921
6927
|
return __awaiter(this, void 0, void 0, function () {
|
|
6922
|
-
var content, parameters, modelRequirements, modelName, modelSettings, rawRequest, start, complete, rawResponse, resultContent, usage;
|
|
6928
|
+
var content, parameters, modelRequirements, modelName, modelSettings, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
|
|
6923
6929
|
return __generator(this, function (_a) {
|
|
6924
6930
|
switch (_a.label) {
|
|
6925
6931
|
case 0:
|
|
@@ -6940,7 +6946,8 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
6940
6946
|
// <- TODO: [๐] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
|
|
6941
6947
|
// <- Note: [๐ง]
|
|
6942
6948
|
};
|
|
6943
|
-
|
|
6949
|
+
rawPromptContent = replaceParameters(content, __assign(__assign({}, parameters), { modelName: modelName }));
|
|
6950
|
+
rawRequest = __assign(__assign({}, modelSettings), { prompt: rawPromptContent, user: this.options.user });
|
|
6944
6951
|
start = getCurrentIsoDate();
|
|
6945
6952
|
if (this.options.isVerbose) {
|
|
6946
6953
|
console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
|
@@ -6970,8 +6977,10 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
6970
6977
|
complete: complete,
|
|
6971
6978
|
},
|
|
6972
6979
|
usage: usage,
|
|
6980
|
+
rawPromptContent: rawPromptContent,
|
|
6981
|
+
rawRequest: rawRequest,
|
|
6973
6982
|
rawResponse: rawResponse,
|
|
6974
|
-
// <- [
|
|
6983
|
+
// <- [๐ฏ]
|
|
6975
6984
|
}];
|
|
6976
6985
|
}
|
|
6977
6986
|
});
|
|
@@ -6982,7 +6991,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
6982
6991
|
*/
|
|
6983
6992
|
OpenAiExecutionTools.prototype.callEmbeddingModel = function (prompt) {
|
|
6984
6993
|
return __awaiter(this, void 0, void 0, function () {
|
|
6985
|
-
var content, parameters, modelRequirements, modelName, rawRequest, start, complete, rawResponse, resultContent, usage;
|
|
6994
|
+
var content, parameters, modelRequirements, modelName, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
|
|
6986
6995
|
return __generator(this, function (_a) {
|
|
6987
6996
|
switch (_a.label) {
|
|
6988
6997
|
case 0:
|
|
@@ -6995,8 +7004,9 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
6995
7004
|
throw new PipelineExecutionError('Use embed only for EMBEDDING variant');
|
|
6996
7005
|
}
|
|
6997
7006
|
modelName = modelRequirements.modelName || this.getDefaultEmbeddingModel().modelName;
|
|
7007
|
+
rawPromptContent = replaceParameters(content, __assign(__assign({}, parameters), { modelName: modelName }));
|
|
6998
7008
|
rawRequest = {
|
|
6999
|
-
input:
|
|
7009
|
+
input: rawPromptContent,
|
|
7000
7010
|
model: modelName,
|
|
7001
7011
|
};
|
|
7002
7012
|
start = getCurrentIsoDate();
|
|
@@ -7024,8 +7034,10 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
7024
7034
|
complete: complete,
|
|
7025
7035
|
},
|
|
7026
7036
|
usage: usage,
|
|
7037
|
+
rawPromptContent: rawPromptContent,
|
|
7038
|
+
rawRequest: rawRequest,
|
|
7027
7039
|
rawResponse: rawResponse,
|
|
7028
|
-
// <- [
|
|
7040
|
+
// <- [๐ฏ]
|
|
7029
7041
|
}];
|
|
7030
7042
|
}
|
|
7031
7043
|
});
|