@promptbook/pdf 0.101.0-9 → 0.102.0-0
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 +63 -117
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +30 -0
- package/esm/typings/src/_packages/core.index.d.ts +12 -0
- package/esm/typings/src/_packages/types.index.d.ts +12 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +11 -4
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +3 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +4 -22
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +1 -26
- package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/DELETE/DELETE.d.ts +0 -24
- package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/GOAL/GOAL.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/MEMORY/MEMORY.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/MESSAGE/MESSAGE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/META/META.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +23 -14
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +2 -14
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/SCENARIO/SCENARIO.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/index.d.ts +1 -1
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +5 -2
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +3 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/MockedChat.d.ts +18 -1
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +8 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +2 -15
- package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +5 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +9 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +13 -0
- package/esm/typings/src/book-components/Chat/hooks/index.d.ts +2 -0
- package/esm/typings/src/book-components/Chat/hooks/useChatAutoScroll.d.ts +41 -0
- package/esm/typings/src/book-components/Chat/hooks/useSendMessageToLlmChat.d.ts +44 -0
- package/esm/typings/src/book-components/Chat/utils/parseMessageButtons.d.ts +22 -0
- package/esm/typings/src/book-components/Chat/utils/savePlugins.d.ts +55 -0
- package/esm/typings/src/book-components/icons/PauseIcon.d.ts +8 -0
- package/esm/typings/src/book-components/icons/PlayIcon.d.ts +8 -0
- package/esm/typings/src/execution/PromptResult.d.ts +2 -4
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -2
- package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +1 -3
- package/esm/typings/src/formats/csv/CsvFormatError.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -2
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +8 -2
- package/esm/typings/src/llm-providers/_common/utils/removeUnsupportedModelRequirements.d.ts +25 -0
- package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +7 -18
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +11 -0
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +58 -0
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +29 -0
- package/esm/typings/src/llm-providers/agent/playground/playground.d.ts +8 -0
- package/esm/typings/src/llm-providers/agent/register-configuration.d.ts +11 -0
- package/esm/typings/src/llm-providers/agent/register-constructor.d.ts +13 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -8
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +4 -5
- package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -0
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +4 -10
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +4 -6
- package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +16 -8
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +3 -8
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +5 -14
- package/esm/typings/src/personas/preparePersona.d.ts +1 -0
- package/esm/typings/src/remote-server/openapi-types.d.ts +31 -31
- package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -2
- package/esm/typings/src/types/ModelRequirements.d.ts +2 -4
- package/esm/typings/src/utils/color/utils/colorSaturation.d.ts +1 -1
- package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +1 -1
- package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +0 -1
- package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +2 -2
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +63 -117
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-2.0/utils/extractAgentMetadata.d.ts +0 -17
- package/esm/typings/src/book-2.0/utils/extractProfileImageFromSystemMessage.d.ts +0 -12
- package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +0 -16
- package/esm/typings/src/expectations/drafts/isDomainNameFree.d.ts +0 -10
- package/esm/typings/src/expectations/drafts/isGithubNameFree.d.ts +0 -10
- package/esm/typings/src/llm-providers/_common/profiles/llmProviderProfiles.d.ts +0 -81
- /package/esm/typings/src/llm-providers/_common/{profiles/test/llmProviderProfiles.test.d.ts → utils/removeUnsupportedModelRequirements.test.d.ts} +0 -0
package/esm/index.es.js
CHANGED
|
@@ -24,7 +24,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
24
24
|
* @generated
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
27
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.102.0-0';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -877,11 +877,12 @@ async function getScraperIntermediateSource(source, options) {
|
|
|
877
877
|
catch (error) {
|
|
878
878
|
// Note: If we can't create cache directory, continue without it
|
|
879
879
|
// This handles read-only filesystems, permission issues, and missing parent directories
|
|
880
|
-
if (error instanceof Error &&
|
|
881
|
-
error.message.includes('
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
880
|
+
if (error instanceof Error &&
|
|
881
|
+
(error.message.includes('EROFS') ||
|
|
882
|
+
error.message.includes('read-only') ||
|
|
883
|
+
error.message.includes('EACCES') ||
|
|
884
|
+
error.message.includes('EPERM') ||
|
|
885
|
+
error.message.includes('ENOENT'))) ;
|
|
885
886
|
else {
|
|
886
887
|
// Re-throw other unexpected errors
|
|
887
888
|
throw error;
|
|
@@ -2960,75 +2961,32 @@ function countUsage(llmTools) {
|
|
|
2960
2961
|
*/
|
|
2961
2962
|
|
|
2962
2963
|
/**
|
|
2963
|
-
*
|
|
2964
|
-
* These profiles represent each provider as a virtual persona in chat interfaces
|
|
2964
|
+
* Takes an item or an array of items and returns an array of items
|
|
2965
2965
|
*
|
|
2966
|
-
*
|
|
2966
|
+
* 1) Any item except array and undefined returns array with that one item (also null)
|
|
2967
|
+
* 2) Undefined returns empty array
|
|
2968
|
+
* 3) Array returns itself
|
|
2969
|
+
*
|
|
2970
|
+
* @private internal utility
|
|
2967
2971
|
*/
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
}
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
color: '#d97706', // Anthropic's orange/amber color
|
|
2979
|
-
},
|
|
2980
|
-
AZURE_OPENAI: {
|
|
2981
|
-
name: 'AZURE_OPENAI',
|
|
2982
|
-
fullname: 'Azure OpenAI',
|
|
2983
|
-
color: '#0078d4', // Microsoft Azure blue
|
|
2984
|
-
},
|
|
2985
|
-
GOOGLE: {
|
|
2986
|
-
name: 'GOOGLE',
|
|
2987
|
-
fullname: 'Google Gemini',
|
|
2988
|
-
color: '#4285f4', // Google blue
|
|
2989
|
-
},
|
|
2990
|
-
DEEPSEEK: {
|
|
2991
|
-
name: 'DEEPSEEK',
|
|
2992
|
-
fullname: 'DeepSeek',
|
|
2993
|
-
color: '#7c3aed', // Purple color for DeepSeek
|
|
2994
|
-
},
|
|
2995
|
-
OLLAMA: {
|
|
2996
|
-
name: 'OLLAMA',
|
|
2997
|
-
fullname: 'Ollama',
|
|
2998
|
-
color: '#059669', // Emerald green for local models
|
|
2999
|
-
},
|
|
3000
|
-
REMOTE: {
|
|
3001
|
-
name: 'REMOTE',
|
|
3002
|
-
fullname: 'Remote Server',
|
|
3003
|
-
color: '#6b7280', // Gray for remote/proxy connections
|
|
3004
|
-
},
|
|
3005
|
-
MOCKED_ECHO: {
|
|
3006
|
-
name: 'MOCKED_ECHO',
|
|
3007
|
-
fullname: 'Echo (Test)',
|
|
3008
|
-
color: '#8b5cf6', // Purple for test/mock tools
|
|
3009
|
-
},
|
|
3010
|
-
MOCKED_FAKE: {
|
|
3011
|
-
name: 'MOCKED_FAKE',
|
|
3012
|
-
fullname: 'Fake LLM (Test)',
|
|
3013
|
-
color: '#ec4899', // Pink for fake/test tools
|
|
3014
|
-
},
|
|
3015
|
-
VERCEL: {
|
|
3016
|
-
name: 'VERCEL',
|
|
3017
|
-
fullname: 'Vercel AI',
|
|
3018
|
-
color: '#000000', // Vercel's black
|
|
3019
|
-
},
|
|
3020
|
-
MULTIPLE: {
|
|
3021
|
-
name: 'MULTIPLE',
|
|
3022
|
-
fullname: 'Multiple Providers',
|
|
3023
|
-
color: '#6366f1', // Indigo for combined/multiple providers
|
|
3024
|
-
},
|
|
3025
|
-
};
|
|
2972
|
+
function arrayableToArray(input) {
|
|
2973
|
+
if (input === undefined) {
|
|
2974
|
+
return [];
|
|
2975
|
+
}
|
|
2976
|
+
if (input instanceof Array) {
|
|
2977
|
+
return input;
|
|
2978
|
+
}
|
|
2979
|
+
return [input];
|
|
2980
|
+
}
|
|
2981
|
+
|
|
3026
2982
|
/**
|
|
3027
|
-
*
|
|
3028
|
-
* TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
|
3029
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2983
|
+
* Profile for Multiple providers aggregation
|
|
3030
2984
|
*/
|
|
3031
|
-
|
|
2985
|
+
const MULTIPLE_PROVIDER_PROFILE = {
|
|
2986
|
+
name: 'MULTIPLE',
|
|
2987
|
+
fullname: 'Multiple Providers',
|
|
2988
|
+
color: '#6366f1',
|
|
2989
|
+
};
|
|
3032
2990
|
/**
|
|
3033
2991
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
3034
2992
|
*
|
|
@@ -3039,12 +2997,10 @@ class MultipleLlmExecutionTools {
|
|
|
3039
2997
|
/**
|
|
3040
2998
|
* Gets array of execution tools in order of priority
|
|
3041
2999
|
*/
|
|
3042
|
-
constructor(...llmExecutionTools) {
|
|
3000
|
+
constructor(title, ...llmExecutionTools) {
|
|
3001
|
+
this.title = title;
|
|
3043
3002
|
this.llmExecutionTools = llmExecutionTools;
|
|
3044
3003
|
}
|
|
3045
|
-
get title() {
|
|
3046
|
-
return 'Multiple LLM Providers';
|
|
3047
|
-
}
|
|
3048
3004
|
get description() {
|
|
3049
3005
|
const innerModelsTitlesAndDescriptions = this.llmExecutionTools
|
|
3050
3006
|
.map(({ title, description }, index) => {
|
|
@@ -3066,7 +3022,7 @@ class MultipleLlmExecutionTools {
|
|
|
3066
3022
|
`);
|
|
3067
3023
|
}
|
|
3068
3024
|
get profile() {
|
|
3069
|
-
return
|
|
3025
|
+
return MULTIPLE_PROVIDER_PROFILE;
|
|
3070
3026
|
}
|
|
3071
3027
|
/**
|
|
3072
3028
|
* Check the configuration of all execution tools
|
|
@@ -3130,7 +3086,7 @@ class MultipleLlmExecutionTools {
|
|
|
3130
3086
|
return await llmExecutionTools.callEmbeddingModel(prompt);
|
|
3131
3087
|
// <- case [🤖]:
|
|
3132
3088
|
default:
|
|
3133
|
-
throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}"`);
|
|
3089
|
+
throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}" in ${llmExecutionTools.title}`);
|
|
3134
3090
|
}
|
|
3135
3091
|
}
|
|
3136
3092
|
catch (error) {
|
|
@@ -3151,7 +3107,7 @@ class MultipleLlmExecutionTools {
|
|
|
3151
3107
|
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
3152
3108
|
// 3) ...
|
|
3153
3109
|
spaceTrim((block) => `
|
|
3154
|
-
All execution tools failed:
|
|
3110
|
+
All execution tools of ${this.title} failed:
|
|
3155
3111
|
|
|
3156
3112
|
${block(errors
|
|
3157
3113
|
.map(({ error, llmExecutionTools }, i) => `${i + 1}) **${llmExecutionTools.title}** thrown **${error.name || 'Error'}:** ${error.message}`)
|
|
@@ -3160,11 +3116,11 @@ class MultipleLlmExecutionTools {
|
|
|
3160
3116
|
`));
|
|
3161
3117
|
}
|
|
3162
3118
|
else if (this.llmExecutionTools.length === 0) {
|
|
3163
|
-
throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools
|
|
3119
|
+
throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
|
|
3164
3120
|
}
|
|
3165
3121
|
else {
|
|
3166
3122
|
throw new PipelineExecutionError(spaceTrim((block) => `
|
|
3167
|
-
You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}"
|
|
3123
|
+
You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
|
|
3168
3124
|
|
|
3169
3125
|
Available \`LlmExecutionTools\`:
|
|
3170
3126
|
${block(this.description)}
|
|
@@ -3194,7 +3150,7 @@ class MultipleLlmExecutionTools {
|
|
|
3194
3150
|
*
|
|
3195
3151
|
* @public exported from `@promptbook/core`
|
|
3196
3152
|
*/
|
|
3197
|
-
function joinLlmExecutionTools(...llmExecutionTools) {
|
|
3153
|
+
function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
3198
3154
|
if (llmExecutionTools.length === 0) {
|
|
3199
3155
|
const warningMessage = spaceTrim(`
|
|
3200
3156
|
You have not provided any \`LlmExecutionTools\`
|
|
@@ -3226,30 +3182,27 @@ function joinLlmExecutionTools(...llmExecutionTools) {
|
|
|
3226
3182
|
};
|
|
3227
3183
|
*/
|
|
3228
3184
|
}
|
|
3229
|
-
return new MultipleLlmExecutionTools(...llmExecutionTools);
|
|
3185
|
+
return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
|
|
3230
3186
|
}
|
|
3231
3187
|
/**
|
|
3232
3188
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
3233
3189
|
*/
|
|
3234
3190
|
|
|
3235
3191
|
/**
|
|
3236
|
-
*
|
|
3237
|
-
*
|
|
3238
|
-
* 1) Any item except array and undefined returns array with that one item (also null)
|
|
3239
|
-
* 2) Undefined returns empty array
|
|
3240
|
-
* 3) Array returns itself
|
|
3192
|
+
* Just returns the given `LlmExecutionTools` or joins multiple into one
|
|
3241
3193
|
*
|
|
3242
|
-
* @
|
|
3194
|
+
* @public exported from `@promptbook/core`
|
|
3243
3195
|
*/
|
|
3244
|
-
function
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
}
|
|
3251
|
-
return [input];
|
|
3196
|
+
function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
|
|
3197
|
+
const _llms = arrayableToArray(oneOrMoreLlmExecutionTools);
|
|
3198
|
+
const llmTools = _llms.length === 1
|
|
3199
|
+
? _llms[0]
|
|
3200
|
+
: joinLlmExecutionTools('Multiple LLM Providers joined by `getSingleLlmExecutionTools`', ..._llms);
|
|
3201
|
+
return llmTools;
|
|
3252
3202
|
}
|
|
3203
|
+
/**
|
|
3204
|
+
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
3205
|
+
*/
|
|
3253
3206
|
|
|
3254
3207
|
/**
|
|
3255
3208
|
* Prepares the persona for the pipeline
|
|
@@ -3268,8 +3221,7 @@ async function preparePersona(personaDescription, tools, options) {
|
|
|
3268
3221
|
pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
|
|
3269
3222
|
tools,
|
|
3270
3223
|
});
|
|
3271
|
-
const
|
|
3272
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
3224
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
3273
3225
|
const availableModels = (await llmTools.listModels())
|
|
3274
3226
|
.filter(({ modelVariant }) => modelVariant === 'CHAT')
|
|
3275
3227
|
.map(({ modelName, modelDescription }) => ({
|
|
@@ -3313,6 +3265,7 @@ async function preparePersona(personaDescription, tools, options) {
|
|
|
3313
3265
|
};
|
|
3314
3266
|
}
|
|
3315
3267
|
/**
|
|
3268
|
+
* TODO: [😩] DRY `preparePersona` and `selectBestModelFromAvailable`
|
|
3316
3269
|
* TODO: [🔃][main] If the persona was prepared with different version or different set of models, prepare it once again
|
|
3317
3270
|
* TODO: [🏢] Check validity of `modelName` in pipeline
|
|
3318
3271
|
* TODO: [🏢] Check validity of `systemMessage` in pipeline
|
|
@@ -4040,9 +3993,7 @@ async function preparePipeline(pipeline, tools, options) {
|
|
|
4040
3993
|
if (tools === undefined || tools.llm === undefined) {
|
|
4041
3994
|
throw new MissingToolsError('LLM tools are required for preparing the pipeline');
|
|
4042
3995
|
}
|
|
4043
|
-
|
|
4044
|
-
const _llms = arrayableToArray(tools.llm);
|
|
4045
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
3996
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
4046
3997
|
const llmToolsWithUsage = countUsage(llmTools);
|
|
4047
3998
|
// <- TODO: [🌯]
|
|
4048
3999
|
/*
|
|
@@ -5185,9 +5136,7 @@ async function executeAttempts(options) {
|
|
|
5185
5136
|
$scriptPipelineExecutionErrors: [],
|
|
5186
5137
|
$failedResults: [], // Track all failed attempts
|
|
5187
5138
|
};
|
|
5188
|
-
|
|
5189
|
-
const _llms = arrayableToArray(tools.llm);
|
|
5190
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
5139
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
5191
5140
|
attempts: for (let attemptIndex = -jokerParameterNames.length; attemptIndex < maxAttempts; attemptIndex++) {
|
|
5192
5141
|
const isJokerAttempt = attemptIndex < 0;
|
|
5193
5142
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
@@ -5707,9 +5656,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5707
5656
|
return ''; // <- Note: Np knowledge present, return empty string
|
|
5708
5657
|
}
|
|
5709
5658
|
try {
|
|
5710
|
-
|
|
5711
|
-
const _llms = arrayableToArray(tools.llm);
|
|
5712
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
5659
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
5713
5660
|
const taskEmbeddingPrompt = {
|
|
5714
5661
|
title: 'Knowledge Search',
|
|
5715
5662
|
modelRequirements: {
|
|
@@ -6310,13 +6257,13 @@ function createPipelineExecutor(options) {
|
|
|
6310
6257
|
// Calculate and update tldr based on pipeline progress
|
|
6311
6258
|
const cv = newOngoingResult;
|
|
6312
6259
|
// Calculate progress based on parameters resolved vs total parameters
|
|
6313
|
-
const totalParameters = pipeline.parameters.filter(p => !p.isInput).length;
|
|
6260
|
+
const totalParameters = pipeline.parameters.filter((p) => !p.isInput).length;
|
|
6314
6261
|
let resolvedParameters = 0;
|
|
6315
6262
|
let currentTaskTitle = '';
|
|
6316
6263
|
// Get the resolved parameters from output parameters
|
|
6317
6264
|
if (cv === null || cv === void 0 ? void 0 : cv.outputParameters) {
|
|
6318
6265
|
// Count how many output parameters have non-empty values
|
|
6319
|
-
resolvedParameters = Object.values(cv.outputParameters).filter(value => value !== undefined && value !== null && String(value).trim() !== '').length;
|
|
6266
|
+
resolvedParameters = Object.values(cv.outputParameters).filter((value) => value !== undefined && value !== null && String(value).trim() !== '').length;
|
|
6320
6267
|
}
|
|
6321
6268
|
// Try to determine current task from execution report
|
|
6322
6269
|
if (((_a = cv === null || cv === void 0 ? void 0 : cv.executionReport) === null || _a === void 0 ? void 0 : _a.promptExecutions) && cv.executionReport.promptExecutions.length > 0) {
|
|
@@ -6426,9 +6373,7 @@ class MarkdownScraper {
|
|
|
6426
6373
|
throw new MissingToolsError('LLM tools are required for scraping external files');
|
|
6427
6374
|
// <- Note: This scraper is used in all other scrapers, so saying "external files" not "markdown files"
|
|
6428
6375
|
}
|
|
6429
|
-
|
|
6430
|
-
const _llms = arrayableToArray(llm);
|
|
6431
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
6376
|
+
const llmTools = getSingleLlmExecutionTools(llm);
|
|
6432
6377
|
// TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
|
|
6433
6378
|
const collection = createCollectionFromJson(...PipelineCollection);
|
|
6434
6379
|
const prepareKnowledgeFromMarkdownExecutor = createPipelineExecutor({
|
|
@@ -6647,11 +6592,12 @@ class MarkitdownScraper {
|
|
|
6647
6592
|
catch (error) {
|
|
6648
6593
|
// Note: If we can't write to cache, we'll continue without caching
|
|
6649
6594
|
// This handles read-only filesystems like Vercel
|
|
6650
|
-
if (error instanceof Error &&
|
|
6651
|
-
error.message.includes('
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6595
|
+
if (error instanceof Error &&
|
|
6596
|
+
(error.message.includes('EROFS') ||
|
|
6597
|
+
error.message.includes('read-only') ||
|
|
6598
|
+
error.message.includes('EACCES') ||
|
|
6599
|
+
error.message.includes('EPERM') ||
|
|
6600
|
+
error.message.includes('ENOENT'))) ;
|
|
6655
6601
|
else {
|
|
6656
6602
|
// Re-throw other unexpected errors
|
|
6657
6603
|
throw error;
|