@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 +39 -18
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/cli.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/openai.index.d.ts +6 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/_packages/wizard.index.d.ts +4 -0
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/$OngoingTaskResult.d.ts +7 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionToolsOptions.d.ts +11 -0
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +3 -5
- package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +17 -0
- package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +11 -0
- package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +14 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +39 -18
- package/umd/index.umd.js.map +1 -1
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-
|
|
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 =
|
|
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
|
|
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
|
-
|
|
5110
|
-
${block(
|
|
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
|
}
|