@promptbook/cli 0.63.0-8 → 0.63.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/README.md +45 -253
- package/esm/index.es.js +11 -11
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/_packages/types.index.d.ts +0 -2
- package/esm/typings/src/cli/cli-commands/make.d.ts +1 -0
- package/esm/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +1 -0
- package/esm/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +1 -0
- package/esm/typings/src/types/ModelVariant.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/Expectations.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +11 -11
- package/umd/index.umd.js.map +1 -1
|
@@ -59,6 +59,8 @@ import { PrefixStorage } from '../storage/utils/PrefixStorage';
|
|
|
59
59
|
import { executionReportJsonToString } from '../types/execution-report/executionReportJsonToString';
|
|
60
60
|
import type { ExecutionReportStringOptions } from '../types/execution-report/ExecutionReportStringOptions';
|
|
61
61
|
import { ExecutionReportStringOptionsDefaults } from '../types/execution-report/ExecutionReportStringOptions';
|
|
62
|
+
import { MODEL_VARIANTS } from '../types/ModelVariant';
|
|
63
|
+
import { EXPECTATION_UNITS } from '../types/PipelineJson/Expectations';
|
|
62
64
|
export { PROMPTBOOK_VERSION };
|
|
63
65
|
export { collectionToJson };
|
|
64
66
|
export { createCollectionFromJson };
|
|
@@ -120,3 +122,5 @@ export { PrefixStorage };
|
|
|
120
122
|
export { executionReportJsonToString };
|
|
121
123
|
export type { ExecutionReportStringOptions };
|
|
122
124
|
export { ExecutionReportStringOptionsDefaults };
|
|
125
|
+
export { MODEL_VARIANTS };
|
|
126
|
+
export { EXPECTATION_UNITS };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PROMPTBOOK_VERSION } from '../version';
|
|
2
1
|
import type { PipelineCollection } from '../collection/PipelineCollection';
|
|
3
2
|
import type { Command } from '../commands/_common/types/Command';
|
|
4
3
|
import type { CommandParser } from '../commands/_common/types/CommandParser';
|
|
@@ -205,7 +204,6 @@ import type { string_snake_case } from '../utils/normalization/normalizeTo_snake
|
|
|
205
204
|
import type { really_any } from '../utils/organization/really_any';
|
|
206
205
|
import type { TODO_any } from '../utils/organization/TODO_any';
|
|
207
206
|
import type { string_promptbook_version } from '../version';
|
|
208
|
-
export { PROMPTBOOK_VERSION };
|
|
209
207
|
export type { PipelineCollection };
|
|
210
208
|
export type { Command };
|
|
211
209
|
export type { CommandParser };
|
|
@@ -6,6 +6,7 @@ import type { Command as Program } from 'commander';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function initializeMakeCommand(program: Program): void;
|
|
8
8
|
/**
|
|
9
|
+
* TODO: [🥃] !!! Allow `ptbk make` without llm tools
|
|
9
10
|
* TODO: Maybe remove this command - "about" command should be enough?
|
|
10
11
|
* TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
|
|
11
12
|
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
@@ -36,4 +36,5 @@ export declare function createLlmToolsFromEnv(options?: CreateLlmToolsFromEnvOpt
|
|
|
36
36
|
* TODO: [🧠] Maybe pass env as argument
|
|
37
37
|
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
38
38
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
39
|
+
* TODO: [🥃] Allow `ptbk make` without llm tools
|
|
39
40
|
*/
|
|
@@ -10,6 +10,6 @@ export type ModelVariant = TupleToUnion<typeof MODEL_VARIANTS>;
|
|
|
10
10
|
/**
|
|
11
11
|
* @@@
|
|
12
12
|
*
|
|
13
|
-
* @
|
|
13
|
+
* @public exported from `@promptbook/core`
|
|
14
14
|
*/
|
|
15
15
|
export declare const MODEL_VARIANTS: readonly ["COMPLETION", "CHAT", "EMBEDDING"];
|
|
@@ -24,7 +24,7 @@ export type ExpectationUnit = TupleToUnion<typeof EXPECTATION_UNITS>;
|
|
|
24
24
|
* Units of text measurement
|
|
25
25
|
*
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook/discussions/30
|
|
27
|
-
* @
|
|
27
|
+
* @public exported from `@promptbook/core`
|
|
28
28
|
*/
|
|
29
29
|
export declare const EXPECTATION_UNITS: readonly ["CHARACTERS", "WORDS", "SENTENCES", "LINES", "PARAGRAPHS", "PAGES"];
|
|
30
30
|
/**
|
|
@@ -14,7 +14,7 @@ export type LlmTemplateJson = PromptTemplateJsonCommon & {
|
|
|
14
14
|
* Requirements for the model
|
|
15
15
|
* - This is required only for blockType PROMPT_TEMPLATE
|
|
16
16
|
*/
|
|
17
|
-
readonly modelRequirements
|
|
17
|
+
readonly modelRequirements?: Partial<ModelRequirements>;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* TODO: [🧠][🥜]
|
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.63.0-
|
|
42
|
+
var PROMPTBOOK_VERSION = '0.63.0-10';
|
|
43
43
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
44
44
|
|
|
45
45
|
/*! *****************************************************************************
|
|
@@ -535,7 +535,7 @@
|
|
|
535
535
|
var contentLanguage = 'text';
|
|
536
536
|
if (blockType === 'PROMPT_TEMPLATE') {
|
|
537
537
|
var modelRequirements = promptTemplate.modelRequirements;
|
|
538
|
-
var modelName =
|
|
538
|
+
var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
|
|
539
539
|
commands_1.push("EXECUTE PROMPT TEMPLATE");
|
|
540
540
|
if (modelVariant) {
|
|
541
541
|
commands_1.push("MODEL VARIANT ".concat(capitalize(modelVariant)));
|
|
@@ -593,8 +593,8 @@
|
|
|
593
593
|
} /* not else */
|
|
594
594
|
if (expectations) {
|
|
595
595
|
try {
|
|
596
|
-
for (var
|
|
597
|
-
var
|
|
596
|
+
for (var _m = (e_6 = void 0, __values(Object.entries(expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
597
|
+
var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
|
|
598
598
|
if (min === max) {
|
|
599
599
|
commands_1.push("EXPECT EXACTLY ".concat(min, " ").concat(capitalize(unit + (min > 1 ? 's' : ''))));
|
|
600
600
|
}
|
|
@@ -611,7 +611,7 @@
|
|
|
611
611
|
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
612
612
|
finally {
|
|
613
613
|
try {
|
|
614
|
-
if (
|
|
614
|
+
if (_o && !_o.done && (_f = _m.return)) _f.call(_m);
|
|
615
615
|
}
|
|
616
616
|
finally { if (e_6) throw e_6.error; }
|
|
617
617
|
}
|
|
@@ -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.63.0-
|
|
863
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.63.0-10",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:[{id:1,promptbookVersion:"0.63.0-10",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.63.0-10",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:[{id:1,promptbookVersion:"0.63.0-10",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.63.0-10",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:[{id:1,promptbookVersion:"0.63.0-10",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.63.0-10",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:[{id:1,promptbookVersion:"0.63.0-10",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],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
|
|
@@ -1158,9 +1158,6 @@
|
|
|
1158
1158
|
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1159
1159
|
}
|
|
1160
1160
|
definedParameters.add(template.resultingParameterName);
|
|
1161
|
-
if (template.blockType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
|
|
1162
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n You must specify MODEL VARIANT in the prompt template \"".concat(template.title, "\"\n\n For example:\n - MODEL VARIANT Chat\n - MODEL NAME `gpt-4-1106-preview`").concat(/* <- TODO: Dynamic listing of command examples */ '', "\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1163
|
-
}
|
|
1164
1161
|
if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
|
|
1165
1162
|
if (!template.expectFormat &&
|
|
1166
1163
|
!template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
@@ -4320,7 +4317,7 @@
|
|
|
4320
4317
|
* Units of text measurement
|
|
4321
4318
|
*
|
|
4322
4319
|
* @see https://github.com/webgptorg/promptbook/discussions/30
|
|
4323
|
-
* @
|
|
4320
|
+
* @public exported from `@promptbook/core`
|
|
4324
4321
|
*/
|
|
4325
4322
|
var EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', 'LINES', 'PARAGRAPHS', 'PAGES'];
|
|
4326
4323
|
/**
|
|
@@ -4560,7 +4557,7 @@
|
|
|
4560
4557
|
/**
|
|
4561
4558
|
* @@@
|
|
4562
4559
|
*
|
|
4563
|
-
* @
|
|
4560
|
+
* @public exported from `@promptbook/core`
|
|
4564
4561
|
*/
|
|
4565
4562
|
var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
|
|
4566
4563
|
|
|
@@ -7637,6 +7634,7 @@
|
|
|
7637
7634
|
* TODO: [🧠] Maybe pass env as argument
|
|
7638
7635
|
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
7639
7636
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
7637
|
+
* TODO: [🥃] Allow `ptbk make` without llm tools
|
|
7640
7638
|
*/
|
|
7641
7639
|
|
|
7642
7640
|
/**
|
|
@@ -7832,6 +7830,7 @@
|
|
|
7832
7830
|
/**
|
|
7833
7831
|
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
7834
7832
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
7833
|
+
* TODO: [🥃] Allow `ptbk make` without llm tools
|
|
7835
7834
|
*/
|
|
7836
7835
|
|
|
7837
7836
|
/**
|
|
@@ -8018,6 +8017,7 @@
|
|
|
8018
8017
|
});
|
|
8019
8018
|
}
|
|
8020
8019
|
/**
|
|
8020
|
+
* TODO: [🥃] !!! Allow `ptbk make` without llm tools
|
|
8021
8021
|
* TODO: Maybe remove this command - "about" command should be enough?
|
|
8022
8022
|
* TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
|
|
8023
8023
|
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|