@promptbook/node 0.67.1 → 0.67.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 +24 -23
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +0 -2
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/errors/{_ExpectError.d.ts → ExpectError.d.ts} +2 -1
- package/esm/typings/src/errors/index.d.ts +2 -0
- package/esm/typings/src/prepare/preparePipeline.d.ts +2 -0
- package/package.json +2 -2
- package/umd/index.umd.js +24 -23
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -13,7 +13,7 @@ import * as dotenv from 'dotenv';
|
|
|
13
13
|
/**
|
|
14
14
|
* The version of the Promptbook library
|
|
15
15
|
*/
|
|
16
|
-
var PROMPTBOOK_VERSION = '0.67.
|
|
16
|
+
var PROMPTBOOK_VERSION = '0.67.1';
|
|
17
17
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
18
18
|
|
|
19
19
|
/*! *****************************************************************************
|
|
@@ -867,7 +867,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
867
867
|
});
|
|
868
868
|
}
|
|
869
869
|
|
|
870
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.67.
|
|
870
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.67.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"},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.67.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"},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.67.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"},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.67.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"},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- Your output format is JSON object\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `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### Key `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"}];
|
|
871
871
|
|
|
872
872
|
/**
|
|
873
873
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -1894,6 +1894,25 @@ var EnvironmentMismatchError = /** @class */ (function (_super) {
|
|
|
1894
1894
|
return EnvironmentMismatchError;
|
|
1895
1895
|
}(Error));
|
|
1896
1896
|
|
|
1897
|
+
/**
|
|
1898
|
+
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
1899
|
+
*
|
|
1900
|
+
* @public exported from `@promptbook/core`
|
|
1901
|
+
* Note: Do not throw this error, its reserved for `checkExpectations` and `createPipelineExecutor` and public ONLY to be serializable through remote server
|
|
1902
|
+
* Note: Always thrown in `checkExpectations` and catched in `createPipelineExecutor` and rethrown as `PipelineExecutionError`
|
|
1903
|
+
* Note: This is a kindof subtype of PipelineExecutionError
|
|
1904
|
+
*/
|
|
1905
|
+
var ExpectError = /** @class */ (function (_super) {
|
|
1906
|
+
__extends(ExpectError, _super);
|
|
1907
|
+
function ExpectError(message) {
|
|
1908
|
+
var _this = _super.call(this, message) || this;
|
|
1909
|
+
_this.name = 'ExpectError';
|
|
1910
|
+
Object.setPrototypeOf(_this, ExpectError.prototype);
|
|
1911
|
+
return _this;
|
|
1912
|
+
}
|
|
1913
|
+
return ExpectError;
|
|
1914
|
+
}(Error));
|
|
1915
|
+
|
|
1897
1916
|
/**
|
|
1898
1917
|
* This error type indicates that some limit was reached
|
|
1899
1918
|
*
|
|
@@ -1932,6 +1951,7 @@ var NotYetImplementedError = /** @class */ (function (_super) {
|
|
|
1932
1951
|
* @public exported from `@promptbook/core`
|
|
1933
1952
|
*/
|
|
1934
1953
|
var ERRORS = {
|
|
1954
|
+
ExpectError: ExpectError,
|
|
1935
1955
|
CollectionError: CollectionError,
|
|
1936
1956
|
EnvironmentMismatchError: EnvironmentMismatchError,
|
|
1937
1957
|
LimitReachedError: LimitReachedError,
|
|
@@ -2099,24 +2119,6 @@ function extractParameterNamesFromPromptTemplate(promptTemplate) {
|
|
|
2099
2119
|
* TODO: [🔣] If script require contentLanguage
|
|
2100
2120
|
*/
|
|
2101
2121
|
|
|
2102
|
-
/**
|
|
2103
|
-
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
2104
|
-
*
|
|
2105
|
-
* @private error of `checkExpectations` and `createPipelineExecutor`
|
|
2106
|
-
* Note: Always thrown in `checkExpectations` and catched in `createPipelineExecutor` and rethrown as `PipelineExecutionError`
|
|
2107
|
-
* Note: This is a kindof subtype of PipelineExecutionError
|
|
2108
|
-
*/
|
|
2109
|
-
var ExpectError = /** @class */ (function (_super) {
|
|
2110
|
-
__extends(ExpectError, _super);
|
|
2111
|
-
function ExpectError(message) {
|
|
2112
|
-
var _this = _super.call(this, message) || this;
|
|
2113
|
-
_this.name = 'ExpectError';
|
|
2114
|
-
Object.setPrototypeOf(_this, ExpectError.prototype);
|
|
2115
|
-
return _this;
|
|
2116
|
-
}
|
|
2117
|
-
return ExpectError;
|
|
2118
|
-
}(Error));
|
|
2119
|
-
|
|
2120
2122
|
/**
|
|
2121
2123
|
* Serializes an error into a [🚉] JSON-serializable object
|
|
2122
2124
|
*
|
|
@@ -3231,9 +3233,6 @@ function createPipelineExecutor(options) {
|
|
|
3231
3233
|
if (!(error_4 instanceof ExpectError)) {
|
|
3232
3234
|
throw error_4;
|
|
3233
3235
|
}
|
|
3234
|
-
if (error_4 instanceof UnexpectedError) {
|
|
3235
|
-
throw error_4;
|
|
3236
|
-
}
|
|
3237
3236
|
expectError = error_4;
|
|
3238
3237
|
return [3 /*break*/, 50];
|
|
3239
3238
|
case 49:
|
|
@@ -4052,6 +4051,8 @@ function preparePipeline(pipeline, options) {
|
|
|
4052
4051
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
4053
4052
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
4054
4053
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
4054
|
+
* TODO: [🧠][♏] Maybe if expecting JSON (In Anthropic Claude and other models without non-json) and its not specified in prompt content, append the instructions
|
|
4055
|
+
* @see https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency#specify-the-desired-output-format
|
|
4055
4056
|
*/
|
|
4056
4057
|
|
|
4057
4058
|
/**
|