@promptbook/markitdown 0.98.0-2 โ†’ 0.98.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/esm/index.es.js CHANGED
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
26
26
  * @generated
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- const PROMPTBOOK_ENGINE_VERSION = '0.98.0-2';
29
+ const PROMPTBOOK_ENGINE_VERSION = '0.98.0-4';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -175,7 +175,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
175
175
  *
176
176
  * @public exported from `@promptbook/core`
177
177
  */
178
- const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
178
+ const DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
179
179
  // <- TODO: [๐Ÿ•] Make also `BOOKS_DIRNAME_ALTERNATIVES`
180
180
  // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
181
181
  /**
@@ -4825,6 +4825,7 @@ async function executeAttempts(options) {
4825
4825
  $resultString: null,
4826
4826
  $expectError: null,
4827
4827
  $scriptPipelineExecutionErrors: [],
4828
+ $failedResults: [], // Track all failed attempts
4828
4829
  };
4829
4830
  // TODO: [๐Ÿš] Make arrayable LLMs -> single LLM DRY
4830
4831
  const _llms = arrayableToArray(tools.llm);
@@ -5070,6 +5071,14 @@ async function executeAttempts(options) {
5070
5071
  throw error;
5071
5072
  }
5072
5073
  $ongoingTaskResult.$expectError = error;
5074
+ // Store each failed attempt
5075
+ if (!Array.isArray($ongoingTaskResult.$failedResults)) {
5076
+ $ongoingTaskResult.$failedResults = [];
5077
+ }
5078
+ $ongoingTaskResult.$failedResults.push({
5079
+ result: $ongoingTaskResult.$resultString,
5080
+ error: error,
5081
+ });
5073
5082
  }
5074
5083
  finally {
5075
5084
  if (!isJokerAttempt &&
@@ -5092,34 +5101,46 @@ async function executeAttempts(options) {
5092
5101
  }
5093
5102
  }
5094
5103
  if ($ongoingTaskResult.$expectError !== null && attempt === maxAttempts - 1) {
5104
+ // Store the current failure before throwing
5105
+ $ongoingTaskResult.$failedResults = $ongoingTaskResult.$failedResults || [];
5106
+ $ongoingTaskResult.$failedResults.push({
5107
+ result: $ongoingTaskResult.$resultString,
5108
+ error: $ongoingTaskResult.$expectError,
5109
+ });
5110
+ // Create a summary of all failures
5111
+ const failuresSummary = $ongoingTaskResult.$failedResults
5112
+ .map((failure, index) => spaceTrim$1((block) => {
5113
+ var _a, _b;
5114
+ return `
5115
+ Attempt ${index + 1}:
5116
+ Error ${((_a = failure.error) === null || _a === void 0 ? void 0 : _a.name) || ''}:
5117
+ ${block((_b = failure.error) === null || _b === void 0 ? void 0 : _b.message.split('\n').map((line) => `> ${line}`).join('\n'))}
5118
+
5119
+ Result:
5120
+ ${block(failure.result === null
5121
+ ? 'null'
5122
+ : spaceTrim$1(failure.result)
5123
+ .split('\n')
5124
+ .map((line) => `> ${line}`)
5125
+ .join('\n'))}
5126
+ `;
5127
+ }))
5128
+ .join('\n\n---\n\n');
5095
5129
  throw new PipelineExecutionError(spaceTrim$1((block) => {
5096
- var _a, _b, _c;
5130
+ var _a;
5097
5131
  return `
5098
5132
  LLM execution failed ${maxExecutionAttempts}x
5099
5133
 
5100
5134
  ${block(pipelineIdentification)}
5101
5135
 
5102
- ---
5103
5136
  The Prompt:
5104
5137
  ${block((((_a = $ongoingTaskResult.$prompt) === null || _a === void 0 ? void 0 : _a.content) || '')
5105
5138
  .split('\n')
5106
5139
  .map((line) => `> ${line}`)
5107
5140
  .join('\n'))}
5108
5141
 
5109
- Last error ${((_b = $ongoingTaskResult.$expectError) === null || _b === void 0 ? void 0 : _b.name) || ''}:
5110
- ${block((((_c = $ongoingTaskResult.$expectError) === null || _c === void 0 ? void 0 : _c.message) || '')
5111
- .split('\n')
5112
- .map((line) => `> ${line}`)
5113
- .join('\n'))}
5114
-
5115
- Last result:
5116
- ${block($ongoingTaskResult.$resultString === null
5117
- ? 'null'
5118
- : spaceTrim$1($ongoingTaskResult.$resultString)
5119
- .split('\n')
5120
- .map((line) => `> ${line}`)
5121
- .join('\n'))}
5122
- ---
5142
+ All Failed Attempts:
5143
+ ${block(failuresSummary)}
5123
5144
  `;
5124
5145
  }));
5125
5146
  }