@promptbook/pdf 0.98.0-3 โ 0.98.0-5
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 +2 -0
- package/esm/typings/src/_packages/openai.index.d.ts +2 -0
- package/esm/typings/src/_packages/wizard.index.d.ts +2 -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/register-constructor.d.ts +10 -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
|
@@ -15,6 +15,7 @@ import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/re
|
|
|
15
15
|
import { _OpenAiCompatibleMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
16
16
|
import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
|
|
17
17
|
import { _OpenAiAssistantRegistration } from '../llm-providers/openai/register-constructor';
|
|
18
|
+
import { _OpenAiCompatibleRegistration } from '../llm-providers/openai/register-constructor';
|
|
18
19
|
import { _BoilerplateScraperRegistration } from '../scrapers/_boilerplate/register-constructor';
|
|
19
20
|
import { _BoilerplateScraperMetadataRegistration } from '../scrapers/_boilerplate/register-metadata';
|
|
20
21
|
import { _LegacyDocumentScraperRegistration } from '../scrapers/document-legacy/register-constructor';
|
|
@@ -46,6 +47,7 @@ export { _OpenAiAssistantMetadataRegistration };
|
|
|
46
47
|
export { _OpenAiCompatibleMetadataRegistration };
|
|
47
48
|
export { _OpenAiRegistration };
|
|
48
49
|
export { _OpenAiAssistantRegistration };
|
|
50
|
+
export { _OpenAiCompatibleRegistration };
|
|
49
51
|
export { _BoilerplateScraperRegistration };
|
|
50
52
|
export { _BoilerplateScraperMetadataRegistration };
|
|
51
53
|
export { _LegacyDocumentScraperRegistration };
|
|
@@ -11,6 +11,7 @@ import { OpenAiExecutionTools } from '../llm-providers/openai/OpenAiExecutionToo
|
|
|
11
11
|
import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
|
|
12
12
|
import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
|
|
13
13
|
import { _OpenAiAssistantRegistration } from '../llm-providers/openai/register-constructor';
|
|
14
|
+
import { _OpenAiCompatibleRegistration } from '../llm-providers/openai/register-constructor';
|
|
14
15
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
15
16
|
export { createOpenAiAssistantExecutionTools };
|
|
16
17
|
export { createOpenAiCompatibleExecutionTools };
|
|
@@ -24,3 +25,4 @@ export { OpenAiExecutionTools };
|
|
|
24
25
|
export type { OpenAiExecutionToolsOptions };
|
|
25
26
|
export { _OpenAiRegistration };
|
|
26
27
|
export { _OpenAiAssistantRegistration };
|
|
28
|
+
export { _OpenAiCompatibleRegistration };
|
|
@@ -14,6 +14,7 @@ import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/re
|
|
|
14
14
|
import { _OpenAiCompatibleMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
15
15
|
import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
|
|
16
16
|
import { _OpenAiAssistantRegistration } from '../llm-providers/openai/register-constructor';
|
|
17
|
+
import { _OpenAiCompatibleRegistration } from '../llm-providers/openai/register-constructor';
|
|
17
18
|
import { _BoilerplateScraperRegistration } from '../scrapers/_boilerplate/register-constructor';
|
|
18
19
|
import { _BoilerplateScraperMetadataRegistration } from '../scrapers/_boilerplate/register-metadata';
|
|
19
20
|
import { _LegacyDocumentScraperRegistration } from '../scrapers/document-legacy/register-constructor';
|
|
@@ -45,6 +46,7 @@ export { _OpenAiAssistantMetadataRegistration };
|
|
|
45
46
|
export { _OpenAiCompatibleMetadataRegistration };
|
|
46
47
|
export { _OpenAiRegistration };
|
|
47
48
|
export { _OpenAiAssistantRegistration };
|
|
49
|
+
export { _OpenAiCompatibleRegistration };
|
|
48
50
|
export { _BoilerplateScraperRegistration };
|
|
49
51
|
export { _BoilerplateScraperMetadataRegistration };
|
|
50
52
|
export { _LegacyDocumentScraperRegistration };
|
|
@@ -176,7 +176,7 @@ export declare const DEFAULT_MAX_PARALLEL_COUNT = 5;
|
|
|
176
176
|
*
|
|
177
177
|
* @public exported from `@promptbook/core`
|
|
178
178
|
*/
|
|
179
|
-
export declare const DEFAULT_MAX_EXECUTION_ATTEMPTS =
|
|
179
|
+
export declare const DEFAULT_MAX_EXECUTION_ATTEMPTS = 3;
|
|
180
180
|
/**
|
|
181
181
|
* The maximum depth to which knowledge sources will be scraped when building a knowledge base.
|
|
182
182
|
* This prevents infinite recursion and limits resource usage.
|
|
@@ -45,4 +45,11 @@ export type $OngoingTaskResult = {
|
|
|
45
45
|
* List of errors encountered during script postprocessing or execution.
|
|
46
46
|
*/
|
|
47
47
|
$scriptPipelineExecutionErrors: Array<Error>;
|
|
48
|
+
/**
|
|
49
|
+
* Array of all failed attempts, storing both the result string and the error for each failure
|
|
50
|
+
*/
|
|
51
|
+
$failedResults: Array<{
|
|
52
|
+
result: string | null;
|
|
53
|
+
error: ExpectError;
|
|
54
|
+
}>;
|
|
48
55
|
};
|
|
@@ -19,6 +19,16 @@ export declare const _OpenAiRegistration: Registration;
|
|
|
19
19
|
* @public exported from `@promptbook/cli`
|
|
20
20
|
*/
|
|
21
21
|
export declare const _OpenAiAssistantRegistration: Registration;
|
|
22
|
+
/**
|
|
23
|
+
* Registration of the OpenAI Compatible provider
|
|
24
|
+
*
|
|
25
|
+
* Note: [๐] Configurations registrations are done in register-constructor.ts BUT constructor register-constructor.ts
|
|
26
|
+
*
|
|
27
|
+
* @public exported from `@promptbook/openai`
|
|
28
|
+
* @public exported from `@promptbook/wizard`
|
|
29
|
+
* @public exported from `@promptbook/cli`
|
|
30
|
+
*/
|
|
31
|
+
export declare const _OpenAiCompatibleRegistration: Registration;
|
|
22
32
|
/**
|
|
23
33
|
* Note: OpenAiCompatibleExecutionTools is an abstract class and cannot be registered directly.
|
|
24
34
|
* It serves as a base class for OpenAiExecutionTools and other compatible implementations.
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.98.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.98.0-4`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/pdf",
|
|
3
|
-
"version": "0.98.0-
|
|
3
|
+
"version": "0.98.0-5",
|
|
4
4
|
"description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"module": "./esm/index.es.js",
|
|
75
75
|
"typings": "./esm/typings/src/_packages/pdf.index.d.ts",
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@promptbook/core": "0.98.0-
|
|
77
|
+
"@promptbook/core": "0.98.0-5"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"crypto": "1.0.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.98.0-
|
|
28
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.98.0-5';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
*
|
|
175
175
|
* @public exported from `@promptbook/core`
|
|
176
176
|
*/
|
|
177
|
-
const DEFAULT_MAX_EXECUTION_ATTEMPTS =
|
|
177
|
+
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [๐คนโโ๏ธ]
|
|
178
178
|
// <- TODO: [๐] Make also `BOOKS_DIRNAME_ALTERNATIVES`
|
|
179
179
|
// TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
|
|
180
180
|
/**
|
|
@@ -4837,6 +4837,7 @@
|
|
|
4837
4837
|
$resultString: null,
|
|
4838
4838
|
$expectError: null,
|
|
4839
4839
|
$scriptPipelineExecutionErrors: [],
|
|
4840
|
+
$failedResults: [], // Track all failed attempts
|
|
4840
4841
|
};
|
|
4841
4842
|
// TODO: [๐] Make arrayable LLMs -> single LLM DRY
|
|
4842
4843
|
const _llms = arrayableToArray(tools.llm);
|
|
@@ -5082,6 +5083,14 @@
|
|
|
5082
5083
|
throw error;
|
|
5083
5084
|
}
|
|
5084
5085
|
$ongoingTaskResult.$expectError = error;
|
|
5086
|
+
// Store each failed attempt
|
|
5087
|
+
if (!Array.isArray($ongoingTaskResult.$failedResults)) {
|
|
5088
|
+
$ongoingTaskResult.$failedResults = [];
|
|
5089
|
+
}
|
|
5090
|
+
$ongoingTaskResult.$failedResults.push({
|
|
5091
|
+
result: $ongoingTaskResult.$resultString,
|
|
5092
|
+
error: error,
|
|
5093
|
+
});
|
|
5085
5094
|
}
|
|
5086
5095
|
finally {
|
|
5087
5096
|
if (!isJokerAttempt &&
|
|
@@ -5104,34 +5113,46 @@
|
|
|
5104
5113
|
}
|
|
5105
5114
|
}
|
|
5106
5115
|
if ($ongoingTaskResult.$expectError !== null && attempt === maxAttempts - 1) {
|
|
5116
|
+
// Store the current failure before throwing
|
|
5117
|
+
$ongoingTaskResult.$failedResults = $ongoingTaskResult.$failedResults || [];
|
|
5118
|
+
$ongoingTaskResult.$failedResults.push({
|
|
5119
|
+
result: $ongoingTaskResult.$resultString,
|
|
5120
|
+
error: $ongoingTaskResult.$expectError,
|
|
5121
|
+
});
|
|
5122
|
+
// Create a summary of all failures
|
|
5123
|
+
const failuresSummary = $ongoingTaskResult.$failedResults
|
|
5124
|
+
.map((failure, index) => spaceTrim.spaceTrim((block) => {
|
|
5125
|
+
var _a, _b;
|
|
5126
|
+
return `
|
|
5127
|
+
Attempt ${index + 1}:
|
|
5128
|
+
Error ${((_a = failure.error) === null || _a === void 0 ? void 0 : _a.name) || ''}:
|
|
5129
|
+
${block((_b = failure.error) === null || _b === void 0 ? void 0 : _b.message.split('\n').map((line) => `> ${line}`).join('\n'))}
|
|
5130
|
+
|
|
5131
|
+
Result:
|
|
5132
|
+
${block(failure.result === null
|
|
5133
|
+
? 'null'
|
|
5134
|
+
: spaceTrim.spaceTrim(failure.result)
|
|
5135
|
+
.split('\n')
|
|
5136
|
+
.map((line) => `> ${line}`)
|
|
5137
|
+
.join('\n'))}
|
|
5138
|
+
`;
|
|
5139
|
+
}))
|
|
5140
|
+
.join('\n\n---\n\n');
|
|
5107
5141
|
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
|
|
5108
|
-
var _a
|
|
5142
|
+
var _a;
|
|
5109
5143
|
return `
|
|
5110
5144
|
LLM execution failed ${maxExecutionAttempts}x
|
|
5111
5145
|
|
|
5112
5146
|
${block(pipelineIdentification)}
|
|
5113
5147
|
|
|
5114
|
-
---
|
|
5115
5148
|
The Prompt:
|
|
5116
5149
|
${block((((_a = $ongoingTaskResult.$prompt) === null || _a === void 0 ? void 0 : _a.content) || '')
|
|
5117
5150
|
.split('\n')
|
|
5118
5151
|
.map((line) => `> ${line}`)
|
|
5119
5152
|
.join('\n'))}
|
|
5120
5153
|
|
|
5121
|
-
|
|
5122
|
-
${block(
|
|
5123
|
-
.split('\n')
|
|
5124
|
-
.map((line) => `> ${line}`)
|
|
5125
|
-
.join('\n'))}
|
|
5126
|
-
|
|
5127
|
-
Last result:
|
|
5128
|
-
${block($ongoingTaskResult.$resultString === null
|
|
5129
|
-
? 'null'
|
|
5130
|
-
: spaceTrim.spaceTrim($ongoingTaskResult.$resultString)
|
|
5131
|
-
.split('\n')
|
|
5132
|
-
.map((line) => `> ${line}`)
|
|
5133
|
-
.join('\n'))}
|
|
5134
|
-
---
|
|
5154
|
+
All Failed Attempts:
|
|
5155
|
+
${block(failuresSummary)}
|
|
5135
5156
|
`;
|
|
5136
5157
|
}));
|
|
5137
5158
|
}
|