@promptbook/node 0.66.0-9 → 0.66.0
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 +15 -11
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/config.d.ts +6 -0
- package/package.json +2 -2
- package/umd/index.umd.js +15 -11
- package/umd/index.umd.js.map +1 -1
|
@@ -17,6 +17,7 @@ import { PIPELINE_COLLECTION_BASE_FILENAME } from '../config';
|
|
|
17
17
|
import { RESERVED_PARAMETER_NAMES } from '../config';
|
|
18
18
|
import { DEFAULT_REMOTE_URL } from '../config';
|
|
19
19
|
import { DEFAULT_REMOTE_URL_PATH } from '../config';
|
|
20
|
+
import { IS_VERBOSE } from '../config';
|
|
20
21
|
import { pipelineJsonToString } from '../conversion/pipelineJsonToString';
|
|
21
22
|
import type { PipelineStringToJsonOptions } from '../conversion/pipelineStringToJson';
|
|
22
23
|
import { pipelineStringToJson } from '../conversion/pipelineStringToJson';
|
|
@@ -88,6 +89,7 @@ export { PIPELINE_COLLECTION_BASE_FILENAME };
|
|
|
88
89
|
export { RESERVED_PARAMETER_NAMES };
|
|
89
90
|
export { DEFAULT_REMOTE_URL };
|
|
90
91
|
export { DEFAULT_REMOTE_URL_PATH };
|
|
92
|
+
export { IS_VERBOSE };
|
|
91
93
|
export { pipelineJsonToString };
|
|
92
94
|
export type { PipelineStringToJsonOptions };
|
|
93
95
|
export { pipelineStringToJson };
|
|
@@ -119,6 +119,12 @@ export declare const DEFAULT_REMOTE_URL = "https://api.pavolhejny.com/";
|
|
|
119
119
|
* @public exported from `@promptbook/core`
|
|
120
120
|
*/
|
|
121
121
|
export declare const DEFAULT_REMOTE_URL_PATH = "/promptbook/socket.io";
|
|
122
|
+
/**
|
|
123
|
+
* @@@
|
|
124
|
+
*
|
|
125
|
+
* @public exported from `@promptbook/core`
|
|
126
|
+
*/
|
|
127
|
+
export declare const IS_VERBOSE = false;
|
|
122
128
|
/**
|
|
123
129
|
* @@@
|
|
124
130
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/node",
|
|
3
|
-
"version": "0.66.0
|
|
3
|
+
"version": "0.66.0",
|
|
4
4
|
"description": "Supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"module": "./esm/index.es.js",
|
|
48
48
|
"typings": "./esm/typings/src/_packages/node.index.d.ts",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.66.0
|
|
50
|
+
"@promptbook/core": "0.66.0"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
/**
|
|
36
36
|
* The version of the Promptbook library
|
|
37
37
|
*/
|
|
38
|
-
var PROMPTBOOK_VERSION = '0.66.0-
|
|
38
|
+
var PROMPTBOOK_VERSION = '0.66.0-9';
|
|
39
39
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
40
40
|
|
|
41
41
|
/*! *****************************************************************************
|
|
@@ -287,6 +287,13 @@
|
|
|
287
287
|
* @private within the repository
|
|
288
288
|
*/
|
|
289
289
|
var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
|
|
290
|
+
// <- TODO: [🧜♂️]
|
|
291
|
+
/**
|
|
292
|
+
* @@@
|
|
293
|
+
*
|
|
294
|
+
* @public exported from `@promptbook/core`
|
|
295
|
+
*/
|
|
296
|
+
var IS_VERBOSE = false;
|
|
290
297
|
/**
|
|
291
298
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
292
299
|
*/
|
|
@@ -734,7 +741,7 @@
|
|
|
734
741
|
});
|
|
735
742
|
}
|
|
736
743
|
|
|
737
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.66.0-
|
|
744
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.66.0-9",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.66.0-9",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.66.0-9",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.66.0-9",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"}];
|
|
738
745
|
|
|
739
746
|
/**
|
|
740
747
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -2591,7 +2598,7 @@
|
|
|
2591
2598
|
function createPipelineExecutor(options) {
|
|
2592
2599
|
var _this = this;
|
|
2593
2600
|
var pipeline = options.pipeline, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
|
|
2594
|
-
var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? MAX_EXECUTION_ATTEMPTS : _b, _c = settings.maxParallelCount, maxParallelCount = _c === void 0 ? MAX_PARALLEL_COUNT : _c, _d = settings.isVerbose, isVerbose = _d === void 0 ?
|
|
2601
|
+
var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? MAX_EXECUTION_ATTEMPTS : _b, _c = settings.maxParallelCount, maxParallelCount = _c === void 0 ? MAX_PARALLEL_COUNT : _c, _d = settings.isVerbose, isVerbose = _d === void 0 ? IS_VERBOSE : _d, _e = settings.isNotPreparedWarningSupressed, isNotPreparedWarningSupressed = _e === void 0 ? false : _e;
|
|
2595
2602
|
validatePipeline(pipeline);
|
|
2596
2603
|
var llmTools = joinLlmExecutionTools.apply(void 0, __spreadArray([], __read(arrayableToArray(tools.llm)), false));
|
|
2597
2604
|
var preparedPipeline;
|
|
@@ -3386,7 +3393,7 @@
|
|
|
3386
3393
|
return __generator(this, function (_j) {
|
|
3387
3394
|
switch (_j.label) {
|
|
3388
3395
|
case 0:
|
|
3389
|
-
llmTools = options.llmTools, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ?
|
|
3396
|
+
llmTools = options.llmTools, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ? IS_VERBOSE : _b;
|
|
3390
3397
|
TODO_USE(maxParallelCount); // <- [🪂]
|
|
3391
3398
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
3392
3399
|
_c = createPipelineExecutor;
|
|
@@ -3673,7 +3680,7 @@
|
|
|
3673
3680
|
return __generator(this, function (_d) {
|
|
3674
3681
|
switch (_d.label) {
|
|
3675
3682
|
case 0:
|
|
3676
|
-
llmTools = options.llmTools, _a = options.isVerbose, isVerbose = _a === void 0 ?
|
|
3683
|
+
llmTools = options.llmTools, _a = options.isVerbose, isVerbose = _a === void 0 ? IS_VERBOSE : _a;
|
|
3677
3684
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
3678
3685
|
_b = createPipelineExecutor;
|
|
3679
3686
|
_c = {};
|
|
@@ -3830,7 +3837,7 @@
|
|
|
3830
3837
|
if (isPipelinePrepared(pipeline)) {
|
|
3831
3838
|
return [2 /*return*/, pipeline];
|
|
3832
3839
|
}
|
|
3833
|
-
llmTools = options.llmTools, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ?
|
|
3840
|
+
llmTools = options.llmTools, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ? IS_VERBOSE : _b;
|
|
3834
3841
|
parameters = pipeline.parameters, promptTemplates = pipeline.promptTemplates, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
|
|
3835
3842
|
llmToolsWithUsage = countTotalUsage(llmTools);
|
|
3836
3843
|
currentPreparation = {
|
|
@@ -6195,7 +6202,7 @@
|
|
|
6195
6202
|
// TODO: !! Implement;
|
|
6196
6203
|
// TODO: [🌗]
|
|
6197
6204
|
}
|
|
6198
|
-
_a = options || {}, _b = _a.isRecursive, isRecursive = _b === void 0 ? true : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ?
|
|
6205
|
+
_a = options || {}, _b = _a.isRecursive, isRecursive = _b === void 0 ? true : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ? IS_VERBOSE : _c, _d = _a.isLazyLoaded, isLazyLoaded = _d === void 0 ? false : _d, _e = _a.isCrashedOnError, isCrashedOnError = _e === void 0 ? true : _e;
|
|
6199
6206
|
collection = createCollectionFromPromise(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
6200
6207
|
var fileNames, collection, _loop_1, fileNames_1, fileNames_1_1, fileName, e_1_1;
|
|
6201
6208
|
var e_1, _a;
|
|
@@ -6413,13 +6420,10 @@
|
|
|
6413
6420
|
var packageName = registered.packageName, className = registered.className;
|
|
6414
6421
|
var existingRegistrationIndex = this.storage.findIndex(function (item) { return item.packageName === packageName && item.className === className; });
|
|
6415
6422
|
var existingRegistration = this.storage[existingRegistrationIndex];
|
|
6416
|
-
// TODO: !!!!!! Global IS_VERBOSE mode
|
|
6417
6423
|
if (!existingRegistration) {
|
|
6418
|
-
console.warn("[\uD83D\uDCE6] Registering `".concat(packageName, ".").concat(className, "` to `").concat(this.storageName, "`"));
|
|
6419
6424
|
this.storage.push(registered);
|
|
6420
6425
|
}
|
|
6421
6426
|
else {
|
|
6422
|
-
console.warn("[\uD83D\uDCE6] Re-registering `".concat(packageName, ".").concat(className, "` to `").concat(this.storageName, "`"));
|
|
6423
6427
|
this.storage[existingRegistrationIndex] = registered;
|
|
6424
6428
|
}
|
|
6425
6429
|
};
|
|
@@ -6583,7 +6587,7 @@
|
|
|
6583
6587
|
*/
|
|
6584
6588
|
function createLlmToolsFromConfiguration(configuration, options) {
|
|
6585
6589
|
if (options === void 0) { options = {}; }
|
|
6586
|
-
var _a = options.isVerbose, isVerbose = _a === void 0 ?
|
|
6590
|
+
var _a = options.isVerbose, isVerbose = _a === void 0 ? IS_VERBOSE : _a;
|
|
6587
6591
|
var llmTools = configuration.map(function (llmConfiguration) {
|
|
6588
6592
|
var registeredItem = $llmToolsRegister
|
|
6589
6593
|
.list()
|