@promptbook/node 0.65.0-5 → 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
|
@@ -17,7 +17,7 @@ import OpenAI from 'openai';
|
|
|
17
17
|
/**
|
|
18
18
|
* The version of the Promptbook library
|
|
19
19
|
*/
|
|
20
|
-
var PROMPTBOOK_VERSION = '0.65.0-
|
|
20
|
+
var PROMPTBOOK_VERSION = '0.65.0-5';
|
|
21
21
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
22
22
|
|
|
23
23
|
/*! *****************************************************************************
|
|
@@ -692,7 +692,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
692
692
|
});
|
|
693
693
|
}
|
|
694
694
|
|
|
695
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.65.0-
|
|
695
|
+
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"}];
|
|
696
696
|
|
|
697
697
|
/**
|
|
698
698
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -6459,9 +6459,10 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
6459
6459
|
RemoteLlmExecutionTools.prototype.listModels = function () {
|
|
6460
6460
|
return __awaiter(this, void 0, void 0, function () {
|
|
6461
6461
|
return __generator(this, function (_a) {
|
|
6462
|
-
return [2 /*return*/,
|
|
6463
|
-
|
|
6464
|
-
|
|
6462
|
+
return [2 /*return*/, (this.options.models ||
|
|
6463
|
+
[
|
|
6464
|
+
/* !!! */
|
|
6465
|
+
])];
|
|
6465
6466
|
});
|
|
6466
6467
|
});
|
|
6467
6468
|
};
|
|
@@ -6475,48 +6476,6 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
6475
6476
|
* TODO: [🧠] Maybe remove `@promptbook/remote-client` and just use `@promptbook/core`
|
|
6476
6477
|
*/
|
|
6477
6478
|
|
|
6478
|
-
/**
|
|
6479
|
-
* Helper of usage compute
|
|
6480
|
-
*
|
|
6481
|
-
* @param content the content of prompt or response
|
|
6482
|
-
* @returns part of PromptResultUsageCounts
|
|
6483
|
-
*
|
|
6484
|
-
* @private internal utility of LlmExecutionTools
|
|
6485
|
-
*/
|
|
6486
|
-
function computeUsageCounts(content) {
|
|
6487
|
-
return {
|
|
6488
|
-
charactersCount: { value: countCharacters(content) },
|
|
6489
|
-
wordsCount: { value: countWords(content) },
|
|
6490
|
-
sentencesCount: { value: countSentences(content) },
|
|
6491
|
-
linesCount: { value: countLines(content) },
|
|
6492
|
-
paragraphsCount: { value: countParagraphs(content) },
|
|
6493
|
-
pagesCount: { value: countPages(content) },
|
|
6494
|
-
};
|
|
6495
|
-
}
|
|
6496
|
-
|
|
6497
|
-
/**
|
|
6498
|
-
* Make UncertainNumber
|
|
6499
|
-
*
|
|
6500
|
-
* @param value
|
|
6501
|
-
*
|
|
6502
|
-
* @private utility for initializating UncertainNumber
|
|
6503
|
-
*/
|
|
6504
|
-
function uncertainNumber(value) {
|
|
6505
|
-
if (value === null || value === undefined || Number.isNaN(value)) {
|
|
6506
|
-
return { value: 0, isUncertain: true };
|
|
6507
|
-
}
|
|
6508
|
-
return { value: value };
|
|
6509
|
-
}
|
|
6510
|
-
|
|
6511
|
-
/**
|
|
6512
|
-
* Get current date in ISO 8601 format
|
|
6513
|
-
*
|
|
6514
|
-
* @private internal utility
|
|
6515
|
-
*/
|
|
6516
|
-
function getCurrentIsoDate() {
|
|
6517
|
-
return new Date().toISOString();
|
|
6518
|
-
}
|
|
6519
|
-
|
|
6520
6479
|
/**
|
|
6521
6480
|
* Function computeUsage will create price per one token based on the string value found on openai page
|
|
6522
6481
|
*
|
|
@@ -6600,6 +6559,48 @@ var ANTHROPIC_CLAUDE_MODELS = [
|
|
|
6600
6559
|
* TODO: [🕚] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
6601
6560
|
*/
|
|
6602
6561
|
|
|
6562
|
+
/**
|
|
6563
|
+
* Helper of usage compute
|
|
6564
|
+
*
|
|
6565
|
+
* @param content the content of prompt or response
|
|
6566
|
+
* @returns part of PromptResultUsageCounts
|
|
6567
|
+
*
|
|
6568
|
+
* @private internal utility of LlmExecutionTools
|
|
6569
|
+
*/
|
|
6570
|
+
function computeUsageCounts(content) {
|
|
6571
|
+
return {
|
|
6572
|
+
charactersCount: { value: countCharacters(content) },
|
|
6573
|
+
wordsCount: { value: countWords(content) },
|
|
6574
|
+
sentencesCount: { value: countSentences(content) },
|
|
6575
|
+
linesCount: { value: countLines(content) },
|
|
6576
|
+
paragraphsCount: { value: countParagraphs(content) },
|
|
6577
|
+
pagesCount: { value: countPages(content) },
|
|
6578
|
+
};
|
|
6579
|
+
}
|
|
6580
|
+
|
|
6581
|
+
/**
|
|
6582
|
+
* Make UncertainNumber
|
|
6583
|
+
*
|
|
6584
|
+
* @param value
|
|
6585
|
+
*
|
|
6586
|
+
* @private utility for initializating UncertainNumber
|
|
6587
|
+
*/
|
|
6588
|
+
function uncertainNumber(value) {
|
|
6589
|
+
if (value === null || value === undefined || Number.isNaN(value)) {
|
|
6590
|
+
return { value: 0, isUncertain: true };
|
|
6591
|
+
}
|
|
6592
|
+
return { value: value };
|
|
6593
|
+
}
|
|
6594
|
+
|
|
6595
|
+
/**
|
|
6596
|
+
* Get current date in ISO 8601 format
|
|
6597
|
+
*
|
|
6598
|
+
* @private internal utility
|
|
6599
|
+
*/
|
|
6600
|
+
function getCurrentIsoDate() {
|
|
6601
|
+
return new Date().toISOString();
|
|
6602
|
+
}
|
|
6603
|
+
|
|
6603
6604
|
/**
|
|
6604
6605
|
* Execution Tools for calling Anthropic Claude API.
|
|
6605
6606
|
*
|
|
@@ -6840,7 +6841,7 @@ function createAnthropicClaudeExecutionTools(options) {
|
|
|
6840
6841
|
className: 'AnthropicClaudeExecutionTools',
|
|
6841
6842
|
options: __assign(__assign({}, options), { isProxied: false }),
|
|
6842
6843
|
},
|
|
6843
|
-
] }));
|
|
6844
|
+
], models: ANTHROPIC_CLAUDE_MODELS }));
|
|
6844
6845
|
}
|
|
6845
6846
|
return new AnthropicClaudeExecutionTools(options);
|
|
6846
6847
|
}
|