@promptbook/markitdown 0.112.0-39 β 0.112.0-41
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 +23 -21
- package/esm/index.es.js +481 -288
- package/esm/index.es.js.map +1 -1
- package/esm/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +8 -2
- package/esm/src/book-components/Chat/Chat/ChatInputArea.d.ts +0 -10
- package/esm/src/book-components/Chat/Chat/ChatInputUploadedFile.d.ts +10 -0
- package/esm/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +46 -0
- package/esm/src/book-components/Chat/Chat/resolveRunBrowserToolCallDetailsState.d.ts +146 -0
- package/esm/src/book-components/Chat/Chat/useChatInputAreaAttachments.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +39 -0
- package/esm/src/book-components/Chat/Chat/useChatPostprocessedMessages.d.ts +17 -0
- package/esm/src/book-components/Chat/Chat/useChatScrollState.d.ts +34 -0
- package/esm/src/book-components/Chat/Chat/useChatToolCallModalState.d.ts +61 -0
- package/esm/src/book-components/Chat/Chat/useChatToolCallState.d.ts +35 -0
- package/esm/src/book-components/Chat/LlmChat/useLlmChatMessageHandler.d.ts +58 -0
- package/esm/src/book-components/Chat/LlmChat/useLlmChatMessages.d.ts +29 -0
- package/esm/src/book-components/Chat/LlmChat/useLlmChatState.d.ts +53 -0
- package/esm/src/collection/pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts +7 -1
- package/esm/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +52 -0
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +128 -0
- package/esm/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +3 -3
- package/esm/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +54 -0
- package/esm/src/llm-providers/openai/utils/OpenAiCompatibleUnsupportedParameterRetrier.d.ts +29 -0
- package/esm/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +28 -0
- package/esm/src/types/number_usd.d.ts +1 -1
- package/esm/src/types/string_parameter_name.d.ts +2 -2
- package/esm/src/types/typeAliases.d.ts +2 -2
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +481 -288
- package/umd/index.umd.js.map +1 -1
- package/umd/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +8 -2
- package/umd/src/book-components/Chat/Chat/ChatInputArea.d.ts +0 -10
- package/umd/src/book-components/Chat/Chat/ChatInputUploadedFile.d.ts +10 -0
- package/umd/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +46 -0
- package/umd/src/book-components/Chat/Chat/resolveRunBrowserToolCallDetailsState.d.ts +146 -0
- package/umd/src/book-components/Chat/Chat/useChatInputAreaAttachments.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +39 -0
- package/umd/src/book-components/Chat/Chat/useChatPostprocessedMessages.d.ts +17 -0
- package/umd/src/book-components/Chat/Chat/useChatScrollState.d.ts +34 -0
- package/umd/src/book-components/Chat/Chat/useChatToolCallModalState.d.ts +61 -0
- package/umd/src/book-components/Chat/Chat/useChatToolCallState.d.ts +35 -0
- package/umd/src/book-components/Chat/LlmChat/useLlmChatMessageHandler.d.ts +58 -0
- package/umd/src/book-components/Chat/LlmChat/useLlmChatMessages.d.ts +29 -0
- package/umd/src/book-components/Chat/LlmChat/useLlmChatState.d.ts +53 -0
- package/umd/src/collection/pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts +7 -1
- package/umd/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +52 -0
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +128 -0
- package/umd/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +3 -3
- package/umd/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +54 -0
- package/umd/src/llm-providers/openai/utils/OpenAiCompatibleUnsupportedParameterRetrier.d.ts +29 -0
- package/umd/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +28 -0
- package/umd/src/types/number_usd.d.ts +1 -1
- package/umd/src/types/string_parameter_name.d.ts +2 -2
- package/umd/src/types/typeAliases.d.ts +2 -2
- package/umd/src/version.d.ts +1 -1
package/esm/index.es.js
CHANGED
|
@@ -24,7 +24,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
24
24
|
* @generated
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
27
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-41';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
@@ -6115,317 +6115,511 @@ function validatePromptResult(options) {
|
|
|
6115
6115
|
* @private internal utility of `createPipelineExecutor`
|
|
6116
6116
|
*/
|
|
6117
6117
|
async function executeAttempts(options) {
|
|
6118
|
-
const
|
|
6119
|
-
|
|
6120
|
-
|
|
6118
|
+
const $ongoingTaskResult = createOngoingTaskResult();
|
|
6119
|
+
const llmTools = getSingleLlmExecutionTools(options.tools.llm);
|
|
6120
|
+
attempts: for (let attemptIndex = -options.jokerParameterNames.length; attemptIndex < options.maxAttempts; attemptIndex++) {
|
|
6121
|
+
const attempt = createAttemptDescriptor({
|
|
6122
|
+
attemptIndex,
|
|
6123
|
+
jokerParameterNames: options.jokerParameterNames,
|
|
6124
|
+
pipelineIdentification: options.pipelineIdentification,
|
|
6125
|
+
});
|
|
6126
|
+
resetAttemptExecutionState($ongoingTaskResult);
|
|
6127
|
+
try {
|
|
6128
|
+
await executeSingleAttempt({
|
|
6129
|
+
attempt,
|
|
6130
|
+
options,
|
|
6131
|
+
llmTools,
|
|
6132
|
+
$ongoingTaskResult,
|
|
6133
|
+
});
|
|
6134
|
+
break attempts;
|
|
6135
|
+
}
|
|
6136
|
+
catch (error) {
|
|
6137
|
+
if (!(error instanceof ExpectError)) {
|
|
6138
|
+
throw error;
|
|
6139
|
+
}
|
|
6140
|
+
recordFailedAttempt({
|
|
6141
|
+
error,
|
|
6142
|
+
attemptIndex,
|
|
6143
|
+
onProgress: options.onProgress,
|
|
6144
|
+
$ongoingTaskResult,
|
|
6145
|
+
});
|
|
6146
|
+
}
|
|
6147
|
+
finally {
|
|
6148
|
+
reportPromptExecution({
|
|
6149
|
+
attempt,
|
|
6150
|
+
task: options.task,
|
|
6151
|
+
$executionReport: options.$executionReport,
|
|
6152
|
+
logLlmCall: options.logLlmCall,
|
|
6153
|
+
$ongoingTaskResult,
|
|
6154
|
+
});
|
|
6155
|
+
}
|
|
6156
|
+
throwIfFinalAttemptFailed({
|
|
6157
|
+
attemptIndex,
|
|
6158
|
+
maxAttempts: options.maxAttempts,
|
|
6159
|
+
maxExecutionAttempts: options.maxExecutionAttempts,
|
|
6160
|
+
pipelineIdentification: options.pipelineIdentification,
|
|
6161
|
+
$ongoingTaskResult,
|
|
6162
|
+
});
|
|
6163
|
+
}
|
|
6164
|
+
return getSuccessfulResultString({
|
|
6165
|
+
pipelineIdentification: options.pipelineIdentification,
|
|
6166
|
+
$ongoingTaskResult,
|
|
6167
|
+
});
|
|
6168
|
+
}
|
|
6169
|
+
/**
|
|
6170
|
+
* Creates mutable attempt state for one task execution lifecycle.
|
|
6171
|
+
*/
|
|
6172
|
+
function createOngoingTaskResult() {
|
|
6173
|
+
return {
|
|
6121
6174
|
$result: null,
|
|
6122
6175
|
$resultString: null,
|
|
6123
6176
|
$expectError: null,
|
|
6124
6177
|
$scriptPipelineExecutionErrors: [],
|
|
6125
|
-
$failedResults: [],
|
|
6178
|
+
$failedResults: [],
|
|
6126
6179
|
};
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6180
|
+
}
|
|
6181
|
+
/**
|
|
6182
|
+
* Resolves the bookkeeping for one loop iteration, including joker lookup.
|
|
6183
|
+
*/
|
|
6184
|
+
function createAttemptDescriptor(options) {
|
|
6185
|
+
const { attemptIndex, jokerParameterNames, pipelineIdentification } = options;
|
|
6186
|
+
const isJokerAttempt = attemptIndex < 0;
|
|
6187
|
+
const jokerParameterName = isJokerAttempt
|
|
6188
|
+
? jokerParameterNames[jokerParameterNames.length + attemptIndex]
|
|
6189
|
+
: undefined;
|
|
6190
|
+
if (isJokerAttempt && !jokerParameterName) {
|
|
6191
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
6192
|
+
Joker not found in attempt ${attemptIndex}
|
|
6135
6193
|
|
|
6136
|
-
|
|
6194
|
+
${block(pipelineIdentification)}
|
|
6195
|
+
`));
|
|
6196
|
+
}
|
|
6197
|
+
return {
|
|
6198
|
+
attemptIndex,
|
|
6199
|
+
isJokerAttempt,
|
|
6200
|
+
jokerParameterName,
|
|
6201
|
+
};
|
|
6202
|
+
}
|
|
6203
|
+
/**
|
|
6204
|
+
* Clears the per-attempt result slots while preserving cumulative failure history.
|
|
6205
|
+
*/
|
|
6206
|
+
function resetAttemptExecutionState($ongoingTaskResult) {
|
|
6207
|
+
$ongoingTaskResult.$result = null;
|
|
6208
|
+
$ongoingTaskResult.$resultString = null;
|
|
6209
|
+
$ongoingTaskResult.$expectError = null;
|
|
6210
|
+
}
|
|
6211
|
+
/**
|
|
6212
|
+
* Executes one loop iteration, from joker resolution or task execution through validation.
|
|
6213
|
+
*/
|
|
6214
|
+
async function executeSingleAttempt(options) {
|
|
6215
|
+
const { attempt, options: executeAttemptsOptions, llmTools, $ongoingTaskResult } = options;
|
|
6216
|
+
if (attempt.isJokerAttempt) {
|
|
6217
|
+
resolveJokerAttemptResult({
|
|
6218
|
+
jokerParameterName: attempt.jokerParameterName,
|
|
6219
|
+
parameters: executeAttemptsOptions.parameters,
|
|
6220
|
+
pipelineIdentification: executeAttemptsOptions.pipelineIdentification,
|
|
6221
|
+
$ongoingTaskResult,
|
|
6222
|
+
});
|
|
6223
|
+
}
|
|
6224
|
+
else {
|
|
6225
|
+
await executeTaskAttempt({
|
|
6226
|
+
options: executeAttemptsOptions,
|
|
6227
|
+
llmTools,
|
|
6228
|
+
$ongoingTaskResult,
|
|
6229
|
+
});
|
|
6230
|
+
await applyPostprocessingFunctions({
|
|
6231
|
+
task: executeAttemptsOptions.task,
|
|
6232
|
+
tools: executeAttemptsOptions.tools,
|
|
6233
|
+
$ongoingTaskResult,
|
|
6234
|
+
});
|
|
6235
|
+
}
|
|
6236
|
+
validateAttemptResult({
|
|
6237
|
+
task: executeAttemptsOptions.task,
|
|
6238
|
+
$ongoingTaskResult,
|
|
6239
|
+
});
|
|
6240
|
+
}
|
|
6241
|
+
/**
|
|
6242
|
+
* Resolves the shortcut value used by a joker attempt.
|
|
6243
|
+
*/
|
|
6244
|
+
function resolveJokerAttemptResult(options) {
|
|
6245
|
+
const { jokerParameterName, parameters, pipelineIdentification, $ongoingTaskResult } = options;
|
|
6246
|
+
if (parameters[jokerParameterName] === undefined) {
|
|
6247
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6248
|
+
Joker parameter {${jokerParameterName}} not defined
|
|
6249
|
+
|
|
6250
|
+
${block(pipelineIdentification)}
|
|
6251
|
+
`));
|
|
6252
|
+
// <- TODO: This is maybe `PipelineLogicError` which should be detected in `validatePipeline` and here just thrown as `UnexpectedError`
|
|
6253
|
+
}
|
|
6254
|
+
$ongoingTaskResult.$resultString = parameters[jokerParameterName];
|
|
6255
|
+
}
|
|
6256
|
+
/**
|
|
6257
|
+
* Dispatches non-joker execution to the handler for the current task type.
|
|
6258
|
+
*/
|
|
6259
|
+
async function executeTaskAttempt(options) {
|
|
6260
|
+
const { options: executeAttemptsOptions, llmTools, $ongoingTaskResult } = options;
|
|
6261
|
+
const { task } = executeAttemptsOptions;
|
|
6262
|
+
switch (task.taskType) {
|
|
6263
|
+
case 'SIMPLE_TASK':
|
|
6264
|
+
executeSimpleTaskAttempt({
|
|
6265
|
+
preparedContent: executeAttemptsOptions.preparedContent,
|
|
6266
|
+
parameters: executeAttemptsOptions.parameters,
|
|
6267
|
+
$ongoingTaskResult,
|
|
6268
|
+
});
|
|
6269
|
+
return;
|
|
6270
|
+
case 'PROMPT_TASK':
|
|
6271
|
+
await executePromptTaskAttempt({
|
|
6272
|
+
preparedPipeline: executeAttemptsOptions.preparedPipeline,
|
|
6273
|
+
task,
|
|
6274
|
+
parameters: executeAttemptsOptions.parameters,
|
|
6275
|
+
preparedContent: executeAttemptsOptions.preparedContent,
|
|
6276
|
+
pipelineIdentification: executeAttemptsOptions.pipelineIdentification,
|
|
6277
|
+
llmTools,
|
|
6278
|
+
$ongoingTaskResult,
|
|
6279
|
+
});
|
|
6280
|
+
return;
|
|
6281
|
+
case 'SCRIPT_TASK':
|
|
6282
|
+
await executeScriptTaskAttempt({
|
|
6283
|
+
tools: executeAttemptsOptions.tools,
|
|
6284
|
+
task,
|
|
6285
|
+
preparedContent: executeAttemptsOptions.preparedContent,
|
|
6286
|
+
parameters: executeAttemptsOptions.parameters,
|
|
6287
|
+
pipelineIdentification: executeAttemptsOptions.pipelineIdentification,
|
|
6288
|
+
$ongoingTaskResult,
|
|
6289
|
+
});
|
|
6290
|
+
return;
|
|
6291
|
+
case 'DIALOG_TASK':
|
|
6292
|
+
await executeDialogTaskAttempt({
|
|
6293
|
+
tools: executeAttemptsOptions.tools,
|
|
6294
|
+
task,
|
|
6295
|
+
parameters: executeAttemptsOptions.parameters,
|
|
6296
|
+
preparedContent: executeAttemptsOptions.preparedContent,
|
|
6297
|
+
priority: executeAttemptsOptions.priority,
|
|
6298
|
+
pipelineIdentification: executeAttemptsOptions.pipelineIdentification,
|
|
6299
|
+
$ongoingTaskResult,
|
|
6300
|
+
});
|
|
6301
|
+
return;
|
|
6302
|
+
default:
|
|
6303
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6304
|
+
Unknown execution type "${task.taskType}"
|
|
6305
|
+
|
|
6306
|
+
${block(executeAttemptsOptions.pipelineIdentification)}
|
|
6137
6307
|
`));
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6308
|
+
}
|
|
6309
|
+
}
|
|
6310
|
+
/**
|
|
6311
|
+
* Executes a simple templated task with no external tools.
|
|
6312
|
+
*/
|
|
6313
|
+
function executeSimpleTaskAttempt(options) {
|
|
6314
|
+
const { preparedContent, parameters, $ongoingTaskResult } = options;
|
|
6315
|
+
$ongoingTaskResult.$resultString = templateParameters(preparedContent, parameters);
|
|
6316
|
+
}
|
|
6317
|
+
/**
|
|
6318
|
+
* Builds the prompt for a prompt task and calls the appropriate LLM variant.
|
|
6319
|
+
*/
|
|
6320
|
+
async function executePromptTaskAttempt(options) {
|
|
6321
|
+
const { preparedPipeline, task, parameters, preparedContent, pipelineIdentification, llmTools, $ongoingTaskResult, } = options;
|
|
6322
|
+
const modelRequirements = {
|
|
6323
|
+
modelVariant: 'CHAT',
|
|
6324
|
+
...(preparedPipeline.defaultModelRequirements || {}),
|
|
6325
|
+
...(task.modelRequirements || {}),
|
|
6326
|
+
}; /* <- Note: [π€] */
|
|
6327
|
+
$ongoingTaskResult.$prompt = {
|
|
6328
|
+
title: task.title,
|
|
6329
|
+
pipelineUrl: `${preparedPipeline.pipelineUrl ? preparedPipeline.pipelineUrl : 'anonymous'}#${task.name
|
|
6330
|
+
// <- TODO: Here should be maybe also subformat index to distinguish between same task with different subformat values
|
|
6331
|
+
}`,
|
|
6332
|
+
parameters,
|
|
6333
|
+
content: preparedContent,
|
|
6334
|
+
modelRequirements,
|
|
6335
|
+
expectations: {
|
|
6336
|
+
...(preparedPipeline.personas.find(({ name }) => name === task.personaName) || {}),
|
|
6337
|
+
...task.expectations,
|
|
6338
|
+
},
|
|
6339
|
+
format: task.format,
|
|
6340
|
+
postprocessingFunctionNames: task.postprocessingFunctionNames,
|
|
6341
|
+
}; // <- TODO: Not very good type guard
|
|
6342
|
+
switch (modelRequirements.modelVariant) {
|
|
6343
|
+
case 'CHAT':
|
|
6344
|
+
$ongoingTaskResult.$chatResult = await llmTools.callChatModel(
|
|
6345
|
+
// <- TODO: [π§] Check that `callChatModel` is defined
|
|
6346
|
+
$deepFreeze($ongoingTaskResult.$prompt));
|
|
6347
|
+
// TODO: [π¬] Destroy chatThread
|
|
6348
|
+
$ongoingTaskResult.$result = $ongoingTaskResult.$chatResult;
|
|
6349
|
+
$ongoingTaskResult.$resultString = $ongoingTaskResult.$chatResult.content;
|
|
6350
|
+
return;
|
|
6351
|
+
case 'COMPLETION':
|
|
6352
|
+
$ongoingTaskResult.$completionResult = await llmTools.callCompletionModel(
|
|
6353
|
+
// <- TODO: [π§] Check that `callCompletionModel` is defined
|
|
6354
|
+
$deepFreeze($ongoingTaskResult.$prompt));
|
|
6355
|
+
$ongoingTaskResult.$result = $ongoingTaskResult.$completionResult;
|
|
6356
|
+
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
6357
|
+
return;
|
|
6358
|
+
case 'EMBEDDING':
|
|
6359
|
+
case 'IMAGE_GENERATION':
|
|
6360
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6361
|
+
${modelRequirements.modelVariant} model can not be used in pipeline
|
|
6146
6362
|
|
|
6147
|
-
|
|
6148
|
-
`));
|
|
6149
|
-
// <- TODO: This is maybe `PipelineLogicError` which should be detected in `validatePipeline` and here just thrown as `UnexpectedError`
|
|
6150
|
-
}
|
|
6151
|
-
else {
|
|
6152
|
-
$ongoingTaskResult.$resultString = parameters[jokerParameterName];
|
|
6153
|
-
}
|
|
6154
|
-
}
|
|
6155
|
-
try {
|
|
6156
|
-
if (!isJokerAttempt) {
|
|
6157
|
-
taskType: switch (task.taskType) {
|
|
6158
|
-
case 'SIMPLE_TASK':
|
|
6159
|
-
$ongoingTaskResult.$resultString = templateParameters(preparedContent, parameters);
|
|
6160
|
-
break taskType;
|
|
6161
|
-
case 'PROMPT_TASK':
|
|
6162
|
-
{
|
|
6163
|
-
const modelRequirements = {
|
|
6164
|
-
modelVariant: 'CHAT',
|
|
6165
|
-
...(preparedPipeline.defaultModelRequirements || {}),
|
|
6166
|
-
...(task.modelRequirements || {}),
|
|
6167
|
-
}; /* <- Note: [π€] */
|
|
6168
|
-
$ongoingTaskResult.$prompt = {
|
|
6169
|
-
title: task.title,
|
|
6170
|
-
pipelineUrl: `${preparedPipeline.pipelineUrl
|
|
6171
|
-
? preparedPipeline.pipelineUrl
|
|
6172
|
-
: 'anonymous' /* <- TODO: [π§ ] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */}#${task.name
|
|
6173
|
-
// <- TODO: Here should be maybe also subformat index to distinguish between same task with different subformat values
|
|
6174
|
-
}`,
|
|
6175
|
-
parameters,
|
|
6176
|
-
content: preparedContent,
|
|
6177
|
-
modelRequirements,
|
|
6178
|
-
expectations: {
|
|
6179
|
-
...(preparedPipeline.personas.find(({ name }) => name === task.personaName) || {}),
|
|
6180
|
-
...task.expectations,
|
|
6181
|
-
},
|
|
6182
|
-
format: task.format,
|
|
6183
|
-
postprocessingFunctionNames: task.postprocessingFunctionNames,
|
|
6184
|
-
}; // <- TODO: Not very good type guard
|
|
6185
|
-
variant: switch (modelRequirements.modelVariant) {
|
|
6186
|
-
case 'CHAT':
|
|
6187
|
-
$ongoingTaskResult.$chatResult = await llmTools.callChatModel(
|
|
6188
|
-
// <- TODO: [π§] Check that `callChatModel` is defined
|
|
6189
|
-
$deepFreeze($ongoingTaskResult.$prompt));
|
|
6190
|
-
// TODO: [π¬] Destroy chatThread
|
|
6191
|
-
$ongoingTaskResult.$result = $ongoingTaskResult.$chatResult;
|
|
6192
|
-
$ongoingTaskResult.$resultString = $ongoingTaskResult.$chatResult.content;
|
|
6193
|
-
break variant;
|
|
6194
|
-
case 'COMPLETION':
|
|
6195
|
-
$ongoingTaskResult.$completionResult = await llmTools.callCompletionModel(
|
|
6196
|
-
// <- TODO: [π§] Check that `callCompletionModel` is defined
|
|
6197
|
-
$deepFreeze($ongoingTaskResult.$prompt));
|
|
6198
|
-
$ongoingTaskResult.$result = $ongoingTaskResult.$completionResult;
|
|
6199
|
-
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
6200
|
-
break variant;
|
|
6201
|
-
case 'EMBEDDING':
|
|
6202
|
-
case 'IMAGE_GENERATION':
|
|
6203
|
-
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6204
|
-
${modelRequirements.modelVariant} model can not be used in pipeline
|
|
6205
|
-
|
|
6206
|
-
This should be catched during parsing
|
|
6207
|
-
|
|
6208
|
-
${block(pipelineIdentification)}
|
|
6209
|
-
|
|
6210
|
-
`));
|
|
6211
|
-
break variant;
|
|
6212
|
-
// <- case [π€]:
|
|
6213
|
-
default:
|
|
6214
|
-
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6215
|
-
Unknown model variant "${task.modelRequirements.modelVariant}"
|
|
6216
|
-
|
|
6217
|
-
${block(pipelineIdentification)}
|
|
6218
|
-
|
|
6219
|
-
`));
|
|
6220
|
-
}
|
|
6221
|
-
}
|
|
6222
|
-
break;
|
|
6223
|
-
case 'SCRIPT_TASK':
|
|
6224
|
-
if (arrayableToArray(tools.script).length === 0) {
|
|
6225
|
-
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6226
|
-
No script execution tools are available
|
|
6363
|
+
This should be catched during parsing
|
|
6227
6364
|
|
|
6228
|
-
|
|
6229
|
-
`));
|
|
6230
|
-
}
|
|
6231
|
-
if (!task.contentLanguage) {
|
|
6232
|
-
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6233
|
-
Script language is not defined for SCRIPT TASK "${task.name}"
|
|
6365
|
+
${block(pipelineIdentification)}
|
|
6234
6366
|
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
try {
|
|
6241
|
-
$ongoingTaskResult.$resultString = await scriptTools.execute($deepFreeze({
|
|
6242
|
-
scriptLanguage: task.contentLanguage,
|
|
6243
|
-
script: preparedContent,
|
|
6244
|
-
parameters,
|
|
6245
|
-
}));
|
|
6246
|
-
break scripts;
|
|
6247
|
-
}
|
|
6248
|
-
catch (error) {
|
|
6249
|
-
assertsError(error);
|
|
6250
|
-
if (error instanceof UnexpectedError) {
|
|
6251
|
-
throw error;
|
|
6252
|
-
}
|
|
6253
|
-
$ongoingTaskResult.$scriptPipelineExecutionErrors.push(error);
|
|
6254
|
-
}
|
|
6255
|
-
}
|
|
6256
|
-
if ($ongoingTaskResult.$resultString !== null) {
|
|
6257
|
-
break taskType;
|
|
6258
|
-
}
|
|
6259
|
-
if ($ongoingTaskResult.$scriptPipelineExecutionErrors.length === 1) {
|
|
6260
|
-
throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
6261
|
-
}
|
|
6262
|
-
else {
|
|
6263
|
-
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6264
|
-
Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
|
|
6367
|
+
`));
|
|
6368
|
+
// <- case [π€]:
|
|
6369
|
+
default:
|
|
6370
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6371
|
+
Unknown model variant "${task.modelRequirements.modelVariant}"
|
|
6265
6372
|
|
|
6266
|
-
|
|
6373
|
+
${block(pipelineIdentification)}
|
|
6267
6374
|
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6375
|
+
`));
|
|
6376
|
+
}
|
|
6377
|
+
}
|
|
6378
|
+
/**
|
|
6379
|
+
* Executes a script task with the first script tool that succeeds.
|
|
6380
|
+
*/
|
|
6381
|
+
async function executeScriptTaskAttempt(options) {
|
|
6382
|
+
const { tools, task, preparedContent, parameters, pipelineIdentification, $ongoingTaskResult } = options;
|
|
6383
|
+
const scriptExecutionTools = arrayableToArray(tools.script);
|
|
6384
|
+
if (scriptExecutionTools.length === 0) {
|
|
6385
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6386
|
+
No script execution tools are available
|
|
6279
6387
|
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
promptMessage: templateParameters(task.description || '', parameters),
|
|
6287
|
-
defaultValue: templateParameters(preparedContent, parameters),
|
|
6288
|
-
// TODO: [π§ ] Figure out how to define placeholder in .book.md file
|
|
6289
|
-
placeholder: undefined,
|
|
6290
|
-
priority,
|
|
6291
|
-
}));
|
|
6292
|
-
break taskType;
|
|
6293
|
-
// <- case: [π
±]
|
|
6294
|
-
default:
|
|
6295
|
-
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6296
|
-
Unknown execution type "${task.taskType}"
|
|
6388
|
+
${block(pipelineIdentification)}
|
|
6389
|
+
`));
|
|
6390
|
+
}
|
|
6391
|
+
if (!task.contentLanguage) {
|
|
6392
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6393
|
+
Script language is not defined for SCRIPT TASK "${task.name}"
|
|
6297
6394
|
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
script: `${functionName}(resultString)`,
|
|
6310
|
-
parameters: {
|
|
6311
|
-
resultString: $ongoingTaskResult.$resultString || '',
|
|
6312
|
-
// Note: No ...parametersForTask, because working with result only
|
|
6313
|
-
},
|
|
6314
|
-
});
|
|
6315
|
-
postprocessingError = null;
|
|
6316
|
-
break scripts;
|
|
6317
|
-
}
|
|
6318
|
-
catch (error) {
|
|
6319
|
-
assertsError(error);
|
|
6320
|
-
if (error instanceof UnexpectedError) {
|
|
6321
|
-
throw error;
|
|
6322
|
-
}
|
|
6323
|
-
postprocessingError = error;
|
|
6324
|
-
$ongoingTaskResult.$scriptPipelineExecutionErrors.push(error);
|
|
6325
|
-
}
|
|
6326
|
-
}
|
|
6327
|
-
if (postprocessingError) {
|
|
6328
|
-
throw postprocessingError;
|
|
6329
|
-
}
|
|
6330
|
-
}
|
|
6331
|
-
}
|
|
6332
|
-
// TODO: [π] Unite object for expecting amount and format
|
|
6333
|
-
// Use the common validation function for both format and expectations
|
|
6334
|
-
if (task.format || task.expectations) {
|
|
6335
|
-
const validationResult = validatePromptResult({
|
|
6336
|
-
resultString: $ongoingTaskResult.$resultString || '',
|
|
6337
|
-
expectations: task.expectations,
|
|
6338
|
-
format: task.format,
|
|
6339
|
-
});
|
|
6340
|
-
if (!validationResult.isValid) {
|
|
6341
|
-
throw validationResult.error;
|
|
6342
|
-
}
|
|
6343
|
-
// Update the result string in case format processing modified it (e.g., JSON extraction)
|
|
6344
|
-
$ongoingTaskResult.$resultString = validationResult.processedResultString;
|
|
6345
|
-
}
|
|
6346
|
-
break attempts;
|
|
6395
|
+
${block(pipelineIdentification)}
|
|
6396
|
+
`));
|
|
6397
|
+
}
|
|
6398
|
+
for (const scriptTools of scriptExecutionTools) {
|
|
6399
|
+
try {
|
|
6400
|
+
$ongoingTaskResult.$resultString = await scriptTools.execute($deepFreeze({
|
|
6401
|
+
scriptLanguage: task.contentLanguage,
|
|
6402
|
+
script: preparedContent,
|
|
6403
|
+
parameters,
|
|
6404
|
+
}));
|
|
6405
|
+
return;
|
|
6347
6406
|
}
|
|
6348
6407
|
catch (error) {
|
|
6349
|
-
|
|
6408
|
+
assertsError(error);
|
|
6409
|
+
if (error instanceof UnexpectedError) {
|
|
6350
6410
|
throw error;
|
|
6351
6411
|
}
|
|
6352
|
-
$ongoingTaskResult.$
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6412
|
+
$ongoingTaskResult.$scriptPipelineExecutionErrors.push(error);
|
|
6413
|
+
}
|
|
6414
|
+
}
|
|
6415
|
+
throw createScriptExecutionFailure({
|
|
6416
|
+
pipelineIdentification,
|
|
6417
|
+
$ongoingTaskResult,
|
|
6418
|
+
});
|
|
6419
|
+
}
|
|
6420
|
+
/**
|
|
6421
|
+
* Creates the final script-task error after all script tools have failed.
|
|
6422
|
+
*/
|
|
6423
|
+
function createScriptExecutionFailure(options) {
|
|
6424
|
+
const { pipelineIdentification, $ongoingTaskResult } = options;
|
|
6425
|
+
if ($ongoingTaskResult.$scriptPipelineExecutionErrors.length === 1) {
|
|
6426
|
+
return $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
6427
|
+
}
|
|
6428
|
+
return new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6429
|
+
Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
|
|
6430
|
+
|
|
6431
|
+
${block(pipelineIdentification)}
|
|
6432
|
+
|
|
6433
|
+
${block($ongoingTaskResult.$scriptPipelineExecutionErrors.map((error) => '- ' + error.message).join('\n\n'))}
|
|
6434
|
+
`));
|
|
6435
|
+
}
|
|
6436
|
+
/**
|
|
6437
|
+
* Executes a dialog task through the configured user-interface tools.
|
|
6438
|
+
*/
|
|
6439
|
+
async function executeDialogTaskAttempt(options) {
|
|
6440
|
+
const { tools, task, parameters, preparedContent, priority, pipelineIdentification, $ongoingTaskResult } = options;
|
|
6441
|
+
if (tools.userInterface === undefined) {
|
|
6442
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6443
|
+
User interface tools are not available
|
|
6444
|
+
|
|
6445
|
+
${block(pipelineIdentification)}
|
|
6446
|
+
`));
|
|
6447
|
+
}
|
|
6448
|
+
// TODO: [πΉ] When making next attempt for `DIALOG TASK`, preserve the previous user input
|
|
6449
|
+
$ongoingTaskResult.$resultString = await tools.userInterface.promptDialog($deepFreeze({
|
|
6450
|
+
promptTitle: task.title,
|
|
6451
|
+
promptMessage: templateParameters(task.description || '', parameters),
|
|
6452
|
+
defaultValue: templateParameters(preparedContent, parameters),
|
|
6453
|
+
// TODO: [π§ ] Figure out how to define placeholder in .book.md file
|
|
6454
|
+
placeholder: undefined,
|
|
6455
|
+
priority,
|
|
6456
|
+
}));
|
|
6457
|
+
}
|
|
6458
|
+
/**
|
|
6459
|
+
* Runs all configured postprocessing functions in order.
|
|
6460
|
+
*/
|
|
6461
|
+
async function applyPostprocessingFunctions(options) {
|
|
6462
|
+
const { task } = options;
|
|
6463
|
+
if (!task.postprocessingFunctionNames) {
|
|
6464
|
+
return;
|
|
6465
|
+
}
|
|
6466
|
+
for (const functionName of task.postprocessingFunctionNames) {
|
|
6467
|
+
await executePostprocessingFunction({
|
|
6468
|
+
functionName,
|
|
6469
|
+
tools: options.tools,
|
|
6470
|
+
$ongoingTaskResult: options.$ongoingTaskResult,
|
|
6471
|
+
});
|
|
6472
|
+
}
|
|
6473
|
+
}
|
|
6474
|
+
/**
|
|
6475
|
+
* Executes one postprocessing function against the current result string.
|
|
6476
|
+
*/
|
|
6477
|
+
async function executePostprocessingFunction(options) {
|
|
6478
|
+
const { functionName, tools, $ongoingTaskResult } = options;
|
|
6479
|
+
let postprocessingError = null;
|
|
6480
|
+
for (const scriptTools of arrayableToArray(tools.script)) {
|
|
6481
|
+
try {
|
|
6482
|
+
$ongoingTaskResult.$resultString = await scriptTools.execute({
|
|
6483
|
+
scriptLanguage: `javascript` /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
|
|
6484
|
+
script: `${functionName}(resultString)`,
|
|
6485
|
+
parameters: {
|
|
6486
|
+
resultString: $ongoingTaskResult.$resultString || '',
|
|
6487
|
+
// Note: No ...parametersForTask, because working with result only
|
|
6488
|
+
},
|
|
6365
6489
|
});
|
|
6490
|
+
postprocessingError = null;
|
|
6491
|
+
return;
|
|
6366
6492
|
}
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
const executionPromptReport = {
|
|
6372
|
-
prompt: {
|
|
6373
|
-
...$ongoingTaskResult.$prompt,
|
|
6374
|
-
// <- TODO: [π§ ] How to pick everyhing except `pipelineUrl`
|
|
6375
|
-
},
|
|
6376
|
-
result: $ongoingTaskResult.$result || undefined,
|
|
6377
|
-
error: $ongoingTaskResult.$expectError === null
|
|
6378
|
-
? undefined
|
|
6379
|
-
: serializeError($ongoingTaskResult.$expectError),
|
|
6380
|
-
};
|
|
6381
|
-
$executionReport.promptExecutions.push(executionPromptReport);
|
|
6382
|
-
if (logLlmCall) {
|
|
6383
|
-
logLlmCall({
|
|
6384
|
-
modelName: 'model' /* <- TODO: How to get model name from the report */,
|
|
6385
|
-
report: executionPromptReport,
|
|
6386
|
-
});
|
|
6387
|
-
}
|
|
6493
|
+
catch (error) {
|
|
6494
|
+
assertsError(error);
|
|
6495
|
+
if (error instanceof UnexpectedError) {
|
|
6496
|
+
throw error;
|
|
6388
6497
|
}
|
|
6498
|
+
postprocessingError = error;
|
|
6499
|
+
$ongoingTaskResult.$scriptPipelineExecutionErrors.push(error);
|
|
6389
6500
|
}
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6501
|
+
}
|
|
6502
|
+
if (postprocessingError) {
|
|
6503
|
+
throw postprocessingError;
|
|
6504
|
+
}
|
|
6505
|
+
}
|
|
6506
|
+
/**
|
|
6507
|
+
* Validates the current result string against expectations and format constraints.
|
|
6508
|
+
*/
|
|
6509
|
+
function validateAttemptResult(options) {
|
|
6510
|
+
const { task, $ongoingTaskResult } = options;
|
|
6511
|
+
if (!task.format && !task.expectations) {
|
|
6512
|
+
return;
|
|
6513
|
+
}
|
|
6514
|
+
// TODO: [π] Unite object for expecting amount and format
|
|
6515
|
+
// Use the common validation function for both format and expectations
|
|
6516
|
+
const validationResult = validatePromptResult({
|
|
6517
|
+
resultString: $ongoingTaskResult.$resultString || '',
|
|
6518
|
+
expectations: task.expectations,
|
|
6519
|
+
format: task.format,
|
|
6520
|
+
});
|
|
6521
|
+
if (!validationResult.isValid) {
|
|
6522
|
+
throw validationResult.error;
|
|
6523
|
+
}
|
|
6524
|
+
// Update the result string in case format processing modified it (e.g., JSON extraction)
|
|
6525
|
+
$ongoingTaskResult.$resultString = validationResult.processedResultString;
|
|
6526
|
+
}
|
|
6527
|
+
/**
|
|
6528
|
+
* Stores one failed attempt and reports the expectation error upstream.
|
|
6529
|
+
*/
|
|
6530
|
+
function recordFailedAttempt(options) {
|
|
6531
|
+
const { error, attemptIndex, onProgress, $ongoingTaskResult } = options;
|
|
6532
|
+
$ongoingTaskResult.$expectError = error;
|
|
6533
|
+
$ongoingTaskResult.$failedResults.push({
|
|
6534
|
+
attemptIndex,
|
|
6535
|
+
result: $ongoingTaskResult.$resultString,
|
|
6536
|
+
error,
|
|
6537
|
+
});
|
|
6538
|
+
onProgress({
|
|
6539
|
+
errors: [error],
|
|
6540
|
+
});
|
|
6541
|
+
}
|
|
6542
|
+
/**
|
|
6543
|
+
* Appends the prompt execution report for prompt-task attempts.
|
|
6544
|
+
*/
|
|
6545
|
+
function reportPromptExecution(options) {
|
|
6546
|
+
const { attempt, task, $executionReport, logLlmCall, $ongoingTaskResult } = options;
|
|
6547
|
+
if (attempt.isJokerAttempt || task.taskType !== 'PROMPT_TASK' || !$ongoingTaskResult.$prompt) {
|
|
6548
|
+
return;
|
|
6549
|
+
}
|
|
6550
|
+
// Note: [2] When some expected parameter is not defined, error will occur in templateParameters
|
|
6551
|
+
// In that case we donβt want to make a report about it because itβs not a llm execution error
|
|
6552
|
+
const executionPromptReport = {
|
|
6553
|
+
prompt: {
|
|
6554
|
+
...$ongoingTaskResult.$prompt,
|
|
6555
|
+
// <- TODO: [π§ ] How to pick everyhing except `pipelineUrl`
|
|
6556
|
+
},
|
|
6557
|
+
result: $ongoingTaskResult.$result || undefined,
|
|
6558
|
+
error: $ongoingTaskResult.$expectError === null ? undefined : serializeError($ongoingTaskResult.$expectError),
|
|
6559
|
+
};
|
|
6560
|
+
$executionReport.promptExecutions.push(executionPromptReport);
|
|
6561
|
+
if (logLlmCall) {
|
|
6562
|
+
logLlmCall({
|
|
6563
|
+
modelName: 'model' /* <- TODO: How to get model name from the report */,
|
|
6564
|
+
report: executionPromptReport,
|
|
6565
|
+
});
|
|
6566
|
+
}
|
|
6567
|
+
}
|
|
6568
|
+
/**
|
|
6569
|
+
* Throws the aggregated retry error after the last regular attempt fails expectations.
|
|
6570
|
+
*/
|
|
6571
|
+
function throwIfFinalAttemptFailed(options) {
|
|
6572
|
+
const { attemptIndex, maxAttempts, maxExecutionAttempts, pipelineIdentification, $ongoingTaskResult } = options;
|
|
6573
|
+
if ($ongoingTaskResult.$expectError === null || attemptIndex !== maxAttempts - 1) {
|
|
6574
|
+
return;
|
|
6575
|
+
}
|
|
6576
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => {
|
|
6577
|
+
var _a;
|
|
6578
|
+
return `
|
|
6579
|
+
LLM execution failed ${maxExecutionAttempts}x
|
|
6414
6580
|
|
|
6415
|
-
|
|
6581
|
+
${block(pipelineIdentification)}
|
|
6416
6582
|
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
.split(/\r?\n/)
|
|
6420
|
-
.map((line) => `> ${line}`)
|
|
6421
|
-
.join('\n'))}
|
|
6583
|
+
The Prompt:
|
|
6584
|
+
${block(quoteMultilineText(((_a = $ongoingTaskResult.$prompt) === null || _a === void 0 ? void 0 : _a.content) || ''))}
|
|
6422
6585
|
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6586
|
+
All Failed Attempts:
|
|
6587
|
+
${block(createFailuresSummary($ongoingTaskResult.$failedResults))}
|
|
6588
|
+
`;
|
|
6589
|
+
}));
|
|
6590
|
+
}
|
|
6591
|
+
/**
|
|
6592
|
+
* Renders the retry history into the aggregated final error body.
|
|
6593
|
+
*/
|
|
6594
|
+
function createFailuresSummary($failedResults) {
|
|
6595
|
+
return $failedResults
|
|
6596
|
+
.map((failure) => spaceTrim$1((block) => {
|
|
6597
|
+
var _a, _b;
|
|
6598
|
+
return `
|
|
6599
|
+
Attempt ${failure.attemptIndex + 1}:
|
|
6600
|
+
Error ${((_a = failure.error) === null || _a === void 0 ? void 0 : _a.name) || ''}:
|
|
6601
|
+
${block(quoteMultilineText(((_b = failure.error) === null || _b === void 0 ? void 0 : _b.message) || ''))}
|
|
6602
|
+
|
|
6603
|
+
Result:
|
|
6604
|
+
${block(failure.result === null ? 'null' : quoteMultilineText(spaceTrim$1(failure.result)))}
|
|
6605
|
+
`;
|
|
6606
|
+
}))
|
|
6607
|
+
.join('\n\n---\n\n');
|
|
6608
|
+
}
|
|
6609
|
+
/**
|
|
6610
|
+
* Formats multiline text as a quoted markdown block.
|
|
6611
|
+
*/
|
|
6612
|
+
function quoteMultilineText(text) {
|
|
6613
|
+
return text
|
|
6614
|
+
.split(/\r?\n/)
|
|
6615
|
+
.map((line) => `> ${line}`)
|
|
6616
|
+
.join('\n');
|
|
6617
|
+
}
|
|
6618
|
+
/**
|
|
6619
|
+
* Returns the successful result string or raises an unexpected internal-state error.
|
|
6620
|
+
*/
|
|
6621
|
+
function getSuccessfulResultString(options) {
|
|
6622
|
+
const { pipelineIdentification, $ongoingTaskResult } = options;
|
|
6429
6623
|
if ($ongoingTaskResult.$resultString === null) {
|
|
6430
6624
|
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
6431
6625
|
Something went wrong and prompt result is null
|
|
@@ -6435,7 +6629,6 @@ async function executeAttempts(options) {
|
|
|
6435
6629
|
}
|
|
6436
6630
|
return $ongoingTaskResult.$resultString;
|
|
6437
6631
|
}
|
|
6438
|
-
// TODO: Break into smaller functions
|
|
6439
6632
|
|
|
6440
6633
|
/**
|
|
6441
6634
|
* Executes a pipeline task that requires mapping or iterating over subvalues of a parameter (such as rows in a CSV).
|