@promptbook/legacy-documents 0.75.0-0 → 0.75.0-2
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 -0
- package/esm/index.es.js +282 -236
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +6 -6
- package/esm/typings/src/_packages/core.index.d.ts +29 -19
- package/esm/typings/src/_packages/types.index.d.ts +58 -50
- package/esm/typings/src/_packages/utils.index.d.ts +4 -4
- package/esm/typings/src/cli/cli-commands/about.d.ts +1 -0
- package/esm/typings/src/cli/cli-commands/hello.d.ts +1 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +1 -0
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -0
- package/esm/typings/src/cli/cli-commands/run.d.ts +1 -0
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -0
- package/esm/typings/src/cli/main.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/collectionToJson.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -1
- package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +2 -2
- package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/FORMAT/formatCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/JOKER/jokerCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/SECTION/SectionCommand.d.ts +11 -0
- package/esm/typings/src/commands/SECTION/SectionType.d.ts +13 -0
- package/esm/typings/src/commands/{TEMPLATE/templateCommandParser.d.ts → SECTION/sectionCommandParser.d.ts} +6 -6
- package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +17 -17
- package/esm/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +1 -1
- package/esm/typings/src/commands/index.d.ts +4 -1
- package/esm/typings/src/config.d.ts +3 -1
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +2 -2
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -2
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +3 -3
- package/esm/typings/src/conversion/prettify/prettifyPipelineString.d.ts +1 -1
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -3
- package/esm/typings/src/conversion/utils/{extractParameterNamesFromTemplate.d.ts → extractParameterNamesFromTask.d.ts} +2 -2
- package/esm/typings/src/conversion/utils/renameParameter.d.ts +1 -1
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +3 -2
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +1 -1
- package/esm/typings/src/errors/index.d.ts +3 -0
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -2
- package/esm/typings/src/execution/PromptResultUsage.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/{$OngoingTemplateResult.d.ts → $OngoingTaskResult.d.ts} +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/{20-executeTemplate.d.ts → 20-executeTask.d.ts} +7 -7
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +5 -5
- package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/{getContextForTemplate.d.ts → getContextForTask.d.ts} +2 -2
- package/esm/typings/src/execution/createPipelineExecutor/{getExamplesForTemplate.d.ts → getExamplesForTask.d.ts} +2 -2
- package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +27 -0
- package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +30 -0
- package/esm/typings/src/{types → execution}/execution-report/ExecutionPromptReportJson.d.ts +2 -2
- package/esm/typings/src/{types → execution}/execution-report/ExecutionReportJson.d.ts +4 -4
- package/esm/typings/src/{types → execution}/execution-report/ExecutionReportStringOptions.d.ts +1 -1
- package/esm/typings/src/execution/utils/checkExpectations.d.ts +1 -1
- package/esm/typings/src/execution/utils/usage-constants.d.ts +3 -0
- package/esm/typings/src/formats/index.d.ts +3 -0
- package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +9 -1
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +4 -1
- package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +15 -0
- package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +5 -1
- package/esm/typings/src/formfactors/index.d.ts +39 -3
- package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -0
- package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +3 -0
- package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -0
- package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +3 -0
- package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -0
- package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +3 -0
- package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +1 -0
- package/esm/typings/src/personas/preparePersona.d.ts +1 -1
- package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/PipelineInterface.d.ts +5 -2
- package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +14 -0
- package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/getPipelineInterface.d.ts +3 -1
- package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/isPipelineImplementingInterface.d.ts +5 -1
- package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/isPipelineInterfacesEqual.d.ts +2 -0
- package/esm/typings/src/pipeline/PipelineJson/DialogTaskJson.d.ts +13 -0
- package/esm/typings/src/{types → pipeline}/PipelineJson/Expectations.d.ts +2 -2
- package/esm/typings/src/{types → pipeline}/PipelineJson/KnowledgePieceJson.d.ts +7 -6
- package/esm/typings/src/{types → pipeline}/PipelineJson/KnowledgeSourceJson.d.ts +3 -3
- package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +96 -0
- package/esm/typings/src/{types → pipeline}/PipelineJson/PersonaJson.d.ts +4 -4
- package/esm/typings/src/{types → pipeline}/PipelineJson/PipelineJson.d.ts +10 -10
- package/esm/typings/src/{types → pipeline}/PipelineJson/PreparationJson.d.ts +1 -1
- package/esm/typings/src/{types/PipelineJson/PromptTemplateJson.d.ts → pipeline/PipelineJson/PromptTaskJson.d.ts} +8 -8
- package/esm/typings/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +20 -0
- package/esm/typings/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +13 -0
- package/esm/typings/src/pipeline/PipelineJson/TaskJson.d.ts +11 -0
- package/esm/typings/src/{types/PipelineJson/TemplateJsonCommon.d.ts → pipeline/PipelineJson/TaskJsonCommon.d.ts} +13 -13
- package/esm/typings/src/{types → pipeline}/PipelineString.d.ts +1 -1
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +2 -2
- package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
- package/esm/typings/src/prepare/{prepareTemplates.d.ts → prepareTasks.d.ts} +7 -7
- package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +1 -1
- package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/document/register-metadata.d.ts +3 -0
- package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +3 -0
- package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +3 -0
- package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +3 -0
- package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +3 -0
- package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +1 -0
- package/esm/typings/src/types/Prompt.d.ts +1 -1
- package/esm/typings/src/types/TaskProgress.d.ts +2 -2
- package/esm/typings/src/types/typeAliasEmoji.d.ts +3 -0
- package/esm/typings/src/types/typeAliases.d.ts +1 -0
- package/esm/typings/src/utils/emojis.d.ts +1 -0
- package/esm/typings/src/utils/expectation-counters/{config.d.ts → constants.d.ts} +4 -0
- package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/index.d.ts +3 -2
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -0
- package/esm/typings/src/utils/parameters/extractParameterNames.d.ts +2 -2
- package/esm/typings/src/utils/serialization/clonePipeline.d.ts +1 -1
- package/esm/typings/src/version.d.ts +2 -1
- package/package.json +5 -4
- package/umd/index.umd.js +282 -236
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/commands/TEMPLATE/TemplateCommand.d.ts +0 -11
- package/esm/typings/src/commands/TEMPLATE/TemplateTypes.d.ts +0 -15
- package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +0 -27
- package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +0 -30
- package/esm/typings/src/formfactors/chat/ChatFormfactorDefinition.d.ts +0 -10
- package/esm/typings/src/types/PipelineJson/DialogTemplateJson.d.ts +0 -13
- package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +0 -39
- package/esm/typings/src/types/PipelineJson/ScriptTemplateJson.d.ts +0 -20
- package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +0 -13
- package/esm/typings/src/types/PipelineJson/TemplateJson.d.ts +0 -11
- /package/esm/typings/src/commands/{TEMPLATE/templateCommand.test.d.ts → SECTION/sectionCommand.test.d.ts} +0 -0
- /package/esm/typings/src/conversion/utils/{extractParameterNamesFromTemplate.test.d.ts → extractParameterNamesFromTask.test.d.ts} +0 -0
- /package/esm/typings/src/{types → execution}/execution-report/ExecutionReportString.d.ts +0 -0
- /package/esm/typings/src/{types → execution}/execution-report/countWorkingDuration.d.ts +0 -0
- /package/esm/typings/src/{types → execution}/execution-report/countWorkingDuration.test.d.ts +0 -0
- /package/esm/typings/src/{types → execution}/execution-report/executionReportJsonToString.d.ts +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
*
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
26
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.0-1';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
29
30
|
*/
|
|
30
31
|
|
|
31
32
|
/*! *****************************************************************************
|
|
@@ -462,6 +463,8 @@
|
|
|
462
463
|
// Note: In normal situations, we check the pipeline logic:
|
|
463
464
|
true);
|
|
464
465
|
/**
|
|
466
|
+
* TODO: Extract `constants.ts` from `config.ts`
|
|
467
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
465
468
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
466
469
|
*/
|
|
467
470
|
|
|
@@ -1078,6 +1081,9 @@
|
|
|
1078
1081
|
normalizedName = normalizedName.replace(/-$/, '');
|
|
1079
1082
|
return normalizedName;
|
|
1080
1083
|
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
1086
|
+
*/
|
|
1081
1087
|
|
|
1082
1088
|
/**
|
|
1083
1089
|
* Removes emojis from a string and fix whitespaces
|
|
@@ -1225,7 +1231,7 @@
|
|
|
1225
1231
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
1226
1232
|
*/
|
|
1227
1233
|
|
|
1228
|
-
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}],
|
|
1234
|
+
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"]}],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",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"]}],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",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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.book.md"}];
|
|
1229
1235
|
|
|
1230
1236
|
/**
|
|
1231
1237
|
* Prettify the html code
|
|
@@ -1279,7 +1285,7 @@
|
|
|
1279
1285
|
*/
|
|
1280
1286
|
function pipelineJsonToString(pipelineJson) {
|
|
1281
1287
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
|
|
1282
|
-
var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters,
|
|
1288
|
+
var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, tasks = pipelineJson.tasks;
|
|
1283
1289
|
var pipelineString = "# ".concat(title);
|
|
1284
1290
|
if (description) {
|
|
1285
1291
|
pipelineString += '\n\n';
|
|
@@ -1329,13 +1335,13 @@
|
|
|
1329
1335
|
pipelineString += '\n\n';
|
|
1330
1336
|
pipelineString += commands.map(function (command) { return "- ".concat(command); }).join('\n');
|
|
1331
1337
|
try {
|
|
1332
|
-
for (var
|
|
1333
|
-
var template =
|
|
1338
|
+
for (var tasks_1 = __values(tasks), tasks_1_1 = tasks_1.next(); !tasks_1_1.done; tasks_1_1 = tasks_1.next()) {
|
|
1339
|
+
var template = tasks_1_1.value;
|
|
1334
1340
|
var
|
|
1335
1341
|
/* Note: Not using:> name, */
|
|
1336
1342
|
title_1 = template.title, description_1 = template.description,
|
|
1337
1343
|
/* Note: dependentParameterNames, */
|
|
1338
|
-
jokers = template.jokerParameterNames,
|
|
1344
|
+
jokers = template.jokerParameterNames, taskType = template.taskType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
|
|
1339
1345
|
pipelineString += '\n\n';
|
|
1340
1346
|
pipelineString += "## ".concat(title_1);
|
|
1341
1347
|
if (description_1) {
|
|
@@ -1344,7 +1350,7 @@
|
|
|
1344
1350
|
}
|
|
1345
1351
|
var commands_1 = [];
|
|
1346
1352
|
var contentLanguage = 'text';
|
|
1347
|
-
if (
|
|
1353
|
+
if (taskType === 'PROMPT_TASK') {
|
|
1348
1354
|
var modelRequirements = template.modelRequirements;
|
|
1349
1355
|
var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
|
|
1350
1356
|
commands_1.push("EXECUTE PROMPT TEMPLATE");
|
|
@@ -1355,11 +1361,11 @@
|
|
|
1355
1361
|
commands_1.push("MODEL NAME `".concat(modelName, "`"));
|
|
1356
1362
|
}
|
|
1357
1363
|
}
|
|
1358
|
-
else if (
|
|
1364
|
+
else if (taskType === 'SIMPLE_TASK') {
|
|
1359
1365
|
commands_1.push("SIMPLE TEMPLATE");
|
|
1360
1366
|
// Note: Nothing special here
|
|
1361
1367
|
}
|
|
1362
|
-
else if (
|
|
1368
|
+
else if (taskType === 'SCRIPT_TASK') {
|
|
1363
1369
|
commands_1.push("SCRIPT TEMPLATE");
|
|
1364
1370
|
if (template.contentLanguage) {
|
|
1365
1371
|
contentLanguage = template.contentLanguage;
|
|
@@ -1368,7 +1374,7 @@
|
|
|
1368
1374
|
contentLanguage = '';
|
|
1369
1375
|
}
|
|
1370
1376
|
}
|
|
1371
|
-
else if (
|
|
1377
|
+
else if (taskType === 'DIALOG_TASK') {
|
|
1372
1378
|
commands_1.push("DIALOG TEMPLATE");
|
|
1373
1379
|
// Note: Nothing special here
|
|
1374
1380
|
} // <- }else if([🅱]
|
|
@@ -1450,7 +1456,7 @@
|
|
|
1450
1456
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1451
1457
|
finally {
|
|
1452
1458
|
try {
|
|
1453
|
-
if (
|
|
1459
|
+
if (tasks_1_1 && !tasks_1_1.done && (_c = tasks_1.return)) _c.call(tasks_1);
|
|
1454
1460
|
}
|
|
1455
1461
|
finally { if (e_3) throw e_3.error; }
|
|
1456
1462
|
}
|
|
@@ -1698,24 +1704,23 @@
|
|
|
1698
1704
|
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Pipeline is valid JSON but with wrong structure\n\n `PipelineJson.parameters` expected to be an array, but got ".concat(typeof pipeline.parameters, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1699
1705
|
}
|
|
1700
1706
|
// TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
|
|
1701
|
-
if (!Array.isArray(pipeline.
|
|
1707
|
+
if (!Array.isArray(pipeline.tasks)) {
|
|
1702
1708
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
1703
|
-
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Pipeline is valid JSON but with wrong structure\n\n `PipelineJson.
|
|
1709
|
+
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Pipeline is valid JSON but with wrong structure\n\n `PipelineJson.tasks` expected to be an array, but got ".concat(typeof pipeline.tasks, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1704
1710
|
}
|
|
1705
1711
|
var _loop_1 = function (parameter) {
|
|
1706
1712
|
if (parameter.isInput && parameter.isOutput) {
|
|
1707
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Parameter {".concat(parameter.name, "} can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1713
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Parameter `{".concat(parameter.name, "}` can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1708
1714
|
}
|
|
1709
1715
|
// Note: Testing that parameter is either intermediate or output BUT not created and unused
|
|
1710
1716
|
if (!parameter.isInput &&
|
|
1711
1717
|
!parameter.isOutput &&
|
|
1712
|
-
!pipeline.
|
|
1713
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
1718
|
+
!pipeline.tasks.some(function (task) { return task.dependentParameterNames.includes(parameter.name); })) {
|
|
1719
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
1714
1720
|
}
|
|
1715
|
-
// Note: Testing that parameter is either input or result of some
|
|
1716
|
-
if (!parameter.isInput &&
|
|
1717
|
-
|
|
1718
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of {").concat(parameter.name, "}\n 2) Add template that results in -> {").concat(parameter.name, "}\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1721
|
+
// Note: Testing that parameter is either input or result of some task
|
|
1722
|
+
if (!parameter.isInput && !pipeline.tasks.some(function (task) { return task.resultingParameterName === parameter.name; })) {
|
|
1723
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of `{").concat(parameter.name, "}`\n 2) Add task that results in `-> {").concat(parameter.name, "}`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1719
1724
|
}
|
|
1720
1725
|
};
|
|
1721
1726
|
try {
|
|
@@ -1732,7 +1737,7 @@
|
|
|
1732
1737
|
}
|
|
1733
1738
|
finally { if (e_1) throw e_1.error; }
|
|
1734
1739
|
}
|
|
1735
|
-
// Note: All input parameters are defined - so that they can be used as result of some
|
|
1740
|
+
// Note: All input parameters are defined - so that they can be used as result of some task
|
|
1736
1741
|
var definedParameters = new Set(pipeline.parameters.filter(function (_a) {
|
|
1737
1742
|
var isInput = _a.isInput;
|
|
1738
1743
|
return isInput;
|
|
@@ -1740,27 +1745,27 @@
|
|
|
1740
1745
|
var name = _a.name;
|
|
1741
1746
|
return name;
|
|
1742
1747
|
}));
|
|
1743
|
-
var _loop_2 = function (
|
|
1748
|
+
var _loop_2 = function (task) {
|
|
1744
1749
|
var e_4, _h, e_5, _j;
|
|
1745
|
-
if (definedParameters.has(
|
|
1746
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(
|
|
1750
|
+
if (definedParameters.has(task.resultingParameterName)) {
|
|
1751
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(task.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1747
1752
|
}
|
|
1748
|
-
if (RESERVED_PARAMETER_NAMES.includes(
|
|
1749
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter name {".concat(
|
|
1753
|
+
if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
|
|
1754
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter name {".concat(task.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1750
1755
|
}
|
|
1751
|
-
definedParameters.add(
|
|
1752
|
-
if (
|
|
1753
|
-
if (!
|
|
1754
|
-
!
|
|
1755
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Joker parameters are used for {".concat(
|
|
1756
|
+
definedParameters.add(task.resultingParameterName);
|
|
1757
|
+
if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
|
|
1758
|
+
if (!task.format &&
|
|
1759
|
+
!task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
1760
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Joker parameters are used for {".concat(task.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1756
1761
|
}
|
|
1757
1762
|
var _loop_4 = function (joker) {
|
|
1758
|
-
if (!
|
|
1759
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(joker, "} is used for {").concat(
|
|
1763
|
+
if (!task.dependentParameterNames.includes(joker)) {
|
|
1764
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(joker, "}` is used for {").concat(task.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1760
1765
|
}
|
|
1761
1766
|
};
|
|
1762
1767
|
try {
|
|
1763
|
-
for (var _k = (e_4 = void 0, __values(
|
|
1768
|
+
for (var _k = (e_4 = void 0, __values(task.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
1764
1769
|
var joker = _l.value;
|
|
1765
1770
|
_loop_4(joker);
|
|
1766
1771
|
}
|
|
@@ -1773,7 +1778,7 @@
|
|
|
1773
1778
|
finally { if (e_4) throw e_4.error; }
|
|
1774
1779
|
}
|
|
1775
1780
|
}
|
|
1776
|
-
if (
|
|
1781
|
+
if (task.expectations) {
|
|
1777
1782
|
var _loop_5 = function (unit, min, max) {
|
|
1778
1783
|
if (min !== undefined && max !== undefined && min > max) {
|
|
1779
1784
|
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Min expectation (=".concat(min, ") of ").concat(unit, " is higher than max expectation (=").concat(max, ")\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
@@ -1786,7 +1791,7 @@
|
|
|
1786
1791
|
}
|
|
1787
1792
|
};
|
|
1788
1793
|
try {
|
|
1789
|
-
for (var _m = (e_5 = void 0, __values(Object.entries(
|
|
1794
|
+
for (var _m = (e_5 = void 0, __values(Object.entries(task.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
1790
1795
|
var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
|
|
1791
1796
|
_loop_5(unit, min, max);
|
|
1792
1797
|
}
|
|
@@ -1801,10 +1806,10 @@
|
|
|
1801
1806
|
}
|
|
1802
1807
|
};
|
|
1803
1808
|
try {
|
|
1804
|
-
// Note: Checking each
|
|
1805
|
-
for (var _f = __values(pipeline.
|
|
1806
|
-
var
|
|
1807
|
-
_loop_2(
|
|
1809
|
+
// Note: Checking each task individually
|
|
1810
|
+
for (var _f = __values(pipeline.tasks), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1811
|
+
var task = _g.value;
|
|
1812
|
+
_loop_2(task);
|
|
1808
1813
|
}
|
|
1809
1814
|
}
|
|
1810
1815
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -1838,37 +1843,48 @@
|
|
|
1838
1843
|
}
|
|
1839
1844
|
finally { if (e_3) throw e_3.error; }
|
|
1840
1845
|
}
|
|
1841
|
-
var unresovedTemplates = __spreadArray([], __read(pipeline.
|
|
1846
|
+
var unresovedTemplates = __spreadArray([], __read(pipeline.tasks), false);
|
|
1842
1847
|
var loopLimit = LOOP_LIMIT;
|
|
1843
1848
|
var _loop_3 = function () {
|
|
1844
1849
|
if (loopLimit-- < 0) {
|
|
1845
1850
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
1846
1851
|
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Loop limit reached during detection of circular dependencies in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
1847
1852
|
}
|
|
1848
|
-
var currentlyResovedTemplates = unresovedTemplates.filter(function (
|
|
1849
|
-
return
|
|
1853
|
+
var currentlyResovedTemplates = unresovedTemplates.filter(function (task) {
|
|
1854
|
+
return task.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
|
|
1850
1855
|
});
|
|
1851
1856
|
if (currentlyResovedTemplates.length === 0) {
|
|
1852
1857
|
throw new PipelineLogicError(
|
|
1853
1858
|
// TODO: [🐎] DRY
|
|
1854
|
-
spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve
|
|
1859
|
+
spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates
|
|
1855
1860
|
.map(function (_a) {
|
|
1856
1861
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
1857
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
1858
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
1862
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
1863
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
1859
1864
|
.join(' and '));
|
|
1860
1865
|
})
|
|
1861
|
-
.join('\n')), "\n\n Resolved
|
|
1866
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameters
|
|
1867
|
+
.filter(function (name) {
|
|
1868
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
1869
|
+
})
|
|
1870
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1871
|
+
.join('\n')), "\n\n\n **Reserved (which are available):**\n ").concat(block(resovedParameters
|
|
1872
|
+
.filter(function (name) {
|
|
1873
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
1874
|
+
})
|
|
1875
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1876
|
+
.join('\n')), "\n\n\n "); }));
|
|
1862
1877
|
}
|
|
1863
1878
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
|
|
1864
1879
|
var resultingParameterName = _a.resultingParameterName;
|
|
1865
1880
|
return resultingParameterName;
|
|
1866
1881
|
})), false);
|
|
1867
|
-
unresovedTemplates = unresovedTemplates.filter(function (
|
|
1882
|
+
unresovedTemplates = unresovedTemplates.filter(function (task) { return !currentlyResovedTemplates.includes(task); });
|
|
1868
1883
|
};
|
|
1869
1884
|
while (unresovedTemplates.length > 0) {
|
|
1870
1885
|
_loop_3();
|
|
1871
1886
|
}
|
|
1887
|
+
// TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
|
|
1872
1888
|
}
|
|
1873
1889
|
/**
|
|
1874
1890
|
* TODO: !! [🧞♀️] Do not allow joker + foreach
|
|
@@ -1925,9 +1941,9 @@
|
|
|
1925
1941
|
}(Error));
|
|
1926
1942
|
|
|
1927
1943
|
/**
|
|
1928
|
-
* Parses the
|
|
1944
|
+
* Parses the task and returns the list of all parameter names
|
|
1929
1945
|
*
|
|
1930
|
-
* @param template the
|
|
1946
|
+
* @param template the task with parameters in {curly} braces
|
|
1931
1947
|
* @returns the list of parameter names
|
|
1932
1948
|
* @public exported from `@promptbook/utils`
|
|
1933
1949
|
*/
|
|
@@ -1958,10 +1974,10 @@
|
|
|
1958
1974
|
* @public exported from `@promptbook/core`
|
|
1959
1975
|
*/
|
|
1960
1976
|
function unpreparePipeline(pipeline) {
|
|
1961
|
-
var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources,
|
|
1977
|
+
var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, tasks = pipeline.tasks;
|
|
1962
1978
|
personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
|
|
1963
1979
|
knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
|
|
1964
|
-
|
|
1980
|
+
tasks = tasks.map(function (template) {
|
|
1965
1981
|
var dependentParameterNames = template.dependentParameterNames;
|
|
1966
1982
|
var parameterNames = extractParameterNames(template.preparedContent || '');
|
|
1967
1983
|
dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
|
|
@@ -1969,7 +1985,7 @@
|
|
|
1969
1985
|
delete templateUnprepared.preparedContent;
|
|
1970
1986
|
return templateUnprepared;
|
|
1971
1987
|
});
|
|
1972
|
-
return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), {
|
|
1988
|
+
return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
|
|
1973
1989
|
}
|
|
1974
1990
|
/**
|
|
1975
1991
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
@@ -2184,6 +2200,9 @@
|
|
|
2184
2200
|
UnexpectedError: UnexpectedError,
|
|
2185
2201
|
// TODO: [🪑]> VersionMismatchError,
|
|
2186
2202
|
};
|
|
2203
|
+
/**
|
|
2204
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2205
|
+
*/
|
|
2187
2206
|
|
|
2188
2207
|
/**
|
|
2189
2208
|
* Deserializes the error object
|
|
@@ -2245,8 +2264,8 @@
|
|
|
2245
2264
|
return false;
|
|
2246
2265
|
}
|
|
2247
2266
|
/*
|
|
2248
|
-
TODO: [🧠][🍫] `
|
|
2249
|
-
> if (!pipeline.
|
|
2267
|
+
TODO: [🧠][🍫] `tasks` can not be determined if they are fully prepared SO ignoring them
|
|
2268
|
+
> if (!pipeline.tasks.every(({ preparedContent }) => preparedContent === undefined)) {
|
|
2250
2269
|
> return false;
|
|
2251
2270
|
> }
|
|
2252
2271
|
*/
|
|
@@ -2259,7 +2278,7 @@
|
|
|
2259
2278
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
2260
2279
|
* - [🏍] ? Is context in each template
|
|
2261
2280
|
* - [♨] Are examples prepared
|
|
2262
|
-
* - [♨] Are
|
|
2281
|
+
* - [♨] Are tasks prepared
|
|
2263
2282
|
*/
|
|
2264
2283
|
|
|
2265
2284
|
/**
|
|
@@ -2407,6 +2426,9 @@
|
|
|
2407
2426
|
pagesCount: { value: 0, isUncertain: true },
|
|
2408
2427
|
},
|
|
2409
2428
|
});
|
|
2429
|
+
/**
|
|
2430
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2431
|
+
*/
|
|
2410
2432
|
|
|
2411
2433
|
/**
|
|
2412
2434
|
* @@@
|
|
@@ -2806,8 +2828,8 @@
|
|
|
2806
2828
|
else if (errors.length > 1) {
|
|
2807
2829
|
throw new PipelineExecutionError(
|
|
2808
2830
|
// TODO: Tell which execution tools failed like
|
|
2809
|
-
// 1) OpenAI throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
2810
|
-
// 2) AnthropicClaude throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
2831
|
+
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
2832
|
+
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
2811
2833
|
// 3) ...
|
|
2812
2834
|
spaceTrim__default["default"](function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors
|
|
2813
2835
|
.map(function (error, i) { return "".concat(i + 1, ") **").concat(error.name || 'Error', ":** ").concat(error.message); })
|
|
@@ -3531,7 +3553,7 @@
|
|
|
3531
3553
|
*/
|
|
3532
3554
|
function clonePipeline(pipeline) {
|
|
3533
3555
|
// Note: Not using spread operator (...) because @@@
|
|
3534
|
-
var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, formfactorName = pipeline.formfactorName, parameters = pipeline.parameters,
|
|
3556
|
+
var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, formfactorName = pipeline.formfactorName, parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
|
|
3535
3557
|
return {
|
|
3536
3558
|
pipelineUrl: pipelineUrl,
|
|
3537
3559
|
sourceFile: sourceFile,
|
|
@@ -3540,7 +3562,7 @@
|
|
|
3540
3562
|
description: description,
|
|
3541
3563
|
formfactorName: formfactorName,
|
|
3542
3564
|
parameters: parameters,
|
|
3543
|
-
|
|
3565
|
+
tasks: tasks,
|
|
3544
3566
|
knowledgeSources: knowledgeSources,
|
|
3545
3567
|
knowledgePieces: knowledgePieces,
|
|
3546
3568
|
personas: personas,
|
|
@@ -3556,17 +3578,17 @@
|
|
|
3556
3578
|
*
|
|
3557
3579
|
* @public exported from `@promptbook/core`
|
|
3558
3580
|
*/
|
|
3559
|
-
function
|
|
3581
|
+
function prepareTasks(pipeline, tools, options) {
|
|
3560
3582
|
return __awaiter(this, void 0, void 0, function () {
|
|
3561
|
-
var _a, maxParallelCount,
|
|
3583
|
+
var _a, maxParallelCount, tasks, knowledgePiecesCount, tasksPrepared;
|
|
3562
3584
|
var _this = this;
|
|
3563
3585
|
return __generator(this, function (_b) {
|
|
3564
3586
|
switch (_b.label) {
|
|
3565
3587
|
case 0:
|
|
3566
3588
|
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
return [4 /*yield*/, forEachAsync(
|
|
3589
|
+
tasks = pipeline.tasks, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
3590
|
+
tasksPrepared = new Array(tasks.length);
|
|
3591
|
+
return [4 /*yield*/, forEachAsync(tasks, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (template, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
3570
3592
|
var dependentParameterNames, preparedContent, preparedTemplate;
|
|
3571
3593
|
return __generator(this, function (_a) {
|
|
3572
3594
|
dependentParameterNames = template.dependentParameterNames;
|
|
@@ -3579,13 +3601,13 @@
|
|
|
3579
3601
|
], false);
|
|
3580
3602
|
}
|
|
3581
3603
|
preparedTemplate = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
|
|
3582
|
-
|
|
3604
|
+
tasksPrepared[index] = preparedTemplate;
|
|
3583
3605
|
return [2 /*return*/];
|
|
3584
3606
|
});
|
|
3585
3607
|
}); })];
|
|
3586
3608
|
case 1:
|
|
3587
3609
|
_b.sent();
|
|
3588
|
-
return [2 /*return*/, {
|
|
3610
|
+
return [2 /*return*/, { tasksPrepared: tasksPrepared }];
|
|
3589
3611
|
}
|
|
3590
3612
|
});
|
|
3591
3613
|
});
|
|
@@ -3593,7 +3615,7 @@
|
|
|
3593
3615
|
/**
|
|
3594
3616
|
* TODO: [🧠] Add context to each template (if missing)
|
|
3595
3617
|
* TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
|
|
3596
|
-
* TODO: [♨][main] !!! Prepare index the examples and maybe
|
|
3618
|
+
* TODO: [♨][main] !!! Prepare index the examples and maybe tasks
|
|
3597
3619
|
* TODO: Write tests for `preparePipeline`
|
|
3598
3620
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
3599
3621
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
@@ -3610,12 +3632,12 @@
|
|
|
3610
3632
|
*/
|
|
3611
3633
|
function preparePipeline(pipeline, tools, options) {
|
|
3612
3634
|
return __awaiter(this, void 0, void 0, function () {
|
|
3613
|
-
var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters,
|
|
3635
|
+
var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters, tasks,
|
|
3614
3636
|
/*
|
|
3615
3637
|
<- TODO: [🧠][🪑] `promptbookVersion` */
|
|
3616
3638
|
knowledgeSources /*
|
|
3617
3639
|
<- TODO: [🧊] `knowledgePieces` */, personas /*
|
|
3618
|
-
<- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared,
|
|
3640
|
+
<- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, tasksPrepared /* TODO: parameters: parametersPrepared*/;
|
|
3619
3641
|
var _this = this;
|
|
3620
3642
|
return __generator(this, function (_c) {
|
|
3621
3643
|
switch (_c.label) {
|
|
@@ -3624,7 +3646,7 @@
|
|
|
3624
3646
|
return [2 /*return*/, pipeline];
|
|
3625
3647
|
}
|
|
3626
3648
|
rootDirname = options.rootDirname, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ? DEFAULT_IS_VERBOSE : _b;
|
|
3627
|
-
parameters = pipeline.parameters,
|
|
3649
|
+
parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
|
|
3628
3650
|
if (tools === undefined || tools.llm === undefined) {
|
|
3629
3651
|
throw new MissingToolsError('LLM tools are required for preparing the pipeline');
|
|
3630
3652
|
}
|
|
@@ -3667,9 +3689,9 @@
|
|
|
3667
3689
|
case 2:
|
|
3668
3690
|
partialknowledgePiecesPrepared = _c.sent();
|
|
3669
3691
|
knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
|
|
3670
|
-
return [4 /*yield*/,
|
|
3692
|
+
return [4 /*yield*/, prepareTasks({
|
|
3671
3693
|
parameters: parameters,
|
|
3672
|
-
|
|
3694
|
+
tasks: tasks,
|
|
3673
3695
|
knowledgePiecesCount: knowledgePiecesPrepared.length,
|
|
3674
3696
|
}, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), {
|
|
3675
3697
|
rootDirname: rootDirname,
|
|
@@ -3677,12 +3699,12 @@
|
|
|
3677
3699
|
isVerbose: isVerbose,
|
|
3678
3700
|
})];
|
|
3679
3701
|
case 3:
|
|
3680
|
-
|
|
3702
|
+
tasksPrepared = (_c.sent()).tasksPrepared;
|
|
3681
3703
|
// ----- /Templates preparation -----
|
|
3682
3704
|
// Note: Count total usage
|
|
3683
3705
|
currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
|
|
3684
|
-
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), {
|
|
3685
|
-
// <- TODO: [🪓] Here should be no need for spreading new array, just `
|
|
3706
|
+
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
|
|
3707
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
|
|
3686
3708
|
knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
|
|
3687
3709
|
}
|
|
3688
3710
|
});
|
|
@@ -3754,9 +3776,9 @@
|
|
|
3754
3776
|
* @throws {ParseError} if the script is invalid
|
|
3755
3777
|
* @public exported from `@promptbook/utils`
|
|
3756
3778
|
*/
|
|
3757
|
-
function
|
|
3779
|
+
function extractParameterNamesFromTask(template) {
|
|
3758
3780
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
|
|
3759
|
-
var title = template.title, description = template.description,
|
|
3781
|
+
var title = template.title, description = template.description, taskType = template.taskType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
|
|
3760
3782
|
var parameterNames = new Set();
|
|
3761
3783
|
try {
|
|
3762
3784
|
for (var _e = __values(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(extractParameterNames(title)), false), __read(extractParameterNames(description || '')), false), __read(extractParameterNames(content)), false), __read(extractParameterNames(preparedContent || '')), false)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
@@ -3771,7 +3793,7 @@
|
|
|
3771
3793
|
}
|
|
3772
3794
|
finally { if (e_1) throw e_1.error; }
|
|
3773
3795
|
}
|
|
3774
|
-
if (
|
|
3796
|
+
if (taskType === 'SCRIPT_TASK') {
|
|
3775
3797
|
try {
|
|
3776
3798
|
for (var _g = __values(extractVariables(content)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
3777
3799
|
var parameterName = _h.value;
|
|
@@ -4202,6 +4224,9 @@
|
|
|
4202
4224
|
TextFormatDefinition,
|
|
4203
4225
|
CsvFormatDefinition,
|
|
4204
4226
|
];
|
|
4227
|
+
/**
|
|
4228
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4229
|
+
*/
|
|
4205
4230
|
|
|
4206
4231
|
/**
|
|
4207
4232
|
* Maps available parameters to expected parameters
|
|
@@ -4403,11 +4428,11 @@
|
|
|
4403
4428
|
for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
4404
4429
|
var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
|
|
4405
4430
|
if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
|
|
4406
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
|
|
4431
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
|
|
4407
4432
|
}
|
|
4408
4433
|
else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
|
|
4409
4434
|
// TODO: [🍵]
|
|
4410
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} is restricted to use"));
|
|
4435
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
|
|
4411
4436
|
}
|
|
4412
4437
|
}
|
|
4413
4438
|
}
|
|
@@ -4418,7 +4443,7 @@
|
|
|
4418
4443
|
}
|
|
4419
4444
|
finally { if (e_1) throw e_1.error; }
|
|
4420
4445
|
}
|
|
4421
|
-
var
|
|
4446
|
+
var replacedTemplates = template;
|
|
4422
4447
|
var match;
|
|
4423
4448
|
var loopLimit = LOOP_LIMIT;
|
|
4424
4449
|
var _loop_1 = function () {
|
|
@@ -4434,11 +4459,11 @@
|
|
|
4434
4459
|
throw new PipelineExecutionError('Parameter is already opened or not closed');
|
|
4435
4460
|
}
|
|
4436
4461
|
if (parameters[parameterName] === undefined) {
|
|
4437
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
4462
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
4438
4463
|
}
|
|
4439
4464
|
var parameterValue = parameters[parameterName];
|
|
4440
4465
|
if (parameterValue === undefined) {
|
|
4441
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
4466
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
4442
4467
|
}
|
|
4443
4468
|
parameterValue = parameterValue.toString();
|
|
4444
4469
|
if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
|
|
@@ -4447,24 +4472,24 @@
|
|
|
4447
4472
|
.map(function (line, index) { return (index === 0 ? line : "".concat(precol).concat(line)); })
|
|
4448
4473
|
.join('\n');
|
|
4449
4474
|
}
|
|
4450
|
-
|
|
4451
|
-
|
|
4475
|
+
replacedTemplates =
|
|
4476
|
+
replacedTemplates.substring(0, match.index + precol.length) +
|
|
4452
4477
|
parameterValue +
|
|
4453
|
-
|
|
4478
|
+
replacedTemplates.substring(match.index + precol.length + parameterName.length + 2);
|
|
4454
4479
|
};
|
|
4455
4480
|
while ((match = /^(?<precol>.*){(?<parameterName>\w+)}(.*)/m /* <- Not global */
|
|
4456
|
-
.exec(
|
|
4481
|
+
.exec(replacedTemplates))) {
|
|
4457
4482
|
_loop_1();
|
|
4458
4483
|
}
|
|
4459
4484
|
// [💫] Check if there are parameters that are not closed properly
|
|
4460
|
-
if (/{\w+$/.test(
|
|
4485
|
+
if (/{\w+$/.test(replacedTemplates)) {
|
|
4461
4486
|
throw new PipelineExecutionError('Parameter is not closed');
|
|
4462
4487
|
}
|
|
4463
4488
|
// [💫] Check if there are parameters that are not opened properly
|
|
4464
|
-
if (/^\w+}/.test(
|
|
4489
|
+
if (/^\w+}/.test(replacedTemplates)) {
|
|
4465
4490
|
throw new PipelineExecutionError('Parameter is not opened');
|
|
4466
4491
|
}
|
|
4467
|
-
return
|
|
4492
|
+
return replacedTemplates;
|
|
4468
4493
|
}
|
|
4469
4494
|
|
|
4470
4495
|
/**
|
|
@@ -4494,6 +4519,10 @@
|
|
|
4494
4519
|
* @public exported from `@promptbook/utils`
|
|
4495
4520
|
*/
|
|
4496
4521
|
var LINES_PER_STANDARD_PAGE = 44;
|
|
4522
|
+
/**
|
|
4523
|
+
* TODO: [🧠] Should be this `constants.ts` or `config.ts`?
|
|
4524
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4525
|
+
*/
|
|
4497
4526
|
|
|
4498
4527
|
/**
|
|
4499
4528
|
* Counts number of lines in the text
|
|
@@ -4572,6 +4601,7 @@
|
|
|
4572
4601
|
};
|
|
4573
4602
|
/**
|
|
4574
4603
|
* TODO: [🧠][🤠] This should be probbably as part of `TextFormatDefinition`
|
|
4604
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4575
4605
|
*/
|
|
4576
4606
|
|
|
4577
4607
|
/**
|
|
@@ -4620,12 +4650,12 @@
|
|
|
4620
4650
|
*/
|
|
4621
4651
|
function executeAttempts(options) {
|
|
4622
4652
|
return __awaiter(this, void 0, void 0, function () {
|
|
4623
|
-
var jokerParameterNames, priority, maxAttempts, preparedContent, parameters,
|
|
4653
|
+
var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTaskResult, _llms, llmTools, _loop_1, attempt, state_1;
|
|
4624
4654
|
return __generator(this, function (_a) {
|
|
4625
4655
|
switch (_a.label) {
|
|
4626
4656
|
case 0:
|
|
4627
|
-
jokerParameterNames = options.jokerParameterNames, priority = options.priority, maxAttempts = options.maxAttempts, preparedContent = options.preparedContent, parameters = options.parameters,
|
|
4628
|
-
$
|
|
4657
|
+
jokerParameterNames = options.jokerParameterNames, priority = options.priority, maxAttempts = options.maxAttempts, preparedContent = options.preparedContent, parameters = options.parameters, task = options.task, preparedPipeline = options.preparedPipeline, tools = options.tools, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, maxExecutionAttempts = options.maxExecutionAttempts;
|
|
4658
|
+
$ongoingTaskResult = {
|
|
4629
4659
|
$result: null,
|
|
4630
4660
|
$resultString: null,
|
|
4631
4661
|
$expectError: null,
|
|
@@ -4645,52 +4675,51 @@
|
|
|
4645
4675
|
if (isJokerAttempt && !jokerParameterName) {
|
|
4646
4676
|
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Joker not found in attempt ".concat(attempt, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
4647
4677
|
}
|
|
4648
|
-
$
|
|
4649
|
-
$
|
|
4650
|
-
$
|
|
4678
|
+
$ongoingTaskResult.$result = null;
|
|
4679
|
+
$ongoingTaskResult.$resultString = null;
|
|
4680
|
+
$ongoingTaskResult.$expectError = null;
|
|
4651
4681
|
if (isJokerAttempt) {
|
|
4652
4682
|
if (parameters[jokerParameterName] === undefined) {
|
|
4653
4683
|
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Joker parameter {".concat(jokerParameterName, "} not defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
4654
4684
|
// <- TODO: This is maybe `PipelineLogicError` which should be detected in `validatePipeline` and here just thrown as `UnexpectedError`
|
|
4655
4685
|
}
|
|
4656
4686
|
else {
|
|
4657
|
-
$
|
|
4687
|
+
$ongoingTaskResult.$resultString = parameters[jokerParameterName];
|
|
4658
4688
|
}
|
|
4659
4689
|
}
|
|
4660
4690
|
_t.label = 1;
|
|
4661
4691
|
case 1:
|
|
4662
4692
|
_t.trys.push([1, 43, 44, 45]);
|
|
4663
4693
|
if (!!isJokerAttempt) return [3 /*break*/, 25];
|
|
4664
|
-
_b =
|
|
4694
|
+
_b = task.taskType;
|
|
4665
4695
|
switch (_b) {
|
|
4666
|
-
case '
|
|
4667
|
-
case '
|
|
4668
|
-
case '
|
|
4669
|
-
case '
|
|
4696
|
+
case 'SIMPLE_TASK': return [3 /*break*/, 2];
|
|
4697
|
+
case 'PROMPT_TASK': return [3 /*break*/, 3];
|
|
4698
|
+
case 'SCRIPT_TASK': return [3 /*break*/, 11];
|
|
4699
|
+
case 'DIALOG_TASK': return [3 /*break*/, 22];
|
|
4670
4700
|
}
|
|
4671
4701
|
return [3 /*break*/, 24];
|
|
4672
4702
|
case 2:
|
|
4673
|
-
$
|
|
4703
|
+
$ongoingTaskResult.$resultString = replaceParameters(preparedContent, parameters);
|
|
4674
4704
|
return [3 /*break*/, 25];
|
|
4675
4705
|
case 3:
|
|
4676
|
-
modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (
|
|
4677
|
-
$
|
|
4678
|
-
title:
|
|
4706
|
+
modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (task.modelRequirements || {}));
|
|
4707
|
+
$ongoingTaskResult.$prompt = {
|
|
4708
|
+
title: task.title,
|
|
4679
4709
|
pipelineUrl: "".concat(preparedPipeline.pipelineUrl
|
|
4680
4710
|
? preparedPipeline.pipelineUrl
|
|
4681
|
-
: 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(
|
|
4682
|
-
// <- TODO: Here should be maybe also subformat index to distinguish between same
|
|
4711
|
+
: 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(task.name
|
|
4712
|
+
// <- TODO: Here should be maybe also subformat index to distinguish between same task with different subformat values
|
|
4683
4713
|
),
|
|
4684
4714
|
parameters: parameters,
|
|
4685
4715
|
content: preparedContent,
|
|
4686
4716
|
modelRequirements: modelRequirements,
|
|
4687
4717
|
expectations: __assign(__assign({}, (preparedPipeline.personas.find(function (_a) {
|
|
4688
4718
|
var name = _a.name;
|
|
4689
|
-
return name ===
|
|
4690
|
-
}) ||
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
postprocessingFunctionNames: template.postprocessingFunctionNames,
|
|
4719
|
+
return name === task.personaName;
|
|
4720
|
+
}) || {})), task.expectations),
|
|
4721
|
+
format: task.format,
|
|
4722
|
+
postprocessingFunctionNames: task.postprocessingFunctionNames,
|
|
4694
4723
|
}; // <- TODO: Not very good type guard
|
|
4695
4724
|
_c = modelRequirements.modelVariant;
|
|
4696
4725
|
switch (_c) {
|
|
@@ -4700,36 +4729,35 @@
|
|
|
4700
4729
|
}
|
|
4701
4730
|
return [3 /*break*/, 9];
|
|
4702
4731
|
case 4:
|
|
4703
|
-
_d = $
|
|
4732
|
+
_d = $ongoingTaskResult;
|
|
4704
4733
|
return [4 /*yield*/, llmTools.callChatModel(
|
|
4705
4734
|
// <- TODO: [🧁] Check that `callChatModel` is defined
|
|
4706
|
-
$deepFreeze($
|
|
4735
|
+
$deepFreeze($ongoingTaskResult.$prompt))];
|
|
4707
4736
|
case 5:
|
|
4708
4737
|
_d.$chatResult = _t.sent();
|
|
4709
4738
|
// TODO: [🍬] Destroy chatThread
|
|
4710
|
-
$
|
|
4711
|
-
$
|
|
4739
|
+
$ongoingTaskResult.$result = $ongoingTaskResult.$chatResult;
|
|
4740
|
+
$ongoingTaskResult.$resultString = $ongoingTaskResult.$chatResult.content;
|
|
4712
4741
|
return [3 /*break*/, 10];
|
|
4713
4742
|
case 6:
|
|
4714
|
-
_e = $
|
|
4743
|
+
_e = $ongoingTaskResult;
|
|
4715
4744
|
return [4 /*yield*/, llmTools.callCompletionModel(
|
|
4716
4745
|
// <- TODO: [🧁] Check that `callCompletionModel` is defined
|
|
4717
|
-
$deepFreeze($
|
|
4746
|
+
$deepFreeze($ongoingTaskResult.$prompt))];
|
|
4718
4747
|
case 7:
|
|
4719
4748
|
_e.$completionResult = _t.sent();
|
|
4720
|
-
$
|
|
4721
|
-
$
|
|
4722
|
-
$ongoingTemplateResult.$completionResult.content;
|
|
4749
|
+
$ongoingTaskResult.$result = $ongoingTaskResult.$completionResult;
|
|
4750
|
+
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
4723
4751
|
return [3 /*break*/, 10];
|
|
4724
4752
|
case 8: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Embedding model can not be used in pipeline\n\n This should be catched during parsing\n\n ".concat(block(pipelineIdentification), "\n\n "); }));
|
|
4725
|
-
case 9: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown model variant \"".concat(
|
|
4753
|
+
case 9: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown model variant \"".concat(task.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
4726
4754
|
case 10: return [3 /*break*/, 25];
|
|
4727
4755
|
case 11:
|
|
4728
4756
|
if (arrayableToArray(tools.script).length === 0) {
|
|
4729
4757
|
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n No script execution tools are available\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
4730
4758
|
}
|
|
4731
|
-
if (!
|
|
4732
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT
|
|
4759
|
+
if (!task.contentLanguage) {
|
|
4760
|
+
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT TASK \"".concat(task.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
4733
4761
|
}
|
|
4734
4762
|
_t.label = 12;
|
|
4735
4763
|
case 12:
|
|
@@ -4742,9 +4770,9 @@
|
|
|
4742
4770
|
_t.label = 14;
|
|
4743
4771
|
case 14:
|
|
4744
4772
|
_t.trys.push([14, 16, , 17]);
|
|
4745
|
-
_h = $
|
|
4773
|
+
_h = $ongoingTaskResult;
|
|
4746
4774
|
return [4 /*yield*/, scriptTools.execute($deepFreeze({
|
|
4747
|
-
scriptLanguage:
|
|
4775
|
+
scriptLanguage: task.contentLanguage,
|
|
4748
4776
|
script: preparedContent,
|
|
4749
4777
|
parameters: parameters,
|
|
4750
4778
|
}))];
|
|
@@ -4759,7 +4787,7 @@
|
|
|
4759
4787
|
if (error_1 instanceof UnexpectedError) {
|
|
4760
4788
|
throw error_1;
|
|
4761
4789
|
}
|
|
4762
|
-
$
|
|
4790
|
+
$ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_1);
|
|
4763
4791
|
return [3 /*break*/, 17];
|
|
4764
4792
|
case 17:
|
|
4765
4793
|
_g = _f.next();
|
|
@@ -4776,14 +4804,14 @@
|
|
|
4776
4804
|
finally { if (e_1) throw e_1.error; }
|
|
4777
4805
|
return [7 /*endfinally*/];
|
|
4778
4806
|
case 21:
|
|
4779
|
-
if ($
|
|
4807
|
+
if ($ongoingTaskResult.$resultString !== null) {
|
|
4780
4808
|
return [3 /*break*/, 25];
|
|
4781
4809
|
}
|
|
4782
|
-
if ($
|
|
4783
|
-
throw $
|
|
4810
|
+
if ($ongoingTaskResult.$scriptPipelineExecutionErrors.length === 1) {
|
|
4811
|
+
throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
4784
4812
|
}
|
|
4785
4813
|
else {
|
|
4786
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Script execution failed ".concat($
|
|
4814
|
+
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Script execution failed ".concat($ongoingTaskResult.$scriptPipelineExecutionErrors.length, "x\n\n ").concat(block(pipelineIdentification), "\n\n ").concat(block($ongoingTaskResult.$scriptPipelineExecutionErrors
|
|
4787
4815
|
.map(function (error) { return '- ' + error.message; })
|
|
4788
4816
|
.join('\n\n')), "\n "); }));
|
|
4789
4817
|
}
|
|
@@ -4791,27 +4819,27 @@
|
|
|
4791
4819
|
if (tools.userInterface === undefined) {
|
|
4792
4820
|
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n User interface tools are not available\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
4793
4821
|
}
|
|
4794
|
-
// TODO: [🌹] When making next attempt for `DIALOG
|
|
4795
|
-
_j = $
|
|
4822
|
+
// TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
|
|
4823
|
+
_j = $ongoingTaskResult;
|
|
4796
4824
|
return [4 /*yield*/, tools.userInterface.promptDialog($deepFreeze({
|
|
4797
|
-
promptTitle:
|
|
4798
|
-
promptMessage: replaceParameters(
|
|
4825
|
+
promptTitle: task.title,
|
|
4826
|
+
promptMessage: replaceParameters(task.description || '', parameters),
|
|
4799
4827
|
defaultValue: replaceParameters(preparedContent, parameters),
|
|
4800
4828
|
// TODO: [🧠] !! Figure out how to define placeholder in .book.md file
|
|
4801
4829
|
placeholder: undefined,
|
|
4802
4830
|
priority: priority,
|
|
4803
4831
|
}))];
|
|
4804
4832
|
case 23:
|
|
4805
|
-
// TODO: [🌹] When making next attempt for `DIALOG
|
|
4833
|
+
// TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
|
|
4806
4834
|
_j.$resultString = _t.sent();
|
|
4807
4835
|
return [3 /*break*/, 25];
|
|
4808
|
-
case 24: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown execution type \"".concat(
|
|
4836
|
+
case 24: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown execution type \"".concat(task.taskType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
4809
4837
|
case 25:
|
|
4810
|
-
if (!(!isJokerAttempt &&
|
|
4838
|
+
if (!(!isJokerAttempt && task.postprocessingFunctionNames)) return [3 /*break*/, 42];
|
|
4811
4839
|
_t.label = 26;
|
|
4812
4840
|
case 26:
|
|
4813
4841
|
_t.trys.push([26, 40, 41, 42]);
|
|
4814
|
-
_k = (e_3 = void 0, __values(
|
|
4842
|
+
_k = (e_3 = void 0, __values(task.postprocessingFunctionNames)), _l = _k.next();
|
|
4815
4843
|
_t.label = 27;
|
|
4816
4844
|
case 27:
|
|
4817
4845
|
if (!!_l.done) return [3 /*break*/, 39];
|
|
@@ -4828,13 +4856,13 @@
|
|
|
4828
4856
|
_t.label = 30;
|
|
4829
4857
|
case 30:
|
|
4830
4858
|
_t.trys.push([30, 32, , 33]);
|
|
4831
|
-
_p = $
|
|
4859
|
+
_p = $ongoingTaskResult;
|
|
4832
4860
|
return [4 /*yield*/, scriptTools.execute({
|
|
4833
4861
|
scriptLanguage: "javascript" /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
|
|
4834
4862
|
script: "".concat(functionName, "(resultString)"),
|
|
4835
4863
|
parameters: {
|
|
4836
|
-
resultString: $
|
|
4837
|
-
// Note: No ...
|
|
4864
|
+
resultString: $ongoingTaskResult.$resultString || '',
|
|
4865
|
+
// Note: No ...parametersForTask, because working with result only
|
|
4838
4866
|
},
|
|
4839
4867
|
})];
|
|
4840
4868
|
case 31:
|
|
@@ -4850,7 +4878,7 @@
|
|
|
4850
4878
|
throw error_2;
|
|
4851
4879
|
}
|
|
4852
4880
|
postprocessingError = error_2;
|
|
4853
|
-
$
|
|
4881
|
+
$ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_2);
|
|
4854
4882
|
return [3 /*break*/, 33];
|
|
4855
4883
|
case 33:
|
|
4856
4884
|
_o = _m.next();
|
|
@@ -4887,12 +4915,12 @@
|
|
|
4887
4915
|
return [7 /*endfinally*/];
|
|
4888
4916
|
case 42:
|
|
4889
4917
|
// TODO: [💝] Unite object for expecting amount and format
|
|
4890
|
-
if (
|
|
4891
|
-
if (
|
|
4892
|
-
if (!isValidJsonString($
|
|
4918
|
+
if (task.format) {
|
|
4919
|
+
if (task.format === 'JSON') {
|
|
4920
|
+
if (!isValidJsonString($ongoingTaskResult.$resultString || '')) {
|
|
4893
4921
|
// TODO: [🏢] Do more universally via `FormatDefinition`
|
|
4894
4922
|
try {
|
|
4895
|
-
$
|
|
4923
|
+
$ongoingTaskResult.$resultString = extractJsonBlock($ongoingTaskResult.$resultString || '');
|
|
4896
4924
|
}
|
|
4897
4925
|
catch (error) {
|
|
4898
4926
|
throw new ExpectError(spaceTrim.spaceTrim(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(
|
|
@@ -4901,12 +4929,12 @@
|
|
|
4901
4929
|
}
|
|
4902
4930
|
}
|
|
4903
4931
|
else {
|
|
4904
|
-
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Unknown format \"".concat(
|
|
4932
|
+
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Unknown format \"".concat(task.format, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
4905
4933
|
}
|
|
4906
4934
|
}
|
|
4907
4935
|
// TODO: [💝] Unite object for expecting amount and format
|
|
4908
|
-
if (
|
|
4909
|
-
checkExpectations(
|
|
4936
|
+
if (task.expectations) {
|
|
4937
|
+
checkExpectations(task.expectations, $ongoingTaskResult.$resultString || '');
|
|
4910
4938
|
}
|
|
4911
4939
|
return [2 /*return*/, "break-attempts"];
|
|
4912
4940
|
case 43:
|
|
@@ -4914,38 +4942,38 @@
|
|
|
4914
4942
|
if (!(error_3 instanceof ExpectError)) {
|
|
4915
4943
|
throw error_3;
|
|
4916
4944
|
}
|
|
4917
|
-
$
|
|
4945
|
+
$ongoingTaskResult.$expectError = error_3;
|
|
4918
4946
|
return [3 /*break*/, 45];
|
|
4919
4947
|
case 44:
|
|
4920
4948
|
if (!isJokerAttempt &&
|
|
4921
|
-
|
|
4922
|
-
$
|
|
4949
|
+
task.taskType === 'PROMPT_TASK' &&
|
|
4950
|
+
$ongoingTaskResult.$prompt
|
|
4923
4951
|
// <- Note: [2] When some expected parameter is not defined, error will occur in replaceParameters
|
|
4924
4952
|
// In that case we don’t want to make a report about it because it’s not a llm execution error
|
|
4925
4953
|
) {
|
|
4926
|
-
// TODO: [🧠] Maybe put other
|
|
4954
|
+
// TODO: [🧠] Maybe put other taskTypes into report
|
|
4927
4955
|
$executionReport.promptExecutions.push({
|
|
4928
|
-
prompt: __assign({}, $
|
|
4929
|
-
result: $
|
|
4930
|
-
error: $
|
|
4956
|
+
prompt: __assign({}, $ongoingTaskResult.$prompt),
|
|
4957
|
+
result: $ongoingTaskResult.$result || undefined,
|
|
4958
|
+
error: $ongoingTaskResult.$expectError === null
|
|
4931
4959
|
? undefined
|
|
4932
|
-
: serializeError($
|
|
4960
|
+
: serializeError($ongoingTaskResult.$expectError),
|
|
4933
4961
|
});
|
|
4934
4962
|
}
|
|
4935
4963
|
return [7 /*endfinally*/];
|
|
4936
4964
|
case 45:
|
|
4937
|
-
if ($
|
|
4965
|
+
if ($ongoingTaskResult.$expectError !== null && attempt === maxAttempts - 1) {
|
|
4938
4966
|
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) {
|
|
4939
4967
|
var _a, _b, _c;
|
|
4940
|
-
return "\n LLM execution failed ".concat(maxExecutionAttempts, "x\n\n ").concat(block(pipelineIdentification), "\n\n ---\n The Prompt:\n ").concat(block((((_a = $
|
|
4968
|
+
return "\n LLM execution failed ".concat(maxExecutionAttempts, "x\n\n ").concat(block(pipelineIdentification), "\n\n ---\n The Prompt:\n ").concat(block((((_a = $ongoingTaskResult.$prompt) === null || _a === void 0 ? void 0 : _a.content) || '')
|
|
4941
4969
|
.split('\n')
|
|
4942
4970
|
.map(function (line) { return "> ".concat(line); })
|
|
4943
|
-
.join('\n')), "\n\n Last error ").concat(((_b = $
|
|
4971
|
+
.join('\n')), "\n\n Last error ").concat(((_b = $ongoingTaskResult.$expectError) === null || _b === void 0 ? void 0 : _b.name) || '', ":\n ").concat(block((((_c = $ongoingTaskResult.$expectError) === null || _c === void 0 ? void 0 : _c.message) || '')
|
|
4944
4972
|
.split('\n')
|
|
4945
4973
|
.map(function (line) { return "> ".concat(line); })
|
|
4946
|
-
.join('\n')), "\n\n Last result:\n ").concat(block($
|
|
4974
|
+
.join('\n')), "\n\n Last result:\n ").concat(block($ongoingTaskResult.$resultString === null
|
|
4947
4975
|
? 'null'
|
|
4948
|
-
: $
|
|
4976
|
+
: $ongoingTaskResult.$resultString
|
|
4949
4977
|
.split('\n')
|
|
4950
4978
|
.map(function (line) { return "> ".concat(line); })
|
|
4951
4979
|
.join('\n')), "\n ---\n ");
|
|
@@ -4970,10 +4998,10 @@
|
|
|
4970
4998
|
attempt++;
|
|
4971
4999
|
return [3 /*break*/, 1];
|
|
4972
5000
|
case 4:
|
|
4973
|
-
if ($
|
|
5001
|
+
if ($ongoingTaskResult.$resultString === null) {
|
|
4974
5002
|
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Something went wrong and prompt result is null\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
4975
5003
|
}
|
|
4976
|
-
return [2 /*return*/, $
|
|
5004
|
+
return [2 /*return*/, $ongoingTaskResult.$resultString];
|
|
4977
5005
|
}
|
|
4978
5006
|
});
|
|
4979
5007
|
});
|
|
@@ -4989,36 +5017,36 @@
|
|
|
4989
5017
|
*/
|
|
4990
5018
|
function executeFormatSubvalues(options) {
|
|
4991
5019
|
return __awaiter(this, void 0, void 0, function () {
|
|
4992
|
-
var
|
|
5020
|
+
var task, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
|
|
4993
5021
|
var _this = this;
|
|
4994
5022
|
return __generator(this, function (_a) {
|
|
4995
5023
|
switch (_a.label) {
|
|
4996
5024
|
case 0:
|
|
4997
|
-
|
|
4998
|
-
if (
|
|
5025
|
+
task = options.task, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
|
|
5026
|
+
if (task.foreach === undefined) {
|
|
4999
5027
|
return [2 /*return*/, /* not await */ executeAttempts(options)];
|
|
5000
5028
|
}
|
|
5001
5029
|
if (jokerParameterNames.length !== 0) {
|
|
5002
5030
|
throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n JOKER parameters are not supported together with FOREACH command\n\n [\uD83E\uDDDE\u200D\u2640\uFE0F] This should be prevented in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
5003
5031
|
}
|
|
5004
|
-
parameterValue = parameters[
|
|
5032
|
+
parameterValue = parameters[task.foreach.parameterName] || '';
|
|
5005
5033
|
formatDefinition = FORMAT_DEFINITIONS.find(function (formatDefinition) {
|
|
5006
|
-
return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(
|
|
5034
|
+
return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(task.foreach.formatName);
|
|
5007
5035
|
});
|
|
5008
5036
|
if (formatDefinition === undefined) {
|
|
5009
5037
|
throw new UnexpectedError(
|
|
5010
5038
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
5011
|
-
spaceTrim__default["default"](function (block) { return "\n Unsupported format \"".concat(
|
|
5039
|
+
spaceTrim__default["default"](function (block) { return "\n Unsupported format \"".concat(task.foreach.formatName, "\"\n\n Available formats:\n ").concat(block(FORMAT_DEFINITIONS.map(function (formatDefinition) { return formatDefinition.formatName; })
|
|
5012
5040
|
.map(function (formatName) { return "- ".concat(formatName); })
|
|
5013
5041
|
.join('\n')), "\n\n [\u26F7] This should never happen because format name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
5014
5042
|
}
|
|
5015
5043
|
subvalueDefinition = formatDefinition.subvalueDefinitions.find(function (subvalueDefinition) {
|
|
5016
|
-
return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(
|
|
5044
|
+
return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(task.foreach.subformatName);
|
|
5017
5045
|
});
|
|
5018
5046
|
if (subvalueDefinition === undefined) {
|
|
5019
5047
|
throw new UnexpectedError(
|
|
5020
5048
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
5021
|
-
spaceTrim__default["default"](function (block) { return "\n Unsupported subformat name \"".concat(
|
|
5049
|
+
spaceTrim__default["default"](function (block) { return "\n Unsupported subformat name \"".concat(task.foreach.subformatName, "\" for format \"").concat(task.foreach.formatName, "\"\n\n Available subformat names for format \"").concat(formatDefinition.formatName, "\":\n ").concat(block(formatDefinition.subvalueDefinitions
|
|
5022
5050
|
.map(function (subvalueDefinition) { return subvalueDefinition.subvalueName; })
|
|
5023
5051
|
.map(function (subvalueName) { return "- ".concat(subvalueName); })
|
|
5024
5052
|
.join('\n')), "\n\n [\u26F7] This should never happen because subformat name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
@@ -5027,7 +5055,7 @@
|
|
|
5027
5055
|
formatSettings = csvSettings;
|
|
5028
5056
|
// <- TODO: [🤹♂️] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
|
|
5029
5057
|
}
|
|
5030
|
-
return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue,
|
|
5058
|
+
return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, task.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
5031
5059
|
var mappedParameters, allSubparameters, subresultString;
|
|
5032
5060
|
return __generator(this, function (_a) {
|
|
5033
5061
|
switch (_a.label) {
|
|
@@ -5036,7 +5064,7 @@
|
|
|
5036
5064
|
// TODO: When done [🐚] Report progress also for each subvalue here
|
|
5037
5065
|
try {
|
|
5038
5066
|
mappedParameters = mapAvailableToExpectedParameters({
|
|
5039
|
-
expectedParameters: Object.fromEntries(
|
|
5067
|
+
expectedParameters: Object.fromEntries(task.foreach.inputSubparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
|
|
5040
5068
|
availableParameters: subparameters,
|
|
5041
5069
|
});
|
|
5042
5070
|
}
|
|
@@ -5069,7 +5097,7 @@
|
|
|
5069
5097
|
*
|
|
5070
5098
|
* @private internal utility of `createPipelineExecutor`
|
|
5071
5099
|
*/
|
|
5072
|
-
function
|
|
5100
|
+
function getContextForTask(task) {
|
|
5073
5101
|
return __awaiter(this, void 0, void 0, function () {
|
|
5074
5102
|
return __generator(this, function (_a) {
|
|
5075
5103
|
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
|
|
@@ -5082,15 +5110,10 @@
|
|
|
5082
5110
|
*
|
|
5083
5111
|
* @private internal utility of `createPipelineExecutor`
|
|
5084
5112
|
*/
|
|
5085
|
-
function
|
|
5113
|
+
function getExamplesForTask(task) {
|
|
5086
5114
|
return __awaiter(this, void 0, void 0, function () {
|
|
5087
|
-
var preparedPipeline;
|
|
5088
5115
|
return __generator(this, function (_a) {
|
|
5089
|
-
|
|
5090
|
-
return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
|
|
5091
|
-
var content = _a.content;
|
|
5092
|
-
return "- ".concat(content);
|
|
5093
|
-
}).join('\n')];
|
|
5116
|
+
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
|
|
5094
5117
|
});
|
|
5095
5118
|
});
|
|
5096
5119
|
}
|
|
@@ -5100,10 +5123,15 @@
|
|
|
5100
5123
|
*
|
|
5101
5124
|
* @private internal utility of `createPipelineExecutor`
|
|
5102
5125
|
*/
|
|
5103
|
-
function
|
|
5126
|
+
function getKnowledgeForTask(options) {
|
|
5104
5127
|
return __awaiter(this, void 0, void 0, function () {
|
|
5128
|
+
var preparedPipeline;
|
|
5105
5129
|
return __generator(this, function (_a) {
|
|
5106
|
-
|
|
5130
|
+
preparedPipeline = options.preparedPipeline, options.task;
|
|
5131
|
+
return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
|
|
5132
|
+
var content = _a.content;
|
|
5133
|
+
return "- ".concat(content);
|
|
5134
|
+
}).join('\n')];
|
|
5107
5135
|
});
|
|
5108
5136
|
});
|
|
5109
5137
|
}
|
|
@@ -5113,21 +5141,21 @@
|
|
|
5113
5141
|
*
|
|
5114
5142
|
* @private internal utility of `createPipelineExecutor`
|
|
5115
5143
|
*/
|
|
5116
|
-
function
|
|
5144
|
+
function getReservedParametersForTask(options) {
|
|
5117
5145
|
return __awaiter(this, void 0, void 0, function () {
|
|
5118
|
-
var preparedPipeline,
|
|
5146
|
+
var preparedPipeline, task, pipelineIdentification, context, knowledge, examples, currentDate, modelName, reservedParameters, _loop_1, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
|
|
5119
5147
|
var e_1, _a;
|
|
5120
5148
|
return __generator(this, function (_b) {
|
|
5121
5149
|
switch (_b.label) {
|
|
5122
5150
|
case 0:
|
|
5123
|
-
preparedPipeline = options.preparedPipeline,
|
|
5124
|
-
return [4 /*yield*/,
|
|
5151
|
+
preparedPipeline = options.preparedPipeline, task = options.task, pipelineIdentification = options.pipelineIdentification;
|
|
5152
|
+
return [4 /*yield*/, getContextForTask()];
|
|
5125
5153
|
case 1:
|
|
5126
5154
|
context = _b.sent();
|
|
5127
|
-
return [4 /*yield*/,
|
|
5155
|
+
return [4 /*yield*/, getKnowledgeForTask({ preparedPipeline: preparedPipeline, task: task })];
|
|
5128
5156
|
case 2:
|
|
5129
5157
|
knowledge = _b.sent();
|
|
5130
|
-
return [4 /*yield*/,
|
|
5158
|
+
return [4 /*yield*/, getExamplesForTask()];
|
|
5131
5159
|
case 3:
|
|
5132
5160
|
examples = _b.sent();
|
|
5133
5161
|
currentDate = new Date().toISOString();
|
|
@@ -5170,31 +5198,31 @@
|
|
|
5170
5198
|
*
|
|
5171
5199
|
* @private internal utility of `createPipelineExecutor`
|
|
5172
5200
|
*/
|
|
5173
|
-
function
|
|
5201
|
+
function executeTask(options) {
|
|
5174
5202
|
return __awaiter(this, void 0, void 0, function () {
|
|
5175
|
-
var
|
|
5203
|
+
var currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, _a, maxExecutionAttempts, name, title, priority, usedParameterNames, dependentParameterNames, definedParameters, _b, _c, _d, definedParameterNames, parameters, _loop_1, _e, _f, parameterName, maxAttempts, jokerParameterNames, preparedContent, resultString;
|
|
5176
5204
|
var e_1, _g, _h;
|
|
5177
5205
|
return __generator(this, function (_j) {
|
|
5178
5206
|
switch (_j.label) {
|
|
5179
5207
|
case 0:
|
|
5180
|
-
|
|
5181
|
-
name = "pipeline-executor-frame-".concat(
|
|
5182
|
-
title =
|
|
5183
|
-
priority = preparedPipeline.
|
|
5208
|
+
currentTask = options.currentTask, preparedPipeline = options.preparedPipeline, parametersToPass = options.parametersToPass, tools = options.tools, onProgress = options.onProgress, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, _a = options.maxExecutionAttempts, maxExecutionAttempts = _a === void 0 ? DEFAULT_MAX_EXECUTION_ATTEMPTS : _a;
|
|
5209
|
+
name = "pipeline-executor-frame-".concat(currentTask.name);
|
|
5210
|
+
title = currentTask.title;
|
|
5211
|
+
priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
5184
5212
|
return [4 /*yield*/, onProgress({
|
|
5185
5213
|
name: name,
|
|
5186
5214
|
title: title,
|
|
5187
5215
|
isStarted: false,
|
|
5188
5216
|
isDone: false,
|
|
5189
|
-
|
|
5190
|
-
parameterName:
|
|
5217
|
+
taskType: currentTask.taskType,
|
|
5218
|
+
parameterName: currentTask.resultingParameterName,
|
|
5191
5219
|
parameterValue: null,
|
|
5192
5220
|
// <- [🍸]
|
|
5193
5221
|
})];
|
|
5194
5222
|
case 1:
|
|
5195
5223
|
_j.sent();
|
|
5196
|
-
usedParameterNames =
|
|
5197
|
-
dependentParameterNames = new Set(
|
|
5224
|
+
usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
5225
|
+
dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
5198
5226
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
5199
5227
|
if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
|
|
5200
5228
|
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Dependent parameters are not consistent with used parameters:\n\n Dependent parameters:\n ".concat(Array.from(dependentParameterNames)
|
|
@@ -5205,9 +5233,9 @@
|
|
|
5205
5233
|
}
|
|
5206
5234
|
_c = (_b = Object).freeze;
|
|
5207
5235
|
_d = [{}];
|
|
5208
|
-
return [4 /*yield*/,
|
|
5236
|
+
return [4 /*yield*/, getReservedParametersForTask({
|
|
5209
5237
|
preparedPipeline: preparedPipeline,
|
|
5210
|
-
|
|
5238
|
+
task: currentTask,
|
|
5211
5239
|
pipelineIdentification: pipelineIdentification,
|
|
5212
5240
|
})];
|
|
5213
5241
|
case 2:
|
|
@@ -5225,11 +5253,11 @@
|
|
|
5225
5253
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
5226
5254
|
// Houston, we have a problem
|
|
5227
5255
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
5228
|
-
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameterName, "} is NOT defined\n BUT used in
|
|
5256
|
+
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameterName, "}` is NOT defined\n BUT used in task \"").concat(currentTask.title || currentTask.name, "\"\n\n This should be catched in `validatePipeline`\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
5229
5257
|
}
|
|
5230
5258
|
};
|
|
5231
5259
|
try {
|
|
5232
|
-
// Note: [2] Check that all used parameters are defined and removing unused parameters for this
|
|
5260
|
+
// Note: [2] Check that all used parameters are defined and removing unused parameters for this task
|
|
5233
5261
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
5234
5262
|
for (_e = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
5235
5263
|
parameterName = _f.value;
|
|
@@ -5245,18 +5273,16 @@
|
|
|
5245
5273
|
}
|
|
5246
5274
|
// Note: [👨👨👧] Now we can freeze `parameters` because we are sure that all and only used parameters are defined and are not going to be changed
|
|
5247
5275
|
Object.freeze(parameters);
|
|
5248
|
-
maxAttempts =
|
|
5249
|
-
jokerParameterNames =
|
|
5250
|
-
preparedContent = (
|
|
5251
|
-
.split('{content}')
|
|
5252
|
-
.join(currentTemplate.content);
|
|
5276
|
+
maxAttempts = currentTask.taskType === 'DIALOG_TASK' ? Infinity : maxExecutionAttempts;
|
|
5277
|
+
jokerParameterNames = currentTask.jokerParameterNames || [];
|
|
5278
|
+
preparedContent = (currentTask.preparedContent || '{content}').split('{content}').join(currentTask.content);
|
|
5253
5279
|
return [4 /*yield*/, executeFormatSubvalues({
|
|
5254
5280
|
jokerParameterNames: jokerParameterNames,
|
|
5255
5281
|
priority: priority,
|
|
5256
5282
|
maxAttempts: maxAttempts,
|
|
5257
5283
|
preparedContent: preparedContent,
|
|
5258
5284
|
parameters: parameters,
|
|
5259
|
-
|
|
5285
|
+
task: currentTask,
|
|
5260
5286
|
preparedPipeline: preparedPipeline,
|
|
5261
5287
|
tools: tools,
|
|
5262
5288
|
$executionReport: $executionReport,
|
|
@@ -5269,15 +5295,15 @@
|
|
|
5269
5295
|
title: title,
|
|
5270
5296
|
isStarted: true,
|
|
5271
5297
|
isDone: true,
|
|
5272
|
-
|
|
5273
|
-
parameterName:
|
|
5298
|
+
taskType: currentTask.taskType,
|
|
5299
|
+
parameterName: currentTask.resultingParameterName,
|
|
5274
5300
|
parameterValue: resultString,
|
|
5275
5301
|
// <- [🍸]
|
|
5276
5302
|
})];
|
|
5277
5303
|
case 4:
|
|
5278
5304
|
_j.sent();
|
|
5279
5305
|
return [2 /*return*/, Object.freeze((_h = {},
|
|
5280
|
-
_h[
|
|
5306
|
+
_h[currentTask.resultingParameterName] =
|
|
5281
5307
|
// <- Note: [👩👩👧] No need to detect parameter collision here because pipeline checks logic consistency during construction
|
|
5282
5308
|
resultString,
|
|
5283
5309
|
_h))];
|
|
@@ -5304,7 +5330,7 @@
|
|
|
5304
5330
|
var _loop_1 = function (parameter) {
|
|
5305
5331
|
if (parametersToPass[parameter.name] === undefined) {
|
|
5306
5332
|
// [4]
|
|
5307
|
-
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
|
|
5333
|
+
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
|
|
5308
5334
|
return "continue";
|
|
5309
5335
|
}
|
|
5310
5336
|
outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
|
|
@@ -5339,7 +5365,7 @@
|
|
|
5339
5365
|
*/
|
|
5340
5366
|
function executePipeline(options) {
|
|
5341
5367
|
return __awaiter(this, void 0, void 0, function () {
|
|
5342
|
-
var inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, _a, isVerbose, preparedPipeline, errors, warnings, executionReport, isReturned, _b, _c, parameter, e_1_1, _loop_1, _d, _e, parameterName, state_1, e_2_1, parametersToPass, resovedParameterNames_1,
|
|
5368
|
+
var inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, _a, isVerbose, preparedPipeline, errors, warnings, executionReport, isReturned, _b, _c, parameter, e_1_1, _loop_1, _d, _e, parameterName, state_1, e_2_1, parametersToPass, resovedParameterNames_1, unresovedTasks_1, resolving_1, loopLimit, _loop_2, error_1, usage_1, outputParameters_1, usage, outputParameters;
|
|
5343
5369
|
var e_1, _f, e_2, _g;
|
|
5344
5370
|
return __generator(this, function (_h) {
|
|
5345
5371
|
switch (_h.label) {
|
|
@@ -5391,7 +5417,7 @@
|
|
|
5391
5417
|
case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
5392
5418
|
isSuccessful: false,
|
|
5393
5419
|
errors: __spreadArray([
|
|
5394
|
-
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
|
|
5420
|
+
new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
|
|
5395
5421
|
], __read(errors), false).map(serializeError),
|
|
5396
5422
|
warnings: [],
|
|
5397
5423
|
executionReport: executionReport,
|
|
@@ -5439,7 +5465,7 @@
|
|
|
5439
5465
|
case 3: return [2 /*return*/, { value: $asDeeplyFrozenSerializableJson(spaceTrim.spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
|
|
5440
5466
|
isSuccessful: false,
|
|
5441
5467
|
errors: __spreadArray([
|
|
5442
|
-
new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
|
|
5468
|
+
new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
|
|
5443
5469
|
], __read(errors), false).map(serializeError),
|
|
5444
5470
|
warnings: warnings.map(serializeError),
|
|
5445
5471
|
executionReport: executionReport,
|
|
@@ -5493,11 +5519,11 @@
|
|
|
5493
5519
|
var name = _a.name;
|
|
5494
5520
|
return name;
|
|
5495
5521
|
});
|
|
5496
|
-
|
|
5522
|
+
unresovedTasks_1 = __spreadArray([], __read(preparedPipeline.tasks), false);
|
|
5497
5523
|
resolving_1 = [];
|
|
5498
5524
|
loopLimit = LOOP_LIMIT;
|
|
5499
5525
|
_loop_2 = function () {
|
|
5500
|
-
var
|
|
5526
|
+
var currentTask, work_1;
|
|
5501
5527
|
return __generator(this, function (_k) {
|
|
5502
5528
|
switch (_k.label) {
|
|
5503
5529
|
case 0:
|
|
@@ -5505,31 +5531,41 @@
|
|
|
5505
5531
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
5506
5532
|
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Loop limit reached during resolving parameters pipeline execution\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
5507
5533
|
}
|
|
5508
|
-
|
|
5509
|
-
return
|
|
5534
|
+
currentTask = unresovedTasks_1.find(function (task) {
|
|
5535
|
+
return task.dependentParameterNames.every(function (name) {
|
|
5510
5536
|
return __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), __read(RESERVED_PARAMETER_NAMES), false).includes(name);
|
|
5511
5537
|
});
|
|
5512
5538
|
});
|
|
5513
|
-
if (!(!
|
|
5539
|
+
if (!(!currentTask && resolving_1.length === 0)) return [3 /*break*/, 1];
|
|
5514
5540
|
throw new UnexpectedError(
|
|
5515
5541
|
// TODO: [🐎] DRY
|
|
5516
|
-
spaceTrim.spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve
|
|
5542
|
+
spaceTrim.spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTasks_1
|
|
5517
5543
|
.map(function (_a) {
|
|
5518
5544
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
5519
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
5520
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
5545
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
5546
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
5521
5547
|
.join(' and '));
|
|
5522
5548
|
})
|
|
5523
|
-
.join('\n')), "\n\n Resolved
|
|
5549
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameterNames_1
|
|
5550
|
+
.filter(function (name) {
|
|
5551
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
5552
|
+
})
|
|
5553
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
5554
|
+
.join('\n')), "\n\n **Reserved (which are available):**\n ").concat(block(resovedParameterNames_1
|
|
5555
|
+
.filter(function (name) {
|
|
5556
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
5557
|
+
})
|
|
5558
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
5559
|
+
.join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
|
|
5524
5560
|
case 1:
|
|
5525
|
-
if (!!
|
|
5561
|
+
if (!!currentTask) return [3 /*break*/, 3];
|
|
5526
5562
|
/* [🤹♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
|
|
5527
5563
|
case 2:
|
|
5528
5564
|
/* [🤹♂️] */ _k.sent();
|
|
5529
5565
|
return [3 /*break*/, 4];
|
|
5530
5566
|
case 3:
|
|
5531
|
-
|
|
5532
|
-
work_1 =
|
|
5567
|
+
unresovedTasks_1 = unresovedTasks_1.filter(function (task) { return task !== currentTask; });
|
|
5568
|
+
work_1 = executeTask(__assign(__assign({}, options), { currentTask: currentTask, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
|
|
5533
5569
|
if (isReturned) {
|
|
5534
5570
|
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Can not call `onProgress` after pipeline execution is finished\n\n ".concat(block(pipelineIdentification), "\n\n ").concat(block(JSON.stringify(progress, null, 4)
|
|
5535
5571
|
.split('\n')
|
|
@@ -5539,16 +5575,16 @@
|
|
|
5539
5575
|
if (onProgress) {
|
|
5540
5576
|
onProgress(progress);
|
|
5541
5577
|
}
|
|
5542
|
-
}, $executionReport: executionReport, pipelineIdentification: spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n
|
|
5578
|
+
}, $executionReport: executionReport, pipelineIdentification: spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Task name: ").concat(currentTask.name, "\n Task title: ").concat(currentTask.title, "\n "); }) }))
|
|
5543
5579
|
.then(function (newParametersToPass) {
|
|
5544
5580
|
parametersToPass = __assign(__assign({}, newParametersToPass), parametersToPass);
|
|
5545
|
-
resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [
|
|
5581
|
+
resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTask.resultingParameterName], false);
|
|
5546
5582
|
})
|
|
5547
5583
|
.then(function () {
|
|
5548
5584
|
resolving_1 = resolving_1.filter(function (w) { return w !== work_1; });
|
|
5549
5585
|
});
|
|
5550
5586
|
// <- Note: Errors are catched here [3]
|
|
5551
|
-
// TODO: BUT if in multiple
|
|
5587
|
+
// TODO: BUT if in multiple tasks are errors, only the first one is catched so maybe we should catch errors here and save them to errors array here
|
|
5552
5588
|
resolving_1.push(work_1);
|
|
5553
5589
|
_k.label = 4;
|
|
5554
5590
|
case 4: return [2 /*return*/];
|
|
@@ -5557,7 +5593,7 @@
|
|
|
5557
5593
|
};
|
|
5558
5594
|
_h.label = 21;
|
|
5559
5595
|
case 21:
|
|
5560
|
-
if (!(
|
|
5596
|
+
if (!(unresovedTasks_1.length > 0)) return [3 /*break*/, 23];
|
|
5561
5597
|
return [5 /*yield**/, _loop_2()];
|
|
5562
5598
|
case 22:
|
|
5563
5599
|
_h.sent();
|
|
@@ -5715,6 +5751,9 @@
|
|
|
5715
5751
|
* @public exported from `@promptbook/cli`
|
|
5716
5752
|
*/
|
|
5717
5753
|
$scrapersMetadataRegister.register(markdownScraperMetadata);
|
|
5754
|
+
/**
|
|
5755
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
5756
|
+
*/
|
|
5718
5757
|
|
|
5719
5758
|
/**
|
|
5720
5759
|
* Scraper for markdown files
|
|
@@ -5909,6 +5948,9 @@
|
|
|
5909
5948
|
* @public exported from `@promptbook/cli`
|
|
5910
5949
|
*/
|
|
5911
5950
|
$scrapersMetadataRegister.register(documentScraperMetadata);
|
|
5951
|
+
/**
|
|
5952
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
5953
|
+
*/
|
|
5912
5954
|
|
|
5913
5955
|
/**
|
|
5914
5956
|
* Scraper of .docx and .odt files
|
|
@@ -6073,6 +6115,9 @@
|
|
|
6073
6115
|
* @public exported from `@promptbook/cli`
|
|
6074
6116
|
*/
|
|
6075
6117
|
$scrapersMetadataRegister.register(legacyDocumentScraperMetadata);
|
|
6118
|
+
/**
|
|
6119
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
6120
|
+
*/
|
|
6076
6121
|
|
|
6077
6122
|
/**
|
|
6078
6123
|
* Scraper for old document files (like .doc and .rtf)
|
|
@@ -6242,6 +6287,7 @@
|
|
|
6242
6287
|
var _LegacyDocumentScraperRegistration = $scrapersRegister.register(createLegacyDocumentScraper);
|
|
6243
6288
|
/**
|
|
6244
6289
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
6290
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
6245
6291
|
*/
|
|
6246
6292
|
|
|
6247
6293
|
exports.BOOK_LANGUAGE_VERSION = BOOK_LANGUAGE_VERSION;
|