@promptbook/vercel 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 +22 -12
- 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 +22 -12
- 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
|
@@ -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
|
}
|
|
@@ -9,6 +9,10 @@ import type { string_user_id } from '../../types/typeAliases';
|
|
|
9
9
|
* @public exported from `@promptbook/azure-openai`
|
|
10
10
|
*/
|
|
11
11
|
export type AzureOpenAiExecutionToolsOptions = CommonToolsOptions & {
|
|
12
|
+
/**
|
|
13
|
+
* The API key of the Azure OpenAI resource
|
|
14
|
+
*/
|
|
15
|
+
readonly apiKey: string_token;
|
|
12
16
|
/**
|
|
13
17
|
* The resource name of the Azure OpenAI resource
|
|
14
18
|
*
|
|
@@ -23,10 +27,6 @@ export type AzureOpenAiExecutionToolsOptions = CommonToolsOptions & {
|
|
|
23
27
|
* Note: Typically you have one resource and multiple deployments.
|
|
24
28
|
*/
|
|
25
29
|
readonly deploymentName: string_name;
|
|
26
|
-
/**
|
|
27
|
-
* The API key of the Azure OpenAI resource
|
|
28
|
-
*/
|
|
29
|
-
readonly apiKey: string_token;
|
|
30
30
|
/**
|
|
31
31
|
* A unique identifier representing your end-user, which can help Azure OpenAI to monitor
|
|
32
32
|
* and detect abuse.
|
|
@@ -3,7 +3,7 @@ import type { number_usd } from '../../types/typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* List of available Deepseek models with descriptions
|
|
5
5
|
*
|
|
6
|
-
* Note: Done at 2025-
|
|
6
|
+
* Note: Done at 2025-05-06
|
|
7
7
|
*
|
|
8
8
|
* @see https://www.deepseek.com/models
|
|
9
9
|
* @public exported from `@promptbook/deepseek`
|
|
@@ -3,7 +3,7 @@ import type { number_usd } from '../../types/typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* List of available Google models with descriptions
|
|
5
5
|
*
|
|
6
|
-
* Note: Done at 2025-
|
|
6
|
+
* Note: Done at 2025-05-06
|
|
7
7
|
*
|
|
8
8
|
* @see https://ai.google.dev/models/gemini
|
|
9
9
|
* @public exported from `@promptbook/google`
|
|
@@ -9,7 +9,7 @@ import { OpenAiExecutionTools } from './OpenAiExecutionTools';
|
|
|
9
9
|
/**
|
|
10
10
|
* Execution Tools for calling OpenAI API Assistants
|
|
11
11
|
*
|
|
12
|
-
* This is
|
|
12
|
+
* This is useful for calling OpenAI API with a single assistant, for more wide usage use `OpenAiExecutionTools`.
|
|
13
13
|
*
|
|
14
14
|
* @public exported from `@promptbook/openai`
|
|
15
15
|
*/
|
|
@@ -3,7 +3,7 @@ import type { number_usd } from '../../types/typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* List of available OpenAI models with pricing
|
|
5
5
|
*
|
|
6
|
-
* Note: Done at
|
|
6
|
+
* Note: Done at 2025-05-06
|
|
7
7
|
*
|
|
8
8
|
* @see https://platform.openai.com/docs/models/
|
|
9
9
|
* @see https://openai.com/api/pricing/
|
|
@@ -10,9 +10,9 @@ import type { Registration } from '../../utils/$Register';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const _OpenAiMetadataRegistration: Registration;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Registration of the OpenAI Assistant metadata
|
|
14
14
|
*
|
|
15
|
-
* Note: [🏐] Configurations registrations are done in
|
|
15
|
+
* Note: [🏐] Configurations registrations are done in the metadata registration section, but the constructor registration is handled separately.
|
|
16
16
|
*
|
|
17
17
|
* @public exported from `@promptbook/core`
|
|
18
18
|
* @public exported from `@promptbook/wizzard`
|
|
@@ -10,9 +10,9 @@ import type { Registration } from '../../utils/$Register';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const _OpenAiRegistration: Registration;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Registration of the OpenAI Assistant provider
|
|
14
14
|
*
|
|
15
|
-
* Note: [🏐] Configurations registrations are done in
|
|
15
|
+
* Note: [🏐] Configurations registrations are done in register-constructor.ts BUT constructor register-constructor.ts
|
|
16
16
|
*
|
|
17
17
|
* @public exported from `@promptbook/openai`
|
|
18
18
|
* @public exported from `@promptbook/wizzard`
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
|
|
2
|
+
/**
|
|
3
|
+
* Migrates the pipeline to the latest version
|
|
4
|
+
*
|
|
5
|
+
* Note: Migration does not do heavy lifting like calling the LLMs, just lightweight changes of the structure
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/core`
|
|
8
|
+
*/
|
|
9
|
+
export declare function migratePipeline(deprecatedPipeline: PipelineJson): PipelineJson;
|
|
@@ -3,14 +3,14 @@ import type { string_formfactor_name } from '../../formfactors/_common/string_fo
|
|
|
3
3
|
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
4
4
|
import type { NonEmptyReadonlyArray } from '../../types/NonEmptyArray';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Internal cache for the `getBookTemplates` function, storing retrieved pipelines.
|
|
7
7
|
*
|
|
8
8
|
* @singleton
|
|
9
9
|
* @private internal cache of `getBookTemplate`
|
|
10
10
|
*/
|
|
11
11
|
export declare let pipelines: Array<SetRequired<PipelineJson, 'pipelineUrl'>> | null;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Retrieves a collection of Promptbook templates.
|
|
14
14
|
*
|
|
15
15
|
* @param formfactorName - optional filter for FORMFACTOR - get only pipelines for this formfactor
|
|
16
16
|
* @returns list of pipelines
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { InputParameterJson } from '../PipelineJson/ParameterJson';
|
|
2
2
|
import type { OutputParameterJson } from '../PipelineJson/ParameterJson';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Defines the interface of a Promptbook pipeline, specifying its input and output parameters.
|
|
5
5
|
*
|
|
6
6
|
* Note: [🚉] This is fully serializable as JSON
|
|
7
7
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
8
8
|
*/
|
|
9
9
|
export type PipelineInterface = {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Input parameters required by the pipeline.
|
|
12
12
|
*
|
|
13
13
|
* Note: Sorted alphabetically
|
|
14
14
|
*/
|
|
15
15
|
readonly inputParameters: ReadonlyArray<InputParameterJson>;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Output parameters produced by the pipeline.
|
|
18
18
|
*
|
|
19
19
|
* Note: Sorted alphabetically
|
|
20
20
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PipelineJson } from '../PipelineJson/PipelineJson';
|
|
2
2
|
import type { PipelineInterface } from './PipelineInterface';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Extracts the interface (input and output parameters) from a pipeline.
|
|
5
5
|
*
|
|
6
6
|
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
7
7
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import type { PipelineJson } from '../PipelineJson/PipelineJson';
|
|
2
2
|
import type { PipelineInterface } from './PipelineInterface';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Options for the `isPipelineImplementingInterface` function.
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
7
7
|
*/
|
|
8
8
|
export type IsPipelineImplementingInterfaceOptions = {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* @param pipeline The pipeline to check.
|
|
11
11
|
*/
|
|
12
12
|
pipeline: PipelineJson;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* @param pipelineInterface The interface to check against.
|
|
15
15
|
*/
|
|
16
16
|
pipelineInterface: PipelineInterface;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Checks if a given pipeline satisfies the requirements of a specified pipeline interface.
|
|
20
20
|
*
|
|
21
21
|
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
22
22
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
23
|
+
* @returns `true` if the pipeline implements the interface, `false` otherwise.
|
|
23
24
|
*
|
|
24
25
|
* @public exported from `@promptbook/core`
|
|
25
26
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PipelineInterface } from './PipelineInterface';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Checks if two pipeline interfaces are structurally identical.
|
|
4
4
|
*
|
|
5
5
|
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
6
6
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
@@ -38,13 +38,15 @@ export type CommonTaskJson = {
|
|
|
38
38
|
*/
|
|
39
39
|
readonly dependentParameterNames: Array<string_parameter_name>;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* List of parameter names that act as jokers.
|
|
42
|
+
* If a joker parameter meets the expectations, its value is used instead of executing the task.
|
|
42
43
|
*
|
|
43
44
|
* @see https://github.com/webgptorg/promptbook/discussions/66
|
|
44
45
|
*/
|
|
45
46
|
readonly jokerParameterNames?: Array<string_parameter_name>;
|
|
46
47
|
/**
|
|
47
|
-
*
|
|
48
|
+
* Configuration for the FOREACH command, if used.
|
|
49
|
+
* Allows iterating over a list parameter.
|
|
48
50
|
*/
|
|
49
51
|
readonly foreach?: ForeachJson;
|
|
50
52
|
/**
|
|
@@ -53,15 +55,16 @@ export type CommonTaskJson = {
|
|
|
53
55
|
*/
|
|
54
56
|
readonly taskType: SectionType;
|
|
55
57
|
/**
|
|
56
|
-
*
|
|
58
|
+
* Raw content of the task with {placeholders} for parameters before any preparation.
|
|
57
59
|
*
|
|
58
|
-
*
|
|
60
|
+
* @see preparedContent
|
|
59
61
|
*/
|
|
60
62
|
readonly content: (string_prompt | string_javascript | string_markdown) & string_template;
|
|
61
63
|
/**
|
|
62
|
-
*
|
|
64
|
+
* Content of the task after preparation, with {placeholders} for parameters.
|
|
65
|
+
* This is the content used during execution.
|
|
63
66
|
*
|
|
64
|
-
*
|
|
67
|
+
* @see content
|
|
65
68
|
*
|
|
66
69
|
* @default "{content}"
|
|
67
70
|
*/
|
|
@@ -96,5 +99,5 @@ export type CommonTaskJson = {
|
|
|
96
99
|
};
|
|
97
100
|
/**
|
|
98
101
|
* TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template
|
|
99
|
-
* TODO: [♈]
|
|
102
|
+
* TODO: [♈] Probably move expectations from tasks to parameters
|
|
100
103
|
*/
|