@promptbook/node 0.92.0-9 → 0.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -5
- package/esm/index.es.js +801 -531
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/browser.index.d.ts +2 -0
- package/esm/typings/src/_packages/core.index.d.ts +26 -14
- package/esm/typings/src/_packages/types.index.d.ts +6 -2
- package/esm/typings/src/collection/PipelineCollection.d.ts +0 -2
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +6 -6
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +0 -2
- package/esm/typings/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +36 -28
- package/esm/typings/src/config.d.ts +41 -11
- package/esm/typings/src/constants.d.ts +43 -2
- package/esm/typings/src/conversion/parsePipeline.d.ts +2 -2
- package/esm/typings/src/errors/0-BoilerplateError.d.ts +2 -2
- package/esm/typings/src/errors/CollectionError.d.ts +1 -1
- package/esm/typings/src/executables/$provideExecutablesForNode.d.ts +1 -1
- package/esm/typings/src/executables/apps/locateLibreoffice.d.ts +2 -1
- package/esm/typings/src/executables/apps/locatePandoc.d.ts +2 -1
- package/esm/typings/src/executables/locateApp.d.ts +2 -2
- package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +2 -1
- package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +2 -1
- package/esm/typings/src/executables/platforms/locateAppOnWindows.d.ts +2 -1
- package/esm/typings/src/execution/AbstractTaskResult.d.ts +1 -1
- package/esm/typings/src/execution/CommonToolsOptions.d.ts +3 -3
- package/esm/typings/src/execution/ExecutionTask.d.ts +19 -1
- package/esm/typings/src/execution/LlmExecutionToolsConstructor.d.ts +2 -1
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +4 -2
- package/esm/typings/src/execution/PromptbookFetch.d.ts +1 -1
- package/esm/typings/src/execution/ScriptExecutionTools.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/$OngoingTaskResult.d.ts +12 -9
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +13 -10
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +12 -9
- package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +15 -3
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +21 -15
- package/esm/typings/src/execution/createPipelineExecutor/computeCosineSimilarity.d.ts +13 -0
- package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +7 -6
- package/esm/typings/src/execution/createPipelineExecutor/getContextForTask.d.ts +5 -1
- package/esm/typings/src/execution/createPipelineExecutor/getExamplesForTask.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +12 -9
- package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +18 -5
- package/esm/typings/src/execution/createPipelineExecutor/knowledgePiecesToString.d.ts +9 -0
- package/esm/typings/src/execution/execution-report/ExecutionReportJson.d.ts +1 -1
- package/esm/typings/src/execution/execution-report/ExecutionReportString.d.ts +1 -1
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +4 -4
- package/esm/typings/src/execution/utils/checkExpectations.d.ts +3 -3
- package/esm/typings/src/execution/utils/uncertainNumber.d.ts +3 -2
- package/esm/typings/src/execution/utils/usageToWorktime.d.ts +1 -1
- package/esm/typings/src/formats/_common/{FormatDefinition.d.ts → FormatParser.d.ts} +8 -6
- package/esm/typings/src/formats/_common/FormatSubvalueParser.d.ts +66 -0
- package/esm/typings/src/formats/csv/CsvFormatParser.d.ts +17 -0
- package/esm/typings/src/formats/csv/CsvSettings.d.ts +2 -2
- package/esm/typings/src/formats/csv/utils/csvParse.d.ts +12 -0
- package/esm/typings/src/formats/csv/utils/isValidCsvString.d.ts +1 -1
- package/esm/typings/src/formats/index.d.ts +2 -2
- package/esm/typings/src/formats/json/JsonFormatParser.d.ts +19 -0
- package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +1 -1
- package/esm/typings/src/formats/json/utils/jsonParse.d.ts +0 -3
- package/esm/typings/src/formats/text/{TextFormatDefinition.d.ts → TextFormatParser.d.ts} +7 -7
- package/esm/typings/src/formats/xml/XmlFormatParser.d.ts +19 -0
- package/esm/typings/src/formats/xml/utils/isValidXmlString.d.ts +1 -1
- package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +16 -7
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +3 -1
- package/esm/typings/src/formfactors/_common/string_formfactor_name.d.ts +2 -1
- package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +2 -2
- package/esm/typings/src/formfactors/completion/CompletionFormfactorDefinition.d.ts +29 -0
- package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +2 -1
- package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +2 -2
- package/esm/typings/src/formfactors/index.d.ts +33 -8
- package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +4 -2
- package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/high-level-abstractions/index.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/register/$llmToolsRegister.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +4 -4
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +4 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +18 -5
- package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +11 -4
- package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +21 -42
- package/esm/typings/src/llm-providers/_common/register/LlmToolsOptions.d.ts +9 -2
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +13 -4
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +10 -5
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +11 -3
- package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +5 -5
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +6 -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 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +4 -4
- package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +2 -2
- package/esm/typings/src/migrations/migratePipeline.d.ts +9 -0
- package/esm/typings/src/other/templates/getBookTemplates.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +3 -3
- package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineInterface/getPipelineInterface.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineInterface/isPipelineImplementingInterface.d.ts +5 -4
- package/esm/typings/src/pipeline/PipelineInterface/isPipelineInterfacesEqual.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineJson/CommonTaskJson.d.ts +10 -7
- package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +3 -2
- package/esm/typings/src/pipeline/PipelineString.d.ts +3 -1
- package/esm/typings/src/pipeline/book-notation.d.ts +2 -2
- package/esm/typings/src/postprocessing/utils/extractBlock.d.ts +1 -1
- package/esm/typings/src/postprocessing/utils/extractJsonBlock.d.ts +2 -2
- package/esm/typings/src/prepare/prepareTasks.d.ts +8 -5
- package/esm/typings/src/remote-server/openapi.d.ts +1 -1
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Response.d.ts +1 -1
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -1
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +7 -6
- package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +3 -3
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/Converter.d.ts +3 -1
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +4 -3
- package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +4 -2
- package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +2 -1
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +6 -3
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +3 -5
- package/esm/typings/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +3 -3
- package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +3 -2
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +8 -5
- package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +2 -1
- package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +6 -5
- package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +3 -1
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +2 -1
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +4 -1
- package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +2 -1
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +3 -4
- package/esm/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +5 -1
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -1
- package/esm/typings/src/storage/file-cache-storage/FileCacheStorage.d.ts +12 -5
- package/esm/typings/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +4 -2
- package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +2 -1
- package/esm/typings/src/storage/local-storage/getIndexedDbStorage.d.ts +11 -0
- package/esm/typings/src/storage/local-storage/utils/IndexedDbStorageOptions.d.ts +14 -0
- package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromIndexedDb.d.ts +8 -0
- package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.d.ts +2 -1
- package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +2 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +2 -2
- package/esm/typings/src/types/ModelVariant.d.ts +5 -5
- package/esm/typings/src/types/typeAliases.d.ts +22 -19
- package/esm/typings/src/utils/$Register.d.ts +8 -7
- package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +2 -2
- package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.d.ts +4 -1
- package/esm/typings/src/utils/editable/utils/isFlatPipeline.d.ts +2 -1
- package/esm/typings/src/utils/editable/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -1
- package/esm/typings/src/utils/expectation-counters/index.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/normalization/nameToUriPart.d.ts +4 -4
- package/esm/typings/src/utils/normalization/nameToUriParts.d.ts +4 -4
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -3
- package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +3 -3
- package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +4 -4
- package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +3 -3
- package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +3 -3
- package/esm/typings/src/utils/normalization/searchKeywords.d.ts +4 -1
- package/esm/typings/src/utils/normalization/titleToName.d.ts +4 -4
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +1 -1
- package/esm/typings/src/utils/organization/empty_object.d.ts +2 -2
- package/esm/typings/src/utils/organization/just.d.ts +1 -1
- package/esm/typings/src/utils/organization/just_empty_object.d.ts +4 -4
- package/esm/typings/src/utils/organization/keepUnused.d.ts +1 -1
- package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +7 -7
- package/esm/typings/src/utils/removeQuotes.d.ts +2 -2
- package/esm/typings/src/utils/serialization/clonePipeline.d.ts +4 -3
- package/esm/typings/src/utils/serialization/deepClone.d.ts +5 -1
- package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -1
- package/esm/typings/src/utils/trimEndOfCodeBlock.d.ts +1 -1
- package/esm/typings/src/utils/unwrapResult.d.ts +2 -2
- package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +3 -3
- package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +5 -4
- package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +1 -1
- package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -1
- package/esm/typings/src/version.d.ts +2 -1
- package/esm/typings/src/wizzard/wizzard.d.ts +1 -1
- package/package.json +14 -2
- package/umd/index.umd.js +804 -534
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +0 -31
- package/esm/typings/src/formats/csv/CsvFormatDefinition.d.ts +0 -17
- package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +0 -19
- package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +0 -19
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/MultipleLlmExecutionTools.d.ts +0 -0
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/joinLlmExecutionTools.d.ts +0 -0
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/playground/playground.d.ts +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
7
7
|
readonly name: "GENERIC";
|
|
8
|
-
readonly description: "
|
|
8
|
+
readonly description: "A generic pipeline";
|
|
9
9
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/173";
|
|
10
10
|
readonly pipelineInterface: {
|
|
11
11
|
readonly inputParameters: readonly [];
|
|
@@ -14,7 +14,7 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
14
14
|
}, {
|
|
15
15
|
readonly name: "CHATBOT";
|
|
16
16
|
readonly aliasNames: readonly ["CHAT"];
|
|
17
|
-
readonly description: "
|
|
17
|
+
readonly description: "A chatbot form factor for conversational user interfaces.";
|
|
18
18
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/174";
|
|
19
19
|
readonly pipelineInterface: {
|
|
20
20
|
readonly inputParameters: readonly [{
|
|
@@ -36,9 +36,6 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
36
36
|
readonly outputParameters: readonly [{
|
|
37
37
|
readonly name: "title";
|
|
38
38
|
readonly description: "Title of the conversation";
|
|
39
|
-
/**
|
|
40
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
41
|
-
*/
|
|
42
39
|
readonly isInput: false;
|
|
43
40
|
readonly isOutput: true;
|
|
44
41
|
}, {
|
|
@@ -55,7 +52,7 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
55
52
|
};
|
|
56
53
|
}, {
|
|
57
54
|
readonly name: "TRANSLATOR";
|
|
58
|
-
readonly description: "
|
|
55
|
+
readonly description: "A text transformation system that converts input content into different forms,\n including language translations, paraphrasing, style conversions, and tone adjustments.\n This form factor takes one input and produces one transformed output.";
|
|
59
56
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/175";
|
|
60
57
|
readonly pipelineInterface: {
|
|
61
58
|
readonly inputParameters: readonly [{
|
|
@@ -74,7 +71,7 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
74
71
|
}, {
|
|
75
72
|
readonly name: "SHEETS";
|
|
76
73
|
readonly aliasNames: readonly ["SHEETS", "SHEET"];
|
|
77
|
-
readonly description: "
|
|
74
|
+
readonly description: "A formfactor for processing spreadsheet-like data in CSV format, enabling AI transformations on tabular data";
|
|
78
75
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/176";
|
|
79
76
|
readonly pipelineInterface: {
|
|
80
77
|
readonly inputParameters: readonly [{
|
|
@@ -92,7 +89,7 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
92
89
|
};
|
|
93
90
|
}, {
|
|
94
91
|
readonly name: "EXPERIMENTAL_MATCHER";
|
|
95
|
-
readonly description: "
|
|
92
|
+
readonly description: "An evaluation system that determines whether content meets specific criteria or patterns.\n Used for content validation, quality assessment, and intelligent filtering tasks. Currently in experimental phase.";
|
|
96
93
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177";
|
|
97
94
|
readonly pipelineInterface: {
|
|
98
95
|
readonly inputParameters: readonly [{
|
|
@@ -132,6 +129,11 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
132
129
|
readonly isInput: true;
|
|
133
130
|
readonly isOutput: false;
|
|
134
131
|
}];
|
|
132
|
+
/**
|
|
133
|
+
* All available formfactor definitions
|
|
134
|
+
*
|
|
135
|
+
* @public exported from `@promptbook/core`
|
|
136
|
+
*/
|
|
135
137
|
readonly outputParameters: readonly [{
|
|
136
138
|
readonly name: "prompt";
|
|
137
139
|
readonly description: "Prompt to be used for image generation";
|
|
@@ -139,6 +141,29 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
139
141
|
readonly isOutput: true;
|
|
140
142
|
}];
|
|
141
143
|
};
|
|
144
|
+
}, {
|
|
145
|
+
readonly name: "COMPLETION";
|
|
146
|
+
readonly description: "Completion is formfactor that emulates completion models";
|
|
147
|
+
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
148
|
+
readonly pipelineInterface: {
|
|
149
|
+
readonly inputParameters: readonly [{
|
|
150
|
+
readonly name: "inputText";
|
|
151
|
+
readonly description: "Input text to be completed";
|
|
152
|
+
readonly isInput: true;
|
|
153
|
+
readonly isOutput: false;
|
|
154
|
+
}, {
|
|
155
|
+
readonly name: "instructions";
|
|
156
|
+
readonly description: "Additional instructions for the model, for example the required length, empty by default";
|
|
157
|
+
readonly isInput: true;
|
|
158
|
+
readonly isOutput: false;
|
|
159
|
+
}];
|
|
160
|
+
readonly outputParameters: readonly [{
|
|
161
|
+
readonly name: "followingText";
|
|
162
|
+
readonly description: "Text that follows the input text";
|
|
163
|
+
readonly isInput: false;
|
|
164
|
+
readonly isOutput: true;
|
|
165
|
+
}];
|
|
166
|
+
};
|
|
142
167
|
}];
|
|
143
168
|
/**
|
|
144
169
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Matcher is form of app that
|
|
2
|
+
* Matcher is form of app that evaluates (spreadsheet) content against defined criteria or patterns,
|
|
3
|
+
* determining if it matches or meets specific requirements. Used for classification,
|
|
4
|
+
* validation, filtering, and quality assessment of inputs.
|
|
3
5
|
*
|
|
4
6
|
* @public exported from `@promptbook/core`
|
|
5
7
|
*/
|
|
6
8
|
export declare const MatcherFormfactorDefinition: {
|
|
7
9
|
readonly name: "EXPERIMENTAL_MATCHER";
|
|
8
|
-
readonly description: "
|
|
10
|
+
readonly description: "An evaluation system that determines whether content meets specific criteria or patterns.\n Used for content validation, quality assessment, and intelligent filtering tasks. Currently in experimental phase.";
|
|
9
11
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177";
|
|
10
12
|
readonly pipelineInterface: {
|
|
11
13
|
readonly inputParameters: readonly [{
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Sheets is form of app that
|
|
2
|
+
* Sheets is form of app that processes tabular data in CSV format, allowing transformation
|
|
3
|
+
* and analysis of structured data through AI-powered operations
|
|
3
4
|
*
|
|
4
5
|
* @public exported from `@promptbook/core`
|
|
5
6
|
*/
|
|
6
7
|
export declare const SheetsFormfactorDefinition: {
|
|
7
8
|
readonly name: "SHEETS";
|
|
8
9
|
readonly aliasNames: readonly ["SHEETS", "SHEET"];
|
|
9
|
-
readonly description: "
|
|
10
|
+
readonly description: "A formfactor for processing spreadsheet-like data in CSV format, enabling AI transformations on tabular data";
|
|
10
11
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/176";
|
|
11
12
|
readonly pipelineInterface: {
|
|
12
13
|
readonly inputParameters: readonly [{
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Translator is form of app that
|
|
2
|
+
* Translator is form of app that transforms input text from one form to another,
|
|
3
|
+
* such as language translation, style conversion, tone modification, or other text transformations.
|
|
3
4
|
*
|
|
4
5
|
* @public exported from `@promptbook/core`
|
|
5
6
|
*/
|
|
6
7
|
export declare const TranslatorFormfactorDefinition: {
|
|
7
8
|
readonly name: "TRANSLATOR";
|
|
8
|
-
readonly description: "
|
|
9
|
+
readonly description: "A text transformation system that converts input content into different forms,\n including language translations, paraphrasing, style conversions, and tone adjustments.\n This form factor takes one input and produces one transformed output.";
|
|
9
10
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/175";
|
|
10
11
|
readonly pipelineInterface: {
|
|
11
12
|
readonly inputParameters: readonly [{
|
|
@@ -23,7 +23,7 @@ export declare const HIGH_LEVEL_ABSTRACTIONS: readonly [{
|
|
|
23
23
|
path: string | null;
|
|
24
24
|
content: import("../pipeline/PipelineString").PipelineString;
|
|
25
25
|
}[];
|
|
26
|
-
readonly formfactorName?: "CHATBOT" | "GENERATOR" | "GENERIC" | "IMAGE_GENERATOR" | "EXPERIMENTAL_MATCHER" | "SHEETS" | "TRANSLATOR" | undefined;
|
|
26
|
+
readonly formfactorName?: "CHATBOT" | "COMPLETION" | "GENERATOR" | "GENERIC" | "IMAGE_GENERATOR" | "EXPERIMENTAL_MATCHER" | "SHEETS" | "TRANSLATOR" | undefined;
|
|
27
27
|
}>): void;
|
|
28
28
|
}, {
|
|
29
29
|
type: "SYNC";
|
|
@@ -45,7 +45,7 @@ export declare const HIGH_LEVEL_ABSTRACTIONS: readonly [{
|
|
|
45
45
|
path: string | null;
|
|
46
46
|
content: import("../pipeline/PipelineString").PipelineString;
|
|
47
47
|
}[];
|
|
48
|
-
readonly formfactorName?: "CHATBOT" | "GENERATOR" | "GENERIC" | "IMAGE_GENERATOR" | "EXPERIMENTAL_MATCHER" | "SHEETS" | "TRANSLATOR" | undefined;
|
|
48
|
+
readonly formfactorName?: "CHATBOT" | "COMPLETION" | "GENERATOR" | "GENERIC" | "IMAGE_GENERATOR" | "EXPERIMENTAL_MATCHER" | "SHEETS" | "TRANSLATOR" | undefined;
|
|
49
49
|
}>): void;
|
|
50
50
|
}];
|
|
51
51
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { $Register } from '../../../utils/$Register';
|
|
2
2
|
import type { LlmToolsMetadata } from './LlmToolsMetadata';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Register for LLM tools metadata.
|
|
5
5
|
*
|
|
6
6
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
7
|
-
* @singleton Only one instance of each register is created per build, but
|
|
7
|
+
* @singleton Only one instance of each register is created per build, but there can be more instances across different builds or environments.
|
|
8
8
|
* @public exported from `@promptbook/core`
|
|
9
9
|
*/
|
|
10
10
|
export declare const $llmToolsMetadataRegister: $Register<LlmToolsMetadata>;
|
|
11
11
|
/**
|
|
12
12
|
* TODO: [®] DRY Register logic
|
|
13
|
-
*/
|
|
13
|
+
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { LlmExecutionToolsConstructor } from '../../../execution/LlmExecutionToolsConstructor';
|
|
2
2
|
import { $Register } from '../../../utils/$Register';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Register for LLM tools.
|
|
5
5
|
*
|
|
6
6
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
7
|
-
* @singleton Only one instance of each register is created per build, but
|
|
7
|
+
* @singleton Only one instance of each register is created per build, but there can be more instances across different builds or environments.
|
|
8
8
|
* @public exported from `@promptbook/core`
|
|
9
9
|
*/
|
|
10
10
|
export declare const $llmToolsRegister: $Register<LlmExecutionToolsConstructor>;
|
|
11
11
|
/**
|
|
12
12
|
* TODO: [®] DRY Register logic
|
|
13
|
-
*/
|
|
13
|
+
*/
|
package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Provides LLM tools configuration by reading environment variables.
|
|
4
4
|
*
|
|
5
|
-
* @@@ .env
|
|
6
5
|
* Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
|
|
7
6
|
*
|
|
8
7
|
* It looks for environment variables:
|
|
@@ -10,10 +9,11 @@ import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
|
|
|
10
9
|
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
11
10
|
* - ...
|
|
12
11
|
*
|
|
13
|
-
* @
|
|
12
|
+
* @see Environment variables documentation or .env file for required variables.
|
|
13
|
+
* @returns A promise that resolves to the LLM tools configuration, or null if configuration is incomplete or missing.
|
|
14
14
|
* @public exported from `@promptbook/node`
|
|
15
15
|
*/
|
|
16
16
|
export declare function $provideLlmToolsConfigurationFromEnv(): Promise<LlmToolsConfiguration>;
|
|
17
17
|
/**
|
|
18
18
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
19
|
-
*/
|
|
19
|
+
*/
|
|
@@ -3,7 +3,8 @@ import type { LlmExecutionToolsWithTotalUsage } from '../utils/count-total-usage
|
|
|
3
3
|
import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFromConfiguration';
|
|
4
4
|
type GetLlmToolsForTestingAndScriptsAndPlaygroundOptions = CreateLlmToolsFromConfigurationOptions & {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Flag indicating whether the cache should be reloaded or reused
|
|
7
|
+
* When set to true, the existing cache will not be used but thinks will be still saved to the cache
|
|
7
8
|
*
|
|
8
9
|
* @default false
|
|
9
10
|
*/
|
|
@@ -22,5 +23,5 @@ export {};
|
|
|
22
23
|
* Note: [⚪] This should never be in any released package
|
|
23
24
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
24
25
|
* TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
|
|
25
|
-
* TODO: [®] DRY Register
|
|
26
|
-
*/
|
|
26
|
+
* TODO: [®] DRY Register logi
|
|
27
|
+
*/
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { MultipleLlmExecutionTools } from '../../
|
|
1
|
+
import { MultipleLlmExecutionTools } from '../../_multiple/MultipleLlmExecutionTools';
|
|
2
2
|
import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFromConfiguration';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Automatically configures LLM tools from environment variables in Node.js
|
|
5
|
+
*
|
|
6
|
+
* This utility function detects available LLM providers based on environment variables
|
|
7
|
+
* and creates properly configured LLM execution tools for each detected provider.
|
|
5
8
|
*
|
|
6
9
|
* Note: This function is not cached, every call creates new instance of `MultipleLlmExecutionTools`
|
|
7
10
|
*
|
|
8
|
-
*
|
|
11
|
+
* Supports environment variables from .env files when dotenv is configured
|
|
9
12
|
* Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
|
|
10
13
|
*
|
|
11
14
|
* It looks for environment variables:
|
|
@@ -13,12 +16,22 @@ import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFro
|
|
|
13
16
|
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
14
17
|
* - ...
|
|
15
18
|
*
|
|
16
|
-
* @
|
|
19
|
+
* @param options Configuration options for the LLM tools
|
|
20
|
+
* @returns A unified interface containing all detected and configured LLM tools
|
|
17
21
|
* @public exported from `@promptbook/node`
|
|
18
22
|
*/
|
|
19
23
|
export declare function $provideLlmToolsFromEnv(options?: CreateLlmToolsFromConfigurationOptions): Promise<MultipleLlmExecutionTools>;
|
|
20
24
|
/**
|
|
21
|
-
* TODO:
|
|
25
|
+
* TODO: The architecture for LLM tools configuration consists of three key functions:
|
|
26
|
+
* 1. `$provideLlmToolsFromEnv` - High-level function that detects available providers from env vars and returns ready-to-use LLM tools
|
|
27
|
+
* 2. `$provideLlmToolsConfigurationFromEnv` - Middle layer that extracts configuration objects from environment variables
|
|
28
|
+
* 3. `createLlmToolsFromConfiguration` - Low-level function that instantiates LLM tools from explicit configuration
|
|
29
|
+
*
|
|
30
|
+
* This layered approach allows flexibility in how tools are configured:
|
|
31
|
+
* - Use $provideLlmToolsFromEnv for automatic detection and setup in Node.js environments
|
|
32
|
+
* - Use $provideLlmToolsConfigurationFromEnv to extract config objects for modification before instantiation
|
|
33
|
+
* - Use createLlmToolsFromConfiguration for explicit control over tool configurations
|
|
34
|
+
*
|
|
22
35
|
* TODO: [🧠][🍛] Which name is better `$provideLlmToolsFromEnv` or `$provideLlmToolsFromEnvironment`?
|
|
23
36
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
24
37
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
@@ -2,17 +2,24 @@ import type { string_title } from '../../../types/typeAliases';
|
|
|
2
2
|
import type { Registered } from '../../../utils/$Register';
|
|
3
3
|
import type { LlmToolsOptions } from './LlmToolsOptions';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Configuration definition for LLM execution tools, containing provider-specific settings
|
|
6
|
+
* that can be passed during runtime to instantiate and configure LLM tools properly.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
+
* The Promptbook LLM tools architecture involves several related types:
|
|
9
|
+
* - `LlmToolsMetadata`: Contains static metadata about the tool, such as name, version, and capabilities
|
|
10
|
+
* - `LlmToolsConfiguration`: Runtime configuration from environment variables or settings
|
|
11
|
+
* - `LlmToolsOptions`: Provider-specific options for instantiating tools
|
|
12
|
+
* - `Registered`: The record of a registered tool in the global registry
|
|
8
13
|
*/
|
|
9
14
|
export type LlmToolsConfiguration = ReadonlyArray<Registered & {
|
|
10
15
|
/**
|
|
11
|
-
*
|
|
16
|
+
* Human-readable name for this specific provider configuration
|
|
17
|
+
* Used in UI components and logs for identifying this particular configuration
|
|
12
18
|
*/
|
|
13
19
|
readonly title: string_title;
|
|
14
20
|
/**
|
|
15
|
-
*
|
|
21
|
+
* Provider-specific configuration options used for instantiating and configuring LLM tools
|
|
22
|
+
* Contains values like API keys, model preferences, endpoint URLs, and other settings
|
|
16
23
|
*/
|
|
17
24
|
readonly options: LlmToolsOptions;
|
|
18
25
|
}>;
|
|
@@ -1,61 +1,34 @@
|
|
|
1
|
+
import { MODEL_ORDERS } from '../../../constants';
|
|
2
|
+
import { MODEL_TRUST_LEVELS } from '../../../constants';
|
|
1
3
|
import type { string_name } from '../../../types/typeAliases';
|
|
2
4
|
import type { string_title } from '../../../types/typeAliases';
|
|
3
5
|
import type { Registered } from '../../../utils/$Register';
|
|
4
6
|
import type { string_SCREAMING_CASE } from '../../../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
5
7
|
import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
9
|
+
* Metadata definition for LLM execution tools that provides information about a provider's capabilities,
|
|
10
|
+
* configuration options, and relationships within the registry system.
|
|
8
11
|
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
readonly PARTIALLY_OPEN: "Model is open source, but training data and model weights are not (fully) known";
|
|
15
|
-
readonly CLOSED_LOCAL: "Model can be run locally, but it is not open source";
|
|
16
|
-
readonly CLOSED_FREE: "Model is behind API gateway but free to use";
|
|
17
|
-
readonly CLOSED_BUSINESS: "Model is behind API gateway and paid but has good SLA, TOS, privacy policy and in general is a good to use in business applications";
|
|
18
|
-
readonly CLOSED: "Model is behind API gateway and paid";
|
|
19
|
-
readonly UNTRUSTED: "Model has questions about the training data and ethics, but it is not known if it is a problem or not";
|
|
20
|
-
readonly VURNABLE: "Model has some known serious vulnerabilities, leaks, ethical problems, etc.";
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* How is the model provider important?
|
|
24
|
-
*
|
|
25
|
-
* @public exported from `@promptbook/core`
|
|
26
|
-
*/
|
|
27
|
-
export declare const MODEL_ORDER: {
|
|
28
|
-
/**
|
|
29
|
-
* Top-tier models, e.g. OpenAI, Anthropic,...
|
|
30
|
-
*/
|
|
31
|
-
readonly TOP_TIER: 333;
|
|
32
|
-
/**
|
|
33
|
-
* Mid-tier models, e.g. Llama, Mistral, etc.
|
|
34
|
-
*/
|
|
35
|
-
readonly NORMAL: 100;
|
|
36
|
-
/**
|
|
37
|
-
* Low-tier models, e.g. Phi, Tiny, etc.
|
|
38
|
-
*/
|
|
39
|
-
readonly LOW_TIER: 0;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* @@@
|
|
43
|
-
*
|
|
44
|
-
* @@@ `LlmToolsMetadata` vs `LlmToolsConfiguration` vs `LlmToolsOptions` (vs `Registered`)
|
|
12
|
+
* The Promptbook LLM tools architecture involves several related types:
|
|
13
|
+
* - `LlmToolsMetadata`: Contains static metadata about the tool, such as name, version, and capabilities
|
|
14
|
+
* - `LlmToolsConfiguration`: Runtime configuration from environment variables or settings
|
|
15
|
+
* - `LlmToolsOptions`: Provider-specific options for instantiating tools
|
|
16
|
+
* - `Registered`: The record of a registered tool in the global registry
|
|
45
17
|
*/
|
|
46
18
|
export type LlmToolsMetadata = Registered & {
|
|
47
19
|
/**
|
|
48
|
-
*
|
|
20
|
+
* Human-readable display name for the LLM provider
|
|
21
|
+
* Used in UI components and documentation references
|
|
49
22
|
*/
|
|
50
23
|
readonly title: string_title;
|
|
51
24
|
/**
|
|
52
25
|
* How is the model is trusted?
|
|
53
26
|
*/
|
|
54
|
-
readonly trustLevel: keyof typeof
|
|
27
|
+
readonly trustLevel: keyof typeof MODEL_TRUST_LEVELS;
|
|
55
28
|
/**
|
|
56
29
|
* How is the model provider important and should be sorted in the list of available providers?
|
|
57
30
|
*/
|
|
58
|
-
readonly order: typeof
|
|
31
|
+
readonly order: typeof MODEL_ORDERS[keyof typeof MODEL_ORDERS] | number;
|
|
59
32
|
/**
|
|
60
33
|
* List of environment variables that can be used to configure the provider
|
|
61
34
|
*
|
|
@@ -64,11 +37,17 @@ export type LlmToolsMetadata = Registered & {
|
|
|
64
37
|
*/
|
|
65
38
|
readonly envVariables: ReadonlyArray<string_name & string_SCREAMING_CASE> | null;
|
|
66
39
|
/**
|
|
67
|
-
*
|
|
40
|
+
* Provides a default configuration template for this LLM provider
|
|
41
|
+
* Used to generate example configurations or as fallback when no specific configuration is provided
|
|
42
|
+
* @returns A standardized configuration object for this LLM provider
|
|
68
43
|
*/
|
|
69
44
|
getBoilerplateConfiguration(): LlmToolsConfiguration[number];
|
|
70
45
|
/**
|
|
71
|
-
*
|
|
46
|
+
* Creates a provider-specific configuration object from environment variables
|
|
47
|
+
* Used to automatically configure LLM tools based on available environment settings
|
|
48
|
+
*
|
|
49
|
+
* @param env Dictionary of environment variables (key-value pairs)
|
|
50
|
+
* @returns Configuration object for this LLM provider if required variables are present, or null if configuration is not possible
|
|
72
51
|
*/
|
|
73
52
|
createConfigurationFromEnv(env: Record<string_name, string>): LlmToolsConfiguration[number] | null;
|
|
74
53
|
};
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import type { TODO_object } from '../../../utils/organization/TODO_object';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Options for configuring LLM (Large Language Model) tools.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* This type is used to pass provider-specific options to LLM execution tools.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* The Promptbook LLM tools architecture involves several related types:
|
|
9
|
+
* - `LlmToolsMetadata`: Contains static metadata about the tool, such as name, version, and capabilities
|
|
10
|
+
* - `LlmToolsConfiguration`: Runtime configuration from environment variables or settings
|
|
11
|
+
* - `LlmToolsOptions`: Provider-specific options for instantiating tools
|
|
12
|
+
* - `Registered`: The record of a registered tool in the global registry
|
|
6
13
|
*/
|
|
7
14
|
export type LlmToolsOptions = TODO_object;
|
|
8
15
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { string_user_id } from '../../../types/typeAliases';
|
|
2
|
-
import { MultipleLlmExecutionTools } from '../../
|
|
2
|
+
import { MultipleLlmExecutionTools } from '../../_multiple/MultipleLlmExecutionTools';
|
|
3
3
|
import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
|
|
4
4
|
/**
|
|
5
5
|
* Options for `$provideLlmToolsFromEnv`
|
|
@@ -21,18 +21,27 @@ export type CreateLlmToolsFromConfigurationOptions = {
|
|
|
21
21
|
readonly userId?: string_user_id;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Creates LLM execution tools from provided configuration objects
|
|
25
|
+
*
|
|
26
|
+
* Instantiates and configures LLM tool instances for each configuration entry,
|
|
27
|
+
* combining them into a unified interface via MultipleLlmExecutionTools.
|
|
25
28
|
*
|
|
26
29
|
* Note: This function is not cached, every call creates new instance of `MultipleLlmExecutionTools`
|
|
27
30
|
*
|
|
28
|
-
* @
|
|
31
|
+
* @param configuration Array of LLM tool configurations to instantiate
|
|
32
|
+
* @param options Additional options for configuring the LLM tools
|
|
33
|
+
* @returns A unified interface combining all successfully instantiated LLM tools
|
|
29
34
|
* @public exported from `@promptbook/core`
|
|
30
35
|
*/
|
|
31
36
|
export declare function createLlmToolsFromConfiguration(configuration: LlmToolsConfiguration, options?: CreateLlmToolsFromConfigurationOptions): MultipleLlmExecutionTools;
|
|
32
37
|
/**
|
|
33
38
|
* TODO: [🎌] Together with `createLlmToolsFromConfiguration` + 'EXECUTION_TOOLS_CLASSES' gets to `@promptbook/core` ALL model providers, make this more efficient
|
|
34
39
|
* TODO: [🧠][🎌] Dynamically install required providers
|
|
35
|
-
* TODO:
|
|
40
|
+
* TODO: We should implement an interactive configuration wizard that would:
|
|
41
|
+
* 1. Detect which LLM providers are available in the environment
|
|
42
|
+
* 2. Guide users through required configuration settings for each provider
|
|
43
|
+
* 3. Allow testing connections before completing setup
|
|
44
|
+
* 4. Generate appropriate configuration code for application integration
|
|
36
45
|
* TODO: [🧠][🍛] Which name is better `createLlmToolsFromConfig` or `createLlmToolsFromConfiguration`?
|
|
37
46
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
38
47
|
* TODO: This should be maybe not under `_common` but under `utils`
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import type { PromptResult } from '../../../../execution/PromptResult';
|
|
2
2
|
import type { Prompt } from '../../../../types/Prompt';
|
|
3
3
|
import type { string_date_iso8601 } from '../../../../types/typeAliases';
|
|
4
|
+
import type { string_semantic_version } from '../../../../types/typeAliases';
|
|
4
5
|
import type { string_promptbook_version } from '../../../../version';
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* Represents a single item stored in the LLM cache.
|
|
7
8
|
*/
|
|
8
9
|
export type CacheItem = {
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
+
* The date and time when the cache item was created, in ISO 8601 format.
|
|
11
12
|
*/
|
|
12
13
|
date: string_date_iso8601;
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* The version of the Promptbook library used when this cache item was created.
|
|
15
16
|
*/
|
|
16
17
|
promptbookVersion?: string_promptbook_version;
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
+
* The version of the Book language used when this cache item was created.
|
|
20
|
+
*/
|
|
21
|
+
bookVersion?: string_semantic_version;
|
|
22
|
+
/**
|
|
23
|
+
* The prompt that was sent to the LLM.
|
|
19
24
|
*/
|
|
20
25
|
prompt: Prompt;
|
|
21
26
|
/**
|
|
22
|
-
*
|
|
27
|
+
* The response received from the LLM.
|
|
23
28
|
*/
|
|
24
29
|
promptResult: PromptResult;
|
|
25
30
|
};
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import type { PromptbookStorage } from '../../../../storage/_common/PromptbookStorage';
|
|
2
2
|
import type { CacheItem } from './CacheItem';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Options for configuring caching behavior for LlmExecutionTools.
|
|
5
5
|
*/
|
|
6
6
|
export type CacheLlmToolsOptions = {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* The cache provider instance to use for storing and retrieving cached data.
|
|
9
9
|
*
|
|
10
10
|
* @default MemoryStorage
|
|
11
11
|
*/
|
|
12
12
|
storage: PromptbookStorage<CacheItem>;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* When set to `true`, the cache will be reloaded regardless of whether the data is already present in the cache.
|
|
15
|
+
* This can be useful for debugging or when you want to ensure that the latest data is always fetched.
|
|
16
|
+
* Data will ne still saved to the cache.
|
|
15
17
|
*
|
|
16
18
|
* @default false
|
|
17
19
|
*/
|
|
18
20
|
isCacheReloaded?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* If true, the preparation logs additional information
|
|
23
|
+
*
|
|
24
|
+
* @default DEFAULT_IS_VERBOSE
|
|
25
|
+
*/
|
|
26
|
+
readonly isVerbose?: boolean;
|
|
19
27
|
};
|
|
@@ -13,7 +13,7 @@ export declare function cacheLlmTools<TLlmTools extends LlmExecutionTools>(llmTo
|
|
|
13
13
|
/**
|
|
14
14
|
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
15
15
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
16
|
-
* TODO: [👷♂️]
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* TODO: [👷♂️] Comprehensive manual about construction of llmTools
|
|
17
|
+
* Detailed explanation about caching strategies and appropriate storage selection for different use cases
|
|
18
|
+
* Examples of how to combine multiple interceptors for advanced caching, logging, and usage tracking
|
|
19
19
|
*/
|
|
@@ -4,24 +4,24 @@ import type { PromptbookStorage } from '../../../../storage/_common/PromptbookSt
|
|
|
4
4
|
import type { TODO_any } from '../../../../utils/organization/TODO_any';
|
|
5
5
|
import type { LlmExecutionToolsWithTotalUsage } from './LlmExecutionToolsWithTotalUsage';
|
|
6
6
|
/**
|
|
7
|
-
* Options for `limitTotalUsage`
|
|
7
|
+
* Options for the `limitTotalUsage` function.
|
|
8
8
|
*/
|
|
9
9
|
type LimitTotalUsageOptions = {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* The usage limits to apply.
|
|
12
12
|
*
|
|
13
13
|
* @default ZERO_USAGE
|
|
14
14
|
*/
|
|
15
15
|
maxTotalUsage: Usage;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* The storage mechanism to use for tracking usage across multiple executions or instances.
|
|
18
18
|
*
|
|
19
|
-
* @default MemoryStorage
|
|
19
|
+
* @default MemoryStorage which will not persist when the process ends
|
|
20
20
|
*/
|
|
21
21
|
storage: PromptbookStorage<TODO_any>;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Wraps LlmExecutionTools to limit the total usage based on provided limits.
|
|
25
25
|
*
|
|
26
26
|
* @public exported from `@promptbook/core`
|
|
27
27
|
*/
|
|
@@ -2,6 +2,7 @@ import Anthropic from '@anthropic-ai/sdk';
|
|
|
2
2
|
import type { AvailableModel } from '../../execution/AvailableModel';
|
|
3
3
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
4
4
|
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
5
|
+
import type { CompletionPromptResult } from '../../execution/PromptResult';
|
|
5
6
|
import type { Prompt } from '../../types/Prompt';
|
|
6
7
|
import type { string_markdown } from '../../types/typeAliases';
|
|
7
8
|
import type { string_markdown_text } from '../../types/typeAliases';
|
|
@@ -19,6 +20,7 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
|
|
|
19
20
|
* Anthropic Claude API client.
|
|
20
21
|
*/
|
|
21
22
|
private client;
|
|
23
|
+
private limiter;
|
|
22
24
|
/**
|
|
23
25
|
* Creates Anthropic Claude Execution Tools.
|
|
24
26
|
*
|
|
@@ -40,6 +42,10 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
|
|
|
40
42
|
* Calls Anthropic Claude API to use a chat model.
|
|
41
43
|
*/
|
|
42
44
|
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<ChatPromptResult>;
|
|
45
|
+
/**
|
|
46
|
+
* Calls Anthropic Claude API to use a completion model.
|
|
47
|
+
*/
|
|
48
|
+
callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<CompletionPromptResult>;
|
|
43
49
|
/**
|
|
44
50
|
* Get the model that should be used as default
|
|
45
51
|
*/
|
|
@@ -3,7 +3,7 @@ import type { number_usd } from '../../types/typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* List of available Anthropic Claude models with pricing
|
|
5
5
|
*
|
|
6
|
-
* Note: Done at
|
|
6
|
+
* Note: Done at 2025-05-06
|
|
7
7
|
*
|
|
8
8
|
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
9
9
|
* @public exported from `@promptbook/anthropic-claude`
|
|
@@ -55,7 +55,7 @@ export declare class AzureOpenAiExecutionTools implements LlmExecutionTools {
|
|
|
55
55
|
*/
|
|
56
56
|
private withTimeout;
|
|
57
57
|
/**
|
|
58
|
-
* Changes Azure error (which is not
|
|
58
|
+
* Changes Azure error (which is not proper Error but object) to proper Error
|
|
59
59
|
*/
|
|
60
60
|
private transformAzureError;
|
|
61
61
|
}
|