@promptbook/cli 0.63.0-2 → 0.63.0-3
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 +2 -2
- package/esm/index.es.js +125 -116
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/anthropic-claude.index.d.ts +2 -0
- package/esm/typings/src/_packages/browser.index.d.ts +2 -0
- package/esm/typings/src/_packages/core.index.d.ts +0 -4
- package/esm/typings/src/_packages/types.index.d.ts +0 -48
- package/esm/typings/src/_packages/utils.index.d.ts +6 -2
- package/esm/typings/src/cli/cli-commands/hello.d.ts +2 -2
- package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -1
- package/esm/typings/src/cli/promptbookCli.d.ts +3 -1
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -2
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -1
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +0 -1
- package/esm/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +2 -0
- package/esm/typings/src/commands/index.d.ts +2 -0
- package/esm/typings/src/config.d.ts +13 -5
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +5 -1
- package/esm/typings/src/errors/_ExpectError.d.ts +2 -1
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +3 -0
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +2 -0
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +3 -0
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +3 -0
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +3 -0
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +1 -0
- package/esm/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +3 -0
- package/esm/typings/src/execution/utils/checkExpectations.d.ts +1 -1
- package/esm/typings/src/execution/utils/computeUsageCounts.d.ts +1 -1
- package/esm/typings/src/expectations/drafts/isDomainNameFree.d.ts +3 -0
- package/esm/typings/src/expectations/drafts/isGithubNameFree.d.ts +3 -0
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
- package/esm/typings/src/formats/csv/ListFormatDefinition.d.ts +2 -0
- package/esm/typings/src/formats/index.d.ts +2 -0
- package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +2 -0
- package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +2 -0
- package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +2 -0
- package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +2 -0
- package/esm/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +4 -2
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -0
- package/esm/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +1 -1
- package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -0
- package/esm/typings/src/scripting/javascript/utils/unknownToString.d.ts +1 -1
- package/esm/typings/src/scripting/python/PythonExecutionTools.d.ts +2 -0
- package/esm/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +2 -0
- package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +1 -1
- package/esm/typings/src/types/Arrayable.d.ts +1 -1
- package/esm/typings/src/types/ModelVariant.d.ts +8 -7
- package/esm/typings/src/types/PipelineJson/Expectations.d.ts +10 -4
- package/esm/typings/src/types/ScriptLanguage.d.ts +6 -4
- package/esm/typings/src/types/typeAliases.d.ts +2 -1
- package/esm/typings/src/utils/arrayableToArray.d.ts +1 -1
- package/esm/typings/src/utils/deepFreeze.d.ts +6 -5
- package/esm/typings/src/utils/files/listAllFiles.d.ts +14 -0
- package/esm/typings/src/utils/getCurrentIsoDate.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +3 -1
- package/esm/typings/src/utils/validators/email/isValidEmail.d.ts +2 -0
- package/package.json +1 -4
- package/umd/index.umd.js +122 -114
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/types/execution-report/config.d.ts +0 -8
- package/umd/typings/promptbook-collection/index.d.ts +0 -252
- package/umd/typings/src/_packages/anthropic-claude.index.d.ts +0 -6
- package/umd/typings/src/_packages/azure-openai.index.d.ts +0 -6
- package/umd/typings/src/_packages/browser.index.d.ts +0 -6
- package/umd/typings/src/_packages/cli.index.d.ts +0 -4
- package/umd/typings/src/_packages/core.index.d.ts +0 -124
- package/umd/typings/src/_packages/execute-javascript.index.d.ts +0 -8
- package/umd/typings/src/_packages/fake-llm.index.d.ts +0 -6
- package/umd/typings/src/_packages/langtail.index.d.ts +0 -6
- package/umd/typings/src/_packages/markdown-utils.index.d.ts +0 -36
- package/umd/typings/src/_packages/node.index.d.ts +0 -8
- package/umd/typings/src/_packages/openai.index.d.ts +0 -8
- package/umd/typings/src/_packages/remote-client.index.d.ts +0 -8
- package/umd/typings/src/_packages/remote-server.index.d.ts +0 -6
- package/umd/typings/src/_packages/types.index.d.ts +0 -462
- package/umd/typings/src/_packages/utils.index.d.ts +0 -130
- package/umd/typings/src/cli/cli-commands/hello.d.ts +0 -10
- package/umd/typings/src/cli/cli-commands/make.d.ts +0 -10
- package/umd/typings/src/cli/cli-commands/prettify.d.ts +0 -10
- package/umd/typings/src/cli/main.d.ts +0 -12
- package/umd/typings/src/cli/promptbookCli.d.ts +0 -10
- package/umd/typings/src/collection/PipelineCollection.d.ts +0 -25
- package/umd/typings/src/collection/SimplePipelineCollection.d.ts +0 -38
- package/umd/typings/src/collection/collectionToJson.d.ts +0 -13
- package/umd/typings/src/collection/collectionToJson.test.d.ts +0 -7
- package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +0 -48
- package/umd/typings/src/collection/constructors/createCollectionFromDirectory.test.d.ts +0 -1
- package/umd/typings/src/collection/constructors/createCollectionFromJson.d.ts +0 -13
- package/umd/typings/src/collection/constructors/createCollectionFromJson.test.d.ts +0 -1
- package/umd/typings/src/collection/constructors/createCollectionFromPromise.d.ts +0 -23
- package/umd/typings/src/collection/constructors/createCollectionFromPromise.test.d.ts +0 -1
- package/umd/typings/src/collection/constructors/createCollectionFromUrl.d.ts +0 -29
- package/umd/typings/src/collection/constructors/createSubcollection.d.ts +0 -13
- package/umd/typings/src/commands/BLOCK/BlockCommand.d.ts +0 -11
- package/umd/typings/src/commands/BLOCK/BlockTypes.d.ts +0 -15
- package/umd/typings/src/commands/BLOCK/blockCommand.test.d.ts +0 -1
- package/umd/typings/src/commands/BLOCK/blockCommandParser.d.ts +0 -9
- package/umd/typings/src/commands/EXPECT/ExpectAmountCommand.d.ts +0 -14
- package/umd/typings/src/commands/EXPECT/ExpectCommand.d.ts +0 -9
- package/umd/typings/src/commands/EXPECT/ExpectFormatCommand.d.ts +0 -7
- package/umd/typings/src/commands/EXPECT/expectCommand.test.d.ts +0 -1
- package/umd/typings/src/commands/EXPECT/expectCommandParser.d.ts +0 -9
- package/umd/typings/src/commands/JOKER/JokerCommand.d.ts +0 -11
- package/umd/typings/src/commands/JOKER/jokerCommand.test.d.ts +0 -1
- package/umd/typings/src/commands/JOKER/jokerCommandParser.d.ts +0 -9
- package/umd/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +0 -11
- package/umd/typings/src/commands/KNOWLEDGE/knowledgeCommand.test.d.ts +0 -1
- package/umd/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +0 -9
- package/umd/typings/src/commands/MODEL/ModelCommand.d.ts +0 -13
- package/umd/typings/src/commands/MODEL/modelCommand.test.d.ts +0 -1
- package/umd/typings/src/commands/MODEL/modelCommandParser.d.ts +0 -9
- package/umd/typings/src/commands/PARAMETER/ParameterCommand.d.ts +0 -15
- package/umd/typings/src/commands/PARAMETER/parameterCommand.test.d.ts +0 -1
- package/umd/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +0 -9
- package/umd/typings/src/commands/PERSONA/PersonaCommand.d.ts +0 -13
- package/umd/typings/src/commands/PERSONA/personaCommand.test.d.ts +0 -1
- package/umd/typings/src/commands/PERSONA/personaCommandParser.d.ts +0 -9
- package/umd/typings/src/commands/POSTPROCESS/PostprocessCommand.d.ts +0 -11
- package/umd/typings/src/commands/POSTPROCESS/postprocessCommand.test.d.ts +0 -1
- package/umd/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +0 -9
- package/umd/typings/src/commands/PROMPTBOOK_VERSION/PromptbookVersionCommand.d.ts +0 -11
- package/umd/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommand.test.d.ts +0 -1
- package/umd/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +0 -9
- package/umd/typings/src/commands/URL/UrlCommand.d.ts +0 -10
- package/umd/typings/src/commands/URL/urlCommand.test.d.ts +0 -1
- package/umd/typings/src/commands/URL/urlCommandParser.d.ts +0 -9
- package/umd/typings/src/commands/X_ACTION/ActionCommand.d.ts +0 -9
- package/umd/typings/src/commands/X_ACTION/actionCommand.test.d.ts +0 -1
- package/umd/typings/src/commands/X_ACTION/actionCommandParser.d.ts +0 -9
- package/umd/typings/src/commands/X_INSTRUMENT/InstrumentCommand.d.ts +0 -9
- package/umd/typings/src/commands/X_INSTRUMENT/instrumentCommand.test.d.ts +0 -1
- package/umd/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +0 -9
- package/umd/typings/src/commands/_BOILERPLATE/BoilerplateCommand.d.ts +0 -10
- package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommand.test.d.ts +0 -1
- package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +0 -13
- package/umd/typings/src/commands/_common/parseCommand.d.ts +0 -12
- package/umd/typings/src/commands/_common/parseCommand.test.d.ts +0 -1
- package/umd/typings/src/commands/_common/types/Command.d.ts +0 -6
- package/umd/typings/src/commands/_common/types/CommandParser.d.ts +0 -64
- package/umd/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +0 -9
- package/umd/typings/src/commands/index.d.ts +0 -4
- package/umd/typings/src/config.d.ts +0 -87
- package/umd/typings/src/config.test.d.ts +0 -4
- package/umd/typings/src/conversion/pipelineJsonToString.d.ts +0 -16
- package/umd/typings/src/conversion/pipelineStringToJson.d.ts +0 -38
- package/umd/typings/src/conversion/pipelineStringToJson.test.d.ts +0 -1
- package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +0 -29
- package/umd/typings/src/conversion/pipelineStringToJsonSync.test.d.ts +0 -1
- package/umd/typings/src/conversion/prettify/PrettifyOptions.d.ts +0 -13
- package/umd/typings/src/conversion/prettify/prettifyPipelineString.d.ts +0 -12
- package/umd/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +0 -27
- package/umd/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.d.ts +0 -14
- package/umd/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.test.d.ts +0 -1
- package/umd/typings/src/conversion/utils/extractVariables.d.ts +0 -14
- package/umd/typings/src/conversion/utils/extractVariables.test.d.ts +0 -1
- package/umd/typings/src/conversion/utils/renameParameter.d.ts +0 -26
- package/umd/typings/src/conversion/utils/renameParameter.test.d.ts +0 -1
- package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +0 -16
- package/umd/typings/src/conversion/utils/stringifyPipelineJson.test.d.ts +0 -1
- package/umd/typings/src/conversion/utils/titleToName.d.ts +0 -9
- package/umd/typings/src/conversion/utils/titleToName.test.d.ts +0 -1
- package/umd/typings/src/conversion/validation/_importPipeline.d.ts +0 -22
- package/umd/typings/src/conversion/validation/pipelineStringToJson-syntaxErrors.test.d.ts +0 -1
- package/umd/typings/src/conversion/validation/validatePipeline-logicErrors.test.d.ts +0 -4
- package/umd/typings/src/conversion/validation/validatePipeline.d.ts +0 -37
- package/umd/typings/src/conversion/validation/validatePipeline.test.d.ts +0 -1
- package/umd/typings/src/errors/CollectionError.d.ts +0 -9
- package/umd/typings/src/errors/EnvironmentMismatchError.d.ts +0 -9
- package/umd/typings/src/errors/LimitReachedError.d.ts +0 -9
- package/umd/typings/src/errors/NotFoundError.d.ts +0 -9
- package/umd/typings/src/errors/NotYetImplementedError.d.ts +0 -9
- package/umd/typings/src/errors/ParsingError.d.ts +0 -9
- package/umd/typings/src/errors/PipelineExecutionError.d.ts +0 -9
- package/umd/typings/src/errors/PipelineLogicError.d.ts +0 -9
- package/umd/typings/src/errors/ReferenceError.d.ts +0 -9
- package/umd/typings/src/errors/UnexpectedError.d.ts +0 -9
- package/umd/typings/src/errors/VersionMismatchError.d.ts +0 -10
- package/umd/typings/src/errors/_ExpectError.d.ts +0 -10
- package/umd/typings/src/execution/CommonExecutionToolsOptions.d.ts +0 -10
- package/umd/typings/src/execution/EmbeddingVector.d.ts +0 -8
- package/umd/typings/src/execution/ExecutionTools.d.ts +0 -33
- package/umd/typings/src/execution/LlmExecutionTools.d.ts +0 -72
- package/umd/typings/src/execution/PipelineExecutor.d.ts +0 -64
- package/umd/typings/src/execution/PromptResult.d.ts +0 -99
- package/umd/typings/src/execution/PromptResultUsage.d.ts +0 -29
- package/umd/typings/src/execution/ScriptExecutionTools.d.ts +0 -39
- package/umd/typings/src/execution/UncertainNumber.d.ts +0 -18
- package/umd/typings/src/execution/UserInterfaceTools.d.ts +0 -46
- package/umd/typings/src/execution/assertsExecutionSuccessful.d.ts +0 -12
- package/umd/typings/src/execution/createPipelineExecutor.d.ts +0 -71
- package/umd/typings/src/execution/embeddingVectorToString.d.ts +0 -7
- package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +0 -4
- package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +0 -9
- package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +0 -5
- package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +0 -11
- package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +0 -4
- package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +0 -7
- package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +0 -1
- package/umd/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +0 -5
- package/umd/typings/src/execution/utils/addUsage.d.ts +0 -65
- package/umd/typings/src/execution/utils/addUsage.test.d.ts +0 -1
- package/umd/typings/src/execution/utils/checkExpectations.d.ts +0 -27
- package/umd/typings/src/execution/utils/checkExpectations.test.d.ts +0 -1
- package/umd/typings/src/execution/utils/computeUsageCounts.d.ts +0 -10
- package/umd/typings/src/execution/utils/forEachAsync.d.ts +0 -19
- package/umd/typings/src/execution/utils/uncertainNumber.d.ts +0 -9
- package/umd/typings/src/execution/utils/usageToHuman.d.ts +0 -17
- package/umd/typings/src/execution/utils/usageToHuman.test.d.ts +0 -1
- package/umd/typings/src/execution/utils/usageToWorktime.d.ts +0 -12
- package/umd/typings/src/execution/utils/usageToWorktime.test.d.ts +0 -1
- package/umd/typings/src/expectations/drafts/isDomainNameFree.d.ts +0 -6
- package/umd/typings/src/expectations/drafts/isGithubNameFree.d.ts +0 -6
- package/umd/typings/src/formats/_common/FormatDefinition.d.ts +0 -70
- package/umd/typings/src/formats/csv/ListFormatDefinition.d.ts +0 -12
- package/umd/typings/src/formats/index.d.ts +0 -4
- package/umd/typings/src/formats/json/JsonFormatDefinition.d.ts +0 -16
- package/umd/typings/src/formats/json/utils/isValidJsonString.d.ts +0 -6
- package/umd/typings/src/formats/json/utils/isValidJsonString.test.d.ts +0 -1
- package/umd/typings/src/formats/list/ListFormatDefinition.d.ts +0 -14
- package/umd/typings/src/formats/xml/XmlFormatDefinition.d.ts +0 -16
- package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceTools.d.ts +0 -17
- package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +0 -14
- package/umd/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +0 -22
- package/umd/typings/src/knowledge/dialogs/user-interface-execution-tools.test.d.ts +0 -1
- package/umd/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +0 -37
- package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +0 -18
- package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.test.d.ts +0 -1
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/playground/markdown-knowledge-playground.d.ts +0 -2
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +0 -14
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +0 -4
- package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +0 -13
- package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts +0 -1
- package/umd/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +0 -37
- package/umd/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +0 -20
- package/umd/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +0 -21
- package/umd/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +0 -29
- package/umd/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +0 -16
- package/umd/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +0 -19
- package/umd/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +0 -15
- package/umd/typings/src/llm-providers/_common/utils/count-total-usage/countTotalUsage.d.ts +0 -17
- package/umd/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +0 -36
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +0 -52
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +0 -12
- package/umd/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +0 -22
- package/umd/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +0 -6
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +0 -50
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +0 -36
- package/umd/typings/src/llm-providers/azure-openai/playground/playground.d.ts +0 -5
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +0 -17
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +0 -13
- package/umd/typings/src/llm-providers/langtail/playground/playground.d.ts +0 -2
- package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +0 -36
- package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +0 -40
- package/umd/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +0 -14
- package/umd/typings/src/llm-providers/mocked/test/fakeTextToExpectations.test.d.ts +0 -1
- package/umd/typings/src/llm-providers/mocked/test/faked-completion.test.d.ts +0 -1
- package/umd/typings/src/llm-providers/mocked/test/joker.test.d.ts +0 -4
- package/umd/typings/src/llm-providers/mocked/test/mocked-chat.test.d.ts +0 -5
- package/umd/typings/src/llm-providers/mocked/test/mocked-completion.test.d.ts +0 -4
- package/umd/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +0 -54
- package/umd/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +0 -21
- package/umd/typings/src/llm-providers/multiple/playground/playground.d.ts +0 -2
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +0 -68
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +0 -20
- package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +0 -14
- package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.test.d.ts +0 -1
- package/umd/typings/src/llm-providers/openai/computeUsage.d.ts +0 -16
- package/umd/typings/src/llm-providers/openai/computeUsage.test.d.ts +0 -1
- package/umd/typings/src/llm-providers/openai/openai-models.d.ts +0 -29
- package/umd/typings/src/llm-providers/openai/playground/playground.d.ts +0 -5
- package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +0 -56
- package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +0 -26
- package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Error.d.ts +0 -11
- package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Progress.d.ts +0 -12
- package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Request.d.ts +0 -17
- package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Response.d.ts +0 -12
- package/umd/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +0 -37
- package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +0 -21
- package/umd/typings/src/personas/preparePersona.d.ts +0 -15
- package/umd/typings/src/personas/preparePersona.test.d.ts +0 -1
- package/umd/typings/src/postprocessing/utils/extractBlock.d.ts +0 -17
- package/umd/typings/src/prepare/PrepareOptions.d.ts +0 -22
- package/umd/typings/src/prepare/isPipelinePrepared.d.ts +0 -15
- package/umd/typings/src/prepare/isPipelinePrepared.test.d.ts +0 -1
- package/umd/typings/src/prepare/preparePipeline.d.ts +0 -16
- package/umd/typings/src/prepare/prepareTemplates.d.ts +0 -32
- package/umd/typings/src/prepare/unpreparePipeline.d.ts +0 -12
- package/umd/typings/src/scripting/_test/custom-function-async.test.ts.test.d.ts +0 -1
- package/umd/typings/src/scripting/_test/custom-function-missing.test.d.ts +0 -1
- package/umd/typings/src/scripting/_test/custom-function-with-dependencies.test.d.ts +0 -1
- package/umd/typings/src/scripting/_test/custom-function.test.d.ts +0 -1
- package/umd/typings/src/scripting/_test/postprocessing.test.d.ts +0 -1
- package/umd/typings/src/scripting/_test/script-execution-errors.test.d.ts +0 -1
- package/umd/typings/src/scripting/_test/script-execution-tools.test.d.ts +0 -1
- package/umd/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +0 -22
- package/umd/typings/src/scripting/javascript/JavascriptEvalExecutionTools.test.d.ts +0 -4
- package/umd/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +0 -8
- package/umd/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +0 -26
- package/umd/typings/src/scripting/javascript/postprocessing-functions.d.ts +0 -51
- package/umd/typings/src/scripting/javascript/utils/preserve.d.ts +0 -12
- package/umd/typings/src/scripting/javascript/utils/unknownToString.d.ts +0 -8
- package/umd/typings/src/scripting/python/PythonExecutionTools.d.ts +0 -16
- package/umd/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +0 -16
- package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +0 -24
- package/umd/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +0 -5
- package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +0 -31
- package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +0 -10
- package/umd/typings/src/storage/files-storage/utils/nameToSubfolderPath.d.ts +0 -7
- package/umd/typings/src/storage/files-storage/utils/nameToSubfolderPath.test.d.ts +0 -1
- package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +0 -10
- package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +0 -10
- package/umd/typings/src/storage/memory/MemoryStorage.d.ts +0 -33
- package/umd/typings/src/storage/utils/PrefixStorage.d.ts +0 -25
- package/umd/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -11
- package/umd/typings/src/types/Arrayable.d.ts +0 -10
- package/umd/typings/src/types/ModelRequirements.d.ts +0 -102
- package/umd/typings/src/types/ModelVariant.d.ts +0 -14
- package/umd/typings/src/types/PipelineJson/Expectations.d.ts +0 -32
- package/umd/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +0 -70
- package/umd/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +0 -27
- package/umd/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +0 -25
- package/umd/typings/src/types/PipelineJson/PersonaJson.d.ts +0 -41
- package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +0 -87
- package/umd/typings/src/types/PipelineJson/PreparationJson.d.ts +0 -22
- package/umd/typings/src/types/PipelineJson/PromptDialogJson.d.ts +0 -13
- package/umd/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +0 -13
- package/umd/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +0 -96
- package/umd/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +0 -36
- package/umd/typings/src/types/PipelineJson/ScriptJson.d.ts +0 -19
- package/umd/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +0 -12
- package/umd/typings/src/types/PipelineString.d.ts +0 -12
- package/umd/typings/src/types/Prompt.d.ts +0 -108
- package/umd/typings/src/types/ScriptLanguage.d.ts +0 -9
- package/umd/typings/src/types/TaskProgress.d.ts +0 -43
- package/umd/typings/src/types/execution-report/ExecutionReportJson.d.ts +0 -58
- package/umd/typings/src/types/execution-report/ExecutionReportString.d.ts +0 -16
- package/umd/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +0 -25
- package/umd/typings/src/types/execution-report/config.d.ts +0 -8
- package/umd/typings/src/types/execution-report/countWorkingDuration.d.ts +0 -7
- package/umd/typings/src/types/execution-report/countWorkingDuration.test.d.ts +0 -1
- package/umd/typings/src/types/execution-report/executionReportJsonToString.d.ts +0 -13
- package/umd/typings/src/types/typeAliasEmoji.d.ts +0 -9
- package/umd/typings/src/types/typeAliases.d.ts +0 -586
- package/umd/typings/src/utils/FromtoItems.d.ts +0 -19
- package/umd/typings/src/utils/arrayableToArray.d.ts +0 -11
- package/umd/typings/src/utils/arrayableToArray.test.d.ts +0 -1
- package/umd/typings/src/utils/currentDate.d.ts +0 -8
- package/umd/typings/src/utils/deepClone.d.ts +0 -10
- package/umd/typings/src/utils/deepFreeze.d.ts +0 -22
- package/umd/typings/src/utils/emojis.d.ts +0 -23
- package/umd/typings/src/utils/expectation-counters/countCharacters.d.ts +0 -7
- package/umd/typings/src/utils/expectation-counters/countCharacters.test.d.ts +0 -1
- package/umd/typings/src/utils/expectation-counters/countLines.d.ts +0 -7
- package/umd/typings/src/utils/expectation-counters/countLines.test.d.ts +0 -1
- package/umd/typings/src/utils/expectation-counters/countPages.d.ts +0 -7
- package/umd/typings/src/utils/expectation-counters/countPages.test.d.ts +0 -1
- package/umd/typings/src/utils/expectation-counters/countParagraphs.d.ts +0 -7
- package/umd/typings/src/utils/expectation-counters/countParagraphs.test.d.ts +0 -1
- package/umd/typings/src/utils/expectation-counters/countSentences.d.ts +0 -13
- package/umd/typings/src/utils/expectation-counters/countSentences.test.d.ts +0 -1
- package/umd/typings/src/utils/expectation-counters/countWords.d.ts +0 -7
- package/umd/typings/src/utils/expectation-counters/countWords.test.d.ts +0 -1
- package/umd/typings/src/utils/expectation-counters/index.d.ts +0 -8
- package/umd/typings/src/utils/extractParameterNames.d.ts +0 -10
- package/umd/typings/src/utils/extractParameterNames.test.d.ts +0 -1
- package/umd/typings/src/utils/formatNumber.d.ts +0 -6
- package/umd/typings/src/utils/formatNumber.test.d.ts +0 -1
- package/umd/typings/src/utils/getCurrentIsoDate.d.ts +0 -7
- package/umd/typings/src/utils/isRunningInWhatever.d.ts +0 -18
- package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +0 -14
- package/umd/typings/src/utils/markdown/addAutoGeneratedSection.test.d.ts +0 -1
- package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +0 -38
- package/umd/typings/src/utils/markdown/createMarkdownChart.test.d.ts +0 -1
- package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +0 -11
- package/umd/typings/src/utils/markdown/createMarkdownTable.test.d.ts +0 -1
- package/umd/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +0 -11
- package/umd/typings/src/utils/markdown/escapeMarkdownBlock.test.d.ts +0 -1
- package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown-real.test.d.ts +0 -1
- package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +0 -34
- package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.test.d.ts +0 -1
- package/umd/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +0 -15
- package/umd/typings/src/utils/markdown/extractAllListItemsFromMarkdown.test.d.ts +0 -1
- package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +0 -20
- package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.test.d.ts +0 -1
- package/umd/typings/src/utils/markdown/flattenMarkdown.d.ts +0 -17
- package/umd/typings/src/utils/markdown/flattenMarkdown.test.d.ts +0 -1
- package/umd/typings/src/utils/markdown/parseMarkdownSection.d.ts +0 -34
- package/umd/typings/src/utils/markdown/parseMarkdownSection.test.d.ts +0 -1
- package/umd/typings/src/utils/markdown/prettifyMarkdown.d.ts +0 -9
- package/umd/typings/src/utils/markdown/prettifyMarkdown.test.d.ts +0 -1
- package/umd/typings/src/utils/markdown/removeContentComments.d.ts +0 -10
- package/umd/typings/src/utils/markdown/removeContentComments.test.d.ts +0 -1
- package/umd/typings/src/utils/markdown/removeMarkdownFormatting.d.ts +0 -9
- package/umd/typings/src/utils/markdown/removeMarkdownFormatting.test.d.ts +0 -1
- package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +0 -15
- package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +0 -12
- package/umd/typings/src/utils/normalization/IKeywords.d.ts +0 -21
- package/umd/typings/src/utils/normalization/capitalize.d.ts +0 -6
- package/umd/typings/src/utils/normalization/capitalize.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/decapitalize.d.ts +0 -6
- package/umd/typings/src/utils/normalization/decapitalize.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/isValidKeyword.d.ts +0 -10
- package/umd/typings/src/utils/normalization/isValidKeyword.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/nameToUriPart.d.ts +0 -9
- package/umd/typings/src/utils/normalization/nameToUriPart.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/nameToUriParts.d.ts +0 -9
- package/umd/typings/src/utils/normalization/nameToUriParts.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +0 -18
- package/umd/typings/src/utils/normalization/normalize-to-kebab-case.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +0 -17
- package/umd/typings/src/utils/normalization/normalizeTo_PascalCase.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +0 -26
- package/umd/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +0 -22
- package/umd/typings/src/utils/normalization/normalizeTo_camelCase.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +0 -17
- package/umd/typings/src/utils/normalization/normalizeTo_snake_case.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/normalizeWhitespaces.d.ts +0 -4
- package/umd/typings/src/utils/normalization/normalizeWhitespaces.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/parseKeywords.d.ts +0 -16
- package/umd/typings/src/utils/normalization/parseKeywords.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/parseKeywordsFromString.d.ts +0 -9
- package/umd/typings/src/utils/normalization/parseKeywordsFromString.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/removeDiacritics.d.ts +0 -11
- package/umd/typings/src/utils/normalization/removeDiacritics.test.d.ts +0 -1
- package/umd/typings/src/utils/normalization/searchKeywords.d.ts +0 -10
- package/umd/typings/src/utils/normalization/searchKeywords.test.d.ts +0 -1
- package/umd/typings/src/utils/organization/TODO_USE.d.ts +0 -12
- package/umd/typings/src/utils/organization/TODO_any.d.ts +0 -6
- package/umd/typings/src/utils/organization/TODO_object.d.ts +0 -6
- package/umd/typings/src/utils/organization/TODO_unknown.d.ts +0 -6
- package/umd/typings/src/utils/organization/___.d.ts +0 -6
- package/umd/typings/src/utils/organization/just.d.ts +0 -14
- package/umd/typings/src/utils/organization/keepUnused.d.ts +0 -16
- package/umd/typings/src/utils/organization/really_any.d.ts +0 -6
- package/umd/typings/src/utils/organization/really_unknown.d.ts +0 -6
- package/umd/typings/src/utils/parseNumber.d.ts +0 -16
- package/umd/typings/src/utils/parseNumber.test.d.ts +0 -1
- package/umd/typings/src/utils/random/randomSeed.d.ts +0 -8
- package/umd/typings/src/utils/removeEmojis.d.ts +0 -8
- package/umd/typings/src/utils/removeEmojis.test.d.ts +0 -1
- package/umd/typings/src/utils/removeQuotes.d.ts +0 -14
- package/umd/typings/src/utils/removeQuotes.test.d.ts +0 -1
- package/umd/typings/src/utils/replaceParameters.d.ts +0 -12
- package/umd/typings/src/utils/replaceParameters.test.d.ts +0 -1
- package/umd/typings/src/utils/sets/difference.d.ts +0 -10
- package/umd/typings/src/utils/sets/difference.test.d.ts +0 -1
- package/umd/typings/src/utils/sets/intersection.d.ts +0 -7
- package/umd/typings/src/utils/sets/intersection.test.d.ts +0 -1
- package/umd/typings/src/utils/sets/union.d.ts +0 -7
- package/umd/typings/src/utils/sets/union.test.d.ts +0 -1
- package/umd/typings/src/utils/trimCodeBlock.d.ts +0 -9
- package/umd/typings/src/utils/trimCodeBlock.test.d.ts +0 -1
- package/umd/typings/src/utils/trimEndOfCodeBlock.d.ts +0 -9
- package/umd/typings/src/utils/trimEndOfCodeBlock.test.d.ts +0 -1
- package/umd/typings/src/utils/unwrapResult.d.ts +0 -37
- package/umd/typings/src/utils/unwrapResult.test.d.ts +0 -1
- package/umd/typings/src/utils/validators/email/isValidEmail.d.ts +0 -6
- package/umd/typings/src/utils/validators/email/isValidEmail.test.d.ts +0 -1
- package/umd/typings/src/utils/validators/filePath/isValidFilePath.d.ts +0 -9
- package/umd/typings/src/utils/validators/filePath/isValidFilePath.test.d.ts +0 -1
- package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +0 -10
- package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.test.d.ts +0 -1
- package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +0 -15
- package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.test.d.ts +0 -1
- package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +0 -12
- package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.test.d.ts +0 -1
- package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +0 -11
- package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.test.d.ts +0 -1
- package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +0 -13
- package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.test.d.ts +0 -1
- package/umd/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +0 -15
- package/umd/typings/src/utils/validators/url/isValidPipelineUrl.test.d.ts +0 -1
- package/umd/typings/src/utils/validators/url/isValidUrl.d.ts +0 -13
- package/umd/typings/src/utils/validators/url/isValidUrl.test.d.ts +0 -1
- package/umd/typings/src/utils/validators/uuid/isValidUuid.d.ts +0 -8
- package/umd/typings/src/utils/validators/uuid/isValidUuid.test.d.ts +0 -1
- package/umd/typings/src/version.d.ts +0 -6
package/README.md
CHANGED
|
@@ -372,11 +372,11 @@ Or you can install them separately:
|
|
|
372
372
|
> ⭐ Marked packages are worth to try first
|
|
373
373
|
|
|
374
374
|
|
|
375
|
-
|
|
376
375
|
- ⭐ **[ptbk](https://www.npmjs.com/package/ptbk)** - Bundle of all packages, when you want to install everything and you don't care about the size
|
|
377
376
|
- **[promptbook](https://www.npmjs.com/package/promptbook)** - Same as `ptbk`
|
|
378
377
|
- **[@promptbook/core](https://www.npmjs.com/package/@promptbook/core)** - Core of the library, it contains the main logic for promptbooks
|
|
379
|
-
- **[@promptbook/node](https://www.npmjs.com/package/@promptbook/node)** - Core of the library for Node.js
|
|
378
|
+
- **[@promptbook/node](https://www.npmjs.com/package/@promptbook/node)** - Core of the library for Node.js environment
|
|
379
|
+
- **[@promptbook/browser](https://www.npmjs.com/package/@promptbook/browser)** - Core of the library for browser environment
|
|
380
380
|
- ⭐ **[@promptbook/utils](https://www.npmjs.com/package/@promptbook/utils)** - Utility functions used in the library but also useful for individual use in preprocessing and postprocessing LLM inputs and outputs
|
|
381
381
|
- **[@promptbook/markdown-utils](https://www.npmjs.com/package/@promptbook/markdown-utils)** - Utility functions used for processing markdown
|
|
382
382
|
- _(Not finished)_ **[@promptbook/wizzard](https://www.npmjs.com/package/@promptbook/wizzard)** - Wizard for creating+running promptbooks in single line
|
package/esm/index.es.js
CHANGED
|
@@ -2,10 +2,11 @@ import commander from 'commander';
|
|
|
2
2
|
import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
3
3
|
import colors from 'colors';
|
|
4
4
|
import { forTime } from 'waitasecond';
|
|
5
|
-
import { access, constants, readFile,
|
|
6
|
-
import { join, dirname } from 'path';
|
|
5
|
+
import { readdir, access, constants, readFile, stat, writeFile, mkdir, unlink } from 'fs/promises';
|
|
6
|
+
import { join as join$1, dirname } from 'path';
|
|
7
7
|
import { format } from 'prettier';
|
|
8
8
|
import parserHtml from 'prettier/parser-html';
|
|
9
|
+
import { join } from 'path/posix';
|
|
9
10
|
import hexEncoder from 'crypto-js/enc-hex';
|
|
10
11
|
import sha256 from 'crypto-js/sha256';
|
|
11
12
|
import * as dotenv from 'dotenv';
|
|
@@ -16,7 +17,7 @@ import glob from 'glob-promise';
|
|
|
16
17
|
/**
|
|
17
18
|
* The version of the Promptbook library
|
|
18
19
|
*/
|
|
19
|
-
var PROMPTBOOK_VERSION = '0.63.0-
|
|
20
|
+
var PROMPTBOOK_VERSION = '0.63.0-2';
|
|
20
21
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
21
22
|
|
|
22
23
|
/*! *****************************************************************************
|
|
@@ -138,6 +139,22 @@ function __spreadArray(to, from, pack) {
|
|
|
138
139
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
/**
|
|
143
|
+
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
144
|
+
*
|
|
145
|
+
* @public exported from `@promptbook/core`
|
|
146
|
+
*/
|
|
147
|
+
var EnvironmentMismatchError = /** @class */ (function (_super) {
|
|
148
|
+
__extends(EnvironmentMismatchError, _super);
|
|
149
|
+
function EnvironmentMismatchError(message) {
|
|
150
|
+
var _this = _super.call(this, message) || this;
|
|
151
|
+
_this.name = 'EnvironmentMismatchError';
|
|
152
|
+
Object.setPrototypeOf(_this, EnvironmentMismatchError.prototype);
|
|
153
|
+
return _this;
|
|
154
|
+
}
|
|
155
|
+
return EnvironmentMismatchError;
|
|
156
|
+
}(Error));
|
|
157
|
+
|
|
141
158
|
/**
|
|
142
159
|
* Detects if the code is running in a browser environment in main thread (Not in a web worker)
|
|
143
160
|
*
|
|
@@ -160,7 +177,7 @@ new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined'
|
|
|
160
177
|
/**
|
|
161
178
|
* Initializes testing `hello` command for Promptbook CLI utilities
|
|
162
179
|
*
|
|
163
|
-
* @private
|
|
180
|
+
* @private internal function of `promptbookCli`
|
|
164
181
|
*/
|
|
165
182
|
function initializeHelloCommand(program) {
|
|
166
183
|
var _this = this;
|
|
@@ -220,9 +237,10 @@ function collectionToJson(collection) {
|
|
|
220
237
|
/**
|
|
221
238
|
* @@@
|
|
222
239
|
*
|
|
223
|
-
* @returns The same object as the input, but deeply frozen
|
|
224
|
-
*
|
|
225
240
|
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
241
|
+
*
|
|
242
|
+
* @returns The same object as the input, but deeply frozen
|
|
243
|
+
* @public exported from `@promptbook/utils`
|
|
226
244
|
*/
|
|
227
245
|
function deepFreeze(objectValue) {
|
|
228
246
|
var e_1, _a;
|
|
@@ -249,10 +267,10 @@ function deepFreeze(objectValue) {
|
|
|
249
267
|
* @@@
|
|
250
268
|
* @@@
|
|
251
269
|
*
|
|
252
|
-
* @returns The same object as the input, but deeply frozen
|
|
253
|
-
* @public exported from `@promptbook/utils`
|
|
254
|
-
*
|
|
255
270
|
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
271
|
+
*
|
|
272
|
+
* @returns The same object as the input, but deeply frozen
|
|
273
|
+
* @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
|
|
256
274
|
*/
|
|
257
275
|
function deepFreezeWithSameType(objectValue) {
|
|
258
276
|
return deepFreeze(objectValue);
|
|
@@ -264,7 +282,7 @@ function deepFreezeWithSameType(objectValue) {
|
|
|
264
282
|
/**
|
|
265
283
|
* The maximum number of iterations for a loops
|
|
266
284
|
*
|
|
267
|
-
* @private within the repository - too low-level in comparison
|
|
285
|
+
* @private within the repository - too low-level in comparison with other `MAX_...`
|
|
268
286
|
*/
|
|
269
287
|
var LOOP_LIMIT = 1000;
|
|
270
288
|
/**
|
|
@@ -299,6 +317,8 @@ var EXECUTIONS_CACHE_DIRNAME = '/.promptbook/executions-cache';
|
|
|
299
317
|
var PIPELINE_COLLECTION_BASE_FILENAME = "index";
|
|
300
318
|
/**
|
|
301
319
|
* Nonce which is used for replacing things in strings
|
|
320
|
+
*
|
|
321
|
+
* @private within the repository
|
|
302
322
|
*/
|
|
303
323
|
var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
|
|
304
324
|
/**
|
|
@@ -328,13 +348,6 @@ var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
|
328
348
|
* @private within the repository
|
|
329
349
|
*/
|
|
330
350
|
var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
|
|
331
|
-
/*
|
|
332
|
-
TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
|
|
333
|
-
*/
|
|
334
|
-
// [🟡][🟢][🔵][⚪]
|
|
335
|
-
/**
|
|
336
|
-
* TODO: !!!!!! Check that all @private contains some normalized explanation
|
|
337
|
-
*/
|
|
338
351
|
|
|
339
352
|
/**
|
|
340
353
|
* Prettify the html code
|
|
@@ -565,7 +578,7 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
565
578
|
return pipelineString;
|
|
566
579
|
}
|
|
567
580
|
/**
|
|
568
|
-
* @private internal
|
|
581
|
+
* @private internal utility of `pipelineJsonToString`
|
|
569
582
|
*/
|
|
570
583
|
function promptTemplateParameterJsonToString(promptTemplateParameterJson) {
|
|
571
584
|
var name = promptTemplateParameterJson.name, description = promptTemplateParameterJson.description;
|
|
@@ -778,7 +791,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
778
791
|
});
|
|
779
792
|
}
|
|
780
793
|
|
|
781
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.63.0-
|
|
794
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.63.0-2",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-2",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-2",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-2",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-2",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-2",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-2",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-2",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"}];
|
|
782
795
|
|
|
783
796
|
/**
|
|
784
797
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -1312,7 +1325,7 @@ function unpreparePipeline(pipeline) {
|
|
|
1312
1325
|
* Library of pipelines that groups together pipelines for an application.
|
|
1313
1326
|
* This implementation is a very thin wrapper around the Array / Map of pipelines.
|
|
1314
1327
|
*
|
|
1315
|
-
* @private use `createCollectionFromJson` instead
|
|
1328
|
+
* @private internal function of `createCollectionFromJson`, use `createCollectionFromJson` instead
|
|
1316
1329
|
* @see https://github.com/webgptorg/pipeline#pipeline-collection
|
|
1317
1330
|
*/
|
|
1318
1331
|
var SimplePipelineCollection = /** @class */ (function () {
|
|
@@ -1321,7 +1334,6 @@ var SimplePipelineCollection = /** @class */ (function () {
|
|
|
1321
1334
|
*
|
|
1322
1335
|
* @param pipelines @@@
|
|
1323
1336
|
*
|
|
1324
|
-
* @private Use instead `createCollectionFromJson`
|
|
1325
1337
|
* Note: During the construction logic of all pipelines are validated
|
|
1326
1338
|
* Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
|
|
1327
1339
|
*/
|
|
@@ -1936,7 +1948,8 @@ function extractParameterNamesFromPromptTemplate(promptTemplate) {
|
|
|
1936
1948
|
/**
|
|
1937
1949
|
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
1938
1950
|
*
|
|
1939
|
-
* @private
|
|
1951
|
+
* @private error of `checkExpectations` and `createPipelineExecutor`
|
|
1952
|
+
* Note: Always thrown in `checkExpectations` and catched in `createPipelineExecutor` and rethrown as `PipelineExecutionError`
|
|
1940
1953
|
* Note: This is a kindof subtype of PipelineExecutionError
|
|
1941
1954
|
*/
|
|
1942
1955
|
var ExpectError = /** @class */ (function (_super) {
|
|
@@ -1974,7 +1987,7 @@ function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
|
1974
1987
|
/**
|
|
1975
1988
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
1976
1989
|
*
|
|
1977
|
-
* @private
|
|
1990
|
+
* @private internal utility of `joinLlmExecutionTools`
|
|
1978
1991
|
*/
|
|
1979
1992
|
var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
1980
1993
|
/**
|
|
@@ -2257,7 +2270,7 @@ function isPipelinePrepared(pipeline) {
|
|
|
2257
2270
|
* 2) Undefined returns empty array
|
|
2258
2271
|
* 3) Array returns itself
|
|
2259
2272
|
*
|
|
2260
|
-
* @private
|
|
2273
|
+
* @private internal utility
|
|
2261
2274
|
*/
|
|
2262
2275
|
function arrayableToArray(input) {
|
|
2263
2276
|
if (input === undefined) {
|
|
@@ -2555,7 +2568,7 @@ var CountUtils = {
|
|
|
2555
2568
|
*
|
|
2556
2569
|
* @throws {ExpectError} if the expectations are not met
|
|
2557
2570
|
* @returns {void} Nothing
|
|
2558
|
-
* @
|
|
2571
|
+
* @private internal function of `createPipelineExecutor`
|
|
2559
2572
|
*/
|
|
2560
2573
|
function checkExpectations(expectations, value) {
|
|
2561
2574
|
var e_1, _a;
|
|
@@ -4236,7 +4249,9 @@ var blockCommandParser = {
|
|
|
4236
4249
|
|
|
4237
4250
|
/**
|
|
4238
4251
|
* Units of text measurement
|
|
4252
|
+
*
|
|
4239
4253
|
* @see https://github.com/webgptorg/promptbook/discussions/30
|
|
4254
|
+
* @private internal base for `ExpectationUnit`
|
|
4240
4255
|
*/
|
|
4241
4256
|
var EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', 'LINES', 'PARAGRAPHS', 'PAGES'];
|
|
4242
4257
|
/**
|
|
@@ -4476,7 +4491,7 @@ var jokerCommandParser = {
|
|
|
4476
4491
|
/**
|
|
4477
4492
|
* @@@
|
|
4478
4493
|
*
|
|
4479
|
-
* @private for `ModelVariant` and `modelCommandParser`
|
|
4494
|
+
* @private internal base for `ModelVariant` and `modelCommandParser`
|
|
4480
4495
|
*/
|
|
4481
4496
|
var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
|
|
4482
4497
|
|
|
@@ -4941,11 +4956,12 @@ var boilerplateCommandParser = {
|
|
|
4941
4956
|
};
|
|
4942
4957
|
/**
|
|
4943
4958
|
* TODO: [💐] Implement BOILERPLATE command into `pipelineStringToJsonSync` function
|
|
4944
|
-
* Note: [⚪] This should never be in any released package
|
|
4945
4959
|
*/
|
|
4946
4960
|
|
|
4947
4961
|
/**
|
|
4948
4962
|
* All available command parsers
|
|
4963
|
+
*
|
|
4964
|
+
* @private internal index of `parseCommand`
|
|
4949
4965
|
*/
|
|
4950
4966
|
var COMMANDS = [
|
|
4951
4967
|
blockCommandParser,
|
|
@@ -5115,6 +5131,8 @@ var NotYetImplementedError = /** @class */ (function (_super) {
|
|
|
5115
5131
|
|
|
5116
5132
|
/**
|
|
5117
5133
|
* Supported script languages
|
|
5134
|
+
*
|
|
5135
|
+
* @private internal base for `ScriptLanguage`
|
|
5118
5136
|
*/
|
|
5119
5137
|
var SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
|
|
5120
5138
|
|
|
@@ -5255,7 +5273,7 @@ function extractOneBlockFromMarkdown(markdown) {
|
|
|
5255
5273
|
return codeBlocks[0];
|
|
5256
5274
|
}
|
|
5257
5275
|
/***
|
|
5258
|
-
* TODO: [🍓][🌻] Decide of this is internal
|
|
5276
|
+
* TODO: [🍓][🌻] Decide of this is internal utility, external util OR validator/postprocessor
|
|
5259
5277
|
*/
|
|
5260
5278
|
|
|
5261
5279
|
/**
|
|
@@ -5872,6 +5890,69 @@ var CollectionError = /** @class */ (function (_super) {
|
|
|
5872
5890
|
return CollectionError;
|
|
5873
5891
|
}(Error));
|
|
5874
5892
|
|
|
5893
|
+
/**
|
|
5894
|
+
* Reads all files in the directory
|
|
5895
|
+
*
|
|
5896
|
+
* @param path
|
|
5897
|
+
* @param isRecursive
|
|
5898
|
+
* @returns List of all files in the directory
|
|
5899
|
+
* @private internal function of `createCollectionFromDirectory`
|
|
5900
|
+
*/
|
|
5901
|
+
function listAllFiles(path, isRecursive) {
|
|
5902
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5903
|
+
var dirents, fileNames, _a, _b, dirent, subPath, _c, _d, _e, _f, e_1_1;
|
|
5904
|
+
var e_1, _g;
|
|
5905
|
+
return __generator(this, function (_h) {
|
|
5906
|
+
switch (_h.label) {
|
|
5907
|
+
case 0: return [4 /*yield*/, readdir(path, {
|
|
5908
|
+
withFileTypes: true /* Note: This is not working: recursive: isRecursive */,
|
|
5909
|
+
})];
|
|
5910
|
+
case 1:
|
|
5911
|
+
dirents = _h.sent();
|
|
5912
|
+
fileNames = dirents.filter(function (dirent) { return dirent.isFile(); }).map(function (_a) {
|
|
5913
|
+
var name = _a.name;
|
|
5914
|
+
return join(path, name);
|
|
5915
|
+
});
|
|
5916
|
+
if (!isRecursive) return [3 /*break*/, 9];
|
|
5917
|
+
_h.label = 2;
|
|
5918
|
+
case 2:
|
|
5919
|
+
_h.trys.push([2, 7, 8, 9]);
|
|
5920
|
+
_a = __values(dirents.filter(function (dirent) { return dirent.isDirectory(); })), _b = _a.next();
|
|
5921
|
+
_h.label = 3;
|
|
5922
|
+
case 3:
|
|
5923
|
+
if (!!_b.done) return [3 /*break*/, 6];
|
|
5924
|
+
dirent = _b.value;
|
|
5925
|
+
subPath = join(path, dirent.name);
|
|
5926
|
+
_d = (_c = fileNames.push).apply;
|
|
5927
|
+
_e = [fileNames];
|
|
5928
|
+
_f = [[]];
|
|
5929
|
+
return [4 /*yield*/, listAllFiles(subPath, isRecursive)];
|
|
5930
|
+
case 4:
|
|
5931
|
+
_d.apply(_c, _e.concat([__spreadArray.apply(void 0, _f.concat([__read.apply(void 0, [(_h.sent())]), false]))]));
|
|
5932
|
+
_h.label = 5;
|
|
5933
|
+
case 5:
|
|
5934
|
+
_b = _a.next();
|
|
5935
|
+
return [3 /*break*/, 3];
|
|
5936
|
+
case 6: return [3 /*break*/, 9];
|
|
5937
|
+
case 7:
|
|
5938
|
+
e_1_1 = _h.sent();
|
|
5939
|
+
e_1 = { error: e_1_1 };
|
|
5940
|
+
return [3 /*break*/, 9];
|
|
5941
|
+
case 8:
|
|
5942
|
+
try {
|
|
5943
|
+
if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
|
|
5944
|
+
}
|
|
5945
|
+
finally { if (e_1) throw e_1.error; }
|
|
5946
|
+
return [7 /*endfinally*/];
|
|
5947
|
+
case 9: return [2 /*return*/, fileNames];
|
|
5948
|
+
}
|
|
5949
|
+
});
|
|
5950
|
+
});
|
|
5951
|
+
}
|
|
5952
|
+
/**
|
|
5953
|
+
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
5954
|
+
*/
|
|
5955
|
+
|
|
5875
5956
|
/**
|
|
5876
5957
|
* Constructs Promptbook from async sources
|
|
5877
5958
|
* It can be one of the following:
|
|
@@ -5979,7 +6060,7 @@ function createCollectionFromDirectory(path, options) {
|
|
|
5979
6060
|
if (!isRunningInNode()) {
|
|
5980
6061
|
throw new Error('Function `createCollectionFromDirectory` can only be run in Node.js environment because it reads the file system.');
|
|
5981
6062
|
}
|
|
5982
|
-
makedLibraryFilePath = join(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".json"));
|
|
6063
|
+
makedLibraryFilePath = join$1(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".json"));
|
|
5983
6064
|
return [4 /*yield*/, access(makedLibraryFilePath, constants.R_OK)
|
|
5984
6065
|
.then(function () { return true; })
|
|
5985
6066
|
.catch(function () { return false; })];
|
|
@@ -6148,66 +6229,7 @@ function createCollectionFromDirectory(path, options) {
|
|
|
6148
6229
|
});
|
|
6149
6230
|
}
|
|
6150
6231
|
/**
|
|
6151
|
-
*
|
|
6152
|
-
*
|
|
6153
|
-
* @param path
|
|
6154
|
-
* @param isRecursive
|
|
6155
|
-
* @returns List of all files in the directory
|
|
6156
|
-
* @private internal function for `createCollectionFromDirectory`
|
|
6157
|
-
*/
|
|
6158
|
-
function listAllFiles(path, isRecursive) {
|
|
6159
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
6160
|
-
var dirents, fileNames, _a, _b, dirent, subPath, _c, _d, _e, _f, e_2_1;
|
|
6161
|
-
var e_2, _g;
|
|
6162
|
-
return __generator(this, function (_h) {
|
|
6163
|
-
switch (_h.label) {
|
|
6164
|
-
case 0: return [4 /*yield*/, readdir(path, {
|
|
6165
|
-
withFileTypes: true /* Note: This is not working: recursive: isRecursive */,
|
|
6166
|
-
})];
|
|
6167
|
-
case 1:
|
|
6168
|
-
dirents = _h.sent();
|
|
6169
|
-
fileNames = dirents.filter(function (dirent) { return dirent.isFile(); }).map(function (_a) {
|
|
6170
|
-
var name = _a.name;
|
|
6171
|
-
return join(path, name);
|
|
6172
|
-
});
|
|
6173
|
-
if (!isRecursive) return [3 /*break*/, 9];
|
|
6174
|
-
_h.label = 2;
|
|
6175
|
-
case 2:
|
|
6176
|
-
_h.trys.push([2, 7, 8, 9]);
|
|
6177
|
-
_a = __values(dirents.filter(function (dirent) { return dirent.isDirectory(); })), _b = _a.next();
|
|
6178
|
-
_h.label = 3;
|
|
6179
|
-
case 3:
|
|
6180
|
-
if (!!_b.done) return [3 /*break*/, 6];
|
|
6181
|
-
dirent = _b.value;
|
|
6182
|
-
subPath = join(path, dirent.name);
|
|
6183
|
-
_d = (_c = fileNames.push).apply;
|
|
6184
|
-
_e = [fileNames];
|
|
6185
|
-
_f = [[]];
|
|
6186
|
-
return [4 /*yield*/, listAllFiles(subPath, isRecursive)];
|
|
6187
|
-
case 4:
|
|
6188
|
-
_d.apply(_c, _e.concat([__spreadArray.apply(void 0, _f.concat([__read.apply(void 0, [(_h.sent())]), false]))]));
|
|
6189
|
-
_h.label = 5;
|
|
6190
|
-
case 5:
|
|
6191
|
-
_b = _a.next();
|
|
6192
|
-
return [3 /*break*/, 3];
|
|
6193
|
-
case 6: return [3 /*break*/, 9];
|
|
6194
|
-
case 7:
|
|
6195
|
-
e_2_1 = _h.sent();
|
|
6196
|
-
e_2 = { error: e_2_1 };
|
|
6197
|
-
return [3 /*break*/, 9];
|
|
6198
|
-
case 8:
|
|
6199
|
-
try {
|
|
6200
|
-
if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
|
|
6201
|
-
}
|
|
6202
|
-
finally { if (e_2) throw e_2.error; }
|
|
6203
|
-
return [7 /*endfinally*/];
|
|
6204
|
-
case 9: return [2 /*return*/, fileNames];
|
|
6205
|
-
}
|
|
6206
|
-
});
|
|
6207
|
-
});
|
|
6208
|
-
}
|
|
6209
|
-
/**
|
|
6210
|
-
* Note: [🟢] This code should never be published outside of `@pipeline/node`
|
|
6232
|
+
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
6211
6233
|
*/
|
|
6212
6234
|
|
|
6213
6235
|
/**
|
|
@@ -6279,22 +6301,6 @@ function usageToHuman(usage) {
|
|
|
6279
6301
|
* TODO: [🏛] Maybe make some markdown builder
|
|
6280
6302
|
*/
|
|
6281
6303
|
|
|
6282
|
-
/**
|
|
6283
|
-
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
6284
|
-
*
|
|
6285
|
-
* @public exported from `@promptbook/core`
|
|
6286
|
-
*/
|
|
6287
|
-
var EnvironmentMismatchError = /** @class */ (function (_super) {
|
|
6288
|
-
__extends(EnvironmentMismatchError, _super);
|
|
6289
|
-
function EnvironmentMismatchError(message) {
|
|
6290
|
-
var _this = _super.call(this, message) || this;
|
|
6291
|
-
_this.name = 'EnvironmentMismatchError';
|
|
6292
|
-
Object.setPrototypeOf(_this, EnvironmentMismatchError.prototype);
|
|
6293
|
-
return _this;
|
|
6294
|
-
}
|
|
6295
|
-
return EnvironmentMismatchError;
|
|
6296
|
-
}(Error));
|
|
6297
|
-
|
|
6298
6304
|
/**
|
|
6299
6305
|
* @@@
|
|
6300
6306
|
*
|
|
@@ -6322,7 +6328,7 @@ var FilesStorage = /** @class */ (function () {
|
|
|
6322
6328
|
FilesStorage.prototype.getFilenameForKey = function (key) {
|
|
6323
6329
|
var name = titleToName(key);
|
|
6324
6330
|
var hash = sha256(hexEncoder.parse(name)).toString( /* hex */);
|
|
6325
|
-
return join.apply(void 0, __spreadArray(__spreadArray([this.options.cacheFolderPath], __read(nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */)), false), ["".concat(name.substring(0, MAX_FILENAME_LENGTH), ".json")], false));
|
|
6331
|
+
return join$1.apply(void 0, __spreadArray(__spreadArray([this.options.cacheFolderPath], __read(nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */)), false), ["".concat(name.substring(0, MAX_FILENAME_LENGTH), ".json")], false));
|
|
6326
6332
|
};
|
|
6327
6333
|
/**
|
|
6328
6334
|
* @@@ 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.
|
|
@@ -6398,7 +6404,7 @@ var FilesStorage = /** @class */ (function () {
|
|
|
6398
6404
|
}());
|
|
6399
6405
|
/**
|
|
6400
6406
|
* TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values
|
|
6401
|
-
* Note: [🟢] This code should never be published outside of `@promptbook/node`
|
|
6407
|
+
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
6402
6408
|
*/
|
|
6403
6409
|
|
|
6404
6410
|
/**
|
|
@@ -6407,7 +6413,7 @@ var FilesStorage = /** @class */ (function () {
|
|
|
6407
6413
|
* @param content the content of prompt or response
|
|
6408
6414
|
* @returns part of PromptResultUsageCounts
|
|
6409
6415
|
*
|
|
6410
|
-
* @private internal
|
|
6416
|
+
* @private internal utility of LlmExecutionTools
|
|
6411
6417
|
*/
|
|
6412
6418
|
function computeUsageCounts(content) {
|
|
6413
6419
|
return {
|
|
@@ -6437,7 +6443,7 @@ function uncertainNumber(value) {
|
|
|
6437
6443
|
/**
|
|
6438
6444
|
* Get current date in ISO 8601 format
|
|
6439
6445
|
*
|
|
6440
|
-
* @private
|
|
6446
|
+
* @private internal utility
|
|
6441
6447
|
*/
|
|
6442
6448
|
function getCurrentIsoDate() {
|
|
6443
6449
|
return new Date().toISOString();
|
|
@@ -6459,6 +6465,7 @@ function computeUsage(value) {
|
|
|
6459
6465
|
* Note: Done at 2024-05-25
|
|
6460
6466
|
*
|
|
6461
6467
|
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
6468
|
+
* @public exported from `@promptbook/anthropic-claude`
|
|
6462
6469
|
*/
|
|
6463
6470
|
var ANTHROPIC_CLAUDE_MODELS = [
|
|
6464
6471
|
{
|
|
@@ -7105,7 +7112,7 @@ var OPENAI_MODELS = [
|
|
|
7105
7112
|
* @param resultContent The content of the result (for embedding prompts or failed prompts pass empty string)
|
|
7106
7113
|
* @param rawResponse The raw response from OpenAI API
|
|
7107
7114
|
* @throws {PipelineExecutionError} If the usage is not defined in the response from OpenAI
|
|
7108
|
-
* @private internal
|
|
7115
|
+
* @private internal utility of `OpenAiExecutionTools`
|
|
7109
7116
|
*/
|
|
7110
7117
|
function computeOpenaiUsage(promptContent, // <- Note: Intentionally using [] to access type properties to bring jsdoc from Prompt/PromptResult to consumer
|
|
7111
7118
|
resultContent, rawResponse) {
|
|
@@ -7487,7 +7494,7 @@ function createLlmToolsFromEnv(options) {
|
|
|
7487
7494
|
* TODO: [🧠] Which name is better `createLlmToolsFromEnv` or `createLlmToolsFromEnvironment`?
|
|
7488
7495
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
7489
7496
|
* TODO: [🧠] Maybe pass env as argument
|
|
7490
|
-
* Note: [🟢] This code should never be published outside of `@promptbook/node`
|
|
7497
|
+
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
7491
7498
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
7492
7499
|
*/
|
|
7493
7500
|
|
|
@@ -7677,7 +7684,7 @@ function getLlmToolsForCli(options) {
|
|
|
7677
7684
|
return cacheLlmTools(countTotalUsage(
|
|
7678
7685
|
// <- Note: for example here we don`t want the [🌯]
|
|
7679
7686
|
createLlmToolsFromEnv()), {
|
|
7680
|
-
storage: new FilesStorage({ cacheFolderPath: join(process.cwd(), EXECUTIONS_CACHE_DIRNAME) }),
|
|
7687
|
+
storage: new FilesStorage({ cacheFolderPath: join$1(process.cwd(), EXECUTIONS_CACHE_DIRNAME) }),
|
|
7681
7688
|
isReloaded: isCacheReloaded,
|
|
7682
7689
|
});
|
|
7683
7690
|
}
|
|
@@ -7689,7 +7696,7 @@ function getLlmToolsForCli(options) {
|
|
|
7689
7696
|
/**
|
|
7690
7697
|
* Initializes `make` command for Promptbook CLI utilities
|
|
7691
7698
|
*
|
|
7692
|
-
* @private
|
|
7699
|
+
* @private internal function of `promptbookCli`
|
|
7693
7700
|
*/
|
|
7694
7701
|
function initializeMakeCommand(program) {
|
|
7695
7702
|
var _this = this;
|
|
@@ -7805,7 +7812,7 @@ function initializeMakeCommand(program) {
|
|
|
7805
7812
|
case 0:
|
|
7806
7813
|
filePath = outFile !== PIPELINE_COLLECTION_BASE_FILENAME
|
|
7807
7814
|
? outFile
|
|
7808
|
-
: join(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".").concat(extension));
|
|
7815
|
+
: join$1(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".").concat(extension));
|
|
7809
7816
|
if (!outFile.endsWith(".".concat(extension))) {
|
|
7810
7817
|
console.warn(colors.yellow("Warning: Extension of output file should be \"".concat(extension, "\"")));
|
|
7811
7818
|
}
|
|
@@ -8049,7 +8056,7 @@ function prettifyPipelineString(pipelineString, options) {
|
|
|
8049
8056
|
/**
|
|
8050
8057
|
* Initializes `prettify` command for Promptbook CLI utilities
|
|
8051
8058
|
*
|
|
8052
|
-
* @private
|
|
8059
|
+
* @private internal function of `promptbookCli`
|
|
8053
8060
|
*/
|
|
8054
8061
|
function initializePrettifyCommand(program) {
|
|
8055
8062
|
var _this = this;
|
|
@@ -8135,6 +8142,8 @@ function initializePrettifyCommand(program) {
|
|
|
8135
8142
|
|
|
8136
8143
|
/**
|
|
8137
8144
|
* Runs CLI utilities of Promptbook package
|
|
8145
|
+
*
|
|
8146
|
+
* @private within the `@promptbook/cli`
|
|
8138
8147
|
*/
|
|
8139
8148
|
function promptbookCli() {
|
|
8140
8149
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -8156,7 +8165,7 @@ function promptbookCli() {
|
|
|
8156
8165
|
});
|
|
8157
8166
|
}
|
|
8158
8167
|
/**
|
|
8159
|
-
* TODO: [🥠] Do not export
|
|
8168
|
+
* TODO: [🥠] Do not export, its just for CLI script
|
|
8160
8169
|
* TODO: [🕌] When more functionalities, rename
|
|
8161
8170
|
* Note: 11:11
|
|
8162
8171
|
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|