@promptbook/website-crawler 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
|
@@ -29,7 +29,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
29
29
|
* @generated
|
|
30
30
|
* @see https://github.com/webgptorg/promptbook
|
|
31
31
|
*/
|
|
32
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.98.0-
|
|
32
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.98.0-4';
|
|
33
33
|
/**
|
|
34
34
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
35
35
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -205,7 +205,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [๐คนโโ๏ธ]
|
|
|
205
205
|
*
|
|
206
206
|
* @public exported from `@promptbook/core`
|
|
207
207
|
*/
|
|
208
|
-
const DEFAULT_MAX_EXECUTION_ATTEMPTS =
|
|
208
|
+
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [๐คนโโ๏ธ]
|
|
209
209
|
// <- TODO: [๐] Make also `BOOKS_DIRNAME_ALTERNATIVES`
|
|
210
210
|
// TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
|
|
211
211
|
/**
|
|
@@ -4839,6 +4839,7 @@ async function executeAttempts(options) {
|
|
|
4839
4839
|
$resultString: null,
|
|
4840
4840
|
$expectError: null,
|
|
4841
4841
|
$scriptPipelineExecutionErrors: [],
|
|
4842
|
+
$failedResults: [], // Track all failed attempts
|
|
4842
4843
|
};
|
|
4843
4844
|
// TODO: [๐] Make arrayable LLMs -> single LLM DRY
|
|
4844
4845
|
const _llms = arrayableToArray(tools.llm);
|
|
@@ -5084,6 +5085,14 @@ async function executeAttempts(options) {
|
|
|
5084
5085
|
throw error;
|
|
5085
5086
|
}
|
|
5086
5087
|
$ongoingTaskResult.$expectError = error;
|
|
5088
|
+
// Store each failed attempt
|
|
5089
|
+
if (!Array.isArray($ongoingTaskResult.$failedResults)) {
|
|
5090
|
+
$ongoingTaskResult.$failedResults = [];
|
|
5091
|
+
}
|
|
5092
|
+
$ongoingTaskResult.$failedResults.push({
|
|
5093
|
+
result: $ongoingTaskResult.$resultString,
|
|
5094
|
+
error: error,
|
|
5095
|
+
});
|
|
5087
5096
|
}
|
|
5088
5097
|
finally {
|
|
5089
5098
|
if (!isJokerAttempt &&
|
|
@@ -5106,34 +5115,46 @@ async function executeAttempts(options) {
|
|
|
5106
5115
|
}
|
|
5107
5116
|
}
|
|
5108
5117
|
if ($ongoingTaskResult.$expectError !== null && attempt === maxAttempts - 1) {
|
|
5118
|
+
// Store the current failure before throwing
|
|
5119
|
+
$ongoingTaskResult.$failedResults = $ongoingTaskResult.$failedResults || [];
|
|
5120
|
+
$ongoingTaskResult.$failedResults.push({
|
|
5121
|
+
result: $ongoingTaskResult.$resultString,
|
|
5122
|
+
error: $ongoingTaskResult.$expectError,
|
|
5123
|
+
});
|
|
5124
|
+
// Create a summary of all failures
|
|
5125
|
+
const failuresSummary = $ongoingTaskResult.$failedResults
|
|
5126
|
+
.map((failure, index) => spaceTrim((block) => {
|
|
5127
|
+
var _a, _b;
|
|
5128
|
+
return `
|
|
5129
|
+
Attempt ${index + 1}:
|
|
5130
|
+
Error ${((_a = failure.error) === null || _a === void 0 ? void 0 : _a.name) || ''}:
|
|
5131
|
+
${block((_b = failure.error) === null || _b === void 0 ? void 0 : _b.message.split('\n').map((line) => `> ${line}`).join('\n'))}
|
|
5132
|
+
|
|
5133
|
+
Result:
|
|
5134
|
+
${block(failure.result === null
|
|
5135
|
+
? 'null'
|
|
5136
|
+
: spaceTrim(failure.result)
|
|
5137
|
+
.split('\n')
|
|
5138
|
+
.map((line) => `> ${line}`)
|
|
5139
|
+
.join('\n'))}
|
|
5140
|
+
`;
|
|
5141
|
+
}))
|
|
5142
|
+
.join('\n\n---\n\n');
|
|
5109
5143
|
throw new PipelineExecutionError(spaceTrim((block) => {
|
|
5110
|
-
var _a
|
|
5144
|
+
var _a;
|
|
5111
5145
|
return `
|
|
5112
5146
|
LLM execution failed ${maxExecutionAttempts}x
|
|
5113
5147
|
|
|
5114
5148
|
${block(pipelineIdentification)}
|
|
5115
5149
|
|
|
5116
|
-
---
|
|
5117
5150
|
The Prompt:
|
|
5118
5151
|
${block((((_a = $ongoingTaskResult.$prompt) === null || _a === void 0 ? void 0 : _a.content) || '')
|
|
5119
5152
|
.split('\n')
|
|
5120
5153
|
.map((line) => `> ${line}`)
|
|
5121
5154
|
.join('\n'))}
|
|
5122
5155
|
|
|
5123
|
-
|
|
5124
|
-
${block(
|
|
5125
|
-
.split('\n')
|
|
5126
|
-
.map((line) => `> ${line}`)
|
|
5127
|
-
.join('\n'))}
|
|
5128
|
-
|
|
5129
|
-
Last result:
|
|
5130
|
-
${block($ongoingTaskResult.$resultString === null
|
|
5131
|
-
? 'null'
|
|
5132
|
-
: spaceTrim($ongoingTaskResult.$resultString)
|
|
5133
|
-
.split('\n')
|
|
5134
|
-
.map((line) => `> ${line}`)
|
|
5135
|
-
.join('\n'))}
|
|
5136
|
-
---
|
|
5156
|
+
All Failed Attempts:
|
|
5157
|
+
${block(failuresSummary)}
|
|
5137
5158
|
`;
|
|
5138
5159
|
}));
|
|
5139
5160
|
}
|