@promptbook/markitdown 0.101.0-8 → 0.101.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/README.md +0 -4
- package/esm/index.es.js +63 -117
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +14 -0
- package/esm/typings/src/_packages/core.index.d.ts +12 -0
- package/esm/typings/src/_packages/types.index.d.ts +8 -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 +2 -8
- 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 +2 -8
- package/esm/typings/src/book-2.0/commitments/GOAL/GOAL.d.ts +2 -8
- 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 +2 -8
- package/esm/typings/src/book-2.0/commitments/MESSAGE/MESSAGE.d.ts +2 -8
- 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 +25 -10
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +2 -8
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +2 -8
- 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 +2 -8
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +2 -8
- 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/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/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/README.md
CHANGED
|
@@ -29,10 +29,6 @@ Write AI applications using plain human language across multiple models and plat
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<blockquote style="color: #ff8811">
|
|
33
|
-
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
34
|
-
</blockquote>
|
|
35
|
-
|
|
36
32
|
## 📦 Package `@promptbook/markitdown`
|
|
37
33
|
|
|
38
34
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
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.101.0
|
|
27
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.101.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
|
|
@@ -864,11 +864,12 @@ async function getScraperIntermediateSource(source, options) {
|
|
|
864
864
|
catch (error) {
|
|
865
865
|
// Note: If we can't create cache directory, continue without it
|
|
866
866
|
// This handles read-only filesystems, permission issues, and missing parent directories
|
|
867
|
-
if (error instanceof Error &&
|
|
868
|
-
error.message.includes('
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
867
|
+
if (error instanceof Error &&
|
|
868
|
+
(error.message.includes('EROFS') ||
|
|
869
|
+
error.message.includes('read-only') ||
|
|
870
|
+
error.message.includes('EACCES') ||
|
|
871
|
+
error.message.includes('EPERM') ||
|
|
872
|
+
error.message.includes('ENOENT'))) ;
|
|
872
873
|
else {
|
|
873
874
|
// Re-throw other unexpected errors
|
|
874
875
|
throw error;
|
|
@@ -2947,75 +2948,32 @@ function countUsage(llmTools) {
|
|
|
2947
2948
|
*/
|
|
2948
2949
|
|
|
2949
2950
|
/**
|
|
2950
|
-
*
|
|
2951
|
-
* These profiles represent each provider as a virtual persona in chat interfaces
|
|
2951
|
+
* Takes an item or an array of items and returns an array of items
|
|
2952
2952
|
*
|
|
2953
|
-
*
|
|
2953
|
+
* 1) Any item except array and undefined returns array with that one item (also null)
|
|
2954
|
+
* 2) Undefined returns empty array
|
|
2955
|
+
* 3) Array returns itself
|
|
2956
|
+
*
|
|
2957
|
+
* @private internal utility
|
|
2954
2958
|
*/
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
}
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
color: '#d97706', // Anthropic's orange/amber color
|
|
2966
|
-
},
|
|
2967
|
-
AZURE_OPENAI: {
|
|
2968
|
-
name: 'AZURE_OPENAI',
|
|
2969
|
-
fullname: 'Azure OpenAI',
|
|
2970
|
-
color: '#0078d4', // Microsoft Azure blue
|
|
2971
|
-
},
|
|
2972
|
-
GOOGLE: {
|
|
2973
|
-
name: 'GOOGLE',
|
|
2974
|
-
fullname: 'Google Gemini',
|
|
2975
|
-
color: '#4285f4', // Google blue
|
|
2976
|
-
},
|
|
2977
|
-
DEEPSEEK: {
|
|
2978
|
-
name: 'DEEPSEEK',
|
|
2979
|
-
fullname: 'DeepSeek',
|
|
2980
|
-
color: '#7c3aed', // Purple color for DeepSeek
|
|
2981
|
-
},
|
|
2982
|
-
OLLAMA: {
|
|
2983
|
-
name: 'OLLAMA',
|
|
2984
|
-
fullname: 'Ollama',
|
|
2985
|
-
color: '#059669', // Emerald green for local models
|
|
2986
|
-
},
|
|
2987
|
-
REMOTE: {
|
|
2988
|
-
name: 'REMOTE',
|
|
2989
|
-
fullname: 'Remote Server',
|
|
2990
|
-
color: '#6b7280', // Gray for remote/proxy connections
|
|
2991
|
-
},
|
|
2992
|
-
MOCKED_ECHO: {
|
|
2993
|
-
name: 'MOCKED_ECHO',
|
|
2994
|
-
fullname: 'Echo (Test)',
|
|
2995
|
-
color: '#8b5cf6', // Purple for test/mock tools
|
|
2996
|
-
},
|
|
2997
|
-
MOCKED_FAKE: {
|
|
2998
|
-
name: 'MOCKED_FAKE',
|
|
2999
|
-
fullname: 'Fake LLM (Test)',
|
|
3000
|
-
color: '#ec4899', // Pink for fake/test tools
|
|
3001
|
-
},
|
|
3002
|
-
VERCEL: {
|
|
3003
|
-
name: 'VERCEL',
|
|
3004
|
-
fullname: 'Vercel AI',
|
|
3005
|
-
color: '#000000', // Vercel's black
|
|
3006
|
-
},
|
|
3007
|
-
MULTIPLE: {
|
|
3008
|
-
name: 'MULTIPLE',
|
|
3009
|
-
fullname: 'Multiple Providers',
|
|
3010
|
-
color: '#6366f1', // Indigo for combined/multiple providers
|
|
3011
|
-
},
|
|
3012
|
-
};
|
|
2959
|
+
function arrayableToArray(input) {
|
|
2960
|
+
if (input === undefined) {
|
|
2961
|
+
return [];
|
|
2962
|
+
}
|
|
2963
|
+
if (input instanceof Array) {
|
|
2964
|
+
return input;
|
|
2965
|
+
}
|
|
2966
|
+
return [input];
|
|
2967
|
+
}
|
|
2968
|
+
|
|
3013
2969
|
/**
|
|
3014
|
-
*
|
|
3015
|
-
* TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
|
3016
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2970
|
+
* Profile for Multiple providers aggregation
|
|
3017
2971
|
*/
|
|
3018
|
-
|
|
2972
|
+
const MULTIPLE_PROVIDER_PROFILE = {
|
|
2973
|
+
name: 'MULTIPLE',
|
|
2974
|
+
fullname: 'Multiple Providers',
|
|
2975
|
+
color: '#6366f1',
|
|
2976
|
+
};
|
|
3019
2977
|
/**
|
|
3020
2978
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
3021
2979
|
*
|
|
@@ -3026,12 +2984,10 @@ class MultipleLlmExecutionTools {
|
|
|
3026
2984
|
/**
|
|
3027
2985
|
* Gets array of execution tools in order of priority
|
|
3028
2986
|
*/
|
|
3029
|
-
constructor(...llmExecutionTools) {
|
|
2987
|
+
constructor(title, ...llmExecutionTools) {
|
|
2988
|
+
this.title = title;
|
|
3030
2989
|
this.llmExecutionTools = llmExecutionTools;
|
|
3031
2990
|
}
|
|
3032
|
-
get title() {
|
|
3033
|
-
return 'Multiple LLM Providers';
|
|
3034
|
-
}
|
|
3035
2991
|
get description() {
|
|
3036
2992
|
const innerModelsTitlesAndDescriptions = this.llmExecutionTools
|
|
3037
2993
|
.map(({ title, description }, index) => {
|
|
@@ -3053,7 +3009,7 @@ class MultipleLlmExecutionTools {
|
|
|
3053
3009
|
`);
|
|
3054
3010
|
}
|
|
3055
3011
|
get profile() {
|
|
3056
|
-
return
|
|
3012
|
+
return MULTIPLE_PROVIDER_PROFILE;
|
|
3057
3013
|
}
|
|
3058
3014
|
/**
|
|
3059
3015
|
* Check the configuration of all execution tools
|
|
@@ -3117,7 +3073,7 @@ class MultipleLlmExecutionTools {
|
|
|
3117
3073
|
return await llmExecutionTools.callEmbeddingModel(prompt);
|
|
3118
3074
|
// <- case [🤖]:
|
|
3119
3075
|
default:
|
|
3120
|
-
throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}"`);
|
|
3076
|
+
throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}" in ${llmExecutionTools.title}`);
|
|
3121
3077
|
}
|
|
3122
3078
|
}
|
|
3123
3079
|
catch (error) {
|
|
@@ -3138,7 +3094,7 @@ class MultipleLlmExecutionTools {
|
|
|
3138
3094
|
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
3139
3095
|
// 3) ...
|
|
3140
3096
|
spaceTrim((block) => `
|
|
3141
|
-
All execution tools failed:
|
|
3097
|
+
All execution tools of ${this.title} failed:
|
|
3142
3098
|
|
|
3143
3099
|
${block(errors
|
|
3144
3100
|
.map(({ error, llmExecutionTools }, i) => `${i + 1}) **${llmExecutionTools.title}** thrown **${error.name || 'Error'}:** ${error.message}`)
|
|
@@ -3147,11 +3103,11 @@ class MultipleLlmExecutionTools {
|
|
|
3147
3103
|
`));
|
|
3148
3104
|
}
|
|
3149
3105
|
else if (this.llmExecutionTools.length === 0) {
|
|
3150
|
-
throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools
|
|
3106
|
+
throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
|
|
3151
3107
|
}
|
|
3152
3108
|
else {
|
|
3153
3109
|
throw new PipelineExecutionError(spaceTrim((block) => `
|
|
3154
|
-
You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}"
|
|
3110
|
+
You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
|
|
3155
3111
|
|
|
3156
3112
|
Available \`LlmExecutionTools\`:
|
|
3157
3113
|
${block(this.description)}
|
|
@@ -3181,7 +3137,7 @@ class MultipleLlmExecutionTools {
|
|
|
3181
3137
|
*
|
|
3182
3138
|
* @public exported from `@promptbook/core`
|
|
3183
3139
|
*/
|
|
3184
|
-
function joinLlmExecutionTools(...llmExecutionTools) {
|
|
3140
|
+
function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
3185
3141
|
if (llmExecutionTools.length === 0) {
|
|
3186
3142
|
const warningMessage = spaceTrim(`
|
|
3187
3143
|
You have not provided any \`LlmExecutionTools\`
|
|
@@ -3213,30 +3169,27 @@ function joinLlmExecutionTools(...llmExecutionTools) {
|
|
|
3213
3169
|
};
|
|
3214
3170
|
*/
|
|
3215
3171
|
}
|
|
3216
|
-
return new MultipleLlmExecutionTools(...llmExecutionTools);
|
|
3172
|
+
return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
|
|
3217
3173
|
}
|
|
3218
3174
|
/**
|
|
3219
3175
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
3220
3176
|
*/
|
|
3221
3177
|
|
|
3222
3178
|
/**
|
|
3223
|
-
*
|
|
3224
|
-
*
|
|
3225
|
-
* 1) Any item except array and undefined returns array with that one item (also null)
|
|
3226
|
-
* 2) Undefined returns empty array
|
|
3227
|
-
* 3) Array returns itself
|
|
3179
|
+
* Just returns the given `LlmExecutionTools` or joins multiple into one
|
|
3228
3180
|
*
|
|
3229
|
-
* @
|
|
3181
|
+
* @public exported from `@promptbook/core`
|
|
3230
3182
|
*/
|
|
3231
|
-
function
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
}
|
|
3238
|
-
return [input];
|
|
3183
|
+
function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
|
|
3184
|
+
const _llms = arrayableToArray(oneOrMoreLlmExecutionTools);
|
|
3185
|
+
const llmTools = _llms.length === 1
|
|
3186
|
+
? _llms[0]
|
|
3187
|
+
: joinLlmExecutionTools('Multiple LLM Providers joined by `getSingleLlmExecutionTools`', ..._llms);
|
|
3188
|
+
return llmTools;
|
|
3239
3189
|
}
|
|
3190
|
+
/**
|
|
3191
|
+
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
3192
|
+
*/
|
|
3240
3193
|
|
|
3241
3194
|
/**
|
|
3242
3195
|
* Prepares the persona for the pipeline
|
|
@@ -3255,8 +3208,7 @@ async function preparePersona(personaDescription, tools, options) {
|
|
|
3255
3208
|
pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
|
|
3256
3209
|
tools,
|
|
3257
3210
|
});
|
|
3258
|
-
const
|
|
3259
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
3211
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
3260
3212
|
const availableModels = (await llmTools.listModels())
|
|
3261
3213
|
.filter(({ modelVariant }) => modelVariant === 'CHAT')
|
|
3262
3214
|
.map(({ modelName, modelDescription }) => ({
|
|
@@ -3300,6 +3252,7 @@ async function preparePersona(personaDescription, tools, options) {
|
|
|
3300
3252
|
};
|
|
3301
3253
|
}
|
|
3302
3254
|
/**
|
|
3255
|
+
* TODO: [😩] DRY `preparePersona` and `selectBestModelFromAvailable`
|
|
3303
3256
|
* TODO: [🔃][main] If the persona was prepared with different version or different set of models, prepare it once again
|
|
3304
3257
|
* TODO: [🏢] Check validity of `modelName` in pipeline
|
|
3305
3258
|
* TODO: [🏢] Check validity of `systemMessage` in pipeline
|
|
@@ -4027,9 +3980,7 @@ async function preparePipeline(pipeline, tools, options) {
|
|
|
4027
3980
|
if (tools === undefined || tools.llm === undefined) {
|
|
4028
3981
|
throw new MissingToolsError('LLM tools are required for preparing the pipeline');
|
|
4029
3982
|
}
|
|
4030
|
-
|
|
4031
|
-
const _llms = arrayableToArray(tools.llm);
|
|
4032
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
3983
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
4033
3984
|
const llmToolsWithUsage = countUsage(llmTools);
|
|
4034
3985
|
// <- TODO: [🌯]
|
|
4035
3986
|
/*
|
|
@@ -5172,9 +5123,7 @@ async function executeAttempts(options) {
|
|
|
5172
5123
|
$scriptPipelineExecutionErrors: [],
|
|
5173
5124
|
$failedResults: [], // Track all failed attempts
|
|
5174
5125
|
};
|
|
5175
|
-
|
|
5176
|
-
const _llms = arrayableToArray(tools.llm);
|
|
5177
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
5126
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
5178
5127
|
attempts: for (let attemptIndex = -jokerParameterNames.length; attemptIndex < maxAttempts; attemptIndex++) {
|
|
5179
5128
|
const isJokerAttempt = attemptIndex < 0;
|
|
5180
5129
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
@@ -5694,9 +5643,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5694
5643
|
return ''; // <- Note: Np knowledge present, return empty string
|
|
5695
5644
|
}
|
|
5696
5645
|
try {
|
|
5697
|
-
|
|
5698
|
-
const _llms = arrayableToArray(tools.llm);
|
|
5699
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
5646
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
5700
5647
|
const taskEmbeddingPrompt = {
|
|
5701
5648
|
title: 'Knowledge Search',
|
|
5702
5649
|
modelRequirements: {
|
|
@@ -6297,13 +6244,13 @@ function createPipelineExecutor(options) {
|
|
|
6297
6244
|
// Calculate and update tldr based on pipeline progress
|
|
6298
6245
|
const cv = newOngoingResult;
|
|
6299
6246
|
// Calculate progress based on parameters resolved vs total parameters
|
|
6300
|
-
const totalParameters = pipeline.parameters.filter(p => !p.isInput).length;
|
|
6247
|
+
const totalParameters = pipeline.parameters.filter((p) => !p.isInput).length;
|
|
6301
6248
|
let resolvedParameters = 0;
|
|
6302
6249
|
let currentTaskTitle = '';
|
|
6303
6250
|
// Get the resolved parameters from output parameters
|
|
6304
6251
|
if (cv === null || cv === void 0 ? void 0 : cv.outputParameters) {
|
|
6305
6252
|
// Count how many output parameters have non-empty values
|
|
6306
|
-
resolvedParameters = Object.values(cv.outputParameters).filter(value => value !== undefined && value !== null && String(value).trim() !== '').length;
|
|
6253
|
+
resolvedParameters = Object.values(cv.outputParameters).filter((value) => value !== undefined && value !== null && String(value).trim() !== '').length;
|
|
6307
6254
|
}
|
|
6308
6255
|
// Try to determine current task from execution report
|
|
6309
6256
|
if (((_a = cv === null || cv === void 0 ? void 0 : cv.executionReport) === null || _a === void 0 ? void 0 : _a.promptExecutions) && cv.executionReport.promptExecutions.length > 0) {
|
|
@@ -6413,9 +6360,7 @@ class MarkdownScraper {
|
|
|
6413
6360
|
throw new MissingToolsError('LLM tools are required for scraping external files');
|
|
6414
6361
|
// <- Note: This scraper is used in all other scrapers, so saying "external files" not "markdown files"
|
|
6415
6362
|
}
|
|
6416
|
-
|
|
6417
|
-
const _llms = arrayableToArray(llm);
|
|
6418
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
6363
|
+
const llmTools = getSingleLlmExecutionTools(llm);
|
|
6419
6364
|
// TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
|
|
6420
6365
|
const collection = createCollectionFromJson(...PipelineCollection);
|
|
6421
6366
|
const prepareKnowledgeFromMarkdownExecutor = createPipelineExecutor({
|
|
@@ -6634,11 +6579,12 @@ class MarkitdownScraper {
|
|
|
6634
6579
|
catch (error) {
|
|
6635
6580
|
// Note: If we can't write to cache, we'll continue without caching
|
|
6636
6581
|
// This handles read-only filesystems like Vercel
|
|
6637
|
-
if (error instanceof Error &&
|
|
6638
|
-
error.message.includes('
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6582
|
+
if (error instanceof Error &&
|
|
6583
|
+
(error.message.includes('EROFS') ||
|
|
6584
|
+
error.message.includes('read-only') ||
|
|
6585
|
+
error.message.includes('EACCES') ||
|
|
6586
|
+
error.message.includes('EPERM') ||
|
|
6587
|
+
error.message.includes('ENOENT'))) ;
|
|
6642
6588
|
else {
|
|
6643
6589
|
// Re-throw other unexpected errors
|
|
6644
6590
|
throw error;
|