@promptbook/node 0.59.0-8 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.es.js +426 -410
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-library/index.d.ts +25 -0
- package/esm/typings/src/_packages/cli.index.d.ts +10 -0
- package/{umd/typings → esm/typings/src}/_packages/core.index.d.ts +11 -9
- package/esm/typings/src/_packages/node.index.d.ts +4 -0
- package/{umd/typings → esm/typings/src}/_packages/types.index.d.ts +4 -3
- package/esm/typings/src/cli/actions/hello.d.ts +7 -0
- package/esm/typings/src/cli/actions/make.d.ts +7 -0
- package/esm/typings/src/cli/actions/prettify.d.ts +7 -0
- package/esm/typings/{conversion/prettify/prettifyPromptbookStringCli.d.ts → src/cli/promptbookCli.d.ts} +2 -2
- package/esm/typings/{config.d.ts → src/config.d.ts} +4 -0
- package/esm/typings/{conversion → src/conversion}/promptbookStringToJson.d.ts +5 -3
- package/esm/typings/src/conversion/promptbookStringToJsonSync.d.ts +23 -0
- package/{umd/typings/conversion/validation/validatePromptbookJson.d.ts → esm/typings/src/conversion/validation/validatePromptbook.d.ts} +2 -2
- package/esm/typings/src/execution/EmbeddingVector.d.ts +8 -0
- package/esm/typings/{execution → src/execution}/LlmExecutionTools.d.ts +1 -0
- package/esm/typings/{execution → src/execution}/PromptResult.d.ts +11 -0
- package/esm/typings/src/execution/embeddingVectorToString.d.ts +5 -0
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +21 -0
- package/esm/typings/{promptbook-library → src/library}/SimplePromptbookLibrary.d.ts +3 -1
- package/esm/typings/{promptbook-library/constructors/createPromptbookLibraryFromDirectory.d.ts → src/library/constructors/createLibraryFromDirectory.d.ts} +2 -2
- package/esm/typings/src/library/constructors/createLibraryFromJson.d.ts +12 -0
- package/esm/typings/{promptbook-library/constructors/createPromptbookLibraryFromPromise.d.ts → src/library/constructors/createLibraryFromPromise.d.ts} +3 -7
- package/esm/typings/{promptbook-library/constructors/createPromptbookLibraryFromUrl.d.ts → src/library/constructors/createLibraryFromUrl.d.ts} +2 -2
- package/esm/typings/{promptbook-library/constructors/createPromptbookSublibrary.d.ts → src/library/constructors/createSublibrary.d.ts} +1 -1
- package/esm/typings/src/library/libraryToJson.d.ts +8 -0
- package/{umd/typings → esm/typings/src}/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +4 -0
- package/esm/typings/{llm-providers → src/llm-providers}/anthropic-claude/anthropic-claude-models.d.ts +1 -0
- package/{umd/typings → esm/typings/src}/llm-providers/openai/OpenAiExecutionTools.d.ts +13 -0
- package/esm/typings/{llm-providers → src/llm-providers}/openai/computeOpenaiUsage.d.ts +4 -2
- package/{umd/typings → esm/typings/src}/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +1 -1
- package/esm/typings/{llm-providers → src/llm-providers}/remote/startRemoteServer.d.ts +1 -1
- package/{umd/typings → esm/typings/src}/types/ModelRequirements.d.ts +1 -1
- package/esm/typings/{types → src/types}/PromptbookJson/KnowledgeJson.d.ts +1 -1
- package/esm/typings/{types → src/types}/PromptbookJson/MaterialKnowledgePieceJson.d.ts +4 -3
- package/package.json +4 -3
- package/umd/index.umd.js +430 -414
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/promptbook-library/index.d.ts +25 -0
- package/umd/typings/src/_packages/cli.index.d.ts +10 -0
- package/{esm/typings → umd/typings/src}/_packages/core.index.d.ts +11 -9
- package/umd/typings/src/_packages/node.index.d.ts +4 -0
- package/{esm/typings → umd/typings/src}/_packages/types.index.d.ts +4 -3
- package/umd/typings/src/cli/actions/hello.d.ts +7 -0
- package/umd/typings/src/cli/actions/make.d.ts +7 -0
- package/umd/typings/src/cli/actions/prettify.d.ts +7 -0
- package/umd/typings/{conversion/prettify/prettifyPromptbookStringCli.d.ts → src/cli/promptbookCli.d.ts} +2 -2
- package/umd/typings/{config.d.ts → src/config.d.ts} +4 -0
- package/umd/typings/{conversion → src/conversion}/promptbookStringToJson.d.ts +5 -3
- package/umd/typings/src/conversion/promptbookStringToJsonSync.d.ts +23 -0
- package/{esm/typings/conversion/validation/validatePromptbookJson.d.ts → umd/typings/src/conversion/validation/validatePromptbook.d.ts} +2 -2
- package/umd/typings/src/execution/EmbeddingVector.d.ts +8 -0
- package/umd/typings/{execution → src/execution}/LlmExecutionTools.d.ts +1 -0
- package/umd/typings/{execution → src/execution}/PromptResult.d.ts +11 -0
- package/umd/typings/src/execution/embeddingVectorToString.d.ts +5 -0
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +21 -0
- package/umd/typings/{promptbook-library → src/library}/SimplePromptbookLibrary.d.ts +3 -1
- package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromDirectory.d.ts → src/library/constructors/createLibraryFromDirectory.d.ts} +2 -2
- package/umd/typings/src/library/constructors/createLibraryFromJson.d.ts +12 -0
- package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromPromise.d.ts → src/library/constructors/createLibraryFromPromise.d.ts} +3 -7
- package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromUrl.d.ts → src/library/constructors/createLibraryFromUrl.d.ts} +2 -2
- package/umd/typings/{promptbook-library/constructors/createPromptbookSublibrary.d.ts → src/library/constructors/createSublibrary.d.ts} +1 -1
- package/umd/typings/src/library/libraryToJson.d.ts +8 -0
- package/{esm/typings → umd/typings/src}/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +4 -0
- package/umd/typings/{llm-providers → src/llm-providers}/anthropic-claude/anthropic-claude-models.d.ts +1 -0
- package/{esm/typings → umd/typings/src}/llm-providers/openai/OpenAiExecutionTools.d.ts +13 -0
- package/umd/typings/{llm-providers → src/llm-providers}/openai/computeOpenaiUsage.d.ts +4 -2
- package/{esm/typings → umd/typings/src}/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +1 -1
- package/umd/typings/{llm-providers → src/llm-providers}/remote/startRemoteServer.d.ts +1 -1
- package/{esm/typings → umd/typings/src}/types/ModelRequirements.d.ts +1 -1
- package/umd/typings/{types → src/types}/PromptbookJson/KnowledgeJson.d.ts +1 -1
- package/umd/typings/{types → src/types}/PromptbookJson/MaterialKnowledgePieceJson.d.ts +4 -3
- package/umd/typings/src/utils/trimCodeBlock.test.d.ts +1 -0
- package/umd/typings/src/utils/trimEndOfCodeBlock.test.d.ts +1 -0
- package/umd/typings/src/utils/unwrapResult.test.d.ts +1 -0
- package/umd/typings/src/utils/validators/url/isValidUrl.test.d.ts +1 -0
- package/esm/typings/_packages/cli.index.d.ts +0 -10
- package/esm/typings/_packages/node.index.d.ts +0 -4
- package/esm/typings/knowledge/prepare-knowledge/_common/IndexPreparer.d.ts +0 -4
- package/esm/typings/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +0 -7
- package/esm/typings/promptbook-library/constructors/createPromptbookLibraryFromSources.d.ts +0 -16
- package/umd/typings/_packages/cli.index.d.ts +0 -10
- package/umd/typings/_packages/node.index.d.ts +0 -4
- package/umd/typings/knowledge/prepare-knowledge/_common/IndexPreparer.d.ts +0 -4
- package/umd/typings/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +0 -7
- package/umd/typings/promptbook-library/constructors/createPromptbookLibraryFromSources.d.ts +0 -16
- /package/esm/typings/{_packages → src/_packages}/anthropic-claude.index.d.ts +0 -0
- /package/esm/typings/{_packages → src/_packages}/azure-openai.index.d.ts +0 -0
- /package/esm/typings/{_packages → src/_packages}/execute-javascript.index.d.ts +0 -0
- /package/esm/typings/{_packages → src/_packages}/fake-llm.index.d.ts +0 -0
- /package/esm/typings/{_packages → src/_packages}/langtail.index.d.ts +0 -0
- /package/esm/typings/{_packages → src/_packages}/openai.index.d.ts +0 -0
- /package/esm/typings/{_packages → src/_packages}/remote-client.index.d.ts +0 -0
- /package/esm/typings/{_packages → src/_packages}/remote-server.index.d.ts +0 -0
- /package/esm/typings/{_packages → src/_packages}/utils.index.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/prettify/PrettifyOptions.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/prettify/prettifyPromptbookString.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/prettify/renderPromptbookMermaid.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/promptbookJsonToString.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/promptbookStringToJson.test.d.ts +0 -0
- /package/esm/typings/{conversion/utils/extractParametersFromPromptTemplate.test.d.ts → src/conversion/promptbookStringToJsonSync.test.d.ts} +0 -0
- /package/esm/typings/{conversion → src/conversion}/utils/extractParametersFromPromptTemplate.d.ts +0 -0
- /package/{umd/typings → esm/typings/src}/conversion/utils/extractParametersFromPromptTemplate.test.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/utils/extractVariables.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/utils/extractVariables.test.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/utils/parseCommand.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/utils/parseCommand.test.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/utils/parseNumber.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/utils/parseNumber.test.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/utils/renameParameter.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/utils/renameParameter.test.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/utils/titleToName.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/utils/titleToName.test.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/validation/_importPromptbook.d.ts +0 -0
- /package/esm/typings/{conversion → src/conversion}/validation/promptbookStringToJson-syntaxErrors.test.d.ts +0 -0
- /package/esm/typings/{conversion/validation/validatePromptbookJson-logicErrors.test.d.ts → src/conversion/validation/validatePromptbook-logicErrors.test.d.ts} +0 -0
- /package/esm/typings/{conversion/validation/validatePromptbookJson.test.d.ts → src/conversion/validation/validatePromptbook.test.d.ts} +0 -0
- /package/esm/typings/{errors → src/errors}/PromptbookExecutionError.d.ts +0 -0
- /package/esm/typings/{errors → src/errors}/PromptbookLibraryError.d.ts +0 -0
- /package/esm/typings/{errors → src/errors}/PromptbookLogicError.d.ts +0 -0
- /package/esm/typings/{errors → src/errors}/PromptbookNotFoundError.d.ts +0 -0
- /package/esm/typings/{errors → src/errors}/PromptbookReferenceError.d.ts +0 -0
- /package/esm/typings/{errors → src/errors}/PromptbookSyntaxError.d.ts +0 -0
- /package/esm/typings/{errors → src/errors}/TemplateError.d.ts +0 -0
- /package/esm/typings/{errors → src/errors}/UnexpectedError.d.ts +0 -0
- /package/esm/typings/{errors → src/errors}/_ExpectError.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/CommonExecutionToolsOptions.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/ExecutionTools.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/PromptbookExecutor.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/ScriptExecutionTools.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/UserInterfaceTools.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/addPromptResultUsage.test.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/assertsExecutionSuccessful.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/createPromptbookExecutor.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/translation/automatic-translate/translateMessages.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/utils/addUsage.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/utils/addUsage.test.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/utils/checkExpectations.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/utils/checkExpectations.test.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/utils/computeUsageCounts.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/utils/forEachAsync.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/utils/replaceParameters.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/utils/replaceParameters.test.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/utils/uncertainNumber.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/utils/usageToWorktime.d.ts +0 -0
- /package/esm/typings/{execution → src/execution}/utils/usageToWorktime.test.d.ts +0 -0
- /package/esm/typings/{expectations → src/expectations}/drafts/isDomainNameFree.d.ts +0 -0
- /package/esm/typings/{expectations → src/expectations}/drafts/isGithubNameFree.d.ts +0 -0
- /package/esm/typings/{formats → src/formats}/_common/FormatDefinition.d.ts +0 -0
- /package/esm/typings/{formats → src/formats}/csv/ListFormatDefinition.d.ts +0 -0
- /package/esm/typings/{formats → src/formats}/index.d.ts +0 -0
- /package/esm/typings/{formats → src/formats}/json/JsonFormatDefinition.d.ts +0 -0
- /package/esm/typings/{formats → src/formats}/json/utils/isValidJsonString.d.ts +0 -0
- /package/esm/typings/{formats → src/formats}/json/utils/isValidJsonString.test.d.ts +0 -0
- /package/esm/typings/{formats → src/formats}/list/ListFormatDefinition.d.ts +0 -0
- /package/esm/typings/{formats → src/formats}/xml/XmlFormatDefinition.d.ts +0 -0
- /package/esm/typings/{knowledge → src/knowledge}/dialogs/callback/CallbackInterfaceTools.d.ts +0 -0
- /package/esm/typings/{knowledge → src/knowledge}/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +0 -0
- /package/esm/typings/{knowledge → src/knowledge}/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +0 -0
- /package/esm/typings/{knowledge → src/knowledge}/dialogs/user-interface-execution-tools.test.d.ts +0 -0
- /package/esm/typings/{knowledge → src/knowledge}/prepare-knowledge/markdown/playground/markdown-knowledge-playground.d.ts +0 -0
- /package/esm/typings/{knowledge → src/knowledge}/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +0 -0
- /package/esm/typings/{knowledge → src/knowledge}/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +0 -0
- /package/esm/typings/{knowledge → src/knowledge}/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts +0 -0
- /package/esm/typings/{promptbook-library → src/library}/PromptbookLibrary.d.ts +0 -0
- /package/esm/typings/{llm-providers/mocked/fakeTextToExpectations.test.d.ts → src/library/constructors/createLibraryFromDirectory.test.d.ts} +0 -0
- /package/esm/typings/{llm-providers/mocked/faked-completion.test.d.ts → src/library/constructors/createLibraryFromJson.test.d.ts} +0 -0
- /package/esm/typings/{llm-providers/openai/computeUsage.test.d.ts → src/library/constructors/createLibraryFromPromise.test.d.ts} +0 -0
- /package/esm/typings/{promptbook-library → src/library}/constructors/justTestFsImport.d.ts +0 -0
- /package/esm/typings/{promptbook-library/constructors/createPromptbookLibraryFromDirectory.test.d.ts → src/library/libraryToJson.test.d.ts} +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/anthropic-claude/playground/playground.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/azure-openai/AzureOpenAiExecutionTools.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/azure-openai/playground/playground.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/langtail/LangtailExecutionTools.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/langtail/LangtailExecutionToolsOptions.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/langtail/playground/playground.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/mocked/MockedEchoLlmExecutionTools.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/mocked/MockedFackedLlmExecutionTools.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/mocked/fakeTextToExpectations.d.ts +0 -0
- /package/{umd/typings → esm/typings/src}/llm-providers/mocked/fakeTextToExpectations.test.d.ts +0 -0
- /package/{umd/typings → esm/typings/src}/llm-providers/mocked/faked-completion.test.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/mocked/joker.test.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/mocked/mocked-chat.test.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/mocked/mocked-completion.test.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/multiple/MultipleLlmExecutionTools.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/multiple/MultipleLlmExecutionToolsOptions.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/multiple/playground/playground.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/openai/OpenAiExecutionToolsOptions.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/openai/computeUsage.d.ts +0 -0
- /package/{umd/typings → esm/typings/src}/llm-providers/openai/computeUsage.test.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/openai/openai-models.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/openai/playground/playground.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/remote/RemoteLlmExecutionTools.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/remote/RemoteLlmExecutionToolsOptions.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Error.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Progress.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Request.d.ts +0 -0
- /package/esm/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Response.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/_test/custom-function-async.test.ts.test.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/_test/custom-function-missing.test.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/_test/custom-function-with-dependencies.test.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/_test/custom-function.test.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/_test/postprocessing.test.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/_test/script-execution-errors.test.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/_test/script-execution-tools.test.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/javascript/JavascriptEvalExecutionTools.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/javascript/JavascriptEvalExecutionTools.test.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/javascript/JavascriptExecutionTools.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/javascript/JavascriptExecutionToolsOptions.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/javascript/utils/preserve.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/javascript/utils/unknownToString.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/python/PythonExecutionTools.d.ts +0 -0
- /package/esm/typings/{scripting → src/scripting}/typescript/TypescriptExecutionTools.d.ts +0 -0
- /package/esm/typings/{types → src/types}/Command.d.ts +0 -0
- /package/esm/typings/{types → src/types}/ExecutionTypes.d.ts +0 -0
- /package/esm/typings/{types → src/types}/Parameters.d.ts +0 -0
- /package/esm/typings/{types → src/types}/Prompt.d.ts +0 -0
- /package/esm/typings/{types → src/types}/PromptbookJson/PromptTemplateJson.d.ts +0 -0
- /package/esm/typings/{types → src/types}/PromptbookJson/PromptTemplateParameterJson.d.ts +0 -0
- /package/esm/typings/{types → src/types}/PromptbookJson/PromptbookJson.d.ts +0 -0
- /package/esm/typings/{types → src/types}/PromptbookString.d.ts +0 -0
- /package/esm/typings/{types → src/types}/ScriptLanguage.d.ts +0 -0
- /package/esm/typings/{types → src/types}/TaskProgress.d.ts +0 -0
- /package/esm/typings/{types → src/types}/execution-report/ExecutionReportJson.d.ts +0 -0
- /package/esm/typings/{types → src/types}/execution-report/ExecutionReportString.d.ts +0 -0
- /package/esm/typings/{types → src/types}/execution-report/ExecutionReportStringOptions.d.ts +0 -0
- /package/esm/typings/{types → src/types}/execution-report/config.d.ts +0 -0
- /package/esm/typings/{types → src/types}/execution-report/countWorkingDuration.d.ts +0 -0
- /package/esm/typings/{types → src/types}/execution-report/countWorkingDuration.test.d.ts +0 -0
- /package/esm/typings/{types → src/types}/execution-report/executionReportJsonToString.d.ts +0 -0
- /package/esm/typings/{types → src/types}/typeAliasEmoji.d.ts +0 -0
- /package/esm/typings/{types → src/types}/typeAliases.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/FromtoItems.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/emojis.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/expectation-counters/countCharacters.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/expectation-counters/countCharacters.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/expectation-counters/countLines.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/expectation-counters/countLines.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/expectation-counters/countPages.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/expectation-counters/countPages.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/expectation-counters/countParagraphs.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/expectation-counters/countParagraphs.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/expectation-counters/countSentences.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/expectation-counters/countSentences.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/expectation-counters/countWords.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/expectation-counters/countWords.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/expectation-counters/index.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/extractParameters.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/extractParameters.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/formatNumber.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/formatNumber.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/getCurrentIsoDate.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/isRunningInWhatever.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/just.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/addAutoGeneratedSection.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/addAutoGeneratedSection.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/createMarkdownChart.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/createMarkdownChart.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/createMarkdownTable.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/createMarkdownTable.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/escapeMarkdownBlock.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/escapeMarkdownBlock.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/extractAllBlocksFromMarkdown.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/extractAllBlocksFromMarkdown.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/extractAllListItemsFromMarkdown.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/extractAllListItemsFromMarkdown.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/extractOneBlockFromMarkdown.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/extractOneBlockFromMarkdown.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/prettifyMarkdown.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/prettifyMarkdown.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/removeContentComments.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/removeContentComments.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/removeMarkdownFormatting.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown/removeMarkdownFormatting.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown-json/MarkdownStructure.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown-json/countMarkdownStructureDeepness.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown-json/countMarkdownStructureDeepness.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown-json/markdownToMarkdownStructure.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/markdown-json/markdownToMarkdownStructure.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/IKeywords.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/capitalize.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/capitalize.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/decapitalize.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/decapitalize.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/isValidKeyword.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/isValidKeyword.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/nameToUriPart.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/nameToUriPart.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/nameToUriParts.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/nameToUriParts.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/normalize-to-kebab-case.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/normalize-to-kebab-case.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_PascalCase.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_PascalCase.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_SCREAMING_CASE.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_SCREAMING_CASE.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_camelCase.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_camelCase.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_snake_case.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_snake_case.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/normalizeWhitespaces.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/normalizeWhitespaces.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/parseKeywords.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/parseKeywords.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/parseKeywordsFromString.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/parseKeywordsFromString.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/removeDiacritics.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/removeDiacritics.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/searchKeywords.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/normalization/searchKeywords.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/postprocessing/extractBlock.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/removeEmojis.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/removeEmojis.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/removeQuotes.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/removeQuotes.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/sets/difference.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/sets/difference.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/sets/intersection.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/sets/intersection.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/sets/union.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/sets/union.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/trimCodeBlock.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/trimCodeBlock.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/trimEndOfCodeBlock.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/trimEndOfCodeBlock.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/unwrapResult.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/unwrapResult.test.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/validators/url/isValidUrl.d.ts +0 -0
- /package/esm/typings/{utils → src/utils}/validators/url/isValidUrl.test.d.ts +0 -0
- /package/esm/typings/{version.d.ts → src/version.d.ts} +0 -0
- /package/umd/typings/{_packages → src/_packages}/anthropic-claude.index.d.ts +0 -0
- /package/umd/typings/{_packages → src/_packages}/azure-openai.index.d.ts +0 -0
- /package/umd/typings/{_packages → src/_packages}/execute-javascript.index.d.ts +0 -0
- /package/umd/typings/{_packages → src/_packages}/fake-llm.index.d.ts +0 -0
- /package/umd/typings/{_packages → src/_packages}/langtail.index.d.ts +0 -0
- /package/umd/typings/{_packages → src/_packages}/openai.index.d.ts +0 -0
- /package/umd/typings/{_packages → src/_packages}/remote-client.index.d.ts +0 -0
- /package/umd/typings/{_packages → src/_packages}/remote-server.index.d.ts +0 -0
- /package/umd/typings/{_packages → src/_packages}/utils.index.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/prettify/PrettifyOptions.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/prettify/prettifyPromptbookString.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/prettify/renderPromptbookMermaid.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/promptbookJsonToString.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/promptbookStringToJson.test.d.ts +0 -0
- /package/{esm/typings/promptbook-library/constructors/createPromptbookLibraryFromPromise.test.d.ts → umd/typings/src/conversion/promptbookStringToJsonSync.test.d.ts} +0 -0
- /package/umd/typings/{conversion → src/conversion}/utils/extractParametersFromPromptTemplate.d.ts +0 -0
- /package/{esm/typings/promptbook-library/constructors/createPromptbookLibraryFromSources.test.d.ts → umd/typings/src/conversion/utils/extractParametersFromPromptTemplate.test.d.ts} +0 -0
- /package/umd/typings/{conversion → src/conversion}/utils/extractVariables.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/utils/extractVariables.test.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/utils/parseCommand.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/utils/parseCommand.test.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/utils/parseNumber.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/utils/parseNumber.test.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/utils/renameParameter.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/utils/renameParameter.test.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/utils/titleToName.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/utils/titleToName.test.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/validation/_importPromptbook.d.ts +0 -0
- /package/umd/typings/{conversion → src/conversion}/validation/promptbookStringToJson-syntaxErrors.test.d.ts +0 -0
- /package/umd/typings/{conversion/validation/validatePromptbookJson-logicErrors.test.d.ts → src/conversion/validation/validatePromptbook-logicErrors.test.d.ts} +0 -0
- /package/umd/typings/{conversion/validation/validatePromptbookJson.test.d.ts → src/conversion/validation/validatePromptbook.test.d.ts} +0 -0
- /package/umd/typings/{errors → src/errors}/PromptbookExecutionError.d.ts +0 -0
- /package/umd/typings/{errors → src/errors}/PromptbookLibraryError.d.ts +0 -0
- /package/umd/typings/{errors → src/errors}/PromptbookLogicError.d.ts +0 -0
- /package/umd/typings/{errors → src/errors}/PromptbookNotFoundError.d.ts +0 -0
- /package/umd/typings/{errors → src/errors}/PromptbookReferenceError.d.ts +0 -0
- /package/umd/typings/{errors → src/errors}/PromptbookSyntaxError.d.ts +0 -0
- /package/umd/typings/{errors → src/errors}/TemplateError.d.ts +0 -0
- /package/umd/typings/{errors → src/errors}/UnexpectedError.d.ts +0 -0
- /package/umd/typings/{errors → src/errors}/_ExpectError.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/CommonExecutionToolsOptions.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/ExecutionTools.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/PromptbookExecutor.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/ScriptExecutionTools.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/UserInterfaceTools.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/addPromptResultUsage.test.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/assertsExecutionSuccessful.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/createPromptbookExecutor.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/translation/automatic-translate/translateMessages.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/utils/addUsage.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/utils/addUsage.test.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/utils/checkExpectations.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/utils/checkExpectations.test.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/utils/computeUsageCounts.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/utils/forEachAsync.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/utils/replaceParameters.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/utils/replaceParameters.test.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/utils/uncertainNumber.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/utils/usageToWorktime.d.ts +0 -0
- /package/umd/typings/{execution → src/execution}/utils/usageToWorktime.test.d.ts +0 -0
- /package/umd/typings/{expectations → src/expectations}/drafts/isDomainNameFree.d.ts +0 -0
- /package/umd/typings/{expectations → src/expectations}/drafts/isGithubNameFree.d.ts +0 -0
- /package/umd/typings/{formats → src/formats}/_common/FormatDefinition.d.ts +0 -0
- /package/umd/typings/{formats → src/formats}/csv/ListFormatDefinition.d.ts +0 -0
- /package/umd/typings/{formats → src/formats}/index.d.ts +0 -0
- /package/umd/typings/{formats → src/formats}/json/JsonFormatDefinition.d.ts +0 -0
- /package/umd/typings/{formats → src/formats}/json/utils/isValidJsonString.d.ts +0 -0
- /package/umd/typings/{formats → src/formats}/json/utils/isValidJsonString.test.d.ts +0 -0
- /package/umd/typings/{formats → src/formats}/list/ListFormatDefinition.d.ts +0 -0
- /package/umd/typings/{formats → src/formats}/xml/XmlFormatDefinition.d.ts +0 -0
- /package/umd/typings/{knowledge → src/knowledge}/dialogs/callback/CallbackInterfaceTools.d.ts +0 -0
- /package/umd/typings/{knowledge → src/knowledge}/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +0 -0
- /package/umd/typings/{knowledge → src/knowledge}/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +0 -0
- /package/umd/typings/{knowledge → src/knowledge}/dialogs/user-interface-execution-tools.test.d.ts +0 -0
- /package/umd/typings/{knowledge → src/knowledge}/prepare-knowledge/markdown/playground/markdown-knowledge-playground.d.ts +0 -0
- /package/umd/typings/{knowledge → src/knowledge}/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +0 -0
- /package/umd/typings/{knowledge → src/knowledge}/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +0 -0
- /package/umd/typings/{knowledge → src/knowledge}/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts +0 -0
- /package/umd/typings/{promptbook-library → src/library}/PromptbookLibrary.d.ts +0 -0
- /package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromDirectory.test.d.ts → src/library/constructors/createLibraryFromDirectory.test.d.ts} +0 -0
- /package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromPromise.test.d.ts → src/library/constructors/createLibraryFromJson.test.d.ts} +0 -0
- /package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromSources.test.d.ts → src/library/constructors/createLibraryFromPromise.test.d.ts} +0 -0
- /package/umd/typings/{promptbook-library → src/library}/constructors/justTestFsImport.d.ts +0 -0
- /package/umd/typings/{scripting/_test/custom-function-async.test.ts.test.d.ts → src/library/libraryToJson.test.d.ts} +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/anthropic-claude/playground/playground.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/azure-openai/AzureOpenAiExecutionTools.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/azure-openai/playground/playground.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/langtail/LangtailExecutionTools.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/langtail/LangtailExecutionToolsOptions.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/langtail/playground/playground.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/mocked/MockedEchoLlmExecutionTools.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/mocked/MockedFackedLlmExecutionTools.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/mocked/fakeTextToExpectations.d.ts +0 -0
- /package/umd/typings/{scripting/_test/custom-function-missing.test.d.ts → src/llm-providers/mocked/fakeTextToExpectations.test.d.ts} +0 -0
- /package/umd/typings/{scripting/_test/custom-function-with-dependencies.test.d.ts → src/llm-providers/mocked/faked-completion.test.d.ts} +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/mocked/joker.test.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/mocked/mocked-chat.test.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/mocked/mocked-completion.test.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/multiple/MultipleLlmExecutionTools.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/multiple/MultipleLlmExecutionToolsOptions.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/multiple/playground/playground.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/openai/OpenAiExecutionToolsOptions.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/openai/computeUsage.d.ts +0 -0
- /package/umd/typings/{scripting/_test/custom-function.test.d.ts → src/llm-providers/openai/computeUsage.test.d.ts} +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/openai/openai-models.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/openai/playground/playground.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/remote/RemoteLlmExecutionTools.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/remote/RemoteLlmExecutionToolsOptions.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Error.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Progress.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Request.d.ts +0 -0
- /package/umd/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Response.d.ts +0 -0
- /package/umd/typings/{scripting/_test/postprocessing.test.d.ts → src/scripting/_test/custom-function-async.test.ts.test.d.ts} +0 -0
- /package/umd/typings/{scripting/_test/script-execution-errors.test.d.ts → src/scripting/_test/custom-function-missing.test.d.ts} +0 -0
- /package/umd/typings/{scripting/_test/script-execution-tools.test.d.ts → src/scripting/_test/custom-function-with-dependencies.test.d.ts} +0 -0
- /package/umd/typings/{types/execution-report/countWorkingDuration.test.d.ts → src/scripting/_test/custom-function.test.d.ts} +0 -0
- /package/umd/typings/{utils/expectation-counters/countCharacters.test.d.ts → src/scripting/_test/postprocessing.test.d.ts} +0 -0
- /package/umd/typings/{utils/expectation-counters/countLines.test.d.ts → src/scripting/_test/script-execution-errors.test.d.ts} +0 -0
- /package/umd/typings/{utils/expectation-counters/countPages.test.d.ts → src/scripting/_test/script-execution-tools.test.d.ts} +0 -0
- /package/umd/typings/{scripting → src/scripting}/javascript/JavascriptEvalExecutionTools.d.ts +0 -0
- /package/umd/typings/{scripting → src/scripting}/javascript/JavascriptEvalExecutionTools.test.d.ts +0 -0
- /package/umd/typings/{scripting → src/scripting}/javascript/JavascriptExecutionTools.d.ts +0 -0
- /package/umd/typings/{scripting → src/scripting}/javascript/JavascriptExecutionToolsOptions.d.ts +0 -0
- /package/umd/typings/{scripting → src/scripting}/javascript/utils/preserve.d.ts +0 -0
- /package/umd/typings/{scripting → src/scripting}/javascript/utils/unknownToString.d.ts +0 -0
- /package/umd/typings/{scripting → src/scripting}/python/PythonExecutionTools.d.ts +0 -0
- /package/umd/typings/{scripting → src/scripting}/typescript/TypescriptExecutionTools.d.ts +0 -0
- /package/umd/typings/{types → src/types}/Command.d.ts +0 -0
- /package/umd/typings/{types → src/types}/ExecutionTypes.d.ts +0 -0
- /package/umd/typings/{types → src/types}/Parameters.d.ts +0 -0
- /package/umd/typings/{types → src/types}/Prompt.d.ts +0 -0
- /package/umd/typings/{types → src/types}/PromptbookJson/PromptTemplateJson.d.ts +0 -0
- /package/umd/typings/{types → src/types}/PromptbookJson/PromptTemplateParameterJson.d.ts +0 -0
- /package/umd/typings/{types → src/types}/PromptbookJson/PromptbookJson.d.ts +0 -0
- /package/umd/typings/{types → src/types}/PromptbookString.d.ts +0 -0
- /package/umd/typings/{types → src/types}/ScriptLanguage.d.ts +0 -0
- /package/umd/typings/{types → src/types}/TaskProgress.d.ts +0 -0
- /package/umd/typings/{types → src/types}/execution-report/ExecutionReportJson.d.ts +0 -0
- /package/umd/typings/{types → src/types}/execution-report/ExecutionReportString.d.ts +0 -0
- /package/umd/typings/{types → src/types}/execution-report/ExecutionReportStringOptions.d.ts +0 -0
- /package/umd/typings/{types → src/types}/execution-report/config.d.ts +0 -0
- /package/umd/typings/{types → src/types}/execution-report/countWorkingDuration.d.ts +0 -0
- /package/umd/typings/{utils/expectation-counters/countParagraphs.test.d.ts → src/types/execution-report/countWorkingDuration.test.d.ts} +0 -0
- /package/umd/typings/{types → src/types}/execution-report/executionReportJsonToString.d.ts +0 -0
- /package/umd/typings/{types → src/types}/typeAliasEmoji.d.ts +0 -0
- /package/umd/typings/{types → src/types}/typeAliases.d.ts +0 -0
- /package/umd/typings/{utils → src/utils}/FromtoItems.d.ts +0 -0
- /package/umd/typings/{utils → src/utils}/emojis.d.ts +0 -0
- /package/umd/typings/{utils → src/utils}/expectation-counters/countCharacters.d.ts +0 -0
- /package/umd/typings/{utils/expectation-counters/countSentences.test.d.ts → src/utils/expectation-counters/countCharacters.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/expectation-counters/countLines.d.ts +0 -0
- /package/umd/typings/{utils/expectation-counters/countWords.test.d.ts → src/utils/expectation-counters/countLines.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/expectation-counters/countPages.d.ts +0 -0
- /package/umd/typings/{utils/extractParameters.test.d.ts → src/utils/expectation-counters/countPages.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/expectation-counters/countParagraphs.d.ts +0 -0
- /package/umd/typings/{utils/formatNumber.test.d.ts → src/utils/expectation-counters/countParagraphs.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/expectation-counters/countSentences.d.ts +0 -0
- /package/umd/typings/{utils/markdown-json/countMarkdownStructureDeepness.test.d.ts → src/utils/expectation-counters/countSentences.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/expectation-counters/countWords.d.ts +0 -0
- /package/umd/typings/{utils/markdown-json/markdownToMarkdownStructure.test.d.ts → src/utils/expectation-counters/countWords.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/expectation-counters/index.d.ts +0 -0
- /package/umd/typings/{utils → src/utils}/extractParameters.d.ts +0 -0
- /package/umd/typings/{utils/markdown/addAutoGeneratedSection.test.d.ts → src/utils/extractParameters.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/formatNumber.d.ts +0 -0
- /package/umd/typings/{utils/markdown/createMarkdownChart.test.d.ts → src/utils/formatNumber.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/getCurrentIsoDate.d.ts +0 -0
- /package/umd/typings/{utils → src/utils}/isRunningInWhatever.d.ts +0 -0
- /package/umd/typings/{utils → src/utils}/just.d.ts +0 -0
- /package/umd/typings/{utils → src/utils}/markdown/addAutoGeneratedSection.d.ts +0 -0
- /package/umd/typings/{utils/markdown/extractAllBlocksFromMarkdown.test.d.ts → src/utils/markdown/addAutoGeneratedSection.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/markdown/createMarkdownChart.d.ts +0 -0
- /package/umd/typings/{utils/markdown/extractAllListItemsFromMarkdown.test.d.ts → src/utils/markdown/createMarkdownChart.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/markdown/createMarkdownTable.d.ts +0 -0
- /package/umd/typings/{utils/markdown/extractOneBlockFromMarkdown.test.d.ts → src/utils/markdown/createMarkdownTable.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/markdown/escapeMarkdownBlock.d.ts +0 -0
- /package/umd/typings/{utils/markdown/prettifyMarkdown.test.d.ts → src/utils/markdown/escapeMarkdownBlock.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/markdown/extractAllBlocksFromMarkdown.d.ts +0 -0
- /package/umd/typings/{utils/markdown/removeContentComments.test.d.ts → src/utils/markdown/extractAllBlocksFromMarkdown.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/markdown/extractAllListItemsFromMarkdown.d.ts +0 -0
- /package/umd/typings/{utils/markdown/removeMarkdownFormatting.test.d.ts → src/utils/markdown/extractAllListItemsFromMarkdown.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/markdown/extractOneBlockFromMarkdown.d.ts +0 -0
- /package/umd/typings/{utils/normalization/capitalize.test.d.ts → src/utils/markdown/extractOneBlockFromMarkdown.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/markdown/prettifyMarkdown.d.ts +0 -0
- /package/umd/typings/{utils/normalization/decapitalize.test.d.ts → src/utils/markdown/prettifyMarkdown.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/markdown/removeContentComments.d.ts +0 -0
- /package/umd/typings/{utils/normalization/isValidKeyword.test.d.ts → src/utils/markdown/removeContentComments.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/markdown/removeMarkdownFormatting.d.ts +0 -0
- /package/umd/typings/{utils/normalization/nameToUriPart.test.d.ts → src/utils/markdown/removeMarkdownFormatting.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/markdown-json/MarkdownStructure.d.ts +0 -0
- /package/umd/typings/{utils → src/utils}/markdown-json/countMarkdownStructureDeepness.d.ts +0 -0
- /package/umd/typings/{utils/markdown/createMarkdownTable.test.d.ts → src/utils/markdown-json/countMarkdownStructureDeepness.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/markdown-json/markdownToMarkdownStructure.d.ts +0 -0
- /package/umd/typings/{utils/markdown/escapeMarkdownBlock.test.d.ts → src/utils/markdown-json/markdownToMarkdownStructure.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/IKeywords.d.ts +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/capitalize.d.ts +0 -0
- /package/umd/typings/{utils/normalization/nameToUriParts.test.d.ts → src/utils/normalization/capitalize.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/decapitalize.d.ts +0 -0
- /package/umd/typings/{utils/normalization/normalize-to-kebab-case.test.d.ts → src/utils/normalization/decapitalize.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/isValidKeyword.d.ts +0 -0
- /package/umd/typings/{utils/normalization/normalizeTo_PascalCase.test.d.ts → src/utils/normalization/isValidKeyword.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/nameToUriPart.d.ts +0 -0
- /package/umd/typings/{utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts → src/utils/normalization/nameToUriPart.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/nameToUriParts.d.ts +0 -0
- /package/umd/typings/{utils/normalization/normalizeTo_camelCase.test.d.ts → src/utils/normalization/nameToUriParts.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/normalize-to-kebab-case.d.ts +0 -0
- /package/umd/typings/{utils/normalization/normalizeTo_snake_case.test.d.ts → src/utils/normalization/normalize-to-kebab-case.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/normalizeTo_PascalCase.d.ts +0 -0
- /package/umd/typings/{utils/normalization/normalizeWhitespaces.test.d.ts → src/utils/normalization/normalizeTo_PascalCase.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/normalizeTo_SCREAMING_CASE.d.ts +0 -0
- /package/umd/typings/{utils/normalization/parseKeywords.test.d.ts → src/utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/normalizeTo_camelCase.d.ts +0 -0
- /package/umd/typings/{utils/normalization/parseKeywordsFromString.test.d.ts → src/utils/normalization/normalizeTo_camelCase.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/normalizeTo_snake_case.d.ts +0 -0
- /package/umd/typings/{utils/normalization/removeDiacritics.test.d.ts → src/utils/normalization/normalizeTo_snake_case.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/normalizeWhitespaces.d.ts +0 -0
- /package/umd/typings/{utils/normalization/searchKeywords.test.d.ts → src/utils/normalization/normalizeWhitespaces.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/parseKeywords.d.ts +0 -0
- /package/umd/typings/{utils/removeEmojis.test.d.ts → src/utils/normalization/parseKeywords.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/parseKeywordsFromString.d.ts +0 -0
- /package/umd/typings/{utils/removeQuotes.test.d.ts → src/utils/normalization/parseKeywordsFromString.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/removeDiacritics.d.ts +0 -0
- /package/umd/typings/{utils/sets/difference.test.d.ts → src/utils/normalization/removeDiacritics.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/normalization/searchKeywords.d.ts +0 -0
- /package/umd/typings/{utils/sets/intersection.test.d.ts → src/utils/normalization/searchKeywords.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/postprocessing/extractBlock.d.ts +0 -0
- /package/umd/typings/{utils → src/utils}/removeEmojis.d.ts +0 -0
- /package/umd/typings/{utils/sets/union.test.d.ts → src/utils/removeEmojis.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/removeQuotes.d.ts +0 -0
- /package/umd/typings/{utils/trimCodeBlock.test.d.ts → src/utils/removeQuotes.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/sets/difference.d.ts +0 -0
- /package/umd/typings/{utils/trimEndOfCodeBlock.test.d.ts → src/utils/sets/difference.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/sets/intersection.d.ts +0 -0
- /package/umd/typings/{utils/unwrapResult.test.d.ts → src/utils/sets/intersection.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/sets/union.d.ts +0 -0
- /package/umd/typings/{utils/validators/url/isValidUrl.test.d.ts → src/utils/sets/union.test.d.ts} +0 -0
- /package/umd/typings/{utils → src/utils}/trimCodeBlock.d.ts +0 -0
- /package/umd/typings/{utils → src/utils}/trimEndOfCodeBlock.d.ts +0 -0
- /package/umd/typings/{utils → src/utils}/unwrapResult.d.ts +0 -0
- /package/umd/typings/{utils → src/utils}/validators/url/isValidUrl.d.ts +0 -0
- /package/umd/typings/{version.d.ts → src/version.d.ts} +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs/promises'), require('path'), require('spacetrim'), require('prettier'), require('prettier/parser-html')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'fs/promises', 'path', 'spacetrim', 'prettier', 'prettier/parser-html'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-node"] = {}, global.promises, global.path, global.spaceTrim, global.prettier, global.parserHtml));
|
|
5
|
-
})(this, (function (exports, promises, path, spaceTrim, prettier, parserHtml) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('fs/promises'), require('path'), require('spacetrim'), require('prettier'), require('prettier/parser-html')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'colors', 'fs/promises', 'path', 'spacetrim', 'prettier', 'prettier/parser-html'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-node"] = {}, global.colors, global.promises, global.path, global.spaceTrim, global.prettier, global.parserHtml));
|
|
5
|
+
})(this, (function (exports, colors, promises, path, spaceTrim, prettier, parserHtml) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
+
var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
|
|
9
10
|
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
|
|
10
11
|
var parserHtml__default = /*#__PURE__*/_interopDefaultLegacy(parserHtml);
|
|
11
12
|
|
|
@@ -129,18 +130,15 @@
|
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
/**
|
|
132
|
-
*
|
|
133
|
+
* The maximum number of iterations for a loops
|
|
133
134
|
*/
|
|
134
|
-
var
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
return PromptbookSyntaxError;
|
|
143
|
-
}(Error));
|
|
135
|
+
var LOOP_LIMIT = 1000;
|
|
136
|
+
/**
|
|
137
|
+
* The name of the builded promptbook library made by CLI `promptbook make` and for lookup in `createLibraryFromDirectory`
|
|
138
|
+
*/
|
|
139
|
+
var PROMPTBOOK_MAKED_BASE_FILENAME = "index";
|
|
140
|
+
|
|
141
|
+
var promptbookLibrary = [{title:"Prepare Keywords",promptbookUrl:"https://promptbook.studio/promptbook/prepare-keywords.ptbk.md",promptbookVersion:"0.59.0-36",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],executionType:"PROMPT_TEMPLATE",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> {content}",resultingParameterName:"keywords"}],knowledge:[]},{title:"Prepare Knowledge from Markdown",promptbookUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.59.0-36",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],executionType:"PROMPT_TEMPLATE",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> {content}",resultingParameterName:"knowledge"}],knowledge:[]}];
|
|
144
142
|
|
|
145
143
|
/**
|
|
146
144
|
* This error indicates errors during the execution of the promptbook
|
|
@@ -181,11 +179,6 @@
|
|
|
181
179
|
* TODO: [🧠] Can this return type be better typed than void
|
|
182
180
|
*/
|
|
183
181
|
|
|
184
|
-
/**
|
|
185
|
-
* The maximum number of iterations for a loops
|
|
186
|
-
*/
|
|
187
|
-
var LOOP_LIMIT = 1000;
|
|
188
|
-
|
|
189
182
|
/**
|
|
190
183
|
* This error indicates that the promptbook object has valid syntax but contains logical errors (like circular dependencies)
|
|
191
184
|
*/
|
|
@@ -200,6 +193,20 @@
|
|
|
200
193
|
return PromptbookLogicError;
|
|
201
194
|
}(Error));
|
|
202
195
|
|
|
196
|
+
/**
|
|
197
|
+
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
198
|
+
*/
|
|
199
|
+
var PromptbookSyntaxError = /** @class */ (function (_super) {
|
|
200
|
+
__extends(PromptbookSyntaxError, _super);
|
|
201
|
+
function PromptbookSyntaxError(message) {
|
|
202
|
+
var _this = _super.call(this, message) || this;
|
|
203
|
+
_this.name = 'PromptbookSyntaxError';
|
|
204
|
+
Object.setPrototypeOf(_this, PromptbookSyntaxError.prototype);
|
|
205
|
+
return _this;
|
|
206
|
+
}
|
|
207
|
+
return PromptbookSyntaxError;
|
|
208
|
+
}(Error));
|
|
209
|
+
|
|
203
210
|
/**
|
|
204
211
|
* This error type indicates that the error should not happen and its last check before crashing with some other error
|
|
205
212
|
*/
|
|
@@ -253,7 +260,7 @@
|
|
|
253
260
|
* @returns the same promptbook if it is logically valid
|
|
254
261
|
* @throws {PromptbookLogicError} on logical error in the promptbook
|
|
255
262
|
*/
|
|
256
|
-
function
|
|
263
|
+
function validatePromptbook(promptbook) {
|
|
257
264
|
// TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
|
|
258
265
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
|
|
259
266
|
if (promptbook.promptbookUrl !== undefined) {
|
|
@@ -317,8 +324,7 @@
|
|
|
317
324
|
throw new PromptbookLogicError("Parameter {".concat(template.resultingParameterName, "} is defined multiple times"));
|
|
318
325
|
}
|
|
319
326
|
definedParameters.add(template.resultingParameterName);
|
|
320
|
-
if (template.executionType === 'PROMPT_TEMPLATE' &&
|
|
321
|
-
(template.modelRequirements.modelVariant === undefined)) {
|
|
327
|
+
if (template.executionType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
|
|
322
328
|
throw new PromptbookLogicError(spaceTrim.spaceTrim("\n\n You must specify MODEL VARIANT in the prompt template \"".concat(template.title, "\"\n\n For example:\n - MODEL VARIANT Chat\n - MODEL NAME `gpt-4-1106-preview`\n\n ")));
|
|
323
329
|
}
|
|
324
330
|
if (template.jokers && template.jokers.length > 0) {
|
|
@@ -388,7 +394,7 @@
|
|
|
388
394
|
var loopLimit = LOOP_LIMIT;
|
|
389
395
|
var _loop_2 = function () {
|
|
390
396
|
if (loopLimit-- < 0) {
|
|
391
|
-
throw new UnexpectedError('Loop limit reached during detection of circular dependencies in `
|
|
397
|
+
throw new UnexpectedError('Loop limit reached during detection of circular dependencies in `validatePromptbook`');
|
|
392
398
|
}
|
|
393
399
|
var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
|
|
394
400
|
return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
|
|
@@ -423,7 +429,7 @@
|
|
|
423
429
|
* > * It checks:
|
|
424
430
|
* > * - it has a valid structure
|
|
425
431
|
* > * - ...
|
|
426
|
-
* > ex port function
|
|
432
|
+
* > ex port function validatePromptbook(promptbook: unknown): asserts promptbook is PromptbookJson {
|
|
427
433
|
*/
|
|
428
434
|
|
|
429
435
|
/**
|
|
@@ -465,7 +471,7 @@
|
|
|
465
471
|
/**
|
|
466
472
|
* The version of the Promptbook library
|
|
467
473
|
*/
|
|
468
|
-
var PROMPTBOOK_VERSION = '0.59.0-
|
|
474
|
+
var PROMPTBOOK_VERSION = '0.59.0-36';
|
|
469
475
|
|
|
470
476
|
/**
|
|
471
477
|
* Function `addUsage` will add multiple usages into one
|
|
@@ -1006,7 +1012,7 @@
|
|
|
1006
1012
|
var _this = this;
|
|
1007
1013
|
var promptbook = options.promptbook, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
|
|
1008
1014
|
var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? 3 : _b;
|
|
1009
|
-
|
|
1015
|
+
validatePromptbook(promptbook);
|
|
1010
1016
|
var promptbookExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
|
|
1011
1017
|
function executeSingleTemplate(currentTemplate) {
|
|
1012
1018
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1437,7 +1443,7 @@
|
|
|
1437
1443
|
return template.dependentParameterNames.every(function (name) { return resovedParameters_1.includes(name); });
|
|
1438
1444
|
});
|
|
1439
1445
|
if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
|
|
1440
|
-
throw new UnexpectedError(spaceTrim.spaceTrim("\n Can not resolve some parameters\n\n Note: This should be catched during
|
|
1446
|
+
throw new UnexpectedError(spaceTrim.spaceTrim("\n Can not resolve some parameters\n\n Note: This should be catched during validatePromptbook\n "));
|
|
1441
1447
|
case 1:
|
|
1442
1448
|
if (!!currentTemplate) return [3 /*break*/, 3];
|
|
1443
1449
|
/* [5] */ return [4 /*yield*/, Promise.race(resolving_1)];
|
|
@@ -1798,6 +1804,7 @@
|
|
|
1798
1804
|
* Library of promptbooks that groups together promptbooks for an application.
|
|
1799
1805
|
* This implementation is a very thin wrapper around the Array / Map of promptbooks.
|
|
1800
1806
|
*
|
|
1807
|
+
* @private use `createLibraryFromJson` instead
|
|
1801
1808
|
* @see https://github.com/webgptorg/promptbook#promptbook-library
|
|
1802
1809
|
*/
|
|
1803
1810
|
var SimplePromptbookLibrary = /** @class */ (function () {
|
|
@@ -1806,8 +1813,9 @@
|
|
|
1806
1813
|
*
|
|
1807
1814
|
* @param promptbooks !!!
|
|
1808
1815
|
*
|
|
1816
|
+
* @private Use instead `createLibraryFromJson`
|
|
1809
1817
|
* Note: During the construction logic of all promptbooks are validated
|
|
1810
|
-
* Note: It is not recommended to use this constructor directly, use `
|
|
1818
|
+
* Note: It is not recommended to use this constructor directly, use `createLibraryFromJson` *(or other variant)* instead
|
|
1811
1819
|
*/
|
|
1812
1820
|
function SimplePromptbookLibrary() {
|
|
1813
1821
|
var e_1, _a;
|
|
@@ -1822,7 +1830,7 @@
|
|
|
1822
1830
|
if (promptbook.promptbookUrl === undefined) {
|
|
1823
1831
|
throw new PromptbookReferenceError(spaceTrim.spaceTrim("\n Promptbook with name \"".concat(promptbook.title, "\" does not have defined URL\n\n Note: Promptbooks without URLs are called anonymous promptbooks\n They can be used as standalone promptbooks, but they cannot be referenced by other promptbooks\n And also they cannot be used in the promptbook library\n\n ")));
|
|
1824
1832
|
}
|
|
1825
|
-
|
|
1833
|
+
validatePromptbook(promptbook);
|
|
1826
1834
|
// Note: [🦄]
|
|
1827
1835
|
if (this.library.has(promptbook.promptbookUrl) &&
|
|
1828
1836
|
promptbookJsonToString(promptbook) !==
|
|
@@ -1876,68 +1884,19 @@
|
|
|
1876
1884
|
/**
|
|
1877
1885
|
* Creates PromptbookLibrary from array of PromptbookJson or PromptbookString
|
|
1878
1886
|
*
|
|
1879
|
-
* Note:
|
|
1887
|
+
* Note: Functions `libraryToJson` and `createLibraryFromJson` are complementary
|
|
1880
1888
|
* Note: During the construction syntax and logic of all sources are validated
|
|
1881
1889
|
*
|
|
1882
1890
|
* @param promptbookSources
|
|
1883
1891
|
* @returns PromptbookLibrary
|
|
1884
1892
|
*/
|
|
1885
|
-
function
|
|
1886
|
-
var
|
|
1893
|
+
function createLibraryFromJson() {
|
|
1894
|
+
var promptbooks = [];
|
|
1887
1895
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1888
|
-
|
|
1896
|
+
promptbooks[_i] = arguments[_i];
|
|
1889
1897
|
}
|
|
1890
|
-
return
|
|
1891
|
-
var promptbooks, promptbookSources_1, promptbookSources_1_1, source, promptbook, e_1_1;
|
|
1892
|
-
var e_1, _a;
|
|
1893
|
-
return __generator(this, function (_b) {
|
|
1894
|
-
switch (_b.label) {
|
|
1895
|
-
case 0:
|
|
1896
|
-
promptbooks = new Array();
|
|
1897
|
-
_b.label = 1;
|
|
1898
|
-
case 1:
|
|
1899
|
-
_b.trys.push([1, 8, 9, 10]);
|
|
1900
|
-
promptbookSources_1 = __values(promptbookSources), promptbookSources_1_1 = promptbookSources_1.next();
|
|
1901
|
-
_b.label = 2;
|
|
1902
|
-
case 2:
|
|
1903
|
-
if (!!promptbookSources_1_1.done) return [3 /*break*/, 7];
|
|
1904
|
-
source = promptbookSources_1_1.value;
|
|
1905
|
-
promptbook = void 0;
|
|
1906
|
-
if (!(typeof source === 'string')) return [3 /*break*/, 4];
|
|
1907
|
-
return [4 /*yield*/, promptbookStringToJson(source)];
|
|
1908
|
-
case 3:
|
|
1909
|
-
// Note: When directly creating from string, no need to validate the source
|
|
1910
|
-
// The validation is performed always before execution
|
|
1911
|
-
promptbook = _b.sent();
|
|
1912
|
-
return [3 /*break*/, 5];
|
|
1913
|
-
case 4:
|
|
1914
|
-
promptbook = source;
|
|
1915
|
-
_b.label = 5;
|
|
1916
|
-
case 5:
|
|
1917
|
-
promptbooks.push(promptbook);
|
|
1918
|
-
_b.label = 6;
|
|
1919
|
-
case 6:
|
|
1920
|
-
promptbookSources_1_1 = promptbookSources_1.next();
|
|
1921
|
-
return [3 /*break*/, 2];
|
|
1922
|
-
case 7: return [3 /*break*/, 10];
|
|
1923
|
-
case 8:
|
|
1924
|
-
e_1_1 = _b.sent();
|
|
1925
|
-
e_1 = { error: e_1_1 };
|
|
1926
|
-
return [3 /*break*/, 10];
|
|
1927
|
-
case 9:
|
|
1928
|
-
try {
|
|
1929
|
-
if (promptbookSources_1_1 && !promptbookSources_1_1.done && (_a = promptbookSources_1.return)) _a.call(promptbookSources_1);
|
|
1930
|
-
}
|
|
1931
|
-
finally { if (e_1) throw e_1.error; }
|
|
1932
|
-
return [7 /*endfinally*/];
|
|
1933
|
-
case 10: return [2 /*return*/, new (SimplePromptbookLibrary.bind.apply(SimplePromptbookLibrary, __spreadArray([void 0], __read(promptbooks), false)))()];
|
|
1934
|
-
}
|
|
1935
|
-
});
|
|
1936
|
-
});
|
|
1898
|
+
return new (SimplePromptbookLibrary.bind.apply(SimplePromptbookLibrary, __spreadArray([void 0], __read(promptbooks), false)))();
|
|
1937
1899
|
}
|
|
1938
|
-
/**
|
|
1939
|
-
* TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
|
|
1940
|
-
*/
|
|
1941
1900
|
|
|
1942
1901
|
/* tslint:disable */
|
|
1943
1902
|
function normalizeToKebabCase(sentence) {
|
|
@@ -1996,85 +1955,100 @@
|
|
|
1996
1955
|
|
|
1997
1956
|
function prepareKnowledgeFromMarkdown(options) {
|
|
1998
1957
|
return __awaiter(this, void 0, void 0, function () {
|
|
1999
|
-
var content, llmTools, library,
|
|
1958
|
+
var content, llmTools, _a, isVerbose, library, prepareKnowledgeFromMarkdownPromptbook, prepareKnowledgeFromMarkdownExecutor, prepareKeywordsPromptbook, prepareKeywordsExecutor, result, outputParameters, knowledgeRaw, knowledgeTextPieces, knowledge;
|
|
2000
1959
|
var _this = this;
|
|
2001
|
-
return __generator(this, function (
|
|
2002
|
-
switch (
|
|
1960
|
+
return __generator(this, function (_b) {
|
|
1961
|
+
switch (_b.label) {
|
|
2003
1962
|
case 0:
|
|
2004
|
-
content = options.content, llmTools = options.llmTools;
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
title: 'Prepare Knowledge from Markdown',
|
|
2008
|
-
promptbookUrl: 'https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md',
|
|
2009
|
-
promptbookVersion: '0.59.0-5',
|
|
2010
|
-
parameters: [
|
|
2011
|
-
{ name: 'content', description: 'Markdown document content', isInput: true, isOutput: false },
|
|
2012
|
-
{ name: 'knowledge', description: 'The knowledge JSON object', isInput: false, isOutput: true },
|
|
2013
|
-
],
|
|
2014
|
-
promptTemplates: [
|
|
2015
|
-
{
|
|
2016
|
-
name: 'knowledge',
|
|
2017
|
-
title: 'Knowledge',
|
|
2018
|
-
dependentParameterNames: ['content'],
|
|
2019
|
-
executionType: 'PROMPT_TEMPLATE',
|
|
2020
|
-
modelRequirements: { modelVariant: 'CHAT', modelName: 'claude-3-opus-20240229' },
|
|
2021
|
-
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> {content}',
|
|
2022
|
-
resultingParameterName: 'knowledge',
|
|
2023
|
-
},
|
|
2024
|
-
],
|
|
2025
|
-
knowledge: [],
|
|
2026
|
-
})];
|
|
1963
|
+
content = options.content, llmTools = options.llmTools, _a = options.isVerbose, isVerbose = _a === void 0 ? false : _a;
|
|
1964
|
+
library = createLibraryFromJson.apply(void 0, __spreadArray([], __read(promptbookLibrary), false));
|
|
1965
|
+
return [4 /*yield*/, library.getPromptbookByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md')];
|
|
2027
1966
|
case 1:
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
promptbook: promptbook,
|
|
1967
|
+
prepareKnowledgeFromMarkdownPromptbook = _b.sent();
|
|
1968
|
+
prepareKnowledgeFromMarkdownExecutor = createPromptbookExecutor({
|
|
1969
|
+
promptbook: prepareKnowledgeFromMarkdownPromptbook,
|
|
2032
1970
|
tools: {
|
|
2033
1971
|
llm: llmTools,
|
|
2034
1972
|
script: [
|
|
2035
|
-
/* <- TODO: Allow to just
|
|
1973
|
+
/* <- TODO: Allow to just keep script undefined */
|
|
2036
1974
|
],
|
|
2037
1975
|
},
|
|
2038
1976
|
});
|
|
2039
|
-
return [4 /*yield*/,
|
|
1977
|
+
return [4 /*yield*/, library.getPromptbookByUrl('https://promptbook.studio/promptbook/prepare-keywords.ptbk.md')];
|
|
2040
1978
|
case 2:
|
|
2041
|
-
|
|
1979
|
+
prepareKeywordsPromptbook = _b.sent();
|
|
1980
|
+
prepareKeywordsExecutor = createPromptbookExecutor({
|
|
1981
|
+
promptbook: prepareKeywordsPromptbook,
|
|
1982
|
+
tools: {
|
|
1983
|
+
llm: llmTools,
|
|
1984
|
+
script: [
|
|
1985
|
+
/* <- TODO: Allow to just keep script undefined */
|
|
1986
|
+
],
|
|
1987
|
+
},
|
|
1988
|
+
});
|
|
1989
|
+
return [4 /*yield*/, prepareKnowledgeFromMarkdownExecutor({ content: content })];
|
|
1990
|
+
case 3:
|
|
1991
|
+
result = _b.sent();
|
|
2042
1992
|
assertsExecutionSuccessful(result);
|
|
2043
1993
|
outputParameters = result.outputParameters;
|
|
2044
1994
|
knowledgeRaw = outputParameters.knowledge;
|
|
2045
1995
|
knowledgeTextPieces = (knowledgeRaw || '').split('\n---\n');
|
|
1996
|
+
if (isVerbose) {
|
|
1997
|
+
console.info('knowledgeTextPieces:', knowledgeTextPieces);
|
|
1998
|
+
}
|
|
2046
1999
|
return [4 /*yield*/, Promise.all(knowledgeTextPieces.map(function (knowledgeTextPiece, i) { return __awaiter(_this, void 0, void 0, function () {
|
|
2047
|
-
var name, title, content, keywords, index, sources;
|
|
2048
|
-
return __generator(this, function (
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2000
|
+
var name, title, content, keywords, index, sources, result_1, _a, outputParameters_1, keywordsRaw, error_1;
|
|
2001
|
+
return __generator(this, function (_b) {
|
|
2002
|
+
switch (_b.label) {
|
|
2003
|
+
case 0:
|
|
2004
|
+
name = "piece-".concat(i);
|
|
2005
|
+
title = spaceTrim__default["default"](knowledgeTextPiece.substring(0, 100));
|
|
2006
|
+
content = spaceTrim__default["default"](knowledgeTextPiece);
|
|
2007
|
+
keywords = [];
|
|
2008
|
+
index = [];
|
|
2009
|
+
sources = [];
|
|
2010
|
+
_b.label = 1;
|
|
2011
|
+
case 1:
|
|
2012
|
+
_b.trys.push([1, 3, , 4]);
|
|
2013
|
+
// TODO: !!!! Summarize name and title from the content
|
|
2014
|
+
title = spaceTrim__default["default"](knowledgeTextPiece.substring(0, 30));
|
|
2015
|
+
name = normalizeToKebabCase(title);
|
|
2016
|
+
return [4 /*yield*/, prepareKeywordsExecutor({ content: content })];
|
|
2017
|
+
case 2:
|
|
2018
|
+
result_1 = _b.sent();
|
|
2019
|
+
_a = result_1.outputParameters, outputParameters_1 = _a === void 0 ? {} : _a;
|
|
2020
|
+
keywordsRaw = outputParameters_1.keywords;
|
|
2021
|
+
keywords = (keywordsRaw || '')
|
|
2022
|
+
.split(',')
|
|
2023
|
+
.map(function (keyword) { return keyword.trim(); })
|
|
2024
|
+
.filter(function (keyword) { return keyword !== ''; });
|
|
2025
|
+
if (isVerbose) {
|
|
2026
|
+
console.info("Keywords for \"".concat(title, "\":"), keywords);
|
|
2027
|
+
}
|
|
2028
|
+
// ---
|
|
2029
|
+
// TODO: !!!! Index through LLM model
|
|
2030
|
+
index.push({
|
|
2031
|
+
modelName: 'fake-model',
|
|
2032
|
+
position: new Array(25).fill(0).map(function () { return Math.random() * 2 - 1; }),
|
|
2033
|
+
});
|
|
2034
|
+
return [3 /*break*/, 4];
|
|
2035
|
+
case 3:
|
|
2036
|
+
error_1 = _b.sent();
|
|
2037
|
+
console.error(error_1);
|
|
2038
|
+
return [3 /*break*/, 4];
|
|
2039
|
+
case 4: return [2 /*return*/, {
|
|
2040
|
+
name: name,
|
|
2041
|
+
title: title,
|
|
2042
|
+
content: content,
|
|
2043
|
+
keywords: keywords,
|
|
2044
|
+
index: index,
|
|
2045
|
+
sources: sources,
|
|
2046
|
+
}];
|
|
2065
2047
|
}
|
|
2066
|
-
return [2 /*return*/, {
|
|
2067
|
-
name: name,
|
|
2068
|
-
title: title,
|
|
2069
|
-
content: content,
|
|
2070
|
-
keywords: keywords,
|
|
2071
|
-
index: index,
|
|
2072
|
-
sources: sources,
|
|
2073
|
-
}];
|
|
2074
2048
|
});
|
|
2075
2049
|
}); }))];
|
|
2076
|
-
case
|
|
2077
|
-
knowledge =
|
|
2050
|
+
case 4:
|
|
2051
|
+
knowledge = _b.sent();
|
|
2078
2052
|
return [2 /*return*/, knowledge];
|
|
2079
2053
|
}
|
|
2080
2054
|
});
|
|
@@ -2923,9 +2897,279 @@
|
|
|
2923
2897
|
return value;
|
|
2924
2898
|
}
|
|
2925
2899
|
|
|
2900
|
+
/**
|
|
2901
|
+
* Compile promptbook from string (markdown) format to JSON format synchronously
|
|
2902
|
+
*
|
|
2903
|
+
* Note: There are two similar functions:
|
|
2904
|
+
* - `promptbookStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
|
|
2905
|
+
* - `promptbookStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
2906
|
+
*
|
|
2907
|
+
* @param promptbookString {Promptbook} in string markdown format (.ptbk.md)
|
|
2908
|
+
* @param options - Options and tools for the compilation
|
|
2909
|
+
* @returns {Promptbook} compiled in JSON format (.ptbk.json)
|
|
2910
|
+
* @throws {PromptbookSyntaxError} if the promptbook string is not valid
|
|
2911
|
+
*
|
|
2912
|
+
* Note: This function does not validate logic of the pipeline only the syntax
|
|
2913
|
+
* Note: This function acts as compilation process
|
|
2914
|
+
*/
|
|
2915
|
+
function promptbookStringToJsonSync(promptbookString) {
|
|
2916
|
+
var e_1, _a, e_2, _b;
|
|
2917
|
+
var promptbookJson = {
|
|
2918
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2919
|
+
title: undefined /* <- Note: Putting here placeholder to keep `title` on top at final JSON */,
|
|
2920
|
+
promptbookUrl: undefined /* <- Note: Putting here placeholder to keep `promptbookUrl` on top at final JSON */,
|
|
2921
|
+
promptbookVersion: PROMPTBOOK_VERSION,
|
|
2922
|
+
description: undefined /* <- Note: Putting here placeholder to keep `description` on top at final JSON */,
|
|
2923
|
+
parameters: [],
|
|
2924
|
+
promptTemplates: [],
|
|
2925
|
+
knowledge: [],
|
|
2926
|
+
};
|
|
2927
|
+
// =============================================================
|
|
2928
|
+
// Note: 1️⃣ Normalization of the PROMPTBOOK string
|
|
2929
|
+
promptbookString = removeContentComments(promptbookString);
|
|
2930
|
+
promptbookString = promptbookString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
|
|
2931
|
+
promptbookString = promptbookString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
|
|
2932
|
+
// =============================================================
|
|
2933
|
+
///Note: 2️⃣ Function for adding parameters
|
|
2934
|
+
var addParam = function (parameterCommand) {
|
|
2935
|
+
var parameterName = parameterCommand.parameterName, parameterDescription = parameterCommand.parameterDescription, isInput = parameterCommand.isInput, isOutput = parameterCommand.isOutput;
|
|
2936
|
+
var existingParameter = promptbookJson.parameters.find(function (parameter) { return parameter.name === parameterName; });
|
|
2937
|
+
if (existingParameter &&
|
|
2938
|
+
existingParameter.description &&
|
|
2939
|
+
existingParameter.description !== parameterDescription &&
|
|
2940
|
+
parameterDescription) {
|
|
2941
|
+
throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameterName, "} is defined multiple times with different description.\n\n First definition:\n ").concat(block(existingParameter.description || '[undefined]'), "\n\n Second definition:\n ").concat(block(parameterDescription || '[undefined]'), "\n "); }));
|
|
2942
|
+
}
|
|
2943
|
+
if (existingParameter) {
|
|
2944
|
+
if (parameterDescription) {
|
|
2945
|
+
existingParameter.description = parameterDescription;
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
else {
|
|
2949
|
+
promptbookJson.parameters.push({
|
|
2950
|
+
name: parameterName,
|
|
2951
|
+
description: parameterDescription || undefined,
|
|
2952
|
+
isInput: isInput,
|
|
2953
|
+
isOutput: isOutput,
|
|
2954
|
+
});
|
|
2955
|
+
}
|
|
2956
|
+
};
|
|
2957
|
+
// =============================================================
|
|
2958
|
+
// Note: 3️⃣ Parse the dynamic part - the template pipeline
|
|
2959
|
+
var markdownStructure = markdownToMarkdownStructure(promptbookString);
|
|
2960
|
+
var markdownStructureDeepness = countMarkdownStructureDeepness(markdownStructure);
|
|
2961
|
+
if (markdownStructureDeepness !== 2) {
|
|
2962
|
+
throw new PromptbookSyntaxError(spaceTrim.spaceTrim("\n Invalid markdown structure.\n The markdown must have exactly 2 levels of headings (one top-level section and one section for each template).\n Now it has ".concat(markdownStructureDeepness, " levels of headings.\n ")));
|
|
2963
|
+
}
|
|
2964
|
+
promptbookJson.title = markdownStructure.title;
|
|
2965
|
+
// TODO: [1] DRY description
|
|
2966
|
+
var description = markdownStructure.content;
|
|
2967
|
+
// Note: Remove codeblocks
|
|
2968
|
+
description = description.split(/^```.*^```/gms).join('');
|
|
2969
|
+
//Note: Remove lists and return statement
|
|
2970
|
+
description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
|
|
2971
|
+
description = spaceTrim.spaceTrim(description);
|
|
2972
|
+
if (description === '') {
|
|
2973
|
+
description = undefined;
|
|
2974
|
+
}
|
|
2975
|
+
promptbookJson.description = description;
|
|
2976
|
+
var defaultModelRequirements = {};
|
|
2977
|
+
var listItems = extractAllListItemsFromMarkdown(markdownStructure.content);
|
|
2978
|
+
try {
|
|
2979
|
+
for (var listItems_1 = __values(listItems), listItems_1_1 = listItems_1.next(); !listItems_1_1.done; listItems_1_1 = listItems_1.next()) {
|
|
2980
|
+
var listItem = listItems_1_1.value;
|
|
2981
|
+
var command = parseCommand(listItem);
|
|
2982
|
+
switch (command.type) {
|
|
2983
|
+
case 'PROMPTBOOK_URL':
|
|
2984
|
+
promptbookJson.promptbookUrl = command.promptbookUrl.href;
|
|
2985
|
+
break;
|
|
2986
|
+
case 'PROMPTBOOK_VERSION':
|
|
2987
|
+
promptbookJson.promptbookVersion = command.promptbookVersion;
|
|
2988
|
+
break;
|
|
2989
|
+
case 'MODEL':
|
|
2990
|
+
defaultModelRequirements[command.key] = command.value;
|
|
2991
|
+
break;
|
|
2992
|
+
case 'PARAMETER':
|
|
2993
|
+
addParam(command);
|
|
2994
|
+
break;
|
|
2995
|
+
default:
|
|
2996
|
+
throw new PromptbookSyntaxError("Command ".concat(command.type, " is not allowed in the head of the promptbook ONLY at the prompt template block"));
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
3000
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3001
|
+
finally {
|
|
3002
|
+
try {
|
|
3003
|
+
if (listItems_1_1 && !listItems_1_1.done && (_a = listItems_1.return)) _a.call(listItems_1);
|
|
3004
|
+
}
|
|
3005
|
+
finally { if (e_1) throw e_1.error; }
|
|
3006
|
+
}
|
|
3007
|
+
var _loop_1 = function (section) {
|
|
3008
|
+
var e_3, _e;
|
|
3009
|
+
// TODO: Parse prompt template description (the content out of the codeblock and lists)
|
|
3010
|
+
var templateModelRequirements = __assign({}, defaultModelRequirements);
|
|
3011
|
+
var listItems_3 = extractAllListItemsFromMarkdown(section.content);
|
|
3012
|
+
var dependentParameterNames = new Set();
|
|
3013
|
+
var executionType = 'PROMPT_TEMPLATE';
|
|
3014
|
+
var jokers = [];
|
|
3015
|
+
var postprocessing = [];
|
|
3016
|
+
var expectAmount = {};
|
|
3017
|
+
var expectFormat = undefined;
|
|
3018
|
+
var isExecutionTypeChanged = false;
|
|
3019
|
+
try {
|
|
3020
|
+
for (var listItems_2 = (e_3 = void 0, __values(listItems_3)), listItems_2_1 = listItems_2.next(); !listItems_2_1.done; listItems_2_1 = listItems_2.next()) {
|
|
3021
|
+
var listItem = listItems_2_1.value;
|
|
3022
|
+
var command = parseCommand(listItem);
|
|
3023
|
+
switch (command.type) {
|
|
3024
|
+
case 'JOKER':
|
|
3025
|
+
jokers.push(command.parameterName);
|
|
3026
|
+
dependentParameterNames.add(command.parameterName);
|
|
3027
|
+
break;
|
|
3028
|
+
case 'EXECUTE':
|
|
3029
|
+
if (isExecutionTypeChanged) {
|
|
3030
|
+
throw new PromptbookSyntaxError('Execution type is already defined in the prompt template. It can be defined only once.');
|
|
3031
|
+
}
|
|
3032
|
+
executionType = command.executionType;
|
|
3033
|
+
isExecutionTypeChanged = true;
|
|
3034
|
+
break;
|
|
3035
|
+
case 'MODEL':
|
|
3036
|
+
templateModelRequirements[command.key] = command.value;
|
|
3037
|
+
break;
|
|
3038
|
+
case 'PARAMETER':
|
|
3039
|
+
// Note: This is just for detecting resulitng parameter name
|
|
3040
|
+
addParam(command);
|
|
3041
|
+
break;
|
|
3042
|
+
case 'POSTPROCESS':
|
|
3043
|
+
postprocessing.push(command.functionName);
|
|
3044
|
+
break;
|
|
3045
|
+
case 'EXPECT_AMOUNT':
|
|
3046
|
+
// eslint-disable-next-line no-case-declarations
|
|
3047
|
+
var unit = command.unit.toLowerCase();
|
|
3048
|
+
expectAmount[unit] = expectAmount[unit] || {};
|
|
3049
|
+
if (command.sign === 'MINIMUM' || command.sign === 'EXACTLY') {
|
|
3050
|
+
if (expectAmount[unit].min !== undefined) {
|
|
3051
|
+
throw new PromptbookSyntaxError("Already defined minumum ".concat(expectAmount[unit].min, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
|
|
3052
|
+
}
|
|
3053
|
+
expectAmount[unit].min = command.amount;
|
|
3054
|
+
} /* not else */
|
|
3055
|
+
if (command.sign === 'MAXIMUM' || command.sign === 'EXACTLY') {
|
|
3056
|
+
if (expectAmount[unit].max !== undefined) {
|
|
3057
|
+
throw new PromptbookSyntaxError("Already defined maximum ".concat(expectAmount[unit].max, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
|
|
3058
|
+
}
|
|
3059
|
+
expectAmount[unit].max = command.amount;
|
|
3060
|
+
}
|
|
3061
|
+
break;
|
|
3062
|
+
case 'EXPECT_FORMAT':
|
|
3063
|
+
if (expectFormat !== undefined && command.format !== expectFormat) {
|
|
3064
|
+
throw new PromptbookSyntaxError("Expect format is already defined to \"".concat(expectFormat, "\". Now you try to redefine it by \"").concat(command.format, "\"."));
|
|
3065
|
+
}
|
|
3066
|
+
expectFormat = command.format;
|
|
3067
|
+
break;
|
|
3068
|
+
default:
|
|
3069
|
+
throw new PromptbookSyntaxError("Command ".concat(command.type, " is not allowed in the block of the prompt template ONLY at the head of the promptbook"));
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
3074
|
+
finally {
|
|
3075
|
+
try {
|
|
3076
|
+
if (listItems_2_1 && !listItems_2_1.done && (_e = listItems_2.return)) _e.call(listItems_2);
|
|
3077
|
+
}
|
|
3078
|
+
finally { if (e_3) throw e_3.error; }
|
|
3079
|
+
}
|
|
3080
|
+
var _f = extractOneBlockFromMarkdown(section.content), language = _f.language, content = _f.content;
|
|
3081
|
+
if (executionType === 'SCRIPT') {
|
|
3082
|
+
if (!language) {
|
|
3083
|
+
throw new PromptbookSyntaxError('You must specify the language of the script in the prompt template');
|
|
3084
|
+
}
|
|
3085
|
+
else if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
|
|
3086
|
+
throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Script language ".concat(language, " is not supported.\n\n Supported languages are:\n ").concat(block(SUPPORTED_SCRIPT_LANGUAGES.join(', ')), "\n\n "); }));
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
var lastLine = section.content.split('\n').pop();
|
|
3090
|
+
var match = /^->\s*\{(?<resultingParamName>[a-z0-9_]+)\}/im.exec(lastLine);
|
|
3091
|
+
if (!match || match.groups === undefined || match.groups.resultingParamName === undefined) {
|
|
3092
|
+
throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Invalid template - each section must end with \"-> {...}\"\n\n Invalid section:\n ".concat(block(
|
|
3093
|
+
// TODO: Show code of invalid sections each time + DRY
|
|
3094
|
+
section.content
|
|
3095
|
+
.split('\n')
|
|
3096
|
+
.map(function (line) { return "> ".concat(line); })
|
|
3097
|
+
.join('\n')), "\n "); }));
|
|
3098
|
+
}
|
|
3099
|
+
var resultingParameterName = match.groups.resultingParamName;
|
|
3100
|
+
// TODO: [1] DRY description
|
|
3101
|
+
var description_1 = section.content;
|
|
3102
|
+
// Note: Remove codeblocks
|
|
3103
|
+
description_1 = description_1.split(/^```.*^```/gms).join('');
|
|
3104
|
+
//Note: Remove lists and return statement
|
|
3105
|
+
description_1 = description_1.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
|
|
3106
|
+
description_1 = spaceTrim.spaceTrim(description_1);
|
|
3107
|
+
if (description_1 === '') {
|
|
3108
|
+
description_1 = undefined;
|
|
3109
|
+
}
|
|
3110
|
+
if (Object.keys(jokers).length === 0) {
|
|
3111
|
+
jokers = undefined;
|
|
3112
|
+
}
|
|
3113
|
+
if (Object.keys(expectAmount).length === 0) {
|
|
3114
|
+
expectAmount = undefined;
|
|
3115
|
+
}
|
|
3116
|
+
if (Object.keys(postprocessing).length === 0) {
|
|
3117
|
+
postprocessing = undefined;
|
|
3118
|
+
}
|
|
3119
|
+
dependentParameterNames = union(dependentParameterNames, extractParametersFromPromptTemplate(__assign(__assign({}, section), { description: description_1, executionType: executionType, content: content })));
|
|
3120
|
+
if (templateModelRequirements.modelVariant === undefined) {
|
|
3121
|
+
templateModelRequirements.modelVariant = 'CHAT';
|
|
3122
|
+
}
|
|
3123
|
+
var template = {
|
|
3124
|
+
name: titleToName(section.title),
|
|
3125
|
+
title: section.title,
|
|
3126
|
+
description: description_1,
|
|
3127
|
+
dependentParameterNames: Array.from(dependentParameterNames),
|
|
3128
|
+
executionType: executionType,
|
|
3129
|
+
jokers: jokers,
|
|
3130
|
+
postprocessing: postprocessing,
|
|
3131
|
+
expectations: expectAmount,
|
|
3132
|
+
expectFormat: expectFormat,
|
|
3133
|
+
modelRequirements: templateModelRequirements,
|
|
3134
|
+
contentLanguage: executionType === 'SCRIPT' ? language : undefined,
|
|
3135
|
+
content: content,
|
|
3136
|
+
resultingParameterName: resultingParameterName,
|
|
3137
|
+
};
|
|
3138
|
+
if (executionType !== 'PROMPT_TEMPLATE') {
|
|
3139
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3140
|
+
delete template.modelRequirements;
|
|
3141
|
+
}
|
|
3142
|
+
promptbookJson.promptTemplates.push(template);
|
|
3143
|
+
};
|
|
3144
|
+
try {
|
|
3145
|
+
for (var _c = __values(markdownStructure.sections), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
3146
|
+
var section = _d.value;
|
|
3147
|
+
_loop_1(section);
|
|
3148
|
+
}
|
|
3149
|
+
}
|
|
3150
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3151
|
+
finally {
|
|
3152
|
+
try {
|
|
3153
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
3154
|
+
}
|
|
3155
|
+
finally { if (e_2) throw e_2.error; }
|
|
3156
|
+
}
|
|
3157
|
+
// =============================================================
|
|
3158
|
+
return promptbookJson;
|
|
3159
|
+
}
|
|
3160
|
+
/**
|
|
3161
|
+
* TODO: Report here line/column of error
|
|
3162
|
+
* TODO: Use spaceTrim more effectively
|
|
3163
|
+
* TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
|
|
3164
|
+
*/
|
|
3165
|
+
|
|
2926
3166
|
/**
|
|
2927
3167
|
* Compile promptbook from string (markdown) format to JSON format
|
|
2928
3168
|
*
|
|
3169
|
+
* Note: There are two similar functions:
|
|
3170
|
+
* - `promptbookStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
|
|
3171
|
+
* - `promptbookStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
3172
|
+
*
|
|
2929
3173
|
* @param promptbookString {Promptbook} in string markdown format (.ptbk.md)
|
|
2930
3174
|
* @param options - Options and tools for the compilation
|
|
2931
3175
|
* @returns {Promptbook} compiled in JSON format (.ptbk.json)
|
|
@@ -2937,262 +3181,29 @@
|
|
|
2937
3181
|
function promptbookStringToJson(promptbookString, options) {
|
|
2938
3182
|
if (options === void 0) { options = {}; }
|
|
2939
3183
|
return __awaiter(this, void 0, void 0, function () {
|
|
2940
|
-
var llmTools,
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
switch (_e.label) {
|
|
3184
|
+
var llmTools, knowledge, promptbookJson;
|
|
3185
|
+
return __generator(this, function (_a) {
|
|
3186
|
+
switch (_a.label) {
|
|
2944
3187
|
case 0:
|
|
2945
3188
|
llmTools = options.llmTools;
|
|
2946
|
-
promptbookJson = {
|
|
2947
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2948
|
-
title: undefined /* <- Note: Putting here placeholder to keep `title` on top at final JSON */,
|
|
2949
|
-
promptbookUrl: undefined /* <- Note: Putting here placeholder to keep `promptbookUrl` on top at final JSON */,
|
|
2950
|
-
promptbookVersion: PROMPTBOOK_VERSION,
|
|
2951
|
-
description: undefined /* <- Note: Putting here placeholder to keep `description` on top at final JSON */,
|
|
2952
|
-
parameters: [],
|
|
2953
|
-
promptTemplates: [],
|
|
2954
|
-
knowledge: [],
|
|
2955
|
-
};
|
|
2956
3189
|
if (!llmTools) return [3 /*break*/, 2];
|
|
2957
3190
|
return [4 /*yield*/, prepareKnowledgeFromMarkdown({
|
|
2958
3191
|
content: 'Roses are red, violets are blue, programmers use Promptbook, users too',
|
|
2959
3192
|
llmTools: llmTools,
|
|
2960
3193
|
})];
|
|
2961
3194
|
case 1:
|
|
2962
|
-
knowledge =
|
|
3195
|
+
knowledge = _a.sent();
|
|
2963
3196
|
console.info('!!!! knowledge', knowledge);
|
|
2964
|
-
|
|
3197
|
+
_a.label = 2;
|
|
2965
3198
|
case 2:
|
|
2966
|
-
|
|
2967
|
-
// Note: 1️⃣ Normalization of the PROMPTBOOK string
|
|
2968
|
-
promptbookString = removeContentComments(promptbookString);
|
|
2969
|
-
promptbookString = promptbookString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
|
|
2970
|
-
promptbookString = promptbookString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
|
|
2971
|
-
addParam = function (parameterCommand) {
|
|
2972
|
-
var parameterName = parameterCommand.parameterName, parameterDescription = parameterCommand.parameterDescription, isInput = parameterCommand.isInput, isOutput = parameterCommand.isOutput;
|
|
2973
|
-
var existingParameter = promptbookJson.parameters.find(function (parameter) { return parameter.name === parameterName; });
|
|
2974
|
-
if (existingParameter &&
|
|
2975
|
-
existingParameter.description &&
|
|
2976
|
-
existingParameter.description !== parameterDescription &&
|
|
2977
|
-
parameterDescription) {
|
|
2978
|
-
throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameterName, "} is defined multiple times with different description.\n\n First definition:\n ").concat(block(existingParameter.description || '[undefined]'), "\n\n Second definition:\n ").concat(block(parameterDescription || '[undefined]'), "\n "); }));
|
|
2979
|
-
}
|
|
2980
|
-
if (existingParameter) {
|
|
2981
|
-
if (parameterDescription) {
|
|
2982
|
-
existingParameter.description = parameterDescription;
|
|
2983
|
-
}
|
|
2984
|
-
}
|
|
2985
|
-
else {
|
|
2986
|
-
promptbookJson.parameters.push({
|
|
2987
|
-
name: parameterName,
|
|
2988
|
-
description: parameterDescription || undefined,
|
|
2989
|
-
isInput: isInput,
|
|
2990
|
-
isOutput: isOutput,
|
|
2991
|
-
});
|
|
2992
|
-
}
|
|
2993
|
-
};
|
|
2994
|
-
markdownStructure = markdownToMarkdownStructure(promptbookString);
|
|
2995
|
-
markdownStructureDeepness = countMarkdownStructureDeepness(markdownStructure);
|
|
2996
|
-
if (markdownStructureDeepness !== 2) {
|
|
2997
|
-
throw new PromptbookSyntaxError(spaceTrim.spaceTrim("\n Invalid markdown structure.\n The markdown must have exactly 2 levels of headings (one top-level section and one section for each template).\n Now it has ".concat(markdownStructureDeepness, " levels of headings.\n ")));
|
|
2998
|
-
}
|
|
2999
|
-
promptbookJson.title = markdownStructure.title;
|
|
3000
|
-
description = markdownStructure.content;
|
|
3001
|
-
// Note: Remove codeblocks
|
|
3002
|
-
description = description.split(/^```.*^```/gms).join('');
|
|
3003
|
-
//Note: Remove lists and return statement
|
|
3004
|
-
description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
|
|
3005
|
-
description = spaceTrim.spaceTrim(description);
|
|
3006
|
-
if (description === '') {
|
|
3007
|
-
description = undefined;
|
|
3008
|
-
}
|
|
3009
|
-
promptbookJson.description = description;
|
|
3010
|
-
defaultModelRequirements = {};
|
|
3011
|
-
listItems = extractAllListItemsFromMarkdown(markdownStructure.content);
|
|
3012
|
-
try {
|
|
3013
|
-
for (listItems_1 = __values(listItems), listItems_1_1 = listItems_1.next(); !listItems_1_1.done; listItems_1_1 = listItems_1.next()) {
|
|
3014
|
-
listItem = listItems_1_1.value;
|
|
3015
|
-
command = parseCommand(listItem);
|
|
3016
|
-
switch (command.type) {
|
|
3017
|
-
case 'PROMPTBOOK_URL':
|
|
3018
|
-
promptbookJson.promptbookUrl = command.promptbookUrl.href;
|
|
3019
|
-
break;
|
|
3020
|
-
case 'PROMPTBOOK_VERSION':
|
|
3021
|
-
promptbookJson.promptbookVersion = command.promptbookVersion;
|
|
3022
|
-
break;
|
|
3023
|
-
case 'MODEL':
|
|
3024
|
-
defaultModelRequirements[command.key] = command.value;
|
|
3025
|
-
break;
|
|
3026
|
-
case 'PARAMETER':
|
|
3027
|
-
addParam(command);
|
|
3028
|
-
break;
|
|
3029
|
-
default:
|
|
3030
|
-
throw new PromptbookSyntaxError("Command ".concat(command.type, " is not allowed in the head of the promptbook ONLY at the prompt template block"));
|
|
3031
|
-
}
|
|
3032
|
-
}
|
|
3033
|
-
}
|
|
3034
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3035
|
-
finally {
|
|
3036
|
-
try {
|
|
3037
|
-
if (listItems_1_1 && !listItems_1_1.done && (_c = listItems_1.return)) _c.call(listItems_1);
|
|
3038
|
-
}
|
|
3039
|
-
finally { if (e_1) throw e_1.error; }
|
|
3040
|
-
}
|
|
3041
|
-
_loop_1 = function (section) {
|
|
3042
|
-
var e_3, _f;
|
|
3043
|
-
// TODO: Parse prompt template description (the content out of the codeblock and lists)
|
|
3044
|
-
var templateModelRequirements = __assign({}, defaultModelRequirements);
|
|
3045
|
-
var listItems_3 = extractAllListItemsFromMarkdown(section.content);
|
|
3046
|
-
var dependentParameterNames = new Set();
|
|
3047
|
-
var executionType = 'PROMPT_TEMPLATE';
|
|
3048
|
-
var jokers = [];
|
|
3049
|
-
var postprocessing = [];
|
|
3050
|
-
var expectAmount = {};
|
|
3051
|
-
var expectFormat = undefined;
|
|
3052
|
-
var isExecutionTypeChanged = false;
|
|
3053
|
-
try {
|
|
3054
|
-
for (var listItems_2 = (e_3 = void 0, __values(listItems_3)), listItems_2_1 = listItems_2.next(); !listItems_2_1.done; listItems_2_1 = listItems_2.next()) {
|
|
3055
|
-
var listItem = listItems_2_1.value;
|
|
3056
|
-
var command = parseCommand(listItem);
|
|
3057
|
-
switch (command.type) {
|
|
3058
|
-
case 'JOKER':
|
|
3059
|
-
jokers.push(command.parameterName);
|
|
3060
|
-
dependentParameterNames.add(command.parameterName);
|
|
3061
|
-
break;
|
|
3062
|
-
case 'EXECUTE':
|
|
3063
|
-
if (isExecutionTypeChanged) {
|
|
3064
|
-
throw new PromptbookSyntaxError('Execution type is already defined in the prompt template. It can be defined only once.');
|
|
3065
|
-
}
|
|
3066
|
-
executionType = command.executionType;
|
|
3067
|
-
isExecutionTypeChanged = true;
|
|
3068
|
-
break;
|
|
3069
|
-
case 'MODEL':
|
|
3070
|
-
templateModelRequirements[command.key] = command.value;
|
|
3071
|
-
break;
|
|
3072
|
-
case 'PARAMETER':
|
|
3073
|
-
// Note: This is just for detecting resulitng parameter name
|
|
3074
|
-
addParam(command);
|
|
3075
|
-
break;
|
|
3076
|
-
case 'POSTPROCESS':
|
|
3077
|
-
postprocessing.push(command.functionName);
|
|
3078
|
-
break;
|
|
3079
|
-
case 'EXPECT_AMOUNT':
|
|
3080
|
-
// eslint-disable-next-line no-case-declarations
|
|
3081
|
-
var unit = command.unit.toLowerCase();
|
|
3082
|
-
expectAmount[unit] = expectAmount[unit] || {};
|
|
3083
|
-
if (command.sign === 'MINIMUM' || command.sign === 'EXACTLY') {
|
|
3084
|
-
if (expectAmount[unit].min !== undefined) {
|
|
3085
|
-
throw new PromptbookSyntaxError("Already defined minumum ".concat(expectAmount[unit].min, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
|
|
3086
|
-
}
|
|
3087
|
-
expectAmount[unit].min = command.amount;
|
|
3088
|
-
} /* not else */
|
|
3089
|
-
if (command.sign === 'MAXIMUM' || command.sign === 'EXACTLY') {
|
|
3090
|
-
if (expectAmount[unit].max !== undefined) {
|
|
3091
|
-
throw new PromptbookSyntaxError("Already defined maximum ".concat(expectAmount[unit].max, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
|
|
3092
|
-
}
|
|
3093
|
-
expectAmount[unit].max = command.amount;
|
|
3094
|
-
}
|
|
3095
|
-
break;
|
|
3096
|
-
case 'EXPECT_FORMAT':
|
|
3097
|
-
if (expectFormat !== undefined && command.format !== expectFormat) {
|
|
3098
|
-
throw new PromptbookSyntaxError("Expect format is already defined to \"".concat(expectFormat, "\". Now you try to redefine it by \"").concat(command.format, "\"."));
|
|
3099
|
-
}
|
|
3100
|
-
expectFormat = command.format;
|
|
3101
|
-
break;
|
|
3102
|
-
default:
|
|
3103
|
-
throw new PromptbookSyntaxError("Command ".concat(command.type, " is not allowed in the block of the prompt template ONLY at the head of the promptbook"));
|
|
3104
|
-
}
|
|
3105
|
-
}
|
|
3106
|
-
}
|
|
3107
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
3108
|
-
finally {
|
|
3109
|
-
try {
|
|
3110
|
-
if (listItems_2_1 && !listItems_2_1.done && (_f = listItems_2.return)) _f.call(listItems_2);
|
|
3111
|
-
}
|
|
3112
|
-
finally { if (e_3) throw e_3.error; }
|
|
3113
|
-
}
|
|
3114
|
-
var _g = extractOneBlockFromMarkdown(section.content), language = _g.language, content = _g.content;
|
|
3115
|
-
if (executionType === 'SCRIPT') {
|
|
3116
|
-
if (!language) {
|
|
3117
|
-
throw new PromptbookSyntaxError('You must specify the language of the script in the prompt template');
|
|
3118
|
-
}
|
|
3119
|
-
else if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
|
|
3120
|
-
throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Script language ".concat(language, " is not supported.\n\n Supported languages are:\n ").concat(block(SUPPORTED_SCRIPT_LANGUAGES.join(', ')), "\n\n "); }));
|
|
3121
|
-
}
|
|
3122
|
-
}
|
|
3123
|
-
var lastLine = section.content.split('\n').pop();
|
|
3124
|
-
var match = /^->\s*\{(?<resultingParamName>[a-z0-9_]+)\}/im.exec(lastLine);
|
|
3125
|
-
if (!match || match.groups === undefined || match.groups.resultingParamName === undefined) {
|
|
3126
|
-
throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Invalid template - each section must end with \"-> {...}\"\n\n Invalid section:\n ".concat(block(
|
|
3127
|
-
// TODO: Show code of invalid sections each time + DRY
|
|
3128
|
-
section.content
|
|
3129
|
-
.split('\n')
|
|
3130
|
-
.map(function (line) { return "> ".concat(line); })
|
|
3131
|
-
.join('\n')), "\n "); }));
|
|
3132
|
-
}
|
|
3133
|
-
var resultingParameterName = match.groups.resultingParamName;
|
|
3134
|
-
// TODO: [1] DRY description
|
|
3135
|
-
var description_1 = section.content;
|
|
3136
|
-
// Note: Remove codeblocks
|
|
3137
|
-
description_1 = description_1.split(/^```.*^```/gms).join('');
|
|
3138
|
-
//Note: Remove lists and return statement
|
|
3139
|
-
description_1 = description_1.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
|
|
3140
|
-
description_1 = spaceTrim.spaceTrim(description_1);
|
|
3141
|
-
if (description_1 === '') {
|
|
3142
|
-
description_1 = undefined;
|
|
3143
|
-
}
|
|
3144
|
-
if (Object.keys(jokers).length === 0) {
|
|
3145
|
-
jokers = undefined;
|
|
3146
|
-
}
|
|
3147
|
-
if (Object.keys(expectAmount).length === 0) {
|
|
3148
|
-
expectAmount = undefined;
|
|
3149
|
-
}
|
|
3150
|
-
if (Object.keys(postprocessing).length === 0) {
|
|
3151
|
-
postprocessing = undefined;
|
|
3152
|
-
}
|
|
3153
|
-
dependentParameterNames = union(dependentParameterNames, extractParametersFromPromptTemplate(__assign(__assign({}, section), { description: description_1, executionType: executionType, content: content })));
|
|
3154
|
-
if (templateModelRequirements.modelVariant === undefined) {
|
|
3155
|
-
templateModelRequirements.modelVariant = 'CHAT';
|
|
3156
|
-
}
|
|
3157
|
-
promptbookJson.promptTemplates.push({
|
|
3158
|
-
name: titleToName(section.title),
|
|
3159
|
-
title: section.title,
|
|
3160
|
-
description: description_1,
|
|
3161
|
-
dependentParameterNames: Array.from(dependentParameterNames),
|
|
3162
|
-
executionType: executionType,
|
|
3163
|
-
jokers: jokers,
|
|
3164
|
-
postprocessing: postprocessing,
|
|
3165
|
-
expectations: expectAmount,
|
|
3166
|
-
expectFormat: expectFormat,
|
|
3167
|
-
modelRequirements: templateModelRequirements,
|
|
3168
|
-
contentLanguage: executionType === 'SCRIPT' ? language : undefined,
|
|
3169
|
-
content: content,
|
|
3170
|
-
resultingParameterName: resultingParameterName,
|
|
3171
|
-
});
|
|
3172
|
-
};
|
|
3173
|
-
try {
|
|
3174
|
-
for (_a = __values(markdownStructure.sections), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
3175
|
-
section = _b.value;
|
|
3176
|
-
_loop_1(section);
|
|
3177
|
-
}
|
|
3178
|
-
}
|
|
3179
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3180
|
-
finally {
|
|
3181
|
-
try {
|
|
3182
|
-
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
|
|
3183
|
-
}
|
|
3184
|
-
finally { if (e_2) throw e_2.error; }
|
|
3185
|
-
}
|
|
3186
|
-
// =============================================================
|
|
3199
|
+
promptbookJson = promptbookStringToJsonSync(promptbookString);
|
|
3187
3200
|
return [2 /*return*/, promptbookJson];
|
|
3188
3201
|
}
|
|
3189
3202
|
});
|
|
3190
3203
|
});
|
|
3191
3204
|
}
|
|
3192
3205
|
/**
|
|
3193
|
-
* TODO:
|
|
3194
|
-
* TODO: Use spaceTrim more effectively
|
|
3195
|
-
* TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
|
|
3206
|
+
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
3196
3207
|
*/
|
|
3197
3208
|
|
|
3198
3209
|
/**
|
|
@@ -3229,19 +3240,19 @@
|
|
|
3229
3240
|
* - Factory function that returns Promise of array of PromptbookJson or PromptbookString
|
|
3230
3241
|
*
|
|
3231
3242
|
* Note: This is useful as internal tool for other constructor functions like
|
|
3232
|
-
* `
|
|
3243
|
+
* `createLibraryFromUrl` or `createLibraryFromDirectory`
|
|
3233
3244
|
* Consider using those functions instead of this one
|
|
3234
3245
|
*
|
|
3235
3246
|
* Note: The function does NOT return promise it returns the library directly which waits for the sources to be resolved
|
|
3236
3247
|
* when error occurs in given promise or factory function, it is thrown during `listPromptbooks` or `getPromptbookByUrl` call
|
|
3237
3248
|
*
|
|
3238
|
-
* Note: Consider using `
|
|
3249
|
+
* Note: Consider using `createLibraryFromDirectory` or `createLibraryFromUrl`
|
|
3239
3250
|
*
|
|
3240
3251
|
* @param promptbookSourcesPromiseOrFactory
|
|
3241
3252
|
* @returns PromptbookLibrary
|
|
3242
3253
|
* @deprecated Do not use, it will became internal tool for other constructor functions
|
|
3243
3254
|
*/
|
|
3244
|
-
function
|
|
3255
|
+
function createLibraryFromPromise(promptbookSourcesPromiseOrFactory) {
|
|
3245
3256
|
var library;
|
|
3246
3257
|
function forSources() {
|
|
3247
3258
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -3256,9 +3267,7 @@
|
|
|
3256
3267
|
return [4 /*yield*/, promptbookSourcesPromiseOrFactory];
|
|
3257
3268
|
case 1:
|
|
3258
3269
|
promptbookSources = _a.sent();
|
|
3259
|
-
|
|
3260
|
-
case 2:
|
|
3261
|
-
library = _a.sent();
|
|
3270
|
+
library = createLibraryFromJson.apply(void 0, __spreadArray([], __read(promptbookSources), false));
|
|
3262
3271
|
return [2 /*return*/];
|
|
3263
3272
|
}
|
|
3264
3273
|
});
|
|
@@ -3306,9 +3315,6 @@
|
|
|
3306
3315
|
isResponsibleForPrompt: isResponsibleForPrompt,
|
|
3307
3316
|
};
|
|
3308
3317
|
}
|
|
3309
|
-
/**
|
|
3310
|
-
* TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
|
|
3311
|
-
*/
|
|
3312
3318
|
|
|
3313
3319
|
/**
|
|
3314
3320
|
* Constructs Promptbook from given directory
|
|
@@ -3319,32 +3325,42 @@
|
|
|
3319
3325
|
* @param options - Misc options for the library
|
|
3320
3326
|
* @returns PromptbookLibrary
|
|
3321
3327
|
*/
|
|
3322
|
-
function
|
|
3328
|
+
function createLibraryFromDirectory(path$1, options) {
|
|
3323
3329
|
return __awaiter(this, void 0, void 0, function () {
|
|
3324
|
-
var _a, _b, isRecursive, _c, isVerbose, _d, isLazyLoaded, _e, isCrashOnError, library;
|
|
3330
|
+
var makedLibraryFilePath, makedLibraryFileExists, _a, _b, isRecursive, _c, isVerbose, _d, isLazyLoaded, _e, isCrashOnError, library;
|
|
3325
3331
|
var _this = this;
|
|
3326
3332
|
return __generator(this, function (_f) {
|
|
3327
3333
|
switch (_f.label) {
|
|
3328
3334
|
case 0:
|
|
3329
3335
|
if (!isRunningInNode()) {
|
|
3330
|
-
throw new Error('Function `
|
|
3336
|
+
throw new Error('Function `createLibraryFromDirectory` can only be run in Node.js environment because it reads the file system.');
|
|
3337
|
+
}
|
|
3338
|
+
makedLibraryFilePath = path.join(path$1, "".concat(PROMPTBOOK_MAKED_BASE_FILENAME, ".json"));
|
|
3339
|
+
return [4 /*yield*/, promises.access(makedLibraryFilePath, promises.constants.R_OK)
|
|
3340
|
+
.then(function () { return true; })
|
|
3341
|
+
.catch(function () { return false; })];
|
|
3342
|
+
case 1:
|
|
3343
|
+
makedLibraryFileExists = _f.sent();
|
|
3344
|
+
if (!makedLibraryFileExists) {
|
|
3345
|
+
console.info(colors__default["default"].yellow("Tip: Prebuild your promptbook library (file with supposed prebuild ".concat(makedLibraryFilePath, " not found) with CLI util \"promptbook make\" to speed up the library creation.")));
|
|
3346
|
+
}
|
|
3347
|
+
else {
|
|
3348
|
+
colors__default["default"].green("(In future, not implemented yet) Using your prebuild promptbook library ".concat(makedLibraryFilePath));
|
|
3349
|
+
// TODO: !! Implement;
|
|
3331
3350
|
}
|
|
3332
3351
|
_a = options || {}, _b = _a.isRecursive, isRecursive = _b === void 0 ? true : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ? false : _c, _d = _a.isLazyLoaded, isLazyLoaded = _d === void 0 ? false : _d, _e = _a.isCrashOnError, isCrashOnError = _e === void 0 ? true : _e;
|
|
3333
|
-
library =
|
|
3352
|
+
library = createLibraryFromPromise(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3334
3353
|
var fileNames, promptbooks, _loop_1, fileNames_1, fileNames_1_1, fileName, e_1_1;
|
|
3335
3354
|
var e_1, _a;
|
|
3336
3355
|
return __generator(this, function (_b) {
|
|
3337
3356
|
switch (_b.label) {
|
|
3338
3357
|
case 0:
|
|
3339
3358
|
if (isVerbose) {
|
|
3340
|
-
console.info("Creating promptbook library from path ".concat(path));
|
|
3359
|
+
console.info("Creating promptbook library from path ".concat(path$1.split('\\').join('/')));
|
|
3341
3360
|
}
|
|
3342
|
-
return [4 /*yield*/, listAllFiles(path, isRecursive)];
|
|
3361
|
+
return [4 /*yield*/, listAllFiles(path$1, isRecursive)];
|
|
3343
3362
|
case 1:
|
|
3344
3363
|
fileNames = _b.sent();
|
|
3345
|
-
if (isVerbose) {
|
|
3346
|
-
console.info('createPromptbookLibraryFromDirectory', { path: path, isRecursive: isRecursive, fileNames: fileNames });
|
|
3347
|
-
}
|
|
3348
3364
|
promptbooks = [];
|
|
3349
3365
|
_loop_1 = function (fileName) {
|
|
3350
3366
|
var promptbook, promptbookString, _c, _d, error_1, wrappedErrorMessage;
|
|
@@ -3364,7 +3380,7 @@
|
|
|
3364
3380
|
case 3:
|
|
3365
3381
|
if (!fileName.endsWith('.ptbk.json')) return [3 /*break*/, 5];
|
|
3366
3382
|
if (isVerbose) {
|
|
3367
|
-
console.info("Loading ".concat(fileName));
|
|
3383
|
+
console.info("Loading ".concat(fileName.split('\\').join('/')));
|
|
3368
3384
|
}
|
|
3369
3385
|
_d = (_c = JSON).parse;
|
|
3370
3386
|
return [4 /*yield*/, promises.readFile(fileName, 'utf8')];
|
|
@@ -3374,7 +3390,7 @@
|
|
|
3374
3390
|
return [3 /*break*/, 6];
|
|
3375
3391
|
case 5:
|
|
3376
3392
|
if (isVerbose) {
|
|
3377
|
-
console.info("Skipping file ".concat(fileName));
|
|
3393
|
+
console.info("Skipping file ".concat(fileName.split('\\').join('/')));
|
|
3378
3394
|
}
|
|
3379
3395
|
_e.label = 6;
|
|
3380
3396
|
case 6:
|
|
@@ -3382,17 +3398,17 @@
|
|
|
3382
3398
|
if (promptbook !== null) {
|
|
3383
3399
|
if (!promptbook.promptbookUrl) {
|
|
3384
3400
|
if (isVerbose) {
|
|
3385
|
-
console.info("Not loading ".concat(fileName, " - missing URL"));
|
|
3401
|
+
console.info("Not loading ".concat(fileName.split('\\').join('/'), " - missing URL"));
|
|
3386
3402
|
}
|
|
3387
3403
|
}
|
|
3388
3404
|
else {
|
|
3389
3405
|
if (isVerbose) {
|
|
3390
|
-
console.info("Loading ".concat(fileName));
|
|
3406
|
+
console.info("Loading ".concat(fileName.split('\\').join('/')));
|
|
3391
3407
|
}
|
|
3392
3408
|
if (!isCrashOnError) {
|
|
3393
3409
|
// Note: Validate promptbook to check if it is logically correct to not crash on invalid promptbooks
|
|
3394
3410
|
// But be handled in current try-catch block
|
|
3395
|
-
|
|
3411
|
+
validatePromptbook(promptbook);
|
|
3396
3412
|
}
|
|
3397
3413
|
// Note: [🦄] Promptbook with same url uniqueness will be checked automatically in SimplePromptbookLibrary
|
|
3398
3414
|
promptbooks.push(promptbook);
|
|
@@ -3444,12 +3460,12 @@
|
|
|
3444
3460
|
}
|
|
3445
3461
|
});
|
|
3446
3462
|
}); });
|
|
3447
|
-
if (!(isLazyLoaded === false)) return [3 /*break*/,
|
|
3463
|
+
if (!(isLazyLoaded === false)) return [3 /*break*/, 3];
|
|
3448
3464
|
return [4 /*yield*/, library.listPromptbooks()];
|
|
3449
|
-
case
|
|
3465
|
+
case 2:
|
|
3450
3466
|
_f.sent();
|
|
3451
|
-
_f.label =
|
|
3452
|
-
case
|
|
3467
|
+
_f.label = 3;
|
|
3468
|
+
case 3: return [2 /*return*/, library];
|
|
3453
3469
|
}
|
|
3454
3470
|
});
|
|
3455
3471
|
});
|
|
@@ -3460,7 +3476,7 @@
|
|
|
3460
3476
|
* @param path
|
|
3461
3477
|
* @param isRecursive
|
|
3462
3478
|
* @returns List of all files in the directory
|
|
3463
|
-
* @private internal function for `
|
|
3479
|
+
* @private internal function for `createLibraryFromDirectory`
|
|
3464
3480
|
*/
|
|
3465
3481
|
function listAllFiles(path$1, isRecursive) {
|
|
3466
3482
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -3518,7 +3534,7 @@
|
|
|
3518
3534
|
*/
|
|
3519
3535
|
|
|
3520
3536
|
exports.PROMPTBOOK_VERSION = PROMPTBOOK_VERSION;
|
|
3521
|
-
exports.
|
|
3537
|
+
exports.createLibraryFromDirectory = createLibraryFromDirectory;
|
|
3522
3538
|
|
|
3523
3539
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3524
3540
|
|