@promptbook/markdown-utils 0.81.0-5 → 0.81.0-7
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 +106 -24
- package/esm/index.es.js.map +1 -1
- package/esm/typings/books/index.d.ts +15 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/templates.index.d.ts +1 -1
- package/esm/typings/src/_packages/utils.index.d.ts +8 -0
- package/esm/typings/src/config.d.ts +26 -0
- package/esm/typings/src/high-level-abstractions/index.d.ts +10 -0
- package/esm/typings/src/other/templates/getBookTemplate.d.ts +12 -0
- package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +10 -0
- package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +10 -0
- package/esm/typings/src/utils/editable/types/PipelineEditableSerialized.d.ts +0 -15
- package/esm/typings/src/utils/parameters/numberToString.d.ts +7 -0
- package/esm/typings/src/utils/parameters/templateParameters.d.ts +6 -2
- package/esm/typings/src/utils/parameters/valueToString.d.ts +17 -0
- package/esm/typings/src/utils/parameters/valueToString.test.d.ts +1 -0
- package/esm/typings/src/utils/serialization/asSerializable.d.ts +4 -0
- package/esm/typings/src/version.d.ts +7 -0
- package/package.json +1 -1
- package/umd/index.umd.js +106 -24
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/utils/formatNumber.d.ts +0 -6
- package/esm/typings/src/utils/getBookTemplate.d.ts +0 -12
- /package/esm/typings/src/utils/{formatNumber.test.d.ts → parameters/numberToString.test.d.ts} +0 -0
package/esm/index.es.js
CHANGED
|
@@ -12,15 +12,17 @@ import { unparse, parse } from 'papaparse';
|
|
|
12
12
|
/**
|
|
13
13
|
* The version of the Book language
|
|
14
14
|
*
|
|
15
|
+
* @generated
|
|
15
16
|
* @see https://github.com/webgptorg/book
|
|
16
17
|
*/
|
|
17
18
|
var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
18
19
|
/**
|
|
19
20
|
* The version of the Promptbook engine
|
|
20
21
|
*
|
|
22
|
+
* @generated
|
|
21
23
|
* @see https://github.com/webgptorg/promptbook
|
|
22
24
|
*/
|
|
23
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.81.0-
|
|
25
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.81.0-6';
|
|
24
26
|
/**
|
|
25
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
26
28
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -356,7 +358,7 @@ function extractJsonBlock(markdown) {
|
|
|
356
358
|
* TODO: [🏢] Make this logic part of `JsonFormatDefinition` or `isValidJsonString`
|
|
357
359
|
*/
|
|
358
360
|
|
|
359
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",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}],tasks:[{taskType:"PROMPT_TASK",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"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-persona.book.md"}];
|
|
361
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou 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}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou 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}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou 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}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",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}],tasks:[{taskType:"PROMPT_TASK",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"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book.md`\n- INPUT PARAMETER `{availableModelNames}` List of available model names separated by comma (,)\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou 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}\n```\n\n`-> {modelRequirements}`\n"}],sourceFile:"./books/prepare-persona.book.md"}];
|
|
360
362
|
|
|
361
363
|
/**
|
|
362
364
|
* Prettify the html code
|
|
@@ -658,6 +660,26 @@ var DEFAULT_TITLE = "Untitled";
|
|
|
658
660
|
* @private within the repository - too low-level in comparison with other `MAX_...`
|
|
659
661
|
*/
|
|
660
662
|
var LOOP_LIMIT = 1000;
|
|
663
|
+
/**
|
|
664
|
+
* Strings to represent various values in the context of parameter values
|
|
665
|
+
*
|
|
666
|
+
* @public exported from `@promptbook/utils`
|
|
667
|
+
*/
|
|
668
|
+
var VALUE_STRINGS = {
|
|
669
|
+
empty: '(nothing; empty string)',
|
|
670
|
+
null: '(no value; null)',
|
|
671
|
+
undefined: '(unknown value; undefined)',
|
|
672
|
+
nan: '(not a number; NaN)',
|
|
673
|
+
infinity: '(infinity; ∞)',
|
|
674
|
+
negativeInfinity: '(negative infinity; -∞)',
|
|
675
|
+
unserializable: '(unserializable value)',
|
|
676
|
+
};
|
|
677
|
+
/**
|
|
678
|
+
* Small number limit
|
|
679
|
+
*
|
|
680
|
+
* @public exported from `@promptbook/utils`
|
|
681
|
+
*/
|
|
682
|
+
var SMALL_NUMBER = 0.001;
|
|
661
683
|
/**
|
|
662
684
|
* Short time interval to prevent race conditions in milliseconds
|
|
663
685
|
*
|
|
@@ -1001,6 +1023,7 @@ function exportJson(options) {
|
|
|
1001
1023
|
* @public exported from `@promptbook/core`
|
|
1002
1024
|
*/
|
|
1003
1025
|
var ORDER_OF_PIPELINE_JSON = [
|
|
1026
|
+
// Note: [🍙] In this order will be pipeline serialized
|
|
1004
1027
|
'title',
|
|
1005
1028
|
'pipelineUrl',
|
|
1006
1029
|
'bookVersion',
|
|
@@ -1012,6 +1035,7 @@ var ORDER_OF_PIPELINE_JSON = [
|
|
|
1012
1035
|
'preparations',
|
|
1013
1036
|
'knowledgeSources',
|
|
1014
1037
|
'knowledgePieces',
|
|
1038
|
+
'sources', // <- TODO: [🧠] Where should the `sources` be
|
|
1015
1039
|
];
|
|
1016
1040
|
/**
|
|
1017
1041
|
* Nonce which is used for replacing things in strings
|
|
@@ -4395,9 +4419,87 @@ function mapAvailableToExpectedParameters(options) {
|
|
|
4395
4419
|
return mappedParameters;
|
|
4396
4420
|
}
|
|
4397
4421
|
|
|
4422
|
+
/**
|
|
4423
|
+
* Format either small or big number
|
|
4424
|
+
*
|
|
4425
|
+
* @public exported from `@promptbook/utils`
|
|
4426
|
+
*/
|
|
4427
|
+
function numberToString(value) {
|
|
4428
|
+
if (value === 0) {
|
|
4429
|
+
return '0';
|
|
4430
|
+
}
|
|
4431
|
+
else if (Number.isNaN(value)) {
|
|
4432
|
+
return VALUE_STRINGS.nan;
|
|
4433
|
+
}
|
|
4434
|
+
else if (value === Infinity) {
|
|
4435
|
+
return VALUE_STRINGS.infinity;
|
|
4436
|
+
}
|
|
4437
|
+
else if (value === -Infinity) {
|
|
4438
|
+
return VALUE_STRINGS.negativeInfinity;
|
|
4439
|
+
}
|
|
4440
|
+
for (var exponent = 0; exponent < 15; exponent++) {
|
|
4441
|
+
var factor = Math.pow(10, exponent);
|
|
4442
|
+
var valueRounded = Math.round(value * factor) / factor;
|
|
4443
|
+
if (Math.abs(value - valueRounded) / value < SMALL_NUMBER) {
|
|
4444
|
+
return valueRounded.toFixed(exponent);
|
|
4445
|
+
}
|
|
4446
|
+
}
|
|
4447
|
+
return value.toString();
|
|
4448
|
+
}
|
|
4449
|
+
|
|
4450
|
+
/**
|
|
4451
|
+
* Function `valueToString` will convert the given value to string
|
|
4452
|
+
* This is useful and used in the `templateParameters` function
|
|
4453
|
+
*
|
|
4454
|
+
* Note: This function is not just calling `toString` method
|
|
4455
|
+
* It's more complex and can handle this conversion specifically for LLM models
|
|
4456
|
+
* See `VALUE_STRINGS`
|
|
4457
|
+
*
|
|
4458
|
+
* Note: There are 2 similar functions
|
|
4459
|
+
* - `valueToString` converts value to string for LLM models as human-readable string
|
|
4460
|
+
* - `asSerializable` converts value to string to preserve full information to be able to convert it back
|
|
4461
|
+
*
|
|
4462
|
+
* @public exported from `@promptbook/utils`
|
|
4463
|
+
*/
|
|
4464
|
+
function valueToString(value) {
|
|
4465
|
+
try {
|
|
4466
|
+
if (value === '') {
|
|
4467
|
+
return VALUE_STRINGS.empty;
|
|
4468
|
+
}
|
|
4469
|
+
else if (value === null) {
|
|
4470
|
+
return VALUE_STRINGS.null;
|
|
4471
|
+
}
|
|
4472
|
+
else if (value === undefined) {
|
|
4473
|
+
return VALUE_STRINGS.undefined;
|
|
4474
|
+
}
|
|
4475
|
+
else if (typeof value === 'string') {
|
|
4476
|
+
return value;
|
|
4477
|
+
}
|
|
4478
|
+
else if (typeof value === 'number') {
|
|
4479
|
+
return numberToString(value);
|
|
4480
|
+
}
|
|
4481
|
+
else if (value instanceof Date) {
|
|
4482
|
+
return value.toISOString();
|
|
4483
|
+
}
|
|
4484
|
+
else {
|
|
4485
|
+
return JSON.stringify(value);
|
|
4486
|
+
}
|
|
4487
|
+
}
|
|
4488
|
+
catch (error) {
|
|
4489
|
+
if (!(error instanceof Error)) {
|
|
4490
|
+
throw error;
|
|
4491
|
+
}
|
|
4492
|
+
console.error(error);
|
|
4493
|
+
return VALUE_STRINGS.unserializable;
|
|
4494
|
+
}
|
|
4495
|
+
}
|
|
4496
|
+
|
|
4398
4497
|
/**
|
|
4399
4498
|
* Replaces parameters in template with values from parameters object
|
|
4400
4499
|
*
|
|
4500
|
+
* Note: This function is not places strings into string,
|
|
4501
|
+
* It's more complex and can handle this operation specifically for LLM models
|
|
4502
|
+
*
|
|
4401
4503
|
* @param template the template with parameters in {curly} braces
|
|
4402
4504
|
* @param parameters the object with parameters
|
|
4403
4505
|
* @returns the template with replaced parameters
|
|
@@ -4447,7 +4549,7 @@ function templateParameters(template, parameters) {
|
|
|
4447
4549
|
if (parameterValue === undefined) {
|
|
4448
4550
|
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
4449
4551
|
}
|
|
4450
|
-
parameterValue = parameterValue
|
|
4552
|
+
parameterValue = valueToString(parameterValue);
|
|
4451
4553
|
if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
|
|
4452
4554
|
parameterValue = parameterValue
|
|
4453
4555
|
.split('\n')
|
|
@@ -6044,26 +6146,6 @@ function addAutoGeneratedSection(content, options) {
|
|
|
6044
6146
|
* TODO: [🏛] This can be part of markdown builder
|
|
6045
6147
|
*/
|
|
6046
6148
|
|
|
6047
|
-
/**
|
|
6048
|
-
* Format either small or big number
|
|
6049
|
-
*
|
|
6050
|
-
* @private within the repository
|
|
6051
|
-
*/
|
|
6052
|
-
function formatNumber(value) {
|
|
6053
|
-
if (value === 0) {
|
|
6054
|
-
return '0';
|
|
6055
|
-
}
|
|
6056
|
-
for (var exponent = 0; exponent < 15; exponent++) {
|
|
6057
|
-
var factor = Math.pow(10, exponent);
|
|
6058
|
-
var valueRounded = Math.round(value * factor) / factor;
|
|
6059
|
-
if (Math.abs(value - valueRounded) / value <
|
|
6060
|
-
0.001 /* <- TODO: Pass as option, pass to executionReportJsonToString as option */) {
|
|
6061
|
-
return valueRounded.toFixed(exponent);
|
|
6062
|
-
}
|
|
6063
|
-
}
|
|
6064
|
-
return value.toString();
|
|
6065
|
-
}
|
|
6066
|
-
|
|
6067
6149
|
/**
|
|
6068
6150
|
* Create a markdown table from a 2D array of strings
|
|
6069
6151
|
*
|
|
@@ -6123,7 +6205,7 @@ function createMarkdownChart(options) {
|
|
|
6123
6205
|
}
|
|
6124
6206
|
finally { if (e_1) throw e_1.error; }
|
|
6125
6207
|
}
|
|
6126
|
-
var legend = "_Note: Each \u2588 represents ".concat(
|
|
6208
|
+
var legend = "_Note: Each \u2588 represents ".concat(numberToString(1 / scale), " ").concat(unitName, ", width of ").concat(valueHeader.toLowerCase(), " is ").concat(numberToString(to - from), " ").concat(unitName, " = ").concat(width, " squares_");
|
|
6127
6209
|
return createMarkdownTable(table) + '\n\n' + legend;
|
|
6128
6210
|
}
|
|
6129
6211
|
/**
|