@promptbook/cli 0.66.0-4 → 0.66.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 +132 -28
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/cli.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +6 -6
- package/esm/typings/src/_packages/types.index.d.ts +4 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.test.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/{$llmToolsConfigurationBoilerplatesRegister.d.ts → $llmToolsMetadataRegister.d.ts} +2 -4
- package/esm/typings/src/llm-providers/_common/LlmToolsConfiguration.d.ts +5 -3
- package/esm/typings/src/llm-providers/_common/LlmToolsMetadata.d.ts +27 -0
- package/esm/typings/src/llm-providers/_common/LlmToolsOptions.d.ts +7 -0
- package/esm/typings/src/llm-providers/_common/config.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +2 -1
- package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -1
- package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +1 -1
- package/esm/typings/src/personas/preparePersona.test.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +133 -27
- package/umd/index.umd.js.map +1 -1
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.66.0-
|
|
23
|
+
var PROMPTBOOK_VERSION = '0.66.0-5';
|
|
24
24
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
25
25
|
|
|
26
26
|
/*! *****************************************************************************
|
|
@@ -303,6 +303,18 @@ var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
|
303
303
|
* @private within the repository
|
|
304
304
|
*/
|
|
305
305
|
var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
|
|
306
|
+
/**
|
|
307
|
+
* @@@
|
|
308
|
+
*
|
|
309
|
+
* @public exported from `@promptbook/core`
|
|
310
|
+
*/
|
|
311
|
+
var DEFAULT_REMOTE_URL = 'https://api.pavolhejny.com/';
|
|
312
|
+
/**
|
|
313
|
+
* @@@
|
|
314
|
+
*
|
|
315
|
+
* @public exported from `@promptbook/core`
|
|
316
|
+
*/
|
|
317
|
+
var DEFAULT_REMOTE_URL_PATH = '/promptbook/socket.io';
|
|
306
318
|
/**
|
|
307
319
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
308
320
|
*/
|
|
@@ -835,7 +847,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
835
847
|
});
|
|
836
848
|
}
|
|
837
849
|
|
|
838
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.66.0-
|
|
850
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.66.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.66.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.66.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.66.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"}];
|
|
839
851
|
|
|
840
852
|
/**
|
|
841
853
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -8111,7 +8123,7 @@ var createOpenAiExecutionTools = Object.assign(function (options) {
|
|
|
8111
8123
|
/**
|
|
8112
8124
|
* @@@
|
|
8113
8125
|
*
|
|
8114
|
-
* TODO: !!!!!!
|
|
8126
|
+
* TODO: !!!!!! Remove EXECUTION_TOOLS_CLASSES and use $llmToolsRegister instead
|
|
8115
8127
|
*
|
|
8116
8128
|
* @private internal type for `createLlmToolsFromConfiguration`
|
|
8117
8129
|
*/
|
|
@@ -8159,6 +8171,38 @@ function createLlmToolsFromConfiguration(configuration, options) {
|
|
|
8159
8171
|
* TODO: This should be maybe not under `_common` but under `utils`
|
|
8160
8172
|
*/
|
|
8161
8173
|
|
|
8174
|
+
/**
|
|
8175
|
+
* Register is @@@
|
|
8176
|
+
*
|
|
8177
|
+
* @private internal utility, exported are only signleton instances of this class
|
|
8178
|
+
*/
|
|
8179
|
+
var Register = /** @class */ (function () {
|
|
8180
|
+
function Register(storage) {
|
|
8181
|
+
this.storage = storage;
|
|
8182
|
+
}
|
|
8183
|
+
Register.prototype.list = function () {
|
|
8184
|
+
// <- TODO: ReadonlyDeep<Array<TRegistered>>
|
|
8185
|
+
return this.storage;
|
|
8186
|
+
};
|
|
8187
|
+
Register.prototype.register = function (registered) {
|
|
8188
|
+
// !!!!!! <- TODO: What to return here
|
|
8189
|
+
// TODO: !!!!!! Compare if same is not already registered
|
|
8190
|
+
this.storage.push(registered);
|
|
8191
|
+
};
|
|
8192
|
+
return Register;
|
|
8193
|
+
}());
|
|
8194
|
+
|
|
8195
|
+
/**
|
|
8196
|
+
* @@@
|
|
8197
|
+
*
|
|
8198
|
+
* Note: `$` is used to indicate that this interacts with the global scope
|
|
8199
|
+
* @singleton Only one instance of each register is created per build, but thare can be more @@@
|
|
8200
|
+
* @public exported from `@promptbook/core`
|
|
8201
|
+
*/
|
|
8202
|
+
var $llmToolsMetadataRegister = new Register([
|
|
8203
|
+
// TODO: !!!!!! Take from global scope
|
|
8204
|
+
]);
|
|
8205
|
+
|
|
8162
8206
|
/**
|
|
8163
8207
|
* @@@
|
|
8164
8208
|
*
|
|
@@ -8176,28 +8220,10 @@ function createLlmToolsFromConfigurationFromEnv() {
|
|
|
8176
8220
|
throw new EnvironmentMismatchError('Function `createLlmToolsFromEnv` works only in Node.js environment');
|
|
8177
8221
|
}
|
|
8178
8222
|
dotenv.config();
|
|
8179
|
-
var llmToolsConfiguration =
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
packageName: '@promptbook/openai',
|
|
8184
|
-
className: 'OpenAiExecutionTools',
|
|
8185
|
-
options: {
|
|
8186
|
-
apiKey: process.env.OPENAI_API_KEY,
|
|
8187
|
-
},
|
|
8188
|
-
});
|
|
8189
|
-
}
|
|
8190
|
-
if (typeof process.env.ANTHROPIC_CLAUDE_API_KEY === 'string') {
|
|
8191
|
-
llmToolsConfiguration.push({
|
|
8192
|
-
title: 'Claude (from env)',
|
|
8193
|
-
packageName: '@promptbook/antrhopic-claude',
|
|
8194
|
-
className: 'AnthropicClaudeExecutionTools',
|
|
8195
|
-
options: {
|
|
8196
|
-
apiKey: process.env.ANTHROPIC_CLAUDE_API_KEY,
|
|
8197
|
-
},
|
|
8198
|
-
});
|
|
8199
|
-
}
|
|
8200
|
-
// <- Note: [🦑] Add here new LLM provider
|
|
8223
|
+
var llmToolsConfiguration = $llmToolsMetadataRegister
|
|
8224
|
+
.list()
|
|
8225
|
+
.map(function (metadata) { return metadata.createConfigurationFromEnv(process.env); })
|
|
8226
|
+
.filter(function (configuration) { return configuration !== null; });
|
|
8201
8227
|
return llmToolsConfiguration;
|
|
8202
8228
|
}
|
|
8203
8229
|
/**
|
|
@@ -8232,7 +8258,7 @@ function createLlmToolsFromEnv(options) {
|
|
|
8232
8258
|
var configuration = createLlmToolsFromConfigurationFromEnv();
|
|
8233
8259
|
if (configuration.length === 0) {
|
|
8234
8260
|
// TODO: [🥃]
|
|
8235
|
-
throw new Error(spaceTrim("\n No LLM tools found in the environment\n\n Please set one of environment variables:\n - OPENAI_API_KEY\n - ANTHROPIC_CLAUDE_API_KEY\n "));
|
|
8261
|
+
throw new Error(spaceTrim("\n No LLM tools found in the environment\n\n !!!!!!!@@@@You have maybe forgotten to two things:\n\n Please set one of environment variables:\n - OPENAI_API_KEY\n - ANTHROPIC_CLAUDE_API_KEY\n "));
|
|
8236
8262
|
}
|
|
8237
8263
|
return createLlmToolsFromConfiguration(configuration, options);
|
|
8238
8264
|
}
|
|
@@ -8450,6 +8476,7 @@ function getLlmToolsForCli(options) {
|
|
|
8450
8476
|
* TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
|
|
8451
8477
|
*/
|
|
8452
8478
|
|
|
8479
|
+
// TODO: !!!!!! Probbably all LLM tools should be registered in `@promptbook/cli`
|
|
8453
8480
|
/**
|
|
8454
8481
|
* Initializes `make` command for Promptbook CLI utilities
|
|
8455
8482
|
*
|
|
@@ -8634,7 +8661,7 @@ function initializeMakeCommand(program) {
|
|
|
8634
8661
|
});
|
|
8635
8662
|
}
|
|
8636
8663
|
/**
|
|
8637
|
-
* TODO: [🥃] !!! Allow `ptbk make` without llm tools
|
|
8664
|
+
* TODO: [🥃] !!! Allow `ptbk make` without configuring any llm tools
|
|
8638
8665
|
* TODO: Maybe remove this command - "about" command should be enough?
|
|
8639
8666
|
* TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
|
|
8640
8667
|
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
@@ -8969,5 +8996,82 @@ var __CLI = {
|
|
|
8969
8996
|
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
8970
8997
|
*/
|
|
8971
8998
|
|
|
8972
|
-
|
|
8999
|
+
/**
|
|
9000
|
+
* @@@ registration1 of default configuration for Anthropic Claude
|
|
9001
|
+
*
|
|
9002
|
+
* Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
|
|
9003
|
+
*
|
|
9004
|
+
* @public exported from `@promptbook/core`
|
|
9005
|
+
* @public exported from `@promptbook/cli`
|
|
9006
|
+
*/
|
|
9007
|
+
var _AnthropicClaudeMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
9008
|
+
title: 'Anthropic Claude',
|
|
9009
|
+
packageName: '@promptbook/anthropic-claude',
|
|
9010
|
+
className: 'AnthropicClaudeExecutionTools',
|
|
9011
|
+
getBoilerplateConfiguration: function () {
|
|
9012
|
+
return {
|
|
9013
|
+
title: 'Anthropic Claude (boilerplate)',
|
|
9014
|
+
packageName: '@promptbook/anthropic-claude',
|
|
9015
|
+
className: 'AnthropicClaudeExecutionTools',
|
|
9016
|
+
options: {
|
|
9017
|
+
apiKey: 'sk-ant-api03-',
|
|
9018
|
+
isProxied: true,
|
|
9019
|
+
remoteUrl: DEFAULT_REMOTE_URL,
|
|
9020
|
+
path: DEFAULT_REMOTE_URL_PATH,
|
|
9021
|
+
},
|
|
9022
|
+
};
|
|
9023
|
+
},
|
|
9024
|
+
createConfigurationFromEnv: function (env) {
|
|
9025
|
+
if (typeof env.ANTHROPIC_CLAUDE_API_KEY === 'string') {
|
|
9026
|
+
return {
|
|
9027
|
+
title: 'Claude (from env)',
|
|
9028
|
+
packageName: '@promptbook/antrhopic-claude',
|
|
9029
|
+
className: 'AnthropicClaudeExecutionTools',
|
|
9030
|
+
options: {
|
|
9031
|
+
apiKey: process.env.ANTHROPIC_CLAUDE_API_KEY,
|
|
9032
|
+
},
|
|
9033
|
+
};
|
|
9034
|
+
}
|
|
9035
|
+
return null;
|
|
9036
|
+
},
|
|
9037
|
+
});
|
|
9038
|
+
|
|
9039
|
+
/**
|
|
9040
|
+
* @@@ registration1 of default configuration for Open AI
|
|
9041
|
+
*
|
|
9042
|
+
* Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
|
|
9043
|
+
*
|
|
9044
|
+
* @public exported from `@promptbook/core`
|
|
9045
|
+
* @public exported from `@promptbook/cli`
|
|
9046
|
+
*/
|
|
9047
|
+
var _OpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
9048
|
+
title: 'Anthropic Claude',
|
|
9049
|
+
packageName: '@promptbook/anthropic-claude',
|
|
9050
|
+
className: 'AnthropicClaudeExecutionTools',
|
|
9051
|
+
getBoilerplateConfiguration: function () {
|
|
9052
|
+
return {
|
|
9053
|
+
title: 'Open AI (boilerplate)',
|
|
9054
|
+
packageName: '@promptbook/openai',
|
|
9055
|
+
className: 'OpenAiExecutionTools',
|
|
9056
|
+
options: {
|
|
9057
|
+
apiKey: 'sk-',
|
|
9058
|
+
},
|
|
9059
|
+
};
|
|
9060
|
+
},
|
|
9061
|
+
createConfigurationFromEnv: function (env) {
|
|
9062
|
+
if (typeof env.OPENAI_API_KEY === 'string') {
|
|
9063
|
+
return {
|
|
9064
|
+
title: 'Open AI (from env)',
|
|
9065
|
+
packageName: '@promptbook/openai',
|
|
9066
|
+
className: 'OpenAiExecutionTools',
|
|
9067
|
+
options: {
|
|
9068
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
9069
|
+
},
|
|
9070
|
+
};
|
|
9071
|
+
}
|
|
9072
|
+
return null;
|
|
9073
|
+
},
|
|
9074
|
+
});
|
|
9075
|
+
|
|
9076
|
+
export { PROMPTBOOK_VERSION, _AnthropicClaudeMetadataRegistration, _OpenAiMetadataRegistration, __CLI };
|
|
8973
9077
|
//# sourceMappingURL=index.es.js.map
|