@promptbook/markdown-utils 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 +1 -1
- package/umd/index.umd.js +39 -18
- package/umd/index.umd.js.map +1 -1
|
@@ -12,8 +12,10 @@ import { _OllamaMetadataRegistration } from '../llm-providers/ollama/register-co
|
|
|
12
12
|
import { _OllamaRegistration } from '../llm-providers/ollama/register-constructor';
|
|
13
13
|
import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
14
14
|
import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
15
|
+
import { _OpenAiCompatibleMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
15
16
|
import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
|
|
16
17
|
import { _OpenAiAssistantRegistration } from '../llm-providers/openai/register-constructor';
|
|
18
|
+
import { _OpenAiCompatibleRegistration } from '../llm-providers/openai/register-constructor';
|
|
17
19
|
import { _BoilerplateScraperRegistration } from '../scrapers/_boilerplate/register-constructor';
|
|
18
20
|
import { _BoilerplateScraperMetadataRegistration } from '../scrapers/_boilerplate/register-metadata';
|
|
19
21
|
import { _LegacyDocumentScraperRegistration } from '../scrapers/document-legacy/register-constructor';
|
|
@@ -42,8 +44,10 @@ export { _OllamaMetadataRegistration };
|
|
|
42
44
|
export { _OllamaRegistration };
|
|
43
45
|
export { _OpenAiMetadataRegistration };
|
|
44
46
|
export { _OpenAiAssistantMetadataRegistration };
|
|
47
|
+
export { _OpenAiCompatibleMetadataRegistration };
|
|
45
48
|
export { _OpenAiRegistration };
|
|
46
49
|
export { _OpenAiAssistantRegistration };
|
|
50
|
+
export { _OpenAiCompatibleRegistration };
|
|
47
51
|
export { _BoilerplateScraperRegistration };
|
|
48
52
|
export { _BoilerplateScraperMetadataRegistration };
|
|
49
53
|
export { _LegacyDocumentScraperRegistration };
|
|
@@ -111,6 +111,7 @@ import { _GoogleMetadataRegistration } from '../llm-providers/google/register-co
|
|
|
111
111
|
import { _OllamaMetadataRegistration } from '../llm-providers/ollama/register-configuration';
|
|
112
112
|
import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
113
113
|
import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
114
|
+
import { _OpenAiCompatibleMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
114
115
|
import { migratePipeline } from '../migrations/migratePipeline';
|
|
115
116
|
import { preparePersona } from '../personas/preparePersona';
|
|
116
117
|
import { book } from '../pipeline/book-notation';
|
|
@@ -259,6 +260,7 @@ export { _GoogleMetadataRegistration };
|
|
|
259
260
|
export { _OllamaMetadataRegistration };
|
|
260
261
|
export { _OpenAiMetadataRegistration };
|
|
261
262
|
export { _OpenAiAssistantMetadataRegistration };
|
|
263
|
+
export { _OpenAiCompatibleMetadataRegistration };
|
|
262
264
|
export { migratePipeline };
|
|
263
265
|
export { preparePersona };
|
|
264
266
|
export { book };
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
|
|
2
2
|
import { createOpenAiAssistantExecutionTools } from '../llm-providers/openai/createOpenAiAssistantExecutionTools';
|
|
3
|
+
import { createOpenAiCompatibleExecutionTools } from '../llm-providers/openai/createOpenAiCompatibleExecutionTools';
|
|
3
4
|
import { createOpenAiExecutionTools } from '../llm-providers/openai/createOpenAiExecutionTools';
|
|
4
5
|
import { OPENAI_MODELS } from '../llm-providers/openai/openai-models';
|
|
5
6
|
import { OpenAiAssistantExecutionTools } from '../llm-providers/openai/OpenAiAssistantExecutionTools';
|
|
6
7
|
import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
|
|
7
8
|
import { OpenAiCompatibleExecutionTools } from '../llm-providers/openai/OpenAiCompatibleExecutionTools';
|
|
9
|
+
import type { OpenAiCompatibleExecutionToolsOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
|
|
8
10
|
import { OpenAiExecutionTools } from '../llm-providers/openai/OpenAiExecutionTools';
|
|
9
11
|
import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
|
|
10
12
|
import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
|
|
11
13
|
import { _OpenAiAssistantRegistration } from '../llm-providers/openai/register-constructor';
|
|
14
|
+
import { _OpenAiCompatibleRegistration } from '../llm-providers/openai/register-constructor';
|
|
12
15
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
13
16
|
export { createOpenAiAssistantExecutionTools };
|
|
17
|
+
export { createOpenAiCompatibleExecutionTools };
|
|
14
18
|
export { createOpenAiExecutionTools };
|
|
15
19
|
export { OPENAI_MODELS };
|
|
16
20
|
export { OpenAiAssistantExecutionTools };
|
|
17
21
|
export type { OpenAiAssistantExecutionToolsOptions };
|
|
18
22
|
export { OpenAiCompatibleExecutionTools };
|
|
23
|
+
export type { OpenAiCompatibleExecutionToolsOptions };
|
|
19
24
|
export { OpenAiExecutionTools };
|
|
20
25
|
export type { OpenAiExecutionToolsOptions };
|
|
21
26
|
export { _OpenAiRegistration };
|
|
22
27
|
export { _OpenAiAssistantRegistration };
|
|
28
|
+
export { _OpenAiCompatibleRegistration };
|
|
@@ -81,6 +81,7 @@ import type { DeepseekExecutionToolsOptions } from '../llm-providers/deepseek/De
|
|
|
81
81
|
import type { GoogleExecutionToolsOptions } from '../llm-providers/google/GoogleExecutionToolsOptions';
|
|
82
82
|
import type { OllamaExecutionToolsOptions } from '../llm-providers/ollama/OllamaExecutionToolsOptions';
|
|
83
83
|
import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
|
|
84
|
+
import type { OpenAiCompatibleExecutionToolsOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
|
|
84
85
|
import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
|
|
85
86
|
import type { VercelExecutionToolsOptions } from '../llm-providers/vercel/VercelExecutionToolsOptions';
|
|
86
87
|
import type { VercelProvider } from '../llm-providers/vercel/VercelProvider';
|
|
@@ -380,6 +381,7 @@ export type { DeepseekExecutionToolsOptions };
|
|
|
380
381
|
export type { GoogleExecutionToolsOptions };
|
|
381
382
|
export type { OllamaExecutionToolsOptions };
|
|
382
383
|
export type { OpenAiAssistantExecutionToolsOptions };
|
|
384
|
+
export type { OpenAiCompatibleExecutionToolsOptions };
|
|
383
385
|
export type { OpenAiExecutionToolsOptions };
|
|
384
386
|
export type { VercelExecutionToolsOptions };
|
|
385
387
|
export type { VercelProvider };
|
|
@@ -11,8 +11,10 @@ import { _OllamaMetadataRegistration } from '../llm-providers/ollama/register-co
|
|
|
11
11
|
import { _OllamaRegistration } from '../llm-providers/ollama/register-constructor';
|
|
12
12
|
import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
13
13
|
import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
14
|
+
import { _OpenAiCompatibleMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
14
15
|
import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
|
|
15
16
|
import { _OpenAiAssistantRegistration } from '../llm-providers/openai/register-constructor';
|
|
17
|
+
import { _OpenAiCompatibleRegistration } from '../llm-providers/openai/register-constructor';
|
|
16
18
|
import { _BoilerplateScraperRegistration } from '../scrapers/_boilerplate/register-constructor';
|
|
17
19
|
import { _BoilerplateScraperMetadataRegistration } from '../scrapers/_boilerplate/register-metadata';
|
|
18
20
|
import { _LegacyDocumentScraperRegistration } from '../scrapers/document-legacy/register-constructor';
|
|
@@ -41,8 +43,10 @@ export { _OllamaMetadataRegistration };
|
|
|
41
43
|
export { _OllamaRegistration };
|
|
42
44
|
export { _OpenAiMetadataRegistration };
|
|
43
45
|
export { _OpenAiAssistantMetadataRegistration };
|
|
46
|
+
export { _OpenAiCompatibleMetadataRegistration };
|
|
44
47
|
export { _OpenAiRegistration };
|
|
45
48
|
export { _OpenAiAssistantRegistration };
|
|
49
|
+
export { _OpenAiCompatibleRegistration };
|
|
46
50
|
export { _BoilerplateScraperRegistration };
|
|
47
51
|
export { _BoilerplateScraperMetadataRegistration };
|
|
48
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
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ClientOptions } from 'openai';
|
|
2
2
|
import type { string_token } from '../../types/typeAliases';
|
|
3
|
-
import type {
|
|
3
|
+
import type { OpenAiCompatibleExecutionToolsOptions } from './OpenAiCompatibleExecutionToolsOptions';
|
|
4
4
|
/**
|
|
5
5
|
* Options for `createOpenAiAssistantExecutionTools` and `OpenAiAssistantExecutionTools`
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/openai`
|
|
8
8
|
*/
|
|
9
|
-
export type OpenAiAssistantExecutionToolsOptions =
|
|
9
|
+
export type OpenAiAssistantExecutionToolsOptions = OpenAiCompatibleExecutionToolsOptions & ClientOptions & {
|
|
10
10
|
/**
|
|
11
11
|
* Which assistant to use
|
|
12
12
|
*/
|
|
@@ -11,14 +11,14 @@ import type { string_markdown_text } from '../../types/typeAliases';
|
|
|
11
11
|
import type { string_model_name } from '../../types/typeAliases';
|
|
12
12
|
import type { string_title } from '../../types/typeAliases';
|
|
13
13
|
import { computeOpenAiUsage } from './computeOpenAiUsage';
|
|
14
|
-
import type {
|
|
14
|
+
import type { OpenAiCompatibleExecutionToolsOptions } from './OpenAiCompatibleExecutionToolsOptions';
|
|
15
15
|
/**
|
|
16
16
|
* Execution Tools for calling OpenAI API or other OpeenAI compatible provider
|
|
17
17
|
*
|
|
18
18
|
* @public exported from `@promptbook/openai`
|
|
19
19
|
*/
|
|
20
20
|
export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecutionTools {
|
|
21
|
-
protected readonly options:
|
|
21
|
+
protected readonly options: OpenAiCompatibleExecutionToolsOptions;
|
|
22
22
|
/**
|
|
23
23
|
* OpenAI API client.
|
|
24
24
|
*/
|
|
@@ -32,7 +32,7 @@ export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecu
|
|
|
32
32
|
*
|
|
33
33
|
* @param options which are relevant are directly passed to the OpenAI compatible client
|
|
34
34
|
*/
|
|
35
|
-
constructor(options:
|
|
35
|
+
constructor(options: OpenAiCompatibleExecutionToolsOptions);
|
|
36
36
|
abstract get title(): string_title & string_markdown_text;
|
|
37
37
|
abstract get description(): string_markdown;
|
|
38
38
|
getClient(): Promise<OpenAI>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ClientOptions } from 'openai';
|
|
2
|
+
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Options for `createOpenAiCompatibleExecutionTools` and `OpenAiCompatibleExecutionTools`
|
|
5
|
+
*
|
|
6
|
+
* This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
|
|
7
|
+
* Rest is used by the `OpenAiCompatibleExecutionTools`.
|
|
8
|
+
*
|
|
9
|
+
* @public exported from `@promptbook/openai`
|
|
10
|
+
*/
|
|
11
|
+
export type OpenAiCompatibleExecutionToolsOptions = CommonToolsOptions & ClientOptions;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
1
|
+
import type { OpenAiCompatibleExecutionToolsOptions } from './OpenAiCompatibleExecutionToolsOptions';
|
|
3
2
|
/**
|
|
4
3
|
* Options for `createOpenAiExecutionTools` and `OpenAiExecutionTools`
|
|
5
4
|
*
|
|
6
|
-
* This extends
|
|
7
|
-
* Rest is used by the `OpenAiExecutionTools`.
|
|
5
|
+
* This extends OpenAiCompatibleExecutionToolsOptions.
|
|
8
6
|
*
|
|
9
7
|
* @public exported from `@promptbook/openai`
|
|
10
8
|
*/
|
|
11
|
-
export type OpenAiExecutionToolsOptions =
|
|
9
|
+
export type OpenAiExecutionToolsOptions = OpenAiCompatibleExecutionToolsOptions;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OpenAiCompatibleExecutionTools } from './OpenAiCompatibleExecutionTools';
|
|
2
|
+
import type { OpenAiCompatibleExecutionToolsOptions } from './OpenAiCompatibleExecutionToolsOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Execution Tools for calling OpenAI compatible API
|
|
5
|
+
*
|
|
6
|
+
* Note: This can be used for any OpenAI compatible APIs
|
|
7
|
+
*
|
|
8
|
+
* @public exported from `@promptbook/openai`
|
|
9
|
+
*/
|
|
10
|
+
export declare const createOpenAiCompatibleExecutionTools: ((options: OpenAiCompatibleExecutionToolsOptions) => OpenAiCompatibleExecutionTools) & {
|
|
11
|
+
packageName: string;
|
|
12
|
+
className: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* TODO: [๐ฆบ] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
|
|
16
|
+
* TODO: [๐ถ] Naming "constructor" vs "creator" vs "factory"
|
|
17
|
+
*/
|
|
@@ -19,6 +19,17 @@ export declare const _OpenAiMetadataRegistration: Registration;
|
|
|
19
19
|
* @public exported from `@promptbook/cli`
|
|
20
20
|
*/
|
|
21
21
|
export declare const _OpenAiAssistantMetadataRegistration: Registration;
|
|
22
|
+
/**
|
|
23
|
+
* Registration of the OpenAI Compatible metadata
|
|
24
|
+
*
|
|
25
|
+
* Note: OpenAiCompatibleExecutionTools is an abstract class and cannot be instantiated directly.
|
|
26
|
+
* It serves as a base class for OpenAiExecutionTools and other compatible implementations.
|
|
27
|
+
*
|
|
28
|
+
* @public exported from `@promptbook/core`
|
|
29
|
+
* @public exported from `@promptbook/wizard`
|
|
30
|
+
* @public exported from `@promptbook/cli`
|
|
31
|
+
*/
|
|
32
|
+
export declare const _OpenAiCompatibleMetadataRegistration: Registration;
|
|
22
33
|
/**
|
|
23
34
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
24
35
|
*/
|
|
@@ -19,6 +19,20 @@ 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;
|
|
32
|
+
/**
|
|
33
|
+
* Note: OpenAiCompatibleExecutionTools is an abstract class and cannot be registered directly.
|
|
34
|
+
* It serves as a base class for OpenAiExecutionTools and other compatible implementations.
|
|
35
|
+
*/
|
|
22
36
|
/**
|
|
23
37
|
* TODO: [๐ถ] Naming "constructor" vs "creator" vs "factory"
|
|
24
38
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -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-3`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
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-4';
|
|
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
|
|
@@ -304,7 +304,7 @@
|
|
|
304
304
|
*
|
|
305
305
|
* @public exported from `@promptbook/core`
|
|
306
306
|
*/
|
|
307
|
-
const DEFAULT_MAX_EXECUTION_ATTEMPTS =
|
|
307
|
+
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [๐คนโโ๏ธ]
|
|
308
308
|
// <- TODO: [๐] Make also `BOOKS_DIRNAME_ALTERNATIVES`
|
|
309
309
|
// TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
|
|
310
310
|
/**
|
|
@@ -4809,6 +4809,7 @@
|
|
|
4809
4809
|
$resultString: null,
|
|
4810
4810
|
$expectError: null,
|
|
4811
4811
|
$scriptPipelineExecutionErrors: [],
|
|
4812
|
+
$failedResults: [], // Track all failed attempts
|
|
4812
4813
|
};
|
|
4813
4814
|
// TODO: [๐] Make arrayable LLMs -> single LLM DRY
|
|
4814
4815
|
const _llms = arrayableToArray(tools.llm);
|
|
@@ -5054,6 +5055,14 @@
|
|
|
5054
5055
|
throw error;
|
|
5055
5056
|
}
|
|
5056
5057
|
$ongoingTaskResult.$expectError = error;
|
|
5058
|
+
// Store each failed attempt
|
|
5059
|
+
if (!Array.isArray($ongoingTaskResult.$failedResults)) {
|
|
5060
|
+
$ongoingTaskResult.$failedResults = [];
|
|
5061
|
+
}
|
|
5062
|
+
$ongoingTaskResult.$failedResults.push({
|
|
5063
|
+
result: $ongoingTaskResult.$resultString,
|
|
5064
|
+
error: error,
|
|
5065
|
+
});
|
|
5057
5066
|
}
|
|
5058
5067
|
finally {
|
|
5059
5068
|
if (!isJokerAttempt &&
|
|
@@ -5076,34 +5085,46 @@
|
|
|
5076
5085
|
}
|
|
5077
5086
|
}
|
|
5078
5087
|
if ($ongoingTaskResult.$expectError !== null && attempt === maxAttempts - 1) {
|
|
5088
|
+
// Store the current failure before throwing
|
|
5089
|
+
$ongoingTaskResult.$failedResults = $ongoingTaskResult.$failedResults || [];
|
|
5090
|
+
$ongoingTaskResult.$failedResults.push({
|
|
5091
|
+
result: $ongoingTaskResult.$resultString,
|
|
5092
|
+
error: $ongoingTaskResult.$expectError,
|
|
5093
|
+
});
|
|
5094
|
+
// Create a summary of all failures
|
|
5095
|
+
const failuresSummary = $ongoingTaskResult.$failedResults
|
|
5096
|
+
.map((failure, index) => spaceTrim.spaceTrim((block) => {
|
|
5097
|
+
var _a, _b;
|
|
5098
|
+
return `
|
|
5099
|
+
Attempt ${index + 1}:
|
|
5100
|
+
Error ${((_a = failure.error) === null || _a === void 0 ? void 0 : _a.name) || ''}:
|
|
5101
|
+
${block((_b = failure.error) === null || _b === void 0 ? void 0 : _b.message.split('\n').map((line) => `> ${line}`).join('\n'))}
|
|
5102
|
+
|
|
5103
|
+
Result:
|
|
5104
|
+
${block(failure.result === null
|
|
5105
|
+
? 'null'
|
|
5106
|
+
: spaceTrim.spaceTrim(failure.result)
|
|
5107
|
+
.split('\n')
|
|
5108
|
+
.map((line) => `> ${line}`)
|
|
5109
|
+
.join('\n'))}
|
|
5110
|
+
`;
|
|
5111
|
+
}))
|
|
5112
|
+
.join('\n\n---\n\n');
|
|
5079
5113
|
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
|
|
5080
|
-
var _a
|
|
5114
|
+
var _a;
|
|
5081
5115
|
return `
|
|
5082
5116
|
LLM execution failed ${maxExecutionAttempts}x
|
|
5083
5117
|
|
|
5084
5118
|
${block(pipelineIdentification)}
|
|
5085
5119
|
|
|
5086
|
-
---
|
|
5087
5120
|
The Prompt:
|
|
5088
5121
|
${block((((_a = $ongoingTaskResult.$prompt) === null || _a === void 0 ? void 0 : _a.content) || '')
|
|
5089
5122
|
.split('\n')
|
|
5090
5123
|
.map((line) => `> ${line}`)
|
|
5091
5124
|
.join('\n'))}
|
|
5092
5125
|
|
|
5093
|
-
|
|
5094
|
-
${block(
|
|
5095
|
-
.split('\n')
|
|
5096
|
-
.map((line) => `> ${line}`)
|
|
5097
|
-
.join('\n'))}
|
|
5098
|
-
|
|
5099
|
-
Last result:
|
|
5100
|
-
${block($ongoingTaskResult.$resultString === null
|
|
5101
|
-
? 'null'
|
|
5102
|
-
: spaceTrim.spaceTrim($ongoingTaskResult.$resultString)
|
|
5103
|
-
.split('\n')
|
|
5104
|
-
.map((line) => `> ${line}`)
|
|
5105
|
-
.join('\n'))}
|
|
5106
|
-
---
|
|
5126
|
+
All Failed Attempts:
|
|
5127
|
+
${block(failuresSummary)}
|
|
5107
5128
|
`;
|
|
5108
5129
|
}));
|
|
5109
5130
|
}
|