@promptbook/core 0.61.0-11 → 0.61.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/esm/index.es.js +152 -56
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/execute-javascript.index.d.ts +1 -1
- package/esm/typings/src/_packages/utils.index.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +3 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +3 -0
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +3 -0
- package/esm/typings/src/cli/promptbookCli.d.ts +1 -0
- package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +4 -2
- package/esm/typings/src/errors/LimitReachedError.d.ts +7 -0
- package/esm/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
- package/esm/typings/src/execution/utils/addUsage.d.ts +57 -1
- package/esm/typings/src/formats/csv/ListFormatDefinition.d.ts +1 -0
- package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +1 -0
- package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +1 -0
- package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -0
- package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -0
- package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -0
- package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -0
- package/{umd/typings/src/llm-providers/utils → esm/typings/src/llm-providers/_common}/createLlmToolsFromEnv.d.ts +3 -2
- package/esm/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -0
- package/esm/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +10 -0
- package/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/cache/CacheItem.d.ts +4 -4
- package/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/cache/CacheLlmToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/{utils → _common/utils}/cache/cacheLlmTools.d.ts +3 -4
- package/esm/typings/src/llm-providers/{utils → _common/utils}/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +2 -2
- package/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/count-total-cost/countTotalCost.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +32 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +3 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
- package/esm/typings/src/personas/preparePersona.d.ts +6 -1
- package/esm/typings/src/prepare/preparePipeline.d.ts +2 -1
- package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +1 -1
- package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +2 -0
- package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +3 -0
- package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
- package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
- package/esm/typings/src/storage/memory/MemoryStorage.d.ts +3 -0
- package/esm/typings/src/storage/utils/PrefixStorage.d.ts +3 -0
- package/esm/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineString.d.ts +1 -1
- package/esm/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
- package/esm/typings/src/utils/deepClone.d.ts +9 -0
- package/esm/typings/src/utils/deepFreeze.d.ts +13 -0
- package/esm/typings/src/utils/emojis.d.ts +2 -2
- package/esm/typings/src/utils/formatNumber.d.ts +1 -1
- package/esm/typings/src/utils/isRunningInWhatever.d.ts +3 -0
- package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -1
- package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/esm/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
- package/esm/typings/src/utils/organization/TODO.d.ts +2 -0
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +1 -0
- package/esm/typings/src/utils/organization/___.d.ts +2 -0
- package/esm/typings/src/utils/organization/just.d.ts +5 -1
- package/esm/typings/src/utils/organization/keepUnused.d.ts +16 -0
- package/esm/typings/src/utils/organization/really_any.d.ts +2 -0
- package/package.json +1 -1
- package/umd/index.umd.js +152 -56
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/src/_packages/execute-javascript.index.d.ts +1 -1
- package/umd/typings/src/_packages/utils.index.d.ts +1 -1
- package/umd/typings/src/cli/cli-commands/hello.d.ts +3 -0
- package/umd/typings/src/cli/cli-commands/make.d.ts +3 -0
- package/umd/typings/src/cli/cli-commands/prettify.d.ts +3 -0
- package/umd/typings/src/cli/promptbookCli.d.ts +1 -0
- package/umd/typings/src/collection/PipelineCollection.d.ts +1 -1
- package/umd/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
- package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
- package/umd/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
- package/umd/typings/src/config.d.ts +1 -1
- package/umd/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/umd/typings/src/conversion/validation/validatePipeline.d.ts +4 -2
- package/umd/typings/src/errors/LimitReachedError.d.ts +7 -0
- package/umd/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
- package/umd/typings/src/execution/utils/addUsage.d.ts +57 -1
- package/umd/typings/src/formats/csv/ListFormatDefinition.d.ts +1 -0
- package/umd/typings/src/formats/json/JsonFormatDefinition.d.ts +1 -0
- package/umd/typings/src/formats/list/ListFormatDefinition.d.ts +1 -0
- package/umd/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -0
- package/umd/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -0
- package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -0
- package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -0
- package/{esm/typings/src/llm-providers/utils → umd/typings/src/llm-providers/_common}/createLlmToolsFromEnv.d.ts +3 -2
- package/umd/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -0
- package/umd/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +10 -0
- package/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/cache/CacheItem.d.ts +4 -4
- package/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/cache/CacheLlmToolsOptions.d.ts +1 -1
- package/umd/typings/src/llm-providers/{utils → _common/utils}/cache/cacheLlmTools.d.ts +3 -4
- package/umd/typings/src/llm-providers/{utils → _common/utils}/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +2 -2
- package/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/count-total-cost/countTotalCost.d.ts +2 -2
- package/umd/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +32 -0
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +3 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +1 -1
- package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
- package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
- package/umd/typings/src/personas/preparePersona.d.ts +6 -1
- package/umd/typings/src/prepare/preparePipeline.d.ts +2 -1
- package/umd/typings/src/prepare/unpreparePipeline.d.ts +1 -0
- package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
- package/umd/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +1 -1
- package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +2 -0
- package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +3 -0
- package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
- package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
- package/umd/typings/src/storage/memory/MemoryStorage.d.ts +3 -0
- package/umd/typings/src/storage/utils/PrefixStorage.d.ts +3 -0
- package/umd/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -1
- package/umd/typings/src/types/ModelRequirements.d.ts +1 -1
- package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
- package/umd/typings/src/types/PipelineString.d.ts +1 -1
- package/umd/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
- package/umd/typings/src/utils/deepClone.d.ts +9 -0
- package/umd/typings/src/utils/deepFreeze.d.ts +13 -0
- package/umd/typings/src/utils/emojis.d.ts +2 -2
- package/umd/typings/src/utils/formatNumber.d.ts +1 -1
- package/umd/typings/src/utils/isRunningInWhatever.d.ts +3 -0
- package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -1
- package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
- package/umd/typings/src/utils/organization/TODO.d.ts +2 -0
- package/umd/typings/src/utils/organization/TODO_USE.d.ts +1 -0
- package/umd/typings/src/utils/organization/___.d.ts +2 -0
- package/umd/typings/src/utils/organization/just.d.ts +5 -1
- package/umd/typings/src/utils/organization/keepUnused.d.ts +16 -0
- package/umd/typings/src/utils/organization/really_any.d.ts +2 -0
- package/esm/typings/src/execution/addPromptResultUsage.test.d.ts +0 -1
- package/esm/typings/src/knowledge/prepare-knowledge/_common/utils/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +0 -10
- package/esm/typings/src/utils/organization/notUsing.d.ts +0 -11
- package/umd/typings/src/execution/addPromptResultUsage.test.d.ts +0 -1
- package/umd/typings/src/knowledge/prepare-knowledge/_common/utils/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +0 -10
- package/umd/typings/src/utils/organization/notUsing.d.ts +0 -11
- /package/esm/typings/src/{utils/postprocessing → postprocessing/utils}/extractBlock.d.ts +0 -0
- /package/umd/typings/src/{utils/postprocessing → postprocessing/utils}/extractBlock.d.ts +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -392,11 +392,44 @@
|
|
|
392
392
|
return parameterString;
|
|
393
393
|
}
|
|
394
394
|
/**
|
|
395
|
-
* TODO:
|
|
395
|
+
* TODO: !!!! Implement new features and commands into `promptTemplateParameterJsonToString`
|
|
396
396
|
* TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
397
397
|
* TODO: Escape all
|
|
398
398
|
*/
|
|
399
399
|
|
|
400
|
+
/**
|
|
401
|
+
* @@@
|
|
402
|
+
*
|
|
403
|
+
* @returns The same object as the input, but deeply frozen
|
|
404
|
+
*
|
|
405
|
+
* Note: This function mutates the object
|
|
406
|
+
*/
|
|
407
|
+
function deepFreeze(objectValue) {
|
|
408
|
+
var e_1, _a;
|
|
409
|
+
var propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
410
|
+
try {
|
|
411
|
+
for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
|
|
412
|
+
var propertyName = propertyNames_1_1.value;
|
|
413
|
+
var value = objectValue[propertyName];
|
|
414
|
+
if (value && typeof value === 'object') {
|
|
415
|
+
deepFreeze(value);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
420
|
+
finally {
|
|
421
|
+
try {
|
|
422
|
+
if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
|
|
423
|
+
}
|
|
424
|
+
finally { if (e_1) throw e_1.error; }
|
|
425
|
+
}
|
|
426
|
+
return Object.freeze(objectValue);
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* TODO: [🔼] Export from `@promptbook/utils`
|
|
430
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
431
|
+
*/
|
|
432
|
+
|
|
400
433
|
/**
|
|
401
434
|
* The maximum number of iterations for a loops
|
|
402
435
|
*/
|
|
@@ -408,11 +441,15 @@
|
|
|
408
441
|
/**
|
|
409
442
|
* The names of the parameters that are reserved for special purposes
|
|
410
443
|
*/
|
|
411
|
-
var RESERVED_PARAMETER_NAMES = [
|
|
444
|
+
var RESERVED_PARAMETER_NAMES = deepFreeze([
|
|
412
445
|
'context',
|
|
413
446
|
// <- TODO: Add more like 'date', 'modelName',...
|
|
414
447
|
// <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
|
|
415
|
-
];
|
|
448
|
+
]);
|
|
449
|
+
/*
|
|
450
|
+
TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
|
|
451
|
+
*/
|
|
452
|
+
// [🟡][🟢][🔵][⚪]
|
|
416
453
|
|
|
417
454
|
/**
|
|
418
455
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -749,6 +786,7 @@
|
|
|
749
786
|
var loopLimit = LOOP_LIMIT;
|
|
750
787
|
var _loop_2 = function () {
|
|
751
788
|
if (loopLimit-- < 0) {
|
|
789
|
+
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
752
790
|
throw new UnexpectedError('Loop limit reached during detection of circular dependencies in `validatePipeline`');
|
|
753
791
|
}
|
|
754
792
|
var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
|
|
@@ -787,7 +825,9 @@
|
|
|
787
825
|
* > ex port function validatePipeline(promptbook: unknown): asserts promptbook is PipelineJson {
|
|
788
826
|
*/
|
|
789
827
|
/**
|
|
790
|
-
* TODO: [🧠]
|
|
828
|
+
* TODO: [🧠][🐣] !!!! Validate that all samples match expectations
|
|
829
|
+
* TODO: [🧠][🐣] !!!! Validate that knowledge is valid (non-void)
|
|
830
|
+
* TODO: [🧠] !!! Validationg not only logic itself but imports around - files and websites and rerefenced pipelines exists
|
|
791
831
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
792
832
|
*/
|
|
793
833
|
|
|
@@ -830,7 +870,7 @@
|
|
|
830
870
|
/**
|
|
831
871
|
* Constructs a pipeline collection from promptbooks
|
|
832
872
|
*
|
|
833
|
-
* @param promptbooks
|
|
873
|
+
* @param promptbooks @@@
|
|
834
874
|
*
|
|
835
875
|
* @private Use instead `createCollectionFromJson`
|
|
836
876
|
* Note: During the construction logic of all promptbooks are validated
|
|
@@ -1134,37 +1174,64 @@
|
|
|
1134
1174
|
// <- [🩻]
|
|
1135
1175
|
];
|
|
1136
1176
|
|
|
1177
|
+
/**
|
|
1178
|
+
* @@@
|
|
1179
|
+
*/
|
|
1180
|
+
function deepClone(objectValue) {
|
|
1181
|
+
return JSON.parse(JSON.stringify(objectValue));
|
|
1182
|
+
/*
|
|
1183
|
+
TODO: [🧠] Is there a better implementation?
|
|
1184
|
+
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1185
|
+
> for (const propertyName of propertyNames) {
|
|
1186
|
+
> const value = (objectValue as really_any)[propertyName];
|
|
1187
|
+
> if (value && typeof value === 'object') {
|
|
1188
|
+
> deepClone(value);
|
|
1189
|
+
> }
|
|
1190
|
+
> }
|
|
1191
|
+
> return Object.assign({}, objectValue);
|
|
1192
|
+
*/
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* TODO: [🔼] Export from `@promptbook/utils`
|
|
1196
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1197
|
+
*/
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* @@@
|
|
1201
|
+
*
|
|
1202
|
+
* TODO: [🔼] Export with addUsage
|
|
1203
|
+
*/
|
|
1204
|
+
var ZERO_USAGE = deepFreeze({
|
|
1205
|
+
price: { value: 0 },
|
|
1206
|
+
input: {
|
|
1207
|
+
tokensCount: { value: 0 },
|
|
1208
|
+
charactersCount: { value: 0 },
|
|
1209
|
+
wordsCount: { value: 0 },
|
|
1210
|
+
sentencesCount: { value: 0 },
|
|
1211
|
+
linesCount: { value: 0 },
|
|
1212
|
+
paragraphsCount: { value: 0 },
|
|
1213
|
+
pagesCount: { value: 0 },
|
|
1214
|
+
},
|
|
1215
|
+
output: {
|
|
1216
|
+
tokensCount: { value: 0 },
|
|
1217
|
+
charactersCount: { value: 0 },
|
|
1218
|
+
wordsCount: { value: 0 },
|
|
1219
|
+
sentencesCount: { value: 0 },
|
|
1220
|
+
linesCount: { value: 0 },
|
|
1221
|
+
paragraphsCount: { value: 0 },
|
|
1222
|
+
pagesCount: { value: 0 },
|
|
1223
|
+
},
|
|
1224
|
+
});
|
|
1137
1225
|
/**
|
|
1138
1226
|
* Function `addUsage` will add multiple usages into one
|
|
1139
1227
|
*
|
|
1140
|
-
* Note: If you provide 0 values, it returns
|
|
1228
|
+
* Note: If you provide 0 values, it returns ZERO_USAGE
|
|
1141
1229
|
*/
|
|
1142
1230
|
function addUsage() {
|
|
1143
1231
|
var usageItems = [];
|
|
1144
1232
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1145
1233
|
usageItems[_i] = arguments[_i];
|
|
1146
1234
|
}
|
|
1147
|
-
var initialStructure = {
|
|
1148
|
-
price: { value: 0 },
|
|
1149
|
-
input: {
|
|
1150
|
-
tokensCount: { value: 0 },
|
|
1151
|
-
charactersCount: { value: 0 },
|
|
1152
|
-
wordsCount: { value: 0 },
|
|
1153
|
-
sentencesCount: { value: 0 },
|
|
1154
|
-
linesCount: { value: 0 },
|
|
1155
|
-
paragraphsCount: { value: 0 },
|
|
1156
|
-
pagesCount: { value: 0 },
|
|
1157
|
-
},
|
|
1158
|
-
output: {
|
|
1159
|
-
tokensCount: { value: 0 },
|
|
1160
|
-
charactersCount: { value: 0 },
|
|
1161
|
-
wordsCount: { value: 0 },
|
|
1162
|
-
sentencesCount: { value: 0 },
|
|
1163
|
-
linesCount: { value: 0 },
|
|
1164
|
-
paragraphsCount: { value: 0 },
|
|
1165
|
-
pagesCount: { value: 0 },
|
|
1166
|
-
},
|
|
1167
|
-
};
|
|
1168
1235
|
return usageItems.reduce(function (acc, item) {
|
|
1169
1236
|
var e_1, _a, e_2, _b;
|
|
1170
1237
|
var _c;
|
|
@@ -1222,7 +1289,7 @@
|
|
|
1222
1289
|
finally { if (e_2) throw e_2.error; }
|
|
1223
1290
|
}
|
|
1224
1291
|
return acc;
|
|
1225
|
-
},
|
|
1292
|
+
}, deepClone(ZERO_USAGE));
|
|
1226
1293
|
}
|
|
1227
1294
|
|
|
1228
1295
|
/**
|
|
@@ -1299,7 +1366,7 @@
|
|
|
1299
1366
|
});
|
|
1300
1367
|
}
|
|
1301
1368
|
|
|
1302
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-
|
|
1369
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-12",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",personaName:null,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> {content}",resultingParameterName:"knowledge"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-12",modelUsage:{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.61.0-12",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",personaName:null,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> {content}",resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-12",modelUsage:{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.61.0-12",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",expectations:{words:{min:1,max:8}},personaName:null,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> {content}",resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-12",modelUsage:{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.61.0-12",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:[{name:"make-model-requirements",title:"Make modelRequirements",dependentParameterNames:["availableModelNames","personaDescription"],blockType:"PROMPT_TEMPLATE",expectFormat:"JSON",personaName:null,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}",resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-12",modelUsage:{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"}];
|
|
1303
1370
|
|
|
1304
1371
|
var defaultDiacriticsRemovalMap = [
|
|
1305
1372
|
{
|
|
@@ -1973,7 +2040,7 @@
|
|
|
1973
2040
|
/**
|
|
1974
2041
|
* The version of the Promptbook library
|
|
1975
2042
|
*/
|
|
1976
|
-
var PROMPTBOOK_VERSION = '0.61.0-
|
|
2043
|
+
var PROMPTBOOK_VERSION = '0.61.0-12';
|
|
1977
2044
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
1978
2045
|
|
|
1979
2046
|
/**
|
|
@@ -2107,6 +2174,20 @@
|
|
|
2107
2174
|
* TODO: [💝] Unite object for expecting amount and format
|
|
2108
2175
|
*/
|
|
2109
2176
|
|
|
2177
|
+
/**
|
|
2178
|
+
* This error type indicates that some limit was reached
|
|
2179
|
+
*/
|
|
2180
|
+
var LimitReachedError = /** @class */ (function (_super) {
|
|
2181
|
+
__extends(LimitReachedError, _super);
|
|
2182
|
+
function LimitReachedError(message) {
|
|
2183
|
+
var _this = _super.call(this, message) || this;
|
|
2184
|
+
_this.name = 'LimitReachedError';
|
|
2185
|
+
Object.setPrototypeOf(_this, LimitReachedError.prototype);
|
|
2186
|
+
return _this;
|
|
2187
|
+
}
|
|
2188
|
+
return LimitReachedError;
|
|
2189
|
+
}(Error));
|
|
2190
|
+
|
|
2110
2191
|
/**
|
|
2111
2192
|
* Replaces parameters in template with values from parameters object
|
|
2112
2193
|
*
|
|
@@ -2123,7 +2204,7 @@
|
|
|
2123
2204
|
var loopLimit = LOOP_LIMIT;
|
|
2124
2205
|
var _loop_1 = function () {
|
|
2125
2206
|
if (loopLimit-- < 0) {
|
|
2126
|
-
throw new
|
|
2207
|
+
throw new LimitReachedError('Loop limit reached during parameters replacement in `replaceParameters`');
|
|
2127
2208
|
}
|
|
2128
2209
|
var precol = match.groups.precol;
|
|
2129
2210
|
var parameterName = match.groups.parameterName;
|
|
@@ -2611,6 +2692,7 @@
|
|
|
2611
2692
|
switch (_e.label) {
|
|
2612
2693
|
case 0:
|
|
2613
2694
|
if (loopLimit-- < 0) {
|
|
2695
|
+
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
2614
2696
|
throw new UnexpectedError('Loop limit reached during resolving parameters pipeline execution');
|
|
2615
2697
|
}
|
|
2616
2698
|
currentTemplate = unresovedTemplates.find(function (template) {
|
|
@@ -2657,7 +2739,7 @@
|
|
|
2657
2739
|
}
|
|
2658
2740
|
usage_1 = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
|
|
2659
2741
|
var result = _a.result;
|
|
2660
|
-
return (result === null || result === void 0 ? void 0 : result.usage) ||
|
|
2742
|
+
return (result === null || result === void 0 ? void 0 : result.usage) || ZERO_USAGE;
|
|
2661
2743
|
})), false));
|
|
2662
2744
|
return [2 /*return*/, {
|
|
2663
2745
|
isSuccessful: false,
|
|
@@ -2686,7 +2768,7 @@
|
|
|
2686
2768
|
}
|
|
2687
2769
|
usage = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
|
|
2688
2770
|
var result = _a.result;
|
|
2689
|
-
return (result === null || result === void 0 ? void 0 : result.usage) ||
|
|
2771
|
+
return (result === null || result === void 0 ? void 0 : result.usage) || ZERO_USAGE;
|
|
2690
2772
|
})), false));
|
|
2691
2773
|
return [2 /*return*/, {
|
|
2692
2774
|
isSuccessful: true,
|
|
@@ -2718,6 +2800,7 @@
|
|
|
2718
2800
|
*
|
|
2719
2801
|
* @param value any values
|
|
2720
2802
|
* @returns void
|
|
2803
|
+
* @private within the repository
|
|
2721
2804
|
*/
|
|
2722
2805
|
function TODO_USE() {
|
|
2723
2806
|
var value = [];
|
|
@@ -2853,6 +2936,7 @@
|
|
|
2853
2936
|
});
|
|
2854
2937
|
}
|
|
2855
2938
|
/**
|
|
2939
|
+
* TODO: [🔼] !!! Export via `@promptbook/markdown`
|
|
2856
2940
|
* TODO: [🪂] Do it in parallel 11:11
|
|
2857
2941
|
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
2858
2942
|
*/
|
|
@@ -2861,7 +2945,6 @@
|
|
|
2861
2945
|
* Prepares the knowle
|
|
2862
2946
|
*
|
|
2863
2947
|
* @see https://github.com/webgptorg/promptbook/discussions/41
|
|
2864
|
-
* @private within the package
|
|
2865
2948
|
*/
|
|
2866
2949
|
function prepareKnowledgePieces(knowledgeSources, options) {
|
|
2867
2950
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -2876,7 +2959,7 @@
|
|
|
2876
2959
|
var partialPieces, pieces;
|
|
2877
2960
|
return __generator(this, function (_a) {
|
|
2878
2961
|
switch (_a.label) {
|
|
2879
|
-
case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.source, // <- TODO: !!!!! Unhardcode markdown, detect which type it is
|
|
2962
|
+
case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.source, // <- TODO: [🐝] !!!!! Unhardcode markdown, detect which type it is
|
|
2880
2963
|
options)];
|
|
2881
2964
|
case 1:
|
|
2882
2965
|
partialPieces = _a.sent();
|
|
@@ -2914,6 +2997,7 @@
|
|
|
2914
2997
|
> ):
|
|
2915
2998
|
*/
|
|
2916
2999
|
/**
|
|
3000
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
2917
3001
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
2918
3002
|
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
2919
3003
|
* TODO: [🪂] More than max things can run in parallel by acident [1,[2a,2b,_],[3a,3b,_]]
|
|
@@ -2926,7 +3010,6 @@
|
|
|
2926
3010
|
* Prepares the persona for the pipeline
|
|
2927
3011
|
*
|
|
2928
3012
|
* @see https://github.com/webgptorg/promptbook/discussions/22
|
|
2929
|
-
* @private within the package
|
|
2930
3013
|
*/
|
|
2931
3014
|
function preparePersona(personaDescription, options) {
|
|
2932
3015
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -2970,9 +3053,6 @@
|
|
|
2970
3053
|
console.info("PERSONA ".concat(personaDescription), modelRequirements);
|
|
2971
3054
|
}
|
|
2972
3055
|
modelName = modelRequirements.modelName, systemMessage = modelRequirements.systemMessage, temperature = modelRequirements.temperature;
|
|
2973
|
-
// TODO: !!! Check validity of `modelName`
|
|
2974
|
-
// TODO: !!! Check validity of `systemMessage`
|
|
2975
|
-
// TODO: !!! Check validity of `temperature`
|
|
2976
3056
|
return [2 /*return*/, {
|
|
2977
3057
|
modelVariant: 'CHAT',
|
|
2978
3058
|
modelName: modelName,
|
|
@@ -2983,6 +3063,12 @@
|
|
|
2983
3063
|
});
|
|
2984
3064
|
});
|
|
2985
3065
|
}
|
|
3066
|
+
/**
|
|
3067
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
3068
|
+
* TODO: [🏢] !! Check validity of `modelName` in pipeline
|
|
3069
|
+
* TODO: [🏢] !! Check validity of `systemMessage` in pipeline
|
|
3070
|
+
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
3071
|
+
*/
|
|
2986
3072
|
|
|
2987
3073
|
/**
|
|
2988
3074
|
* Prepare pipeline from string (markdown) format to JSON format
|
|
@@ -3008,7 +3094,7 @@
|
|
|
3008
3094
|
id: 1,
|
|
3009
3095
|
// TODO: [🍥]> date: $currentDate(),
|
|
3010
3096
|
promptbookVersion: PROMPTBOOK_VERSION,
|
|
3011
|
-
modelUsage:
|
|
3097
|
+
modelUsage: ZERO_USAGE,
|
|
3012
3098
|
};
|
|
3013
3099
|
preparations = [
|
|
3014
3100
|
// ...preparations
|
|
@@ -3043,10 +3129,11 @@
|
|
|
3043
3129
|
});
|
|
3044
3130
|
}
|
|
3045
3131
|
/**
|
|
3132
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
3046
3133
|
* TODO: Write tests for `preparePipeline`
|
|
3047
3134
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
3048
3135
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
3049
|
-
* TODO:
|
|
3136
|
+
* TODO: [🎐] !!!! Use here countTotalUsage
|
|
3050
3137
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
3051
3138
|
*/
|
|
3052
3139
|
|
|
@@ -3361,7 +3448,7 @@
|
|
|
3361
3448
|
'Knowledge BLOCK',
|
|
3362
3449
|
// 'Knowledge', // <- Note: [⛱] For execution blocks which are also separate commands shortcut does not work
|
|
3363
3450
|
//---
|
|
3364
|
-
/*
|
|
3451
|
+
/* Note: Not implemented block types will be in examples in future -> */
|
|
3365
3452
|
'Instrument BLOCK',
|
|
3366
3453
|
// 'Instrument', // <- Note: [⛱]
|
|
3367
3454
|
'Action BLOCK',
|
|
@@ -3379,10 +3466,10 @@
|
|
|
3379
3466
|
if (blockTypes.length !== 1) {
|
|
3380
3467
|
throw new ParsingError(spaceTrim__default["default"](function (block) { return "\n Unknown block type in BLOCK command\n\n Supported block types are:\n ".concat(block(BlockTypes.join(', ')), "\n "); }));
|
|
3381
3468
|
}
|
|
3382
|
-
|
|
3469
|
+
var blockType = blockTypes[0];
|
|
3383
3470
|
return {
|
|
3384
3471
|
type: 'BLOCK',
|
|
3385
|
-
blockType:
|
|
3472
|
+
blockType: blockType,
|
|
3386
3473
|
};
|
|
3387
3474
|
},
|
|
3388
3475
|
};
|
|
@@ -3627,7 +3714,7 @@
|
|
|
3627
3714
|
|
|
3628
3715
|
var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
|
|
3629
3716
|
/**
|
|
3630
|
-
* TODO: [🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
|
|
3717
|
+
* TODO: [🧠][🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
|
|
3631
3718
|
* TODO: [🧠][💱] Add more model options: `stop_token`, `logit_bias`, `logprobs` (`top_logprobs`), `top_k`, `top_p`, `presence_penalty`, `frequency_penalty`, `bestOf`, `logitBias`, `logitBiasType`,...
|
|
3632
3719
|
* [💱] Probbably keep using just `temperature` in Promptbook (not `top_k` and `top_p`)
|
|
3633
3720
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
@@ -4087,6 +4174,7 @@
|
|
|
4087
4174
|
};
|
|
4088
4175
|
/**
|
|
4089
4176
|
* TODO: [💐] Implement BOILERPLATE command into `pipelineStringToJsonSync` function
|
|
4177
|
+
* Note: [⚪] This should never be in any released package
|
|
4090
4178
|
*/
|
|
4091
4179
|
|
|
4092
4180
|
/**
|
|
@@ -4105,7 +4193,7 @@
|
|
|
4105
4193
|
actionCommandParser,
|
|
4106
4194
|
instrumentCommandParser,
|
|
4107
4195
|
personaCommandParser,
|
|
4108
|
-
boilerplateCommandParser, // <- TODO:
|
|
4196
|
+
boilerplateCommandParser, // <- TODO: !! Only in development, remove in production
|
|
4109
4197
|
];
|
|
4110
4198
|
|
|
4111
4199
|
/**
|
|
@@ -4191,7 +4279,7 @@
|
|
|
4191
4279
|
}));
|
|
4192
4280
|
}
|
|
4193
4281
|
/**
|
|
4194
|
-
*
|
|
4282
|
+
* @@@
|
|
4195
4283
|
*/
|
|
4196
4284
|
function getSupportedCommandsMessage() {
|
|
4197
4285
|
return COMMANDS.flatMap(function (_a) {
|
|
@@ -4202,7 +4290,7 @@
|
|
|
4202
4290
|
}).join('\n');
|
|
4203
4291
|
}
|
|
4204
4292
|
/**
|
|
4205
|
-
*
|
|
4293
|
+
* @@@
|
|
4206
4294
|
*/
|
|
4207
4295
|
function parseCommandVariant(input) {
|
|
4208
4296
|
var e_1, _a;
|
|
@@ -4933,7 +5021,7 @@
|
|
|
4933
5021
|
if (command.blockType === 'KNOWLEDGE') {
|
|
4934
5022
|
knowledgeCommandParser.applyToPipelineJson(pipelineJson, {
|
|
4935
5023
|
type: 'KNOWLEDGE',
|
|
4936
|
-
source: content, // <- TODO: !!!!
|
|
5024
|
+
source: content, // <- TODO: [🐝] !!!! Work with KNOWLEDGE which not referring to the source file/wweb, but its content itself
|
|
4937
5025
|
});
|
|
4938
5026
|
return "continue-templates";
|
|
4939
5027
|
}
|
|
@@ -5071,7 +5159,7 @@
|
|
|
5071
5159
|
delete template.modelRequirements;
|
|
5072
5160
|
}
|
|
5073
5161
|
// TODO: [🍧] What actually about preparation and pushing the block into `promptTemplates`
|
|
5074
|
-
pipelineJson.promptTemplates.push(template
|
|
5162
|
+
pipelineJson.promptTemplates.push(template);
|
|
5075
5163
|
};
|
|
5076
5164
|
try {
|
|
5077
5165
|
// =============================================================
|
|
@@ -5185,7 +5273,7 @@
|
|
|
5185
5273
|
/**
|
|
5186
5274
|
* Add or modify an auto-generated section in a markdown file
|
|
5187
5275
|
*
|
|
5188
|
-
* @private within the
|
|
5276
|
+
* @private within the repository
|
|
5189
5277
|
*/
|
|
5190
5278
|
function addAutoGeneratedSection(content, options) {
|
|
5191
5279
|
var sectionName = options.sectionName, sectionContent = options.sectionContent;
|
|
@@ -5472,6 +5560,9 @@
|
|
|
5472
5560
|
};
|
|
5473
5561
|
return SimplePromptInterfaceTools;
|
|
5474
5562
|
}());
|
|
5563
|
+
/**
|
|
5564
|
+
* Note: [🔵] This code should never be published outside of `@promptbook/browser`
|
|
5565
|
+
*/
|
|
5475
5566
|
|
|
5476
5567
|
/**
|
|
5477
5568
|
* Unprepare just strips the preparation data of the pipeline
|
|
@@ -5483,6 +5574,7 @@
|
|
|
5483
5574
|
return __assign(__assign({}, pipeline), { knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] });
|
|
5484
5575
|
}
|
|
5485
5576
|
/**
|
|
5577
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
5486
5578
|
* TODO: Write tests for `preparePipeline`
|
|
5487
5579
|
*/
|
|
5488
5580
|
|
|
@@ -5497,7 +5589,7 @@
|
|
|
5497
5589
|
/**
|
|
5498
5590
|
* Format either small or big number
|
|
5499
5591
|
*
|
|
5500
|
-
* @private within the
|
|
5592
|
+
* @private within the repository
|
|
5501
5593
|
*/
|
|
5502
5594
|
function formatNumber(value) {
|
|
5503
5595
|
if (value === 0) {
|
|
@@ -5517,7 +5609,7 @@
|
|
|
5517
5609
|
/**
|
|
5518
5610
|
* Create a markdown table from a 2D array of strings
|
|
5519
5611
|
*
|
|
5520
|
-
* @private within the
|
|
5612
|
+
* @private within the repository
|
|
5521
5613
|
*/
|
|
5522
5614
|
function createMarkdownTable(table) {
|
|
5523
5615
|
var columnWidths = table.reduce(function (widths, row) {
|
|
@@ -5545,7 +5637,7 @@
|
|
|
5545
5637
|
/**
|
|
5546
5638
|
* Function createMarkdownChart will draw a chart in markdown from ⬛+🟦 tiles
|
|
5547
5639
|
*
|
|
5548
|
-
* @private within the
|
|
5640
|
+
* @private within the repository
|
|
5549
5641
|
*/
|
|
5550
5642
|
function createMarkdownChart(options) {
|
|
5551
5643
|
var e_1, _a;
|
|
@@ -5590,10 +5682,14 @@
|
|
|
5590
5682
|
* Returns the same value that is passed as argument.
|
|
5591
5683
|
* No side effects.
|
|
5592
5684
|
*
|
|
5593
|
-
* Note: It can be usefull for
|
|
5685
|
+
* Note: It can be usefull for:
|
|
5686
|
+
*
|
|
5687
|
+
* 1) Leveling indentation
|
|
5688
|
+
* 2) Putting always-true or always-false conditions without getting eslint errors
|
|
5594
5689
|
*
|
|
5595
5690
|
* @param value any values
|
|
5596
5691
|
* @returns the same values
|
|
5692
|
+
* @private within the repository
|
|
5597
5693
|
*/
|
|
5598
5694
|
function just(value) {
|
|
5599
5695
|
if (value === undefined) {
|
|
@@ -5614,7 +5710,7 @@
|
|
|
5614
5710
|
/**
|
|
5615
5711
|
* Count the duration of working time
|
|
5616
5712
|
*
|
|
5617
|
-
* @private within the
|
|
5713
|
+
* @private within the repository
|
|
5618
5714
|
*/
|
|
5619
5715
|
function countWorkingDuration(items) {
|
|
5620
5716
|
var e_1, _a;
|