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