@promptbook/core 0.62.1 → 0.63.0-1
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 -1
- package/esm/index.es.js +533 -39
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/anthropic-claude.index.d.ts +3 -2
- package/esm/typings/src/_packages/azure-openai.index.d.ts +4 -2
- package/esm/typings/src/_packages/browser.index.d.ts +6 -0
- package/esm/typings/src/_packages/cli.index.d.ts +1 -7
- package/esm/typings/src/_packages/core.index.d.ts +87 -13
- package/esm/typings/src/_packages/execute-javascript.index.d.ts +5 -45
- package/esm/typings/src/_packages/fake-llm.index.d.ts +4 -5
- package/esm/typings/src/_packages/langtail.index.d.ts +4 -2
- package/esm/typings/src/_packages/markdown-utils.index.d.ts +23 -4
- package/esm/typings/src/_packages/node.index.d.ts +5 -2
- package/esm/typings/src/_packages/openai.index.d.ts +5 -2
- package/esm/typings/src/_packages/remote-client.index.d.ts +5 -2
- package/esm/typings/src/_packages/remote-server.index.d.ts +4 -2
- package/esm/typings/src/_packages/types.index.d.ts +441 -21
- package/esm/typings/src/_packages/utils.index.d.ts +84 -31
- package/esm/typings/src/cli/main.d.ts +12 -0
- package/esm/typings/src/collection/collectionToJson.d.ts +2 -0
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
- package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -0
- package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -0
- package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createSubcollection.d.ts +1 -0
- package/esm/typings/src/commands/BLOCK/BlockTypes.d.ts +2 -0
- package/esm/typings/src/config.d.ts +27 -1
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +6 -3
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +4 -3
- package/esm/typings/src/conversion/prettify/prettifyPipelineString.d.ts +2 -0
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +2 -0
- package/esm/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.d.ts +1 -0
- package/esm/typings/src/conversion/utils/extractVariables.d.ts +1 -0
- package/esm/typings/src/conversion/utils/renameParameter.d.ts +1 -0
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +2 -0
- package/esm/typings/src/conversion/utils/titleToName.d.ts +6 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +1 -0
- package/esm/typings/src/errors/CollectionError.d.ts +2 -0
- package/esm/typings/src/errors/EnvironmentMismatchError.d.ts +2 -0
- package/esm/typings/src/errors/LimitReachedError.d.ts +2 -0
- package/esm/typings/src/errors/NotFoundError.d.ts +2 -0
- package/esm/typings/src/errors/NotYetImplementedError.d.ts +2 -0
- package/esm/typings/src/errors/ParsingError.d.ts +2 -0
- package/esm/typings/src/errors/PipelineExecutionError.d.ts +2 -0
- package/esm/typings/src/errors/PipelineLogicError.d.ts +2 -0
- package/esm/typings/src/errors/ReferenceError.d.ts +2 -0
- package/esm/typings/src/errors/UnexpectedError.d.ts +2 -0
- package/esm/typings/src/errors/VersionMismatchError.d.ts +2 -0
- package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -0
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +1 -0
- package/esm/typings/src/execution/embeddingVectorToString.d.ts +2 -0
- package/esm/typings/src/execution/utils/addUsage.d.ts +3 -1
- package/esm/typings/src/execution/utils/checkExpectations.d.ts +2 -0
- package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -0
- package/esm/typings/src/execution/utils/usageToHuman.d.ts +2 -0
- package/esm/typings/src/execution/utils/usageToWorktime.d.ts +2 -0
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +2 -1
- package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +2 -0
- package/esm/typings/src/knowledge/dialogs/callback/CallbackInterfaceTools.d.ts +2 -0
- package/esm/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +2 -0
- package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -1
- package/esm/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +10 -0
- package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +2 -0
- package/esm/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +4 -1
- package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countTotalUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +2 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +1 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +2 -0
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +2 -0
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +2 -0
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +7 -1
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
- package/esm/typings/src/personas/preparePersona.d.ts +1 -1
- package/esm/typings/src/postprocessing/utils/extractBlock.d.ts +5 -0
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +2 -1
- package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
- package/esm/typings/src/prepare/prepareTemplates.d.ts +2 -1
- package/esm/typings/src/prepare/unpreparePipeline.d.ts +2 -1
- package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +2 -0
- package/esm/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +1 -0
- package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +51 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +0 -1
- package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +2 -1
- package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +0 -3
- package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
- package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
- package/esm/typings/src/storage/memory/MemoryStorage.d.ts +2 -3
- package/esm/typings/src/storage/utils/PrefixStorage.d.ts +2 -3
- package/esm/typings/src/types/ModelRequirements.d.ts +0 -1
- package/esm/typings/src/types/Prompt.d.ts +0 -1
- package/esm/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +4 -0
- package/esm/typings/src/types/execution-report/executionReportJsonToString.d.ts +2 -0
- package/esm/typings/src/types/typeAliases.d.ts +9 -2
- package/esm/typings/src/utils/currentDate.d.ts +1 -0
- package/esm/typings/src/utils/deepClone.d.ts +2 -1
- package/esm/typings/src/utils/deepFreeze.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +2 -0
- package/esm/typings/src/utils/expectation-counters/countLines.d.ts +2 -0
- package/esm/typings/src/utils/expectation-counters/countPages.d.ts +2 -0
- package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +2 -0
- package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +4 -0
- package/esm/typings/src/utils/expectation-counters/countWords.d.ts +2 -0
- package/esm/typings/src/utils/expectation-counters/index.d.ts +2 -0
- package/esm/typings/src/utils/extractParameterNames.d.ts +1 -0
- package/esm/typings/src/utils/isRunningInWhatever.d.ts +6 -3
- package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +4 -1
- package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/esm/typings/src/utils/markdown/createMarkdownTable.d.ts +4 -1
- package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +5 -0
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +2 -1
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -0
- package/esm/typings/src/utils/markdown/flattenMarkdown.d.ts +3 -0
- package/esm/typings/src/utils/markdown/parseMarkdownSection.d.ts +4 -0
- package/esm/typings/src/utils/markdown/removeContentComments.d.ts +1 -0
- package/esm/typings/src/utils/markdown/removeMarkdownFormatting.d.ts +1 -0
- package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +3 -0
- package/esm/typings/src/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +2 -0
- package/esm/typings/src/utils/normalization/IKeywords.d.ts +3 -0
- package/esm/typings/src/utils/normalization/capitalize.d.ts +1 -0
- package/esm/typings/src/utils/normalization/decapitalize.d.ts +1 -0
- package/esm/typings/src/utils/normalization/isValidKeyword.d.ts +2 -0
- package/esm/typings/src/utils/normalization/nameToUriPart.d.ts +8 -0
- package/esm/typings/src/utils/normalization/nameToUriParts.d.ts +8 -0
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +10 -0
- package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +9 -0
- package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +10 -0
- package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +11 -0
- package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +9 -0
- package/esm/typings/src/utils/normalization/parseKeywords.d.ts +1 -0
- package/esm/typings/src/utils/normalization/parseKeywordsFromString.d.ts +1 -0
- package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +7 -0
- package/esm/typings/src/utils/normalization/searchKeywords.d.ts +5 -0
- package/esm/typings/src/utils/parseNumber.d.ts +2 -1
- package/esm/typings/src/utils/random/randomSeed.d.ts +1 -0
- package/esm/typings/src/utils/removeEmojis.d.ts +1 -0
- package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
- package/esm/typings/src/utils/replaceParameters.d.ts +1 -0
- package/esm/typings/src/utils/sets/difference.d.ts +1 -0
- package/esm/typings/src/utils/sets/intersection.d.ts +1 -0
- package/esm/typings/src/utils/sets/union.d.ts +1 -0
- package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
- package/esm/typings/src/utils/trimEndOfCodeBlock.d.ts +2 -0
- package/esm/typings/src/utils/unwrapResult.d.ts +1 -0
- package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +1 -0
- package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +7 -0
- package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +2 -0
- package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +2 -0
- package/esm/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +2 -0
- package/esm/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -0
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +2 -0
- package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
- package/package.json +1 -1
- package/umd/index.umd.js +556 -43
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/src/_packages/anthropic-claude.index.d.ts +3 -2
- package/umd/typings/src/_packages/azure-openai.index.d.ts +4 -2
- package/umd/typings/src/_packages/browser.index.d.ts +6 -0
- package/umd/typings/src/_packages/cli.index.d.ts +1 -7
- package/umd/typings/src/_packages/core.index.d.ts +87 -13
- package/umd/typings/src/_packages/execute-javascript.index.d.ts +5 -45
- package/umd/typings/src/_packages/fake-llm.index.d.ts +4 -5
- package/umd/typings/src/_packages/langtail.index.d.ts +4 -2
- package/umd/typings/src/_packages/markdown-utils.index.d.ts +23 -4
- package/umd/typings/src/_packages/node.index.d.ts +5 -2
- package/umd/typings/src/_packages/openai.index.d.ts +5 -2
- package/umd/typings/src/_packages/remote-client.index.d.ts +5 -2
- package/umd/typings/src/_packages/remote-server.index.d.ts +4 -2
- package/umd/typings/src/_packages/types.index.d.ts +441 -21
- package/umd/typings/src/_packages/utils.index.d.ts +84 -31
- package/umd/typings/src/cli/main.d.ts +12 -0
- package/umd/typings/src/collection/collectionToJson.d.ts +2 -0
- package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
- package/umd/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -0
- package/umd/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -0
- package/umd/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
- package/umd/typings/src/collection/constructors/createSubcollection.d.ts +1 -0
- package/umd/typings/src/commands/BLOCK/BlockTypes.d.ts +2 -0
- package/umd/typings/src/config.d.ts +27 -1
- package/umd/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
- package/umd/typings/src/conversion/pipelineStringToJson.d.ts +6 -3
- package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +4 -3
- package/umd/typings/src/conversion/prettify/prettifyPipelineString.d.ts +2 -0
- package/umd/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +2 -0
- package/umd/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.d.ts +1 -0
- package/umd/typings/src/conversion/utils/extractVariables.d.ts +1 -0
- package/umd/typings/src/conversion/utils/renameParameter.d.ts +1 -0
- package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +2 -0
- package/umd/typings/src/conversion/utils/titleToName.d.ts +6 -1
- package/umd/typings/src/conversion/validation/validatePipeline.d.ts +1 -0
- package/umd/typings/src/errors/CollectionError.d.ts +2 -0
- package/umd/typings/src/errors/EnvironmentMismatchError.d.ts +2 -0
- package/umd/typings/src/errors/LimitReachedError.d.ts +2 -0
- package/umd/typings/src/errors/NotFoundError.d.ts +2 -0
- package/umd/typings/src/errors/NotYetImplementedError.d.ts +2 -0
- package/umd/typings/src/errors/ParsingError.d.ts +2 -0
- package/umd/typings/src/errors/PipelineExecutionError.d.ts +2 -0
- package/umd/typings/src/errors/PipelineLogicError.d.ts +2 -0
- package/umd/typings/src/errors/ReferenceError.d.ts +2 -0
- package/umd/typings/src/errors/UnexpectedError.d.ts +2 -0
- package/umd/typings/src/errors/VersionMismatchError.d.ts +2 -0
- package/umd/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -0
- package/umd/typings/src/execution/createPipelineExecutor.d.ts +1 -0
- package/umd/typings/src/execution/embeddingVectorToString.d.ts +2 -0
- package/umd/typings/src/execution/utils/addUsage.d.ts +3 -1
- package/umd/typings/src/execution/utils/checkExpectations.d.ts +2 -0
- package/umd/typings/src/execution/utils/forEachAsync.d.ts +1 -0
- package/umd/typings/src/execution/utils/usageToHuman.d.ts +2 -0
- package/umd/typings/src/execution/utils/usageToWorktime.d.ts +2 -0
- package/umd/typings/src/formats/_common/FormatDefinition.d.ts +2 -1
- package/umd/typings/src/formats/json/utils/isValidJsonString.d.ts +2 -0
- package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceTools.d.ts +2 -0
- package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +2 -0
- package/umd/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -1
- package/umd/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +10 -0
- package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +2 -0
- package/umd/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +4 -1
- package/umd/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +1 -1
- package/umd/typings/src/llm-providers/_common/utils/count-total-usage/countTotalUsage.d.ts +1 -1
- package/umd/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +2 -1
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -0
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -1
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +2 -0
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +1 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +2 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +2 -0
- package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -0
- package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +2 -0
- package/umd/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +2 -0
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -0
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +2 -0
- package/umd/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
- package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +2 -0
- package/umd/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +7 -1
- package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
- package/umd/typings/src/personas/preparePersona.d.ts +1 -1
- package/umd/typings/src/postprocessing/utils/extractBlock.d.ts +5 -0
- package/umd/typings/src/prepare/isPipelinePrepared.d.ts +2 -1
- package/umd/typings/src/prepare/preparePipeline.d.ts +1 -1
- package/umd/typings/src/prepare/prepareTemplates.d.ts +2 -1
- package/umd/typings/src/prepare/unpreparePipeline.d.ts +2 -1
- package/umd/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +2 -0
- package/umd/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +1 -0
- package/umd/typings/src/scripting/javascript/postprocessing-functions.d.ts +51 -0
- package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +0 -1
- package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +2 -1
- package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +0 -3
- package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
- package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
- package/umd/typings/src/storage/memory/MemoryStorage.d.ts +2 -3
- package/umd/typings/src/storage/utils/PrefixStorage.d.ts +2 -3
- package/umd/typings/src/types/ModelRequirements.d.ts +0 -1
- package/umd/typings/src/types/Prompt.d.ts +0 -1
- package/umd/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +4 -0
- package/umd/typings/src/types/execution-report/executionReportJsonToString.d.ts +2 -0
- package/umd/typings/src/types/typeAliases.d.ts +9 -2
- package/umd/typings/src/utils/currentDate.d.ts +1 -0
- package/umd/typings/src/utils/deepClone.d.ts +2 -1
- package/umd/typings/src/utils/deepFreeze.d.ts +1 -1
- package/umd/typings/src/utils/expectation-counters/countCharacters.d.ts +2 -0
- package/umd/typings/src/utils/expectation-counters/countLines.d.ts +2 -0
- package/umd/typings/src/utils/expectation-counters/countPages.d.ts +2 -0
- package/umd/typings/src/utils/expectation-counters/countParagraphs.d.ts +2 -0
- package/umd/typings/src/utils/expectation-counters/countSentences.d.ts +4 -0
- package/umd/typings/src/utils/expectation-counters/countWords.d.ts +2 -0
- package/umd/typings/src/utils/expectation-counters/index.d.ts +2 -0
- package/umd/typings/src/utils/extractParameterNames.d.ts +1 -0
- package/umd/typings/src/utils/isRunningInWhatever.d.ts +6 -3
- package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +4 -1
- package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +4 -1
- package/umd/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +5 -0
- package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
- package/umd/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +2 -1
- package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -0
- package/umd/typings/src/utils/markdown/flattenMarkdown.d.ts +3 -0
- package/umd/typings/src/utils/markdown/parseMarkdownSection.d.ts +4 -0
- package/umd/typings/src/utils/markdown/removeContentComments.d.ts +1 -0
- package/umd/typings/src/utils/markdown/removeMarkdownFormatting.d.ts +1 -0
- package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +3 -0
- package/umd/typings/src/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +2 -0
- package/umd/typings/src/utils/normalization/IKeywords.d.ts +3 -0
- package/umd/typings/src/utils/normalization/capitalize.d.ts +1 -0
- package/umd/typings/src/utils/normalization/decapitalize.d.ts +1 -0
- package/umd/typings/src/utils/normalization/isValidKeyword.d.ts +2 -0
- package/umd/typings/src/utils/normalization/nameToUriPart.d.ts +8 -0
- package/umd/typings/src/utils/normalization/nameToUriParts.d.ts +8 -0
- package/umd/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +10 -0
- package/umd/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +9 -0
- package/umd/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +10 -0
- package/umd/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +11 -0
- package/umd/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +9 -0
- package/umd/typings/src/utils/normalization/parseKeywords.d.ts +1 -0
- package/umd/typings/src/utils/normalization/parseKeywordsFromString.d.ts +1 -0
- package/umd/typings/src/utils/normalization/removeDiacritics.d.ts +7 -0
- package/umd/typings/src/utils/normalization/searchKeywords.d.ts +5 -0
- package/umd/typings/src/utils/parseNumber.d.ts +2 -1
- package/umd/typings/src/utils/random/randomSeed.d.ts +1 -0
- package/umd/typings/src/utils/removeEmojis.d.ts +1 -0
- package/umd/typings/src/utils/removeQuotes.d.ts +1 -0
- package/umd/typings/src/utils/replaceParameters.d.ts +1 -0
- package/umd/typings/src/utils/sets/difference.d.ts +1 -0
- package/umd/typings/src/utils/sets/intersection.d.ts +1 -0
- package/umd/typings/src/utils/sets/union.d.ts +1 -0
- package/umd/typings/src/utils/trimCodeBlock.d.ts +1 -0
- package/umd/typings/src/utils/trimEndOfCodeBlock.d.ts +2 -0
- package/umd/typings/src/utils/unwrapResult.d.ts +1 -0
- package/umd/typings/src/utils/validators/filePath/isValidFilePath.d.ts +1 -0
- package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +7 -0
- package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +2 -0
- package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +2 -0
- package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +2 -0
- package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +1 -0
- package/umd/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -0
- package/umd/typings/src/utils/validators/url/isValidUrl.d.ts +2 -0
- package/umd/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
package/esm/index.es.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
2
2
|
import { format } from 'prettier';
|
|
3
3
|
import parserHtml from 'prettier/parser-html';
|
|
4
|
+
import hexEncoder from 'crypto-js/enc-hex';
|
|
5
|
+
import sha256 from 'crypto-js/sha256';
|
|
4
6
|
import moment from 'moment';
|
|
5
7
|
|
|
8
|
+
/**
|
|
9
|
+
* The version of the Promptbook library
|
|
10
|
+
*/
|
|
11
|
+
var PROMPTBOOK_VERSION = '0.63.0-0';
|
|
12
|
+
// TODO: !!!! List here all the versions and annotate + put into script
|
|
13
|
+
|
|
6
14
|
/*! *****************************************************************************
|
|
7
15
|
Copyright (c) Microsoft Corporation.
|
|
8
16
|
|
|
@@ -126,6 +134,8 @@ function __spreadArray(to, from, pack) {
|
|
|
126
134
|
* Converts PipelineCollection to serialized JSON
|
|
127
135
|
*
|
|
128
136
|
* Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
|
|
137
|
+
*
|
|
138
|
+
* @public exported from `@promptbook/core`
|
|
129
139
|
*/
|
|
130
140
|
function collectionToJson(collection) {
|
|
131
141
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -184,6 +194,7 @@ function prettifyMarkdown(content) {
|
|
|
184
194
|
/**
|
|
185
195
|
* Makes first letter of a string uppercase
|
|
186
196
|
*
|
|
197
|
+
* @public exported from `@promptbook/utils`
|
|
187
198
|
*/
|
|
188
199
|
function capitalize(word) {
|
|
189
200
|
return word.substring(0, 1).toUpperCase() + word.substring(1);
|
|
@@ -194,6 +205,7 @@ function capitalize(word) {
|
|
|
194
205
|
*
|
|
195
206
|
* @param pipelineJson Promptbook in JSON format (.ptbk.json)
|
|
196
207
|
* @returns Promptbook in string format (.ptbk.md)
|
|
208
|
+
* @public exported from `@promptbook/core`
|
|
197
209
|
*/
|
|
198
210
|
function pipelineJsonToString(pipelineJson) {
|
|
199
211
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
|
|
@@ -424,6 +436,7 @@ function deepFreeze(objectValue) {
|
|
|
424
436
|
* @@@
|
|
425
437
|
*
|
|
426
438
|
* @returns The same object as the input, but deeply frozen
|
|
439
|
+
* @public exported from `@promptbook/utils`
|
|
427
440
|
*
|
|
428
441
|
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
429
442
|
*/
|
|
@@ -431,7 +444,6 @@ function deepFreezeWithSameType(objectValue) {
|
|
|
431
444
|
return deepFreeze(objectValue);
|
|
432
445
|
}
|
|
433
446
|
/**
|
|
434
|
-
* TODO: [🔼] Export from `@promptbook/utils`
|
|
435
447
|
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
436
448
|
*/
|
|
437
449
|
|
|
@@ -457,22 +469,62 @@ function just(value) {
|
|
|
457
469
|
|
|
458
470
|
/**
|
|
459
471
|
* The maximum number of iterations for a loops
|
|
472
|
+
*
|
|
473
|
+
* @private within the repository - too low-level in comparison to other `MAX_...`
|
|
460
474
|
*/
|
|
461
475
|
var LOOP_LIMIT = 1000;
|
|
462
476
|
/**
|
|
463
477
|
* The maximum number of (LLM) tasks running in parallel
|
|
478
|
+
*
|
|
479
|
+
* @public exported from `@promptbook/core`
|
|
464
480
|
*/
|
|
465
481
|
var MAX_PARALLEL_COUNT = 5;
|
|
466
482
|
/**
|
|
467
483
|
* The maximum number of attempts to execute LLM task before giving up
|
|
484
|
+
*
|
|
485
|
+
* @public exported from `@promptbook/core`
|
|
468
486
|
*/
|
|
469
487
|
var MAX_EXECUTION_ATTEMPTS = 3;
|
|
488
|
+
/**
|
|
489
|
+
* The maximum length of the (generated) filename
|
|
490
|
+
*
|
|
491
|
+
* @public exported from `@promptbook/core`
|
|
492
|
+
*/
|
|
493
|
+
var MAX_FILENAME_LENGTH = 30;
|
|
494
|
+
/**
|
|
495
|
+
* @@@
|
|
496
|
+
* TODO: [🐝] !!! Use
|
|
497
|
+
*
|
|
498
|
+
* @public exported from `@promptbook/core`
|
|
499
|
+
*/
|
|
500
|
+
var MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3;
|
|
501
|
+
/**
|
|
502
|
+
* @@@
|
|
503
|
+
* TODO: [🐝] !!! Use
|
|
504
|
+
*
|
|
505
|
+
* @public exported from `@promptbook/core`
|
|
506
|
+
*/
|
|
507
|
+
var MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200;
|
|
508
|
+
/**
|
|
509
|
+
* Where to store the cache of executions for promptbook CLI
|
|
510
|
+
*
|
|
511
|
+
* @public exported from `@promptbook/core`
|
|
512
|
+
*/
|
|
513
|
+
var EXECUTIONS_CACHE_DIRNAME = '/.promptbook/executions-cache';
|
|
514
|
+
/**
|
|
515
|
+
* The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`
|
|
516
|
+
*
|
|
517
|
+
* @public exported from `@promptbook/core`
|
|
518
|
+
*/
|
|
519
|
+
var PIPELINE_COLLECTION_BASE_FILENAME = "index";
|
|
470
520
|
/**
|
|
471
521
|
* Nonce which is used for replacing things in strings
|
|
472
522
|
*/
|
|
473
523
|
var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
|
|
474
524
|
/**
|
|
475
525
|
* The names of the parameters that are reserved for special purposes
|
|
526
|
+
*
|
|
527
|
+
* @public exported from `@promptbook/core`
|
|
476
528
|
*/
|
|
477
529
|
var RESERVED_PARAMETER_NAMES = deepFreeze([
|
|
478
530
|
'content',
|
|
@@ -486,10 +538,14 @@ var RESERVED_PARAMETER_NAMES = deepFreeze([
|
|
|
486
538
|
]);
|
|
487
539
|
/**
|
|
488
540
|
* @@@
|
|
541
|
+
*
|
|
542
|
+
* @private within the repository
|
|
489
543
|
*/
|
|
490
544
|
var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
491
545
|
/**
|
|
492
546
|
* @@@
|
|
547
|
+
*
|
|
548
|
+
* @private within the repository
|
|
493
549
|
*/
|
|
494
550
|
var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
|
|
495
551
|
/*
|
|
@@ -497,11 +553,13 @@ TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
|
|
|
497
553
|
*/
|
|
498
554
|
// [🟡][🟢][🔵][⚪]
|
|
499
555
|
/**
|
|
500
|
-
* TODO:
|
|
556
|
+
* TODO: !!!!!! Check that all @private contains some normalized explanation
|
|
501
557
|
*/
|
|
502
558
|
|
|
503
559
|
/**
|
|
504
560
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
561
|
+
*
|
|
562
|
+
* @public exported from `@promptbook/core`
|
|
505
563
|
*/
|
|
506
564
|
var ParsingError = /** @class */ (function (_super) {
|
|
507
565
|
__extends(ParsingError, _super);
|
|
@@ -516,6 +574,8 @@ var ParsingError = /** @class */ (function (_super) {
|
|
|
516
574
|
|
|
517
575
|
/**
|
|
518
576
|
* This error indicates that the promptbook object has valid syntax but contains logical errors (like circular dependencies)
|
|
577
|
+
*
|
|
578
|
+
* @public exported from `@promptbook/core`
|
|
519
579
|
*/
|
|
520
580
|
var PipelineLogicError = /** @class */ (function (_super) {
|
|
521
581
|
__extends(PipelineLogicError, _super);
|
|
@@ -530,6 +590,8 @@ var PipelineLogicError = /** @class */ (function (_super) {
|
|
|
530
590
|
|
|
531
591
|
/**
|
|
532
592
|
* This error type indicates that the error should not happen and its last check before crashing with some other error
|
|
593
|
+
*
|
|
594
|
+
* @public exported from `@promptbook/core`
|
|
533
595
|
*/
|
|
534
596
|
var UnexpectedError = /** @class */ (function (_super) {
|
|
535
597
|
__extends(UnexpectedError, _super);
|
|
@@ -548,6 +610,8 @@ var UnexpectedError = /** @class */ (function (_super) {
|
|
|
548
610
|
* Note: There are two simmilar functions:
|
|
549
611
|
* - `isValidSemanticVersion` which tests any semantic version
|
|
550
612
|
* - `isValidPromptbookVersion` *(this one)* which tests just Promptbook versions
|
|
613
|
+
*
|
|
614
|
+
* @public exported from `@promptbook/utils`
|
|
551
615
|
*/
|
|
552
616
|
function isValidSemanticVersion(version) {
|
|
553
617
|
if (typeof version !== 'string') {
|
|
@@ -568,6 +632,8 @@ function isValidSemanticVersion(version) {
|
|
|
568
632
|
* Note: There are two simmilar functions:
|
|
569
633
|
* - `isValidSemanticVersion` which tests any semantic version
|
|
570
634
|
* - `isValidPromptbookVersion` *(this one)* which tests just Promptbook versions
|
|
635
|
+
*
|
|
636
|
+
* @public exported from `@promptbook/utils`
|
|
571
637
|
*/
|
|
572
638
|
function isValidPromptbookVersion(version) {
|
|
573
639
|
if (!isValidSemanticVersion(version)) {
|
|
@@ -586,6 +652,8 @@ function isValidPromptbookVersion(version) {
|
|
|
586
652
|
* Note: There are two simmilar functions:
|
|
587
653
|
* - `isUrlOnPrivateNetwork` which tests full URL
|
|
588
654
|
* - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
|
|
655
|
+
*
|
|
656
|
+
* @public exported from `@promptbook/utils`
|
|
589
657
|
*/
|
|
590
658
|
function isHostnameOnPrivateNetwork(hostname) {
|
|
591
659
|
if (hostname === 'example.com' ||
|
|
@@ -620,6 +688,7 @@ function isHostnameOnPrivateNetwork(hostname) {
|
|
|
620
688
|
*
|
|
621
689
|
* @param {string} ipAddress - The IP address to check.
|
|
622
690
|
* @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
|
|
691
|
+
* @public exported from `@promptbook/utils`
|
|
623
692
|
*/
|
|
624
693
|
function isUrlOnPrivateNetwork(url) {
|
|
625
694
|
if (typeof url === 'string') {
|
|
@@ -635,6 +704,8 @@ function isUrlOnPrivateNetwork(url) {
|
|
|
635
704
|
* Note: There are two simmilar functions:
|
|
636
705
|
* - `isValidUrl` which tests any URL
|
|
637
706
|
* - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
|
|
707
|
+
*
|
|
708
|
+
* @public exported from `@promptbook/utils`
|
|
638
709
|
*/
|
|
639
710
|
function isValidUrl(url) {
|
|
640
711
|
if (typeof url !== 'string') {
|
|
@@ -661,6 +732,8 @@ function isValidUrl(url) {
|
|
|
661
732
|
* Note: There are two simmilar functions:
|
|
662
733
|
* - `isValidUrl` which tests any URL
|
|
663
734
|
* - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
|
|
735
|
+
*
|
|
736
|
+
* @public exported from `@promptbook/utils`
|
|
664
737
|
*/
|
|
665
738
|
function isValidPipelineUrl(url) {
|
|
666
739
|
if (!isValidUrl(url)) {
|
|
@@ -698,6 +771,7 @@ function isValidPipelineUrl(url) {
|
|
|
698
771
|
* @param pipeline valid or invalid PipelineJson
|
|
699
772
|
* @returns the same pipeline if it is logically valid
|
|
700
773
|
* @throws {PipelineLogicError} on logical error in the pipeline
|
|
774
|
+
* @public exported from `@promptbook/core`
|
|
701
775
|
*/
|
|
702
776
|
function validatePipeline(pipeline) {
|
|
703
777
|
// TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
|
|
@@ -927,6 +1001,8 @@ function validatePipeline(pipeline) {
|
|
|
927
1001
|
|
|
928
1002
|
/**
|
|
929
1003
|
* This error indicates that promptbook not found in the collection
|
|
1004
|
+
*
|
|
1005
|
+
* @public exported from `@promptbook/core`
|
|
930
1006
|
*/
|
|
931
1007
|
var NotFoundError = /** @class */ (function (_super) {
|
|
932
1008
|
__extends(NotFoundError, _super);
|
|
@@ -941,6 +1017,8 @@ var NotFoundError = /** @class */ (function (_super) {
|
|
|
941
1017
|
|
|
942
1018
|
/**
|
|
943
1019
|
* This error indicates errors in referencing promptbooks between each other
|
|
1020
|
+
*
|
|
1021
|
+
* @public exported from `@promptbook/core`
|
|
944
1022
|
*/
|
|
945
1023
|
var ReferenceError$1 = /** @class */ (function (_super) {
|
|
946
1024
|
__extends(ReferenceError, _super);
|
|
@@ -958,6 +1036,7 @@ var ReferenceError$1 = /** @class */ (function (_super) {
|
|
|
958
1036
|
*
|
|
959
1037
|
* @param template the template with parameters in {curly} braces
|
|
960
1038
|
* @returns the list of parameter names
|
|
1039
|
+
* @public exported from `@promptbook/utils`
|
|
961
1040
|
*/
|
|
962
1041
|
function extractParameterNames(template) {
|
|
963
1042
|
var e_1, _a;
|
|
@@ -982,6 +1061,8 @@ function extractParameterNames(template) {
|
|
|
982
1061
|
|
|
983
1062
|
/**
|
|
984
1063
|
* Unprepare just strips the preparation data of the pipeline
|
|
1064
|
+
*
|
|
1065
|
+
* @public exported from `@promptbook/core`
|
|
985
1066
|
*/
|
|
986
1067
|
function unpreparePipeline(pipeline) {
|
|
987
1068
|
var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, promptTemplates = pipeline.promptTemplates;
|
|
@@ -998,7 +1079,6 @@ function unpreparePipeline(pipeline) {
|
|
|
998
1079
|
return __assign(__assign({}, pipeline), { promptTemplates: promptTemplates, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] });
|
|
999
1080
|
}
|
|
1000
1081
|
/**
|
|
1001
|
-
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
1002
1082
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
1003
1083
|
* TODO: Write tests for `preparePipeline`
|
|
1004
1084
|
* TODO: [🍙] Make some standart order of json properties
|
|
@@ -1100,6 +1180,7 @@ var SimplePipelineCollection = /** @class */ (function () {
|
|
|
1100
1180
|
*
|
|
1101
1181
|
* @param promptbookSources
|
|
1102
1182
|
* @returns PipelineCollection
|
|
1183
|
+
* @public exported from `@promptbook/core`
|
|
1103
1184
|
*/
|
|
1104
1185
|
function createCollectionFromJson() {
|
|
1105
1186
|
var promptbooks = [];
|
|
@@ -1127,6 +1208,7 @@ function createCollectionFromJson() {
|
|
|
1127
1208
|
* @param promptbookSourcesPromiseOrFactory
|
|
1128
1209
|
* @returns PipelineCollection
|
|
1129
1210
|
* @deprecated Do not use, it will became internal tool for other constructor functions
|
|
1211
|
+
* @public exported from `@promptbook/core`
|
|
1130
1212
|
*/
|
|
1131
1213
|
function createCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
|
|
1132
1214
|
var collection = null;
|
|
@@ -1197,8 +1279,8 @@ function createCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
|
|
|
1197
1279
|
|
|
1198
1280
|
/**
|
|
1199
1281
|
* Constructs Promptbook from remote Promptbase URL
|
|
1200
|
-
|
|
1201
1282
|
* @returns PipelineCollection
|
|
1283
|
+
* @public exported from `@promptbook/core`
|
|
1202
1284
|
*/
|
|
1203
1285
|
function createCollectionFromUrl(url, options) {
|
|
1204
1286
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1238,6 +1320,7 @@ function createCollectionFromUrl(url, options) {
|
|
|
1238
1320
|
*
|
|
1239
1321
|
* @param promptbookSources
|
|
1240
1322
|
* @returns PipelineCollection
|
|
1323
|
+
* @public exported from `@promptbook/core`
|
|
1241
1324
|
*/
|
|
1242
1325
|
function createSubcollection(collection, predicate) {
|
|
1243
1326
|
function listPipelines() {
|
|
@@ -1313,6 +1396,7 @@ function createSubcollection(collection, predicate) {
|
|
|
1313
1396
|
* Block type describes the way how the block is blockd
|
|
1314
1397
|
*
|
|
1315
1398
|
* @see https://github.com/webgptorg/promptbook#block-type
|
|
1399
|
+
* @public exported from `@promptbook/core`
|
|
1316
1400
|
*/
|
|
1317
1401
|
var BlockTypes = [
|
|
1318
1402
|
'PROMPT_TEMPLATE',
|
|
@@ -1328,6 +1412,8 @@ var BlockTypes = [
|
|
|
1328
1412
|
|
|
1329
1413
|
/**
|
|
1330
1414
|
* @@@
|
|
1415
|
+
*
|
|
1416
|
+
* @public exported from `@promptbook/utils`
|
|
1331
1417
|
*/
|
|
1332
1418
|
function deepClone(objectValue) {
|
|
1333
1419
|
return JSON.parse(JSON.stringify(objectValue));
|
|
@@ -1344,14 +1430,13 @@ function deepClone(objectValue) {
|
|
|
1344
1430
|
*/
|
|
1345
1431
|
}
|
|
1346
1432
|
/**
|
|
1347
|
-
* TODO: [🔼] Export from `@promptbook/utils`
|
|
1348
1433
|
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1349
1434
|
*/
|
|
1350
1435
|
|
|
1351
1436
|
/**
|
|
1352
1437
|
* @@@
|
|
1353
1438
|
*
|
|
1354
|
-
*
|
|
1439
|
+
* @public exported from `@promptbook/core`
|
|
1355
1440
|
*/
|
|
1356
1441
|
var ZERO_USAGE = deepFreeze({
|
|
1357
1442
|
price: { value: 0 },
|
|
@@ -1378,6 +1463,8 @@ var ZERO_USAGE = deepFreeze({
|
|
|
1378
1463
|
* Function `addUsage` will add multiple usages into one
|
|
1379
1464
|
*
|
|
1380
1465
|
* Note: If you provide 0 values, it returns ZERO_USAGE
|
|
1466
|
+
*
|
|
1467
|
+
* @public exported from `@promptbook/core`
|
|
1381
1468
|
*/
|
|
1382
1469
|
function addUsage() {
|
|
1383
1470
|
var usageItems = [];
|
|
@@ -1450,6 +1537,7 @@ function addUsage() {
|
|
|
1450
1537
|
* @param array - Array to iterate over
|
|
1451
1538
|
* @param options - Options for the function
|
|
1452
1539
|
* @param callbackfunction - Function to call for each item
|
|
1540
|
+
* @public exported from `@promptbook/utils`
|
|
1453
1541
|
*/
|
|
1454
1542
|
function forEachAsync(array, options, callbackfunction) {
|
|
1455
1543
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1518,7 +1606,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
1518
1606
|
});
|
|
1519
1607
|
}
|
|
1520
1608
|
|
|
1521
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.
|
|
1609
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.63.0-0",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.0-0",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.63.0-0",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.0-0",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.63.0-0",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.0-0",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.63.0-0",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Option `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.0-0",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
1522
1610
|
|
|
1523
1611
|
var defaultDiacriticsRemovalMap = [
|
|
1524
1612
|
{
|
|
@@ -1736,6 +1824,8 @@ var defaultDiacriticsRemovalMap = [
|
|
|
1736
1824
|
* > "ě" => "e"
|
|
1737
1825
|
* > "Ă" => "A"
|
|
1738
1826
|
* > ...
|
|
1827
|
+
*
|
|
1828
|
+
* @public exported from `@promptbook/utils`
|
|
1739
1829
|
*/
|
|
1740
1830
|
var DIACRITIC_VARIANTS_LETTERS = {};
|
|
1741
1831
|
// tslint:disable-next-line: prefer-for-of
|
|
@@ -1763,7 +1853,11 @@ for (var i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
|
1763
1853
|
*/
|
|
1764
1854
|
|
|
1765
1855
|
/**
|
|
1856
|
+
* @@@
|
|
1766
1857
|
*
|
|
1858
|
+
* @param input @@@
|
|
1859
|
+
* @returns @@@
|
|
1860
|
+
* @public exported from `@promptbook/utils`
|
|
1767
1861
|
*/
|
|
1768
1862
|
function removeDiacritics(input) {
|
|
1769
1863
|
/*eslint no-control-regex: "off"*/
|
|
@@ -1771,7 +1865,19 @@ function removeDiacritics(input) {
|
|
|
1771
1865
|
return DIACRITIC_VARIANTS_LETTERS[a] || a;
|
|
1772
1866
|
});
|
|
1773
1867
|
}
|
|
1868
|
+
/**
|
|
1869
|
+
* TODO: [Ж] Variant for cyrillic (and in general non-latin) letters
|
|
1870
|
+
*/
|
|
1774
1871
|
|
|
1872
|
+
/**
|
|
1873
|
+
* @@@
|
|
1874
|
+
*
|
|
1875
|
+
* @param text @@@
|
|
1876
|
+
* @returns @@@
|
|
1877
|
+
* @example 'hello-world'
|
|
1878
|
+
* @example 'i-love-promptbook'
|
|
1879
|
+
* @public exported from `@promptbook/utils`
|
|
1880
|
+
*/
|
|
1775
1881
|
function normalizeToKebabCase(text) {
|
|
1776
1882
|
var e_1, _a;
|
|
1777
1883
|
text = removeDiacritics(text);
|
|
@@ -1831,6 +1937,7 @@ function normalizeToKebabCase(text) {
|
|
|
1831
1937
|
*
|
|
1832
1938
|
* @param text with emojis
|
|
1833
1939
|
* @returns text without emojis
|
|
1940
|
+
* @public exported from `@promptbook/utils`
|
|
1834
1941
|
*/
|
|
1835
1942
|
function removeEmojis(text) {
|
|
1836
1943
|
// Replace emojis (and also ZWJ sequence) with hyphens
|
|
@@ -1842,7 +1949,12 @@ function removeEmojis(text) {
|
|
|
1842
1949
|
}
|
|
1843
1950
|
|
|
1844
1951
|
/**
|
|
1845
|
-
*
|
|
1952
|
+
* @@@
|
|
1953
|
+
*
|
|
1954
|
+
* @param value @@@
|
|
1955
|
+
* @returns @@@
|
|
1956
|
+
* @example @@@
|
|
1957
|
+
* @public exported from `@promptbook/utils`
|
|
1846
1958
|
*/
|
|
1847
1959
|
function titleToName(value) {
|
|
1848
1960
|
if (value.startsWith('http://') || value.startsWith('https://')) {
|
|
@@ -1861,6 +1973,8 @@ function titleToName(value) {
|
|
|
1861
1973
|
|
|
1862
1974
|
/**
|
|
1863
1975
|
* This error indicates errors during the execution of the pipeline
|
|
1976
|
+
*
|
|
1977
|
+
* @public exported from `@promptbook/core`
|
|
1864
1978
|
*/
|
|
1865
1979
|
var PipelineExecutionError = /** @class */ (function (_super) {
|
|
1866
1980
|
__extends(PipelineExecutionError, _super);
|
|
@@ -1878,6 +1992,7 @@ var PipelineExecutionError = /** @class */ (function (_super) {
|
|
|
1878
1992
|
*
|
|
1879
1993
|
* @param executionResult - The partial result of the promptnook execution
|
|
1880
1994
|
* @throws {PipelineExecutionError} If the execution is not successful or if multiple errors occurred
|
|
1995
|
+
* @public exported from `@promptbook/core`
|
|
1881
1996
|
*/
|
|
1882
1997
|
function assertsExecutionSuccessful(executionResult) {
|
|
1883
1998
|
var isSuccessful = executionResult.isSuccessful, errors = executionResult.errors;
|
|
@@ -1908,6 +2023,7 @@ function assertsExecutionSuccessful(executionResult) {
|
|
|
1908
2023
|
* @param script from which to extract the variables
|
|
1909
2024
|
* @returns the list of variable names
|
|
1910
2025
|
* @throws {ParsingError} if the script is invalid
|
|
2026
|
+
* @public exported from `@promptbook/utils`
|
|
1911
2027
|
*/
|
|
1912
2028
|
function extractVariables(script) {
|
|
1913
2029
|
var variables = new Set();
|
|
@@ -1956,6 +2072,7 @@ function extractVariables(script) {
|
|
|
1956
2072
|
* @param promptTemplate the template with used parameters
|
|
1957
2073
|
* @returns the set of parameter names
|
|
1958
2074
|
* @throws {ParsingError} if the script is invalid
|
|
2075
|
+
* @public exported from `@promptbook/utils`
|
|
1959
2076
|
*/
|
|
1960
2077
|
function extractParameterNamesFromPromptTemplate(promptTemplate) {
|
|
1961
2078
|
var e_1, _a, e_2, _b, e_3, _c;
|
|
@@ -2029,6 +2146,8 @@ var ExpectError = /** @class */ (function (_super) {
|
|
|
2029
2146
|
|
|
2030
2147
|
/**
|
|
2031
2148
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
2149
|
+
*
|
|
2150
|
+
* @public exported from `@promptbook/utils`
|
|
2032
2151
|
*/
|
|
2033
2152
|
function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
2034
2153
|
try {
|
|
@@ -2255,6 +2374,8 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
|
2255
2374
|
*
|
|
2256
2375
|
*
|
|
2257
2376
|
* Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`
|
|
2377
|
+
*
|
|
2378
|
+
* @public exported from `@promptbook/core`
|
|
2258
2379
|
*/
|
|
2259
2380
|
function joinLlmExecutionTools() {
|
|
2260
2381
|
var llmExecutionTools = [];
|
|
@@ -2294,6 +2415,8 @@ function joinLlmExecutionTools() {
|
|
|
2294
2415
|
|
|
2295
2416
|
/**
|
|
2296
2417
|
* Determine if the pipeline is fully prepared
|
|
2418
|
+
*
|
|
2419
|
+
* @public exported from `@promptbook/core`
|
|
2297
2420
|
*/
|
|
2298
2421
|
function isPipelinePrepared(pipeline) {
|
|
2299
2422
|
// Note: Ignoring `pipeline.preparations` @@@
|
|
@@ -2314,7 +2437,6 @@ function isPipelinePrepared(pipeline) {
|
|
|
2314
2437
|
}
|
|
2315
2438
|
/**
|
|
2316
2439
|
* TODO: [🐠] Maybe base this on `makeValidator`
|
|
2317
|
-
* TODO: [🔼] Export via core or utils
|
|
2318
2440
|
* TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
|
|
2319
2441
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
2320
2442
|
* - [🏍] ? Is context in each template
|
|
@@ -2360,6 +2482,8 @@ function TODO_USE() {
|
|
|
2360
2482
|
|
|
2361
2483
|
/**
|
|
2362
2484
|
* This error type indicates that some limit was reached
|
|
2485
|
+
*
|
|
2486
|
+
* @public exported from `@promptbook/core`
|
|
2363
2487
|
*/
|
|
2364
2488
|
var LimitReachedError = /** @class */ (function (_super) {
|
|
2365
2489
|
__extends(LimitReachedError, _super);
|
|
@@ -2379,6 +2503,7 @@ var LimitReachedError = /** @class */ (function (_super) {
|
|
|
2379
2503
|
* @param parameters the object with parameters
|
|
2380
2504
|
* @returns the template with replaced parameters
|
|
2381
2505
|
* @throws {PipelineExecutionError} if parameter is not defined, not closed, or not opened
|
|
2506
|
+
* @public exported from `@promptbook/utils`
|
|
2382
2507
|
*/
|
|
2383
2508
|
function replaceParameters(template, parameters) {
|
|
2384
2509
|
var e_1, _a;
|
|
@@ -2454,6 +2579,7 @@ function replaceParameters(template, parameters) {
|
|
|
2454
2579
|
* Create difference set of two sets.
|
|
2455
2580
|
*
|
|
2456
2581
|
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
2582
|
+
* @public exported from `@promptbook/utils`
|
|
2457
2583
|
*/
|
|
2458
2584
|
function difference(a, b, isEqual) {
|
|
2459
2585
|
var e_1, _a;
|
|
@@ -2487,6 +2613,7 @@ function difference(a, b, isEqual) {
|
|
|
2487
2613
|
* Creates a new set with all elements that are present in either set
|
|
2488
2614
|
*
|
|
2489
2615
|
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
2616
|
+
* @public exported from `@promptbook/utils`
|
|
2490
2617
|
*/
|
|
2491
2618
|
function union() {
|
|
2492
2619
|
var e_1, _a, e_2, _b;
|
|
@@ -2523,14 +2650,10 @@ function union() {
|
|
|
2523
2650
|
return union;
|
|
2524
2651
|
}
|
|
2525
2652
|
|
|
2526
|
-
/**
|
|
2527
|
-
* The version of the Promptbook library
|
|
2528
|
-
*/
|
|
2529
|
-
var PROMPTBOOK_VERSION = '0.62.0';
|
|
2530
|
-
// TODO: !!!! List here all the versions and annotate + put into script
|
|
2531
|
-
|
|
2532
2653
|
/**
|
|
2533
2654
|
* Counts number of characters in the text
|
|
2655
|
+
*
|
|
2656
|
+
* @public exported from `@promptbook/utils`
|
|
2534
2657
|
*/
|
|
2535
2658
|
function countCharacters(text) {
|
|
2536
2659
|
// Remove null characters
|
|
@@ -2544,6 +2667,8 @@ function countCharacters(text) {
|
|
|
2544
2667
|
|
|
2545
2668
|
/**
|
|
2546
2669
|
* Counts number of lines in the text
|
|
2670
|
+
*
|
|
2671
|
+
* @public exported from `@promptbook/utils`
|
|
2547
2672
|
*/
|
|
2548
2673
|
function countLines(text) {
|
|
2549
2674
|
if (text === '') {
|
|
@@ -2554,6 +2679,8 @@ function countLines(text) {
|
|
|
2554
2679
|
|
|
2555
2680
|
/**
|
|
2556
2681
|
* Counts number of pages in the text
|
|
2682
|
+
*
|
|
2683
|
+
* @public exported from `@promptbook/utils`
|
|
2557
2684
|
*/
|
|
2558
2685
|
function countPages(text) {
|
|
2559
2686
|
var sentencesPerPage = 5; // Assuming each page has 5 sentences
|
|
@@ -2564,6 +2691,8 @@ function countPages(text) {
|
|
|
2564
2691
|
|
|
2565
2692
|
/**
|
|
2566
2693
|
* Counts number of paragraphs in the text
|
|
2694
|
+
*
|
|
2695
|
+
* @public exported from `@promptbook/utils`
|
|
2567
2696
|
*/
|
|
2568
2697
|
function countParagraphs(text) {
|
|
2569
2698
|
return text.split(/\n\s*\n/).filter(function (paragraph) { return paragraph.trim() !== ''; }).length;
|
|
@@ -2571,12 +2700,16 @@ function countParagraphs(text) {
|
|
|
2571
2700
|
|
|
2572
2701
|
/**
|
|
2573
2702
|
* Split text into sentences
|
|
2703
|
+
*
|
|
2704
|
+
* @public exported from `@promptbook/utils`
|
|
2574
2705
|
*/
|
|
2575
2706
|
function splitIntoSentences(text) {
|
|
2576
2707
|
return text.split(/[.!?]+/).filter(function (sentence) { return sentence.trim() !== ''; });
|
|
2577
2708
|
}
|
|
2578
2709
|
/**
|
|
2579
2710
|
* Counts number of sentences in the text
|
|
2711
|
+
*
|
|
2712
|
+
* @public exported from `@promptbook/utils`
|
|
2580
2713
|
*/
|
|
2581
2714
|
function countSentences(text) {
|
|
2582
2715
|
return splitIntoSentences(text).length;
|
|
@@ -2584,6 +2717,8 @@ function countSentences(text) {
|
|
|
2584
2717
|
|
|
2585
2718
|
/**
|
|
2586
2719
|
* Counts number of words in the text
|
|
2720
|
+
*
|
|
2721
|
+
* @public exported from `@promptbook/utils`
|
|
2587
2722
|
*/
|
|
2588
2723
|
function countWords(text) {
|
|
2589
2724
|
text = text.replace(/[\p{Extended_Pictographic}]/gu, 'a');
|
|
@@ -2593,6 +2728,8 @@ function countWords(text) {
|
|
|
2593
2728
|
|
|
2594
2729
|
/**
|
|
2595
2730
|
* Index of all counter functions
|
|
2731
|
+
*
|
|
2732
|
+
* @public exported from `@promptbook/utils`
|
|
2596
2733
|
*/
|
|
2597
2734
|
var CountUtils = {
|
|
2598
2735
|
CHARACTERS: countCharacters,
|
|
@@ -2612,6 +2749,7 @@ var CountUtils = {
|
|
|
2612
2749
|
*
|
|
2613
2750
|
* @throws {ExpectError} if the expectations are not met
|
|
2614
2751
|
* @returns {void} Nothing
|
|
2752
|
+
* @public exported from `@promptbook/core`
|
|
2615
2753
|
*/
|
|
2616
2754
|
function checkExpectations(expectations, value) {
|
|
2617
2755
|
var e_1, _a;
|
|
@@ -2643,6 +2781,7 @@ function checkExpectations(expectations, value) {
|
|
|
2643
2781
|
* - `isPassingExpectations` which returns a boolean
|
|
2644
2782
|
*
|
|
2645
2783
|
* @returns {boolean} True if the expectations are met
|
|
2784
|
+
* @public exported from `@promptbook/core`
|
|
2646
2785
|
*/
|
|
2647
2786
|
function isPassingExpectations(expectations, value) {
|
|
2648
2787
|
try {
|
|
@@ -2665,6 +2804,7 @@ function isPassingExpectations(expectations, value) {
|
|
|
2665
2804
|
*
|
|
2666
2805
|
* @returns The executor function
|
|
2667
2806
|
* @throws {PipelineLogicError} on logical error in the pipeline
|
|
2807
|
+
* @public exported from `@promptbook/core`
|
|
2668
2808
|
*/
|
|
2669
2809
|
function createPipelineExecutor(options) {
|
|
2670
2810
|
var _this = this;
|
|
@@ -3453,6 +3593,8 @@ function createPipelineExecutor(options) {
|
|
|
3453
3593
|
|
|
3454
3594
|
/**
|
|
3455
3595
|
* @@@
|
|
3596
|
+
*
|
|
3597
|
+
* @public exported from `@promptbook/core`
|
|
3456
3598
|
*/
|
|
3457
3599
|
function prepareKnowledgeFromMarkdown(knowledgeContent /* <- TODO: [🖖] (?maybe not) Always the file */, options) {
|
|
3458
3600
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -3588,6 +3730,7 @@ function prepareKnowledgeFromMarkdown(knowledgeContent /* <- TODO: [🖖] (?mayb
|
|
|
3588
3730
|
* Prepares the knowle
|
|
3589
3731
|
*
|
|
3590
3732
|
* @see https://github.com/webgptorg/promptbook/discussions/41
|
|
3733
|
+
* @public exported from `@promptbook/core`
|
|
3591
3734
|
*/
|
|
3592
3735
|
function prepareKnowledgePieces(knowledgeSources, options) {
|
|
3593
3736
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -3602,7 +3745,7 @@ function prepareKnowledgePieces(knowledgeSources, options) {
|
|
|
3602
3745
|
var partialPieces, pieces;
|
|
3603
3746
|
return __generator(this, function (_a) {
|
|
3604
3747
|
switch (_a.label) {
|
|
3605
|
-
case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.source, // <- TODO: [🐝] !!! Unhardcode markdown, detect which type it is
|
|
3748
|
+
case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.source, // <- TODO: [🐝] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
|
|
3606
3749
|
options)];
|
|
3607
3750
|
case 1:
|
|
3608
3751
|
partialPieces = _a.sent();
|
|
@@ -3640,7 +3783,6 @@ TODO: [🧊] This is how it can look in future
|
|
|
3640
3783
|
> ):
|
|
3641
3784
|
*/
|
|
3642
3785
|
/**
|
|
3643
|
-
* TODO: [🐝][🔼] !!! Export via `@promptbook/core`
|
|
3644
3786
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
3645
3787
|
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
3646
3788
|
* TODO: [🪂] More than max things can run in parallel by acident [1,[2a,2b,_],[3a,3b,_]]
|
|
@@ -3654,6 +3796,7 @@ TODO: [🧊] This is how it can look in future
|
|
|
3654
3796
|
*
|
|
3655
3797
|
* @param llmTools LLM tools to be intercepted with usage counting
|
|
3656
3798
|
* @returns LLM tools with same functionality with added total cost counting
|
|
3799
|
+
* @public exported from `@promptbook/core`
|
|
3657
3800
|
*/
|
|
3658
3801
|
function countTotalUsage(llmTools) {
|
|
3659
3802
|
var _this = this;
|
|
@@ -3721,7 +3864,6 @@ function countTotalUsage(llmTools) {
|
|
|
3721
3864
|
return proxyTools;
|
|
3722
3865
|
}
|
|
3723
3866
|
/**
|
|
3724
|
-
* TODO: [🔼] !!! Export via `@promptbookcore/`
|
|
3725
3867
|
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
3726
3868
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
3727
3869
|
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
@@ -3733,6 +3875,7 @@ function countTotalUsage(llmTools) {
|
|
|
3733
3875
|
* Prepares the persona for the pipeline
|
|
3734
3876
|
*
|
|
3735
3877
|
* @see https://github.com/webgptorg/promptbook/discussions/22
|
|
3878
|
+
* @public exported from `@promptbook/core`
|
|
3736
3879
|
*/
|
|
3737
3880
|
function preparePersona(personaDescription, options) {
|
|
3738
3881
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -3787,7 +3930,6 @@ function preparePersona(personaDescription, options) {
|
|
|
3787
3930
|
});
|
|
3788
3931
|
}
|
|
3789
3932
|
/**
|
|
3790
|
-
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
3791
3933
|
* TODO: [🏢] !! Check validity of `modelName` in pipeline
|
|
3792
3934
|
* TODO: [🏢] !! Check validity of `systemMessage` in pipeline
|
|
3793
3935
|
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
@@ -3795,6 +3937,8 @@ function preparePersona(personaDescription, options) {
|
|
|
3795
3937
|
|
|
3796
3938
|
/**
|
|
3797
3939
|
* @@@
|
|
3940
|
+
*
|
|
3941
|
+
* @public exported from `@promptbook/core`
|
|
3798
3942
|
*/
|
|
3799
3943
|
function prepareTemplates(pipeline, options) {
|
|
3800
3944
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -3836,7 +3980,6 @@ function prepareTemplates(pipeline, options) {
|
|
|
3836
3980
|
* TODO: [🧠] Add context to each template (if missing)
|
|
3837
3981
|
* TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
|
|
3838
3982
|
* TODO: [♨] !!! Prepare index the samples and maybe templates
|
|
3839
|
-
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
3840
3983
|
* TODO: Write tests for `preparePipeline`
|
|
3841
3984
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
3842
3985
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
@@ -3849,6 +3992,7 @@ function prepareTemplates(pipeline, options) {
|
|
|
3849
3992
|
*
|
|
3850
3993
|
* Note: This function does not validate logic of the pipeline
|
|
3851
3994
|
* Note: This function acts as part of compilation process
|
|
3995
|
+
* @public exported from `@promptbook/core`
|
|
3852
3996
|
*/
|
|
3853
3997
|
function preparePipeline(pipeline, options) {
|
|
3854
3998
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -3925,7 +4069,6 @@ function preparePipeline(pipeline, options) {
|
|
|
3925
4069
|
});
|
|
3926
4070
|
}
|
|
3927
4071
|
/**
|
|
3928
|
-
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
3929
4072
|
* TODO: Write tests for `preparePipeline`
|
|
3930
4073
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
3931
4074
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
@@ -3936,6 +4079,7 @@ function preparePipeline(pipeline, options) {
|
|
|
3936
4079
|
* Tests if given string is valid URL.
|
|
3937
4080
|
*
|
|
3938
4081
|
* Note: This does not check if the file exists only if the path is valid
|
|
4082
|
+
* @public exported from `@promptbook/utils`
|
|
3939
4083
|
*/
|
|
3940
4084
|
function isValidFilePath(filePath) {
|
|
3941
4085
|
if (typeof filePath !== 'string') {
|
|
@@ -4118,6 +4262,7 @@ var personaCommandParser = {
|
|
|
4118
4262
|
*
|
|
4119
4263
|
* @param {string} str - The string to remove Markdown tags from.
|
|
4120
4264
|
* @returns {string} The input string with all Markdown tags removed.
|
|
4265
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
4121
4266
|
*/
|
|
4122
4267
|
function removeMarkdownFormatting(str) {
|
|
4123
4268
|
// Remove bold formatting
|
|
@@ -4129,6 +4274,15 @@ function removeMarkdownFormatting(str) {
|
|
|
4129
4274
|
return str;
|
|
4130
4275
|
}
|
|
4131
4276
|
|
|
4277
|
+
/**
|
|
4278
|
+
* @@@
|
|
4279
|
+
*
|
|
4280
|
+
* @param text @@@
|
|
4281
|
+
* @returns @@@
|
|
4282
|
+
* @example 'HELLO_WORLD'
|
|
4283
|
+
* @example 'I_LOVE_PROMPTBOOK'
|
|
4284
|
+
* @public exported from `@promptbook/utils`
|
|
4285
|
+
*/
|
|
4132
4286
|
function normalizeTo_SCREAMING_CASE(text) {
|
|
4133
4287
|
var e_1, _a;
|
|
4134
4288
|
var charType;
|
|
@@ -4296,7 +4450,7 @@ var EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', 'LINES', 'PARAGRAPH
|
|
|
4296
4450
|
* @returns parsed number
|
|
4297
4451
|
* @throws {ParsingError} if the value is not a number
|
|
4298
4452
|
*
|
|
4299
|
-
* @
|
|
4453
|
+
* @public exported from `@promptbook/utils`
|
|
4300
4454
|
*/
|
|
4301
4455
|
function parseNumber(value) {
|
|
4302
4456
|
var originalValue = value;
|
|
@@ -4352,6 +4506,7 @@ function parseNumber(value) {
|
|
|
4352
4506
|
}
|
|
4353
4507
|
/**
|
|
4354
4508
|
* TODO: Maybe use sth. like safe-eval in fraction/calculation case @see https://www.npmjs.com/package/safe-eval
|
|
4509
|
+
* TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
|
|
4355
4510
|
*/
|
|
4356
4511
|
|
|
4357
4512
|
/**
|
|
@@ -4663,6 +4818,13 @@ var parameterCommandParser = {
|
|
|
4663
4818
|
},
|
|
4664
4819
|
};
|
|
4665
4820
|
|
|
4821
|
+
/**
|
|
4822
|
+
* @@@
|
|
4823
|
+
*
|
|
4824
|
+
* @param javascriptName @@@
|
|
4825
|
+
* @returns @@@
|
|
4826
|
+
* @public exported from `@promptbook/utils`
|
|
4827
|
+
*/
|
|
4666
4828
|
function isValidJavascriptName(javascriptName) {
|
|
4667
4829
|
if (typeof javascriptName !== 'string') {
|
|
4668
4830
|
return false;
|
|
@@ -5135,6 +5297,8 @@ function parseCommandVariant(input) {
|
|
|
5135
5297
|
|
|
5136
5298
|
/**
|
|
5137
5299
|
* This error type indicates that some part of the code is not implemented yet
|
|
5300
|
+
*
|
|
5301
|
+
* @public exported from `@promptbook/core`
|
|
5138
5302
|
*/
|
|
5139
5303
|
var NotYetImplementedError = /** @class */ (function (_super) {
|
|
5140
5304
|
__extends(NotYetImplementedError, _super);
|
|
@@ -5161,7 +5325,8 @@ var SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
|
|
|
5161
5325
|
* Note: It can not work with html syntax and comments
|
|
5162
5326
|
*
|
|
5163
5327
|
* @param markdown any valid markdown
|
|
5164
|
-
* @returns
|
|
5328
|
+
* @returns @@@
|
|
5329
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
5165
5330
|
*/
|
|
5166
5331
|
function extractAllListItemsFromMarkdown(markdown) {
|
|
5167
5332
|
var e_1, _a;
|
|
@@ -5201,7 +5366,7 @@ function extractAllListItemsFromMarkdown(markdown) {
|
|
|
5201
5366
|
*
|
|
5202
5367
|
* @param markdown any valid markdown
|
|
5203
5368
|
* @returns code blocks with language and content
|
|
5204
|
-
*
|
|
5369
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
5205
5370
|
*/
|
|
5206
5371
|
function extractAllBlocksFromMarkdown(markdown) {
|
|
5207
5372
|
var e_1, _a;
|
|
@@ -5278,6 +5443,7 @@ function extractAllBlocksFromMarkdown(markdown) {
|
|
|
5278
5443
|
*
|
|
5279
5444
|
* @param markdown any valid markdown
|
|
5280
5445
|
* @returns code block with language and content
|
|
5446
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
5281
5447
|
*/
|
|
5282
5448
|
function extractOneBlockFromMarkdown(markdown) {
|
|
5283
5449
|
var codeBlocks = extractAllBlocksFromMarkdown(markdown);
|
|
@@ -5292,6 +5458,8 @@ function extractOneBlockFromMarkdown(markdown) {
|
|
|
5292
5458
|
|
|
5293
5459
|
/**
|
|
5294
5460
|
* Parses markdown section to title its level and content
|
|
5461
|
+
*
|
|
5462
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
5295
5463
|
*/
|
|
5296
5464
|
function parseMarkdownSection(value) {
|
|
5297
5465
|
var _a, _b;
|
|
@@ -5316,6 +5484,8 @@ function parseMarkdownSection(value) {
|
|
|
5316
5484
|
|
|
5317
5485
|
/**
|
|
5318
5486
|
* Splits the markdown into sections by headings
|
|
5487
|
+
*
|
|
5488
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
5319
5489
|
*/
|
|
5320
5490
|
function splitMarkdownIntoSections(markdown) {
|
|
5321
5491
|
var e_1, _a;
|
|
@@ -5377,6 +5547,7 @@ function splitMarkdownIntoSections(markdown) {
|
|
|
5377
5547
|
return sections;
|
|
5378
5548
|
}
|
|
5379
5549
|
/**
|
|
5550
|
+
* TODO: [🏛] This can be part of markdown builder
|
|
5380
5551
|
* Note: [🕞] In past (commit 42086e1603cbed506482997c00a8ee979af0a247) there was much more
|
|
5381
5552
|
* sophisticated implementation of this function through parsing markdown into JSON structure
|
|
5382
5553
|
* and flattening the actual structure
|
|
@@ -5388,6 +5559,8 @@ function splitMarkdownIntoSections(markdown) {
|
|
|
5388
5559
|
*
|
|
5389
5560
|
* - It always have h1 - if there is no h1 in the markdown, it will be added "# Untitled"
|
|
5390
5561
|
* - All other headings are normalized to h2
|
|
5562
|
+
*
|
|
5563
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
5391
5564
|
*/
|
|
5392
5565
|
function flattenMarkdown(markdown) {
|
|
5393
5566
|
var e_1, _a;
|
|
@@ -5423,6 +5596,7 @@ function flattenMarkdown(markdown) {
|
|
|
5423
5596
|
return spaceTrim(flattenedMarkdown);
|
|
5424
5597
|
}
|
|
5425
5598
|
/**
|
|
5599
|
+
* TODO: [🏛] This can be part of markdown builder
|
|
5426
5600
|
* Note: [🕞] In past (commit 42086e1603cbed506482997c00a8ee979af0a247) there was much more
|
|
5427
5601
|
* sophisticated implementation of this function through parsing markdown into JSON structure
|
|
5428
5602
|
* and flattening the actual structure
|
|
@@ -5434,6 +5608,7 @@ function flattenMarkdown(markdown) {
|
|
|
5434
5608
|
*
|
|
5435
5609
|
* @param {string} content - The string to remove comments from.
|
|
5436
5610
|
* @returns {string} The input string with all comments removed.
|
|
5611
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
5437
5612
|
*/
|
|
5438
5613
|
function removeContentComments(content) {
|
|
5439
5614
|
return spaceTrim$1(content.replace(/<!--(.*?)-->/gs, ''));
|
|
@@ -5447,12 +5622,13 @@ function removeContentComments(content) {
|
|
|
5447
5622
|
* - `pipelineStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
5448
5623
|
* - `preparePipeline` - just one step in the compilation process
|
|
5449
5624
|
*
|
|
5625
|
+
* Note: This function does not validate logic of the pipeline only the syntax
|
|
5626
|
+
* Note: This function acts as compilation process
|
|
5627
|
+
*
|
|
5450
5628
|
* @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
|
|
5451
5629
|
* @returns {Promptbook} compiled in JSON format (.ptbk.json)
|
|
5452
5630
|
* @throws {ParsingError} if the promptbook string is not valid
|
|
5453
|
-
*
|
|
5454
|
-
* Note: This function does not validate logic of the pipeline only the syntax
|
|
5455
|
-
* Note: This function acts as compilation process
|
|
5631
|
+
* @public exported from `@promptbook/core`
|
|
5456
5632
|
*/
|
|
5457
5633
|
function pipelineStringToJsonSync(pipelineString) {
|
|
5458
5634
|
var e_1, _a, e_2, _b;
|
|
@@ -5845,13 +6021,14 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
5845
6021
|
* - `pipelineStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
5846
6022
|
* - `preparePipeline` - just one step in the compilation process
|
|
5847
6023
|
*
|
|
6024
|
+
* Note: This function does not validate logic of the pipeline only the syntax
|
|
6025
|
+
* Note: This function acts as compilation process
|
|
6026
|
+
*
|
|
5848
6027
|
* @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
|
|
5849
6028
|
* @param options - Options and tools for the compilation
|
|
5850
6029
|
* @returns {Promptbook} compiled in JSON format (.ptbk.json)
|
|
5851
6030
|
* @throws {ParsingError} if the promptbook string is not valid
|
|
5852
|
-
*
|
|
5853
|
-
* Note: This function does not validate logic of the pipeline only the syntax
|
|
5854
|
-
* Note: This function acts as compilation process
|
|
6031
|
+
* @public exported from `@promptbook/core`
|
|
5855
6032
|
*/
|
|
5856
6033
|
function pipelineStringToJson(pipelineString, options) {
|
|
5857
6034
|
if (options === void 0) { options = { llmTools: null }; }
|
|
@@ -5880,7 +6057,7 @@ function pipelineStringToJson(pipelineString, options) {
|
|
|
5880
6057
|
/**
|
|
5881
6058
|
* Add or modify an auto-generated section in a markdown file
|
|
5882
6059
|
*
|
|
5883
|
-
* @
|
|
6060
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
5884
6061
|
*/
|
|
5885
6062
|
function addAutoGeneratedSection(content, options) {
|
|
5886
6063
|
var sectionName = options.sectionName, sectionContent = options.sectionContent;
|
|
@@ -5900,7 +6077,20 @@ function addAutoGeneratedSection(content, options) {
|
|
|
5900
6077
|
var _a = __read(placeForSection, 1), heading = _a[0];
|
|
5901
6078
|
return content.replace(heading, "<!--".concat(sectionName, "-->\n").concat(warningLine, "\n").concat(sectionContent, "\n<!--/").concat(sectionName, "-->\n\n").concat(heading));
|
|
5902
6079
|
}
|
|
6080
|
+
/**
|
|
6081
|
+
* TODO: [🏛] This can be part of markdown builder
|
|
6082
|
+
*/
|
|
5903
6083
|
|
|
6084
|
+
/**
|
|
6085
|
+
* @@@
|
|
6086
|
+
*
|
|
6087
|
+
* @param text @@@
|
|
6088
|
+
* @param _isFirstLetterCapital @@@
|
|
6089
|
+
* @returns @@@
|
|
6090
|
+
* @example 'helloWorld'
|
|
6091
|
+
* @example 'iLovePromptbook'
|
|
6092
|
+
* @public exported from `@promptbook/utils`
|
|
6093
|
+
*/
|
|
5904
6094
|
function normalizeTo_camelCase(text, _isFirstLetterCapital) {
|
|
5905
6095
|
var e_1, _a;
|
|
5906
6096
|
if (_isFirstLetterCapital === void 0) { _isFirstLetterCapital = false; }
|
|
@@ -5959,6 +6149,8 @@ function normalizeTo_camelCase(text, _isFirstLetterCapital) {
|
|
|
5959
6149
|
* Creates a Mermaid graph based on the promptbook
|
|
5960
6150
|
*
|
|
5961
6151
|
* Note: The result is not wrapped in a Markdown code block
|
|
6152
|
+
*
|
|
6153
|
+
* @public exported from `@promptbook/utils`
|
|
5962
6154
|
*/
|
|
5963
6155
|
function renderPromptbookMermaid(pipelineJson, options) {
|
|
5964
6156
|
var _a = (options || {}).linkPromptTemplate, linkPromptTemplate = _a === void 0 ? function () { return null; } : _a;
|
|
@@ -6015,6 +6207,8 @@ function renderPromptbookMermaid(pipelineJson, options) {
|
|
|
6015
6207
|
|
|
6016
6208
|
/**
|
|
6017
6209
|
* Prettyfies Promptbook string and adds Mermaid graph
|
|
6210
|
+
*
|
|
6211
|
+
* @public exported from `@promptbook/core`
|
|
6018
6212
|
*/
|
|
6019
6213
|
function prettifyPipelineString(pipelineString, options) {
|
|
6020
6214
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -6057,6 +6251,8 @@ function prettifyPipelineString(pipelineString, options) {
|
|
|
6057
6251
|
*
|
|
6058
6252
|
* Note: [0] It can be used for more JSON types like whole collection of pipelines, single knowledge piece, etc.
|
|
6059
6253
|
* Note: In contrast to JSON.stringify, this function ensures that **embedding index** is on single line
|
|
6254
|
+
*
|
|
6255
|
+
* @public exported from `@promptbook/core`
|
|
6060
6256
|
*/
|
|
6061
6257
|
function stringifyPipelineJson(pipeline) {
|
|
6062
6258
|
var pipelineJsonStringified = JSON.stringify(pipeline, null, 4);
|
|
@@ -6076,6 +6272,8 @@ function stringifyPipelineJson(pipeline) {
|
|
|
6076
6272
|
|
|
6077
6273
|
/**
|
|
6078
6274
|
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
6275
|
+
*
|
|
6276
|
+
* @public exported from `@promptbook/core`
|
|
6079
6277
|
*/
|
|
6080
6278
|
var CollectionError = /** @class */ (function (_super) {
|
|
6081
6279
|
__extends(CollectionError, _super);
|
|
@@ -6088,8 +6286,26 @@ var CollectionError = /** @class */ (function (_super) {
|
|
|
6088
6286
|
return CollectionError;
|
|
6089
6287
|
}(Error));
|
|
6090
6288
|
|
|
6289
|
+
/**
|
|
6290
|
+
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
6291
|
+
*
|
|
6292
|
+
* @public exported from `@promptbook/core`
|
|
6293
|
+
*/
|
|
6294
|
+
var EnvironmentMismatchError = /** @class */ (function (_super) {
|
|
6295
|
+
__extends(EnvironmentMismatchError, _super);
|
|
6296
|
+
function EnvironmentMismatchError(message) {
|
|
6297
|
+
var _this = _super.call(this, message) || this;
|
|
6298
|
+
_this.name = 'EnvironmentMismatchError';
|
|
6299
|
+
Object.setPrototypeOf(_this, EnvironmentMismatchError.prototype);
|
|
6300
|
+
return _this;
|
|
6301
|
+
}
|
|
6302
|
+
return EnvironmentMismatchError;
|
|
6303
|
+
}(Error));
|
|
6304
|
+
|
|
6091
6305
|
/**
|
|
6092
6306
|
* This error type indicates that the version of the pipeline is not matching the expected version
|
|
6307
|
+
*
|
|
6308
|
+
* @public exported from `@promptbook/core`
|
|
6093
6309
|
*/
|
|
6094
6310
|
var VersionMismatchError = /** @class */ (function (_super) {
|
|
6095
6311
|
__extends(VersionMismatchError, _super);
|
|
@@ -6104,6 +6320,8 @@ var VersionMismatchError = /** @class */ (function (_super) {
|
|
|
6104
6320
|
|
|
6105
6321
|
/**
|
|
6106
6322
|
* Pretty print an embedding vector for logging
|
|
6323
|
+
*
|
|
6324
|
+
* @public exported from `@promptbook/core`
|
|
6107
6325
|
*/
|
|
6108
6326
|
function embeddingVectorToString(embeddingVector) {
|
|
6109
6327
|
var vectorLength = Math.pow(embeddingVector.reduce(function (acc, val) { return acc + Math.pow(val, 2); }, 0), 0.5);
|
|
@@ -6116,6 +6334,8 @@ function embeddingVectorToString(embeddingVector) {
|
|
|
6116
6334
|
* Note: This is an estimate based of theese sources:
|
|
6117
6335
|
* - https://jecas.cz/doba-cteni
|
|
6118
6336
|
* - https://www.originalnitonery.cz/blog/psani-vsemi-deseti-se-muzete-naucit-i-sami-doma
|
|
6337
|
+
*
|
|
6338
|
+
* @public exported from `@promptbook/core`
|
|
6119
6339
|
*/
|
|
6120
6340
|
function usageToWorktime(usage) {
|
|
6121
6341
|
var value = usage.input.wordsCount.value / (200 /* words per minute */ * 60) +
|
|
@@ -6130,6 +6350,8 @@ function usageToWorktime(usage) {
|
|
|
6130
6350
|
|
|
6131
6351
|
/**
|
|
6132
6352
|
* Function `usageToHuman` will take usage and convert it to human readable report
|
|
6353
|
+
*
|
|
6354
|
+
* @public exported from `@promptbook/core`
|
|
6133
6355
|
*/
|
|
6134
6356
|
function usageToHuman(usage) {
|
|
6135
6357
|
var report = 'Usage:';
|
|
@@ -6154,6 +6376,8 @@ function usageToHuman(usage) {
|
|
|
6154
6376
|
/**
|
|
6155
6377
|
* Delagates the user interaction to a async callback function
|
|
6156
6378
|
* You need to provide your own implementation of this callback function and its bind to UI.
|
|
6379
|
+
*
|
|
6380
|
+
* @public exported from `@promptbook/core`
|
|
6157
6381
|
*/
|
|
6158
6382
|
var CallbackInterfaceTools = /** @class */ (function () {
|
|
6159
6383
|
function CallbackInterfaceTools(options) {
|
|
@@ -6186,6 +6410,8 @@ var CallbackInterfaceTools = /** @class */ (function () {
|
|
|
6186
6410
|
*
|
|
6187
6411
|
* Warning: It is used for testing and mocking
|
|
6188
6412
|
* **NOT intended to use in the production** due to its synchronous nature.
|
|
6413
|
+
*
|
|
6414
|
+
* @public exported from `@promptbook/core`
|
|
6189
6415
|
*/
|
|
6190
6416
|
var SimplePromptInterfaceTools = /** @class */ (function () {
|
|
6191
6417
|
function SimplePromptInterfaceTools(options) {
|
|
@@ -6217,12 +6443,260 @@ var SimplePromptInterfaceTools = /** @class */ (function () {
|
|
|
6217
6443
|
*/
|
|
6218
6444
|
|
|
6219
6445
|
/**
|
|
6220
|
-
*
|
|
6446
|
+
* Stores
|
|
6447
|
+
*
|
|
6448
|
+
* @public exported from `@promptbook/core`
|
|
6221
6449
|
*/
|
|
6222
|
-
var
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
}
|
|
6450
|
+
var MemoryStorage = /** @class */ (function () {
|
|
6451
|
+
function MemoryStorage() {
|
|
6452
|
+
this.storage = {};
|
|
6453
|
+
}
|
|
6454
|
+
Object.defineProperty(MemoryStorage.prototype, "length", {
|
|
6455
|
+
/**
|
|
6456
|
+
* Returns the number of key/value pairs currently present in the list associated with the object.
|
|
6457
|
+
*/
|
|
6458
|
+
get: function () {
|
|
6459
|
+
return Object.keys(this.storage).length;
|
|
6460
|
+
},
|
|
6461
|
+
enumerable: false,
|
|
6462
|
+
configurable: true
|
|
6463
|
+
});
|
|
6464
|
+
/**
|
|
6465
|
+
* Empties the list associated with the object of all key/value pairs, if there are any.
|
|
6466
|
+
*/
|
|
6467
|
+
MemoryStorage.prototype.clear = function () {
|
|
6468
|
+
this.storage = {};
|
|
6469
|
+
};
|
|
6470
|
+
/**
|
|
6471
|
+
* Returns the current value associated with the given key, or null if the given key does not exist in the list associated with the object.
|
|
6472
|
+
*/
|
|
6473
|
+
MemoryStorage.prototype.getItem = function (key) {
|
|
6474
|
+
return this.storage[key] || null;
|
|
6475
|
+
};
|
|
6476
|
+
/**
|
|
6477
|
+
* Returns the name of the nth key in the list, or null if n is greater than or equal to the number of key/value pairs in the object.
|
|
6478
|
+
*/
|
|
6479
|
+
MemoryStorage.prototype.key = function (index) {
|
|
6480
|
+
return Object.keys(this.storage)[index] || null;
|
|
6481
|
+
};
|
|
6482
|
+
/**
|
|
6483
|
+
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
|
6484
|
+
*/
|
|
6485
|
+
MemoryStorage.prototype.setItem = function (key, value) {
|
|
6486
|
+
this.storage[key] = value;
|
|
6487
|
+
};
|
|
6488
|
+
/**
|
|
6489
|
+
* Removes the key/value pair with the given key from the list associated with the object, if a key/value pair with the given key exists.
|
|
6490
|
+
*/
|
|
6491
|
+
MemoryStorage.prototype.removeItem = function (key) {
|
|
6492
|
+
delete this.storage[key];
|
|
6493
|
+
};
|
|
6494
|
+
return MemoryStorage;
|
|
6495
|
+
}());
|
|
6496
|
+
|
|
6497
|
+
/**
|
|
6498
|
+
* Simple wrapper `new Date().toISOString()`
|
|
6499
|
+
*
|
|
6500
|
+
* @returns string_date branded type
|
|
6501
|
+
* @public exported from `@promptbook/utils`
|
|
6502
|
+
*/
|
|
6503
|
+
function $currentDate() {
|
|
6504
|
+
return new Date().toISOString();
|
|
6505
|
+
}
|
|
6506
|
+
|
|
6507
|
+
/**
|
|
6508
|
+
* Intercepts LLM tools and counts total usage of the tools
|
|
6509
|
+
*
|
|
6510
|
+
* Note: It can take extended `LlmExecutionTools` and cache the
|
|
6511
|
+
*
|
|
6512
|
+
* @param llmTools LLM tools to be intercepted with usage counting, it can contain extra methods like `totalUsage`
|
|
6513
|
+
* @returns LLM tools with same functionality with added total cost counting
|
|
6514
|
+
* @public exported from `@promptbook/core`
|
|
6515
|
+
*/
|
|
6516
|
+
function cacheLlmTools(llmTools, options) {
|
|
6517
|
+
var _this = this;
|
|
6518
|
+
if (options === void 0) { options = {}; }
|
|
6519
|
+
var _a = options.storage, storage = _a === void 0 ? new MemoryStorage() : _a, _b = options.isReloaded, isReloaded = _b === void 0 ? false : _b;
|
|
6520
|
+
var proxyTools = __assign(__assign({}, llmTools), {
|
|
6521
|
+
// <- Note: [🥫]
|
|
6522
|
+
get title() {
|
|
6523
|
+
// TODO: [🧠] Maybe put here some suffix
|
|
6524
|
+
return llmTools.title;
|
|
6525
|
+
},
|
|
6526
|
+
get description() {
|
|
6527
|
+
// TODO: [🧠] Maybe put here some suffix
|
|
6528
|
+
return llmTools.description;
|
|
6529
|
+
}, listModels: function () {
|
|
6530
|
+
// TODO: [🧠] Should be model listing also cached?
|
|
6531
|
+
return /* not await */ llmTools.listModels();
|
|
6532
|
+
} });
|
|
6533
|
+
var callCommonModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
6534
|
+
var key, cacheItem, _a, promptResult, _b;
|
|
6535
|
+
return __generator(this, function (_c) {
|
|
6536
|
+
switch (_c.label) {
|
|
6537
|
+
case 0:
|
|
6538
|
+
key = titleToName(prompt.title.substring(0, MAX_FILENAME_LENGTH - 10) +
|
|
6539
|
+
'-' +
|
|
6540
|
+
sha256(hexEncoder.parse(JSON.stringify(prompt.parameters))).toString( /* hex */));
|
|
6541
|
+
if (!!isReloaded) return [3 /*break*/, 2];
|
|
6542
|
+
return [4 /*yield*/, storage.getItem(key)];
|
|
6543
|
+
case 1:
|
|
6544
|
+
_a = _c.sent();
|
|
6545
|
+
return [3 /*break*/, 3];
|
|
6546
|
+
case 2:
|
|
6547
|
+
_a = null;
|
|
6548
|
+
_c.label = 3;
|
|
6549
|
+
case 3:
|
|
6550
|
+
cacheItem = _a;
|
|
6551
|
+
if (cacheItem) {
|
|
6552
|
+
return [2 /*return*/, cacheItem.promptResult];
|
|
6553
|
+
}
|
|
6554
|
+
_b = prompt.modelRequirements.modelVariant;
|
|
6555
|
+
switch (_b) {
|
|
6556
|
+
case 'CHAT': return [3 /*break*/, 4];
|
|
6557
|
+
case 'COMPLETION': return [3 /*break*/, 6];
|
|
6558
|
+
case 'EMBEDDING': return [3 /*break*/, 8];
|
|
6559
|
+
}
|
|
6560
|
+
return [3 /*break*/, 10];
|
|
6561
|
+
case 4: return [4 /*yield*/, llmTools.callChatModel(prompt)];
|
|
6562
|
+
case 5:
|
|
6563
|
+
promptResult = _c.sent();
|
|
6564
|
+
return [3 /*break*/, 11];
|
|
6565
|
+
case 6: return [4 /*yield*/, llmTools.callCompletionModel(prompt)];
|
|
6566
|
+
case 7:
|
|
6567
|
+
promptResult = _c.sent();
|
|
6568
|
+
return [3 /*break*/, 11];
|
|
6569
|
+
case 8: return [4 /*yield*/, llmTools.callEmbeddingModel(prompt)];
|
|
6570
|
+
case 9:
|
|
6571
|
+
promptResult = _c.sent();
|
|
6572
|
+
return [3 /*break*/, 11];
|
|
6573
|
+
case 10: throw new PipelineExecutionError("Unknown model variant \"".concat(prompt.modelRequirements.modelVariant, "\""));
|
|
6574
|
+
case 11: return [4 /*yield*/, storage.setItem(key, {
|
|
6575
|
+
date: $currentDate(),
|
|
6576
|
+
promptbookVersion: PROMPTBOOK_VERSION,
|
|
6577
|
+
prompt: prompt,
|
|
6578
|
+
promptResult: promptResult,
|
|
6579
|
+
})];
|
|
6580
|
+
case 12:
|
|
6581
|
+
_c.sent();
|
|
6582
|
+
return [2 /*return*/, promptResult];
|
|
6583
|
+
}
|
|
6584
|
+
});
|
|
6585
|
+
}); };
|
|
6586
|
+
if (llmTools.callChatModel !== undefined) {
|
|
6587
|
+
proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
6588
|
+
return __generator(this, function (_a) {
|
|
6589
|
+
return [2 /*return*/, /* not await */ callCommonModel(prompt)];
|
|
6590
|
+
});
|
|
6591
|
+
}); };
|
|
6592
|
+
}
|
|
6593
|
+
if (llmTools.callCompletionModel !== undefined) {
|
|
6594
|
+
proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
6595
|
+
return __generator(this, function (_a) {
|
|
6596
|
+
return [2 /*return*/, /* not await */ callCommonModel(prompt)];
|
|
6597
|
+
});
|
|
6598
|
+
}); };
|
|
6599
|
+
}
|
|
6600
|
+
if (llmTools.callEmbeddingModel !== undefined) {
|
|
6601
|
+
proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
6602
|
+
return __generator(this, function (_a) {
|
|
6603
|
+
return [2 /*return*/, /* not await */ callCommonModel(prompt)];
|
|
6604
|
+
});
|
|
6605
|
+
}); };
|
|
6606
|
+
}
|
|
6607
|
+
// <- Note: [🤖]
|
|
6608
|
+
return proxyTools;
|
|
6609
|
+
}
|
|
6610
|
+
/**
|
|
6611
|
+
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
6612
|
+
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
6613
|
+
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
6614
|
+
* @@@ write discussion about this and storages
|
|
6615
|
+
* @@@ write how to combine multiple interceptors
|
|
6616
|
+
*/
|
|
6617
|
+
|
|
6618
|
+
/**
|
|
6619
|
+
* @@@
|
|
6620
|
+
*
|
|
6621
|
+
* @public exported from `@promptbook/core`
|
|
6622
|
+
*/
|
|
6623
|
+
function limitTotalUsage(llmTools, options) {
|
|
6624
|
+
var _this = this;
|
|
6625
|
+
if (options === void 0) { options = {}; }
|
|
6626
|
+
var _a = options.maxTotalUsage, maxTotalUsage = _a === void 0 ? ZERO_USAGE : _a, _b = options.storage, storage = _b === void 0 ? new MemoryStorage() : _b;
|
|
6627
|
+
TODO_USE(storage);
|
|
6628
|
+
var proxyTools = countTotalUsage(llmTools);
|
|
6629
|
+
if (maxTotalUsage.price.value !== 0) {
|
|
6630
|
+
throw new NotYetImplementedError('`limitTotalUsage` is not yet implemented for non-zero price');
|
|
6631
|
+
// TODO: "Cannot call `callChatModel` because the total cost limit is reached"
|
|
6632
|
+
}
|
|
6633
|
+
if (proxyTools.callChatModel !== undefined) {
|
|
6634
|
+
proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
6635
|
+
return __generator(this, function (_a) {
|
|
6636
|
+
TODO_USE(prompt);
|
|
6637
|
+
throw new LimitReachedError('Cannot call `callChatModel` because you are not allowed to spend any cost');
|
|
6638
|
+
});
|
|
6639
|
+
}); };
|
|
6640
|
+
}
|
|
6641
|
+
if (proxyTools.callCompletionModel !== undefined) {
|
|
6642
|
+
proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
6643
|
+
return __generator(this, function (_a) {
|
|
6644
|
+
TODO_USE(prompt);
|
|
6645
|
+
throw new LimitReachedError('Cannot call `callCompletionModel` because you are not allowed to spend any cost');
|
|
6646
|
+
});
|
|
6647
|
+
}); };
|
|
6648
|
+
}
|
|
6649
|
+
if (proxyTools.callEmbeddingModel !== undefined) {
|
|
6650
|
+
proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
6651
|
+
return __generator(this, function (_a) {
|
|
6652
|
+
TODO_USE(prompt);
|
|
6653
|
+
throw new LimitReachedError('Cannot call `callEmbeddingModel` because you are not allowed to spend any cost');
|
|
6654
|
+
});
|
|
6655
|
+
}); };
|
|
6656
|
+
}
|
|
6657
|
+
// <- Note: [🤖]
|
|
6658
|
+
return proxyTools;
|
|
6659
|
+
}
|
|
6660
|
+
/**
|
|
6661
|
+
* TODO: Maybe internally use `countTotalUsage`
|
|
6662
|
+
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
6663
|
+
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
6664
|
+
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
6665
|
+
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
6666
|
+
*/
|
|
6667
|
+
|
|
6668
|
+
/**
|
|
6669
|
+
* This class behaves like LocalStorage but separates keys by prefix
|
|
6670
|
+
*
|
|
6671
|
+
* @public exported from `@promptbook/core`
|
|
6672
|
+
*/
|
|
6673
|
+
var PrefixStorage = /** @class */ (function () {
|
|
6674
|
+
function PrefixStorage(baseStorage, keyPrefix, separator) {
|
|
6675
|
+
if (separator === void 0) { separator = '_'; }
|
|
6676
|
+
this.baseStorage = baseStorage;
|
|
6677
|
+
this.keyPrefix = keyPrefix;
|
|
6678
|
+
this.separator = separator;
|
|
6679
|
+
}
|
|
6680
|
+
/**
|
|
6681
|
+
* Returns the current value associated with the given key, or null if the given key does not exist in the list associated with the object.
|
|
6682
|
+
*/
|
|
6683
|
+
PrefixStorage.prototype.getItem = function (key) {
|
|
6684
|
+
return this.baseStorage.getItem(this.keyPrefix + this.separator + key);
|
|
6685
|
+
};
|
|
6686
|
+
/**
|
|
6687
|
+
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
|
6688
|
+
*/
|
|
6689
|
+
PrefixStorage.prototype.setItem = function (key, value) {
|
|
6690
|
+
return this.baseStorage.setItem(this.keyPrefix + this.separator + key, value);
|
|
6691
|
+
};
|
|
6692
|
+
/**
|
|
6693
|
+
* Removes the key/value pair with the given key from the list associated with the object, if a key/value pair with the given key exists.
|
|
6694
|
+
*/
|
|
6695
|
+
PrefixStorage.prototype.removeItem = function (key) {
|
|
6696
|
+
this.baseStorage.removeItem(this.keyPrefix + this.separator + key);
|
|
6697
|
+
};
|
|
6698
|
+
return PrefixStorage;
|
|
6699
|
+
}());
|
|
6226
6700
|
|
|
6227
6701
|
/**
|
|
6228
6702
|
* Format either small or big number
|
|
@@ -6247,7 +6721,7 @@ function formatNumber(value) {
|
|
|
6247
6721
|
/**
|
|
6248
6722
|
* Create a markdown table from a 2D array of strings
|
|
6249
6723
|
*
|
|
6250
|
-
* @
|
|
6724
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
6251
6725
|
*/
|
|
6252
6726
|
function createMarkdownTable(table) {
|
|
6253
6727
|
var columnWidths = table.reduce(function (widths, row) {
|
|
@@ -6271,11 +6745,14 @@ function createMarkdownTable(table) {
|
|
|
6271
6745
|
});
|
|
6272
6746
|
return __spreadArray([header, separator], __read(rows), false).join('\n');
|
|
6273
6747
|
}
|
|
6748
|
+
/**
|
|
6749
|
+
* TODO: [🏛] This can be part of markdown builder
|
|
6750
|
+
*/
|
|
6274
6751
|
|
|
6275
6752
|
/**
|
|
6276
6753
|
* Function createMarkdownChart will draw a chart in markdown from ⬛+🟦 tiles
|
|
6277
6754
|
*
|
|
6278
|
-
* @
|
|
6755
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
6279
6756
|
*/
|
|
6280
6757
|
function createMarkdownChart(options) {
|
|
6281
6758
|
var e_1, _a;
|
|
@@ -6311,10 +6788,25 @@ function createMarkdownChart(options) {
|
|
|
6311
6788
|
/**
|
|
6312
6789
|
* Function escapeMarkdownBlock will escape markdown block if needed
|
|
6313
6790
|
* It is useful when you want have block in block
|
|
6791
|
+
*
|
|
6792
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
6314
6793
|
*/
|
|
6315
6794
|
function escapeMarkdownBlock(value) {
|
|
6316
6795
|
return value.replace(/```/g, '\\`\\`\\`');
|
|
6317
6796
|
}
|
|
6797
|
+
/**
|
|
6798
|
+
* TODO: [🏛] This can be part of markdown builder
|
|
6799
|
+
*/
|
|
6800
|
+
|
|
6801
|
+
/**
|
|
6802
|
+
* Default options for generating an execution report string
|
|
6803
|
+
*
|
|
6804
|
+
* @public exported from `@promptbook/core`
|
|
6805
|
+
*/
|
|
6806
|
+
var ExecutionReportStringOptionsDefaults = {
|
|
6807
|
+
taxRate: 0,
|
|
6808
|
+
chartsWidth: 36,
|
|
6809
|
+
};
|
|
6318
6810
|
|
|
6319
6811
|
/**
|
|
6320
6812
|
* The thresholds for the relative time in the `moment` NPM package.
|
|
@@ -6360,6 +6852,8 @@ function countWorkingDuration(items) {
|
|
|
6360
6852
|
|
|
6361
6853
|
/**
|
|
6362
6854
|
* Converts execution report from JSON to string format
|
|
6855
|
+
*
|
|
6856
|
+
* @public exported from `@promptbook/core`
|
|
6363
6857
|
*/
|
|
6364
6858
|
function executionReportJsonToString(executionReportJson, options) {
|
|
6365
6859
|
var e_1, _a;
|
|
@@ -6529,5 +7023,5 @@ function executionReportJsonToString(executionReportJson, options) {
|
|
|
6529
7023
|
* TODO: [🧠] Allow to filter out some parts of the report by options
|
|
6530
7024
|
*/
|
|
6531
7025
|
|
|
6532
|
-
export { BlockTypes, CallbackInterfaceTools, CollectionError, ExecutionReportStringOptionsDefaults,
|
|
7026
|
+
export { BlockTypes, CallbackInterfaceTools, CollectionError, EXECUTIONS_CACHE_DIRNAME, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, LimitReachedError, MAX_EXECUTION_ATTEMPTS, MAX_FILENAME_LENGTH, MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, MAX_PARALLEL_COUNT, MemoryStorage, NotFoundError, NotYetImplementedError, PIPELINE_COLLECTION_BASE_FILENAME, PROMPTBOOK_VERSION, ParsingError, PipelineExecutionError, PipelineLogicError, PrefixStorage, RESERVED_PARAMETER_NAMES, ReferenceError$1 as ReferenceError, SimplePromptInterfaceTools, UnexpectedError, VersionMismatchError, ZERO_USAGE, addUsage, assertsExecutionSuccessful, cacheLlmTools, checkExpectations, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, isPassingExpectations, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, prepareKnowledgeFromMarkdown, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTemplates, prettifyPipelineString, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
|
|
6533
7027
|
//# sourceMappingURL=index.es.js.map
|