@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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CommonExecutionToolsOptions } from '../../../execution/CommonExecutionToolsOptions';
|
|
2
|
+
import type { AvailableModel } from '../../../execution/LlmExecutionTools';
|
|
2
3
|
import type { client_id } from '../../../types/typeAliases';
|
|
3
4
|
import type { string_base_url } from '../../../types/typeAliases';
|
|
4
5
|
import type { string_uri } from '../../../types/typeAliases';
|
|
@@ -21,6 +22,12 @@ export type RemoteLlmExecutionToolsOptions = CommonExecutionToolsOptions & {
|
|
|
21
22
|
* @example '/promptbook/socket.io'
|
|
22
23
|
*/
|
|
23
24
|
readonly path: string_uri;
|
|
25
|
+
/**
|
|
26
|
+
* If set, only these models will be listed as available
|
|
27
|
+
*
|
|
28
|
+
* TODO: [🧠] !!!! Figure out better solution
|
|
29
|
+
*/
|
|
30
|
+
readonly models?: Array<AvailableModel>;
|
|
24
31
|
/**
|
|
25
32
|
* Mode of the server to connect to
|
|
26
33
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
/**
|
|
40
40
|
* The version of the Promptbook library
|
|
41
41
|
*/
|
|
42
|
-
var PROMPTBOOK_VERSION = '0.65.0-
|
|
42
|
+
var PROMPTBOOK_VERSION = '0.65.0-5';
|
|
43
43
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
44
44
|
|
|
45
45
|
/*! *****************************************************************************
|
|
@@ -860,7 +860,7 @@
|
|
|
860
860
|
});
|
|
861
861
|
}
|
|
862
862
|
|
|
863
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.65.0-
|
|
863
|
+
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"}];
|
|
864
864
|
|
|
865
865
|
/**
|
|
866
866
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -6631,9 +6631,10 @@
|
|
|
6631
6631
|
socket.on('connect', function () {
|
|
6632
6632
|
resolve(socket);
|
|
6633
6633
|
});
|
|
6634
|
+
// TODO: !!!! Better timeout handling
|
|
6634
6635
|
setTimeout(function () {
|
|
6635
6636
|
reject(new Error("Timeout while connecting to ".concat(_this.options.remoteUrl)));
|
|
6636
|
-
},
|
|
6637
|
+
}, 1000 /* <- TODO: Timeout to config */);
|
|
6637
6638
|
});
|
|
6638
6639
|
};
|
|
6639
6640
|
/**
|
|
@@ -6713,9 +6714,10 @@
|
|
|
6713
6714
|
RemoteLlmExecutionTools.prototype.listModels = function () {
|
|
6714
6715
|
return __awaiter(this, void 0, void 0, function () {
|
|
6715
6716
|
return __generator(this, function (_a) {
|
|
6716
|
-
return [2 /*return*/,
|
|
6717
|
-
|
|
6718
|
-
|
|
6717
|
+
return [2 /*return*/, (this.options.models ||
|
|
6718
|
+
[
|
|
6719
|
+
/* !!! */
|
|
6720
|
+
])];
|
|
6719
6721
|
});
|
|
6720
6722
|
});
|
|
6721
6723
|
};
|
|
@@ -6729,48 +6731,6 @@
|
|
|
6729
6731
|
* TODO: [🧠] Maybe remove `@promptbook/remote-client` and just use `@promptbook/core`
|
|
6730
6732
|
*/
|
|
6731
6733
|
|
|
6732
|
-
/**
|
|
6733
|
-
* Helper of usage compute
|
|
6734
|
-
*
|
|
6735
|
-
* @param content the content of prompt or response
|
|
6736
|
-
* @returns part of PromptResultUsageCounts
|
|
6737
|
-
*
|
|
6738
|
-
* @private internal utility of LlmExecutionTools
|
|
6739
|
-
*/
|
|
6740
|
-
function computeUsageCounts(content) {
|
|
6741
|
-
return {
|
|
6742
|
-
charactersCount: { value: countCharacters(content) },
|
|
6743
|
-
wordsCount: { value: countWords(content) },
|
|
6744
|
-
sentencesCount: { value: countSentences(content) },
|
|
6745
|
-
linesCount: { value: countLines(content) },
|
|
6746
|
-
paragraphsCount: { value: countParagraphs(content) },
|
|
6747
|
-
pagesCount: { value: countPages(content) },
|
|
6748
|
-
};
|
|
6749
|
-
}
|
|
6750
|
-
|
|
6751
|
-
/**
|
|
6752
|
-
* Make UncertainNumber
|
|
6753
|
-
*
|
|
6754
|
-
* @param value
|
|
6755
|
-
*
|
|
6756
|
-
* @private utility for initializating UncertainNumber
|
|
6757
|
-
*/
|
|
6758
|
-
function uncertainNumber(value) {
|
|
6759
|
-
if (value === null || value === undefined || Number.isNaN(value)) {
|
|
6760
|
-
return { value: 0, isUncertain: true };
|
|
6761
|
-
}
|
|
6762
|
-
return { value: value };
|
|
6763
|
-
}
|
|
6764
|
-
|
|
6765
|
-
/**
|
|
6766
|
-
* Get current date in ISO 8601 format
|
|
6767
|
-
*
|
|
6768
|
-
* @private internal utility
|
|
6769
|
-
*/
|
|
6770
|
-
function getCurrentIsoDate() {
|
|
6771
|
-
return new Date().toISOString();
|
|
6772
|
-
}
|
|
6773
|
-
|
|
6774
6734
|
/**
|
|
6775
6735
|
* Function computeUsage will create price per one token based on the string value found on openai page
|
|
6776
6736
|
*
|
|
@@ -6854,6 +6814,48 @@
|
|
|
6854
6814
|
* TODO: [🕚] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
6855
6815
|
*/
|
|
6856
6816
|
|
|
6817
|
+
/**
|
|
6818
|
+
* Helper of usage compute
|
|
6819
|
+
*
|
|
6820
|
+
* @param content the content of prompt or response
|
|
6821
|
+
* @returns part of PromptResultUsageCounts
|
|
6822
|
+
*
|
|
6823
|
+
* @private internal utility of LlmExecutionTools
|
|
6824
|
+
*/
|
|
6825
|
+
function computeUsageCounts(content) {
|
|
6826
|
+
return {
|
|
6827
|
+
charactersCount: { value: countCharacters(content) },
|
|
6828
|
+
wordsCount: { value: countWords(content) },
|
|
6829
|
+
sentencesCount: { value: countSentences(content) },
|
|
6830
|
+
linesCount: { value: countLines(content) },
|
|
6831
|
+
paragraphsCount: { value: countParagraphs(content) },
|
|
6832
|
+
pagesCount: { value: countPages(content) },
|
|
6833
|
+
};
|
|
6834
|
+
}
|
|
6835
|
+
|
|
6836
|
+
/**
|
|
6837
|
+
* Make UncertainNumber
|
|
6838
|
+
*
|
|
6839
|
+
* @param value
|
|
6840
|
+
*
|
|
6841
|
+
* @private utility for initializating UncertainNumber
|
|
6842
|
+
*/
|
|
6843
|
+
function uncertainNumber(value) {
|
|
6844
|
+
if (value === null || value === undefined || Number.isNaN(value)) {
|
|
6845
|
+
return { value: 0, isUncertain: true };
|
|
6846
|
+
}
|
|
6847
|
+
return { value: value };
|
|
6848
|
+
}
|
|
6849
|
+
|
|
6850
|
+
/**
|
|
6851
|
+
* Get current date in ISO 8601 format
|
|
6852
|
+
*
|
|
6853
|
+
* @private internal utility
|
|
6854
|
+
*/
|
|
6855
|
+
function getCurrentIsoDate() {
|
|
6856
|
+
return new Date().toISOString();
|
|
6857
|
+
}
|
|
6858
|
+
|
|
6857
6859
|
/**
|
|
6858
6860
|
* Execution Tools for calling Anthropic Claude API.
|
|
6859
6861
|
*
|
|
@@ -7094,7 +7096,7 @@
|
|
|
7094
7096
|
className: 'AnthropicClaudeExecutionTools',
|
|
7095
7097
|
options: __assign(__assign({}, options), { isProxied: false }),
|
|
7096
7098
|
},
|
|
7097
|
-
] }));
|
|
7099
|
+
], models: ANTHROPIC_CLAUDE_MODELS }));
|
|
7098
7100
|
}
|
|
7099
7101
|
return new AnthropicClaudeExecutionTools(options);
|
|
7100
7102
|
}
|