@promptbook/node 0.74.0-11 → 0.74.0-13
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 +48 -46
- 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 +48 -46
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -152,7 +152,7 @@ Following is the documentation and blueprint of the Book language.
|
|
|
152
152
|
|
|
153
153
|
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.
|
|
154
154
|
|
|
155
|
-
It has file with `.
|
|
155
|
+
It has file with `.book.md` or `.book` extension with `UTF-8` non BOM encoding.
|
|
156
156
|
|
|
157
157
|
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.
|
|
158
158
|
|
|
@@ -245,11 +245,6 @@ Or you can install them separately:
|
|
|
245
245
|
|
|
246
246
|
## 📚 Dictionary
|
|
247
247
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
248
|
### 📚 Dictionary
|
|
254
249
|
|
|
255
250
|
The following glossary is used to clarify certain concepts:
|
|
@@ -265,8 +260,6 @@ The following glossary is used to clarify certain concepts:
|
|
|
265
260
|
- **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.
|
|
266
261
|
- **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.
|
|
267
262
|
|
|
268
|
-
|
|
269
|
-
|
|
270
263
|
_Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
271
264
|
|
|
272
265
|
#### Promptbook core
|
|
@@ -327,8 +320,6 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
|
|
|
327
320
|
- [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
|
|
328
321
|
- [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
|
|
329
322
|
|
|
330
|
-
|
|
331
|
-
|
|
332
323
|
### Terms specific to Promptbook TypeScript implementation
|
|
333
324
|
|
|
334
325
|
- Anonymous mode
|
package/esm/index.es.js
CHANGED
|
@@ -26,7 +26,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
26
26
|
*
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.74.0-
|
|
29
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.74.0-12';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
*/
|
|
@@ -519,13 +519,13 @@ function capitalize(word) {
|
|
|
519
519
|
/**
|
|
520
520
|
* Converts promptbook in JSON format to string format
|
|
521
521
|
*
|
|
522
|
-
* @param pipelineJson Promptbook in JSON format (.
|
|
523
|
-
* @returns Promptbook in string format (.
|
|
522
|
+
* @param pipelineJson Promptbook in JSON format (.book.json)
|
|
523
|
+
* @returns Promptbook in string format (.book.md)
|
|
524
524
|
* @public exported from `@promptbook/core`
|
|
525
525
|
*/
|
|
526
526
|
function pipelineJsonToString(pipelineJson) {
|
|
527
527
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
|
|
528
|
-
var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl,
|
|
528
|
+
var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
|
|
529
529
|
var pipelineString = "# ".concat(title);
|
|
530
530
|
if (description) {
|
|
531
531
|
pipelineString += '\n\n';
|
|
@@ -535,8 +535,10 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
535
535
|
if (pipelineUrl) {
|
|
536
536
|
commands.push("PIPELINE URL ".concat(pipelineUrl));
|
|
537
537
|
}
|
|
538
|
-
|
|
539
|
-
|
|
538
|
+
if (bookVersion !== "undefined") {
|
|
539
|
+
commands.push("BOOK VERSION ".concat(bookVersion));
|
|
540
|
+
}
|
|
541
|
+
// TODO: [main] !!!!!! This increase size of the bundle and is probbably not necessary
|
|
540
542
|
pipelineString = prettifyMarkdown(pipelineString);
|
|
541
543
|
try {
|
|
542
544
|
for (var _g = __values(parameters.filter(function (_a) {
|
|
@@ -716,7 +718,7 @@ function templateParameterJsonToString(templateParameterJson) {
|
|
|
716
718
|
* TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
717
719
|
* TODO: [🏛] Maybe make some markdown builder
|
|
718
720
|
* TODO: [🏛] Escape all
|
|
719
|
-
* TODO: [🧠] Should be in generated .
|
|
721
|
+
* TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
|
|
720
722
|
*/
|
|
721
723
|
|
|
722
724
|
/**
|
|
@@ -1354,7 +1356,7 @@ function joinLlmExecutionTools() {
|
|
|
1354
1356
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
1355
1357
|
*/
|
|
1356
1358
|
|
|
1357
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.
|
|
1359
|
+
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"}];
|
|
1358
1360
|
|
|
1359
1361
|
/**
|
|
1360
1362
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -1529,7 +1531,7 @@ function isValidPipelineUrl(url) {
|
|
|
1529
1531
|
if (!url.startsWith('https://')) {
|
|
1530
1532
|
return false;
|
|
1531
1533
|
}
|
|
1532
|
-
if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.
|
|
1534
|
+
if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.book.md') || url.endsWith('.ptbk'))) {
|
|
1533
1535
|
return false;
|
|
1534
1536
|
}
|
|
1535
1537
|
if (url.includes('#')) {
|
|
@@ -1598,9 +1600,9 @@ function validatePipelineCore(pipeline) {
|
|
|
1598
1600
|
// <- Note: [🚲]
|
|
1599
1601
|
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1600
1602
|
}
|
|
1601
|
-
if (pipeline.
|
|
1603
|
+
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
1602
1604
|
// <- Note: [🚲]
|
|
1603
|
-
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.
|
|
1605
|
+
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.bookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1604
1606
|
}
|
|
1605
1607
|
// TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
|
|
1606
1608
|
if (!Array.isArray(pipeline.parameters)) {
|
|
@@ -3557,7 +3559,7 @@ function executeAttempts(options) {
|
|
|
3557
3559
|
promptTitle: template.title,
|
|
3558
3560
|
promptMessage: replaceParameters(template.description || '', parameters),
|
|
3559
3561
|
defaultValue: replaceParameters(preparedContent, parameters),
|
|
3560
|
-
// TODO: [🧠] !! Figure out how to define placeholder in .
|
|
3562
|
+
// TODO: [🧠] !! Figure out how to define placeholder in .book.md file
|
|
3561
3563
|
placeholder: undefined,
|
|
3562
3564
|
priority: priority,
|
|
3563
3565
|
}))];
|
|
@@ -4123,7 +4125,7 @@ function executePipeline(options) {
|
|
|
4123
4125
|
pipelineUrl: preparedPipeline.pipelineUrl,
|
|
4124
4126
|
title: preparedPipeline.title,
|
|
4125
4127
|
promptbookUsedVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
4126
|
-
promptbookRequestedVersion: preparedPipeline.
|
|
4128
|
+
promptbookRequestedVersion: preparedPipeline.bookVersion,
|
|
4127
4129
|
description: preparedPipeline.description,
|
|
4128
4130
|
promptExecutions: [],
|
|
4129
4131
|
};
|
|
@@ -4472,7 +4474,7 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
4472
4474
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
4473
4475
|
_b = createPipelineExecutor;
|
|
4474
4476
|
_c = {};
|
|
4475
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.
|
|
4477
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book.md')];
|
|
4476
4478
|
case 1:
|
|
4477
4479
|
preparePersonaExecutor = _b.apply(void 0, [(_c.pipeline = _d.sent(),
|
|
4478
4480
|
_c.tools = tools,
|
|
@@ -5229,12 +5231,12 @@ TODO: [🧊] This is how it can look in future
|
|
|
5229
5231
|
*/
|
|
5230
5232
|
function clonePipeline(pipeline) {
|
|
5231
5233
|
// Note: Not using spread operator (...) because @@@
|
|
5232
|
-
var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title,
|
|
5234
|
+
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;
|
|
5233
5235
|
return {
|
|
5234
5236
|
pipelineUrl: pipelineUrl,
|
|
5235
5237
|
sourceFile: sourceFile,
|
|
5236
5238
|
title: title,
|
|
5237
|
-
|
|
5239
|
+
bookVersion: bookVersion,
|
|
5238
5240
|
description: description,
|
|
5239
5241
|
parameters: parameters,
|
|
5240
5242
|
templates: templates,
|
|
@@ -5446,7 +5448,7 @@ var knowledgeCommandParser = {
|
|
|
5446
5448
|
throw new ParseError("Source not valid");
|
|
5447
5449
|
}
|
|
5448
5450
|
if (sourceContent.startsWith('../') || sourceContent.startsWith('/') || /^[A-Z]:[\\/]+/i.test(sourceContent)) {
|
|
5449
|
-
throw new ParseError("Source cannot be outside of the .
|
|
5451
|
+
throw new ParseError("Source cannot be outside of the .book.md folder");
|
|
5450
5452
|
}
|
|
5451
5453
|
return {
|
|
5452
5454
|
type: 'KNOWLEDGE',
|
|
@@ -6096,7 +6098,7 @@ function validateParameterName(parameterName) {
|
|
|
6096
6098
|
/**
|
|
6097
6099
|
* Parses the foreach command
|
|
6098
6100
|
*
|
|
6099
|
-
* Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.
|
|
6101
|
+
* Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book.md` file
|
|
6100
6102
|
*
|
|
6101
6103
|
* @see `documentationUrl` for more details
|
|
6102
6104
|
* @private within the commands folder
|
|
@@ -6246,7 +6248,7 @@ var foreachCommandParser = {
|
|
|
6246
6248
|
},
|
|
6247
6249
|
};
|
|
6248
6250
|
/**
|
|
6249
|
-
* TODO: [🍭] Make .
|
|
6251
|
+
* TODO: [🍭] Make .book.md file with examples of the FOREACH with wrong parsing and logic
|
|
6250
6252
|
*/
|
|
6251
6253
|
|
|
6252
6254
|
/**
|
|
@@ -6880,7 +6882,7 @@ var bookVersionCommandParser = {
|
|
|
6880
6882
|
/**
|
|
6881
6883
|
* Description of the BOOK_VERSION command
|
|
6882
6884
|
*/
|
|
6883
|
-
description: "Which version of the Book language is the .
|
|
6885
|
+
description: "Which version of the Book language is the .book.md using",
|
|
6884
6886
|
/**
|
|
6885
6887
|
* Link to documentation
|
|
6886
6888
|
*/
|
|
@@ -6894,19 +6896,19 @@ var bookVersionCommandParser = {
|
|
|
6894
6896
|
*/
|
|
6895
6897
|
parse: function (input) {
|
|
6896
6898
|
var args = input.args;
|
|
6897
|
-
var
|
|
6898
|
-
if (
|
|
6899
|
+
var bookVersion = args.pop();
|
|
6900
|
+
if (bookVersion === undefined) {
|
|
6899
6901
|
throw new ParseError("Version is required");
|
|
6900
6902
|
}
|
|
6901
|
-
if (!isValidPromptbookVersion(
|
|
6902
|
-
throw new ParseError("Invalid Promptbook version \"".concat(
|
|
6903
|
+
if (!isValidPromptbookVersion(bookVersion)) {
|
|
6904
|
+
throw new ParseError("Invalid Promptbook version \"".concat(bookVersion, "\""));
|
|
6903
6905
|
}
|
|
6904
6906
|
if (args.length > 0 && !(((args.length === 1 && args[0]) || '').toUpperCase() === 'VERSION')) {
|
|
6905
6907
|
throw new ParseError("Can not have more than one Promptbook version");
|
|
6906
6908
|
}
|
|
6907
6909
|
return {
|
|
6908
6910
|
type: 'BOOK_VERSION',
|
|
6909
|
-
|
|
6911
|
+
bookVersion: bookVersion,
|
|
6910
6912
|
};
|
|
6911
6913
|
},
|
|
6912
6914
|
/**
|
|
@@ -6916,7 +6918,7 @@ var bookVersionCommandParser = {
|
|
|
6916
6918
|
*/
|
|
6917
6919
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
6918
6920
|
// TODO: Warn if the version is overridden
|
|
6919
|
-
$pipelineJson.
|
|
6921
|
+
$pipelineJson.bookVersion = command.bookVersion;
|
|
6920
6922
|
},
|
|
6921
6923
|
/**
|
|
6922
6924
|
* Converts the BOOK_VERSION command back to string
|
|
@@ -6969,9 +6971,9 @@ var urlCommandParser = {
|
|
|
6969
6971
|
* Example usages of the URL command
|
|
6970
6972
|
*/
|
|
6971
6973
|
examples: [
|
|
6972
|
-
'PIPELINE URL https://promptbook.studio/library/write-cv.
|
|
6973
|
-
'URL https://promptbook.studio/library/write-cv.
|
|
6974
|
-
'https://promptbook.studio/library/write-cv.
|
|
6974
|
+
'PIPELINE URL https://promptbook.studio/library/write-cv.book.md',
|
|
6975
|
+
'URL https://promptbook.studio/library/write-cv.book.md',
|
|
6976
|
+
'https://promptbook.studio/library/write-cv.book.md',
|
|
6975
6977
|
],
|
|
6976
6978
|
/**
|
|
6977
6979
|
* Parses the URL command
|
|
@@ -7172,7 +7174,7 @@ var instrumentCommandParser = {
|
|
|
7172
7174
|
/**
|
|
7173
7175
|
* Parses the boilerplate command
|
|
7174
7176
|
*
|
|
7175
|
-
* Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.
|
|
7177
|
+
* Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book.md` file
|
|
7176
7178
|
*
|
|
7177
7179
|
* @see `documentationUrl` for more details
|
|
7178
7180
|
* @private within the commands folder
|
|
@@ -7226,7 +7228,7 @@ var boilerplateCommandParser = {
|
|
|
7226
7228
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7227
7229
|
*/
|
|
7228
7230
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7229
|
-
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .
|
|
7231
|
+
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
|
|
7230
7232
|
},
|
|
7231
7233
|
/**
|
|
7232
7234
|
* Apply the BOILERPLATE command to the `pipelineJson`
|
|
@@ -7234,7 +7236,7 @@ var boilerplateCommandParser = {
|
|
|
7234
7236
|
* Note: `$` is used to indicate that this function mutates given `templateJson`
|
|
7235
7237
|
*/
|
|
7236
7238
|
$applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
|
|
7237
|
-
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .
|
|
7239
|
+
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
|
|
7238
7240
|
},
|
|
7239
7241
|
/**
|
|
7240
7242
|
* Converts the BOILERPLATE command back to string
|
|
@@ -7250,7 +7252,7 @@ var boilerplateCommandParser = {
|
|
|
7250
7252
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7251
7253
|
*/
|
|
7252
7254
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7253
|
-
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .
|
|
7255
|
+
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
|
|
7254
7256
|
},
|
|
7255
7257
|
/**
|
|
7256
7258
|
* Reads the BOILERPLATE command from the `TemplateJson`
|
|
@@ -7258,7 +7260,7 @@ var boilerplateCommandParser = {
|
|
|
7258
7260
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7259
7261
|
*/
|
|
7260
7262
|
takeFromTemplateJson: function ($templateJson) {
|
|
7261
|
-
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .
|
|
7263
|
+
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
|
|
7262
7264
|
},
|
|
7263
7265
|
};
|
|
7264
7266
|
|
|
@@ -7734,8 +7736,8 @@ function titleToName(value) {
|
|
|
7734
7736
|
* Note: This function does not validate logic of the pipeline only the parsing
|
|
7735
7737
|
* Note: This function acts as compilation process
|
|
7736
7738
|
*
|
|
7737
|
-
* @param pipelineString {Promptbook} in string markdown format (.
|
|
7738
|
-
* @returns {Promptbook} compiled in JSON format (.
|
|
7739
|
+
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
7740
|
+
* @returns {Promptbook} compiled in JSON format (.book.json)
|
|
7739
7741
|
* @throws {ParseError} if the promptbook string is not valid
|
|
7740
7742
|
* @public exported from `@promptbook/core`
|
|
7741
7743
|
*/
|
|
@@ -7744,7 +7746,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
7744
7746
|
var $pipelineJson = {
|
|
7745
7747
|
title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
|
|
7746
7748
|
pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
|
|
7747
|
-
|
|
7749
|
+
bookVersion: undefined /* <- Note: By default no explicit version */,
|
|
7748
7750
|
description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
|
|
7749
7751
|
parameters: [],
|
|
7750
7752
|
templates: [],
|
|
@@ -8127,10 +8129,10 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8127
8129
|
* Note: This function does not validate logic of the pipeline only the parsing
|
|
8128
8130
|
* Note: This function acts as compilation process
|
|
8129
8131
|
*
|
|
8130
|
-
* @param pipelineString {Promptbook} in string markdown format (.
|
|
8132
|
+
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
8131
8133
|
* @param tools - Tools for the preparation and scraping - if not provided together with `llm`, the preparation will be skipped
|
|
8132
8134
|
* @param options - Options and tools for the compilation
|
|
8133
|
-
* @returns {Promptbook} compiled in JSON format (.
|
|
8135
|
+
* @returns {Promptbook} compiled in JSON format (.book.json)
|
|
8134
8136
|
* @throws {ParseError} if the promptbook string is not valid
|
|
8135
8137
|
* @public exported from `@promptbook/core`
|
|
8136
8138
|
*/
|
|
@@ -9511,13 +9513,13 @@ function createCollectionFromDirectory(path, tools, options) {
|
|
|
9511
9513
|
return [4 /*yield*/, listAllFiles(path, isRecursive, tools.fs)];
|
|
9512
9514
|
case 1:
|
|
9513
9515
|
fileNames = _b.sent();
|
|
9514
|
-
// Note: First load all .
|
|
9515
|
-
// .
|
|
9516
|
+
// Note: First load all .book.json and then .book.md files
|
|
9517
|
+
// .book.json can be prepared so it is faster to load
|
|
9516
9518
|
fileNames.sort(function (a, b) {
|
|
9517
|
-
if (a.endsWith('.
|
|
9519
|
+
if (a.endsWith('.book.json') && b.endsWith('.book.md')) {
|
|
9518
9520
|
return -1;
|
|
9519
9521
|
}
|
|
9520
|
-
if (a.endsWith('.
|
|
9522
|
+
if (a.endsWith('.book.md') && b.endsWith('.book.json')) {
|
|
9521
9523
|
return 1;
|
|
9522
9524
|
}
|
|
9523
9525
|
return 0;
|
|
@@ -9534,7 +9536,7 @@ function createCollectionFromDirectory(path, tools, options) {
|
|
|
9534
9536
|
case 1:
|
|
9535
9537
|
_e.trys.push([1, 8, , 9]);
|
|
9536
9538
|
pipeline = null;
|
|
9537
|
-
if (!fileName.endsWith('.
|
|
9539
|
+
if (!fileName.endsWith('.book.md')) return [3 /*break*/, 4];
|
|
9538
9540
|
return [4 /*yield*/, readFile(fileName, 'utf-8')];
|
|
9539
9541
|
case 2:
|
|
9540
9542
|
pipelineString = (_e.sent());
|
|
@@ -9546,7 +9548,7 @@ function createCollectionFromDirectory(path, tools, options) {
|
|
|
9546
9548
|
pipeline = __assign(__assign({}, pipeline), { sourceFile: sourceFile });
|
|
9547
9549
|
return [3 /*break*/, 7];
|
|
9548
9550
|
case 4:
|
|
9549
|
-
if (!fileName.endsWith('.
|
|
9551
|
+
if (!fileName.endsWith('.book.json')) return [3 /*break*/, 6];
|
|
9550
9552
|
_d = (_c = JSON).parse;
|
|
9551
9553
|
return [4 /*yield*/, readFile(fileName, 'utf-8')];
|
|
9552
9554
|
case 5:
|
|
@@ -9714,7 +9716,7 @@ function stringifyPipelineJson(pipeline) {
|
|
|
9714
9716
|
return pipelineJsonStringified;
|
|
9715
9717
|
}
|
|
9716
9718
|
/**
|
|
9717
|
-
* TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.
|
|
9719
|
+
* TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book.md
|
|
9718
9720
|
* TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
|
|
9719
9721
|
* TODO: [🧠] Maybe more elegant solution than replacing via regex
|
|
9720
9722
|
* TODO: [🍙] Make some standard order of json properties
|