@promptbook/legacy-documents 0.75.0-1 → 0.75.0-4
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 +28 -17
- package/esm/index.es.js +272 -250
- package/esm/index.es.js.map +1 -1
- package/esm/typings/{promptbook-collection → books}/index.d.ts +6 -6
- package/esm/typings/src/_packages/core.index.d.ts +28 -20
- package/esm/typings/src/_packages/types.index.d.ts +62 -52
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- 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 +3 -3
- 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/{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 -19
- 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 +11 -3
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +3 -3
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -2
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +3 -3
- package/esm/typings/src/conversion/prettify/prettifyPipelineString.d.ts +1 -1
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +4 -4
- package/esm/typings/src/conversion/utils/extractParameterNamesFromTask.d.ts +15 -0
- package/esm/typings/src/conversion/utils/renameParameter.d.ts +3 -3
- 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/dialogs/simple-prompt/SimplePromptInterfaceTools.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/ScriptExecutionTools.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 +2 -2
- package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +7 -1
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +3 -0
- package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +45 -0
- package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +3 -3
- package/esm/typings/src/formfactors/index.d.ts +85 -12
- package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +13 -3
- package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +13 -3
- 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/PipelineInterface/PipelineInterface.d.ts +26 -0
- 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/{types/PipelineJson/TemplateJsonCommon.d.ts → pipeline/PipelineJson/CommonTaskJson.d.ts} +24 -24
- 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 +98 -0
- package/esm/typings/src/{types → pipeline}/PipelineJson/PersonaJson.d.ts +5 -5
- package/esm/typings/src/{types → pipeline}/PipelineJson/PipelineJson.d.ts +11 -11
- 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 → pipeline}/PipelineString.d.ts +1 -1
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +3 -3
- package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
- package/esm/typings/src/prepare/prepareTasks.d.ts +32 -0
- 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 +4 -4
- package/esm/typings/src/types/SectionType.d.ts +21 -0
- package/esm/typings/src/types/TaskProgress.d.ts +2 -2
- package/esm/typings/src/types/TaskType.d.ts +15 -0
- package/esm/typings/src/types/typeAliasEmoji.d.ts +3 -0
- package/esm/typings/src/types/typeAliases.d.ts +2 -1
- package/esm/typings/src/utils/emojis.d.ts +1 -0
- package/esm/typings/src/utils/expectation-counters/constants.d.ts +1 -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/organization/TODO_remove_as.d.ts +6 -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 +272 -250
- 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/conversion/utils/extractParameterNamesFromTemplate.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 -15
- package/esm/typings/src/pipeline/pipeline-interface/PipelineInterface.d.ts +0 -22
- package/esm/typings/src/pipeline/pipeline-interface/constants.d.ts +0 -9
- package/esm/typings/src/prepare/prepareTemplates.d.ts +0 -32
- 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/esm/index.es.js
CHANGED
|
@@ -23,9 +23,10 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
23
23
|
*
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.75.0-
|
|
26
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.0-3';
|
|
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
|
/*! *****************************************************************************
|
|
@@ -399,7 +400,7 @@ var DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [🤹♂️]
|
|
|
399
400
|
*
|
|
400
401
|
* @public exported from `@promptbook/core`
|
|
401
402
|
*/
|
|
402
|
-
var DEFAULT_SCRAPE_CACHE_DIRNAME = '
|
|
403
|
+
var DEFAULT_SCRAPE_CACHE_DIRNAME = './.promptbook/scrape-cache';
|
|
403
404
|
/**
|
|
404
405
|
* Nonce which is used for replacing things in strings
|
|
405
406
|
*
|
|
@@ -463,6 +464,7 @@ var IS_PIPELINE_LOGIC_VALIDATED = just(
|
|
|
463
464
|
true);
|
|
464
465
|
/**
|
|
465
466
|
* TODO: Extract `constants.ts` from `config.ts`
|
|
467
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
466
468
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
467
469
|
*/
|
|
468
470
|
|
|
@@ -1079,6 +1081,9 @@ function normalizeToKebabCase(text) {
|
|
|
1079
1081
|
normalizedName = normalizedName.replace(/-$/, '');
|
|
1080
1082
|
return normalizedName;
|
|
1081
1083
|
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
1086
|
+
*/
|
|
1082
1087
|
|
|
1083
1088
|
/**
|
|
1084
1089
|
* Removes emojis from a string and fix whitespaces
|
|
@@ -1226,7 +1231,7 @@ function getScraperIntermediateSource(source, options) {
|
|
|
1226
1231
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
1227
1232
|
*/
|
|
1228
1233
|
|
|
1229
|
-
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:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-persona.book.md"}];
|
|
1230
1235
|
|
|
1231
1236
|
/**
|
|
1232
1237
|
* Prettify the html code
|
|
@@ -1280,7 +1285,7 @@ function capitalize(word) {
|
|
|
1280
1285
|
*/
|
|
1281
1286
|
function pipelineJsonToString(pipelineJson) {
|
|
1282
1287
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
|
|
1283
|
-
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;
|
|
1284
1289
|
var pipelineString = "# ".concat(title);
|
|
1285
1290
|
if (description) {
|
|
1286
1291
|
pipelineString += '\n\n';
|
|
@@ -1301,7 +1306,7 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
1301
1306
|
return isInput;
|
|
1302
1307
|
})), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1303
1308
|
var parameter = _h.value;
|
|
1304
|
-
commands.push("INPUT PARAMETER ".concat(
|
|
1309
|
+
commands.push("INPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
|
|
1305
1310
|
}
|
|
1306
1311
|
}
|
|
1307
1312
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -1317,7 +1322,7 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
1317
1322
|
return isOutput;
|
|
1318
1323
|
})), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
1319
1324
|
var parameter = _k.value;
|
|
1320
|
-
commands.push("OUTPUT PARAMETER ".concat(
|
|
1325
|
+
commands.push("OUTPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
|
|
1321
1326
|
}
|
|
1322
1327
|
}
|
|
1323
1328
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -1330,13 +1335,13 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
1330
1335
|
pipelineString += '\n\n';
|
|
1331
1336
|
pipelineString += commands.map(function (command) { return "- ".concat(command); }).join('\n');
|
|
1332
1337
|
try {
|
|
1333
|
-
for (var
|
|
1334
|
-
var
|
|
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 task = tasks_1_1.value;
|
|
1335
1340
|
var
|
|
1336
1341
|
/* Note: Not using:> name, */
|
|
1337
|
-
title_1 =
|
|
1342
|
+
title_1 = task.title, description_1 = task.description,
|
|
1338
1343
|
/* Note: dependentParameterNames, */
|
|
1339
|
-
jokers =
|
|
1344
|
+
jokers = task.jokerParameterNames, taskType = task.taskType, content = task.content, postprocessing = task.postprocessingFunctionNames, expectations = task.expectations, format = task.format, resultingParameterName = task.resultingParameterName;
|
|
1340
1345
|
pipelineString += '\n\n';
|
|
1341
1346
|
pipelineString += "## ".concat(title_1);
|
|
1342
1347
|
if (description_1) {
|
|
@@ -1345,10 +1350,11 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
1345
1350
|
}
|
|
1346
1351
|
var commands_1 = [];
|
|
1347
1352
|
var contentLanguage = 'text';
|
|
1348
|
-
if (
|
|
1349
|
-
var modelRequirements =
|
|
1353
|
+
if (taskType === 'PROMPT_TASK') {
|
|
1354
|
+
var modelRequirements = task.modelRequirements;
|
|
1350
1355
|
var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
|
|
1351
|
-
|
|
1356
|
+
// Note: Do nothing, it is default
|
|
1357
|
+
// commands.push(`PROMPT`);
|
|
1352
1358
|
if (modelVariant) {
|
|
1353
1359
|
commands_1.push("MODEL VARIANT ".concat(capitalize(modelVariant)));
|
|
1354
1360
|
}
|
|
@@ -1356,21 +1362,21 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
1356
1362
|
commands_1.push("MODEL NAME `".concat(modelName, "`"));
|
|
1357
1363
|
}
|
|
1358
1364
|
}
|
|
1359
|
-
else if (
|
|
1365
|
+
else if (taskType === 'SIMPLE_TASK') {
|
|
1360
1366
|
commands_1.push("SIMPLE TEMPLATE");
|
|
1361
1367
|
// Note: Nothing special here
|
|
1362
1368
|
}
|
|
1363
|
-
else if (
|
|
1364
|
-
commands_1.push("SCRIPT
|
|
1365
|
-
if (
|
|
1366
|
-
contentLanguage =
|
|
1369
|
+
else if (taskType === 'SCRIPT_TASK') {
|
|
1370
|
+
commands_1.push("SCRIPT");
|
|
1371
|
+
if (task.contentLanguage) {
|
|
1372
|
+
contentLanguage = task.contentLanguage;
|
|
1367
1373
|
}
|
|
1368
1374
|
else {
|
|
1369
1375
|
contentLanguage = '';
|
|
1370
1376
|
}
|
|
1371
1377
|
}
|
|
1372
|
-
else if (
|
|
1373
|
-
commands_1.push("DIALOG
|
|
1378
|
+
else if (taskType === 'DIALOG_TASK') {
|
|
1379
|
+
commands_1.push("DIALOG");
|
|
1374
1380
|
// Note: Nothing special here
|
|
1375
1381
|
} // <- }else if([🅱]
|
|
1376
1382
|
if (jokers) {
|
|
@@ -1445,13 +1451,13 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
1445
1451
|
pipelineString += '\n';
|
|
1446
1452
|
pipelineString += '```';
|
|
1447
1453
|
pipelineString += '\n\n';
|
|
1448
|
-
pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use
|
|
1454
|
+
pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use taskParameterJsonToString
|
|
1449
1455
|
}
|
|
1450
1456
|
}
|
|
1451
1457
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1452
1458
|
finally {
|
|
1453
1459
|
try {
|
|
1454
|
-
if (
|
|
1460
|
+
if (tasks_1_1 && !tasks_1_1.done && (_c = tasks_1.return)) _c.call(tasks_1);
|
|
1455
1461
|
}
|
|
1456
1462
|
finally { if (e_3) throw e_3.error; }
|
|
1457
1463
|
}
|
|
@@ -1460,8 +1466,8 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
1460
1466
|
/**
|
|
1461
1467
|
* @private internal utility of `pipelineJsonToString`
|
|
1462
1468
|
*/
|
|
1463
|
-
function
|
|
1464
|
-
var name =
|
|
1469
|
+
function taskParameterJsonToString(taskParameterJson) {
|
|
1470
|
+
var name = taskParameterJson.name, description = taskParameterJson.description;
|
|
1465
1471
|
var parameterString = "{".concat(name, "}");
|
|
1466
1472
|
if (description) {
|
|
1467
1473
|
parameterString = "".concat(parameterString, " ").concat(description);
|
|
@@ -1469,7 +1475,7 @@ function templateParameterJsonToString(templateParameterJson) {
|
|
|
1469
1475
|
return parameterString;
|
|
1470
1476
|
}
|
|
1471
1477
|
/**
|
|
1472
|
-
* TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `
|
|
1478
|
+
* TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `taskParameterJsonToString` , use `stringifyCommand`
|
|
1473
1479
|
* TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
1474
1480
|
* TODO: [🏛] Maybe make some markdown builder
|
|
1475
1481
|
* TODO: [🏛] Escape all
|
|
@@ -1699,9 +1705,9 @@ function validatePipelineCore(pipeline) {
|
|
|
1699
1705
|
throw new ParseError(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 "); }));
|
|
1700
1706
|
}
|
|
1701
1707
|
// TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
|
|
1702
|
-
if (!Array.isArray(pipeline.
|
|
1708
|
+
if (!Array.isArray(pipeline.tasks)) {
|
|
1703
1709
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
1704
|
-
throw new ParseError(spaceTrim(function (block) { return "\n Pipeline is valid JSON but with wrong structure\n\n `PipelineJson.
|
|
1710
|
+
throw new ParseError(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 "); }));
|
|
1705
1711
|
}
|
|
1706
1712
|
var _loop_1 = function (parameter) {
|
|
1707
1713
|
if (parameter.isInput && parameter.isOutput) {
|
|
@@ -1710,13 +1716,12 @@ function validatePipelineCore(pipeline) {
|
|
|
1710
1716
|
// Note: Testing that parameter is either intermediate or output BUT not created and unused
|
|
1711
1717
|
if (!parameter.isInput &&
|
|
1712
1718
|
!parameter.isOutput &&
|
|
1713
|
-
!pipeline.
|
|
1719
|
+
!pipeline.tasks.some(function (task) { return task.dependentParameterNames.includes(parameter.name); })) {
|
|
1714
1720
|
throw new PipelineLogicError(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 "); }));
|
|
1715
1721
|
}
|
|
1716
|
-
// Note: Testing that parameter is either input or result of some
|
|
1717
|
-
if (!parameter.isInput &&
|
|
1718
|
-
|
|
1719
|
-
throw new PipelineLogicError(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 "); }));
|
|
1722
|
+
// Note: Testing that parameter is either input or result of some task
|
|
1723
|
+
if (!parameter.isInput && !pipeline.tasks.some(function (task) { return task.resultingParameterName === parameter.name; })) {
|
|
1724
|
+
throw new PipelineLogicError(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 "); }));
|
|
1720
1725
|
}
|
|
1721
1726
|
};
|
|
1722
1727
|
try {
|
|
@@ -1733,7 +1738,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1733
1738
|
}
|
|
1734
1739
|
finally { if (e_1) throw e_1.error; }
|
|
1735
1740
|
}
|
|
1736
|
-
// Note: All input parameters are defined - so that they can be used as result of some
|
|
1741
|
+
// Note: All input parameters are defined - so that they can be used as result of some task
|
|
1737
1742
|
var definedParameters = new Set(pipeline.parameters.filter(function (_a) {
|
|
1738
1743
|
var isInput = _a.isInput;
|
|
1739
1744
|
return isInput;
|
|
@@ -1741,27 +1746,27 @@ function validatePipelineCore(pipeline) {
|
|
|
1741
1746
|
var name = _a.name;
|
|
1742
1747
|
return name;
|
|
1743
1748
|
}));
|
|
1744
|
-
var _loop_2 = function (
|
|
1749
|
+
var _loop_2 = function (task) {
|
|
1745
1750
|
var e_4, _h, e_5, _j;
|
|
1746
|
-
if (definedParameters.has(
|
|
1747
|
-
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter `{".concat(
|
|
1751
|
+
if (definedParameters.has(task.resultingParameterName)) {
|
|
1752
|
+
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter `{".concat(task.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1748
1753
|
}
|
|
1749
|
-
if (RESERVED_PARAMETER_NAMES.includes(
|
|
1750
|
-
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter name {".concat(
|
|
1754
|
+
if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
|
|
1755
|
+
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter name {".concat(task.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1751
1756
|
}
|
|
1752
|
-
definedParameters.add(
|
|
1753
|
-
if (
|
|
1754
|
-
if (!
|
|
1755
|
-
!
|
|
1756
|
-
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Joker parameters are used for {".concat(
|
|
1757
|
+
definedParameters.add(task.resultingParameterName);
|
|
1758
|
+
if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
|
|
1759
|
+
if (!task.format &&
|
|
1760
|
+
!task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
1761
|
+
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Joker parameters are used for {".concat(task.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1757
1762
|
}
|
|
1758
1763
|
var _loop_4 = function (joker) {
|
|
1759
|
-
if (!
|
|
1760
|
-
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter `{".concat(joker, "}` is used for {").concat(
|
|
1764
|
+
if (!task.dependentParameterNames.includes(joker)) {
|
|
1765
|
+
throw new PipelineLogicError(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 "); }));
|
|
1761
1766
|
}
|
|
1762
1767
|
};
|
|
1763
1768
|
try {
|
|
1764
|
-
for (var _k = (e_4 = void 0, __values(
|
|
1769
|
+
for (var _k = (e_4 = void 0, __values(task.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
1765
1770
|
var joker = _l.value;
|
|
1766
1771
|
_loop_4(joker);
|
|
1767
1772
|
}
|
|
@@ -1774,7 +1779,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1774
1779
|
finally { if (e_4) throw e_4.error; }
|
|
1775
1780
|
}
|
|
1776
1781
|
}
|
|
1777
|
-
if (
|
|
1782
|
+
if (task.expectations) {
|
|
1778
1783
|
var _loop_5 = function (unit, min, max) {
|
|
1779
1784
|
if (min !== undefined && max !== undefined && min > max) {
|
|
1780
1785
|
throw new PipelineLogicError(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 "); }));
|
|
@@ -1787,7 +1792,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1787
1792
|
}
|
|
1788
1793
|
};
|
|
1789
1794
|
try {
|
|
1790
|
-
for (var _m = (e_5 = void 0, __values(Object.entries(
|
|
1795
|
+
for (var _m = (e_5 = void 0, __values(Object.entries(task.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
1791
1796
|
var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
|
|
1792
1797
|
_loop_5(unit, min, max);
|
|
1793
1798
|
}
|
|
@@ -1802,10 +1807,10 @@ function validatePipelineCore(pipeline) {
|
|
|
1802
1807
|
}
|
|
1803
1808
|
};
|
|
1804
1809
|
try {
|
|
1805
|
-
// Note: Checking each
|
|
1806
|
-
for (var _f = __values(pipeline.
|
|
1807
|
-
var
|
|
1808
|
-
_loop_2(
|
|
1810
|
+
// Note: Checking each task individually
|
|
1811
|
+
for (var _f = __values(pipeline.tasks), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1812
|
+
var task = _g.value;
|
|
1813
|
+
_loop_2(task);
|
|
1809
1814
|
}
|
|
1810
1815
|
}
|
|
1811
1816
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -1839,20 +1844,20 @@ function validatePipelineCore(pipeline) {
|
|
|
1839
1844
|
}
|
|
1840
1845
|
finally { if (e_3) throw e_3.error; }
|
|
1841
1846
|
}
|
|
1842
|
-
var
|
|
1847
|
+
var unresovedTasks = __spreadArray([], __read(pipeline.tasks), false);
|
|
1843
1848
|
var loopLimit = LOOP_LIMIT;
|
|
1844
1849
|
var _loop_3 = function () {
|
|
1845
1850
|
if (loopLimit-- < 0) {
|
|
1846
1851
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
1847
1852
|
throw new UnexpectedError(spaceTrim(function (block) { return "\n Loop limit reached during detection of circular dependencies in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
1848
1853
|
}
|
|
1849
|
-
var
|
|
1850
|
-
return
|
|
1854
|
+
var currentlyResovedTasks = unresovedTasks.filter(function (task) {
|
|
1855
|
+
return task.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
|
|
1851
1856
|
});
|
|
1852
|
-
if (
|
|
1857
|
+
if (currentlyResovedTasks.length === 0) {
|
|
1853
1858
|
throw new PipelineLogicError(
|
|
1854
1859
|
// TODO: [🐎] DRY
|
|
1855
|
-
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(
|
|
1860
|
+
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(unresovedTasks
|
|
1856
1861
|
.map(function (_a) {
|
|
1857
1862
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
1858
1863
|
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
@@ -1871,13 +1876,13 @@ function validatePipelineCore(pipeline) {
|
|
|
1871
1876
|
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1872
1877
|
.join('\n')), "\n\n\n "); }));
|
|
1873
1878
|
}
|
|
1874
|
-
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(
|
|
1879
|
+
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTasks.map(function (_a) {
|
|
1875
1880
|
var resultingParameterName = _a.resultingParameterName;
|
|
1876
1881
|
return resultingParameterName;
|
|
1877
1882
|
})), false);
|
|
1878
|
-
|
|
1883
|
+
unresovedTasks = unresovedTasks.filter(function (task) { return !currentlyResovedTasks.includes(task); });
|
|
1879
1884
|
};
|
|
1880
|
-
while (
|
|
1885
|
+
while (unresovedTasks.length > 0) {
|
|
1881
1886
|
_loop_3();
|
|
1882
1887
|
}
|
|
1883
1888
|
// TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
|
|
@@ -1937,9 +1942,9 @@ var PipelineUrlError = /** @class */ (function (_super) {
|
|
|
1937
1942
|
}(Error));
|
|
1938
1943
|
|
|
1939
1944
|
/**
|
|
1940
|
-
* Parses the
|
|
1945
|
+
* Parses the task and returns the list of all parameter names
|
|
1941
1946
|
*
|
|
1942
|
-
* @param template the template with parameters in {curly} braces
|
|
1947
|
+
* @param template the string template with parameters in {curly} braces
|
|
1943
1948
|
* @returns the list of parameter names
|
|
1944
1949
|
* @public exported from `@promptbook/utils`
|
|
1945
1950
|
*/
|
|
@@ -1970,18 +1975,18 @@ function extractParameterNames(template) {
|
|
|
1970
1975
|
* @public exported from `@promptbook/core`
|
|
1971
1976
|
*/
|
|
1972
1977
|
function unpreparePipeline(pipeline) {
|
|
1973
|
-
var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources,
|
|
1978
|
+
var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, tasks = pipeline.tasks;
|
|
1974
1979
|
personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
|
|
1975
1980
|
knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
|
|
1976
|
-
|
|
1977
|
-
var dependentParameterNames =
|
|
1978
|
-
var parameterNames = extractParameterNames(
|
|
1981
|
+
tasks = tasks.map(function (task) {
|
|
1982
|
+
var dependentParameterNames = task.dependentParameterNames;
|
|
1983
|
+
var parameterNames = extractParameterNames(task.preparedContent || '');
|
|
1979
1984
|
dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
|
|
1980
|
-
var
|
|
1981
|
-
delete
|
|
1982
|
-
return
|
|
1985
|
+
var taskUnprepared = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames });
|
|
1986
|
+
delete taskUnprepared.preparedContent;
|
|
1987
|
+
return taskUnprepared;
|
|
1983
1988
|
});
|
|
1984
|
-
return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), {
|
|
1989
|
+
return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
|
|
1985
1990
|
}
|
|
1986
1991
|
/**
|
|
1987
1992
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
@@ -2196,6 +2201,9 @@ var ERRORS = {
|
|
|
2196
2201
|
UnexpectedError: UnexpectedError,
|
|
2197
2202
|
// TODO: [🪑]> VersionMismatchError,
|
|
2198
2203
|
};
|
|
2204
|
+
/**
|
|
2205
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2206
|
+
*/
|
|
2199
2207
|
|
|
2200
2208
|
/**
|
|
2201
2209
|
* Deserializes the error object
|
|
@@ -2257,8 +2265,8 @@ function isPipelinePrepared(pipeline) {
|
|
|
2257
2265
|
return false;
|
|
2258
2266
|
}
|
|
2259
2267
|
/*
|
|
2260
|
-
TODO: [🧠][🍫] `
|
|
2261
|
-
> if (!pipeline.
|
|
2268
|
+
TODO: [🧠][🍫] `tasks` can not be determined if they are fully prepared SO ignoring them
|
|
2269
|
+
> if (!pipeline.tasks.every(({ preparedContent }) => preparedContent === undefined)) {
|
|
2262
2270
|
> return false;
|
|
2263
2271
|
> }
|
|
2264
2272
|
*/
|
|
@@ -2269,9 +2277,9 @@ function isPipelinePrepared(pipeline) {
|
|
|
2269
2277
|
* TODO: [🐠] Maybe base this on `makeValidator`
|
|
2270
2278
|
* TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
|
|
2271
2279
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
2272
|
-
* - [🏍] ? Is context in each
|
|
2280
|
+
* - [🏍] ? Is context in each task
|
|
2273
2281
|
* - [♨] Are examples prepared
|
|
2274
|
-
* - [♨] Are
|
|
2282
|
+
* - [♨] Are tasks prepared
|
|
2275
2283
|
*/
|
|
2276
2284
|
|
|
2277
2285
|
/**
|
|
@@ -2419,6 +2427,9 @@ $deepFreeze({
|
|
|
2419
2427
|
pagesCount: { value: 0, isUncertain: true },
|
|
2420
2428
|
},
|
|
2421
2429
|
});
|
|
2430
|
+
/**
|
|
2431
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2432
|
+
*/
|
|
2422
2433
|
|
|
2423
2434
|
/**
|
|
2424
2435
|
* @@@
|
|
@@ -3543,7 +3554,7 @@ TODO: [🧊] This is how it can look in future
|
|
|
3543
3554
|
*/
|
|
3544
3555
|
function clonePipeline(pipeline) {
|
|
3545
3556
|
// Note: Not using spread operator (...) because @@@
|
|
3546
|
-
var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, formfactorName = pipeline.formfactorName, parameters = pipeline.parameters,
|
|
3557
|
+
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;
|
|
3547
3558
|
return {
|
|
3548
3559
|
pipelineUrl: pipelineUrl,
|
|
3549
3560
|
sourceFile: sourceFile,
|
|
@@ -3552,7 +3563,7 @@ function clonePipeline(pipeline) {
|
|
|
3552
3563
|
description: description,
|
|
3553
3564
|
formfactorName: formfactorName,
|
|
3554
3565
|
parameters: parameters,
|
|
3555
|
-
|
|
3566
|
+
tasks: tasks,
|
|
3556
3567
|
knowledgeSources: knowledgeSources,
|
|
3557
3568
|
knowledgePieces: knowledgePieces,
|
|
3558
3569
|
personas: personas,
|
|
@@ -3568,20 +3579,20 @@ function clonePipeline(pipeline) {
|
|
|
3568
3579
|
*
|
|
3569
3580
|
* @public exported from `@promptbook/core`
|
|
3570
3581
|
*/
|
|
3571
|
-
function
|
|
3582
|
+
function prepareTasks(pipeline, tools, options) {
|
|
3572
3583
|
return __awaiter(this, void 0, void 0, function () {
|
|
3573
|
-
var _a, maxParallelCount,
|
|
3584
|
+
var _a, maxParallelCount, tasks, knowledgePiecesCount, tasksPrepared;
|
|
3574
3585
|
var _this = this;
|
|
3575
3586
|
return __generator(this, function (_b) {
|
|
3576
3587
|
switch (_b.label) {
|
|
3577
3588
|
case 0:
|
|
3578
3589
|
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
return [4 /*yield*/, forEachAsync(
|
|
3582
|
-
var dependentParameterNames, preparedContent,
|
|
3590
|
+
tasks = pipeline.tasks, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
3591
|
+
tasksPrepared = new Array(tasks.length);
|
|
3592
|
+
return [4 /*yield*/, forEachAsync(tasks, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (task, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
3593
|
+
var dependentParameterNames, preparedContent, preparedTask;
|
|
3583
3594
|
return __generator(this, function (_a) {
|
|
3584
|
-
dependentParameterNames =
|
|
3595
|
+
dependentParameterNames = task.dependentParameterNames;
|
|
3585
3596
|
preparedContent = undefined;
|
|
3586
3597
|
if (knowledgePiecesCount > 0 && !dependentParameterNames.includes('knowledge')) {
|
|
3587
3598
|
preparedContent = spaceTrim("\n {content}\n\n ## Knowledge\n\n {knowledge}\n ");
|
|
@@ -3590,22 +3601,22 @@ function prepareTemplates(pipeline, tools, options) {
|
|
|
3590
3601
|
'knowledge',
|
|
3591
3602
|
], false);
|
|
3592
3603
|
}
|
|
3593
|
-
|
|
3594
|
-
|
|
3604
|
+
preparedTask = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
|
|
3605
|
+
tasksPrepared[index] = preparedTask;
|
|
3595
3606
|
return [2 /*return*/];
|
|
3596
3607
|
});
|
|
3597
3608
|
}); })];
|
|
3598
3609
|
case 1:
|
|
3599
3610
|
_b.sent();
|
|
3600
|
-
return [2 /*return*/, {
|
|
3611
|
+
return [2 /*return*/, { tasksPrepared: tasksPrepared }];
|
|
3601
3612
|
}
|
|
3602
3613
|
});
|
|
3603
3614
|
});
|
|
3604
3615
|
}
|
|
3605
3616
|
/**
|
|
3606
|
-
* TODO: [🧠] Add context to each
|
|
3607
|
-
* TODO: [🧠] What is better name `
|
|
3608
|
-
* TODO: [♨][main] !!! Prepare index the examples and maybe
|
|
3617
|
+
* TODO: [🧠] Add context to each task (if missing)
|
|
3618
|
+
* TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
|
|
3619
|
+
* TODO: [♨][main] !!! Prepare index the examples and maybe tasks
|
|
3609
3620
|
* TODO: Write tests for `preparePipeline`
|
|
3610
3621
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
3611
3622
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
@@ -3622,12 +3633,12 @@ function prepareTemplates(pipeline, tools, options) {
|
|
|
3622
3633
|
*/
|
|
3623
3634
|
function preparePipeline(pipeline, tools, options) {
|
|
3624
3635
|
return __awaiter(this, void 0, void 0, function () {
|
|
3625
|
-
var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters,
|
|
3636
|
+
var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters, tasks,
|
|
3626
3637
|
/*
|
|
3627
3638
|
<- TODO: [🧠][🪑] `promptbookVersion` */
|
|
3628
3639
|
knowledgeSources /*
|
|
3629
3640
|
<- TODO: [🧊] `knowledgePieces` */, personas /*
|
|
3630
|
-
<- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared,
|
|
3641
|
+
<- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, tasksPrepared /* TODO: parameters: parametersPrepared*/;
|
|
3631
3642
|
var _this = this;
|
|
3632
3643
|
return __generator(this, function (_c) {
|
|
3633
3644
|
switch (_c.label) {
|
|
@@ -3636,7 +3647,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
3636
3647
|
return [2 /*return*/, pipeline];
|
|
3637
3648
|
}
|
|
3638
3649
|
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;
|
|
3639
|
-
parameters = pipeline.parameters,
|
|
3650
|
+
parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
|
|
3640
3651
|
if (tools === undefined || tools.llm === undefined) {
|
|
3641
3652
|
throw new MissingToolsError('LLM tools are required for preparing the pipeline');
|
|
3642
3653
|
}
|
|
@@ -3679,9 +3690,9 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
3679
3690
|
case 2:
|
|
3680
3691
|
partialknowledgePiecesPrepared = _c.sent();
|
|
3681
3692
|
knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
|
|
3682
|
-
return [4 /*yield*/,
|
|
3693
|
+
return [4 /*yield*/, prepareTasks({
|
|
3683
3694
|
parameters: parameters,
|
|
3684
|
-
|
|
3695
|
+
tasks: tasks,
|
|
3685
3696
|
knowledgePiecesCount: knowledgePiecesPrepared.length,
|
|
3686
3697
|
}, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), {
|
|
3687
3698
|
rootDirname: rootDirname,
|
|
@@ -3689,12 +3700,12 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
3689
3700
|
isVerbose: isVerbose,
|
|
3690
3701
|
})];
|
|
3691
3702
|
case 3:
|
|
3692
|
-
|
|
3693
|
-
// ----- /
|
|
3703
|
+
tasksPrepared = (_c.sent()).tasksPrepared;
|
|
3704
|
+
// ----- /Tasks preparation -----
|
|
3694
3705
|
// Note: Count total usage
|
|
3695
3706
|
currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
|
|
3696
|
-
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), {
|
|
3697
|
-
// <- TODO: [🪓] Here should be no need for spreading new array, just `
|
|
3707
|
+
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
|
|
3708
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
|
|
3698
3709
|
knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
|
|
3699
3710
|
}
|
|
3700
3711
|
});
|
|
@@ -3759,16 +3770,16 @@ function extractVariables(script) {
|
|
|
3759
3770
|
*/
|
|
3760
3771
|
|
|
3761
3772
|
/**
|
|
3762
|
-
* Parses the
|
|
3773
|
+
* Parses the task and returns the set of all used parameters
|
|
3763
3774
|
*
|
|
3764
|
-
* @param
|
|
3775
|
+
* @param task the task with used parameters
|
|
3765
3776
|
* @returns the set of parameter names
|
|
3766
3777
|
* @throws {ParseError} if the script is invalid
|
|
3767
3778
|
* @public exported from `@promptbook/utils`
|
|
3768
3779
|
*/
|
|
3769
|
-
function
|
|
3780
|
+
function extractParameterNamesFromTask(task) {
|
|
3770
3781
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
|
|
3771
|
-
var title =
|
|
3782
|
+
var title = task.title, description = task.description, taskType = task.taskType, content = task.content, preparedContent = task.preparedContent, jokerParameterNames = task.jokerParameterNames, foreach = task.foreach;
|
|
3772
3783
|
var parameterNames = new Set();
|
|
3773
3784
|
try {
|
|
3774
3785
|
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()) {
|
|
@@ -3783,7 +3794,7 @@ function extractParameterNamesFromTemplate(template) {
|
|
|
3783
3794
|
}
|
|
3784
3795
|
finally { if (e_1) throw e_1.error; }
|
|
3785
3796
|
}
|
|
3786
|
-
if (
|
|
3797
|
+
if (taskType === 'SCRIPT_TASK') {
|
|
3787
3798
|
try {
|
|
3788
3799
|
for (var _g = __values(extractVariables(content)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
3789
3800
|
var parameterName = _h.value;
|
|
@@ -4214,6 +4225,9 @@ var FORMAT_DEFINITIONS = [
|
|
|
4214
4225
|
TextFormatDefinition,
|
|
4215
4226
|
CsvFormatDefinition,
|
|
4216
4227
|
];
|
|
4228
|
+
/**
|
|
4229
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4230
|
+
*/
|
|
4217
4231
|
|
|
4218
4232
|
/**
|
|
4219
4233
|
* Maps available parameters to expected parameters
|
|
@@ -4430,7 +4444,7 @@ function replaceParameters(template, parameters) {
|
|
|
4430
4444
|
}
|
|
4431
4445
|
finally { if (e_1) throw e_1.error; }
|
|
4432
4446
|
}
|
|
4433
|
-
var
|
|
4447
|
+
var replacedTemplates = template;
|
|
4434
4448
|
var match;
|
|
4435
4449
|
var loopLimit = LOOP_LIMIT;
|
|
4436
4450
|
var _loop_1 = function () {
|
|
@@ -4459,24 +4473,24 @@ function replaceParameters(template, parameters) {
|
|
|
4459
4473
|
.map(function (line, index) { return (index === 0 ? line : "".concat(precol).concat(line)); })
|
|
4460
4474
|
.join('\n');
|
|
4461
4475
|
}
|
|
4462
|
-
|
|
4463
|
-
|
|
4476
|
+
replacedTemplates =
|
|
4477
|
+
replacedTemplates.substring(0, match.index + precol.length) +
|
|
4464
4478
|
parameterValue +
|
|
4465
|
-
|
|
4479
|
+
replacedTemplates.substring(match.index + precol.length + parameterName.length + 2);
|
|
4466
4480
|
};
|
|
4467
4481
|
while ((match = /^(?<precol>.*){(?<parameterName>\w+)}(.*)/m /* <- Not global */
|
|
4468
|
-
.exec(
|
|
4482
|
+
.exec(replacedTemplates))) {
|
|
4469
4483
|
_loop_1();
|
|
4470
4484
|
}
|
|
4471
4485
|
// [💫] Check if there are parameters that are not closed properly
|
|
4472
|
-
if (/{\w+$/.test(
|
|
4486
|
+
if (/{\w+$/.test(replacedTemplates)) {
|
|
4473
4487
|
throw new PipelineExecutionError('Parameter is not closed');
|
|
4474
4488
|
}
|
|
4475
4489
|
// [💫] Check if there are parameters that are not opened properly
|
|
4476
|
-
if (/^\w+}/.test(
|
|
4490
|
+
if (/^\w+}/.test(replacedTemplates)) {
|
|
4477
4491
|
throw new PipelineExecutionError('Parameter is not opened');
|
|
4478
4492
|
}
|
|
4479
|
-
return
|
|
4493
|
+
return replacedTemplates;
|
|
4480
4494
|
}
|
|
4481
4495
|
|
|
4482
4496
|
/**
|
|
@@ -4508,6 +4522,7 @@ var CHARACTERS_PER_STANDARD_LINE = 63;
|
|
|
4508
4522
|
var LINES_PER_STANDARD_PAGE = 44;
|
|
4509
4523
|
/**
|
|
4510
4524
|
* TODO: [🧠] Should be this `constants.ts` or `config.ts`?
|
|
4525
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4511
4526
|
*/
|
|
4512
4527
|
|
|
4513
4528
|
/**
|
|
@@ -4587,6 +4602,7 @@ var CountUtils = {
|
|
|
4587
4602
|
};
|
|
4588
4603
|
/**
|
|
4589
4604
|
* TODO: [🧠][🤠] This should be probbably as part of `TextFormatDefinition`
|
|
4605
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4590
4606
|
*/
|
|
4591
4607
|
|
|
4592
4608
|
/**
|
|
@@ -4635,12 +4651,12 @@ function checkExpectations(expectations, value) {
|
|
|
4635
4651
|
*/
|
|
4636
4652
|
function executeAttempts(options) {
|
|
4637
4653
|
return __awaiter(this, void 0, void 0, function () {
|
|
4638
|
-
var jokerParameterNames, priority, maxAttempts, preparedContent, parameters,
|
|
4654
|
+
var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTaskResult, _llms, llmTools, _loop_1, attempt, state_1;
|
|
4639
4655
|
return __generator(this, function (_a) {
|
|
4640
4656
|
switch (_a.label) {
|
|
4641
4657
|
case 0:
|
|
4642
|
-
jokerParameterNames = options.jokerParameterNames, priority = options.priority, maxAttempts = options.maxAttempts, preparedContent = options.preparedContent, parameters = options.parameters,
|
|
4643
|
-
$
|
|
4658
|
+
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;
|
|
4659
|
+
$ongoingTaskResult = {
|
|
4644
4660
|
$result: null,
|
|
4645
4661
|
$resultString: null,
|
|
4646
4662
|
$expectError: null,
|
|
@@ -4660,52 +4676,51 @@ function executeAttempts(options) {
|
|
|
4660
4676
|
if (isJokerAttempt && !jokerParameterName) {
|
|
4661
4677
|
throw new UnexpectedError(spaceTrim(function (block) { return "\n Joker not found in attempt ".concat(attempt, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
4662
4678
|
}
|
|
4663
|
-
$
|
|
4664
|
-
$
|
|
4665
|
-
$
|
|
4679
|
+
$ongoingTaskResult.$result = null;
|
|
4680
|
+
$ongoingTaskResult.$resultString = null;
|
|
4681
|
+
$ongoingTaskResult.$expectError = null;
|
|
4666
4682
|
if (isJokerAttempt) {
|
|
4667
4683
|
if (parameters[jokerParameterName] === undefined) {
|
|
4668
4684
|
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Joker parameter {".concat(jokerParameterName, "} not defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
4669
4685
|
// <- TODO: This is maybe `PipelineLogicError` which should be detected in `validatePipeline` and here just thrown as `UnexpectedError`
|
|
4670
4686
|
}
|
|
4671
4687
|
else {
|
|
4672
|
-
$
|
|
4688
|
+
$ongoingTaskResult.$resultString = parameters[jokerParameterName];
|
|
4673
4689
|
}
|
|
4674
4690
|
}
|
|
4675
4691
|
_t.label = 1;
|
|
4676
4692
|
case 1:
|
|
4677
4693
|
_t.trys.push([1, 43, 44, 45]);
|
|
4678
4694
|
if (!!isJokerAttempt) return [3 /*break*/, 25];
|
|
4679
|
-
_b =
|
|
4695
|
+
_b = task.taskType;
|
|
4680
4696
|
switch (_b) {
|
|
4681
|
-
case '
|
|
4682
|
-
case '
|
|
4683
|
-
case '
|
|
4684
|
-
case '
|
|
4697
|
+
case 'SIMPLE_TASK': return [3 /*break*/, 2];
|
|
4698
|
+
case 'PROMPT_TASK': return [3 /*break*/, 3];
|
|
4699
|
+
case 'SCRIPT_TASK': return [3 /*break*/, 11];
|
|
4700
|
+
case 'DIALOG_TASK': return [3 /*break*/, 22];
|
|
4685
4701
|
}
|
|
4686
4702
|
return [3 /*break*/, 24];
|
|
4687
4703
|
case 2:
|
|
4688
|
-
$
|
|
4704
|
+
$ongoingTaskResult.$resultString = replaceParameters(preparedContent, parameters);
|
|
4689
4705
|
return [3 /*break*/, 25];
|
|
4690
4706
|
case 3:
|
|
4691
|
-
modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (
|
|
4692
|
-
$
|
|
4693
|
-
title:
|
|
4707
|
+
modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (task.modelRequirements || {}));
|
|
4708
|
+
$ongoingTaskResult.$prompt = {
|
|
4709
|
+
title: task.title,
|
|
4694
4710
|
pipelineUrl: "".concat(preparedPipeline.pipelineUrl
|
|
4695
4711
|
? preparedPipeline.pipelineUrl
|
|
4696
|
-
: 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(
|
|
4697
|
-
// <- TODO: Here should be maybe also subformat index to distinguish between same
|
|
4712
|
+
: 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(task.name
|
|
4713
|
+
// <- TODO: Here should be maybe also subformat index to distinguish between same task with different subformat values
|
|
4698
4714
|
),
|
|
4699
4715
|
parameters: parameters,
|
|
4700
4716
|
content: preparedContent,
|
|
4701
4717
|
modelRequirements: modelRequirements,
|
|
4702
4718
|
expectations: __assign(__assign({}, (preparedPipeline.personas.find(function (_a) {
|
|
4703
4719
|
var name = _a.name;
|
|
4704
|
-
return name ===
|
|
4705
|
-
}) ||
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
postprocessingFunctionNames: template.postprocessingFunctionNames,
|
|
4720
|
+
return name === task.personaName;
|
|
4721
|
+
}) || {})), task.expectations),
|
|
4722
|
+
format: task.format,
|
|
4723
|
+
postprocessingFunctionNames: task.postprocessingFunctionNames,
|
|
4709
4724
|
}; // <- TODO: Not very good type guard
|
|
4710
4725
|
_c = modelRequirements.modelVariant;
|
|
4711
4726
|
switch (_c) {
|
|
@@ -4715,36 +4730,35 @@ function executeAttempts(options) {
|
|
|
4715
4730
|
}
|
|
4716
4731
|
return [3 /*break*/, 9];
|
|
4717
4732
|
case 4:
|
|
4718
|
-
_d = $
|
|
4733
|
+
_d = $ongoingTaskResult;
|
|
4719
4734
|
return [4 /*yield*/, llmTools.callChatModel(
|
|
4720
4735
|
// <- TODO: [🧁] Check that `callChatModel` is defined
|
|
4721
|
-
$deepFreeze($
|
|
4736
|
+
$deepFreeze($ongoingTaskResult.$prompt))];
|
|
4722
4737
|
case 5:
|
|
4723
4738
|
_d.$chatResult = _t.sent();
|
|
4724
4739
|
// TODO: [🍬] Destroy chatThread
|
|
4725
|
-
$
|
|
4726
|
-
$
|
|
4740
|
+
$ongoingTaskResult.$result = $ongoingTaskResult.$chatResult;
|
|
4741
|
+
$ongoingTaskResult.$resultString = $ongoingTaskResult.$chatResult.content;
|
|
4727
4742
|
return [3 /*break*/, 10];
|
|
4728
4743
|
case 6:
|
|
4729
|
-
_e = $
|
|
4744
|
+
_e = $ongoingTaskResult;
|
|
4730
4745
|
return [4 /*yield*/, llmTools.callCompletionModel(
|
|
4731
4746
|
// <- TODO: [🧁] Check that `callCompletionModel` is defined
|
|
4732
|
-
$deepFreeze($
|
|
4747
|
+
$deepFreeze($ongoingTaskResult.$prompt))];
|
|
4733
4748
|
case 7:
|
|
4734
4749
|
_e.$completionResult = _t.sent();
|
|
4735
|
-
$
|
|
4736
|
-
$
|
|
4737
|
-
$ongoingTemplateResult.$completionResult.content;
|
|
4750
|
+
$ongoingTaskResult.$result = $ongoingTaskResult.$completionResult;
|
|
4751
|
+
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
4738
4752
|
return [3 /*break*/, 10];
|
|
4739
4753
|
case 8: throw new PipelineExecutionError(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 "); }));
|
|
4740
|
-
case 9: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown model variant \"".concat(
|
|
4754
|
+
case 9: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown model variant \"".concat(task.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
4741
4755
|
case 10: return [3 /*break*/, 25];
|
|
4742
4756
|
case 11:
|
|
4743
4757
|
if (arrayableToArray(tools.script).length === 0) {
|
|
4744
4758
|
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n No script execution tools are available\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
4745
4759
|
}
|
|
4746
|
-
if (!
|
|
4747
|
-
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT
|
|
4760
|
+
if (!task.contentLanguage) {
|
|
4761
|
+
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT TASK \"".concat(task.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
4748
4762
|
}
|
|
4749
4763
|
_t.label = 12;
|
|
4750
4764
|
case 12:
|
|
@@ -4757,9 +4771,9 @@ function executeAttempts(options) {
|
|
|
4757
4771
|
_t.label = 14;
|
|
4758
4772
|
case 14:
|
|
4759
4773
|
_t.trys.push([14, 16, , 17]);
|
|
4760
|
-
_h = $
|
|
4774
|
+
_h = $ongoingTaskResult;
|
|
4761
4775
|
return [4 /*yield*/, scriptTools.execute($deepFreeze({
|
|
4762
|
-
scriptLanguage:
|
|
4776
|
+
scriptLanguage: task.contentLanguage,
|
|
4763
4777
|
script: preparedContent,
|
|
4764
4778
|
parameters: parameters,
|
|
4765
4779
|
}))];
|
|
@@ -4774,7 +4788,7 @@ function executeAttempts(options) {
|
|
|
4774
4788
|
if (error_1 instanceof UnexpectedError) {
|
|
4775
4789
|
throw error_1;
|
|
4776
4790
|
}
|
|
4777
|
-
$
|
|
4791
|
+
$ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_1);
|
|
4778
4792
|
return [3 /*break*/, 17];
|
|
4779
4793
|
case 17:
|
|
4780
4794
|
_g = _f.next();
|
|
@@ -4791,14 +4805,14 @@ function executeAttempts(options) {
|
|
|
4791
4805
|
finally { if (e_1) throw e_1.error; }
|
|
4792
4806
|
return [7 /*endfinally*/];
|
|
4793
4807
|
case 21:
|
|
4794
|
-
if ($
|
|
4808
|
+
if ($ongoingTaskResult.$resultString !== null) {
|
|
4795
4809
|
return [3 /*break*/, 25];
|
|
4796
4810
|
}
|
|
4797
|
-
if ($
|
|
4798
|
-
throw $
|
|
4811
|
+
if ($ongoingTaskResult.$scriptPipelineExecutionErrors.length === 1) {
|
|
4812
|
+
throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
4799
4813
|
}
|
|
4800
4814
|
else {
|
|
4801
|
-
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script execution failed ".concat($
|
|
4815
|
+
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script execution failed ".concat($ongoingTaskResult.$scriptPipelineExecutionErrors.length, "x\n\n ").concat(block(pipelineIdentification), "\n\n ").concat(block($ongoingTaskResult.$scriptPipelineExecutionErrors
|
|
4802
4816
|
.map(function (error) { return '- ' + error.message; })
|
|
4803
4817
|
.join('\n\n')), "\n "); }));
|
|
4804
4818
|
}
|
|
@@ -4806,27 +4820,27 @@ function executeAttempts(options) {
|
|
|
4806
4820
|
if (tools.userInterface === undefined) {
|
|
4807
4821
|
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n User interface tools are not available\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
4808
4822
|
}
|
|
4809
|
-
// TODO: [🌹] When making next attempt for `DIALOG
|
|
4810
|
-
_j = $
|
|
4823
|
+
// TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
|
|
4824
|
+
_j = $ongoingTaskResult;
|
|
4811
4825
|
return [4 /*yield*/, tools.userInterface.promptDialog($deepFreeze({
|
|
4812
|
-
promptTitle:
|
|
4813
|
-
promptMessage: replaceParameters(
|
|
4826
|
+
promptTitle: task.title,
|
|
4827
|
+
promptMessage: replaceParameters(task.description || '', parameters),
|
|
4814
4828
|
defaultValue: replaceParameters(preparedContent, parameters),
|
|
4815
4829
|
// TODO: [🧠] !! Figure out how to define placeholder in .book.md file
|
|
4816
4830
|
placeholder: undefined,
|
|
4817
4831
|
priority: priority,
|
|
4818
4832
|
}))];
|
|
4819
4833
|
case 23:
|
|
4820
|
-
// TODO: [🌹] When making next attempt for `DIALOG
|
|
4834
|
+
// TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
|
|
4821
4835
|
_j.$resultString = _t.sent();
|
|
4822
4836
|
return [3 /*break*/, 25];
|
|
4823
|
-
case 24: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown execution type \"".concat(
|
|
4837
|
+
case 24: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown execution type \"".concat(task.taskType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
4824
4838
|
case 25:
|
|
4825
|
-
if (!(!isJokerAttempt &&
|
|
4839
|
+
if (!(!isJokerAttempt && task.postprocessingFunctionNames)) return [3 /*break*/, 42];
|
|
4826
4840
|
_t.label = 26;
|
|
4827
4841
|
case 26:
|
|
4828
4842
|
_t.trys.push([26, 40, 41, 42]);
|
|
4829
|
-
_k = (e_3 = void 0, __values(
|
|
4843
|
+
_k = (e_3 = void 0, __values(task.postprocessingFunctionNames)), _l = _k.next();
|
|
4830
4844
|
_t.label = 27;
|
|
4831
4845
|
case 27:
|
|
4832
4846
|
if (!!_l.done) return [3 /*break*/, 39];
|
|
@@ -4843,13 +4857,13 @@ function executeAttempts(options) {
|
|
|
4843
4857
|
_t.label = 30;
|
|
4844
4858
|
case 30:
|
|
4845
4859
|
_t.trys.push([30, 32, , 33]);
|
|
4846
|
-
_p = $
|
|
4860
|
+
_p = $ongoingTaskResult;
|
|
4847
4861
|
return [4 /*yield*/, scriptTools.execute({
|
|
4848
4862
|
scriptLanguage: "javascript" /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
|
|
4849
4863
|
script: "".concat(functionName, "(resultString)"),
|
|
4850
4864
|
parameters: {
|
|
4851
|
-
resultString: $
|
|
4852
|
-
// Note: No ...
|
|
4865
|
+
resultString: $ongoingTaskResult.$resultString || '',
|
|
4866
|
+
// Note: No ...parametersForTask, because working with result only
|
|
4853
4867
|
},
|
|
4854
4868
|
})];
|
|
4855
4869
|
case 31:
|
|
@@ -4865,7 +4879,7 @@ function executeAttempts(options) {
|
|
|
4865
4879
|
throw error_2;
|
|
4866
4880
|
}
|
|
4867
4881
|
postprocessingError = error_2;
|
|
4868
|
-
$
|
|
4882
|
+
$ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_2);
|
|
4869
4883
|
return [3 /*break*/, 33];
|
|
4870
4884
|
case 33:
|
|
4871
4885
|
_o = _m.next();
|
|
@@ -4902,12 +4916,12 @@ function executeAttempts(options) {
|
|
|
4902
4916
|
return [7 /*endfinally*/];
|
|
4903
4917
|
case 42:
|
|
4904
4918
|
// TODO: [💝] Unite object for expecting amount and format
|
|
4905
|
-
if (
|
|
4906
|
-
if (
|
|
4907
|
-
if (!isValidJsonString($
|
|
4919
|
+
if (task.format) {
|
|
4920
|
+
if (task.format === 'JSON') {
|
|
4921
|
+
if (!isValidJsonString($ongoingTaskResult.$resultString || '')) {
|
|
4908
4922
|
// TODO: [🏢] Do more universally via `FormatDefinition`
|
|
4909
4923
|
try {
|
|
4910
|
-
$
|
|
4924
|
+
$ongoingTaskResult.$resultString = extractJsonBlock($ongoingTaskResult.$resultString || '');
|
|
4911
4925
|
}
|
|
4912
4926
|
catch (error) {
|
|
4913
4927
|
throw new ExpectError(spaceTrim(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(
|
|
@@ -4916,12 +4930,12 @@ function executeAttempts(options) {
|
|
|
4916
4930
|
}
|
|
4917
4931
|
}
|
|
4918
4932
|
else {
|
|
4919
|
-
throw new UnexpectedError(spaceTrim(function (block) { return "\n Unknown format \"".concat(
|
|
4933
|
+
throw new UnexpectedError(spaceTrim(function (block) { return "\n Unknown format \"".concat(task.format, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
4920
4934
|
}
|
|
4921
4935
|
}
|
|
4922
4936
|
// TODO: [💝] Unite object for expecting amount and format
|
|
4923
|
-
if (
|
|
4924
|
-
checkExpectations(
|
|
4937
|
+
if (task.expectations) {
|
|
4938
|
+
checkExpectations(task.expectations, $ongoingTaskResult.$resultString || '');
|
|
4925
4939
|
}
|
|
4926
4940
|
return [2 /*return*/, "break-attempts"];
|
|
4927
4941
|
case 43:
|
|
@@ -4929,38 +4943,38 @@ function executeAttempts(options) {
|
|
|
4929
4943
|
if (!(error_3 instanceof ExpectError)) {
|
|
4930
4944
|
throw error_3;
|
|
4931
4945
|
}
|
|
4932
|
-
$
|
|
4946
|
+
$ongoingTaskResult.$expectError = error_3;
|
|
4933
4947
|
return [3 /*break*/, 45];
|
|
4934
4948
|
case 44:
|
|
4935
4949
|
if (!isJokerAttempt &&
|
|
4936
|
-
|
|
4937
|
-
$
|
|
4950
|
+
task.taskType === 'PROMPT_TASK' &&
|
|
4951
|
+
$ongoingTaskResult.$prompt
|
|
4938
4952
|
// <- Note: [2] When some expected parameter is not defined, error will occur in replaceParameters
|
|
4939
4953
|
// In that case we don’t want to make a report about it because it’s not a llm execution error
|
|
4940
4954
|
) {
|
|
4941
|
-
// TODO: [🧠] Maybe put other
|
|
4955
|
+
// TODO: [🧠] Maybe put other taskTypes into report
|
|
4942
4956
|
$executionReport.promptExecutions.push({
|
|
4943
|
-
prompt: __assign({}, $
|
|
4944
|
-
result: $
|
|
4945
|
-
error: $
|
|
4957
|
+
prompt: __assign({}, $ongoingTaskResult.$prompt),
|
|
4958
|
+
result: $ongoingTaskResult.$result || undefined,
|
|
4959
|
+
error: $ongoingTaskResult.$expectError === null
|
|
4946
4960
|
? undefined
|
|
4947
|
-
: serializeError($
|
|
4961
|
+
: serializeError($ongoingTaskResult.$expectError),
|
|
4948
4962
|
});
|
|
4949
4963
|
}
|
|
4950
4964
|
return [7 /*endfinally*/];
|
|
4951
4965
|
case 45:
|
|
4952
|
-
if ($
|
|
4966
|
+
if ($ongoingTaskResult.$expectError !== null && attempt === maxAttempts - 1) {
|
|
4953
4967
|
throw new PipelineExecutionError(spaceTrim(function (block) {
|
|
4954
4968
|
var _a, _b, _c;
|
|
4955
|
-
return "\n LLM execution failed ".concat(maxExecutionAttempts, "x\n\n ").concat(block(pipelineIdentification), "\n\n ---\n The Prompt:\n ").concat(block((((_a = $
|
|
4969
|
+
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) || '')
|
|
4956
4970
|
.split('\n')
|
|
4957
4971
|
.map(function (line) { return "> ".concat(line); })
|
|
4958
|
-
.join('\n')), "\n\n Last error ").concat(((_b = $
|
|
4972
|
+
.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) || '')
|
|
4959
4973
|
.split('\n')
|
|
4960
4974
|
.map(function (line) { return "> ".concat(line); })
|
|
4961
|
-
.join('\n')), "\n\n Last result:\n ").concat(block($
|
|
4975
|
+
.join('\n')), "\n\n Last result:\n ").concat(block($ongoingTaskResult.$resultString === null
|
|
4962
4976
|
? 'null'
|
|
4963
|
-
: $
|
|
4977
|
+
: $ongoingTaskResult.$resultString
|
|
4964
4978
|
.split('\n')
|
|
4965
4979
|
.map(function (line) { return "> ".concat(line); })
|
|
4966
4980
|
.join('\n')), "\n ---\n ");
|
|
@@ -4985,10 +4999,10 @@ function executeAttempts(options) {
|
|
|
4985
4999
|
attempt++;
|
|
4986
5000
|
return [3 /*break*/, 1];
|
|
4987
5001
|
case 4:
|
|
4988
|
-
if ($
|
|
5002
|
+
if ($ongoingTaskResult.$resultString === null) {
|
|
4989
5003
|
throw new UnexpectedError(spaceTrim(function (block) { return "\n Something went wrong and prompt result is null\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
4990
5004
|
}
|
|
4991
|
-
return [2 /*return*/, $
|
|
5005
|
+
return [2 /*return*/, $ongoingTaskResult.$resultString];
|
|
4992
5006
|
}
|
|
4993
5007
|
});
|
|
4994
5008
|
});
|
|
@@ -5004,36 +5018,36 @@ function executeAttempts(options) {
|
|
|
5004
5018
|
*/
|
|
5005
5019
|
function executeFormatSubvalues(options) {
|
|
5006
5020
|
return __awaiter(this, void 0, void 0, function () {
|
|
5007
|
-
var
|
|
5021
|
+
var task, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
|
|
5008
5022
|
var _this = this;
|
|
5009
5023
|
return __generator(this, function (_a) {
|
|
5010
5024
|
switch (_a.label) {
|
|
5011
5025
|
case 0:
|
|
5012
|
-
|
|
5013
|
-
if (
|
|
5026
|
+
task = options.task, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
|
|
5027
|
+
if (task.foreach === undefined) {
|
|
5014
5028
|
return [2 /*return*/, /* not await */ executeAttempts(options)];
|
|
5015
5029
|
}
|
|
5016
5030
|
if (jokerParameterNames.length !== 0) {
|
|
5017
5031
|
throw new UnexpectedError(spaceTrim$1(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 "); }));
|
|
5018
5032
|
}
|
|
5019
|
-
parameterValue = parameters[
|
|
5033
|
+
parameterValue = parameters[task.foreach.parameterName] || '';
|
|
5020
5034
|
formatDefinition = FORMAT_DEFINITIONS.find(function (formatDefinition) {
|
|
5021
|
-
return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(
|
|
5035
|
+
return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(task.foreach.formatName);
|
|
5022
5036
|
});
|
|
5023
5037
|
if (formatDefinition === undefined) {
|
|
5024
5038
|
throw new UnexpectedError(
|
|
5025
5039
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
5026
|
-
spaceTrim$1(function (block) { return "\n Unsupported format \"".concat(
|
|
5040
|
+
spaceTrim$1(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; })
|
|
5027
5041
|
.map(function (formatName) { return "- ".concat(formatName); })
|
|
5028
5042
|
.join('\n')), "\n\n [\u26F7] This should never happen because format name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
5029
5043
|
}
|
|
5030
5044
|
subvalueDefinition = formatDefinition.subvalueDefinitions.find(function (subvalueDefinition) {
|
|
5031
|
-
return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(
|
|
5045
|
+
return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(task.foreach.subformatName);
|
|
5032
5046
|
});
|
|
5033
5047
|
if (subvalueDefinition === undefined) {
|
|
5034
5048
|
throw new UnexpectedError(
|
|
5035
5049
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
5036
|
-
spaceTrim$1(function (block) { return "\n Unsupported subformat name \"".concat(
|
|
5050
|
+
spaceTrim$1(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
|
|
5037
5051
|
.map(function (subvalueDefinition) { return subvalueDefinition.subvalueName; })
|
|
5038
5052
|
.map(function (subvalueName) { return "- ".concat(subvalueName); })
|
|
5039
5053
|
.join('\n')), "\n\n [\u26F7] This should never happen because subformat name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
@@ -5042,7 +5056,7 @@ function executeFormatSubvalues(options) {
|
|
|
5042
5056
|
formatSettings = csvSettings;
|
|
5043
5057
|
// <- TODO: [🤹♂️] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
|
|
5044
5058
|
}
|
|
5045
|
-
return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue,
|
|
5059
|
+
return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, task.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
5046
5060
|
var mappedParameters, allSubparameters, subresultString;
|
|
5047
5061
|
return __generator(this, function (_a) {
|
|
5048
5062
|
switch (_a.label) {
|
|
@@ -5051,7 +5065,7 @@ function executeFormatSubvalues(options) {
|
|
|
5051
5065
|
// TODO: When done [🐚] Report progress also for each subvalue here
|
|
5052
5066
|
try {
|
|
5053
5067
|
mappedParameters = mapAvailableToExpectedParameters({
|
|
5054
|
-
expectedParameters: Object.fromEntries(
|
|
5068
|
+
expectedParameters: Object.fromEntries(task.foreach.inputSubparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
|
|
5055
5069
|
availableParameters: subparameters,
|
|
5056
5070
|
});
|
|
5057
5071
|
}
|
|
@@ -5084,7 +5098,7 @@ function executeFormatSubvalues(options) {
|
|
|
5084
5098
|
*
|
|
5085
5099
|
* @private internal utility of `createPipelineExecutor`
|
|
5086
5100
|
*/
|
|
5087
|
-
function
|
|
5101
|
+
function getContextForTask(task) {
|
|
5088
5102
|
return __awaiter(this, void 0, void 0, function () {
|
|
5089
5103
|
return __generator(this, function (_a) {
|
|
5090
5104
|
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
|
|
@@ -5097,15 +5111,10 @@ function getContextForTemplate(template) {
|
|
|
5097
5111
|
*
|
|
5098
5112
|
* @private internal utility of `createPipelineExecutor`
|
|
5099
5113
|
*/
|
|
5100
|
-
function
|
|
5114
|
+
function getExamplesForTask(task) {
|
|
5101
5115
|
return __awaiter(this, void 0, void 0, function () {
|
|
5102
|
-
var preparedPipeline;
|
|
5103
5116
|
return __generator(this, function (_a) {
|
|
5104
|
-
|
|
5105
|
-
return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
|
|
5106
|
-
var content = _a.content;
|
|
5107
|
-
return "- ".concat(content);
|
|
5108
|
-
}).join('\n')];
|
|
5117
|
+
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
|
|
5109
5118
|
});
|
|
5110
5119
|
});
|
|
5111
5120
|
}
|
|
@@ -5115,10 +5124,15 @@ function getKnowledgeForTemplate(options) {
|
|
|
5115
5124
|
*
|
|
5116
5125
|
* @private internal utility of `createPipelineExecutor`
|
|
5117
5126
|
*/
|
|
5118
|
-
function
|
|
5127
|
+
function getKnowledgeForTask(options) {
|
|
5119
5128
|
return __awaiter(this, void 0, void 0, function () {
|
|
5129
|
+
var preparedPipeline;
|
|
5120
5130
|
return __generator(this, function (_a) {
|
|
5121
|
-
|
|
5131
|
+
preparedPipeline = options.preparedPipeline, options.task;
|
|
5132
|
+
return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
|
|
5133
|
+
var content = _a.content;
|
|
5134
|
+
return "- ".concat(content);
|
|
5135
|
+
}).join('\n')];
|
|
5122
5136
|
});
|
|
5123
5137
|
});
|
|
5124
5138
|
}
|
|
@@ -5128,21 +5142,21 @@ function getExamplesForTemplate(template) {
|
|
|
5128
5142
|
*
|
|
5129
5143
|
* @private internal utility of `createPipelineExecutor`
|
|
5130
5144
|
*/
|
|
5131
|
-
function
|
|
5145
|
+
function getReservedParametersForTask(options) {
|
|
5132
5146
|
return __awaiter(this, void 0, void 0, function () {
|
|
5133
|
-
var preparedPipeline,
|
|
5147
|
+
var preparedPipeline, task, pipelineIdentification, context, knowledge, examples, currentDate, modelName, reservedParameters, _loop_1, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
|
|
5134
5148
|
var e_1, _a;
|
|
5135
5149
|
return __generator(this, function (_b) {
|
|
5136
5150
|
switch (_b.label) {
|
|
5137
5151
|
case 0:
|
|
5138
|
-
preparedPipeline = options.preparedPipeline,
|
|
5139
|
-
return [4 /*yield*/,
|
|
5152
|
+
preparedPipeline = options.preparedPipeline, task = options.task, pipelineIdentification = options.pipelineIdentification;
|
|
5153
|
+
return [4 /*yield*/, getContextForTask()];
|
|
5140
5154
|
case 1:
|
|
5141
5155
|
context = _b.sent();
|
|
5142
|
-
return [4 /*yield*/,
|
|
5156
|
+
return [4 /*yield*/, getKnowledgeForTask({ preparedPipeline: preparedPipeline, task: task })];
|
|
5143
5157
|
case 2:
|
|
5144
5158
|
knowledge = _b.sent();
|
|
5145
|
-
return [4 /*yield*/,
|
|
5159
|
+
return [4 /*yield*/, getExamplesForTask()];
|
|
5146
5160
|
case 3:
|
|
5147
5161
|
examples = _b.sent();
|
|
5148
5162
|
currentDate = new Date().toISOString();
|
|
@@ -5185,31 +5199,31 @@ function getReservedParametersForTemplate(options) {
|
|
|
5185
5199
|
*
|
|
5186
5200
|
* @private internal utility of `createPipelineExecutor`
|
|
5187
5201
|
*/
|
|
5188
|
-
function
|
|
5202
|
+
function executeTask(options) {
|
|
5189
5203
|
return __awaiter(this, void 0, void 0, function () {
|
|
5190
|
-
var
|
|
5204
|
+
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;
|
|
5191
5205
|
var e_1, _g, _h;
|
|
5192
5206
|
return __generator(this, function (_j) {
|
|
5193
5207
|
switch (_j.label) {
|
|
5194
5208
|
case 0:
|
|
5195
|
-
|
|
5196
|
-
name = "pipeline-executor-frame-".concat(
|
|
5197
|
-
title =
|
|
5198
|
-
priority = preparedPipeline.
|
|
5209
|
+
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;
|
|
5210
|
+
name = "pipeline-executor-frame-".concat(currentTask.name);
|
|
5211
|
+
title = currentTask.title;
|
|
5212
|
+
priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
5199
5213
|
return [4 /*yield*/, onProgress({
|
|
5200
5214
|
name: name,
|
|
5201
5215
|
title: title,
|
|
5202
5216
|
isStarted: false,
|
|
5203
5217
|
isDone: false,
|
|
5204
|
-
|
|
5205
|
-
parameterName:
|
|
5218
|
+
taskType: currentTask.taskType,
|
|
5219
|
+
parameterName: currentTask.resultingParameterName,
|
|
5206
5220
|
parameterValue: null,
|
|
5207
5221
|
// <- [🍸]
|
|
5208
5222
|
})];
|
|
5209
5223
|
case 1:
|
|
5210
5224
|
_j.sent();
|
|
5211
|
-
usedParameterNames =
|
|
5212
|
-
dependentParameterNames = new Set(
|
|
5225
|
+
usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
5226
|
+
dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
5213
5227
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
5214
5228
|
if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
|
|
5215
5229
|
throw new UnexpectedError(spaceTrim(function (block) { return "\n Dependent parameters are not consistent with used parameters:\n\n Dependent parameters:\n ".concat(Array.from(dependentParameterNames)
|
|
@@ -5220,9 +5234,9 @@ function executeTemplate(options) {
|
|
|
5220
5234
|
}
|
|
5221
5235
|
_c = (_b = Object).freeze;
|
|
5222
5236
|
_d = [{}];
|
|
5223
|
-
return [4 /*yield*/,
|
|
5237
|
+
return [4 /*yield*/, getReservedParametersForTask({
|
|
5224
5238
|
preparedPipeline: preparedPipeline,
|
|
5225
|
-
|
|
5239
|
+
task: currentTask,
|
|
5226
5240
|
pipelineIdentification: pipelineIdentification,
|
|
5227
5241
|
})];
|
|
5228
5242
|
case 2:
|
|
@@ -5240,11 +5254,11 @@ function executeTemplate(options) {
|
|
|
5240
5254
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
5241
5255
|
// Houston, we have a problem
|
|
5242
5256
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
5243
|
-
throw new UnexpectedError(spaceTrim(function (block) { return "\n Parameter `{".concat(parameterName, "}` is NOT defined\n BUT used in
|
|
5257
|
+
throw new UnexpectedError(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 "); }));
|
|
5244
5258
|
}
|
|
5245
5259
|
};
|
|
5246
5260
|
try {
|
|
5247
|
-
// Note: [2] Check that all used parameters are defined and removing unused parameters for this
|
|
5261
|
+
// Note: [2] Check that all used parameters are defined and removing unused parameters for this task
|
|
5248
5262
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
5249
5263
|
for (_e = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
5250
5264
|
parameterName = _f.value;
|
|
@@ -5260,18 +5274,16 @@ function executeTemplate(options) {
|
|
|
5260
5274
|
}
|
|
5261
5275
|
// 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
|
|
5262
5276
|
Object.freeze(parameters);
|
|
5263
|
-
maxAttempts =
|
|
5264
|
-
jokerParameterNames =
|
|
5265
|
-
preparedContent = (
|
|
5266
|
-
.split('{content}')
|
|
5267
|
-
.join(currentTemplate.content);
|
|
5277
|
+
maxAttempts = currentTask.taskType === 'DIALOG_TASK' ? Infinity : maxExecutionAttempts;
|
|
5278
|
+
jokerParameterNames = currentTask.jokerParameterNames || [];
|
|
5279
|
+
preparedContent = (currentTask.preparedContent || '{content}').split('{content}').join(currentTask.content);
|
|
5268
5280
|
return [4 /*yield*/, executeFormatSubvalues({
|
|
5269
5281
|
jokerParameterNames: jokerParameterNames,
|
|
5270
5282
|
priority: priority,
|
|
5271
5283
|
maxAttempts: maxAttempts,
|
|
5272
5284
|
preparedContent: preparedContent,
|
|
5273
5285
|
parameters: parameters,
|
|
5274
|
-
|
|
5286
|
+
task: currentTask,
|
|
5275
5287
|
preparedPipeline: preparedPipeline,
|
|
5276
5288
|
tools: tools,
|
|
5277
5289
|
$executionReport: $executionReport,
|
|
@@ -5284,15 +5296,15 @@ function executeTemplate(options) {
|
|
|
5284
5296
|
title: title,
|
|
5285
5297
|
isStarted: true,
|
|
5286
5298
|
isDone: true,
|
|
5287
|
-
|
|
5288
|
-
parameterName:
|
|
5299
|
+
taskType: currentTask.taskType,
|
|
5300
|
+
parameterName: currentTask.resultingParameterName,
|
|
5289
5301
|
parameterValue: resultString,
|
|
5290
5302
|
// <- [🍸]
|
|
5291
5303
|
})];
|
|
5292
5304
|
case 4:
|
|
5293
5305
|
_j.sent();
|
|
5294
5306
|
return [2 /*return*/, Object.freeze((_h = {},
|
|
5295
|
-
_h[
|
|
5307
|
+
_h[currentTask.resultingParameterName] =
|
|
5296
5308
|
// <- Note: [👩👩👧] No need to detect parameter collision here because pipeline checks logic consistency during construction
|
|
5297
5309
|
resultString,
|
|
5298
5310
|
_h))];
|
|
@@ -5354,7 +5366,7 @@ function filterJustOutputParameters(options) {
|
|
|
5354
5366
|
*/
|
|
5355
5367
|
function executePipeline(options) {
|
|
5356
5368
|
return __awaiter(this, void 0, void 0, function () {
|
|
5357
|
-
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,
|
|
5369
|
+
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;
|
|
5358
5370
|
var e_1, _f, e_2, _g;
|
|
5359
5371
|
return __generator(this, function (_h) {
|
|
5360
5372
|
switch (_h.label) {
|
|
@@ -5508,11 +5520,11 @@ function executePipeline(options) {
|
|
|
5508
5520
|
var name = _a.name;
|
|
5509
5521
|
return name;
|
|
5510
5522
|
});
|
|
5511
|
-
|
|
5523
|
+
unresovedTasks_1 = __spreadArray([], __read(preparedPipeline.tasks), false);
|
|
5512
5524
|
resolving_1 = [];
|
|
5513
5525
|
loopLimit = LOOP_LIMIT;
|
|
5514
5526
|
_loop_2 = function () {
|
|
5515
|
-
var
|
|
5527
|
+
var currentTask, work_1;
|
|
5516
5528
|
return __generator(this, function (_k) {
|
|
5517
5529
|
switch (_k.label) {
|
|
5518
5530
|
case 0:
|
|
@@ -5520,15 +5532,15 @@ function executePipeline(options) {
|
|
|
5520
5532
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
5521
5533
|
throw new UnexpectedError(spaceTrim(function (block) { return "\n Loop limit reached during resolving parameters pipeline execution\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
5522
5534
|
}
|
|
5523
|
-
|
|
5524
|
-
return
|
|
5535
|
+
currentTask = unresovedTasks_1.find(function (task) {
|
|
5536
|
+
return task.dependentParameterNames.every(function (name) {
|
|
5525
5537
|
return __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), __read(RESERVED_PARAMETER_NAMES), false).includes(name);
|
|
5526
5538
|
});
|
|
5527
5539
|
});
|
|
5528
|
-
if (!(!
|
|
5540
|
+
if (!(!currentTask && resolving_1.length === 0)) return [3 /*break*/, 1];
|
|
5529
5541
|
throw new UnexpectedError(
|
|
5530
5542
|
// TODO: [🐎] DRY
|
|
5531
|
-
spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(
|
|
5543
|
+
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
|
|
5532
5544
|
.map(function (_a) {
|
|
5533
5545
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
5534
5546
|
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
@@ -5547,14 +5559,14 @@ function executePipeline(options) {
|
|
|
5547
5559
|
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
5548
5560
|
.join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
|
|
5549
5561
|
case 1:
|
|
5550
|
-
if (!!
|
|
5562
|
+
if (!!currentTask) return [3 /*break*/, 3];
|
|
5551
5563
|
/* [🤹♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
|
|
5552
5564
|
case 2:
|
|
5553
5565
|
/* [🤹♂️] */ _k.sent();
|
|
5554
5566
|
return [3 /*break*/, 4];
|
|
5555
5567
|
case 3:
|
|
5556
|
-
|
|
5557
|
-
work_1 =
|
|
5568
|
+
unresovedTasks_1 = unresovedTasks_1.filter(function (task) { return task !== currentTask; });
|
|
5569
|
+
work_1 = executeTask(__assign(__assign({}, options), { currentTask: currentTask, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
|
|
5558
5570
|
if (isReturned) {
|
|
5559
5571
|
throw new UnexpectedError(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)
|
|
5560
5572
|
.split('\n')
|
|
@@ -5564,16 +5576,16 @@ function executePipeline(options) {
|
|
|
5564
5576
|
if (onProgress) {
|
|
5565
5577
|
onProgress(progress);
|
|
5566
5578
|
}
|
|
5567
|
-
}, $executionReport: executionReport, pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n
|
|
5579
|
+
}, $executionReport: executionReport, pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Task name: ").concat(currentTask.name, "\n Task title: ").concat(currentTask.title, "\n "); }) }))
|
|
5568
5580
|
.then(function (newParametersToPass) {
|
|
5569
5581
|
parametersToPass = __assign(__assign({}, newParametersToPass), parametersToPass);
|
|
5570
|
-
resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [
|
|
5582
|
+
resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTask.resultingParameterName], false);
|
|
5571
5583
|
})
|
|
5572
5584
|
.then(function () {
|
|
5573
5585
|
resolving_1 = resolving_1.filter(function (w) { return w !== work_1; });
|
|
5574
5586
|
});
|
|
5575
5587
|
// <- Note: Errors are catched here [3]
|
|
5576
|
-
// TODO: BUT if in multiple
|
|
5588
|
+
// 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
|
|
5577
5589
|
resolving_1.push(work_1);
|
|
5578
5590
|
_k.label = 4;
|
|
5579
5591
|
case 4: return [2 /*return*/];
|
|
@@ -5582,7 +5594,7 @@ function executePipeline(options) {
|
|
|
5582
5594
|
};
|
|
5583
5595
|
_h.label = 21;
|
|
5584
5596
|
case 21:
|
|
5585
|
-
if (!(
|
|
5597
|
+
if (!(unresovedTasks_1.length > 0)) return [3 /*break*/, 23];
|
|
5586
5598
|
return [5 /*yield**/, _loop_2()];
|
|
5587
5599
|
case 22:
|
|
5588
5600
|
_h.sent();
|
|
@@ -5740,6 +5752,9 @@ var markdownScraperMetadata = $deepFreeze({
|
|
|
5740
5752
|
* @public exported from `@promptbook/cli`
|
|
5741
5753
|
*/
|
|
5742
5754
|
$scrapersMetadataRegister.register(markdownScraperMetadata);
|
|
5755
|
+
/**
|
|
5756
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
5757
|
+
*/
|
|
5743
5758
|
|
|
5744
5759
|
/**
|
|
5745
5760
|
* Scraper for markdown files
|
|
@@ -5934,6 +5949,9 @@ var documentScraperMetadata = $deepFreeze({
|
|
|
5934
5949
|
* @public exported from `@promptbook/cli`
|
|
5935
5950
|
*/
|
|
5936
5951
|
$scrapersMetadataRegister.register(documentScraperMetadata);
|
|
5952
|
+
/**
|
|
5953
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
5954
|
+
*/
|
|
5937
5955
|
|
|
5938
5956
|
/**
|
|
5939
5957
|
* Scraper of .docx and .odt files
|
|
@@ -6098,6 +6116,9 @@ var legacyDocumentScraperMetadata = $deepFreeze({
|
|
|
6098
6116
|
* @public exported from `@promptbook/cli`
|
|
6099
6117
|
*/
|
|
6100
6118
|
$scrapersMetadataRegister.register(legacyDocumentScraperMetadata);
|
|
6119
|
+
/**
|
|
6120
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
6121
|
+
*/
|
|
6101
6122
|
|
|
6102
6123
|
/**
|
|
6103
6124
|
* Scraper for old document files (like .doc and .rtf)
|
|
@@ -6267,6 +6288,7 @@ var createLegacyDocumentScraper = Object.assign(function (tools, options) {
|
|
|
6267
6288
|
var _LegacyDocumentScraperRegistration = $scrapersRegister.register(createLegacyDocumentScraper);
|
|
6268
6289
|
/**
|
|
6269
6290
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
6291
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
6270
6292
|
*/
|
|
6271
6293
|
|
|
6272
6294
|
export { BOOK_LANGUAGE_VERSION, LegacyDocumentScraper, PROMPTBOOK_ENGINE_VERSION, _LegacyDocumentScraperRegistration, createLegacyDocumentScraper };
|