@promptbook/pdf 0.103.0-55 → 0.103.0-66
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 +91 -39
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +2 -2
- package/esm/typings/src/_packages/core.index.d.ts +6 -8
- package/esm/typings/src/_packages/types.index.d.ts +7 -1
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
- package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +3 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +6 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +52 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +14 -0
- package/esm/typings/src/book-components/icons/SendIcon.d.ts +3 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +4 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.test.d.ts +4 -0
- package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +6 -0
- package/esm/typings/src/commitments/META_FONT/META_FONT.d.ts +42 -0
- package/esm/typings/src/commitments/USE/USE.d.ts +53 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +42 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.test.d.ts +1 -0
- package/esm/typings/src/commitments/{IMPORTANT/IMPORTANT.d.ts → USE_MCP/USE_MCP.d.ts} +16 -5
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +38 -0
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +6 -0
- package/esm/typings/src/commitments/index.d.ts +93 -1
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +3 -1
- package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
- package/esm/typings/src/playground/playground.d.ts +3 -0
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/utils/color/Color.d.ts +9 -1
- package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +6 -0
- package/esm/typings/src/utils/random/CzechNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/EnglishNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/NamePool.d.ts +17 -0
- package/esm/typings/src/utils/random/getNamePool.d.ts +10 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +3 -3
- package/umd/index.umd.js +116 -64
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgent.d.ts +0 -29
- package/esm/typings/src/commitments/registry.d.ts +0 -68
- package/esm/typings/src/playground/playground1.d.ts +0 -2
package/esm/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mkdir, rm, readFile } from 'fs/promises';
|
|
2
|
-
import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
2
|
+
import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
3
3
|
import { SHA256 } from 'crypto-js';
|
|
4
4
|
import hexEncoder from 'crypto-js/enc-hex';
|
|
5
5
|
import { basename, join, dirname, isAbsolute } from 'path';
|
|
@@ -24,7 +24,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
24
24
|
* @generated
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
27
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-66';
|
|
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
|
|
@@ -47,6 +47,17 @@ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-55';
|
|
|
47
47
|
function keepUnused(...valuesToKeep) {
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Trims string from all 4 sides
|
|
52
|
+
*
|
|
53
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
54
|
+
* Developed by same author @hejny as this package
|
|
55
|
+
*
|
|
56
|
+
* @public exported from `@promptbook/utils`
|
|
57
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
58
|
+
*/
|
|
59
|
+
const spaceTrim = spaceTrim$1;
|
|
60
|
+
|
|
50
61
|
/**
|
|
51
62
|
* Just marks a place of place where should be something implemented
|
|
52
63
|
* No side effects.
|
|
@@ -108,6 +119,7 @@ function take(initialValue) {
|
|
|
108
119
|
* @public exported from `@promptbook/color`
|
|
109
120
|
*/
|
|
110
121
|
const CSS_COLORS = {
|
|
122
|
+
promptbook: '#79EAFD',
|
|
111
123
|
transparent: 'rgba(0,0,0,0)',
|
|
112
124
|
aliceblue: '#f0f8ff',
|
|
113
125
|
antiquewhite: '#faebd7',
|
|
@@ -308,21 +320,61 @@ class Color {
|
|
|
308
320
|
* @param color
|
|
309
321
|
* @returns Color object
|
|
310
322
|
*/
|
|
311
|
-
static from(color) {
|
|
312
|
-
if (color
|
|
323
|
+
static from(color, _isSingleValue = false) {
|
|
324
|
+
if (color === '') {
|
|
325
|
+
throw new Error(`Can not create color from empty string`);
|
|
326
|
+
}
|
|
327
|
+
else if (color instanceof Color) {
|
|
313
328
|
return take(color);
|
|
314
329
|
}
|
|
315
330
|
else if (Color.isColor(color)) {
|
|
316
331
|
return take(color);
|
|
317
332
|
}
|
|
318
333
|
else if (typeof color === 'string') {
|
|
319
|
-
|
|
334
|
+
try {
|
|
335
|
+
return Color.fromString(color);
|
|
336
|
+
}
|
|
337
|
+
catch (error) {
|
|
338
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
339
|
+
if (_isSingleValue) {
|
|
340
|
+
throw error;
|
|
341
|
+
}
|
|
342
|
+
const parts = color.split(/[\s+,;|]/);
|
|
343
|
+
if (parts.length > 0) {
|
|
344
|
+
return Color.from(parts[0].trim(), true);
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
320
350
|
}
|
|
321
351
|
else {
|
|
322
352
|
console.error({ color });
|
|
323
353
|
throw new Error(`Can not create color from given object`);
|
|
324
354
|
}
|
|
325
355
|
}
|
|
356
|
+
/**
|
|
357
|
+
* Creates a new Color instance from miscellaneous formats
|
|
358
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
359
|
+
*
|
|
360
|
+
* @param color
|
|
361
|
+
* @returns Color object
|
|
362
|
+
*/
|
|
363
|
+
static fromSafe(color) {
|
|
364
|
+
try {
|
|
365
|
+
return Color.from(color);
|
|
366
|
+
}
|
|
367
|
+
catch (error) {
|
|
368
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
369
|
+
console.warn(spaceTrim((block) => `
|
|
370
|
+
Color.fromSafe error:
|
|
371
|
+
${block(error.message)}
|
|
372
|
+
|
|
373
|
+
Returning default PROMPTBOOK_COLOR.
|
|
374
|
+
`));
|
|
375
|
+
return Color.fromString('promptbook');
|
|
376
|
+
}
|
|
377
|
+
}
|
|
326
378
|
/**
|
|
327
379
|
* Creates a new Color instance from miscellaneous string formats
|
|
328
380
|
*
|
|
@@ -932,7 +984,7 @@ const ADMIN_GITHUB_NAME = 'hejny';
|
|
|
932
984
|
*
|
|
933
985
|
* @public exported from `@promptbook/core`
|
|
934
986
|
*/
|
|
935
|
-
const PROMPTBOOK_COLOR = Color.
|
|
987
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
936
988
|
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
937
989
|
/**
|
|
938
990
|
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
@@ -1156,7 +1208,7 @@ class KnowledgeScrapeError extends Error {
|
|
|
1156
1208
|
function getErrorReportUrl(error) {
|
|
1157
1209
|
const report = {
|
|
1158
1210
|
title: `🐜 Error report from ${NAME}`,
|
|
1159
|
-
body: spaceTrim((block) => `
|
|
1211
|
+
body: spaceTrim$2((block) => `
|
|
1160
1212
|
|
|
1161
1213
|
|
|
1162
1214
|
\`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
|
|
@@ -2053,7 +2105,7 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
2053
2105
|
pipelineString += '\n\n';
|
|
2054
2106
|
pipelineString += '```' + contentLanguage;
|
|
2055
2107
|
pipelineString += '\n';
|
|
2056
|
-
pipelineString += spaceTrim(content);
|
|
2108
|
+
pipelineString += spaceTrim$2(content);
|
|
2057
2109
|
// <- TODO: [main] !!3 Escape
|
|
2058
2110
|
// <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
|
|
2059
2111
|
pipelineString += '\n';
|
|
@@ -2174,7 +2226,7 @@ function checkSerializableAsJson(options) {
|
|
|
2174
2226
|
}
|
|
2175
2227
|
else if (typeof value === 'object') {
|
|
2176
2228
|
if (value instanceof Date) {
|
|
2177
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
2229
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
2178
2230
|
\`${name}\` is Date
|
|
2179
2231
|
|
|
2180
2232
|
Use \`string_date_iso8601\` instead
|
|
@@ -2193,7 +2245,7 @@ function checkSerializableAsJson(options) {
|
|
|
2193
2245
|
throw new UnexpectedError(`${name} is RegExp`);
|
|
2194
2246
|
}
|
|
2195
2247
|
else if (value instanceof Error) {
|
|
2196
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
2248
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
2197
2249
|
\`${name}\` is unserialized Error
|
|
2198
2250
|
|
|
2199
2251
|
Use function \`serializeError\`
|
|
@@ -2216,7 +2268,7 @@ function checkSerializableAsJson(options) {
|
|
|
2216
2268
|
}
|
|
2217
2269
|
catch (error) {
|
|
2218
2270
|
assertsError(error);
|
|
2219
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
2271
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
2220
2272
|
\`${name}\` is not serializable
|
|
2221
2273
|
|
|
2222
2274
|
${block(error.stack || error.message)}
|
|
@@ -2248,7 +2300,7 @@ function checkSerializableAsJson(options) {
|
|
|
2248
2300
|
}
|
|
2249
2301
|
}
|
|
2250
2302
|
else {
|
|
2251
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
2303
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
2252
2304
|
\`${name}\` is unknown type
|
|
2253
2305
|
|
|
2254
2306
|
Additional message for \`${name}\`:
|
|
@@ -3279,7 +3331,7 @@ function serializeError(error) {
|
|
|
3279
3331
|
const { name, message, stack } = error;
|
|
3280
3332
|
const { id } = error;
|
|
3281
3333
|
if (!Object.keys(ALL_ERRORS).includes(name)) {
|
|
3282
|
-
console.error(spaceTrim((block) => `
|
|
3334
|
+
console.error(spaceTrim$2((block) => `
|
|
3283
3335
|
|
|
3284
3336
|
Cannot serialize error with name "${name}"
|
|
3285
3337
|
|
|
@@ -3312,7 +3364,7 @@ function jsonParse(value) {
|
|
|
3312
3364
|
}
|
|
3313
3365
|
else if (typeof value !== 'string') {
|
|
3314
3366
|
console.error('Can not parse JSON from non-string value.', { text: value });
|
|
3315
|
-
throw new Error(spaceTrim(`
|
|
3367
|
+
throw new Error(spaceTrim$2(`
|
|
3316
3368
|
Can not parse JSON from non-string value.
|
|
3317
3369
|
|
|
3318
3370
|
The value type: ${typeof value}
|
|
@@ -3326,7 +3378,7 @@ function jsonParse(value) {
|
|
|
3326
3378
|
if (!(error instanceof Error)) {
|
|
3327
3379
|
throw error;
|
|
3328
3380
|
}
|
|
3329
|
-
throw new Error(spaceTrim((block) => `
|
|
3381
|
+
throw new Error(spaceTrim$2((block) => `
|
|
3330
3382
|
${block(error.message)}
|
|
3331
3383
|
|
|
3332
3384
|
The expected JSON text:
|
|
@@ -3379,7 +3431,7 @@ function deserializeError(error) {
|
|
|
3379
3431
|
message = `${name}: ${message}`;
|
|
3380
3432
|
}
|
|
3381
3433
|
if (stack !== undefined && stack !== '') {
|
|
3382
|
-
message = spaceTrim((block) => `
|
|
3434
|
+
message = spaceTrim$2((block) => `
|
|
3383
3435
|
${block(message)}
|
|
3384
3436
|
|
|
3385
3437
|
Original stack trace:
|
|
@@ -3891,14 +3943,14 @@ class MultipleLlmExecutionTools {
|
|
|
3891
3943
|
if (description === undefined) {
|
|
3892
3944
|
return headLine;
|
|
3893
3945
|
}
|
|
3894
|
-
return spaceTrim((block) => `
|
|
3946
|
+
return spaceTrim$2((block) => `
|
|
3895
3947
|
${headLine}
|
|
3896
3948
|
|
|
3897
3949
|
${ /* <- Note: Indenting the description: */block(description)}
|
|
3898
3950
|
`);
|
|
3899
3951
|
})
|
|
3900
3952
|
.join('\n\n');
|
|
3901
|
-
return spaceTrim((block) => `
|
|
3953
|
+
return spaceTrim$2((block) => `
|
|
3902
3954
|
Multiple LLM Providers:
|
|
3903
3955
|
|
|
3904
3956
|
${block(innerModelsTitlesAndDescriptions)}
|
|
@@ -3989,7 +4041,7 @@ class MultipleLlmExecutionTools {
|
|
|
3989
4041
|
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
3990
4042
|
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
3991
4043
|
// 3) ...
|
|
3992
|
-
spaceTrim((block) => `
|
|
4044
|
+
spaceTrim$2((block) => `
|
|
3993
4045
|
All execution tools of ${this.title} failed:
|
|
3994
4046
|
|
|
3995
4047
|
${block(errors
|
|
@@ -4002,7 +4054,7 @@ class MultipleLlmExecutionTools {
|
|
|
4002
4054
|
throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
|
|
4003
4055
|
}
|
|
4004
4056
|
else {
|
|
4005
|
-
throw new PipelineExecutionError(spaceTrim((block) => `
|
|
4057
|
+
throw new PipelineExecutionError(spaceTrim$2((block) => `
|
|
4006
4058
|
You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
|
|
4007
4059
|
|
|
4008
4060
|
Available \`LlmExecutionTools\`:
|
|
@@ -4035,7 +4087,7 @@ class MultipleLlmExecutionTools {
|
|
|
4035
4087
|
*/
|
|
4036
4088
|
function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
4037
4089
|
if (llmExecutionTools.length === 0) {
|
|
4038
|
-
const warningMessage = spaceTrim(`
|
|
4090
|
+
const warningMessage = spaceTrim$2(`
|
|
4039
4091
|
You have not provided any \`LlmExecutionTools\`
|
|
4040
4092
|
This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
|
|
4041
4093
|
|
|
@@ -4352,14 +4404,14 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
4352
4404
|
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
4353
4405
|
});
|
|
4354
4406
|
if (metadata.length === 0) {
|
|
4355
|
-
return spaceTrim(`
|
|
4407
|
+
return spaceTrim$2(`
|
|
4356
4408
|
**No scrapers are available**
|
|
4357
4409
|
|
|
4358
4410
|
This is a unexpected behavior, you are probably using some broken version of Promptbook
|
|
4359
4411
|
At least there should be available the metadata of the scrapers
|
|
4360
4412
|
`);
|
|
4361
4413
|
}
|
|
4362
|
-
return spaceTrim((block) => `
|
|
4414
|
+
return spaceTrim$2((block) => `
|
|
4363
4415
|
Available scrapers are:
|
|
4364
4416
|
${block(metadata
|
|
4365
4417
|
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
@@ -4470,7 +4522,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
|
|
|
4470
4522
|
else if (urlOrRequest instanceof Request) {
|
|
4471
4523
|
url = urlOrRequest.url;
|
|
4472
4524
|
}
|
|
4473
|
-
throw new PromptbookFetchError(spaceTrim((block) => `
|
|
4525
|
+
throw new PromptbookFetchError(spaceTrim$2((block) => `
|
|
4474
4526
|
Can not fetch "${url}"
|
|
4475
4527
|
|
|
4476
4528
|
Fetch error:
|
|
@@ -4631,7 +4683,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
4631
4683
|
const fileExtension = getFileExtension(filename);
|
|
4632
4684
|
const mimeType = extensionToMimeType(fileExtension || '');
|
|
4633
4685
|
if (!(await isFileExisting(filename, tools.fs))) {
|
|
4634
|
-
throw new NotFoundError(spaceTrim((block) => `
|
|
4686
|
+
throw new NotFoundError(spaceTrim$2((block) => `
|
|
4635
4687
|
Can not make source handler for file which does not exist:
|
|
4636
4688
|
|
|
4637
4689
|
File:
|
|
@@ -4724,7 +4776,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
4724
4776
|
// <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
|
|
4725
4777
|
break;
|
|
4726
4778
|
}
|
|
4727
|
-
console.warn(spaceTrim((block) => `
|
|
4779
|
+
console.warn(spaceTrim$2((block) => `
|
|
4728
4780
|
Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
|
|
4729
4781
|
|
|
4730
4782
|
The source:
|
|
@@ -4740,7 +4792,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
4740
4792
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
4741
4793
|
}
|
|
4742
4794
|
if (partialPieces === null) {
|
|
4743
|
-
throw new KnowledgeScrapeError(spaceTrim((block) => `
|
|
4795
|
+
throw new KnowledgeScrapeError(spaceTrim$2((block) => `
|
|
4744
4796
|
Cannot scrape knowledge
|
|
4745
4797
|
|
|
4746
4798
|
The source:
|
|
@@ -5315,7 +5367,7 @@ const CsvFormatParser = {
|
|
|
5315
5367
|
const { value, outputParameterName, settings, mapCallback, onProgress } = options;
|
|
5316
5368
|
const csv = csvParse(value, settings);
|
|
5317
5369
|
if (csv.errors.length !== 0) {
|
|
5318
|
-
throw new CsvFormatError(spaceTrim((block) => `
|
|
5370
|
+
throw new CsvFormatError(spaceTrim$2((block) => `
|
|
5319
5371
|
CSV parsing error
|
|
5320
5372
|
|
|
5321
5373
|
Error(s) from CSV parsing:
|
|
@@ -5360,7 +5412,7 @@ const CsvFormatParser = {
|
|
|
5360
5412
|
const { value, settings, mapCallback, onProgress } = options;
|
|
5361
5413
|
const csv = csvParse(value, settings);
|
|
5362
5414
|
if (csv.errors.length !== 0) {
|
|
5363
|
-
throw new CsvFormatError(spaceTrim((block) => `
|
|
5415
|
+
throw new CsvFormatError(spaceTrim$2((block) => `
|
|
5364
5416
|
CSV parsing error
|
|
5365
5417
|
|
|
5366
5418
|
Error(s) from CSV parsing:
|
|
@@ -5570,7 +5622,7 @@ function mapAvailableToExpectedParameters(options) {
|
|
|
5570
5622
|
}
|
|
5571
5623
|
// Phase 2️⃣: Non-matching mapping
|
|
5572
5624
|
if (expectedParameterNames.size !== availableParametersNames.size) {
|
|
5573
|
-
throw new PipelineExecutionError(spaceTrim((block) => `
|
|
5625
|
+
throw new PipelineExecutionError(spaceTrim$2((block) => `
|
|
5574
5626
|
Can not map available parameters to expected parameters
|
|
5575
5627
|
|
|
5576
5628
|
Mapped parameters:
|
|
@@ -6355,7 +6407,7 @@ async function executeFormatSubvalues(options) {
|
|
|
6355
6407
|
return /* not await */ executeAttempts({ ...options, logLlmCall });
|
|
6356
6408
|
}
|
|
6357
6409
|
if (jokerParameterNames.length !== 0) {
|
|
6358
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
6410
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
6359
6411
|
JOKER parameters are not supported together with FOREACH command
|
|
6360
6412
|
|
|
6361
6413
|
[🧞♀️] This should be prevented in \`validatePipeline\`
|
|
@@ -6368,7 +6420,7 @@ async function executeFormatSubvalues(options) {
|
|
|
6368
6420
|
if (formatDefinition === undefined) {
|
|
6369
6421
|
throw new UnexpectedError(
|
|
6370
6422
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
6371
|
-
spaceTrim((block) => `
|
|
6423
|
+
spaceTrim$2((block) => `
|
|
6372
6424
|
Unsupported format "${task.foreach.formatName}"
|
|
6373
6425
|
|
|
6374
6426
|
Available formats:
|
|
@@ -6385,7 +6437,7 @@ async function executeFormatSubvalues(options) {
|
|
|
6385
6437
|
if (subvalueParser === undefined) {
|
|
6386
6438
|
throw new UnexpectedError(
|
|
6387
6439
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
6388
|
-
spaceTrim((block) => `
|
|
6440
|
+
spaceTrim$2((block) => `
|
|
6389
6441
|
Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
|
|
6390
6442
|
|
|
6391
6443
|
Available subformat names for format "${formatDefinition.formatName}":
|
|
@@ -6425,7 +6477,7 @@ async function executeFormatSubvalues(options) {
|
|
|
6425
6477
|
if (!(error instanceof PipelineExecutionError)) {
|
|
6426
6478
|
throw error;
|
|
6427
6479
|
}
|
|
6428
|
-
const highLevelError = new PipelineExecutionError(spaceTrim((block) => `
|
|
6480
|
+
const highLevelError = new PipelineExecutionError(spaceTrim$2((block) => `
|
|
6429
6481
|
${error.message}
|
|
6430
6482
|
|
|
6431
6483
|
This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
@@ -6449,7 +6501,7 @@ async function executeFormatSubvalues(options) {
|
|
|
6449
6501
|
...options,
|
|
6450
6502
|
priority: priority + index,
|
|
6451
6503
|
parameters: allSubparameters,
|
|
6452
|
-
pipelineIdentification: spaceTrim((block) => `
|
|
6504
|
+
pipelineIdentification: spaceTrim$2((block) => `
|
|
6453
6505
|
${block(pipelineIdentification)}
|
|
6454
6506
|
Subparameter index: ${index}
|
|
6455
6507
|
`),
|
|
@@ -6458,7 +6510,7 @@ async function executeFormatSubvalues(options) {
|
|
|
6458
6510
|
}
|
|
6459
6511
|
catch (error) {
|
|
6460
6512
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
6461
|
-
console.error(spaceTrim((block) => `
|
|
6513
|
+
console.error(spaceTrim$2((block) => `
|
|
6462
6514
|
${error.message}
|
|
6463
6515
|
|
|
6464
6516
|
This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
@@ -7330,8 +7382,8 @@ class MarkdownScraper {
|
|
|
7330
7382
|
knowledgeTextPieces.map(async (knowledgeTextPiece, i) => {
|
|
7331
7383
|
// Note: These are just default values, they will be overwritten by the actual values:
|
|
7332
7384
|
let name = `piece-${i}`;
|
|
7333
|
-
let title = spaceTrim(knowledgeTextPiece.substring(0, 100));
|
|
7334
|
-
const knowledgePieceContent = spaceTrim(knowledgeTextPiece);
|
|
7385
|
+
let title = spaceTrim$2(knowledgeTextPiece.substring(0, 100));
|
|
7386
|
+
const knowledgePieceContent = spaceTrim$2(knowledgeTextPiece);
|
|
7335
7387
|
let keywords = [];
|
|
7336
7388
|
const index = [];
|
|
7337
7389
|
/*
|
|
@@ -7344,7 +7396,7 @@ class MarkdownScraper {
|
|
|
7344
7396
|
isCrashedOnError: true,
|
|
7345
7397
|
});
|
|
7346
7398
|
const { title: titleRaw = 'Untitled' } = titleResult.outputParameters;
|
|
7347
|
-
title = spaceTrim(titleRaw) /* <- TODO: Maybe do in pipeline */;
|
|
7399
|
+
title = spaceTrim$2(titleRaw) /* <- TODO: Maybe do in pipeline */;
|
|
7348
7400
|
name = titleToName(title);
|
|
7349
7401
|
// --- Keywords
|
|
7350
7402
|
const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise({
|