@promptbook/remote-client 0.61.0-11 → 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 +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/cli/cli-commands/hello.d.ts +3 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +3 -0
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +3 -0
- package/esm/typings/src/cli/promptbookCli.d.ts +1 -0
- package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +4 -2
- package/esm/typings/src/errors/LimitReachedError.d.ts +7 -0
- package/esm/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
- package/esm/typings/src/execution/utils/addUsage.d.ts +57 -1
- package/esm/typings/src/formats/csv/ListFormatDefinition.d.ts +1 -0
- package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +1 -0
- package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +1 -0
- package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -0
- package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -0
- package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -0
- package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -0
- package/{umd/typings/src/llm-providers/utils → esm/typings/src/llm-providers/_common}/createLlmToolsFromEnv.d.ts +3 -2
- package/esm/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -0
- package/esm/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +10 -0
- package/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/cache/CacheItem.d.ts +4 -4
- package/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/cache/CacheLlmToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/{utils → _common/utils}/cache/cacheLlmTools.d.ts +3 -4
- package/esm/typings/src/llm-providers/{utils → _common/utils}/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +2 -2
- package/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/count-total-cost/countTotalCost.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +32 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +3 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
- package/esm/typings/src/personas/preparePersona.d.ts +6 -1
- package/esm/typings/src/prepare/preparePipeline.d.ts +2 -1
- package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +1 -1
- package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +2 -0
- package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +3 -0
- package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
- package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
- package/esm/typings/src/storage/memory/MemoryStorage.d.ts +3 -0
- package/esm/typings/src/storage/utils/PrefixStorage.d.ts +3 -0
- package/esm/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineString.d.ts +1 -1
- package/esm/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
- 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/emojis.d.ts +2 -2
- package/esm/typings/src/utils/formatNumber.d.ts +1 -1
- package/esm/typings/src/utils/isRunningInWhatever.d.ts +3 -0
- package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -1
- package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/esm/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
- package/esm/typings/src/utils/organization/TODO.d.ts +2 -0
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +1 -0
- package/esm/typings/src/utils/organization/___.d.ts +2 -0
- package/esm/typings/src/utils/organization/just.d.ts +5 -1
- package/esm/typings/src/utils/organization/keepUnused.d.ts +16 -0
- package/esm/typings/src/utils/organization/really_any.d.ts +2 -0
- package/package.json +2 -2
- package/umd/index.umd.js +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/cli/cli-commands/hello.d.ts +3 -0
- package/umd/typings/src/cli/cli-commands/make.d.ts +3 -0
- package/umd/typings/src/cli/cli-commands/prettify.d.ts +3 -0
- package/umd/typings/src/cli/promptbookCli.d.ts +1 -0
- package/umd/typings/src/collection/PipelineCollection.d.ts +1 -1
- package/umd/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
- package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
- package/umd/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
- package/umd/typings/src/config.d.ts +1 -1
- package/umd/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/umd/typings/src/conversion/validation/validatePipeline.d.ts +4 -2
- package/umd/typings/src/errors/LimitReachedError.d.ts +7 -0
- package/umd/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
- package/umd/typings/src/execution/utils/addUsage.d.ts +57 -1
- package/umd/typings/src/formats/csv/ListFormatDefinition.d.ts +1 -0
- package/umd/typings/src/formats/json/JsonFormatDefinition.d.ts +1 -0
- package/umd/typings/src/formats/list/ListFormatDefinition.d.ts +1 -0
- package/umd/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -0
- package/umd/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -0
- package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -0
- package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -0
- package/{esm/typings/src/llm-providers/utils → umd/typings/src/llm-providers/_common}/createLlmToolsFromEnv.d.ts +3 -2
- package/umd/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -0
- package/umd/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +10 -0
- package/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/cache/CacheItem.d.ts +4 -4
- package/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/cache/CacheLlmToolsOptions.d.ts +1 -1
- package/umd/typings/src/llm-providers/{utils → _common/utils}/cache/cacheLlmTools.d.ts +3 -4
- package/umd/typings/src/llm-providers/{utils → _common/utils}/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +2 -2
- package/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/count-total-cost/countTotalCost.d.ts +2 -2
- package/umd/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +32 -0
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +3 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +1 -1
- package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
- package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
- package/umd/typings/src/personas/preparePersona.d.ts +6 -1
- package/umd/typings/src/prepare/preparePipeline.d.ts +2 -1
- package/umd/typings/src/prepare/unpreparePipeline.d.ts +1 -0
- package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
- package/umd/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +1 -1
- package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +2 -0
- package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +3 -0
- package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
- package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
- package/umd/typings/src/storage/memory/MemoryStorage.d.ts +3 -0
- package/umd/typings/src/storage/utils/PrefixStorage.d.ts +3 -0
- package/umd/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -1
- package/umd/typings/src/types/ModelRequirements.d.ts +1 -1
- package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
- package/umd/typings/src/types/PipelineString.d.ts +1 -1
- package/umd/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
- 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/emojis.d.ts +2 -2
- package/umd/typings/src/utils/formatNumber.d.ts +1 -1
- package/umd/typings/src/utils/isRunningInWhatever.d.ts +3 -0
- package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -1
- package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
- package/umd/typings/src/utils/organization/TODO.d.ts +2 -0
- package/umd/typings/src/utils/organization/TODO_USE.d.ts +1 -0
- package/umd/typings/src/utils/organization/___.d.ts +2 -0
- package/umd/typings/src/utils/organization/just.d.ts +5 -1
- package/umd/typings/src/utils/organization/keepUnused.d.ts +16 -0
- package/umd/typings/src/utils/organization/really_any.d.ts +2 -0
- package/esm/typings/src/execution/addPromptResultUsage.test.d.ts +0 -1
- package/esm/typings/src/knowledge/prepare-knowledge/_common/utils/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +0 -10
- package/esm/typings/src/utils/organization/notUsing.d.ts +0 -11
- package/umd/typings/src/execution/addPromptResultUsage.test.d.ts +0 -1
- package/umd/typings/src/knowledge/prepare-knowledge/_common/utils/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +0 -10
- package/umd/typings/src/utils/organization/notUsing.d.ts +0 -11
- /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
package/esm/index.es.js
CHANGED
|
@@ -214,7 +214,7 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
214
214
|
/**
|
|
215
215
|
* The version of the Promptbook library
|
|
216
216
|
*/
|
|
217
|
-
var PROMPTBOOK_VERSION = '0.61.0-
|
|
217
|
+
var PROMPTBOOK_VERSION = '0.61.0-12';
|
|
218
218
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
219
219
|
|
|
220
220
|
export { PROMPTBOOK_VERSION, RemoteLlmExecutionTools };
|
|
@@ -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';
|
|
@@ -6,4 +6,5 @@ export declare function promptbookCli(): Promise<void>;
|
|
|
6
6
|
* TODO: [🥠] Do not export to utils directly, its just for CLI script
|
|
7
7
|
* TODO: [🕌] When more functionalities, rename
|
|
8
8
|
* Note: 11:11
|
|
9
|
+
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
9
10
|
*/
|
|
@@ -5,7 +5,7 @@ import type { string_pipeline_url } from '../types/typeAliases';
|
|
|
5
5
|
/**
|
|
6
6
|
* Collection that groups together pipelines, knowledge, personas, tools and actions
|
|
7
7
|
*
|
|
8
|
-
* @see
|
|
8
|
+
* @see @@@ https://github.com/webgptorg/pipeline#pipeline-collection
|
|
9
9
|
*/
|
|
10
10
|
export type PipelineCollection = {
|
|
11
11
|
/**
|
|
@@ -14,7 +14,7 @@ export declare class SimplePipelineCollection implements PipelineCollection {
|
|
|
14
14
|
/**
|
|
15
15
|
* Constructs a pipeline collection from promptbooks
|
|
16
16
|
*
|
|
17
|
-
* @param promptbooks
|
|
17
|
+
* @param promptbooks @@@
|
|
18
18
|
*
|
|
19
19
|
* @private Use instead `createCollectionFromJson`
|
|
20
20
|
* Note: During the construction logic of all promptbooks are validated
|
|
@@ -44,4 +44,5 @@ export declare function createCollectionFromDirectory(path: string_folder_path,
|
|
|
44
44
|
export {};
|
|
45
45
|
/**
|
|
46
46
|
* TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
|
|
47
|
+
* Note: [🟢] This code should never be published outside of `@promptbook/node`
|
|
47
48
|
*/
|
|
@@ -9,4 +9,5 @@ import type { BoilerplateCommand } from './BoilerplateCommand';
|
|
|
9
9
|
export declare const boilerplateCommandParser: CommandParser<BoilerplateCommand>;
|
|
10
10
|
/**
|
|
11
11
|
* TODO: [💐] Implement BOILERPLATE command into `pipelineStringToJsonSync` function
|
|
12
|
+
* Note: [⚪] This should never be in any released package
|
|
12
13
|
*/
|
|
@@ -28,7 +28,7 @@ export type CommandParserInput = {
|
|
|
28
28
|
readonly args: Array<string_name & string_SCREAMING_CASE>;
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
|
-
* TODO:
|
|
31
|
+
* TODO: @@@ Annotate all
|
|
32
32
|
* TODO: [🧠] Maybe put flag if it is for whole `.ptbk.md` file of just one section
|
|
33
33
|
* TODO: [🍧] CommandParser should have applyToPipelineJson method
|
|
34
34
|
* which will apply parsed command to the pipeline JSON
|
|
@@ -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[];
|
|
@@ -8,7 +8,7 @@ import type { PipelineString } from '../types/PipelineString';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function pipelineJsonToString(pipelineJson: PipelineJson): PipelineString;
|
|
10
10
|
/**
|
|
11
|
-
* TODO:
|
|
11
|
+
* TODO: !!!! Implement new features and commands into `promptTemplateParameterJsonToString`
|
|
12
12
|
* TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
13
13
|
* TODO: Escape all
|
|
14
14
|
*/
|
|
@@ -26,6 +26,8 @@ export declare function validatePipeline(pipeline: PipelineJson): PipelineJson;
|
|
|
26
26
|
* > ex port function validatePipeline(promptbook: unknown): asserts promptbook is PipelineJson {
|
|
27
27
|
*/
|
|
28
28
|
/**
|
|
29
|
-
* TODO: [🧠]
|
|
29
|
+
* TODO: [🧠][🐣] !!!! Validate that all samples match expectations
|
|
30
|
+
* TODO: [🧠][🐣] !!!! Validate that knowledge is valid (non-void)
|
|
31
|
+
* TODO: [🧠] !!! Validationg not only logic itself but imports around - files and websites and rerefenced pipelines exists
|
|
30
32
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
31
|
-
*/
|
|
33
|
+
*/
|
|
@@ -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;
|
|
@@ -8,4 +8,5 @@ export declare const CsvFormatDefinition: FormatDefinition<string, string, objec
|
|
|
8
8
|
* TODO: [🍓] In `CsvFormatDefinition` implement partial `canBeValid`
|
|
9
9
|
* TODO: [🍓] In `CsvFormatDefinition` implement `heal
|
|
10
10
|
* TODO: [🍓] In `CsvFormatDefinition` implement `extractValues`
|
|
11
|
+
* TODO: [🏢] Allow to expect something inside CSV objects and other formats
|
|
11
12
|
*/
|
|
@@ -12,4 +12,5 @@ export declare const JsonFormatDefinition: FormatDefinition<string, string, obje
|
|
|
12
12
|
* TODO: [🍓] In `JsonFormatDefinition` implement partial `canBeValid`
|
|
13
13
|
* TODO: [🍓] In `JsonFormatDefinition` implement `heal
|
|
14
14
|
* TODO: [🍓] In `JsonFormatDefinition` implement `extractValues`
|
|
15
|
+
* TODO: [🏢] Allow to expect something inside JSON objects and other formats
|
|
15
16
|
*/
|
|
@@ -10,4 +10,5 @@ export declare const ListFormatDefinition: FormatDefinition<string, string, obje
|
|
|
10
10
|
* TODO: [🍓] In `ListFormatDefinition` implement partial `canBeValid`
|
|
11
11
|
* TODO: [🍓] In `ListFormatDefinition` implement `heal
|
|
12
12
|
* TODO: [🍓] In `ListFormatDefinition` implement `extractValues`
|
|
13
|
+
* TODO: [🏢] Allow to expect something inside each item of list and other formats
|
|
13
14
|
*/
|
|
@@ -12,4 +12,5 @@ export declare const XmlFormatDefinition: FormatDefinition<string, string, objec
|
|
|
12
12
|
* TODO: [🍓] In `XmlFormatDefinition` implement partial `canBeValid`
|
|
13
13
|
* TODO: [🍓] In `XmlFormatDefinition` implement `heal
|
|
14
14
|
* TODO: [🍓] In `XmlFormatDefinition` implement `extractValues`
|
|
15
|
+
* TODO: [🏢] Allow to expect something inside XML and other formats
|
|
15
16
|
*/
|
|
@@ -15,3 +15,6 @@ export declare class SimplePromptInterfaceTools implements UserInterfaceTools {
|
|
|
15
15
|
*/
|
|
16
16
|
promptDialog(options: UserInterfaceToolsPromptDialogOptions): Promise<string>;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Note: [🔵] This code should never be published outside of `@promptbook/browser`
|
|
20
|
+
*/
|
|
@@ -5,10 +5,10 @@ import type { KnowledgeSourceJson } from '../../../types/PipelineJson/KnowledgeS
|
|
|
5
5
|
* Prepares the knowle
|
|
6
6
|
*
|
|
7
7
|
* @see https://github.com/webgptorg/promptbook/discussions/41
|
|
8
|
-
* @private within the package
|
|
9
8
|
*/
|
|
10
9
|
export declare function prepareKnowledgePieces(knowledgeSources: Array<KnowledgeSourceJson>, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'preparationIds'>>>;
|
|
11
10
|
/**
|
|
11
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
12
12
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
13
13
|
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
14
14
|
* TODO: [🪂] More than max things can run in parallel by acident [1,[2a,2b,_],[3a,3b,_]]
|
package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { string_markdown } from '../../../types/typeAliases';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function prepareKnowledgeFromMarkdown(content: string_markdown, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>>>;
|
|
8
8
|
/**
|
|
9
|
+
* TODO: [🔼] !!! Export via `@promptbook/markdown`
|
|
9
10
|
* TODO: [🪂] Do it in parallel 11:11
|
|
10
11
|
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
11
12
|
*/
|
|
@@ -6,6 +6,7 @@ import type { string_base64 } from '../../../types/typeAliases';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function prepareKnowledgeFromPdf(content: string_base64, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>>>;
|
|
8
8
|
/**
|
|
9
|
+
* TODO: [🔼] !!! Export via `@promptbook/pdf`
|
|
9
10
|
* TODO: [🧺] In future, content can be alse File or Blob BUT for now for wider compatibility its only base64
|
|
10
11
|
* @see https://stackoverflow.com/questions/14653349/node-js-cant-create-blobs
|
|
11
12
|
* TODO: [🪂] Do it in parallel
|
|
@@ -12,10 +12,11 @@ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function createLlmToolsFromEnv(): LlmExecutionTools;
|
|
14
14
|
/**
|
|
15
|
-
* TODO:
|
|
16
|
-
* TODO:
|
|
15
|
+
* TODO: [🔼] !!! Export via `@promptbook/node`
|
|
16
|
+
* TODO: @@@ write discussion about this - wizzard
|
|
17
17
|
* TODO: Add Azure
|
|
18
18
|
* TODO: [🧠] Which name is better `createLlmToolsFromEnv` or `createLlmToolsFromEnvironment`?
|
|
19
19
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
20
20
|
* TODO: [🧠] Maybe pass env as argument
|
|
21
|
+
* Note: [🟢] This code should never be published outside of `@promptbook/node`
|
|
21
22
|
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
2
|
+
/**
|
|
3
|
+
* Returns LLM tools for CLI
|
|
4
|
+
*
|
|
5
|
+
* @private within the repository - for CLI utils
|
|
6
|
+
*/
|
|
7
|
+
export declare function getLlmToolsForCli(): LlmExecutionTools;
|
|
8
|
+
/**
|
|
9
|
+
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
10
|
+
*/
|
package/esm/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
2
|
+
/**
|
|
3
|
+
* Returns LLM tools for testing purposes
|
|
4
|
+
*
|
|
5
|
+
* @private within the repository - JUST FOR TESTS, SCRIPTS AND PLAYGROUND
|
|
6
|
+
*/
|
|
7
|
+
export declare function getLlmToolsForTestingAndScriptsAndPlayground(): LlmExecutionTools;
|
|
8
|
+
/**
|
|
9
|
+
* Note: [⚪] This should never be in any released package
|
|
10
|
+
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { PromptResult } from '
|
|
2
|
-
import type { Prompt } from '
|
|
3
|
-
import type { string_date_iso8601 } from '
|
|
4
|
-
import type { string_promptbook_version } from '
|
|
1
|
+
import type { PromptResult } from '../../../../execution/PromptResult';
|
|
2
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
3
|
+
import type { string_date_iso8601 } from '../../../../types/typeAliases';
|
|
4
|
+
import type { string_promptbook_version } from '../../../../version';
|
|
5
5
|
/**
|
|
6
6
|
* @@@
|
|
7
7
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LlmExecutionTools } from '
|
|
1
|
+
import type { LlmExecutionTools } from '../../../../execution/LlmExecutionTools';
|
|
2
2
|
import type { CacheLlmToolsOptions } from './CacheLlmToolsOptions';
|
|
3
3
|
/**
|
|
4
4
|
* Intercepts LLM tools and counts total usage of the tools
|
|
@@ -8,9 +8,8 @@ import type { CacheLlmToolsOptions } from './CacheLlmToolsOptions';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function cacheLlmTools(llmTools: LlmExecutionTools, options?: Partial<CacheLlmToolsOptions>): LlmExecutionTools;
|
|
10
10
|
/**
|
|
11
|
-
* TODO:
|
|
12
|
-
* TODO:
|
|
13
|
-
* TODO: !!!! write discussion about this and storages
|
|
11
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
12
|
+
* TODO: @@@ write discussion about this and storages
|
|
14
13
|
* write how to combine multiple interceptors
|
|
15
14
|
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
16
15
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { LlmExecutionTools } from '
|
|
2
|
-
import type { PromptResultUsage } from '
|
|
1
|
+
import type { LlmExecutionTools } from '../../../../execution/LlmExecutionTools';
|
|
2
|
+
import type { PromptResultUsage } from '../../../../execution/PromptResult';
|
|
3
3
|
/**
|
|
4
4
|
* LLM tools with option to get total cost of the execution
|
|
5
5
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LlmExecutionTools } from '
|
|
1
|
+
import type { LlmExecutionTools } from '../../../../execution/LlmExecutionTools';
|
|
2
2
|
import type { LlmExecutionToolsWithTotalCost } from './LlmExecutionToolsWithTotalCost';
|
|
3
3
|
/**
|
|
4
4
|
* Intercepts LLM tools and counts total usage of the tools
|
|
@@ -8,7 +8,7 @@ import type { LlmExecutionToolsWithTotalCost } from './LlmExecutionToolsWithTota
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function countTotalUsage(llmTools: LlmExecutionTools): LlmExecutionToolsWithTotalCost;
|
|
10
10
|
/**
|
|
11
|
-
* TODO:
|
|
11
|
+
* TODO: [🔼] !!! Export via `@promptbookcore/`
|
|
12
12
|
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
13
13
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
14
14
|
*/
|
|
@@ -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
|
+
*/
|
|
@@ -45,4 +45,5 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
|
|
|
45
45
|
* TODO: [🧠] Maybe handle errors via transformAnthropicError (like transformAzureError)
|
|
46
46
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
47
47
|
* TODO: Maybe make custom OpenaiError
|
|
48
|
+
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
48
49
|
*/
|
|
@@ -15,7 +15,7 @@ export declare const ANTHROPIC_CLAUDE_MODELS: Array<AvailableModel & {
|
|
|
15
15
|
}>;
|
|
16
16
|
/**
|
|
17
17
|
* Note: [🤖] Add models of new variant
|
|
18
|
-
* TODO:
|
|
18
|
+
* TODO: [🧠] !!! Add embedding models OR Anthropic has only chat+completion models?
|
|
19
19
|
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
20
20
|
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
21
21
|
* TODO: [🕚] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
@@ -44,4 +44,5 @@ export declare class AzureOpenAiExecutionTools implements LlmExecutionTools {
|
|
|
44
44
|
/**
|
|
45
45
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
46
46
|
* TODO: Maybe make custom AzureOpenaiError
|
|
47
|
+
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
47
48
|
*/
|
|
@@ -29,6 +29,6 @@ export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
|
|
|
29
29
|
listModels(): Array<AvailableModel>;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* TODO:
|
|
32
|
+
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
33
33
|
* TODO: Allow in spaceTrim: nesting with > ${block(prompt.request)}, same as replace params
|
|
34
34
|
*/
|
|
@@ -62,4 +62,5 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
|
62
62
|
* TODO: [🧠][🧙♂️] Maybe there can be some wizzard for thoose who want to use just OpenAI
|
|
63
63
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
64
64
|
* TODO: Maybe make custom OpenaiError
|
|
65
|
+
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
65
66
|
*/
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* @see https://openai.com/api/pricing/
|
|
5
5
|
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
6
6
|
*
|
|
7
|
-
* @private within the
|
|
7
|
+
* @private within the repository, used only as internal helper for `OPENAI_MODELS` and `computeUsage`
|
|
8
8
|
*/
|
|
9
9
|
type string_model_price = `$${number}.${number} / ${number}M tokens`;
|
|
10
10
|
/**
|
|
11
11
|
* Function computeUsage will create price per one token based on the string value found on openai page
|
|
12
12
|
*
|
|
13
|
-
* @private within the
|
|
13
|
+
* @private within the repository, used only as internal helper for `OPENAI_MODELS`
|
|
14
14
|
*/
|
|
15
15
|
export declare function computeUsage(value: string_model_price): number;
|
|
16
16
|
export {};
|
|
@@ -5,6 +5,11 @@ import type { string_persona_description } from '../types/typeAliases';
|
|
|
5
5
|
* Prepares the persona for the pipeline
|
|
6
6
|
*
|
|
7
7
|
* @see https://github.com/webgptorg/promptbook/discussions/22
|
|
8
|
-
* @private within the package
|
|
9
8
|
*/
|
|
10
9
|
export declare function preparePersona(personaDescription: string_persona_description, options: PrepareOptions): Promise<PersonaPreparedJson['modelRequirements']>;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
12
|
+
* TODO: [🏢] !! Check validity of `modelName` in pipeline
|
|
13
|
+
* TODO: [🏢] !! Check validity of `systemMessage` in pipeline
|
|
14
|
+
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
15
|
+
*/
|
|
@@ -8,9 +8,10 @@ import type { PrepareOptions } from './PrepareOptions';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function preparePipeline(pipeline: PipelineJson, options: PrepareOptions): Promise<PipelineJson>;
|
|
10
10
|
/**
|
|
11
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
11
12
|
* TODO: Write tests for `preparePipeline`
|
|
12
13
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
13
14
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
14
|
-
* TODO:
|
|
15
|
+
* TODO: [🎐] !!!! Use here countTotalUsage
|
|
15
16
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
16
17
|
*/
|
|
@@ -24,5 +24,7 @@ export declare class FilesStorage<TItem> implements PromptbookStorage<TItem> {
|
|
|
24
24
|
removeItem(key: string): Promise<void>;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
+
* TODO: [🔼] !!! Export via `@promptbook/node`
|
|
27
28
|
* TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values
|
|
29
|
+
* Note: [🟢] This code should never be published outside of `@promptbook/node`
|
|
28
30
|
*/
|
|
@@ -4,5 +4,6 @@ import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function getLocalStorage<TItem>(): PromptbookStorage<TItem>;
|
|
6
6
|
/**
|
|
7
|
-
* Export
|
|
7
|
+
* TODO: [🔼] !!! Export via `@promptbook/browser`
|
|
8
|
+
* Note: [🔵] This code should never be published outside of `@promptbook/browser`
|
|
8
9
|
*/
|
|
@@ -4,5 +4,6 @@ import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function getSessionStorage<TItem>(): PromptbookStorage<TItem>;
|
|
6
6
|
/**
|
|
7
|
-
* Export
|
|
7
|
+
* TODO: [🔼] !!! Export via `@promptbook/browser`
|
|
8
|
+
* Note: [🔵] This code should never be published outside of `@promptbook/browser`
|
|
8
9
|
*/
|