@promptbook/cli 0.65.0-4 → 0.65.0-6
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
CHANGED
|
@@ -20,7 +20,7 @@ import glob from 'glob-promise';
|
|
|
20
20
|
/**
|
|
21
21
|
* The version of the Promptbook library
|
|
22
22
|
*/
|
|
23
|
-
var PROMPTBOOK_VERSION = '0.65.0-
|
|
23
|
+
var PROMPTBOOK_VERSION = '0.65.0-5';
|
|
24
24
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
25
25
|
|
|
26
26
|
/*! *****************************************************************************
|
|
@@ -841,7 +841,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
841
841
|
});
|
|
842
842
|
}
|
|
843
843
|
|
|
844
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.65.0-
|
|
844
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.65.0-5",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.65.0-5",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.65.0-5",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.65.0-5",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:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
845
845
|
|
|
846
846
|
/**
|
|
847
847
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -6612,9 +6612,10 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
6612
6612
|
socket.on('connect', function () {
|
|
6613
6613
|
resolve(socket);
|
|
6614
6614
|
});
|
|
6615
|
+
// TODO: !!!! Better timeout handling
|
|
6615
6616
|
setTimeout(function () {
|
|
6616
6617
|
reject(new Error("Timeout while connecting to ".concat(_this.options.remoteUrl)));
|
|
6617
|
-
},
|
|
6618
|
+
}, 1000 /* <- TODO: Timeout to config */);
|
|
6618
6619
|
});
|
|
6619
6620
|
};
|
|
6620
6621
|
/**
|
|
@@ -6694,9 +6695,10 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
6694
6695
|
RemoteLlmExecutionTools.prototype.listModels = function () {
|
|
6695
6696
|
return __awaiter(this, void 0, void 0, function () {
|
|
6696
6697
|
return __generator(this, function (_a) {
|
|
6697
|
-
return [2 /*return*/,
|
|
6698
|
-
|
|
6699
|
-
|
|
6698
|
+
return [2 /*return*/, (this.options.models ||
|
|
6699
|
+
[
|
|
6700
|
+
/* !!! */
|
|
6701
|
+
])];
|
|
6700
6702
|
});
|
|
6701
6703
|
});
|
|
6702
6704
|
};
|
|
@@ -6710,48 +6712,6 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
6710
6712
|
* TODO: [🧠] Maybe remove `@promptbook/remote-client` and just use `@promptbook/core`
|
|
6711
6713
|
*/
|
|
6712
6714
|
|
|
6713
|
-
/**
|
|
6714
|
-
* Helper of usage compute
|
|
6715
|
-
*
|
|
6716
|
-
* @param content the content of prompt or response
|
|
6717
|
-
* @returns part of PromptResultUsageCounts
|
|
6718
|
-
*
|
|
6719
|
-
* @private internal utility of LlmExecutionTools
|
|
6720
|
-
*/
|
|
6721
|
-
function computeUsageCounts(content) {
|
|
6722
|
-
return {
|
|
6723
|
-
charactersCount: { value: countCharacters(content) },
|
|
6724
|
-
wordsCount: { value: countWords(content) },
|
|
6725
|
-
sentencesCount: { value: countSentences(content) },
|
|
6726
|
-
linesCount: { value: countLines(content) },
|
|
6727
|
-
paragraphsCount: { value: countParagraphs(content) },
|
|
6728
|
-
pagesCount: { value: countPages(content) },
|
|
6729
|
-
};
|
|
6730
|
-
}
|
|
6731
|
-
|
|
6732
|
-
/**
|
|
6733
|
-
* Make UncertainNumber
|
|
6734
|
-
*
|
|
6735
|
-
* @param value
|
|
6736
|
-
*
|
|
6737
|
-
* @private utility for initializating UncertainNumber
|
|
6738
|
-
*/
|
|
6739
|
-
function uncertainNumber(value) {
|
|
6740
|
-
if (value === null || value === undefined || Number.isNaN(value)) {
|
|
6741
|
-
return { value: 0, isUncertain: true };
|
|
6742
|
-
}
|
|
6743
|
-
return { value: value };
|
|
6744
|
-
}
|
|
6745
|
-
|
|
6746
|
-
/**
|
|
6747
|
-
* Get current date in ISO 8601 format
|
|
6748
|
-
*
|
|
6749
|
-
* @private internal utility
|
|
6750
|
-
*/
|
|
6751
|
-
function getCurrentIsoDate() {
|
|
6752
|
-
return new Date().toISOString();
|
|
6753
|
-
}
|
|
6754
|
-
|
|
6755
6715
|
/**
|
|
6756
6716
|
* Function computeUsage will create price per one token based on the string value found on openai page
|
|
6757
6717
|
*
|
|
@@ -6835,6 +6795,48 @@ var ANTHROPIC_CLAUDE_MODELS = [
|
|
|
6835
6795
|
* TODO: [🕚] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
6836
6796
|
*/
|
|
6837
6797
|
|
|
6798
|
+
/**
|
|
6799
|
+
* Helper of usage compute
|
|
6800
|
+
*
|
|
6801
|
+
* @param content the content of prompt or response
|
|
6802
|
+
* @returns part of PromptResultUsageCounts
|
|
6803
|
+
*
|
|
6804
|
+
* @private internal utility of LlmExecutionTools
|
|
6805
|
+
*/
|
|
6806
|
+
function computeUsageCounts(content) {
|
|
6807
|
+
return {
|
|
6808
|
+
charactersCount: { value: countCharacters(content) },
|
|
6809
|
+
wordsCount: { value: countWords(content) },
|
|
6810
|
+
sentencesCount: { value: countSentences(content) },
|
|
6811
|
+
linesCount: { value: countLines(content) },
|
|
6812
|
+
paragraphsCount: { value: countParagraphs(content) },
|
|
6813
|
+
pagesCount: { value: countPages(content) },
|
|
6814
|
+
};
|
|
6815
|
+
}
|
|
6816
|
+
|
|
6817
|
+
/**
|
|
6818
|
+
* Make UncertainNumber
|
|
6819
|
+
*
|
|
6820
|
+
* @param value
|
|
6821
|
+
*
|
|
6822
|
+
* @private utility for initializating UncertainNumber
|
|
6823
|
+
*/
|
|
6824
|
+
function uncertainNumber(value) {
|
|
6825
|
+
if (value === null || value === undefined || Number.isNaN(value)) {
|
|
6826
|
+
return { value: 0, isUncertain: true };
|
|
6827
|
+
}
|
|
6828
|
+
return { value: value };
|
|
6829
|
+
}
|
|
6830
|
+
|
|
6831
|
+
/**
|
|
6832
|
+
* Get current date in ISO 8601 format
|
|
6833
|
+
*
|
|
6834
|
+
* @private internal utility
|
|
6835
|
+
*/
|
|
6836
|
+
function getCurrentIsoDate() {
|
|
6837
|
+
return new Date().toISOString();
|
|
6838
|
+
}
|
|
6839
|
+
|
|
6838
6840
|
/**
|
|
6839
6841
|
* Execution Tools for calling Anthropic Claude API.
|
|
6840
6842
|
*
|
|
@@ -7075,7 +7077,7 @@ function createAnthropicClaudeExecutionTools(options) {
|
|
|
7075
7077
|
className: 'AnthropicClaudeExecutionTools',
|
|
7076
7078
|
options: __assign(__assign({}, options), { isProxied: false }),
|
|
7077
7079
|
},
|
|
7078
|
-
] }));
|
|
7080
|
+
], models: ANTHROPIC_CLAUDE_MODELS }));
|
|
7079
7081
|
}
|
|
7080
7082
|
return new AnthropicClaudeExecutionTools(options);
|
|
7081
7083
|
}
|