@promptbook/cli 0.88.0-9 → 0.89.0-1
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 +35 -14
- package/esm/index.es.js +65 -29
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +10 -0
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/errors/PipelineExecutionError.d.ts +5 -0
- package/esm/typings/src/errors/utils/ErrorJson.d.ts +5 -0
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +7 -0
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/{countTotalUsage.d.ts → countUsage.d.ts} +1 -1
- package/esm/typings/src/playground/BrjappConnector.d.ts +64 -0
- package/esm/typings/src/playground/brjapp-api-schema.d.ts +12879 -0
- package/esm/typings/src/playground/playground.d.ts +5 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +2 -1
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +15 -3
- package/esm/typings/src/types/typeAliases.d.ts +2 -2
- package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countLines.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countPages.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countWords.d.ts +3 -0
- package/package.json +1 -1
- package/umd/index.umd.js +67 -31
- package/umd/index.umd.js.map +1 -1
package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts
CHANGED
|
@@ -37,7 +37,8 @@ export type PromptbookServer_AnonymousIdentification = {
|
|
|
37
37
|
/**
|
|
38
38
|
* Identifier of the end user
|
|
39
39
|
*
|
|
40
|
-
* Note:
|
|
40
|
+
* Note: This can be either some id or email or any other identifier
|
|
41
|
+
* Note: In anonymous mode, this is passed to the certain model providers to identify misuse
|
|
41
42
|
* Note: In anonymous mode, there is no need to identify yourself, nor does it change the actual configuration of LLM Tools (unlike in application mode)
|
|
42
43
|
*/
|
|
43
44
|
readonly userId?: string_user_id;
|
|
@@ -58,15 +58,27 @@ export type ApplicationRemoteServerOptions<TCustomOptions> = {
|
|
|
58
58
|
};
|
|
59
59
|
export type ApplicationRemoteServerClientOptions<TCustomOptions> = {
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* Identifier of the application
|
|
62
|
+
*
|
|
63
|
+
* Note: This is usefull when you use Promptbook remote server for multiple apps/frontends, if its used just for single app, use here just "app" or "your-app-name"
|
|
64
|
+
* Note: This can be some id or some semantic name like "email-agent"
|
|
62
65
|
*/
|
|
63
66
|
readonly appId: string_app_id | null;
|
|
64
67
|
/**
|
|
65
|
-
*
|
|
68
|
+
* Identifier of the end user
|
|
69
|
+
*
|
|
70
|
+
* Note: This can be either some id or email or any other identifier
|
|
71
|
+
* Note: This is also passed to the certain model providers to identify misuse
|
|
66
72
|
*/
|
|
67
73
|
readonly userId?: string_user_id;
|
|
68
74
|
/**
|
|
69
|
-
*
|
|
75
|
+
* Token of the user to verify its identity
|
|
76
|
+
*
|
|
77
|
+
* Note: This is passed for example to `createLlmExecutionTools`
|
|
78
|
+
*/
|
|
79
|
+
readonly userToken?: string_user_id;
|
|
80
|
+
/**
|
|
81
|
+
* Additional arbitrary options to identify the client or to pass custom metadata
|
|
70
82
|
*/
|
|
71
83
|
readonly customOptions?: TCustomOptions;
|
|
72
84
|
};
|
|
@@ -433,13 +433,13 @@ export type string_uuid = string & {
|
|
|
433
433
|
*
|
|
434
434
|
* @@@
|
|
435
435
|
*/
|
|
436
|
-
export type string_app_id = id;
|
|
436
|
+
export type string_app_id = id | 'app';
|
|
437
437
|
/**
|
|
438
438
|
* End user identifier
|
|
439
439
|
*
|
|
440
440
|
* @@@
|
|
441
441
|
*/
|
|
442
|
-
export type string_user_id = id;
|
|
442
|
+
export type string_user_id = id | string_email;
|
|
443
443
|
/**
|
|
444
444
|
* Semantic helper
|
|
445
445
|
*
|
|
@@ -5,3 +5,6 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
|
|
|
5
5
|
* @public exported from `@promptbook/utils`
|
|
6
6
|
*/
|
|
7
7
|
export declare function countCharacters(text: string): ExpectationAmount;
|
|
8
|
+
/**
|
|
9
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
10
|
+
*/
|
|
@@ -7,3 +7,6 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
|
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
8
8
|
*/
|
|
9
9
|
export declare function countLines(text: string): ExpectationAmount;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
12
|
+
*/
|
|
@@ -7,3 +7,6 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
|
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
8
8
|
*/
|
|
9
9
|
export declare function countPages(text: string): ExpectationAmount;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
12
|
+
*/
|
|
@@ -5,3 +5,6 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
|
|
|
5
5
|
* @public exported from `@promptbook/utils`
|
|
6
6
|
*/
|
|
7
7
|
export declare function countParagraphs(text: string): ExpectationAmount;
|
|
8
|
+
/**
|
|
9
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
10
|
+
*/
|
|
@@ -11,3 +11,6 @@ export declare function splitIntoSentences(text: string): ReadonlyArray<string>;
|
|
|
11
11
|
* @public exported from `@promptbook/utils`
|
|
12
12
|
*/
|
|
13
13
|
export declare function countSentences(text: string): ExpectationAmount;
|
|
14
|
+
/**
|
|
15
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
16
|
+
*/
|
|
@@ -5,3 +5,6 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
|
|
|
5
5
|
* @public exported from `@promptbook/utils`
|
|
6
6
|
*/
|
|
7
7
|
export declare function countWords(text: string): ExpectationAmount;
|
|
8
|
+
/**
|
|
9
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
10
|
+
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('commander'), require('spacetrim'), require('waitasecond'), require('path'), require('fs/promises'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'colors', 'commander', 'spacetrim', 'waitasecond', 'path', 'fs/promises', 'crypto-js/enc-hex', 'crypto-js/sha256', 'dotenv', 'child_process', 'jszip', 'prettier', 'prettier/parser-html', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-cli"] = {}, global.colors, global.commander, global.spaceTrim, global.waitasecond, global.path, global.promises, global.hexEncoder, global.sha256, global.
|
|
5
|
-
})(this, (function (exports, colors, commander, spaceTrim, waitasecond, path, promises, hexEncoder, sha256, dotenv, child_process, JSZip, prettier, parserHtml,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('commander'), require('spacetrim'), require('waitasecond'), require('path'), require('fs/promises'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('crypto'), require('rxjs'), require('dotenv'), require('child_process'), require('jszip'), require('prettier'), require('prettier/parser-html'), require('papaparse'), require('crypto-js'), require('mime-types'), require('glob-promise'), require('prompts'), require('moment'), require('express'), require('http'), require('socket.io'), require('socket.io-client'), require('@anthropic-ai/sdk'), require('@azure/openai'), require('openai'), require('@mozilla/readability'), require('jsdom'), require('showdown')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'colors', 'commander', 'spacetrim', 'waitasecond', 'path', 'fs/promises', 'crypto-js/enc-hex', 'crypto-js/sha256', 'crypto', 'rxjs', 'dotenv', 'child_process', 'jszip', 'prettier', 'prettier/parser-html', 'papaparse', 'crypto-js', 'mime-types', 'glob-promise', 'prompts', 'moment', 'express', 'http', 'socket.io', 'socket.io-client', '@anthropic-ai/sdk', '@azure/openai', 'openai', '@mozilla/readability', 'jsdom', 'showdown'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-cli"] = {}, global.colors, global.commander, global.spaceTrim, global.waitasecond, global.path, global.promises, global.hexEncoder, global.sha256, global.crypto, global.rxjs, global.dotenv, global.child_process, global.JSZip, global.prettier, global.parserHtml, global.papaparse, global.cryptoJs, global.mimeTypes, global.glob, global.prompts, global.moment, global.express, global.http, global.socket_io, global.socket_ioClient, global.Anthropic, global.openai, global.OpenAI, global.readability, global.jsdom, global.showdown));
|
|
5
|
+
})(this, (function (exports, colors, commander, spaceTrim, waitasecond, path, promises, hexEncoder, sha256, crypto, rxjs, dotenv, child_process, JSZip, prettier, parserHtml, papaparse, cryptoJs, mimeTypes, glob, prompts, moment, express, http, socket_io, socket_ioClient, Anthropic, openai, OpenAI, readability, jsdom, showdown) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
* @generated
|
|
55
55
|
* @see https://github.com/webgptorg/promptbook
|
|
56
56
|
*/
|
|
57
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
57
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-1';
|
|
58
58
|
/**
|
|
59
59
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
60
60
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -214,7 +214,7 @@
|
|
|
214
214
|
*
|
|
215
215
|
* @public exported from `@promptbook/core`
|
|
216
216
|
*/
|
|
217
|
-
const DEFAULT_MAX_EXECUTION_ATTEMPTS =
|
|
217
|
+
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [🤹♂️]
|
|
218
218
|
/**
|
|
219
219
|
* Where to store your books
|
|
220
220
|
* This is kind of a "src" for your books
|
|
@@ -1508,6 +1508,21 @@
|
|
|
1508
1508
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
1509
1509
|
*/
|
|
1510
1510
|
|
|
1511
|
+
/**
|
|
1512
|
+
* Generates random token
|
|
1513
|
+
*
|
|
1514
|
+
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
1515
|
+
*
|
|
1516
|
+
* @private internal helper function
|
|
1517
|
+
* @returns secure random token
|
|
1518
|
+
*/
|
|
1519
|
+
function $randomToken(randomness) {
|
|
1520
|
+
return crypto.randomBytes(randomness).toString('hex');
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
1524
|
+
*/
|
|
1525
|
+
|
|
1511
1526
|
/**
|
|
1512
1527
|
* This error indicates errors during the execution of the pipeline
|
|
1513
1528
|
*
|
|
@@ -1515,11 +1530,17 @@
|
|
|
1515
1530
|
*/
|
|
1516
1531
|
class PipelineExecutionError extends Error {
|
|
1517
1532
|
constructor(message) {
|
|
1533
|
+
// Added id parameter
|
|
1518
1534
|
super(message);
|
|
1519
1535
|
this.name = 'PipelineExecutionError';
|
|
1536
|
+
// TODO: [🐙] DRY - Maybe $randomId
|
|
1537
|
+
this.id = `error-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */)}`;
|
|
1520
1538
|
Object.setPrototypeOf(this, PipelineExecutionError.prototype);
|
|
1521
1539
|
}
|
|
1522
1540
|
}
|
|
1541
|
+
/**
|
|
1542
|
+
* TODO: !!!!!! Add id to all errors
|
|
1543
|
+
*/
|
|
1523
1544
|
|
|
1524
1545
|
/**
|
|
1525
1546
|
* Stores data in memory (HEAP)
|
|
@@ -1778,8 +1799,9 @@
|
|
|
1778
1799
|
* @returns LLM tools with same functionality with added total cost counting
|
|
1779
1800
|
* @public exported from `@promptbook/core`
|
|
1780
1801
|
*/
|
|
1781
|
-
function
|
|
1802
|
+
function countUsage(llmTools) {
|
|
1782
1803
|
let totalUsage = ZERO_USAGE;
|
|
1804
|
+
const spending = new rxjs.Subject();
|
|
1783
1805
|
const proxyTools = {
|
|
1784
1806
|
get title() {
|
|
1785
1807
|
// TODO: [🧠] Maybe put here some suffix
|
|
@@ -1789,12 +1811,15 @@
|
|
|
1789
1811
|
// TODO: [🧠] Maybe put here some suffix
|
|
1790
1812
|
return llmTools.description;
|
|
1791
1813
|
},
|
|
1792
|
-
|
|
1814
|
+
checkConfiguration() {
|
|
1793
1815
|
return /* not await */ llmTools.checkConfiguration();
|
|
1794
1816
|
},
|
|
1795
1817
|
listModels() {
|
|
1796
1818
|
return /* not await */ llmTools.listModels();
|
|
1797
1819
|
},
|
|
1820
|
+
spending() {
|
|
1821
|
+
return spending.asObservable();
|
|
1822
|
+
},
|
|
1798
1823
|
getTotalUsage() {
|
|
1799
1824
|
// <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
1800
1825
|
return totalUsage;
|
|
@@ -1805,6 +1830,7 @@
|
|
|
1805
1830
|
// console.info('[🚕] callChatModel through countTotalUsage');
|
|
1806
1831
|
const promptResult = await llmTools.callChatModel(prompt);
|
|
1807
1832
|
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1833
|
+
spending.next(promptResult.usage);
|
|
1808
1834
|
return promptResult;
|
|
1809
1835
|
};
|
|
1810
1836
|
}
|
|
@@ -1813,6 +1839,7 @@
|
|
|
1813
1839
|
// console.info('[🚕] callCompletionModel through countTotalUsage');
|
|
1814
1840
|
const promptResult = await llmTools.callCompletionModel(prompt);
|
|
1815
1841
|
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1842
|
+
spending.next(promptResult.usage);
|
|
1816
1843
|
return promptResult;
|
|
1817
1844
|
};
|
|
1818
1845
|
}
|
|
@@ -1821,6 +1848,7 @@
|
|
|
1821
1848
|
// console.info('[🚕] callEmbeddingModel through countTotalUsage');
|
|
1822
1849
|
const promptResult = await llmTools.callEmbeddingModel(prompt);
|
|
1823
1850
|
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1851
|
+
spending.next(promptResult.usage);
|
|
1824
1852
|
return promptResult;
|
|
1825
1853
|
};
|
|
1826
1854
|
}
|
|
@@ -2528,7 +2556,7 @@
|
|
|
2528
2556
|
throw new EnvironmentMismatchError('Function `$provideLlmToolsForWizzardOrCli` works only in Node.js environment');
|
|
2529
2557
|
}
|
|
2530
2558
|
const { isCacheReloaded } = options !== null && options !== void 0 ? options : {};
|
|
2531
|
-
return cacheLlmTools(
|
|
2559
|
+
return cacheLlmTools(countUsage(
|
|
2532
2560
|
// <- Note: for example here we don`t want the [🌯]
|
|
2533
2561
|
await $provideLlmToolsFromEnv()), {
|
|
2534
2562
|
storage: new FileCacheStorage({ fs: $provideFilesystemForNode() }, {
|
|
@@ -4083,21 +4111,6 @@
|
|
|
4083
4111
|
* - [♨] Are tasks prepared
|
|
4084
4112
|
*/
|
|
4085
4113
|
|
|
4086
|
-
/**
|
|
4087
|
-
* Generates random token
|
|
4088
|
-
*
|
|
4089
|
-
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
4090
|
-
*
|
|
4091
|
-
* @private internal helper function
|
|
4092
|
-
* @returns secure random token
|
|
4093
|
-
*/
|
|
4094
|
-
function $randomToken(randomness) {
|
|
4095
|
-
return crypto.randomBytes(randomness).toString('hex');
|
|
4096
|
-
}
|
|
4097
|
-
/**
|
|
4098
|
-
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
4099
|
-
*/
|
|
4100
|
-
|
|
4101
4114
|
/**
|
|
4102
4115
|
* Recursively converts JSON strings to JSON objects
|
|
4103
4116
|
|
|
@@ -4278,7 +4291,7 @@
|
|
|
4278
4291
|
* @public exported from `@promptbook/utils`
|
|
4279
4292
|
*/
|
|
4280
4293
|
function deserializeError(error) {
|
|
4281
|
-
const { name, stack } = error;
|
|
4294
|
+
const { name, stack, id } = error; // Added id
|
|
4282
4295
|
let { message } = error;
|
|
4283
4296
|
let ErrorClass = ALL_ERRORS[error.name];
|
|
4284
4297
|
if (ErrorClass === undefined) {
|
|
@@ -4293,7 +4306,9 @@
|
|
|
4293
4306
|
${block(stack || '')}
|
|
4294
4307
|
`);
|
|
4295
4308
|
}
|
|
4296
|
-
|
|
4309
|
+
const deserializedError = new ErrorClass(message);
|
|
4310
|
+
deserializedError.id = id; // Assign id to the error object
|
|
4311
|
+
return deserializedError;
|
|
4297
4312
|
}
|
|
4298
4313
|
|
|
4299
4314
|
/**
|
|
@@ -4343,6 +4358,7 @@
|
|
|
4343
4358
|
*/
|
|
4344
4359
|
function createTask(options) {
|
|
4345
4360
|
const { taskType, taskProcessCallback } = options;
|
|
4361
|
+
// TODO: [🐙] DRY
|
|
4346
4362
|
const taskId = `${taskType.toLowerCase().substring(0, 4)}-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */)}`;
|
|
4347
4363
|
let status = 'RUNNING';
|
|
4348
4364
|
const createdAt = new Date();
|
|
@@ -4375,7 +4391,7 @@
|
|
|
4375
4391
|
assertsTaskSuccessful(executionResult);
|
|
4376
4392
|
status = 'FINISHED';
|
|
4377
4393
|
currentValue = jsonStringsToJsons(executionResult);
|
|
4378
|
-
// <- TODO:
|
|
4394
|
+
// <- TODO: [🧠] Is this a good idea to convert JSON strins to JSONs?
|
|
4379
4395
|
partialResultSubject.next(executionResult);
|
|
4380
4396
|
}
|
|
4381
4397
|
catch (error) {
|
|
@@ -4439,19 +4455,21 @@
|
|
|
4439
4455
|
*/
|
|
4440
4456
|
function serializeError(error) {
|
|
4441
4457
|
const { name, message, stack } = error;
|
|
4458
|
+
const { id } = error;
|
|
4442
4459
|
if (!Object.keys(ALL_ERRORS).includes(name)) {
|
|
4443
4460
|
console.error(spaceTrim__default["default"]((block) => `
|
|
4444
|
-
|
|
4461
|
+
|
|
4445
4462
|
Cannot serialize error with name "${name}"
|
|
4446
4463
|
|
|
4447
4464
|
${block(stack || message)}
|
|
4448
|
-
|
|
4465
|
+
|
|
4449
4466
|
`));
|
|
4450
4467
|
}
|
|
4451
4468
|
return {
|
|
4452
4469
|
name: name,
|
|
4453
4470
|
message,
|
|
4454
4471
|
stack,
|
|
4472
|
+
id, // Include id in the serialized object
|
|
4455
4473
|
};
|
|
4456
4474
|
}
|
|
4457
4475
|
|
|
@@ -5184,6 +5202,9 @@
|
|
|
5184
5202
|
text = text.replace(/\p{Extended_Pictographic}(\u{200D}\p{Extended_Pictographic})*/gu, '-');
|
|
5185
5203
|
return text.length;
|
|
5186
5204
|
}
|
|
5205
|
+
/**
|
|
5206
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5207
|
+
*/
|
|
5187
5208
|
|
|
5188
5209
|
/**
|
|
5189
5210
|
* Number of characters per standard line with 11pt Arial font size.
|
|
@@ -5215,6 +5236,9 @@
|
|
|
5215
5236
|
const lines = text.split('\n');
|
|
5216
5237
|
return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
|
|
5217
5238
|
}
|
|
5239
|
+
/**
|
|
5240
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5241
|
+
*/
|
|
5218
5242
|
|
|
5219
5243
|
/**
|
|
5220
5244
|
* Counts number of pages in the text
|
|
@@ -5226,6 +5250,9 @@
|
|
|
5226
5250
|
function countPages(text) {
|
|
5227
5251
|
return Math.ceil(countLines(text) / LINES_PER_STANDARD_PAGE);
|
|
5228
5252
|
}
|
|
5253
|
+
/**
|
|
5254
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5255
|
+
*/
|
|
5229
5256
|
|
|
5230
5257
|
/**
|
|
5231
5258
|
* Counts number of paragraphs in the text
|
|
@@ -5235,6 +5262,9 @@
|
|
|
5235
5262
|
function countParagraphs(text) {
|
|
5236
5263
|
return text.split(/\n\s*\n/).filter((paragraph) => paragraph.trim() !== '').length;
|
|
5237
5264
|
}
|
|
5265
|
+
/**
|
|
5266
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5267
|
+
*/
|
|
5238
5268
|
|
|
5239
5269
|
/**
|
|
5240
5270
|
* Split text into sentences
|
|
@@ -5252,6 +5282,9 @@
|
|
|
5252
5282
|
function countSentences(text) {
|
|
5253
5283
|
return splitIntoSentences(text).length;
|
|
5254
5284
|
}
|
|
5285
|
+
/**
|
|
5286
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5287
|
+
*/
|
|
5255
5288
|
|
|
5256
5289
|
/**
|
|
5257
5290
|
* Counts number of words in the text
|
|
@@ -5265,6 +5298,9 @@
|
|
|
5265
5298
|
text = text.replace(/([a-z])([A-Z])/g, '$1 $2');
|
|
5266
5299
|
return text.split(/[^a-zа-я0-9]+/i).filter((word) => word.length > 0).length;
|
|
5267
5300
|
}
|
|
5301
|
+
/**
|
|
5302
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5303
|
+
*/
|
|
5268
5304
|
|
|
5269
5305
|
/**
|
|
5270
5306
|
* Index of all counter functions
|
|
@@ -6748,7 +6784,7 @@
|
|
|
6748
6784
|
// TODO: [🚐] Make arrayable LLMs -> single LLM DRY
|
|
6749
6785
|
const _llms = arrayableToArray(tools.llm);
|
|
6750
6786
|
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
6751
|
-
const llmToolsWithUsage =
|
|
6787
|
+
const llmToolsWithUsage = countUsage(llmTools);
|
|
6752
6788
|
// <- TODO: [🌯]
|
|
6753
6789
|
/*
|
|
6754
6790
|
TODO: [🧠][🪑][🔃] Should this be done or not
|
|
@@ -12351,7 +12387,7 @@
|
|
|
12351
12387
|
pipeline,
|
|
12352
12388
|
tools,
|
|
12353
12389
|
isNotPreparedWarningSupressed: true,
|
|
12354
|
-
maxExecutionAttempts:
|
|
12390
|
+
maxExecutionAttempts: DEFAULT_MAX_EXECUTION_ATTEMPTS,
|
|
12355
12391
|
// <- TODO: Why "LLM execution failed undefinedx"
|
|
12356
12392
|
maxParallelCount: 1, // <- TODO: Pass CLI argument
|
|
12357
12393
|
});
|