@promptbook/cli 0.61.0-12 → 0.61.0-13
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 +110 -37
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/execute-javascript.index.d.ts +1 -1
- package/esm/typings/src/_packages/utils.index.d.ts +1 -1
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/errors/LimitReachedError.d.ts +7 -0
- package/esm/typings/src/execution/utils/addUsage.d.ts +57 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +32 -0
- package/esm/typings/src/utils/deepClone.d.ts +9 -0
- package/esm/typings/src/utils/deepFreeze.d.ts +13 -0
- package/esm/typings/src/utils/organization/just.d.ts +4 -1
- package/esm/typings/src/utils/organization/keepUnused.d.ts +16 -0
- package/esm/typings/src/version.d.ts +0 -3
- package/package.json +2 -2
- package/umd/index.umd.js +110 -37
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/src/_packages/execute-javascript.index.d.ts +1 -1
- package/umd/typings/src/_packages/utils.index.d.ts +1 -1
- package/umd/typings/src/config.d.ts +1 -1
- package/umd/typings/src/errors/LimitReachedError.d.ts +7 -0
- package/umd/typings/src/execution/utils/addUsage.d.ts +57 -1
- package/umd/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +32 -0
- package/umd/typings/src/utils/deepClone.d.ts +9 -0
- package/umd/typings/src/utils/deepFreeze.d.ts +13 -0
- package/umd/typings/src/utils/organization/just.d.ts +4 -1
- package/umd/typings/src/utils/organization/keepUnused.d.ts +16 -0
- package/umd/typings/src/version.d.ts +0 -3
- package/esm/typings/src/execution/addPromptResultUsage.test.d.ts +0 -1
- package/esm/typings/src/utils/organization/keepImported.d.ts +0 -12
- package/esm/typings/src/utils/organization/notUsing.d.ts +0 -12
- package/umd/typings/src/execution/addPromptResultUsage.test.d.ts +0 -1
- package/umd/typings/src/utils/organization/keepImported.d.ts +0 -12
- package/umd/typings/src/utils/organization/notUsing.d.ts +0 -12
- /package/esm/typings/src/{utils/postprocessing → postprocessing/utils}/extractBlock.d.ts +0 -0
- /package/umd/typings/src/{utils/postprocessing → postprocessing/utils}/extractBlock.d.ts +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import spaceTrim from 'spacetrim';
|
|
2
|
+
import { extractBlock } from '../postprocessing/utils/extractBlock';
|
|
2
3
|
import { JavascriptEvalExecutionTools } from '../scripting/javascript/JavascriptEvalExecutionTools';
|
|
3
4
|
import { JavascriptExecutionTools } from '../scripting/javascript/JavascriptExecutionTools';
|
|
4
5
|
import { prettifyMarkdown } from '../utils/markdown/prettifyMarkdown';
|
|
@@ -13,7 +14,6 @@ import { normalizeTo_camelCase } from '../utils/normalization/normalizeTo_camelC
|
|
|
13
14
|
import { normalizeTo_snake_case } from '../utils/normalization/normalizeTo_snake_case';
|
|
14
15
|
import { normalizeWhitespaces } from '../utils/normalization/normalizeWhitespaces';
|
|
15
16
|
import { removeDiacritics } from '../utils/normalization/removeDiacritics';
|
|
16
|
-
import { extractBlock } from '../utils/postprocessing/extractBlock';
|
|
17
17
|
import { removeEmojis } from '../utils/removeEmojis';
|
|
18
18
|
import { removeQuotes } from '../utils/removeQuotes';
|
|
19
19
|
import { trimCodeBlock } from '../utils/trimCodeBlock';
|
|
@@ -7,6 +7,7 @@ import { titleToName } from '../conversion/utils/titleToName';
|
|
|
7
7
|
import { forEachAsync } from '../execution/utils/forEachAsync';
|
|
8
8
|
import { replaceParameters } from '../execution/utils/replaceParameters';
|
|
9
9
|
import { isValidJsonString } from '../formats/json/utils/isValidJsonString';
|
|
10
|
+
import { extractBlock } from '../postprocessing/utils/extractBlock';
|
|
10
11
|
import { $currentDate } from '../utils/currentDate';
|
|
11
12
|
import { countCharacters } from '../utils/expectation-counters/countCharacters';
|
|
12
13
|
import { countLines } from '../utils/expectation-counters/countLines';
|
|
@@ -34,7 +35,6 @@ import { parseKeywordsFromString } from '../utils/normalization/parseKeywordsFro
|
|
|
34
35
|
import { removeDiacritics } from '../utils/normalization/removeDiacritics';
|
|
35
36
|
import { searchKeywords } from '../utils/normalization/searchKeywords';
|
|
36
37
|
import { parseNumber } from '../utils/parseNumber';
|
|
37
|
-
import { extractBlock } from '../utils/postprocessing/extractBlock';
|
|
38
38
|
import { $randomSeed } from '../utils/random/randomSeed';
|
|
39
39
|
import { removeEmojis } from '../utils/removeEmojis';
|
|
40
40
|
import { removeQuotes } from '../utils/removeQuotes';
|
|
@@ -21,4 +21,4 @@ export declare const PIPELINE_COLLECTION_BASE_FILENAME = "index";
|
|
|
21
21
|
/**
|
|
22
22
|
* The names of the parameters that are reserved for special purposes
|
|
23
23
|
*/
|
|
24
|
-
export declare const RESERVED_PARAMETER_NAMES: string[];
|
|
24
|
+
export declare const RESERVED_PARAMETER_NAMES: readonly string[];
|
|
@@ -1,7 +1,63 @@
|
|
|
1
1
|
import type { PromptResultUsage } from '../PromptResult';
|
|
2
|
+
/**
|
|
3
|
+
* @@@
|
|
4
|
+
*
|
|
5
|
+
* TODO: [🔼] Export with addUsage
|
|
6
|
+
*/
|
|
7
|
+
export declare const ZERO_USAGE: import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{
|
|
8
|
+
readonly price: {
|
|
9
|
+
readonly value: 0;
|
|
10
|
+
};
|
|
11
|
+
readonly input: {
|
|
12
|
+
readonly tokensCount: {
|
|
13
|
+
readonly value: 0;
|
|
14
|
+
};
|
|
15
|
+
readonly charactersCount: {
|
|
16
|
+
readonly value: 0;
|
|
17
|
+
};
|
|
18
|
+
readonly wordsCount: {
|
|
19
|
+
readonly value: 0;
|
|
20
|
+
};
|
|
21
|
+
readonly sentencesCount: {
|
|
22
|
+
readonly value: 0;
|
|
23
|
+
};
|
|
24
|
+
readonly linesCount: {
|
|
25
|
+
readonly value: 0;
|
|
26
|
+
};
|
|
27
|
+
readonly paragraphsCount: {
|
|
28
|
+
readonly value: 0;
|
|
29
|
+
};
|
|
30
|
+
readonly pagesCount: {
|
|
31
|
+
readonly value: 0;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
readonly output: {
|
|
35
|
+
readonly tokensCount: {
|
|
36
|
+
readonly value: 0;
|
|
37
|
+
};
|
|
38
|
+
readonly charactersCount: {
|
|
39
|
+
readonly value: 0;
|
|
40
|
+
};
|
|
41
|
+
readonly wordsCount: {
|
|
42
|
+
readonly value: 0;
|
|
43
|
+
};
|
|
44
|
+
readonly sentencesCount: {
|
|
45
|
+
readonly value: 0;
|
|
46
|
+
};
|
|
47
|
+
readonly linesCount: {
|
|
48
|
+
readonly value: 0;
|
|
49
|
+
};
|
|
50
|
+
readonly paragraphsCount: {
|
|
51
|
+
readonly value: 0;
|
|
52
|
+
};
|
|
53
|
+
readonly pagesCount: {
|
|
54
|
+
readonly value: 0;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}>;
|
|
2
58
|
/**
|
|
3
59
|
* Function `addUsage` will add multiple usages into one
|
|
4
60
|
*
|
|
5
|
-
* Note: If you provide 0 values, it returns
|
|
61
|
+
* Note: If you provide 0 values, it returns ZERO_USAGE
|
|
6
62
|
*/
|
|
7
63
|
export declare function addUsage(...usageItems: Array<PromptResultUsage>): PromptResultUsage;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../../../execution/LlmExecutionTools';
|
|
2
|
+
import type { PromptResultUsage } from '../../../../execution/PromptResult';
|
|
3
|
+
import type { PromptbookStorage } from '../../../../storage/_common/PromptbookStorage';
|
|
4
|
+
import type { TODO } from '../../../../utils/organization/TODO';
|
|
5
|
+
import type { LlmExecutionToolsWithTotalCost } from './LlmExecutionToolsWithTotalCost';
|
|
6
|
+
/**
|
|
7
|
+
* Options for `limitTotalCost`
|
|
8
|
+
*/
|
|
9
|
+
type LimitTotalCostOptions = {
|
|
10
|
+
/**
|
|
11
|
+
* @@@
|
|
12
|
+
*
|
|
13
|
+
* @default ZERO_USAGE
|
|
14
|
+
*/
|
|
15
|
+
maxTotalCost: PromptResultUsage;
|
|
16
|
+
/**
|
|
17
|
+
* @@@
|
|
18
|
+
*
|
|
19
|
+
* @default MemoryStorage
|
|
20
|
+
*/
|
|
21
|
+
storage: PromptbookStorage<TODO>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @@@
|
|
25
|
+
*/
|
|
26
|
+
export declare function limitTotalCost(llmTools: LlmExecutionTools, options?: Partial<LimitTotalCostOptions>): LlmExecutionToolsWithTotalCost;
|
|
27
|
+
export {};
|
|
28
|
+
/**
|
|
29
|
+
* TODO: [🔼] !!! Export via `@promptbookcore/`
|
|
30
|
+
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
31
|
+
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
32
|
+
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WritableDeep } from 'type-fest';
|
|
2
|
+
/**
|
|
3
|
+
* @@@
|
|
4
|
+
*/
|
|
5
|
+
export declare function deepClone<TObject>(objectValue: TObject): WritableDeep<TObject>;
|
|
6
|
+
/**
|
|
7
|
+
* TODO: [🔼] Export from `@promptbook/utils`
|
|
8
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
9
|
+
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReadonlyDeep } from 'type-fest';
|
|
2
|
+
/**
|
|
3
|
+
* @@@
|
|
4
|
+
*
|
|
5
|
+
* @returns The same object as the input, but deeply frozen
|
|
6
|
+
*
|
|
7
|
+
* Note: This function mutates the object
|
|
8
|
+
*/
|
|
9
|
+
export declare function deepFreeze<TObject>(objectValue: TObject): ReadonlyDeep<TObject>;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: [🔼] Export from `@promptbook/utils`
|
|
12
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
13
|
+
*/
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* Returns the same value that is passed as argument.
|
|
3
3
|
* No side effects.
|
|
4
4
|
*
|
|
5
|
-
* Note: It can be usefull for
|
|
5
|
+
* Note: It can be usefull for:
|
|
6
|
+
*
|
|
7
|
+
* 1) Leveling indentation
|
|
8
|
+
* 2) Putting always-true or always-false conditions without getting eslint errors
|
|
6
9
|
*
|
|
7
10
|
* @param value any values
|
|
8
11
|
* @returns the same values
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { really_any } from './really_any';
|
|
2
|
+
/**
|
|
3
|
+
* Just says that the variable is not used but should be kept
|
|
4
|
+
* No side effects.
|
|
5
|
+
*
|
|
6
|
+
* Note: It can be usefull for:
|
|
7
|
+
*
|
|
8
|
+
* 1) Suppressing eager optimization of unused imports
|
|
9
|
+
* 2) Suppressing eslint errors of unused variables in the tests
|
|
10
|
+
* 3) Keeping the type of the variable for type testing
|
|
11
|
+
*
|
|
12
|
+
* @param value any values
|
|
13
|
+
* @returns void
|
|
14
|
+
* @private within the repository
|
|
15
|
+
*/
|
|
16
|
+
export declare function keepUnused<TTypeToKeep1 = really_any, TTypeToKeep2 = really_any, TTypeToKeep3 = really_any>(...valuesToKeep: Array<really_any>): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { really_any } from './really_any';
|
|
2
|
-
/**
|
|
3
|
-
* Just says that the variable is not used but should be kept
|
|
4
|
-
* No side effects.
|
|
5
|
-
*
|
|
6
|
-
* Note: It can be usefull suppressing eager optimization of unused imports
|
|
7
|
-
*
|
|
8
|
-
* @param value any values
|
|
9
|
-
* @returns void
|
|
10
|
-
* @private within the repository
|
|
11
|
-
*/
|
|
12
|
-
export declare function keepImported(...value: Array<really_any>): void;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { really_any } from './really_any';
|
|
2
|
-
/**
|
|
3
|
-
* Just says that the variable is not used
|
|
4
|
-
* No side effects.
|
|
5
|
-
*
|
|
6
|
-
* Note: It can be usefull suppressing eslint errors of unused variables in the tests
|
|
7
|
-
*
|
|
8
|
-
* @param value any values
|
|
9
|
-
* @returns void
|
|
10
|
-
* @private within the repository
|
|
11
|
-
*/
|
|
12
|
-
export declare function notUsing(...value: Array<really_any>): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { really_any } from './really_any';
|
|
2
|
-
/**
|
|
3
|
-
* Just says that the variable is not used but should be kept
|
|
4
|
-
* No side effects.
|
|
5
|
-
*
|
|
6
|
-
* Note: It can be usefull suppressing eager optimization of unused imports
|
|
7
|
-
*
|
|
8
|
-
* @param value any values
|
|
9
|
-
* @returns void
|
|
10
|
-
* @private within the repository
|
|
11
|
-
*/
|
|
12
|
-
export declare function keepImported(...value: Array<really_any>): void;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { really_any } from './really_any';
|
|
2
|
-
/**
|
|
3
|
-
* Just says that the variable is not used
|
|
4
|
-
* No side effects.
|
|
5
|
-
*
|
|
6
|
-
* Note: It can be usefull suppressing eslint errors of unused variables in the tests
|
|
7
|
-
*
|
|
8
|
-
* @param value any values
|
|
9
|
-
* @returns void
|
|
10
|
-
* @private within the repository
|
|
11
|
-
*/
|
|
12
|
-
export declare function notUsing(...value: Array<really_any>): void;
|
|
File without changes
|
|
File without changes
|