@promptbook/cli 0.63.0-2 → 0.63.0-4
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 +4 -2
- package/esm/index.es.js +134 -117
- 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 +19 -5
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +1 -0
- 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/execution-report/executionReportJsonToString.d.ts +1 -0
- 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 +131 -115
- 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
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
<!-- ⚠️ WARNING: This section has been generated so that any manual changes will be overwritten -->
|
|
2
|
+
|
|
1
3
|
#  Promptbook
|
|
2
4
|
|
|
3
5
|
Supercharge your use of large language models
|
|
@@ -372,11 +374,11 @@ Or you can install them separately:
|
|
|
372
374
|
> ⭐ Marked packages are worth to try first
|
|
373
375
|
|
|
374
376
|
|
|
375
|
-
|
|
376
377
|
- ⭐ **[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
378
|
- **[promptbook](https://www.npmjs.com/package/promptbook)** - Same as `ptbk`
|
|
378
379
|
- **[@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
|
|
380
|
+
- **[@promptbook/node](https://www.npmjs.com/package/@promptbook/node)** - Core of the library for Node.js environment
|
|
381
|
+
- **[@promptbook/browser](https://www.npmjs.com/package/@promptbook/browser)** - Core of the library for browser environment
|
|
380
382
|
- ⭐ **[@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
383
|
- **[@promptbook/markdown-utils](https://www.npmjs.com/package/@promptbook/markdown-utils)** - Utility functions used for processing markdown
|
|
382
384
|
- _(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-3';
|
|
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);
|
|
@@ -261,10 +279,16 @@ function deepFreezeWithSameType(objectValue) {
|
|
|
261
279
|
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
262
280
|
*/
|
|
263
281
|
|
|
282
|
+
/**
|
|
283
|
+
* Warning message for the generated sections and files files
|
|
284
|
+
*
|
|
285
|
+
* @private within the repository
|
|
286
|
+
*/
|
|
287
|
+
var GENERATOR_WARNING = "\u26A0\uFE0F WARNING: This section has been generated so that any manual changes will be overwritten";
|
|
264
288
|
/**
|
|
265
289
|
* The maximum number of iterations for a loops
|
|
266
290
|
*
|
|
267
|
-
* @private within the repository - too low-level in comparison
|
|
291
|
+
* @private within the repository - too low-level in comparison with other `MAX_...`
|
|
268
292
|
*/
|
|
269
293
|
var LOOP_LIMIT = 1000;
|
|
270
294
|
/**
|
|
@@ -299,6 +323,8 @@ var EXECUTIONS_CACHE_DIRNAME = '/.promptbook/executions-cache';
|
|
|
299
323
|
var PIPELINE_COLLECTION_BASE_FILENAME = "index";
|
|
300
324
|
/**
|
|
301
325
|
* Nonce which is used for replacing things in strings
|
|
326
|
+
*
|
|
327
|
+
* @private within the repository
|
|
302
328
|
*/
|
|
303
329
|
var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
|
|
304
330
|
/**
|
|
@@ -328,13 +354,6 @@ var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
|
328
354
|
* @private within the repository
|
|
329
355
|
*/
|
|
330
356
|
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
357
|
|
|
339
358
|
/**
|
|
340
359
|
* Prettify the html code
|
|
@@ -565,7 +584,7 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
565
584
|
return pipelineString;
|
|
566
585
|
}
|
|
567
586
|
/**
|
|
568
|
-
* @private internal
|
|
587
|
+
* @private internal utility of `pipelineJsonToString`
|
|
569
588
|
*/
|
|
570
589
|
function promptTemplateParameterJsonToString(promptTemplateParameterJson) {
|
|
571
590
|
var name = promptTemplateParameterJson.name, description = promptTemplateParameterJson.description;
|
|
@@ -580,6 +599,7 @@ function promptTemplateParameterJsonToString(promptTemplateParameterJson) {
|
|
|
580
599
|
* TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
581
600
|
* TODO: [🏛] Maybe make some markdown builder
|
|
582
601
|
* TODO: [🏛] Escape all
|
|
602
|
+
* TODO: [🧠] Should be in generated .ptbk.md file GENERATOR_WARNING
|
|
583
603
|
*/
|
|
584
604
|
|
|
585
605
|
/**
|
|
@@ -778,7 +798,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
778
798
|
});
|
|
779
799
|
}
|
|
780
800
|
|
|
781
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.63.0-
|
|
801
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.63.0-3",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-3",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-3",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-3",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-3",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-3",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-3",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-3",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
802
|
|
|
783
803
|
/**
|
|
784
804
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -1312,7 +1332,7 @@ function unpreparePipeline(pipeline) {
|
|
|
1312
1332
|
* Library of pipelines that groups together pipelines for an application.
|
|
1313
1333
|
* This implementation is a very thin wrapper around the Array / Map of pipelines.
|
|
1314
1334
|
*
|
|
1315
|
-
* @private use `createCollectionFromJson` instead
|
|
1335
|
+
* @private internal function of `createCollectionFromJson`, use `createCollectionFromJson` instead
|
|
1316
1336
|
* @see https://github.com/webgptorg/pipeline#pipeline-collection
|
|
1317
1337
|
*/
|
|
1318
1338
|
var SimplePipelineCollection = /** @class */ (function () {
|
|
@@ -1321,7 +1341,6 @@ var SimplePipelineCollection = /** @class */ (function () {
|
|
|
1321
1341
|
*
|
|
1322
1342
|
* @param pipelines @@@
|
|
1323
1343
|
*
|
|
1324
|
-
* @private Use instead `createCollectionFromJson`
|
|
1325
1344
|
* Note: During the construction logic of all pipelines are validated
|
|
1326
1345
|
* Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
|
|
1327
1346
|
*/
|
|
@@ -1936,7 +1955,8 @@ function extractParameterNamesFromPromptTemplate(promptTemplate) {
|
|
|
1936
1955
|
/**
|
|
1937
1956
|
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
1938
1957
|
*
|
|
1939
|
-
* @private
|
|
1958
|
+
* @private error of `checkExpectations` and `createPipelineExecutor`
|
|
1959
|
+
* Note: Always thrown in `checkExpectations` and catched in `createPipelineExecutor` and rethrown as `PipelineExecutionError`
|
|
1940
1960
|
* Note: This is a kindof subtype of PipelineExecutionError
|
|
1941
1961
|
*/
|
|
1942
1962
|
var ExpectError = /** @class */ (function (_super) {
|
|
@@ -1974,7 +1994,7 @@ function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
|
1974
1994
|
/**
|
|
1975
1995
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
1976
1996
|
*
|
|
1977
|
-
* @private
|
|
1997
|
+
* @private internal utility of `joinLlmExecutionTools`
|
|
1978
1998
|
*/
|
|
1979
1999
|
var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
1980
2000
|
/**
|
|
@@ -2257,7 +2277,7 @@ function isPipelinePrepared(pipeline) {
|
|
|
2257
2277
|
* 2) Undefined returns empty array
|
|
2258
2278
|
* 3) Array returns itself
|
|
2259
2279
|
*
|
|
2260
|
-
* @private
|
|
2280
|
+
* @private internal utility
|
|
2261
2281
|
*/
|
|
2262
2282
|
function arrayableToArray(input) {
|
|
2263
2283
|
if (input === undefined) {
|
|
@@ -2555,7 +2575,7 @@ var CountUtils = {
|
|
|
2555
2575
|
*
|
|
2556
2576
|
* @throws {ExpectError} if the expectations are not met
|
|
2557
2577
|
* @returns {void} Nothing
|
|
2558
|
-
* @
|
|
2578
|
+
* @private internal function of `createPipelineExecutor`
|
|
2559
2579
|
*/
|
|
2560
2580
|
function checkExpectations(expectations, value) {
|
|
2561
2581
|
var e_1, _a;
|
|
@@ -4236,7 +4256,9 @@ var blockCommandParser = {
|
|
|
4236
4256
|
|
|
4237
4257
|
/**
|
|
4238
4258
|
* Units of text measurement
|
|
4259
|
+
*
|
|
4239
4260
|
* @see https://github.com/webgptorg/promptbook/discussions/30
|
|
4261
|
+
* @private internal base for `ExpectationUnit`
|
|
4240
4262
|
*/
|
|
4241
4263
|
var EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', 'LINES', 'PARAGRAPHS', 'PAGES'];
|
|
4242
4264
|
/**
|
|
@@ -4476,7 +4498,7 @@ var jokerCommandParser = {
|
|
|
4476
4498
|
/**
|
|
4477
4499
|
* @@@
|
|
4478
4500
|
*
|
|
4479
|
-
* @private for `ModelVariant` and `modelCommandParser`
|
|
4501
|
+
* @private internal base for `ModelVariant` and `modelCommandParser`
|
|
4480
4502
|
*/
|
|
4481
4503
|
var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
|
|
4482
4504
|
|
|
@@ -4941,11 +4963,12 @@ var boilerplateCommandParser = {
|
|
|
4941
4963
|
};
|
|
4942
4964
|
/**
|
|
4943
4965
|
* TODO: [💐] Implement BOILERPLATE command into `pipelineStringToJsonSync` function
|
|
4944
|
-
* Note: [⚪] This should never be in any released package
|
|
4945
4966
|
*/
|
|
4946
4967
|
|
|
4947
4968
|
/**
|
|
4948
4969
|
* All available command parsers
|
|
4970
|
+
*
|
|
4971
|
+
* @private internal index of `parseCommand`
|
|
4949
4972
|
*/
|
|
4950
4973
|
var COMMANDS = [
|
|
4951
4974
|
blockCommandParser,
|
|
@@ -5115,6 +5138,8 @@ var NotYetImplementedError = /** @class */ (function (_super) {
|
|
|
5115
5138
|
|
|
5116
5139
|
/**
|
|
5117
5140
|
* Supported script languages
|
|
5141
|
+
*
|
|
5142
|
+
* @private internal base for `ScriptLanguage`
|
|
5118
5143
|
*/
|
|
5119
5144
|
var SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
|
|
5120
5145
|
|
|
@@ -5255,7 +5280,7 @@ function extractOneBlockFromMarkdown(markdown) {
|
|
|
5255
5280
|
return codeBlocks[0];
|
|
5256
5281
|
}
|
|
5257
5282
|
/***
|
|
5258
|
-
* TODO: [🍓][🌻] Decide of this is internal
|
|
5283
|
+
* TODO: [🍓][🌻] Decide of this is internal utility, external util OR validator/postprocessor
|
|
5259
5284
|
*/
|
|
5260
5285
|
|
|
5261
5286
|
/**
|
|
@@ -5854,6 +5879,7 @@ function pipelineStringToJson(pipelineString, options) {
|
|
|
5854
5879
|
/**
|
|
5855
5880
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
5856
5881
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
5882
|
+
* TODO: [🧠] Should be in generated JSON file GENERATOR_WARNING
|
|
5857
5883
|
*/
|
|
5858
5884
|
|
|
5859
5885
|
/**
|
|
@@ -5872,6 +5898,69 @@ var CollectionError = /** @class */ (function (_super) {
|
|
|
5872
5898
|
return CollectionError;
|
|
5873
5899
|
}(Error));
|
|
5874
5900
|
|
|
5901
|
+
/**
|
|
5902
|
+
* Reads all files in the directory
|
|
5903
|
+
*
|
|
5904
|
+
* @param path
|
|
5905
|
+
* @param isRecursive
|
|
5906
|
+
* @returns List of all files in the directory
|
|
5907
|
+
* @private internal function of `createCollectionFromDirectory`
|
|
5908
|
+
*/
|
|
5909
|
+
function listAllFiles(path, isRecursive) {
|
|
5910
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5911
|
+
var dirents, fileNames, _a, _b, dirent, subPath, _c, _d, _e, _f, e_1_1;
|
|
5912
|
+
var e_1, _g;
|
|
5913
|
+
return __generator(this, function (_h) {
|
|
5914
|
+
switch (_h.label) {
|
|
5915
|
+
case 0: return [4 /*yield*/, readdir(path, {
|
|
5916
|
+
withFileTypes: true /* Note: This is not working: recursive: isRecursive */,
|
|
5917
|
+
})];
|
|
5918
|
+
case 1:
|
|
5919
|
+
dirents = _h.sent();
|
|
5920
|
+
fileNames = dirents.filter(function (dirent) { return dirent.isFile(); }).map(function (_a) {
|
|
5921
|
+
var name = _a.name;
|
|
5922
|
+
return join(path, name);
|
|
5923
|
+
});
|
|
5924
|
+
if (!isRecursive) return [3 /*break*/, 9];
|
|
5925
|
+
_h.label = 2;
|
|
5926
|
+
case 2:
|
|
5927
|
+
_h.trys.push([2, 7, 8, 9]);
|
|
5928
|
+
_a = __values(dirents.filter(function (dirent) { return dirent.isDirectory(); })), _b = _a.next();
|
|
5929
|
+
_h.label = 3;
|
|
5930
|
+
case 3:
|
|
5931
|
+
if (!!_b.done) return [3 /*break*/, 6];
|
|
5932
|
+
dirent = _b.value;
|
|
5933
|
+
subPath = join(path, dirent.name);
|
|
5934
|
+
_d = (_c = fileNames.push).apply;
|
|
5935
|
+
_e = [fileNames];
|
|
5936
|
+
_f = [[]];
|
|
5937
|
+
return [4 /*yield*/, listAllFiles(subPath, isRecursive)];
|
|
5938
|
+
case 4:
|
|
5939
|
+
_d.apply(_c, _e.concat([__spreadArray.apply(void 0, _f.concat([__read.apply(void 0, [(_h.sent())]), false]))]));
|
|
5940
|
+
_h.label = 5;
|
|
5941
|
+
case 5:
|
|
5942
|
+
_b = _a.next();
|
|
5943
|
+
return [3 /*break*/, 3];
|
|
5944
|
+
case 6: return [3 /*break*/, 9];
|
|
5945
|
+
case 7:
|
|
5946
|
+
e_1_1 = _h.sent();
|
|
5947
|
+
e_1 = { error: e_1_1 };
|
|
5948
|
+
return [3 /*break*/, 9];
|
|
5949
|
+
case 8:
|
|
5950
|
+
try {
|
|
5951
|
+
if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
|
|
5952
|
+
}
|
|
5953
|
+
finally { if (e_1) throw e_1.error; }
|
|
5954
|
+
return [7 /*endfinally*/];
|
|
5955
|
+
case 9: return [2 /*return*/, fileNames];
|
|
5956
|
+
}
|
|
5957
|
+
});
|
|
5958
|
+
});
|
|
5959
|
+
}
|
|
5960
|
+
/**
|
|
5961
|
+
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
5962
|
+
*/
|
|
5963
|
+
|
|
5875
5964
|
/**
|
|
5876
5965
|
* Constructs Promptbook from async sources
|
|
5877
5966
|
* It can be one of the following:
|
|
@@ -5979,7 +6068,7 @@ function createCollectionFromDirectory(path, options) {
|
|
|
5979
6068
|
if (!isRunningInNode()) {
|
|
5980
6069
|
throw new Error('Function `createCollectionFromDirectory` can only be run in Node.js environment because it reads the file system.');
|
|
5981
6070
|
}
|
|
5982
|
-
makedLibraryFilePath = join(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".json"));
|
|
6071
|
+
makedLibraryFilePath = join$1(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".json"));
|
|
5983
6072
|
return [4 /*yield*/, access(makedLibraryFilePath, constants.R_OK)
|
|
5984
6073
|
.then(function () { return true; })
|
|
5985
6074
|
.catch(function () { return false; })];
|
|
@@ -6148,66 +6237,7 @@ function createCollectionFromDirectory(path, options) {
|
|
|
6148
6237
|
});
|
|
6149
6238
|
}
|
|
6150
6239
|
/**
|
|
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`
|
|
6240
|
+
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
6211
6241
|
*/
|
|
6212
6242
|
|
|
6213
6243
|
/**
|
|
@@ -6279,22 +6309,6 @@ function usageToHuman(usage) {
|
|
|
6279
6309
|
* TODO: [🏛] Maybe make some markdown builder
|
|
6280
6310
|
*/
|
|
6281
6311
|
|
|
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
6312
|
/**
|
|
6299
6313
|
* @@@
|
|
6300
6314
|
*
|
|
@@ -6322,7 +6336,7 @@ var FilesStorage = /** @class */ (function () {
|
|
|
6322
6336
|
FilesStorage.prototype.getFilenameForKey = function (key) {
|
|
6323
6337
|
var name = titleToName(key);
|
|
6324
6338
|
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));
|
|
6339
|
+
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
6340
|
};
|
|
6327
6341
|
/**
|
|
6328
6342
|
* @@@ 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 +6412,7 @@ var FilesStorage = /** @class */ (function () {
|
|
|
6398
6412
|
}());
|
|
6399
6413
|
/**
|
|
6400
6414
|
* 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`
|
|
6415
|
+
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
6402
6416
|
*/
|
|
6403
6417
|
|
|
6404
6418
|
/**
|
|
@@ -6407,7 +6421,7 @@ var FilesStorage = /** @class */ (function () {
|
|
|
6407
6421
|
* @param content the content of prompt or response
|
|
6408
6422
|
* @returns part of PromptResultUsageCounts
|
|
6409
6423
|
*
|
|
6410
|
-
* @private internal
|
|
6424
|
+
* @private internal utility of LlmExecutionTools
|
|
6411
6425
|
*/
|
|
6412
6426
|
function computeUsageCounts(content) {
|
|
6413
6427
|
return {
|
|
@@ -6437,7 +6451,7 @@ function uncertainNumber(value) {
|
|
|
6437
6451
|
/**
|
|
6438
6452
|
* Get current date in ISO 8601 format
|
|
6439
6453
|
*
|
|
6440
|
-
* @private
|
|
6454
|
+
* @private internal utility
|
|
6441
6455
|
*/
|
|
6442
6456
|
function getCurrentIsoDate() {
|
|
6443
6457
|
return new Date().toISOString();
|
|
@@ -6459,6 +6473,7 @@ function computeUsage(value) {
|
|
|
6459
6473
|
* Note: Done at 2024-05-25
|
|
6460
6474
|
*
|
|
6461
6475
|
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
6476
|
+
* @public exported from `@promptbook/anthropic-claude`
|
|
6462
6477
|
*/
|
|
6463
6478
|
var ANTHROPIC_CLAUDE_MODELS = [
|
|
6464
6479
|
{
|
|
@@ -7105,7 +7120,7 @@ var OPENAI_MODELS = [
|
|
|
7105
7120
|
* @param resultContent The content of the result (for embedding prompts or failed prompts pass empty string)
|
|
7106
7121
|
* @param rawResponse The raw response from OpenAI API
|
|
7107
7122
|
* @throws {PipelineExecutionError} If the usage is not defined in the response from OpenAI
|
|
7108
|
-
* @private internal
|
|
7123
|
+
* @private internal utility of `OpenAiExecutionTools`
|
|
7109
7124
|
*/
|
|
7110
7125
|
function computeOpenaiUsage(promptContent, // <- Note: Intentionally using [] to access type properties to bring jsdoc from Prompt/PromptResult to consumer
|
|
7111
7126
|
resultContent, rawResponse) {
|
|
@@ -7487,7 +7502,7 @@ function createLlmToolsFromEnv(options) {
|
|
|
7487
7502
|
* TODO: [🧠] Which name is better `createLlmToolsFromEnv` or `createLlmToolsFromEnvironment`?
|
|
7488
7503
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
7489
7504
|
* TODO: [🧠] Maybe pass env as argument
|
|
7490
|
-
* Note: [🟢] This code should never be published outside of `@promptbook/node`
|
|
7505
|
+
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
7491
7506
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
7492
7507
|
*/
|
|
7493
7508
|
|
|
@@ -7677,7 +7692,7 @@ function getLlmToolsForCli(options) {
|
|
|
7677
7692
|
return cacheLlmTools(countTotalUsage(
|
|
7678
7693
|
// <- Note: for example here we don`t want the [🌯]
|
|
7679
7694
|
createLlmToolsFromEnv()), {
|
|
7680
|
-
storage: new FilesStorage({ cacheFolderPath: join(process.cwd(), EXECUTIONS_CACHE_DIRNAME) }),
|
|
7695
|
+
storage: new FilesStorage({ cacheFolderPath: join$1(process.cwd(), EXECUTIONS_CACHE_DIRNAME) }),
|
|
7681
7696
|
isReloaded: isCacheReloaded,
|
|
7682
7697
|
});
|
|
7683
7698
|
}
|
|
@@ -7689,7 +7704,7 @@ function getLlmToolsForCli(options) {
|
|
|
7689
7704
|
/**
|
|
7690
7705
|
* Initializes `make` command for Promptbook CLI utilities
|
|
7691
7706
|
*
|
|
7692
|
-
* @private
|
|
7707
|
+
* @private internal function of `promptbookCli`
|
|
7693
7708
|
*/
|
|
7694
7709
|
function initializeMakeCommand(program) {
|
|
7695
7710
|
var _this = this;
|
|
@@ -7805,7 +7820,7 @@ function initializeMakeCommand(program) {
|
|
|
7805
7820
|
case 0:
|
|
7806
7821
|
filePath = outFile !== PIPELINE_COLLECTION_BASE_FILENAME
|
|
7807
7822
|
? outFile
|
|
7808
|
-
: join(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".").concat(extension));
|
|
7823
|
+
: join$1(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".").concat(extension));
|
|
7809
7824
|
if (!outFile.endsWith(".".concat(extension))) {
|
|
7810
7825
|
console.warn(colors.yellow("Warning: Extension of output file should be \"".concat(extension, "\"")));
|
|
7811
7826
|
}
|
|
@@ -7861,7 +7876,7 @@ function initializeMakeCommand(program) {
|
|
|
7861
7876
|
*/
|
|
7862
7877
|
function addAutoGeneratedSection(content, options) {
|
|
7863
7878
|
var sectionName = options.sectionName, sectionContent = options.sectionContent;
|
|
7864
|
-
var warningLine = "<!--
|
|
7879
|
+
var warningLine = "<!-- ".concat(GENERATOR_WARNING, " -->");
|
|
7865
7880
|
var sectionRegex = new RegExp("<!--".concat(sectionName, "-->([\\s\\S]*?)<!--/").concat(sectionName, "-->"), 'g');
|
|
7866
7881
|
var sectionMatch = content.match(sectionRegex);
|
|
7867
7882
|
if (sectionMatch) {
|
|
@@ -8049,7 +8064,7 @@ function prettifyPipelineString(pipelineString, options) {
|
|
|
8049
8064
|
/**
|
|
8050
8065
|
* Initializes `prettify` command for Promptbook CLI utilities
|
|
8051
8066
|
*
|
|
8052
|
-
* @private
|
|
8067
|
+
* @private internal function of `promptbookCli`
|
|
8053
8068
|
*/
|
|
8054
8069
|
function initializePrettifyCommand(program) {
|
|
8055
8070
|
var _this = this;
|
|
@@ -8135,6 +8150,8 @@ function initializePrettifyCommand(program) {
|
|
|
8135
8150
|
|
|
8136
8151
|
/**
|
|
8137
8152
|
* Runs CLI utilities of Promptbook package
|
|
8153
|
+
*
|
|
8154
|
+
* @private within the `@promptbook/cli`
|
|
8138
8155
|
*/
|
|
8139
8156
|
function promptbookCli() {
|
|
8140
8157
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -8156,7 +8173,7 @@ function promptbookCli() {
|
|
|
8156
8173
|
});
|
|
8157
8174
|
}
|
|
8158
8175
|
/**
|
|
8159
|
-
* TODO: [🥠] Do not export
|
|
8176
|
+
* TODO: [🥠] Do not export, its just for CLI script
|
|
8160
8177
|
* TODO: [🕌] When more functionalities, rename
|
|
8161
8178
|
* Note: 11:11
|
|
8162
8179
|
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|