@promptbook/website-crawler 0.101.0-9 → 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 +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/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/website-crawler`
|
|
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
|
@@ -27,7 +27,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.101.0
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.101.0';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1047,11 +1047,12 @@ async function getScraperIntermediateSource(source, options) {
|
|
|
1047
1047
|
catch (error) {
|
|
1048
1048
|
// Note: If we can't create cache directory, continue without it
|
|
1049
1049
|
// This handles read-only filesystems, permission issues, and missing parent directories
|
|
1050
|
-
if (error instanceof Error &&
|
|
1051
|
-
error.message.includes('
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1050
|
+
if (error instanceof Error &&
|
|
1051
|
+
(error.message.includes('EROFS') ||
|
|
1052
|
+
error.message.includes('read-only') ||
|
|
1053
|
+
error.message.includes('EACCES') ||
|
|
1054
|
+
error.message.includes('EPERM') ||
|
|
1055
|
+
error.message.includes('ENOENT'))) ;
|
|
1055
1056
|
else {
|
|
1056
1057
|
// Re-throw other unexpected errors
|
|
1057
1058
|
throw error;
|
|
@@ -3080,75 +3081,32 @@ function countUsage(llmTools) {
|
|
|
3080
3081
|
*/
|
|
3081
3082
|
|
|
3082
3083
|
/**
|
|
3083
|
-
*
|
|
3084
|
-
*
|
|
3084
|
+
* Takes an item or an array of items and returns an array of items
|
|
3085
|
+
*
|
|
3086
|
+
* 1) Any item except array and undefined returns array with that one item (also null)
|
|
3087
|
+
* 2) Undefined returns empty array
|
|
3088
|
+
* 3) Array returns itself
|
|
3085
3089
|
*
|
|
3086
|
-
* @private
|
|
3090
|
+
* @private internal utility
|
|
3087
3091
|
*/
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
}
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
color: '#d97706', // Anthropic's orange/amber color
|
|
3099
|
-
},
|
|
3100
|
-
AZURE_OPENAI: {
|
|
3101
|
-
name: 'AZURE_OPENAI',
|
|
3102
|
-
fullname: 'Azure OpenAI',
|
|
3103
|
-
color: '#0078d4', // Microsoft Azure blue
|
|
3104
|
-
},
|
|
3105
|
-
GOOGLE: {
|
|
3106
|
-
name: 'GOOGLE',
|
|
3107
|
-
fullname: 'Google Gemini',
|
|
3108
|
-
color: '#4285f4', // Google blue
|
|
3109
|
-
},
|
|
3110
|
-
DEEPSEEK: {
|
|
3111
|
-
name: 'DEEPSEEK',
|
|
3112
|
-
fullname: 'DeepSeek',
|
|
3113
|
-
color: '#7c3aed', // Purple color for DeepSeek
|
|
3114
|
-
},
|
|
3115
|
-
OLLAMA: {
|
|
3116
|
-
name: 'OLLAMA',
|
|
3117
|
-
fullname: 'Ollama',
|
|
3118
|
-
color: '#059669', // Emerald green for local models
|
|
3119
|
-
},
|
|
3120
|
-
REMOTE: {
|
|
3121
|
-
name: 'REMOTE',
|
|
3122
|
-
fullname: 'Remote Server',
|
|
3123
|
-
color: '#6b7280', // Gray for remote/proxy connections
|
|
3124
|
-
},
|
|
3125
|
-
MOCKED_ECHO: {
|
|
3126
|
-
name: 'MOCKED_ECHO',
|
|
3127
|
-
fullname: 'Echo (Test)',
|
|
3128
|
-
color: '#8b5cf6', // Purple for test/mock tools
|
|
3129
|
-
},
|
|
3130
|
-
MOCKED_FAKE: {
|
|
3131
|
-
name: 'MOCKED_FAKE',
|
|
3132
|
-
fullname: 'Fake LLM (Test)',
|
|
3133
|
-
color: '#ec4899', // Pink for fake/test tools
|
|
3134
|
-
},
|
|
3135
|
-
VERCEL: {
|
|
3136
|
-
name: 'VERCEL',
|
|
3137
|
-
fullname: 'Vercel AI',
|
|
3138
|
-
color: '#000000', // Vercel's black
|
|
3139
|
-
},
|
|
3140
|
-
MULTIPLE: {
|
|
3141
|
-
name: 'MULTIPLE',
|
|
3142
|
-
fullname: 'Multiple Providers',
|
|
3143
|
-
color: '#6366f1', // Indigo for combined/multiple providers
|
|
3144
|
-
},
|
|
3145
|
-
};
|
|
3092
|
+
function arrayableToArray(input) {
|
|
3093
|
+
if (input === undefined) {
|
|
3094
|
+
return [];
|
|
3095
|
+
}
|
|
3096
|
+
if (input instanceof Array) {
|
|
3097
|
+
return input;
|
|
3098
|
+
}
|
|
3099
|
+
return [input];
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3146
3102
|
/**
|
|
3147
|
-
*
|
|
3148
|
-
* TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
|
3149
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
3103
|
+
* Profile for Multiple providers aggregation
|
|
3150
3104
|
*/
|
|
3151
|
-
|
|
3105
|
+
const MULTIPLE_PROVIDER_PROFILE = {
|
|
3106
|
+
name: 'MULTIPLE',
|
|
3107
|
+
fullname: 'Multiple Providers',
|
|
3108
|
+
color: '#6366f1',
|
|
3109
|
+
};
|
|
3152
3110
|
/**
|
|
3153
3111
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
3154
3112
|
*
|
|
@@ -3159,12 +3117,10 @@ class MultipleLlmExecutionTools {
|
|
|
3159
3117
|
/**
|
|
3160
3118
|
* Gets array of execution tools in order of priority
|
|
3161
3119
|
*/
|
|
3162
|
-
constructor(...llmExecutionTools) {
|
|
3120
|
+
constructor(title, ...llmExecutionTools) {
|
|
3121
|
+
this.title = title;
|
|
3163
3122
|
this.llmExecutionTools = llmExecutionTools;
|
|
3164
3123
|
}
|
|
3165
|
-
get title() {
|
|
3166
|
-
return 'Multiple LLM Providers';
|
|
3167
|
-
}
|
|
3168
3124
|
get description() {
|
|
3169
3125
|
const innerModelsTitlesAndDescriptions = this.llmExecutionTools
|
|
3170
3126
|
.map(({ title, description }, index) => {
|
|
@@ -3186,7 +3142,7 @@ class MultipleLlmExecutionTools {
|
|
|
3186
3142
|
`);
|
|
3187
3143
|
}
|
|
3188
3144
|
get profile() {
|
|
3189
|
-
return
|
|
3145
|
+
return MULTIPLE_PROVIDER_PROFILE;
|
|
3190
3146
|
}
|
|
3191
3147
|
/**
|
|
3192
3148
|
* Check the configuration of all execution tools
|
|
@@ -3250,7 +3206,7 @@ class MultipleLlmExecutionTools {
|
|
|
3250
3206
|
return await llmExecutionTools.callEmbeddingModel(prompt);
|
|
3251
3207
|
// <- case [🤖]:
|
|
3252
3208
|
default:
|
|
3253
|
-
throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}"`);
|
|
3209
|
+
throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}" in ${llmExecutionTools.title}`);
|
|
3254
3210
|
}
|
|
3255
3211
|
}
|
|
3256
3212
|
catch (error) {
|
|
@@ -3271,7 +3227,7 @@ class MultipleLlmExecutionTools {
|
|
|
3271
3227
|
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
3272
3228
|
// 3) ...
|
|
3273
3229
|
spaceTrim$1((block) => `
|
|
3274
|
-
All execution tools failed:
|
|
3230
|
+
All execution tools of ${this.title} failed:
|
|
3275
3231
|
|
|
3276
3232
|
${block(errors
|
|
3277
3233
|
.map(({ error, llmExecutionTools }, i) => `${i + 1}) **${llmExecutionTools.title}** thrown **${error.name || 'Error'}:** ${error.message}`)
|
|
@@ -3280,11 +3236,11 @@ class MultipleLlmExecutionTools {
|
|
|
3280
3236
|
`));
|
|
3281
3237
|
}
|
|
3282
3238
|
else if (this.llmExecutionTools.length === 0) {
|
|
3283
|
-
throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools
|
|
3239
|
+
throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
|
|
3284
3240
|
}
|
|
3285
3241
|
else {
|
|
3286
3242
|
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
3287
|
-
You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}"
|
|
3243
|
+
You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
|
|
3288
3244
|
|
|
3289
3245
|
Available \`LlmExecutionTools\`:
|
|
3290
3246
|
${block(this.description)}
|
|
@@ -3314,7 +3270,7 @@ class MultipleLlmExecutionTools {
|
|
|
3314
3270
|
*
|
|
3315
3271
|
* @public exported from `@promptbook/core`
|
|
3316
3272
|
*/
|
|
3317
|
-
function joinLlmExecutionTools(...llmExecutionTools) {
|
|
3273
|
+
function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
3318
3274
|
if (llmExecutionTools.length === 0) {
|
|
3319
3275
|
const warningMessage = spaceTrim$1(`
|
|
3320
3276
|
You have not provided any \`LlmExecutionTools\`
|
|
@@ -3346,30 +3302,27 @@ function joinLlmExecutionTools(...llmExecutionTools) {
|
|
|
3346
3302
|
};
|
|
3347
3303
|
*/
|
|
3348
3304
|
}
|
|
3349
|
-
return new MultipleLlmExecutionTools(...llmExecutionTools);
|
|
3305
|
+
return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
|
|
3350
3306
|
}
|
|
3351
3307
|
/**
|
|
3352
3308
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
3353
3309
|
*/
|
|
3354
3310
|
|
|
3355
3311
|
/**
|
|
3356
|
-
*
|
|
3357
|
-
*
|
|
3358
|
-
* 1) Any item except array and undefined returns array with that one item (also null)
|
|
3359
|
-
* 2) Undefined returns empty array
|
|
3360
|
-
* 3) Array returns itself
|
|
3312
|
+
* Just returns the given `LlmExecutionTools` or joins multiple into one
|
|
3361
3313
|
*
|
|
3362
|
-
* @
|
|
3314
|
+
* @public exported from `@promptbook/core`
|
|
3363
3315
|
*/
|
|
3364
|
-
function
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
}
|
|
3371
|
-
return [input];
|
|
3316
|
+
function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
|
|
3317
|
+
const _llms = arrayableToArray(oneOrMoreLlmExecutionTools);
|
|
3318
|
+
const llmTools = _llms.length === 1
|
|
3319
|
+
? _llms[0]
|
|
3320
|
+
: joinLlmExecutionTools('Multiple LLM Providers joined by `getSingleLlmExecutionTools`', ..._llms);
|
|
3321
|
+
return llmTools;
|
|
3372
3322
|
}
|
|
3323
|
+
/**
|
|
3324
|
+
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
3325
|
+
*/
|
|
3373
3326
|
|
|
3374
3327
|
/**
|
|
3375
3328
|
* Prepares the persona for the pipeline
|
|
@@ -3388,8 +3341,7 @@ async function preparePersona(personaDescription, tools, options) {
|
|
|
3388
3341
|
pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
|
|
3389
3342
|
tools,
|
|
3390
3343
|
});
|
|
3391
|
-
const
|
|
3392
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
3344
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
3393
3345
|
const availableModels = (await llmTools.listModels())
|
|
3394
3346
|
.filter(({ modelVariant }) => modelVariant === 'CHAT')
|
|
3395
3347
|
.map(({ modelName, modelDescription }) => ({
|
|
@@ -3433,6 +3385,7 @@ async function preparePersona(personaDescription, tools, options) {
|
|
|
3433
3385
|
};
|
|
3434
3386
|
}
|
|
3435
3387
|
/**
|
|
3388
|
+
* TODO: [😩] DRY `preparePersona` and `selectBestModelFromAvailable`
|
|
3436
3389
|
* TODO: [🔃][main] If the persona was prepared with different version or different set of models, prepare it once again
|
|
3437
3390
|
* TODO: [🏢] Check validity of `modelName` in pipeline
|
|
3438
3391
|
* TODO: [🏢] Check validity of `systemMessage` in pipeline
|
|
@@ -4041,9 +3994,7 @@ async function preparePipeline(pipeline, tools, options) {
|
|
|
4041
3994
|
if (tools === undefined || tools.llm === undefined) {
|
|
4042
3995
|
throw new MissingToolsError('LLM tools are required for preparing the pipeline');
|
|
4043
3996
|
}
|
|
4044
|
-
|
|
4045
|
-
const _llms = arrayableToArray(tools.llm);
|
|
4046
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
3997
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
4047
3998
|
const llmToolsWithUsage = countUsage(llmTools);
|
|
4048
3999
|
// <- TODO: [🌯]
|
|
4049
4000
|
/*
|
|
@@ -5186,9 +5137,7 @@ async function executeAttempts(options) {
|
|
|
5186
5137
|
$scriptPipelineExecutionErrors: [],
|
|
5187
5138
|
$failedResults: [], // Track all failed attempts
|
|
5188
5139
|
};
|
|
5189
|
-
|
|
5190
|
-
const _llms = arrayableToArray(tools.llm);
|
|
5191
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
5140
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
5192
5141
|
attempts: for (let attemptIndex = -jokerParameterNames.length; attemptIndex < maxAttempts; attemptIndex++) {
|
|
5193
5142
|
const isJokerAttempt = attemptIndex < 0;
|
|
5194
5143
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
@@ -5708,9 +5657,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5708
5657
|
return ''; // <- Note: Np knowledge present, return empty string
|
|
5709
5658
|
}
|
|
5710
5659
|
try {
|
|
5711
|
-
|
|
5712
|
-
const _llms = arrayableToArray(tools.llm);
|
|
5713
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
5660
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
5714
5661
|
const taskEmbeddingPrompt = {
|
|
5715
5662
|
title: 'Knowledge Search',
|
|
5716
5663
|
modelRequirements: {
|
|
@@ -6311,13 +6258,13 @@ function createPipelineExecutor(options) {
|
|
|
6311
6258
|
// Calculate and update tldr based on pipeline progress
|
|
6312
6259
|
const cv = newOngoingResult;
|
|
6313
6260
|
// Calculate progress based on parameters resolved vs total parameters
|
|
6314
|
-
const totalParameters = pipeline.parameters.filter(p => !p.isInput).length;
|
|
6261
|
+
const totalParameters = pipeline.parameters.filter((p) => !p.isInput).length;
|
|
6315
6262
|
let resolvedParameters = 0;
|
|
6316
6263
|
let currentTaskTitle = '';
|
|
6317
6264
|
// Get the resolved parameters from output parameters
|
|
6318
6265
|
if (cv === null || cv === void 0 ? void 0 : cv.outputParameters) {
|
|
6319
6266
|
// Count how many output parameters have non-empty values
|
|
6320
|
-
resolvedParameters = Object.values(cv.outputParameters).filter(value => value !== undefined && value !== null && String(value).trim() !== '').length;
|
|
6267
|
+
resolvedParameters = Object.values(cv.outputParameters).filter((value) => value !== undefined && value !== null && String(value).trim() !== '').length;
|
|
6321
6268
|
}
|
|
6322
6269
|
// Try to determine current task from execution report
|
|
6323
6270
|
if (((_a = cv === null || cv === void 0 ? void 0 : cv.executionReport) === null || _a === void 0 ? void 0 : _a.promptExecutions) && cv.executionReport.promptExecutions.length > 0) {
|
|
@@ -6427,9 +6374,7 @@ class MarkdownScraper {
|
|
|
6427
6374
|
throw new MissingToolsError('LLM tools are required for scraping external files');
|
|
6428
6375
|
// <- Note: This scraper is used in all other scrapers, so saying "external files" not "markdown files"
|
|
6429
6376
|
}
|
|
6430
|
-
|
|
6431
|
-
const _llms = arrayableToArray(llm);
|
|
6432
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
6377
|
+
const llmTools = getSingleLlmExecutionTools(llm);
|
|
6433
6378
|
// TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
|
|
6434
6379
|
const collection = createCollectionFromJson(...PipelineCollection);
|
|
6435
6380
|
const prepareKnowledgeFromMarkdownExecutor = createPipelineExecutor({
|
|
@@ -6629,11 +6574,12 @@ class WebsiteScraper {
|
|
|
6629
6574
|
catch (error) {
|
|
6630
6575
|
// Note: If we can't write to cache, we'll continue without caching
|
|
6631
6576
|
// This handles read-only filesystems like Vercel
|
|
6632
|
-
if (error instanceof Error &&
|
|
6633
|
-
error.message.includes('
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6577
|
+
if (error instanceof Error &&
|
|
6578
|
+
(error.message.includes('EROFS') ||
|
|
6579
|
+
error.message.includes('read-only') ||
|
|
6580
|
+
error.message.includes('EACCES') ||
|
|
6581
|
+
error.message.includes('EPERM') ||
|
|
6582
|
+
error.message.includes('ENOENT'))) ;
|
|
6637
6583
|
else {
|
|
6638
6584
|
// Re-throw other unexpected errors
|
|
6639
6585
|
throw error;
|