@promptbook/remote-client 0.61.0-2 โ 0.61.0-20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.es.js +37 -4
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +200 -30
- package/esm/typings/src/_packages/core.index.d.ts +7 -2
- package/esm/typings/src/_packages/execute-javascript.index.d.ts +1 -1
- package/esm/typings/src/_packages/node.index.d.ts +2 -1
- package/esm/typings/src/_packages/types.index.d.ts +11 -7
- package/esm/typings/src/_packages/utils.index.d.ts +8 -6
- package/esm/typings/src/cli/cli-commands/hello.d.ts +3 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +3 -0
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +3 -0
- package/esm/typings/src/cli/promptbookCli.d.ts +1 -0
- package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +10 -10
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +8 -7
- package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +2 -2
- package/esm/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +2 -3
- package/esm/typings/src/commands/MODEL/ModelCommand.d.ts +2 -2
- package/esm/typings/src/commands/PERSONA/PersonaCommand.d.ts +4 -2
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +42 -14
- package/esm/typings/src/config.d.ts +38 -1
- package/esm/typings/src/config.test.d.ts +4 -0
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +9 -5
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +5 -3
- package/esm/typings/src/conversion/prettify/PrettifyOptions.d.ts +2 -2
- package/esm/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts +2 -2
- package/esm/typings/src/conversion/utils/renameParameter.d.ts +3 -3
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +13 -0
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +12 -3
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +10 -1
- package/esm/typings/src/errors/EnvironmentMismatchError.d.ts +7 -0
- package/esm/typings/src/errors/LimitReachedError.d.ts +7 -0
- package/esm/typings/src/errors/VersionMismatchError.d.ts +8 -0
- package/esm/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +10 -8
- package/esm/typings/src/execution/PipelineExecutor.d.ts +9 -8
- package/esm/typings/src/execution/PromptResult.d.ts +28 -58
- package/esm/typings/src/execution/PromptResultUsage.d.ts +26 -0
- package/esm/typings/src/execution/ScriptExecutionTools.d.ts +5 -4
- package/esm/typings/src/execution/UncertainNumber.d.ts +18 -0
- package/esm/typings/src/execution/UserInterfaceTools.d.ts +5 -5
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +19 -3
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +2 -2
- package/esm/typings/src/execution/utils/addUsage.d.ts +58 -2
- package/esm/typings/src/execution/utils/computeUsageCounts.d.ts +1 -1
- package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -1
- package/esm/typings/src/execution/utils/uncertainNumber.d.ts +1 -1
- package/esm/typings/src/execution/utils/usageToWorktime.d.ts +2 -2
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
- package/esm/typings/src/formats/csv/ListFormatDefinition.d.ts +2 -1
- package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +2 -1
- package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +2 -1
- package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -0
- package/esm/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +1 -1
- package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -0
- package/esm/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +27 -0
- package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +18 -0
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +9 -23
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +3 -0
- package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +8 -14
- package/esm/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +30 -0
- package/esm/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -0
- package/esm/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +11 -0
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +29 -0
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +10 -0
- package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +16 -0
- package/esm/typings/src/llm-providers/_common/utils/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +11 -0
- package/esm/typings/src/llm-providers/_common/utils/count-total-cost/countTotalCost.d.ts +14 -0
- package/esm/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +32 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -2
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +3 -3
- package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +3 -0
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +5 -4
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +5 -5
- package/esm/typings/src/llm-providers/azure-openai/playground/playground.d.ts +3 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +3 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +5 -5
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +7 -7
- package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +12 -8
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +7 -6
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +3 -2
- package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +3 -0
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +9 -7
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/personas/preparePersona.d.ts +15 -0
- package/esm/typings/src/prepare/PrepareOptions.d.ts +22 -0
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +10 -0
- package/esm/typings/src/prepare/preparePipeline.d.ts +18 -0
- package/esm/typings/src/prepare/unpreparePipeline.d.ts +9 -0
- package/esm/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/utils/unknownToString.d.ts +2 -1
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +25 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +5 -0
- package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +30 -0
- package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +13 -0
- package/esm/typings/src/storage/files-storage/utils/nameToSubfolderPath.d.ts +7 -0
- package/esm/typings/src/storage/files-storage/utils/nameToSubfolderPath.test.d.ts +1 -0
- package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +9 -0
- package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +9 -0
- package/esm/typings/src/storage/memory/MemoryStorage.d.ts +34 -0
- package/esm/typings/src/storage/utils/PrefixStorage.d.ts +26 -0
- package/esm/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +11 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +71 -11
- package/esm/typings/src/types/ModelVariant.d.ts +14 -0
- package/esm/typings/src/types/PipelineJson/Expectations.d.ts +6 -2
- package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +67 -0
- package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +24 -0
- package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +9 -1
- package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +38 -0
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +29 -4
- package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +21 -0
- package/esm/typings/src/types/PipelineJson/PromptDialogJson.d.ts +5 -0
- package/esm/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +5 -1
- package/esm/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +13 -4
- package/esm/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +11 -2
- package/esm/typings/src/types/PipelineJson/ScriptJson.d.ts +2 -0
- package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +2 -0
- package/esm/typings/src/types/PipelineString.d.ts +1 -1
- package/esm/typings/src/types/Prompt.d.ts +54 -10
- package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +4 -4
- package/esm/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +3 -3
- package/esm/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +114 -15
- package/esm/typings/src/utils/FromtoItems.d.ts +3 -3
- package/esm/typings/src/utils/currentDate.d.ts +7 -0
- package/esm/typings/src/utils/deepClone.d.ts +9 -0
- package/esm/typings/src/utils/deepFreeze.d.ts +22 -0
- package/esm/typings/src/utils/emojis.d.ts +2 -2
- package/esm/typings/src/utils/extractParameters.d.ts +2 -2
- package/esm/typings/src/utils/formatNumber.d.ts +1 -1
- package/esm/typings/src/utils/isRunningInWhatever.d.ts +3 -0
- package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +3 -3
- package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +7 -10
- package/esm/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown-real.test.d.ts +1 -0
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +9 -2
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/markdown/parseMarkdownSection.d.ts +3 -3
- package/esm/typings/src/utils/normalization/parseKeywords.d.ts +2 -1
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +12 -0
- package/esm/typings/src/utils/organization/TODO_any.d.ts +6 -0
- package/esm/typings/src/utils/organization/TODO_object.d.ts +6 -0
- package/esm/typings/src/utils/organization/TODO_unknown.d.ts +6 -0
- package/esm/typings/src/utils/organization/___.d.ts +6 -0
- package/esm/typings/src/utils/{just.d.ts โ organization/just.d.ts} +5 -1
- package/esm/typings/src/utils/organization/keepUnused.d.ts +16 -0
- package/esm/typings/src/utils/organization/really_any.d.ts +6 -0
- package/esm/typings/src/utils/organization/really_unknown.d.ts +6 -0
- package/esm/typings/src/utils/random/randomSeed.d.ts +7 -0
- package/{umd/typings/src/execution โ esm/typings/src}/utils/replaceParameters.d.ts +2 -4
- package/esm/typings/src/utils/replaceParameters.test.d.ts +1 -0
- package/esm/typings/src/utils/sets/difference.d.ts +3 -0
- package/esm/typings/src/utils/validators/email/isValidEmail.d.ts +2 -1
- package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +2 -1
- package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +2 -1
- package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +2 -1
- package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +2 -1
- package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -1
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +2 -1
- package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -1
- package/package.json +2 -2
- package/umd/index.umd.js +37 -4
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/promptbook-collection/index.d.ts +200 -30
- package/umd/typings/src/_packages/core.index.d.ts +7 -2
- package/umd/typings/src/_packages/execute-javascript.index.d.ts +1 -1
- package/umd/typings/src/_packages/node.index.d.ts +2 -1
- package/umd/typings/src/_packages/types.index.d.ts +11 -7
- package/umd/typings/src/_packages/utils.index.d.ts +8 -6
- package/umd/typings/src/cli/cli-commands/hello.d.ts +3 -0
- package/umd/typings/src/cli/cli-commands/make.d.ts +3 -0
- package/umd/typings/src/cli/cli-commands/prettify.d.ts +3 -0
- package/umd/typings/src/cli/promptbookCli.d.ts +1 -0
- package/umd/typings/src/collection/PipelineCollection.d.ts +1 -1
- package/umd/typings/src/collection/SimplePipelineCollection.d.ts +10 -10
- package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +8 -7
- package/umd/typings/src/collection/constructors/createCollectionFromUrl.d.ts +2 -2
- package/umd/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +2 -3
- package/umd/typings/src/commands/MODEL/ModelCommand.d.ts +2 -2
- package/umd/typings/src/commands/PERSONA/PersonaCommand.d.ts +4 -2
- package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
- package/umd/typings/src/commands/_common/types/CommandParser.d.ts +42 -14
- package/umd/typings/src/config.d.ts +38 -1
- package/umd/typings/src/config.test.d.ts +4 -0
- package/umd/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/umd/typings/src/conversion/pipelineStringToJson.d.ts +9 -5
- package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +5 -3
- package/umd/typings/src/conversion/prettify/PrettifyOptions.d.ts +2 -2
- package/umd/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts +2 -2
- package/umd/typings/src/conversion/utils/renameParameter.d.ts +3 -3
- package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +13 -0
- package/umd/typings/src/conversion/utils/stringifyPipelineJson.test.d.ts +1 -0
- package/umd/typings/src/conversion/validation/_importPipeline.d.ts +12 -3
- package/umd/typings/src/conversion/validation/validatePipeline.d.ts +10 -1
- package/umd/typings/src/errors/EnvironmentMismatchError.d.ts +7 -0
- package/umd/typings/src/errors/LimitReachedError.d.ts +7 -0
- package/umd/typings/src/errors/VersionMismatchError.d.ts +8 -0
- package/umd/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
- package/umd/typings/src/execution/LlmExecutionTools.d.ts +10 -8
- package/umd/typings/src/execution/PipelineExecutor.d.ts +9 -8
- package/umd/typings/src/execution/PromptResult.d.ts +28 -58
- package/umd/typings/src/execution/PromptResultUsage.d.ts +26 -0
- package/umd/typings/src/execution/ScriptExecutionTools.d.ts +5 -4
- package/umd/typings/src/execution/UncertainNumber.d.ts +18 -0
- package/umd/typings/src/execution/UserInterfaceTools.d.ts +5 -5
- package/umd/typings/src/execution/createPipelineExecutor.d.ts +19 -3
- package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +2 -2
- package/umd/typings/src/execution/utils/addUsage.d.ts +58 -2
- package/umd/typings/src/execution/utils/computeUsageCounts.d.ts +1 -1
- package/umd/typings/src/execution/utils/forEachAsync.d.ts +1 -1
- package/umd/typings/src/execution/utils/uncertainNumber.d.ts +1 -1
- package/umd/typings/src/execution/utils/usageToWorktime.d.ts +2 -2
- package/umd/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
- package/umd/typings/src/formats/csv/ListFormatDefinition.d.ts +2 -1
- package/umd/typings/src/formats/json/JsonFormatDefinition.d.ts +2 -1
- package/umd/typings/src/formats/list/ListFormatDefinition.d.ts +2 -1
- package/umd/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -0
- package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +1 -1
- package/umd/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -0
- package/umd/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +27 -0
- package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +18 -0
- package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.test.d.ts +1 -0
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +9 -23
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +3 -0
- package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +8 -14
- package/umd/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +30 -0
- package/umd/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -0
- package/umd/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +11 -0
- package/umd/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +29 -0
- package/umd/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +10 -0
- package/umd/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +16 -0
- package/umd/typings/src/llm-providers/_common/utils/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +11 -0
- package/umd/typings/src/llm-providers/_common/utils/count-total-cost/countTotalCost.d.ts +14 -0
- package/umd/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +32 -0
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -2
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +1 -1
- package/umd/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +3 -3
- package/umd/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +3 -0
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +5 -4
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +5 -5
- package/umd/typings/src/llm-providers/azure-openai/playground/playground.d.ts +3 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +3 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +1 -1
- package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +5 -5
- package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +7 -7
- package/umd/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +12 -8
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +7 -6
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +1 -1
- package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
- package/umd/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
- package/umd/typings/src/llm-providers/openai/openai-models.d.ts +3 -2
- package/umd/typings/src/llm-providers/openai/playground/playground.d.ts +3 -0
- package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +9 -7
- package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +1 -1
- package/umd/typings/src/personas/preparePersona.d.ts +15 -0
- package/umd/typings/src/personas/preparePersona.test.d.ts +1 -0
- package/umd/typings/src/prepare/PrepareOptions.d.ts +22 -0
- package/umd/typings/src/prepare/isPipelinePrepared.d.ts +10 -0
- package/umd/typings/src/prepare/isPipelinePrepared.test.d.ts +1 -0
- package/umd/typings/src/prepare/preparePipeline.d.ts +18 -0
- package/umd/typings/src/prepare/unpreparePipeline.d.ts +9 -0
- package/umd/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +1 -1
- package/umd/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
- package/umd/typings/src/scripting/javascript/utils/unknownToString.d.ts +2 -1
- package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +25 -0
- package/umd/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +5 -0
- package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +30 -0
- package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +13 -0
- package/umd/typings/src/storage/files-storage/utils/nameToSubfolderPath.d.ts +7 -0
- package/umd/typings/src/storage/files-storage/utils/nameToSubfolderPath.test.d.ts +1 -0
- package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +9 -0
- package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +9 -0
- package/umd/typings/src/storage/memory/MemoryStorage.d.ts +34 -0
- package/umd/typings/src/storage/utils/PrefixStorage.d.ts +26 -0
- package/umd/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +11 -0
- package/umd/typings/src/types/ModelRequirements.d.ts +71 -11
- package/umd/typings/src/types/ModelVariant.d.ts +14 -0
- package/umd/typings/src/types/PipelineJson/Expectations.d.ts +6 -2
- package/umd/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +67 -0
- package/umd/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +24 -0
- package/umd/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +9 -1
- package/umd/typings/src/types/PipelineJson/PersonaJson.d.ts +38 -0
- package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +29 -4
- package/umd/typings/src/types/PipelineJson/PreparationJson.d.ts +21 -0
- package/umd/typings/src/types/PipelineJson/PromptDialogJson.d.ts +5 -0
- package/umd/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +5 -1
- package/umd/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +13 -4
- package/umd/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +11 -2
- package/umd/typings/src/types/PipelineJson/ScriptJson.d.ts +2 -0
- package/umd/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +2 -0
- package/umd/typings/src/types/PipelineString.d.ts +1 -1
- package/umd/typings/src/types/Prompt.d.ts +54 -10
- package/umd/typings/src/types/execution-report/ExecutionReportJson.d.ts +4 -4
- package/umd/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +3 -3
- package/umd/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
- package/umd/typings/src/types/typeAliases.d.ts +114 -15
- package/umd/typings/src/utils/FromtoItems.d.ts +3 -3
- package/umd/typings/src/utils/currentDate.d.ts +7 -0
- package/umd/typings/src/utils/deepClone.d.ts +9 -0
- package/umd/typings/src/utils/deepFreeze.d.ts +22 -0
- package/umd/typings/src/utils/emojis.d.ts +2 -2
- package/umd/typings/src/utils/extractParameters.d.ts +2 -2
- package/umd/typings/src/utils/formatNumber.d.ts +1 -1
- package/umd/typings/src/utils/isRunningInWhatever.d.ts +3 -0
- package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +3 -3
- package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +7 -10
- package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
- package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown-real.test.d.ts +1 -0
- package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +9 -2
- package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
- package/umd/typings/src/utils/markdown/parseMarkdownSection.d.ts +3 -3
- package/umd/typings/src/utils/normalization/parseKeywords.d.ts +2 -1
- package/umd/typings/src/utils/organization/TODO_USE.d.ts +12 -0
- package/umd/typings/src/utils/organization/TODO_any.d.ts +6 -0
- package/umd/typings/src/utils/organization/TODO_object.d.ts +6 -0
- package/umd/typings/src/utils/organization/TODO_unknown.d.ts +6 -0
- package/umd/typings/src/utils/organization/___.d.ts +6 -0
- package/umd/typings/src/utils/{just.d.ts โ organization/just.d.ts} +5 -1
- package/umd/typings/src/utils/organization/keepUnused.d.ts +16 -0
- package/umd/typings/src/utils/organization/really_any.d.ts +6 -0
- package/umd/typings/src/utils/organization/really_unknown.d.ts +6 -0
- package/umd/typings/src/utils/random/randomSeed.d.ts +7 -0
- package/{esm/typings/src/execution โ umd/typings/src}/utils/replaceParameters.d.ts +2 -4
- package/umd/typings/src/utils/replaceParameters.test.d.ts +1 -0
- package/umd/typings/src/utils/sets/difference.d.ts +3 -0
- package/umd/typings/src/utils/validators/email/isValidEmail.d.ts +2 -1
- package/umd/typings/src/utils/validators/filePath/isValidFilePath.d.ts +2 -1
- package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +2 -1
- package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +2 -1
- package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +2 -1
- package/umd/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -1
- package/umd/typings/src/utils/validators/url/isValidUrl.d.ts +2 -1
- package/umd/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -1
- package/esm/typings/src/collection/constructors/justTestFsImport.d.ts +0 -7
- package/esm/typings/src/personas/personaToModelRequirements.d.ts +0 -6
- package/esm/typings/src/types/Parameters.d.ts +0 -14
- package/esm/typings/src/types/PipelineJson/KnowledgeJson.d.ts +0 -6
- package/esm/typings/src/types/PipelineJson/MaterialKnowledgePieceJson.d.ts +0 -28
- package/umd/typings/src/collection/constructors/justTestFsImport.d.ts +0 -7
- package/umd/typings/src/personas/personaToModelRequirements.d.ts +0 -6
- package/umd/typings/src/types/Parameters.d.ts +0 -14
- package/umd/typings/src/types/PipelineJson/KnowledgeJson.d.ts +0 -6
- package/umd/typings/src/types/PipelineJson/MaterialKnowledgePieceJson.d.ts +0 -28
- /package/esm/typings/src/_packages/{markdown-utils.d.ts โ markdown-utils.index.d.ts} +0 -0
- /package/esm/typings/src/{execution/addPromptResultUsage.test.d.ts โ conversion/utils/stringifyPipelineJson.test.d.ts} +0 -0
- /package/esm/typings/src/{execution/utils/replaceParameters.test.d.ts โ knowledge/prepare-knowledge/_common/prepareKnowledgePieces.test.d.ts} +0 -0
- /package/{umd/typings/src/execution/addPromptResultUsage.test.d.ts โ esm/typings/src/personas/preparePersona.test.d.ts} +0 -0
- /package/esm/typings/src/{utils/postprocessing โ postprocessing/utils}/extractBlock.d.ts +0 -0
- /package/{umd/typings/src/execution/utils/replaceParameters.test.d.ts โ esm/typings/src/prepare/isPipelinePrepared.test.d.ts} +0 -0
- /package/umd/typings/src/_packages/{markdown-utils.d.ts โ markdown-utils.index.d.ts} +0 -0
- /package/umd/typings/src/{utils/postprocessing โ postprocessing/utils}/extractBlock.d.ts +0 -0
|
@@ -1,37 +1,45 @@
|
|
|
1
|
-
import type { KebabCase } from 'type-fest';
|
|
2
|
-
import type { ExpectationUnit } from '../types/PipelineJson/Expectations';
|
|
3
|
-
import type { number_positive } from '../types/typeAliases';
|
|
4
|
-
import type { number_usd } from '../types/typeAliases';
|
|
5
1
|
import type { string_date_iso8601 } from '../types/typeAliases';
|
|
6
2
|
import type { string_model_name } from '../types/typeAliases';
|
|
3
|
+
import type { TODO_object } from '../utils/organization/TODO_object';
|
|
7
4
|
import type { EmbeddingVector } from './EmbeddingVector';
|
|
5
|
+
import type { PromptResultUsage } from './PromptResultUsage';
|
|
8
6
|
/**
|
|
9
7
|
* Prompt result is the simplest concept of execution.
|
|
10
8
|
* It is the result of executing one prompt _(NOT a template)_.
|
|
11
9
|
*
|
|
12
10
|
* @see https://github.com/webgptorg/promptbook#prompt-result
|
|
13
11
|
*/
|
|
14
|
-
export type PromptResult =
|
|
12
|
+
export type PromptResult = CompletionPromptResult | ChatPromptResult | EmbeddingPromptResult;
|
|
15
13
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* Completion prompt result
|
|
15
|
+
*
|
|
16
|
+
* Note:It contains only the newly generated text NOT the whole completion
|
|
17
|
+
* Note: This is fully serializable as JSON
|
|
18
18
|
*/
|
|
19
|
-
export type
|
|
19
|
+
export type CompletionPromptResult = CommonPromptResult;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
*Chat prompt result
|
|
22
|
+
*
|
|
23
|
+
* Note: This is fully serializable as JSON
|
|
22
24
|
*/
|
|
23
|
-
export type
|
|
25
|
+
export type ChatPromptResult = CommonPromptResult & {};
|
|
24
26
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
+
* Embedding prompt result
|
|
28
|
+
*
|
|
29
|
+
* Note: This is fully serializable as JSON
|
|
27
30
|
*/
|
|
28
|
-
export type
|
|
31
|
+
export type EmbeddingPromptResult = Omit<CommonPromptResult, 'content'> & {
|
|
29
32
|
/**
|
|
30
33
|
* The response from the model
|
|
31
34
|
*/
|
|
32
35
|
content: EmbeddingVector;
|
|
33
36
|
};
|
|
34
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Common properties for all prompt results
|
|
39
|
+
*
|
|
40
|
+
* Note: This is fully serializable as JSON
|
|
41
|
+
*/
|
|
42
|
+
export type CommonPromptResult = {
|
|
35
43
|
/**
|
|
36
44
|
* Exact text response from the model
|
|
37
45
|
*/
|
|
@@ -47,15 +55,15 @@ export type PromptCommonResult = {
|
|
|
47
55
|
/**
|
|
48
56
|
* Start of the execution
|
|
49
57
|
*/
|
|
50
|
-
start: string_date_iso8601;
|
|
58
|
+
readonly start: string_date_iso8601;
|
|
51
59
|
/**
|
|
52
60
|
* First token generated
|
|
53
61
|
*/
|
|
54
|
-
firstToken?: string_date_iso8601;
|
|
62
|
+
readonly firstToken?: string_date_iso8601;
|
|
55
63
|
/**
|
|
56
64
|
* End of the execution
|
|
57
65
|
*/
|
|
58
|
-
complete: string_date_iso8601;
|
|
66
|
+
readonly complete: string_date_iso8601;
|
|
59
67
|
};
|
|
60
68
|
/**
|
|
61
69
|
* Usage of the prompt execution
|
|
@@ -64,51 +72,13 @@ export type PromptCommonResult = {
|
|
|
64
72
|
/**
|
|
65
73
|
* Raw response from the model
|
|
66
74
|
*/
|
|
67
|
-
readonly rawResponse:
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Usage statistics for one or many prompt results
|
|
71
|
-
*/
|
|
72
|
-
export type PromptResultUsage = {
|
|
73
|
-
/**
|
|
74
|
-
* Cost of the execution in USD
|
|
75
|
-
*
|
|
76
|
-
* Note: If the cost is unknown, the value 0 and isUncertain is true
|
|
77
|
-
*/
|
|
78
|
-
price: UncertainNumber;
|
|
79
|
-
/**
|
|
80
|
-
* Number of whatever used in the input aka. `prompt_tokens`
|
|
81
|
-
*/
|
|
82
|
-
input: PromptResultUsageCounts;
|
|
83
|
-
/**
|
|
84
|
-
* Number of tokens used in the output aka. `completion_tokens`
|
|
85
|
-
*/
|
|
86
|
-
output: PromptResultUsageCounts;
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Record of all possible measurable units
|
|
90
|
-
*/
|
|
91
|
-
export type PromptResultUsageCounts = Record<`${KebabCase<'TOKENS' | ExpectationUnit>}Count`, UncertainNumber>;
|
|
92
|
-
/**
|
|
93
|
-
* Number which can be uncertain
|
|
94
|
-
*
|
|
95
|
-
* Note: If the value is completelly unknown, the value 0 and isUncertain is true
|
|
96
|
-
* Note: Not using NaN or null because it looses the value which is better to be uncertain then not to be at all
|
|
97
|
-
*/
|
|
98
|
-
export type UncertainNumber = {
|
|
99
|
-
/**
|
|
100
|
-
* The numeric value
|
|
101
|
-
*/
|
|
102
|
-
value: number_usd & (number_positive | 0);
|
|
103
|
-
/**
|
|
104
|
-
* Is the value uncertain
|
|
105
|
-
*/
|
|
106
|
-
isUncertain?: true;
|
|
75
|
+
readonly rawResponse: TODO_object;
|
|
107
76
|
};
|
|
108
77
|
/**
|
|
109
78
|
* TODO: [๐ง ] Maybe timing more accurate then seconds?
|
|
110
79
|
* TODO: [๐ง ] Should here be link to the prompt?
|
|
111
|
-
* TODO: [๐ง ] Maybe type
|
|
80
|
+
* TODO: [๐ง ] Maybe type `rawResponse` properly - not onject but OpenAI.result.whatever
|
|
112
81
|
* TODO: [๐ง ] Maybe remove redundant raw.choices.text
|
|
113
82
|
* TODO: Log raw even if prompt failed - log the raw error
|
|
83
|
+
* TODO: [๐ณ] Add `TranslationPromptResult`
|
|
114
84
|
*/
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { KebabCase } from 'type-fest';
|
|
2
|
+
import type { ExpectationUnit } from '../types/PipelineJson/Expectations';
|
|
3
|
+
import type { UncertainNumber } from './UncertainNumber';
|
|
4
|
+
/**
|
|
5
|
+
* Usage statistics for one or many prompt results
|
|
6
|
+
*/
|
|
7
|
+
export type PromptResultUsage = {
|
|
8
|
+
/**
|
|
9
|
+
* Cost of the execution in USD
|
|
10
|
+
*
|
|
11
|
+
* Note: If the cost is unknown, the value 0 and isUncertain is true
|
|
12
|
+
*/
|
|
13
|
+
readonly price: UncertainNumber;
|
|
14
|
+
/**
|
|
15
|
+
* Number of whatever used in the input aka. `prompt_tokens`
|
|
16
|
+
*/
|
|
17
|
+
readonly input: PromptResultUsageCounts;
|
|
18
|
+
/**
|
|
19
|
+
* Number of tokens used in the output aka. `completion_tokens`
|
|
20
|
+
*/
|
|
21
|
+
readonly output: PromptResultUsageCounts;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Record of all possible measurable units
|
|
25
|
+
*/
|
|
26
|
+
export type PromptResultUsageCounts = Record<`${KebabCase<'TOKENS' | ExpectationUnit>}Count`, UncertainNumber>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ScriptLanguage } from '../types/ScriptLanguage';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Parameters } from '../types/typeAliases';
|
|
3
3
|
import type { string_script } from '../types/typeAliases';
|
|
4
4
|
/**
|
|
5
5
|
* Represents all the tools needed to EXECUTE SCRIPTs
|
|
@@ -16,13 +16,13 @@ export type ScriptExecutionToolsExecuteOptions = {
|
|
|
16
16
|
/**
|
|
17
17
|
* Language of the script
|
|
18
18
|
*/
|
|
19
|
-
scriptLanguage: ScriptLanguage;
|
|
19
|
+
readonly scriptLanguage: ScriptLanguage;
|
|
20
20
|
/**
|
|
21
21
|
* Parameters for the script
|
|
22
22
|
* Theese parameters are passed to the script as variables
|
|
23
23
|
* For example: { "name": "John" } => const name = "John";
|
|
24
24
|
*/
|
|
25
|
-
parameters:
|
|
25
|
+
readonly parameters: Parameters;
|
|
26
26
|
/**
|
|
27
27
|
* The content of the script to execute
|
|
28
28
|
* - It can be a single statement
|
|
@@ -31,8 +31,9 @@ export type ScriptExecutionToolsExecuteOptions = {
|
|
|
31
31
|
* - It can be IIFE (immediately invoked function expression)
|
|
32
32
|
* - It can use the parameters as variables and functions from global scope
|
|
33
33
|
*/
|
|
34
|
-
script: string_script;
|
|
34
|
+
readonly script: string_script;
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* TODO: [๐ง ][๐] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
|
|
38
|
+
* TODO: [๐ง ][๐ช] Should be common things like types, utils in folder containing A,B,C,.. or else outside this listing folder?
|
|
38
39
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { number_positive } from '../types/typeAliases';
|
|
2
|
+
import type { number_usd } from '../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* Number which can be uncertain
|
|
5
|
+
*
|
|
6
|
+
* Note: If the value is completelly unknown, the value 0 and isUncertain is true
|
|
7
|
+
* Note: Not using NaN or null because it looses the value which is better to be uncertain then not to be at all
|
|
8
|
+
*/
|
|
9
|
+
export type UncertainNumber = {
|
|
10
|
+
/**
|
|
11
|
+
* The numeric value
|
|
12
|
+
*/
|
|
13
|
+
readonly value: number_usd & (number_positive | 0);
|
|
14
|
+
/**
|
|
15
|
+
* Is the value uncertain
|
|
16
|
+
*/
|
|
17
|
+
readonly isUncertain?: true;
|
|
18
|
+
};
|
|
@@ -21,26 +21,26 @@ export type UserInterfaceToolsPromptDialogOptions = {
|
|
|
21
21
|
* Note: This is not a prompt to language model but a prompt to the user
|
|
22
22
|
* @example "Your name"
|
|
23
23
|
*/
|
|
24
|
-
promptTitle: string;
|
|
24
|
+
readonly promptTitle: string;
|
|
25
25
|
/**
|
|
26
26
|
* Prompt message
|
|
27
27
|
*
|
|
28
28
|
* Note: This is not a prompt to language model but a prompt to the user
|
|
29
29
|
* @example "Please enter your name, including your last name, title, etc."
|
|
30
30
|
*/
|
|
31
|
-
promptMessage: string;
|
|
31
|
+
readonly promptMessage: string;
|
|
32
32
|
/**
|
|
33
33
|
* Default value for the input/textarea
|
|
34
34
|
*/
|
|
35
|
-
defaultValue: string | null;
|
|
35
|
+
readonly defaultValue: string | null;
|
|
36
36
|
/**
|
|
37
37
|
* Placeholder for the input/textarea
|
|
38
38
|
*/
|
|
39
|
-
placeholder?: string;
|
|
39
|
+
readonly placeholder?: string;
|
|
40
40
|
/**
|
|
41
41
|
* Priority of the prompt
|
|
42
42
|
*
|
|
43
43
|
* Note: This would be reflected for example into the UI z-index of the prompt modal
|
|
44
44
|
*/
|
|
45
|
-
priority: number_integer & number_positive;
|
|
45
|
+
readonly priority: number_integer & number_positive;
|
|
46
46
|
};
|
|
@@ -5,12 +5,24 @@ type CreatePipelineExecutorSettings = {
|
|
|
5
5
|
/**
|
|
6
6
|
* When executor does not satisfy expectations it will be retried this amount of times
|
|
7
7
|
*
|
|
8
|
-
* @default
|
|
8
|
+
* @default MAX_EXECUTION_ATTEMPTS
|
|
9
9
|
*/
|
|
10
|
-
readonly maxExecutionAttempts
|
|
10
|
+
readonly maxExecutionAttempts?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Maximum number of tasks running in parallel
|
|
13
|
+
*
|
|
14
|
+
* @default MAX_PARALLEL_COUNT
|
|
15
|
+
*/
|
|
16
|
+
readonly maxParallelCount?: number;
|
|
17
|
+
/**
|
|
18
|
+
* If true, the preparation logs additional information
|
|
19
|
+
*
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
readonly isVerbose?: boolean;
|
|
11
23
|
};
|
|
12
24
|
/**
|
|
13
|
-
* Options for
|
|
25
|
+
* Options for `createPipelineExecutor`
|
|
14
26
|
*/
|
|
15
27
|
interface CreatePipelineExecutorOptions {
|
|
16
28
|
/**
|
|
@@ -35,8 +47,12 @@ interface CreatePipelineExecutorOptions {
|
|
|
35
47
|
export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
|
|
36
48
|
export {};
|
|
37
49
|
/**
|
|
50
|
+
* TODO: Use isVerbose here (not only pass to `preparePipeline`)
|
|
51
|
+
* TODO: [๐ช] Use maxParallelCount here (not only pass to `preparePipeline`)
|
|
52
|
+
* TODO: [โ] Probbably move expectations from templates to parameters
|
|
38
53
|
* TODO: [๐ง ] When not meet expectations in PROMPT_DIALOG, make some way to tell the user
|
|
39
54
|
* TODO: [๐ง] Strongly type the executors to avoid need of remove nullables whtn noUncheckedIndexedAccess in tsconfig.json
|
|
40
55
|
* Note: CreatePipelineExecutorOptions are just connected to PipelineExecutor so do not extract to types folder
|
|
41
56
|
* TODO: [๐ง ][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
|
|
57
|
+
* TODO: [๐ ] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
42
58
|
*/
|
|
@@ -1,7 +1,63 @@
|
|
|
1
|
-
import type { PromptResultUsage } from '../
|
|
1
|
+
import type { PromptResultUsage } from '../PromptResultUsage';
|
|
2
|
+
/**
|
|
3
|
+
* @@@
|
|
4
|
+
*
|
|
5
|
+
* TODO: [๐ผ] Export with addUsage
|
|
6
|
+
*/
|
|
7
|
+
export declare const ZERO_USAGE: import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{
|
|
8
|
+
readonly price: {
|
|
9
|
+
readonly value: 0;
|
|
10
|
+
};
|
|
11
|
+
readonly input: {
|
|
12
|
+
readonly tokensCount: {
|
|
13
|
+
readonly value: 0;
|
|
14
|
+
};
|
|
15
|
+
readonly charactersCount: {
|
|
16
|
+
readonly value: 0;
|
|
17
|
+
};
|
|
18
|
+
readonly wordsCount: {
|
|
19
|
+
readonly value: 0;
|
|
20
|
+
};
|
|
21
|
+
readonly sentencesCount: {
|
|
22
|
+
readonly value: 0;
|
|
23
|
+
};
|
|
24
|
+
readonly linesCount: {
|
|
25
|
+
readonly value: 0;
|
|
26
|
+
};
|
|
27
|
+
readonly paragraphsCount: {
|
|
28
|
+
readonly value: 0;
|
|
29
|
+
};
|
|
30
|
+
readonly pagesCount: {
|
|
31
|
+
readonly value: 0;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
readonly output: {
|
|
35
|
+
readonly tokensCount: {
|
|
36
|
+
readonly value: 0;
|
|
37
|
+
};
|
|
38
|
+
readonly charactersCount: {
|
|
39
|
+
readonly value: 0;
|
|
40
|
+
};
|
|
41
|
+
readonly wordsCount: {
|
|
42
|
+
readonly value: 0;
|
|
43
|
+
};
|
|
44
|
+
readonly sentencesCount: {
|
|
45
|
+
readonly value: 0;
|
|
46
|
+
};
|
|
47
|
+
readonly linesCount: {
|
|
48
|
+
readonly value: 0;
|
|
49
|
+
};
|
|
50
|
+
readonly paragraphsCount: {
|
|
51
|
+
readonly value: 0;
|
|
52
|
+
};
|
|
53
|
+
readonly pagesCount: {
|
|
54
|
+
readonly value: 0;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}>;
|
|
2
58
|
/**
|
|
3
59
|
* Function `addUsage` will add multiple usages into one
|
|
4
60
|
*
|
|
5
|
-
* Note: If you provide 0 values, it returns
|
|
61
|
+
* Note: If you provide 0 values, it returns ZERO_USAGE
|
|
6
62
|
*/
|
|
7
63
|
export declare function addUsage(...usageItems: Array<PromptResultUsage>): PromptResultUsage;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PromptResultUsage } from '../
|
|
2
|
-
import type { UncertainNumber } from '../
|
|
1
|
+
import type { PromptResultUsage } from '../PromptResultUsage';
|
|
2
|
+
import type { UncertainNumber } from '../UncertainNumber';
|
|
3
3
|
/**
|
|
4
4
|
* Function usageToWorktime will take usage and estimate saved worktime in hours of reading / writing
|
|
5
5
|
*
|
|
@@ -65,5 +65,5 @@ export type FormatDefinition<TValue extends TPartialValue, TPartialValue extends
|
|
|
65
65
|
* TODO: [๐][๐จโโ๏ธ] Compute TPartialValue dynamically - PartialString<TValue>
|
|
66
66
|
* TODO: [๐][๐ง ] Should execution tools be aviable to heal, canBeValid and isValid?
|
|
67
67
|
* TODO: [๐][๐ง ] llm Provider Bindings
|
|
68
|
-
* TODO: [๐]Export via some package
|
|
68
|
+
* TODO: [๐][๐ผ] Export via some package
|
|
69
69
|
*/
|
|
@@ -8,4 +8,5 @@ export declare const CsvFormatDefinition: FormatDefinition<string, string, objec
|
|
|
8
8
|
* TODO: [๐] In `CsvFormatDefinition` implement partial `canBeValid`
|
|
9
9
|
* TODO: [๐] In `CsvFormatDefinition` implement `heal
|
|
10
10
|
* TODO: [๐] In `CsvFormatDefinition` implement `extractValues`
|
|
11
|
-
|
|
11
|
+
* TODO: [๐ข] Allow to expect something inside CSV objects and other formats
|
|
12
|
+
*/
|
|
@@ -12,4 +12,5 @@ export declare const JsonFormatDefinition: FormatDefinition<string, string, obje
|
|
|
12
12
|
* TODO: [๐] In `JsonFormatDefinition` implement partial `canBeValid`
|
|
13
13
|
* TODO: [๐] In `JsonFormatDefinition` implement `heal
|
|
14
14
|
* TODO: [๐] In `JsonFormatDefinition` implement `extractValues`
|
|
15
|
-
|
|
15
|
+
* TODO: [๐ข] Allow to expect something inside JSON objects and other formats
|
|
16
|
+
*/
|
|
@@ -10,4 +10,5 @@ export declare const ListFormatDefinition: FormatDefinition<string, string, obje
|
|
|
10
10
|
* TODO: [๐] In `ListFormatDefinition` implement partial `canBeValid`
|
|
11
11
|
* TODO: [๐] In `ListFormatDefinition` implement `heal
|
|
12
12
|
* TODO: [๐] In `ListFormatDefinition` implement `extractValues`
|
|
13
|
-
|
|
13
|
+
* TODO: [๐ข] Allow to expect something inside each item of list and other formats
|
|
14
|
+
*/
|
|
@@ -12,4 +12,5 @@ export declare const XmlFormatDefinition: FormatDefinition<string, string, objec
|
|
|
12
12
|
* TODO: [๐] In `XmlFormatDefinition` implement partial `canBeValid`
|
|
13
13
|
* TODO: [๐] In `XmlFormatDefinition` implement `heal
|
|
14
14
|
* TODO: [๐] In `XmlFormatDefinition` implement `extractValues`
|
|
15
|
+
* TODO: [๐ข] Allow to expect something inside XML and other formats
|
|
15
16
|
*/
|
|
@@ -2,7 +2,7 @@ import type { Promisable } from 'type-fest';
|
|
|
2
2
|
import type { CommonExecutionToolsOptions } from '../../../execution/CommonExecutionToolsOptions';
|
|
3
3
|
import type { UserInterfaceToolsPromptDialogOptions } from '../../../execution/UserInterfaceTools';
|
|
4
4
|
/**
|
|
5
|
-
* Options for CallbackInterfaceTools
|
|
5
|
+
* Options for `CallbackInterfaceTools`
|
|
6
6
|
*/
|
|
7
7
|
export type CallbackInterfaceToolsOptions = CommonExecutionToolsOptions & {
|
|
8
8
|
/**
|
|
@@ -15,3 +15,6 @@ export declare class SimplePromptInterfaceTools implements UserInterfaceTools {
|
|
|
15
15
|
*/
|
|
16
16
|
promptDialog(options: UserInterfaceToolsPromptDialogOptions): Promise<string>;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Note: [๐ต] This code should never be published outside of `@promptbook/browser`
|
|
20
|
+
*/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { string_file_path } from '../../../types/typeAliases';
|
|
3
|
+
import type { string_knowledge_source_link } from '../../../types/typeAliases';
|
|
4
|
+
import type { string_markdown } from '../../../types/typeAliases';
|
|
5
|
+
import type { string_markdown_text } from '../../../types/typeAliases';
|
|
6
|
+
import type { string_mime_type } from '../../../types/typeAliases';
|
|
7
|
+
import type { string_mime_type_with_wildcard } from '../../../types/typeAliases';
|
|
8
|
+
import type { string_promptbook_documentation_url } from '../../../types/typeAliases';
|
|
9
|
+
import type { really_unknown } from '../../../utils/organization/really_unknown';
|
|
10
|
+
export type Scraper = {
|
|
11
|
+
readonly description: string_markdown_text;
|
|
12
|
+
readonly documentationUrl: string_promptbook_documentation_url;
|
|
13
|
+
readonly examples: Array<string_file_path>;
|
|
14
|
+
readonly mimeTypes: Array<string_mime_type_with_wildcard>;
|
|
15
|
+
scrape(source: ScraperSourceOptions): Promisable<string_markdown>;
|
|
16
|
+
};
|
|
17
|
+
export type ScraperSourceOptions = {
|
|
18
|
+
readonly source: string_knowledge_source_link;
|
|
19
|
+
readonly mimeType: string_mime_type;
|
|
20
|
+
asJson(): Promise<really_unknown>;
|
|
21
|
+
asText(): Promise<really_unknown>;
|
|
22
|
+
asBlob(): Promise<really_unknown>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* TODO: [๐] @@@ Annotate all
|
|
26
|
+
* TODO: [๐ผ] Export via types
|
|
27
|
+
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PrepareOptions } from '../../../prepare/PrepareOptions';
|
|
2
|
+
import type { KnowledgePiecePreparedJson } from '../../../types/PipelineJson/KnowledgePieceJson';
|
|
3
|
+
import type { KnowledgeSourceJson } from '../../../types/PipelineJson/KnowledgeSourceJson';
|
|
4
|
+
/**
|
|
5
|
+
* Prepares the knowle
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/webgptorg/promptbook/discussions/41
|
|
8
|
+
*/
|
|
9
|
+
export declare function prepareKnowledgePieces(knowledgeSources: Array<KnowledgeSourceJson>, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'preparationIds'>>>;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: [๐][๐ผ] !!! Export via `@promptbook/core`
|
|
12
|
+
* TODO: [๐ง] In future one preparation can take data from previous preparation and save tokens and time
|
|
13
|
+
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
14
|
+
* TODO: [๐ช] More than max things can run in parallel by acident [1,[2a,2b,_],[3a,3b,_]]
|
|
15
|
+
* TODO: [๐ง ][โ] Do here propper M:N mapping
|
|
16
|
+
* [x] One source can make multiple pieces
|
|
17
|
+
* [ ] One piece can have multiple sources
|
|
18
|
+
*/
|
package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { PrepareOptions } from '../../../prepare/PrepareOptions';
|
|
2
|
+
import type { KnowledgePiecePreparedJson } from '../../../types/PipelineJson/KnowledgePieceJson';
|
|
3
3
|
import type { string_markdown } from '../../../types/typeAliases';
|
|
4
|
-
type PrepareKnowledgeFromMarkdownOptions = {
|
|
5
|
-
/**
|
|
6
|
-
* The source of the knowledge in markdown format
|
|
7
|
-
*/
|
|
8
|
-
content: string_markdown;
|
|
9
|
-
/**
|
|
10
|
-
* The LLM tools to use for the conversion and extraction of knowledge
|
|
11
|
-
*
|
|
12
|
-
* Note: If you want to use multiple LLMs, you can use `joinLlmExecutionTools` to join them first
|
|
13
|
-
*/
|
|
14
|
-
llmTools: LlmExecutionTools;
|
|
15
|
-
/**
|
|
16
|
-
* If true, the preaparation of knowledge logs additional information
|
|
17
|
-
*
|
|
18
|
-
* @default false
|
|
19
|
-
*/
|
|
20
|
-
isVerbose?: boolean;
|
|
21
|
-
};
|
|
22
|
-
export declare function prepareKnowledgeFromMarkdown(options: PrepareKnowledgeFromMarkdownOptions): Promise<KnowledgeJson>;
|
|
23
|
-
export {};
|
|
24
4
|
/**
|
|
25
|
-
*
|
|
5
|
+
* @@@
|
|
6
|
+
*/
|
|
7
|
+
export declare function prepareKnowledgeFromMarkdown(content: string_markdown, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>>>;
|
|
8
|
+
/**
|
|
9
|
+
* TODO: [๐][๐ผ] !!! Export via `@promptbook/markdown`
|
|
10
|
+
* TODO: [๐ช] Do it in parallel 11:11
|
|
11
|
+
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
26
12
|
*/
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { PrepareOptions } from '../../../prepare/PrepareOptions';
|
|
2
|
+
import type { KnowledgePiecePreparedJson } from '../../../types/PipelineJson/KnowledgePieceJson';
|
|
3
3
|
import type { string_base64 } from '../../../types/typeAliases';
|
|
4
|
-
type PrepareKnowledgeFromPdfOptions = {
|
|
5
|
-
/**
|
|
6
|
-
* The source of the knowledge in PDF format
|
|
7
|
-
*/
|
|
8
|
-
content: string_base64;
|
|
9
|
-
/**
|
|
10
|
-
* The LLM tools to use for the conversion and extraction of knowledge
|
|
11
|
-
*/
|
|
12
|
-
llmTools: LlmExecutionTools;
|
|
13
|
-
};
|
|
14
|
-
export declare function prepareKnowledgeFromPdf(options: PrepareKnowledgeFromPdfOptions): Promise<KnowledgeJson>;
|
|
15
|
-
export {};
|
|
16
4
|
/**
|
|
5
|
+
* @@@
|
|
6
|
+
*/
|
|
7
|
+
export declare function prepareKnowledgeFromPdf(content: string_base64, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>>>;
|
|
8
|
+
/**
|
|
9
|
+
* TODO: [๐][๐ผ] !!! Export via `@promptbook/pdf`
|
|
17
10
|
* TODO: [๐งบ] In future, content can be alse File or Blob BUT for now for wider compatibility its only base64
|
|
18
11
|
* @see https://stackoverflow.com/questions/14653349/node-js-cant-create-blobs
|
|
12
|
+
* TODO: [๐ช] Do it in parallel
|
|
19
13
|
*/
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
2
|
+
export type CreateLlmToolsFromEnvOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* This will will be passed to the created `LlmExecutionTools`
|
|
5
|
+
*
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
isVerbose?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @@@
|
|
12
|
+
*
|
|
13
|
+
* Note: This function is not cached, every call creates new instance of `LlmExecutionTools`
|
|
14
|
+
*
|
|
15
|
+
* It looks for environment variables:
|
|
16
|
+
* - `process.env.OPENAI_API_KEY`
|
|
17
|
+
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
18
|
+
*
|
|
19
|
+
* @returns @@@
|
|
20
|
+
*/
|
|
21
|
+
export declare function createLlmToolsFromEnv(options?: CreateLlmToolsFromEnvOptions): LlmExecutionTools;
|
|
22
|
+
/**
|
|
23
|
+
* TODO: [๐ผ] !!! Export via `@promptbook/node`
|
|
24
|
+
* TODO: @@@ write discussion about this - wizzard
|
|
25
|
+
* TODO: Add Azure
|
|
26
|
+
* TODO: [๐ง ] Which name is better `createLlmToolsFromEnv` or `createLlmToolsFromEnvironment`?
|
|
27
|
+
* TODO: [๐ง ] Is there some meaningfull way how to test this util
|
|
28
|
+
* TODO: [๐ง ] Maybe pass env as argument
|
|
29
|
+
* Note: [๐ข] This code should never be published outside of `@promptbook/node`
|
|
30
|
+
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
2
|
+
/**
|
|
3
|
+
* Returns LLM tools for CLI
|
|
4
|
+
*
|
|
5
|
+
* @private within the repository - for CLI utils
|
|
6
|
+
*/
|
|
7
|
+
export declare function getLlmToolsForCli(): LlmExecutionTools;
|
|
8
|
+
/**
|
|
9
|
+
* Note: [๐ก] This code should never be published outside of `@promptbook/cli`
|
|
10
|
+
*/
|
package/esm/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
2
|
+
import type { CreateLlmToolsFromEnvOptions } from './createLlmToolsFromEnv';
|
|
3
|
+
/**
|
|
4
|
+
* Returns LLM tools for testing purposes
|
|
5
|
+
*
|
|
6
|
+
* @private within the repository - JUST FOR TESTS, SCRIPTS AND PLAYGROUND
|
|
7
|
+
*/
|
|
8
|
+
export declare function getLlmToolsForTestingAndScriptsAndPlayground(options?: CreateLlmToolsFromEnvOptions): LlmExecutionTools;
|
|
9
|
+
/**
|
|
10
|
+
* Note: [โช] This should never be in any released package
|
|
11
|
+
*/
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PromptResult } from '../../../../execution/PromptResult';
|
|
2
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
3
|
+
import type { string_date_iso8601 } from '../../../../types/typeAliases';
|
|
4
|
+
import type { string_promptbook_version } from '../../../../version';
|
|
5
|
+
/**
|
|
6
|
+
* @@@
|
|
7
|
+
*/
|
|
8
|
+
export type CacheItem = {
|
|
9
|
+
/**
|
|
10
|
+
* @@@
|
|
11
|
+
*/
|
|
12
|
+
date: string_date_iso8601;
|
|
13
|
+
/**
|
|
14
|
+
* @@@
|
|
15
|
+
*/
|
|
16
|
+
promptbookVersion: string_promptbook_version;
|
|
17
|
+
/**
|
|
18
|
+
* @@@
|
|
19
|
+
*/
|
|
20
|
+
prompt: Prompt;
|
|
21
|
+
/**
|
|
22
|
+
* @@@
|
|
23
|
+
*/
|
|
24
|
+
promptResult: PromptResult;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* TODO: [๐ง ] Should be this exported alongsite `cacheLlmTools` through `@promptbook/utils` OR through `@promptbook/types`
|
|
28
|
+
* TODO: [๐ซ] `prompt` is NOT fully serializable as JSON, it contains functions which are not serializable, fix it
|
|
29
|
+
*/
|