@promptbook/pdf 0.74.0-11 → 0.74.0-12
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 +1 -10
- package/esm/index.es.js +21 -19
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/cli/promptbookCli.d.ts +1 -1
- package/esm/typings/src/collection/collectionToJson.test.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -1
- package/esm/typings/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +3 -3
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -2
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +2 -2
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +7 -7
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
- package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +6 -4
- package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
- package/esm/typings/src/types/Prompt.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +2 -2
- package/package.json +2 -2
- package/umd/index.umd.js +21 -19
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -150,7 +150,7 @@ Following is the documentation and blueprint of the Book language.
|
|
|
150
150
|
|
|
151
151
|
File is designed to be easy to read and write. It is strict subset of markdown. It is designed to be understandable by both humans and machines and without specific knowledge of the language.
|
|
152
152
|
|
|
153
|
-
It has file with `.
|
|
153
|
+
It has file with `.book.md` or `.book` extension with `UTF-8` non BOM encoding.
|
|
154
154
|
|
|
155
155
|
As it is source code, it can leverage all the features of version control systems like git and does not suffer from the problems of binary formats, proprietary formats, or no-code solutions.
|
|
156
156
|
|
|
@@ -243,11 +243,6 @@ Or you can install them separately:
|
|
|
243
243
|
|
|
244
244
|
## 📚 Dictionary
|
|
245
245
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
246
|
### 📚 Dictionary
|
|
252
247
|
|
|
253
248
|
The following glossary is used to clarify certain concepts:
|
|
@@ -263,8 +258,6 @@ The following glossary is used to clarify certain concepts:
|
|
|
263
258
|
- **Retrieval-augmented generation** is a machine learning paradigm where a model generates text by retrieving relevant information from a large database of text. This approach combines the benefits of generative models and retrieval models.
|
|
264
259
|
- **Longtail** refers to non-common or rare events, items, or entities that are not well-represented in the training data of machine learning models. Longtail items are often challenging for models to predict accurately.
|
|
265
260
|
|
|
266
|
-
|
|
267
|
-
|
|
268
261
|
_Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
269
262
|
|
|
270
263
|
#### Promptbook core
|
|
@@ -325,8 +318,6 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
|
|
|
325
318
|
- [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
|
|
326
319
|
- [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
|
|
327
320
|
|
|
328
|
-
|
|
329
|
-
|
|
330
321
|
### Terms specific to Promptbook TypeScript implementation
|
|
331
322
|
|
|
332
323
|
- Anonymous mode
|
package/esm/index.es.js
CHANGED
|
@@ -20,7 +20,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
20
20
|
*
|
|
21
21
|
* @see https://github.com/webgptorg/promptbook
|
|
22
22
|
*/
|
|
23
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.74.0-
|
|
23
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.74.0-11';
|
|
24
24
|
/**
|
|
25
25
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
26
26
|
*/
|
|
@@ -173,7 +173,7 @@ var NotYetImplementedError = /** @class */ (function (_super) {
|
|
|
173
173
|
function TODO_USE() {
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.
|
|
176
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",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}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\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- Write just the JSON object, no other text should be present\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}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.book.md"}];
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
179
|
* Prettify the html code
|
|
@@ -221,13 +221,13 @@ function capitalize(word) {
|
|
|
221
221
|
/**
|
|
222
222
|
* Converts promptbook in JSON format to string format
|
|
223
223
|
*
|
|
224
|
-
* @param pipelineJson Promptbook in JSON format (.
|
|
225
|
-
* @returns Promptbook in string format (.
|
|
224
|
+
* @param pipelineJson Promptbook in JSON format (.book.json)
|
|
225
|
+
* @returns Promptbook in string format (.book.md)
|
|
226
226
|
* @public exported from `@promptbook/core`
|
|
227
227
|
*/
|
|
228
228
|
function pipelineJsonToString(pipelineJson) {
|
|
229
229
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
|
|
230
|
-
var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl,
|
|
230
|
+
var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
|
|
231
231
|
var pipelineString = "# ".concat(title);
|
|
232
232
|
if (description) {
|
|
233
233
|
pipelineString += '\n\n';
|
|
@@ -237,8 +237,10 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
237
237
|
if (pipelineUrl) {
|
|
238
238
|
commands.push("PIPELINE URL ".concat(pipelineUrl));
|
|
239
239
|
}
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
if (bookVersion !== "undefined") {
|
|
241
|
+
commands.push("BOOK VERSION ".concat(bookVersion));
|
|
242
|
+
}
|
|
243
|
+
// TODO: [main] !!!!!! This increase size of the bundle and is probbably not necessary
|
|
242
244
|
pipelineString = prettifyMarkdown(pipelineString);
|
|
243
245
|
try {
|
|
244
246
|
for (var _g = __values(parameters.filter(function (_a) {
|
|
@@ -418,7 +420,7 @@ function templateParameterJsonToString(templateParameterJson) {
|
|
|
418
420
|
* TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
419
421
|
* TODO: [🏛] Maybe make some markdown builder
|
|
420
422
|
* TODO: [🏛] Escape all
|
|
421
|
-
* TODO: [🧠] Should be in generated .
|
|
423
|
+
* TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
|
|
422
424
|
*/
|
|
423
425
|
|
|
424
426
|
/**
|
|
@@ -898,7 +900,7 @@ function isValidPipelineUrl(url) {
|
|
|
898
900
|
if (!url.startsWith('https://')) {
|
|
899
901
|
return false;
|
|
900
902
|
}
|
|
901
|
-
if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.
|
|
903
|
+
if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.book.md') || url.endsWith('.ptbk'))) {
|
|
902
904
|
return false;
|
|
903
905
|
}
|
|
904
906
|
if (url.includes('#')) {
|
|
@@ -967,9 +969,9 @@ function validatePipelineCore(pipeline) {
|
|
|
967
969
|
// <- Note: [🚲]
|
|
968
970
|
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
969
971
|
}
|
|
970
|
-
if (pipeline.
|
|
972
|
+
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
971
973
|
// <- Note: [🚲]
|
|
972
|
-
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.
|
|
974
|
+
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.bookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
973
975
|
}
|
|
974
976
|
// TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
|
|
975
977
|
if (!Array.isArray(pipeline.parameters)) {
|
|
@@ -2602,7 +2604,7 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
2602
2604
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
2603
2605
|
_b = createPipelineExecutor;
|
|
2604
2606
|
_c = {};
|
|
2605
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.
|
|
2607
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book.md')];
|
|
2606
2608
|
case 1:
|
|
2607
2609
|
preparePersonaExecutor = _b.apply(void 0, [(_c.pipeline = _d.sent(),
|
|
2608
2610
|
_c.tools = tools,
|
|
@@ -3274,12 +3276,12 @@ TODO: [🧊] This is how it can look in future
|
|
|
3274
3276
|
*/
|
|
3275
3277
|
function clonePipeline(pipeline) {
|
|
3276
3278
|
// Note: Not using spread operator (...) because @@@
|
|
3277
|
-
var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title,
|
|
3279
|
+
var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
|
|
3278
3280
|
return {
|
|
3279
3281
|
pipelineUrl: pipelineUrl,
|
|
3280
3282
|
sourceFile: sourceFile,
|
|
3281
3283
|
title: title,
|
|
3282
|
-
|
|
3284
|
+
bookVersion: bookVersion,
|
|
3283
3285
|
description: description,
|
|
3284
3286
|
parameters: parameters,
|
|
3285
3287
|
templates: templates,
|
|
@@ -4527,7 +4529,7 @@ function executeAttempts(options) {
|
|
|
4527
4529
|
promptTitle: template.title,
|
|
4528
4530
|
promptMessage: replaceParameters(template.description || '', parameters),
|
|
4529
4531
|
defaultValue: replaceParameters(preparedContent, parameters),
|
|
4530
|
-
// TODO: [🧠] !! Figure out how to define placeholder in .
|
|
4532
|
+
// TODO: [🧠] !! Figure out how to define placeholder in .book.md file
|
|
4531
4533
|
placeholder: undefined,
|
|
4532
4534
|
priority: priority,
|
|
4533
4535
|
}))];
|
|
@@ -5093,7 +5095,7 @@ function executePipeline(options) {
|
|
|
5093
5095
|
pipelineUrl: preparedPipeline.pipelineUrl,
|
|
5094
5096
|
title: preparedPipeline.title,
|
|
5095
5097
|
promptbookUsedVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
5096
|
-
promptbookRequestedVersion: preparedPipeline.
|
|
5098
|
+
promptbookRequestedVersion: preparedPipeline.bookVersion,
|
|
5097
5099
|
description: preparedPipeline.description,
|
|
5098
5100
|
promptExecutions: [],
|
|
5099
5101
|
};
|
|
@@ -5489,7 +5491,7 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
5489
5491
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
5490
5492
|
_d = createPipelineExecutor;
|
|
5491
5493
|
_g = {};
|
|
5492
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.
|
|
5494
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md')];
|
|
5493
5495
|
case 1:
|
|
5494
5496
|
prepareKnowledgeFromMarkdownExecutor = _d.apply(void 0, [(_g.pipeline = _k.sent(),
|
|
5495
5497
|
_g.tools = {
|
|
@@ -5498,7 +5500,7 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
5498
5500
|
_g)]);
|
|
5499
5501
|
_e = createPipelineExecutor;
|
|
5500
5502
|
_h = {};
|
|
5501
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-title.
|
|
5503
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-title.book.md')];
|
|
5502
5504
|
case 2:
|
|
5503
5505
|
prepareTitleExecutor = _e.apply(void 0, [(_h.pipeline = _k.sent(),
|
|
5504
5506
|
_h.tools = {
|
|
@@ -5507,7 +5509,7 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
5507
5509
|
_h)]);
|
|
5508
5510
|
_f = createPipelineExecutor;
|
|
5509
5511
|
_j = {};
|
|
5510
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-keywords.
|
|
5512
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md')];
|
|
5511
5513
|
case 3:
|
|
5512
5514
|
prepareKeywordsExecutor = _f.apply(void 0, [(_j.pipeline = _k.sent(),
|
|
5513
5515
|
_j.tools = {
|