@promptbook/node 0.56.0-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +706 -0
- package/esm/index.es.js +2491 -0
- package/esm/index.es.js.map +1 -0
- package/esm/typings/_packages/anthropic-claude.index.d.ts +5 -0
- package/esm/typings/_packages/azure-openai.index.d.ts +5 -0
- package/esm/typings/_packages/cli.index.d.ts +10 -0
- package/esm/typings/_packages/core.index.d.ts +41 -0
- package/esm/typings/_packages/execute-javascript.index.d.ts +48 -0
- package/esm/typings/_packages/fake-llm.index.d.ts +7 -0
- package/esm/typings/_packages/langtail.index.d.ts +5 -0
- package/esm/typings/_packages/node.index.d.ts +4 -0
- package/esm/typings/_packages/openai.index.d.ts +6 -0
- package/esm/typings/_packages/remote-client.index.d.ts +6 -0
- package/esm/typings/_packages/remote-server.index.d.ts +5 -0
- package/esm/typings/_packages/types.index.d.ts +28 -0
- package/esm/typings/_packages/utils.index.d.ts +71 -0
- package/esm/typings/config.d.ts +8 -0
- package/esm/typings/conversion/prettify/PrettifyOptions.d.ts +13 -0
- package/esm/typings/conversion/prettify/prettifyPromptbookString.d.ts +10 -0
- package/esm/typings/conversion/prettify/prettifyPromptbookStringCli.d.ts +9 -0
- package/esm/typings/conversion/prettify/renderPromptbookMermaid.d.ts +25 -0
- package/esm/typings/conversion/promptbookJsonToString.d.ts +12 -0
- package/esm/typings/conversion/promptbookStringToJson.d.ts +15 -0
- package/esm/typings/conversion/promptbookStringToJson.test.d.ts +1 -0
- package/esm/typings/conversion/utils/extractParametersFromPromptTemplate.d.ts +13 -0
- package/esm/typings/conversion/utils/extractParametersFromPromptTemplate.test.d.ts +1 -0
- package/esm/typings/conversion/utils/extractVariables.d.ts +13 -0
- package/esm/typings/conversion/utils/extractVariables.test.d.ts +1 -0
- package/esm/typings/conversion/utils/parseCommand.d.ts +11 -0
- package/esm/typings/conversion/utils/parseCommand.test.d.ts +4 -0
- package/esm/typings/conversion/utils/parseNumber.d.ts +15 -0
- package/esm/typings/conversion/utils/parseNumber.test.d.ts +1 -0
- package/esm/typings/conversion/utils/renameParameter.d.ts +25 -0
- package/esm/typings/conversion/utils/renameParameter.test.d.ts +1 -0
- package/esm/typings/conversion/utils/titleToName.d.ts +4 -0
- package/esm/typings/conversion/utils/titleToName.test.d.ts +1 -0
- package/esm/typings/conversion/validation/_importPromptbook.d.ts +13 -0
- package/esm/typings/conversion/validation/promptbookStringToJson-syntaxErrors.test.d.ts +1 -0
- package/esm/typings/conversion/validation/validatePromptbookJson-logicErrors.test.d.ts +1 -0
- package/esm/typings/conversion/validation/validatePromptbookJson.d.ts +27 -0
- package/esm/typings/conversion/validation/validatePromptbookJson.test.d.ts +1 -0
- package/esm/typings/errors/PromptbookExecutionError.d.ts +7 -0
- package/esm/typings/errors/PromptbookLibraryError.d.ts +7 -0
- package/esm/typings/errors/PromptbookLogicError.d.ts +7 -0
- package/esm/typings/errors/PromptbookNotFoundError.d.ts +7 -0
- package/esm/typings/errors/PromptbookReferenceError.d.ts +7 -0
- package/esm/typings/errors/PromptbookSyntaxError.d.ts +7 -0
- package/esm/typings/errors/TemplateError.d.ts +9 -0
- package/esm/typings/errors/UnexpectedError.d.ts +7 -0
- package/esm/typings/errors/_ExpectError.d.ts +10 -0
- package/esm/typings/execution/CommonExecutionToolsOptions.d.ts +9 -0
- package/esm/typings/execution/ExecutionTools.d.ts +32 -0
- package/esm/typings/execution/LlmExecutionTools.d.ts +50 -0
- package/esm/typings/execution/PromptResult.d.ts +103 -0
- package/esm/typings/execution/PromptbookExecutor.d.ts +42 -0
- package/esm/typings/execution/ScriptExecutionTools.d.ts +38 -0
- package/esm/typings/execution/UserInterfaceTools.d.ts +46 -0
- package/esm/typings/execution/addPromptResultUsage.test.d.ts +1 -0
- package/esm/typings/execution/assertsExecutionSuccessful.d.ts +11 -0
- package/esm/typings/execution/createPromptbookExecutor.d.ts +42 -0
- package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +43 -0
- package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +8 -0
- package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/anthropic-claude-models.d.ts +20 -0
- package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/playground/playground.d.ts +2 -0
- package/esm/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionTools.d.ts +42 -0
- package/esm/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +35 -0
- package/esm/typings/execution/plugins/llm-execution-tools/azure-openai/playground/playground.d.ts +2 -0
- package/esm/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts +7 -0
- package/esm/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionToolsOptions.d.ts +11 -0
- package/esm/typings/execution/plugins/llm-execution-tools/langtail/playground/playground.d.ts +2 -0
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +28 -0
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +25 -0
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/fakeTextToExpectations.d.ts +14 -0
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/fakeTextToExpectations.test.d.ts +1 -0
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/faked-completion.test.d.ts +1 -0
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/joker.test.d.ts +4 -0
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/mocked-chat.test.d.ts +4 -0
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/mocked-completion.test.d.ts +4 -0
- package/esm/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools.d.ts +37 -0
- package/esm/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionToolsOptions.d.ts +24 -0
- package/esm/typings/execution/plugins/llm-execution-tools/multiple/playground/playground.d.ts +2 -0
- package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +47 -0
- package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +18 -0
- package/esm/typings/execution/plugins/llm-execution-tools/openai/computeOpenaiUsage.d.ts +12 -0
- package/esm/typings/execution/plugins/llm-execution-tools/openai/computeUsage.d.ts +16 -0
- package/esm/typings/execution/plugins/llm-execution-tools/openai/computeUsage.test.d.ts +1 -0
- package/esm/typings/execution/plugins/llm-execution-tools/openai/openai-models.d.ts +26 -0
- package/esm/typings/execution/plugins/llm-execution-tools/openai/playground/playground.d.ts +2 -0
- package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +42 -0
- package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionToolsOptions.d.ts +24 -0
- package/esm/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Error.d.ts +11 -0
- package/esm/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Progress.d.ts +12 -0
- package/esm/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Request.d.ts +17 -0
- package/esm/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Response.d.ts +12 -0
- package/esm/typings/execution/plugins/llm-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +28 -0
- package/esm/typings/execution/plugins/llm-execution-tools/remote/startRemoteServer.d.ts +18 -0
- package/esm/typings/execution/plugins/script-execution-tools/custom-function-async.test.ts.test.d.ts +1 -0
- package/esm/typings/execution/plugins/script-execution-tools/custom-function-missing.test.d.ts +1 -0
- package/esm/typings/execution/plugins/script-execution-tools/custom-function-with-dependencies.test.d.ts +1 -0
- package/esm/typings/execution/plugins/script-execution-tools/custom-function.test.d.ts +1 -0
- package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.d.ts +20 -0
- package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.test.d.ts +4 -0
- package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionTools.d.ts +7 -0
- package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionToolsOptions.d.ts +26 -0
- package/esm/typings/execution/plugins/script-execution-tools/javascript/utils/preserve.d.ts +11 -0
- package/esm/typings/execution/plugins/script-execution-tools/javascript/utils/unknownToString.d.ts +7 -0
- package/esm/typings/execution/plugins/script-execution-tools/postprocessing.test.d.ts +1 -0
- package/esm/typings/execution/plugins/script-execution-tools/python/PythonExecutionTools.d.ts +16 -0
- package/esm/typings/execution/plugins/script-execution-tools/script-execution-errors.test.d.ts +1 -0
- package/esm/typings/execution/plugins/script-execution-tools/script-execution-tools.test.d.ts +1 -0
- package/esm/typings/execution/plugins/script-execution-tools/typescript/TypescriptExecutionTools.d.ts +16 -0
- package/esm/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools.d.ts +15 -0
- package/esm/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions.d.ts +12 -0
- package/esm/typings/execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools.d.ts +17 -0
- package/esm/typings/execution/plugins/user-interface-execution-tools/user-interface-execution-tools.test.d.ts +1 -0
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +4 -0
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +9 -0
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +5 -0
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +11 -0
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +4 -0
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +7 -0
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +1 -0
- package/esm/typings/execution/translation/automatic-translate/translateMessages.d.ts +5 -0
- package/esm/typings/execution/utils/addUsage.d.ts +7 -0
- package/esm/typings/execution/utils/addUsage.test.d.ts +1 -0
- package/esm/typings/execution/utils/checkExpectations.d.ts +25 -0
- package/esm/typings/execution/utils/checkExpectations.test.d.ts +1 -0
- package/esm/typings/execution/utils/computeUsageCounts.d.ts +10 -0
- package/esm/typings/execution/utils/forEachAsync.d.ts +18 -0
- package/esm/typings/execution/utils/replaceParameters.d.ts +13 -0
- package/esm/typings/execution/utils/replaceParameters.test.d.ts +1 -0
- package/esm/typings/execution/utils/uncertainNumber.d.ts +9 -0
- package/esm/typings/execution/utils/usageToWorktime.d.ts +10 -0
- package/esm/typings/execution/utils/usageToWorktime.test.d.ts +1 -0
- package/esm/typings/library/PromptbookLibrary.d.ts +25 -0
- package/esm/typings/library/SimplePromptbookLibrary.d.ts +36 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +43 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromDirectory.test.d.ts +1 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +23 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.test.d.ts +1 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromSources.d.ts +13 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromSources.test.d.ts +1 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromUrl.d.ts +26 -0
- package/esm/typings/library/constructors/createPromptbookSublibrary.d.ts +12 -0
- package/esm/typings/library/constructors/justTestFsImport.d.ts +7 -0
- package/esm/typings/types/Command.d.ts +101 -0
- package/esm/typings/types/ExecutionTypes.d.ts +13 -0
- package/esm/typings/types/ModelRequirements.d.ts +43 -0
- package/esm/typings/types/Parameters.d.ts +14 -0
- package/esm/typings/types/Prompt.d.ts +57 -0
- package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +145 -0
- package/esm/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +26 -0
- package/esm/typings/types/PromptbookJson/PromptbookJson.d.ts +53 -0
- package/esm/typings/types/PromptbookString.d.ts +12 -0
- package/esm/typings/types/ScriptLanguage.d.ts +9 -0
- package/esm/typings/types/TaskProgress.d.ts +43 -0
- package/esm/typings/types/execution-report/ExecutionReportJson.d.ts +58 -0
- package/esm/typings/types/execution-report/ExecutionReportString.d.ts +16 -0
- package/esm/typings/types/execution-report/ExecutionReportStringOptions.d.ts +21 -0
- package/esm/typings/types/execution-report/config.d.ts +8 -0
- package/esm/typings/types/execution-report/countWorkingDuration.d.ts +7 -0
- package/esm/typings/types/execution-report/countWorkingDuration.test.d.ts +1 -0
- package/esm/typings/types/execution-report/executionReportJsonToString.d.ts +11 -0
- package/esm/typings/types/execution-report/executionReportJsonToString.test.d.ts +1 -0
- package/esm/typings/types/typeAliasEmoji.d.ts +9 -0
- package/esm/typings/types/typeAliases.d.ts +430 -0
- package/esm/typings/utils/FromtoItems.d.ts +19 -0
- package/esm/typings/utils/emojis.d.ts +22 -0
- package/esm/typings/utils/expectation-counters/countCharacters.d.ts +5 -0
- package/esm/typings/utils/expectation-counters/countCharacters.test.d.ts +1 -0
- package/esm/typings/utils/expectation-counters/countLines.d.ts +5 -0
- package/esm/typings/utils/expectation-counters/countLines.test.d.ts +1 -0
- package/esm/typings/utils/expectation-counters/countPages.d.ts +5 -0
- package/esm/typings/utils/expectation-counters/countPages.test.d.ts +1 -0
- package/esm/typings/utils/expectation-counters/countParagraphs.d.ts +5 -0
- package/esm/typings/utils/expectation-counters/countParagraphs.test.d.ts +1 -0
- package/esm/typings/utils/expectation-counters/countSentences.d.ts +9 -0
- package/esm/typings/utils/expectation-counters/countSentences.test.d.ts +1 -0
- package/esm/typings/utils/expectation-counters/countWords.d.ts +5 -0
- package/esm/typings/utils/expectation-counters/countWords.test.d.ts +1 -0
- package/esm/typings/utils/expectation-counters/index.d.ts +6 -0
- package/esm/typings/utils/extractParameters.d.ts +9 -0
- package/esm/typings/utils/extractParameters.test.d.ts +1 -0
- package/esm/typings/utils/formatNumber.d.ts +6 -0
- package/esm/typings/utils/formatNumber.test.d.ts +1 -0
- package/esm/typings/utils/getCurrentIsoDate.d.ts +7 -0
- package/esm/typings/utils/isRunningInWhatever.d.ts +12 -0
- package/esm/typings/utils/isValidJsonString.d.ts +4 -0
- package/esm/typings/utils/isValidJsonString.test.d.ts +1 -0
- package/esm/typings/utils/just.d.ts +10 -0
- package/esm/typings/utils/markdown/addAutoGeneratedSection.d.ts +11 -0
- package/esm/typings/utils/markdown/addAutoGeneratedSection.test.d.ts +1 -0
- package/esm/typings/utils/markdown/createMarkdownChart.d.ts +41 -0
- package/esm/typings/utils/markdown/createMarkdownChart.test.d.ts +1 -0
- package/esm/typings/utils/markdown/createMarkdownTable.d.ts +8 -0
- package/esm/typings/utils/markdown/createMarkdownTable.test.d.ts +1 -0
- package/esm/typings/utils/markdown/escapeMarkdownBlock.d.ts +6 -0
- package/esm/typings/utils/markdown/escapeMarkdownBlock.test.d.ts +1 -0
- package/esm/typings/utils/markdown/extractAllBlocksFromMarkdown.d.ts +27 -0
- package/esm/typings/utils/markdown/extractAllBlocksFromMarkdown.test.d.ts +1 -0
- package/esm/typings/utils/markdown/extractAllListItemsFromMarkdown.d.ts +14 -0
- package/esm/typings/utils/markdown/extractAllListItemsFromMarkdown.test.d.ts +1 -0
- package/esm/typings/utils/markdown/extractOneBlockFromMarkdown.d.ts +19 -0
- package/esm/typings/utils/markdown/extractOneBlockFromMarkdown.test.d.ts +1 -0
- package/esm/typings/utils/markdown/prettifyMarkdown.d.ts +8 -0
- package/esm/typings/utils/markdown/prettifyMarkdown.test.d.ts +1 -0
- package/esm/typings/utils/markdown/removeContentComments.d.ts +9 -0
- package/esm/typings/utils/markdown/removeContentComments.test.d.ts +1 -0
- package/esm/typings/utils/markdown/removeMarkdownFormatting.d.ts +8 -0
- package/esm/typings/utils/markdown/removeMarkdownFormatting.test.d.ts +1 -0
- package/esm/typings/utils/markdown-json/MarkdownStructure.d.ts +25 -0
- package/esm/typings/utils/markdown-json/countMarkdownStructureDeepness.d.ts +7 -0
- package/esm/typings/utils/markdown-json/countMarkdownStructureDeepness.test.d.ts +1 -0
- package/esm/typings/utils/markdown-json/markdownToMarkdownStructure.d.ts +13 -0
- package/esm/typings/utils/markdown-json/markdownToMarkdownStructure.test.d.ts +1 -0
- package/esm/typings/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +10 -0
- package/esm/typings/utils/normalization/IKeywords.d.ts +18 -0
- package/esm/typings/utils/normalization/capitalize.d.ts +5 -0
- package/esm/typings/utils/normalization/capitalize.test.d.ts +1 -0
- package/esm/typings/utils/normalization/decapitalize.d.ts +5 -0
- package/esm/typings/utils/normalization/decapitalize.test.d.ts +1 -0
- package/esm/typings/utils/normalization/isValidKeyword.d.ts +8 -0
- package/esm/typings/utils/normalization/isValidKeyword.test.d.ts +1 -0
- package/esm/typings/utils/normalization/nameToUriPart.d.ts +1 -0
- package/esm/typings/utils/normalization/nameToUriPart.test.d.ts +1 -0
- package/esm/typings/utils/normalization/nameToUriParts.d.ts +1 -0
- package/esm/typings/utils/normalization/nameToUriParts.test.d.ts +1 -0
- package/esm/typings/utils/normalization/normalize-to-kebab-case.d.ts +1 -0
- package/esm/typings/utils/normalization/normalize-to-kebab-case.test.d.ts +1 -0
- package/esm/typings/utils/normalization/normalizeTo_PascalCase.d.ts +1 -0
- package/esm/typings/utils/normalization/normalizeTo_PascalCase.test.d.ts +1 -0
- package/esm/typings/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +4 -0
- package/esm/typings/utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts +1 -0
- package/esm/typings/utils/normalization/normalizeTo_camelCase.d.ts +4 -0
- package/esm/typings/utils/normalization/normalizeTo_camelCase.test.d.ts +1 -0
- package/esm/typings/utils/normalization/normalizeTo_snake_case.d.ts +1 -0
- package/esm/typings/utils/normalization/normalizeTo_snake_case.test.d.ts +1 -0
- package/esm/typings/utils/normalization/normalizeWhitespaces.d.ts +4 -0
- package/esm/typings/utils/normalization/normalizeWhitespaces.test.d.ts +1 -0
- package/esm/typings/utils/normalization/parseKeywords.d.ts +14 -0
- package/esm/typings/utils/normalization/parseKeywords.test.d.ts +1 -0
- package/esm/typings/utils/normalization/parseKeywordsFromString.d.ts +8 -0
- package/esm/typings/utils/normalization/parseKeywordsFromString.test.d.ts +1 -0
- package/esm/typings/utils/normalization/removeDiacritics.d.ts +4 -0
- package/esm/typings/utils/normalization/removeDiacritics.test.d.ts +1 -0
- package/esm/typings/utils/normalization/searchKeywords.d.ts +5 -0
- package/esm/typings/utils/normalization/searchKeywords.test.d.ts +1 -0
- package/esm/typings/utils/postprocessing/extractBlock.d.ts +12 -0
- package/esm/typings/utils/removeEmojis.d.ts +7 -0
- package/esm/typings/utils/removeEmojis.test.d.ts +1 -0
- package/esm/typings/utils/removeQuotes.d.ts +13 -0
- package/esm/typings/utils/removeQuotes.test.d.ts +1 -0
- package/esm/typings/utils/sets/difference.d.ts +4 -0
- package/esm/typings/utils/sets/difference.test.d.ts +1 -0
- package/esm/typings/utils/sets/intersection.d.ts +4 -0
- package/esm/typings/utils/sets/intersection.test.d.ts +1 -0
- package/esm/typings/utils/sets/union.d.ts +4 -0
- package/esm/typings/utils/sets/union.test.d.ts +1 -0
- package/esm/typings/utils/trimCodeBlock.d.ts +8 -0
- package/esm/typings/utils/trimCodeBlock.test.d.ts +1 -0
- package/esm/typings/utils/trimEndOfCodeBlock.d.ts +7 -0
- package/esm/typings/utils/trimEndOfCodeBlock.test.d.ts +1 -0
- package/esm/typings/utils/unwrapResult.d.ts +36 -0
- package/esm/typings/utils/unwrapResult.test.d.ts +1 -0
- package/esm/typings/utils/validators/url/isValidUrl.d.ts +7 -0
- package/esm/typings/utils/validators/url/isValidUrl.test.d.ts +1 -0
- package/esm/typings/version.d.ts +5 -0
- package/package.json +56 -0
- package/umd/index.umd.js +2501 -0
- package/umd/index.umd.js.map +1 -0
- package/umd/typings/_packages/anthropic-claude.index.d.ts +5 -0
- package/umd/typings/_packages/azure-openai.index.d.ts +5 -0
- package/umd/typings/_packages/cli.index.d.ts +10 -0
- package/umd/typings/_packages/core.index.d.ts +41 -0
- package/umd/typings/_packages/execute-javascript.index.d.ts +48 -0
- package/umd/typings/_packages/fake-llm.index.d.ts +7 -0
- package/umd/typings/_packages/langtail.index.d.ts +5 -0
- package/umd/typings/_packages/node.index.d.ts +4 -0
- package/umd/typings/_packages/openai.index.d.ts +6 -0
- package/umd/typings/_packages/remote-client.index.d.ts +6 -0
- package/umd/typings/_packages/remote-server.index.d.ts +5 -0
- package/umd/typings/_packages/types.index.d.ts +28 -0
- package/umd/typings/_packages/utils.index.d.ts +71 -0
- package/umd/typings/config.d.ts +8 -0
- package/umd/typings/conversion/prettify/PrettifyOptions.d.ts +13 -0
- package/umd/typings/conversion/prettify/prettifyPromptbookString.d.ts +10 -0
- package/umd/typings/conversion/prettify/prettifyPromptbookStringCli.d.ts +9 -0
- package/umd/typings/conversion/prettify/renderPromptbookMermaid.d.ts +25 -0
- package/umd/typings/conversion/promptbookJsonToString.d.ts +12 -0
- package/umd/typings/conversion/promptbookStringToJson.d.ts +15 -0
- package/umd/typings/conversion/promptbookStringToJson.test.d.ts +1 -0
- package/umd/typings/conversion/utils/extractParametersFromPromptTemplate.d.ts +13 -0
- package/umd/typings/conversion/utils/extractParametersFromPromptTemplate.test.d.ts +1 -0
- package/umd/typings/conversion/utils/extractVariables.d.ts +13 -0
- package/umd/typings/conversion/utils/extractVariables.test.d.ts +1 -0
- package/umd/typings/conversion/utils/parseCommand.d.ts +11 -0
- package/umd/typings/conversion/utils/parseCommand.test.d.ts +4 -0
- package/umd/typings/conversion/utils/parseNumber.d.ts +15 -0
- package/umd/typings/conversion/utils/parseNumber.test.d.ts +1 -0
- package/umd/typings/conversion/utils/renameParameter.d.ts +25 -0
- package/umd/typings/conversion/utils/renameParameter.test.d.ts +1 -0
- package/umd/typings/conversion/utils/titleToName.d.ts +4 -0
- package/umd/typings/conversion/utils/titleToName.test.d.ts +1 -0
- package/umd/typings/conversion/validation/_importPromptbook.d.ts +13 -0
- package/umd/typings/conversion/validation/promptbookStringToJson-syntaxErrors.test.d.ts +1 -0
- package/umd/typings/conversion/validation/validatePromptbookJson-logicErrors.test.d.ts +1 -0
- package/umd/typings/conversion/validation/validatePromptbookJson.d.ts +27 -0
- package/umd/typings/conversion/validation/validatePromptbookJson.test.d.ts +1 -0
- package/umd/typings/errors/PromptbookExecutionError.d.ts +7 -0
- package/umd/typings/errors/PromptbookLibraryError.d.ts +7 -0
- package/umd/typings/errors/PromptbookLogicError.d.ts +7 -0
- package/umd/typings/errors/PromptbookNotFoundError.d.ts +7 -0
- package/umd/typings/errors/PromptbookReferenceError.d.ts +7 -0
- package/umd/typings/errors/PromptbookSyntaxError.d.ts +7 -0
- package/umd/typings/errors/TemplateError.d.ts +9 -0
- package/umd/typings/errors/UnexpectedError.d.ts +7 -0
- package/umd/typings/errors/_ExpectError.d.ts +10 -0
- package/umd/typings/execution/CommonExecutionToolsOptions.d.ts +9 -0
- package/umd/typings/execution/ExecutionTools.d.ts +32 -0
- package/umd/typings/execution/LlmExecutionTools.d.ts +50 -0
- package/umd/typings/execution/PromptResult.d.ts +103 -0
- package/umd/typings/execution/PromptbookExecutor.d.ts +42 -0
- package/umd/typings/execution/ScriptExecutionTools.d.ts +38 -0
- package/umd/typings/execution/UserInterfaceTools.d.ts +46 -0
- package/umd/typings/execution/addPromptResultUsage.test.d.ts +1 -0
- package/umd/typings/execution/assertsExecutionSuccessful.d.ts +11 -0
- package/umd/typings/execution/createPromptbookExecutor.d.ts +42 -0
- package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +43 -0
- package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +8 -0
- package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/anthropic-claude-models.d.ts +20 -0
- package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/playground/playground.d.ts +2 -0
- package/umd/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionTools.d.ts +42 -0
- package/umd/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +35 -0
- package/umd/typings/execution/plugins/llm-execution-tools/azure-openai/playground/playground.d.ts +2 -0
- package/umd/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts +7 -0
- package/umd/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionToolsOptions.d.ts +11 -0
- package/umd/typings/execution/plugins/llm-execution-tools/langtail/playground/playground.d.ts +2 -0
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +28 -0
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +25 -0
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/fakeTextToExpectations.d.ts +14 -0
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/fakeTextToExpectations.test.d.ts +1 -0
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/faked-completion.test.d.ts +1 -0
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/joker.test.d.ts +4 -0
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/mocked-chat.test.d.ts +4 -0
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/mocked-completion.test.d.ts +4 -0
- package/umd/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools.d.ts +37 -0
- package/umd/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionToolsOptions.d.ts +24 -0
- package/umd/typings/execution/plugins/llm-execution-tools/multiple/playground/playground.d.ts +2 -0
- package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +47 -0
- package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +18 -0
- package/umd/typings/execution/plugins/llm-execution-tools/openai/computeOpenaiUsage.d.ts +12 -0
- package/umd/typings/execution/plugins/llm-execution-tools/openai/computeUsage.d.ts +16 -0
- package/umd/typings/execution/plugins/llm-execution-tools/openai/computeUsage.test.d.ts +1 -0
- package/umd/typings/execution/plugins/llm-execution-tools/openai/openai-models.d.ts +26 -0
- package/umd/typings/execution/plugins/llm-execution-tools/openai/playground/playground.d.ts +2 -0
- package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +42 -0
- package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionToolsOptions.d.ts +24 -0
- package/umd/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Error.d.ts +11 -0
- package/umd/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Progress.d.ts +12 -0
- package/umd/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Request.d.ts +17 -0
- package/umd/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Response.d.ts +12 -0
- package/umd/typings/execution/plugins/llm-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +28 -0
- package/umd/typings/execution/plugins/llm-execution-tools/remote/startRemoteServer.d.ts +18 -0
- package/umd/typings/execution/plugins/script-execution-tools/custom-function-async.test.ts.test.d.ts +1 -0
- package/umd/typings/execution/plugins/script-execution-tools/custom-function-missing.test.d.ts +1 -0
- package/umd/typings/execution/plugins/script-execution-tools/custom-function-with-dependencies.test.d.ts +1 -0
- package/umd/typings/execution/plugins/script-execution-tools/custom-function.test.d.ts +1 -0
- package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.d.ts +20 -0
- package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.test.d.ts +4 -0
- package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionTools.d.ts +7 -0
- package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionToolsOptions.d.ts +26 -0
- package/umd/typings/execution/plugins/script-execution-tools/javascript/utils/preserve.d.ts +11 -0
- package/umd/typings/execution/plugins/script-execution-tools/javascript/utils/unknownToString.d.ts +7 -0
- package/umd/typings/execution/plugins/script-execution-tools/postprocessing.test.d.ts +1 -0
- package/umd/typings/execution/plugins/script-execution-tools/python/PythonExecutionTools.d.ts +16 -0
- package/umd/typings/execution/plugins/script-execution-tools/script-execution-errors.test.d.ts +1 -0
- package/umd/typings/execution/plugins/script-execution-tools/script-execution-tools.test.d.ts +1 -0
- package/umd/typings/execution/plugins/script-execution-tools/typescript/TypescriptExecutionTools.d.ts +16 -0
- package/umd/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools.d.ts +15 -0
- package/umd/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions.d.ts +12 -0
- package/umd/typings/execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools.d.ts +17 -0
- package/umd/typings/execution/plugins/user-interface-execution-tools/user-interface-execution-tools.test.d.ts +1 -0
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +4 -0
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +9 -0
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +5 -0
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +11 -0
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +4 -0
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +7 -0
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +1 -0
- package/umd/typings/execution/translation/automatic-translate/translateMessages.d.ts +5 -0
- package/umd/typings/execution/utils/addUsage.d.ts +7 -0
- package/umd/typings/execution/utils/addUsage.test.d.ts +1 -0
- package/umd/typings/execution/utils/checkExpectations.d.ts +25 -0
- package/umd/typings/execution/utils/checkExpectations.test.d.ts +1 -0
- package/umd/typings/execution/utils/computeUsageCounts.d.ts +10 -0
- package/umd/typings/execution/utils/forEachAsync.d.ts +18 -0
- package/umd/typings/execution/utils/replaceParameters.d.ts +13 -0
- package/umd/typings/execution/utils/replaceParameters.test.d.ts +1 -0
- package/umd/typings/execution/utils/uncertainNumber.d.ts +9 -0
- package/umd/typings/execution/utils/usageToWorktime.d.ts +10 -0
- package/umd/typings/execution/utils/usageToWorktime.test.d.ts +1 -0
- package/umd/typings/library/PromptbookLibrary.d.ts +25 -0
- package/umd/typings/library/SimplePromptbookLibrary.d.ts +36 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +43 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromDirectory.test.d.ts +1 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +23 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.test.d.ts +1 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromSources.d.ts +13 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromSources.test.d.ts +1 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromUrl.d.ts +26 -0
- package/umd/typings/library/constructors/createPromptbookSublibrary.d.ts +12 -0
- package/umd/typings/library/constructors/justTestFsImport.d.ts +7 -0
- package/umd/typings/types/Command.d.ts +101 -0
- package/umd/typings/types/ExecutionTypes.d.ts +13 -0
- package/umd/typings/types/ModelRequirements.d.ts +43 -0
- package/umd/typings/types/Parameters.d.ts +14 -0
- package/umd/typings/types/Prompt.d.ts +57 -0
- package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +145 -0
- package/umd/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +26 -0
- package/umd/typings/types/PromptbookJson/PromptbookJson.d.ts +53 -0
- package/umd/typings/types/PromptbookString.d.ts +12 -0
- package/umd/typings/types/ScriptLanguage.d.ts +9 -0
- package/umd/typings/types/TaskProgress.d.ts +43 -0
- package/umd/typings/types/execution-report/ExecutionReportJson.d.ts +58 -0
- package/umd/typings/types/execution-report/ExecutionReportString.d.ts +16 -0
- package/umd/typings/types/execution-report/ExecutionReportStringOptions.d.ts +21 -0
- package/umd/typings/types/execution-report/config.d.ts +8 -0
- package/umd/typings/types/execution-report/countWorkingDuration.d.ts +7 -0
- package/umd/typings/types/execution-report/countWorkingDuration.test.d.ts +1 -0
- package/umd/typings/types/execution-report/executionReportJsonToString.d.ts +11 -0
- package/umd/typings/types/execution-report/executionReportJsonToString.test.d.ts +1 -0
- package/umd/typings/types/typeAliasEmoji.d.ts +9 -0
- package/umd/typings/types/typeAliases.d.ts +430 -0
- package/umd/typings/utils/FromtoItems.d.ts +19 -0
- package/umd/typings/utils/emojis.d.ts +22 -0
- package/umd/typings/utils/expectation-counters/countCharacters.d.ts +5 -0
- package/umd/typings/utils/expectation-counters/countCharacters.test.d.ts +1 -0
- package/umd/typings/utils/expectation-counters/countLines.d.ts +5 -0
- package/umd/typings/utils/expectation-counters/countLines.test.d.ts +1 -0
- package/umd/typings/utils/expectation-counters/countPages.d.ts +5 -0
- package/umd/typings/utils/expectation-counters/countPages.test.d.ts +1 -0
- package/umd/typings/utils/expectation-counters/countParagraphs.d.ts +5 -0
- package/umd/typings/utils/expectation-counters/countParagraphs.test.d.ts +1 -0
- package/umd/typings/utils/expectation-counters/countSentences.d.ts +9 -0
- package/umd/typings/utils/expectation-counters/countSentences.test.d.ts +1 -0
- package/umd/typings/utils/expectation-counters/countWords.d.ts +5 -0
- package/umd/typings/utils/expectation-counters/countWords.test.d.ts +1 -0
- package/umd/typings/utils/expectation-counters/index.d.ts +6 -0
- package/umd/typings/utils/extractParameters.d.ts +9 -0
- package/umd/typings/utils/extractParameters.test.d.ts +1 -0
- package/umd/typings/utils/formatNumber.d.ts +6 -0
- package/umd/typings/utils/formatNumber.test.d.ts +1 -0
- package/umd/typings/utils/getCurrentIsoDate.d.ts +7 -0
- package/umd/typings/utils/isRunningInWhatever.d.ts +12 -0
- package/umd/typings/utils/isValidJsonString.d.ts +4 -0
- package/umd/typings/utils/isValidJsonString.test.d.ts +1 -0
- package/umd/typings/utils/just.d.ts +10 -0
- package/umd/typings/utils/markdown/addAutoGeneratedSection.d.ts +11 -0
- package/umd/typings/utils/markdown/addAutoGeneratedSection.test.d.ts +1 -0
- package/umd/typings/utils/markdown/createMarkdownChart.d.ts +41 -0
- package/umd/typings/utils/markdown/createMarkdownChart.test.d.ts +1 -0
- package/umd/typings/utils/markdown/createMarkdownTable.d.ts +8 -0
- package/umd/typings/utils/markdown/createMarkdownTable.test.d.ts +1 -0
- package/umd/typings/utils/markdown/escapeMarkdownBlock.d.ts +6 -0
- package/umd/typings/utils/markdown/escapeMarkdownBlock.test.d.ts +1 -0
- package/umd/typings/utils/markdown/extractAllBlocksFromMarkdown.d.ts +27 -0
- package/umd/typings/utils/markdown/extractAllBlocksFromMarkdown.test.d.ts +1 -0
- package/umd/typings/utils/markdown/extractAllListItemsFromMarkdown.d.ts +14 -0
- package/umd/typings/utils/markdown/extractAllListItemsFromMarkdown.test.d.ts +1 -0
- package/umd/typings/utils/markdown/extractOneBlockFromMarkdown.d.ts +19 -0
- package/umd/typings/utils/markdown/extractOneBlockFromMarkdown.test.d.ts +1 -0
- package/umd/typings/utils/markdown/prettifyMarkdown.d.ts +8 -0
- package/umd/typings/utils/markdown/prettifyMarkdown.test.d.ts +1 -0
- package/umd/typings/utils/markdown/removeContentComments.d.ts +9 -0
- package/umd/typings/utils/markdown/removeContentComments.test.d.ts +1 -0
- package/umd/typings/utils/markdown/removeMarkdownFormatting.d.ts +8 -0
- package/umd/typings/utils/markdown/removeMarkdownFormatting.test.d.ts +1 -0
- package/umd/typings/utils/markdown-json/MarkdownStructure.d.ts +25 -0
- package/umd/typings/utils/markdown-json/countMarkdownStructureDeepness.d.ts +7 -0
- package/umd/typings/utils/markdown-json/countMarkdownStructureDeepness.test.d.ts +1 -0
- package/umd/typings/utils/markdown-json/markdownToMarkdownStructure.d.ts +13 -0
- package/umd/typings/utils/markdown-json/markdownToMarkdownStructure.test.d.ts +1 -0
- package/umd/typings/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +10 -0
- package/umd/typings/utils/normalization/IKeywords.d.ts +18 -0
- package/umd/typings/utils/normalization/capitalize.d.ts +5 -0
- package/umd/typings/utils/normalization/capitalize.test.d.ts +1 -0
- package/umd/typings/utils/normalization/decapitalize.d.ts +5 -0
- package/umd/typings/utils/normalization/decapitalize.test.d.ts +1 -0
- package/umd/typings/utils/normalization/isValidKeyword.d.ts +8 -0
- package/umd/typings/utils/normalization/isValidKeyword.test.d.ts +1 -0
- package/umd/typings/utils/normalization/nameToUriPart.d.ts +1 -0
- package/umd/typings/utils/normalization/nameToUriPart.test.d.ts +1 -0
- package/umd/typings/utils/normalization/nameToUriParts.d.ts +1 -0
- package/umd/typings/utils/normalization/nameToUriParts.test.d.ts +1 -0
- package/umd/typings/utils/normalization/normalize-to-kebab-case.d.ts +1 -0
- package/umd/typings/utils/normalization/normalize-to-kebab-case.test.d.ts +1 -0
- package/umd/typings/utils/normalization/normalizeTo_PascalCase.d.ts +1 -0
- package/umd/typings/utils/normalization/normalizeTo_PascalCase.test.d.ts +1 -0
- package/umd/typings/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +4 -0
- package/umd/typings/utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts +1 -0
- package/umd/typings/utils/normalization/normalizeTo_camelCase.d.ts +4 -0
- package/umd/typings/utils/normalization/normalizeTo_camelCase.test.d.ts +1 -0
- package/umd/typings/utils/normalization/normalizeTo_snake_case.d.ts +1 -0
- package/umd/typings/utils/normalization/normalizeTo_snake_case.test.d.ts +1 -0
- package/umd/typings/utils/normalization/normalizeWhitespaces.d.ts +4 -0
- package/umd/typings/utils/normalization/normalizeWhitespaces.test.d.ts +1 -0
- package/umd/typings/utils/normalization/parseKeywords.d.ts +14 -0
- package/umd/typings/utils/normalization/parseKeywords.test.d.ts +1 -0
- package/umd/typings/utils/normalization/parseKeywordsFromString.d.ts +8 -0
- package/umd/typings/utils/normalization/parseKeywordsFromString.test.d.ts +1 -0
- package/umd/typings/utils/normalization/removeDiacritics.d.ts +4 -0
- package/umd/typings/utils/normalization/removeDiacritics.test.d.ts +1 -0
- package/umd/typings/utils/normalization/searchKeywords.d.ts +5 -0
- package/umd/typings/utils/normalization/searchKeywords.test.d.ts +1 -0
- package/umd/typings/utils/postprocessing/extractBlock.d.ts +12 -0
- package/umd/typings/utils/removeEmojis.d.ts +7 -0
- package/umd/typings/utils/removeEmojis.test.d.ts +1 -0
- package/umd/typings/utils/removeQuotes.d.ts +13 -0
- package/umd/typings/utils/removeQuotes.test.d.ts +1 -0
- package/umd/typings/utils/sets/difference.d.ts +4 -0
- package/umd/typings/utils/sets/difference.test.d.ts +1 -0
- package/umd/typings/utils/sets/intersection.d.ts +4 -0
- package/umd/typings/utils/sets/intersection.test.d.ts +1 -0
- package/umd/typings/utils/sets/union.d.ts +4 -0
- package/umd/typings/utils/sets/union.test.d.ts +1 -0
- package/umd/typings/utils/trimCodeBlock.d.ts +8 -0
- package/umd/typings/utils/trimCodeBlock.test.d.ts +1 -0
- package/umd/typings/utils/trimEndOfCodeBlock.d.ts +7 -0
- package/umd/typings/utils/trimEndOfCodeBlock.test.d.ts +1 -0
- package/umd/typings/utils/unwrapResult.d.ts +36 -0
- package/umd/typings/utils/unwrapResult.test.d.ts +1 -0
- package/umd/typings/utils/validators/url/isValidUrl.d.ts +7 -0
- package/umd/typings/utils/validators/url/isValidUrl.test.d.ts +1 -0
- package/umd/typings/version.d.ts +5 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function parseNumber will parse number from string
|
|
3
|
+
*
|
|
4
|
+
* Unlike Number.parseInt, Number.parseFloat it will never ever result in NaN
|
|
5
|
+
* Note: it also works only with decimal numbers
|
|
6
|
+
*
|
|
7
|
+
* @returns parsed number
|
|
8
|
+
* @throws {PromptbookSyntaxError} if the value is not a number
|
|
9
|
+
*
|
|
10
|
+
* @private within the parseCommand
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseNumber(value: string | number): number;
|
|
13
|
+
/**
|
|
14
|
+
* TODO: Maybe use sth. like safe-eval in fraction/calculation case @see https://www.npmjs.com/package/safe-eval
|
|
15
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
|
|
2
|
+
import type { string_name } from '../../types/typeAliases';
|
|
3
|
+
type RenameParameterOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Promptbook to search and replace for parameters
|
|
6
|
+
* This promptbook is returned as copy with replaced parameters
|
|
7
|
+
*/
|
|
8
|
+
promptbook: PromptbookJson;
|
|
9
|
+
/**
|
|
10
|
+
* Original parameter name that should be replaced
|
|
11
|
+
*/
|
|
12
|
+
oldParameterName: string_name;
|
|
13
|
+
/**
|
|
14
|
+
* New parameter name that should replace the original parameter name
|
|
15
|
+
*/
|
|
16
|
+
newParameterName: string_name;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Function renameParameter will find all usable parameters for given prompt template
|
|
20
|
+
* In other words, it will find all parameters that are not used in the prompt template itseld and all its dependencies
|
|
21
|
+
*
|
|
22
|
+
* @throws {PromptbookLogicError} If the new parameter name is already used in the promptbook
|
|
23
|
+
*/
|
|
24
|
+
export declare function renameParameter(options: RenameParameterOptions): PromptbookJson;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
|
|
2
|
+
import type { PromptbookString } from '../../types/PromptbookString';
|
|
3
|
+
/**
|
|
4
|
+
* Import the text file
|
|
5
|
+
*
|
|
6
|
+
* Note: Using here custom import to work in jest tests
|
|
7
|
+
* Note: Using sync version is 💩 in the production code, but it's ok here in tests
|
|
8
|
+
*
|
|
9
|
+
* @param path - The path to the file relative to samples/templates directory
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export declare function importPromptbook(path: `${string}.ptbk.md`): PromptbookString;
|
|
13
|
+
export declare function importPromptbook(path: `${string}.ptbk.json`): PromptbookJson;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
|
|
2
|
+
/**
|
|
3
|
+
* Validates PromptbookJson if it is logically valid
|
|
4
|
+
*
|
|
5
|
+
* It checks:
|
|
6
|
+
* - if it has correct parameters dependency
|
|
7
|
+
*
|
|
8
|
+
* It does NOT check:
|
|
9
|
+
* - if it is valid json
|
|
10
|
+
* - if it is meaningful
|
|
11
|
+
*
|
|
12
|
+
* @param promptbook valid or invalid PromptbookJson
|
|
13
|
+
* @returns the same promptbook if it is logically valid
|
|
14
|
+
* @throws {PromptbookLogicError} on logical error in the promptbook
|
|
15
|
+
*/
|
|
16
|
+
export declare function validatePromptbookJson(promptbook: PromptbookJson): PromptbookJson;
|
|
17
|
+
/**
|
|
18
|
+
* TODO: [🧠] Work with promptbookVersion
|
|
19
|
+
* TODO: Use here some json-schema, Zod or something similar and change it to:
|
|
20
|
+
* > /**
|
|
21
|
+
* > * Validates PromptbookJson if it is logically valid.
|
|
22
|
+
* > *
|
|
23
|
+
* > * It checks:
|
|
24
|
+
* > * - it has a valid structure
|
|
25
|
+
* > * - ...
|
|
26
|
+
* > ex port function validatePromptbookJson(promptbook: unknown): asserts promptbook is PromptbookJson {
|
|
27
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This error indicates that the promptbook object has valid syntax but contains logical errors (like circular dependencies)
|
|
3
|
+
*/
|
|
4
|
+
export declare class PromptbookLogicError extends Error {
|
|
5
|
+
readonly name = "PromptbookLogicError";
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This error occurs during the parameter replacement in the template
|
|
3
|
+
*
|
|
4
|
+
* Note: This is a kindof subtype of PromptbookExecutionError because it occurs during the execution of the pipeline
|
|
5
|
+
*/
|
|
6
|
+
export declare class TemplateError extends Error {
|
|
7
|
+
readonly name = "TemplateError";
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
3
|
+
*
|
|
4
|
+
* @private Always catched and rethrown as `PromptbookExecutionError`
|
|
5
|
+
* Note: This is a kindof subtype of PromptbookExecutionError
|
|
6
|
+
*/
|
|
7
|
+
export declare class ExpectError extends Error {
|
|
8
|
+
readonly name = "ExpectError";
|
|
9
|
+
constructor(message: string);
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from './LlmExecutionTools';
|
|
2
|
+
import type { ScriptExecutionTools } from './ScriptExecutionTools';
|
|
3
|
+
import type { UserInterfaceTools } from './UserInterfaceTools';
|
|
4
|
+
/**
|
|
5
|
+
* All the tools needed to execute prompts (template pipelines).
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/webgptorg/promptbook#execution-tools
|
|
8
|
+
*/
|
|
9
|
+
export type ExecutionTools = {
|
|
10
|
+
/**
|
|
11
|
+
* Tools for executing prompts to large language models like GPT-4
|
|
12
|
+
*
|
|
13
|
+
* Tip: Combine multiple LLM execution tools with `MultipleLlmExecutionTools`
|
|
14
|
+
* @see https://github.com/webgptorg/promptbook/?tab=readme-ov-file#llm-execution-tools
|
|
15
|
+
*/
|
|
16
|
+
llm: LlmExecutionTools;
|
|
17
|
+
/**
|
|
18
|
+
* Tools for executing scripts
|
|
19
|
+
*
|
|
20
|
+
* Note: You can pass multiple ScriptExecutionTools, they will be tried one by one until one of them supports the script
|
|
21
|
+
* If none of them supports the script, an error is thrown
|
|
22
|
+
* @see https://github.com/webgptorg/promptbook/?tab=readme-ov-file#script-execution-tools
|
|
23
|
+
*/
|
|
24
|
+
script: Array<ScriptExecutionTools>;
|
|
25
|
+
/**
|
|
26
|
+
* Tools for interacting with the user
|
|
27
|
+
*
|
|
28
|
+
* Note: When undefined, the user interface is disabled and promptbook which requires user interaction will fail
|
|
29
|
+
* @see https://github.com/webgptorg/promptbook/?tab=readme-ov-file#user-interface-tools
|
|
30
|
+
*/
|
|
31
|
+
userInterface?: UserInterfaceTools;
|
|
32
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { ModelVariant } from '../types/ModelRequirements';
|
|
3
|
+
import type { Prompt } from '../types/Prompt';
|
|
4
|
+
import type { string_model_name } from '../types/typeAliases';
|
|
5
|
+
import type { string_title } from '../types/typeAliases';
|
|
6
|
+
import type { PromptChatResult } from './PromptResult';
|
|
7
|
+
import type { PromptCompletionResult } from './PromptResult';
|
|
8
|
+
/**
|
|
9
|
+
* Container for all the tools needed to execute prompts to large language models like GPT-4
|
|
10
|
+
* On its interface it exposes common methods for prompt execution.
|
|
11
|
+
* Inside (in constructor) it calls OpenAI, Azure, GPU, proxy, cache, logging,...
|
|
12
|
+
*
|
|
13
|
+
* @see https://github.com/webgptorg/promptbook#llm-execution-tools
|
|
14
|
+
*/
|
|
15
|
+
export type LlmExecutionTools = {
|
|
16
|
+
/**
|
|
17
|
+
* Use a chat model
|
|
18
|
+
*/
|
|
19
|
+
gptChat(prompt: Prompt): Promise<PromptChatResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Use a completion model
|
|
22
|
+
*/
|
|
23
|
+
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
24
|
+
/**
|
|
25
|
+
* List all available models that can be used
|
|
26
|
+
*/
|
|
27
|
+
listModels(): Promisable<Array<AvailableModel>>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Represents a model that can be used for prompt execution
|
|
31
|
+
*/
|
|
32
|
+
export type AvailableModel = {
|
|
33
|
+
/**
|
|
34
|
+
* The model title
|
|
35
|
+
*/
|
|
36
|
+
readonly modelTitle: string_title;
|
|
37
|
+
/**
|
|
38
|
+
* The model name aviailable
|
|
39
|
+
*/
|
|
40
|
+
readonly modelName: string_model_name;
|
|
41
|
+
/**
|
|
42
|
+
* Variant of the model
|
|
43
|
+
*/
|
|
44
|
+
readonly modelVariant: ModelVariant;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* TODO: [🍓][♐] Some heuristic to pick the best model in listed models
|
|
48
|
+
* TODO: [🏳] gptChat -> chat, gptComplete -> complete, translate
|
|
49
|
+
* TODO: [🧠] Should or should not there be a word "GPT" in both gptComplete and gptChat
|
|
50
|
+
*/
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { KebabCase } from 'type-fest';
|
|
2
|
+
import type { ExpectationUnit } from '../types/PromptbookJson/PromptTemplateJson';
|
|
3
|
+
import type { number_positive } from '../types/typeAliases';
|
|
4
|
+
import type { number_usd } from '../types/typeAliases';
|
|
5
|
+
import type { string_date_iso8601 } from '../types/typeAliases';
|
|
6
|
+
import type { string_model_name } from '../types/typeAliases';
|
|
7
|
+
/**
|
|
8
|
+
* Prompt result is the simplest concept of execution.
|
|
9
|
+
* It is the result of executing one prompt _(NOT a template)_.
|
|
10
|
+
*
|
|
11
|
+
* @see https://github.com/webgptorg/promptbook#prompt-result
|
|
12
|
+
*/
|
|
13
|
+
export type PromptResult = PromptCompletionResult | PromptChatResult;
|
|
14
|
+
/**
|
|
15
|
+
* Prompt completion result
|
|
16
|
+
* It contains only the following text NOT the whole completion
|
|
17
|
+
*/
|
|
18
|
+
export type PromptCompletionResult = PromptCommonResult;
|
|
19
|
+
/**
|
|
20
|
+
* Prompt chat result
|
|
21
|
+
*/
|
|
22
|
+
export type PromptChatResult = PromptCommonResult & {};
|
|
23
|
+
export type PromptCommonResult = {
|
|
24
|
+
/**
|
|
25
|
+
* Exact text response from the model
|
|
26
|
+
*/
|
|
27
|
+
readonly content: string;
|
|
28
|
+
/**
|
|
29
|
+
* Name of the model used to generate the response
|
|
30
|
+
*/
|
|
31
|
+
readonly modelName: string_model_name;
|
|
32
|
+
/**
|
|
33
|
+
* Timing
|
|
34
|
+
*/
|
|
35
|
+
readonly timing: {
|
|
36
|
+
/**
|
|
37
|
+
* Start of the execution
|
|
38
|
+
*/
|
|
39
|
+
start: string_date_iso8601;
|
|
40
|
+
/**
|
|
41
|
+
* First token generated
|
|
42
|
+
*/
|
|
43
|
+
firstToken?: string_date_iso8601;
|
|
44
|
+
/**
|
|
45
|
+
* End of the execution
|
|
46
|
+
*/
|
|
47
|
+
complete: string_date_iso8601;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Usage of the prompt execution
|
|
51
|
+
*/
|
|
52
|
+
readonly usage: PromptResultUsage;
|
|
53
|
+
/**
|
|
54
|
+
* Raw response from the model
|
|
55
|
+
*/
|
|
56
|
+
readonly rawResponse: object;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Usage statistics for one or many prompt results
|
|
60
|
+
*/
|
|
61
|
+
export type PromptResultUsage = {
|
|
62
|
+
/**
|
|
63
|
+
* Cost of the execution in USD
|
|
64
|
+
*
|
|
65
|
+
* Note: If the cost is unknown, the value 0 and isUncertain is true
|
|
66
|
+
*/
|
|
67
|
+
price: UncertainNumber;
|
|
68
|
+
/**
|
|
69
|
+
* Number of whatever used in the input aka. `prompt_tokens`
|
|
70
|
+
*/
|
|
71
|
+
input: PromptResultUsageCounts;
|
|
72
|
+
/**
|
|
73
|
+
* Number of tokens used in the output aka. `completion_tokens`
|
|
74
|
+
*/
|
|
75
|
+
output: PromptResultUsageCounts;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Record of all possible measurable units
|
|
79
|
+
*/
|
|
80
|
+
export type PromptResultUsageCounts = Record<`${KebabCase<'TOKENS' | ExpectationUnit>}Count`, UncertainNumber>;
|
|
81
|
+
/**
|
|
82
|
+
* Number which can be uncertain
|
|
83
|
+
*
|
|
84
|
+
* Note: If the value is completelly unknown, the value 0 and isUncertain is true
|
|
85
|
+
* Note: Not using NaN or null because it looses the value which is better to be uncertain then not to be at all
|
|
86
|
+
*/
|
|
87
|
+
export type UncertainNumber = {
|
|
88
|
+
/**
|
|
89
|
+
* The numeric value
|
|
90
|
+
*/
|
|
91
|
+
value: number_usd & (number_positive | 0);
|
|
92
|
+
/**
|
|
93
|
+
* Is the value uncertain
|
|
94
|
+
*/
|
|
95
|
+
isUncertain?: true;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* TODO: [🧠] Maybe timing more accurate then seconds?
|
|
99
|
+
* TODO: [🧠] Should here be link to the prompt?
|
|
100
|
+
* TODO: [🧠] Maybe type raw properly - not onject but OpenAI.result.whatever
|
|
101
|
+
* TODO: [🧠] Maybe remove redundant raw.choices.text
|
|
102
|
+
* TODO: Log raw even if prompt failed - log the raw error
|
|
103
|
+
*/
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { TaskProgress } from '../types/TaskProgress';
|
|
3
|
+
import type { ExecutionReportJson } from '../types/execution-report/ExecutionReportJson';
|
|
4
|
+
import type { string_name } from '../types/typeAliases';
|
|
5
|
+
import type { PromptResultUsage } from './PromptResult';
|
|
6
|
+
/**
|
|
7
|
+
* Executor is a simple async function that takes INPUT PARAMETERs and returns result parameters _(along with all intermediate parameters and INPUT PARAMETERs = it extends input object)_.
|
|
8
|
+
* Executor is made by combining execution tools and promptbook library.
|
|
9
|
+
*
|
|
10
|
+
* It can be created with `createPromptbookExecutor` function.
|
|
11
|
+
*
|
|
12
|
+
* @see https://github.com/webgptorg/promptbook#executor
|
|
13
|
+
*/
|
|
14
|
+
export type PromptbookExecutor = {
|
|
15
|
+
(inputParameters: Record<string_name, string>, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<{
|
|
16
|
+
/**
|
|
17
|
+
* Whether the execution was successful, details are aviable in `executionReport`
|
|
18
|
+
*/
|
|
19
|
+
isSuccessful: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Added usage of whole execution, detailed usage is aviable in `executionReport`
|
|
22
|
+
*/
|
|
23
|
+
usage: PromptResultUsage;
|
|
24
|
+
/**
|
|
25
|
+
* Errors that occured during the execution, details are aviable in `executionReport`
|
|
26
|
+
*/
|
|
27
|
+
errors: Array<Error>;
|
|
28
|
+
/**
|
|
29
|
+
* The report of the execution with all details
|
|
30
|
+
*/
|
|
31
|
+
executionReport: ExecutionReportJson;
|
|
32
|
+
/**
|
|
33
|
+
* Result parameters of the execution
|
|
34
|
+
*
|
|
35
|
+
* Note: If the execution was not successful, there are only some of the result parameters
|
|
36
|
+
*/
|
|
37
|
+
outputParameters: Record<string_name, string>;
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* TODO: [🧠] Should this file be in /execution or /types folder?
|
|
42
|
+
*/
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { string_name } from '../types/typeAliases';
|
|
2
|
+
import type { string_script } from '../types/typeAliases';
|
|
3
|
+
import type { ScriptLanguage } from '../types/ScriptLanguage';
|
|
4
|
+
/**
|
|
5
|
+
* Represents all the tools needed to EXECUTE SCRIPTs
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/webgptorg/promptbook#script-execution-tools
|
|
8
|
+
*/
|
|
9
|
+
export type ScriptExecutionTools = {
|
|
10
|
+
execute(options: ScriptExecutionToolsExecuteOptions): Promise<string>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Input for the script execution
|
|
14
|
+
*/
|
|
15
|
+
export type ScriptExecutionToolsExecuteOptions = {
|
|
16
|
+
/**
|
|
17
|
+
* Language of the script
|
|
18
|
+
*/
|
|
19
|
+
scriptLanguage: ScriptLanguage;
|
|
20
|
+
/**
|
|
21
|
+
* Parameters for the script
|
|
22
|
+
* Theese parameters are passed to the script as variables
|
|
23
|
+
* For example: { "name": "John" } => const name = "John";
|
|
24
|
+
*/
|
|
25
|
+
parameters: Record<string_name, string>;
|
|
26
|
+
/**
|
|
27
|
+
* The content of the script to execute
|
|
28
|
+
* - It can be a single statement
|
|
29
|
+
* - It can be multiple statements separated by semicolon and return
|
|
30
|
+
* - It can be a function (but you need to call it)
|
|
31
|
+
* - It can be IIFE (immediately invoked function expression)
|
|
32
|
+
* - It can use the parameters as variables and functions from global scope
|
|
33
|
+
*/
|
|
34
|
+
script: string_script;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* TODO: [🧠][💙] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
|
|
38
|
+
*/
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { number_integer } from '../types/typeAliases';
|
|
2
|
+
import type { number_positive } from '../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* Represents all the tools needed to interact with the user.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/webgptorg/promptbook#user-interface-tools
|
|
7
|
+
*/
|
|
8
|
+
export type UserInterfaceTools = {
|
|
9
|
+
/**
|
|
10
|
+
* Asks the user to answer a free-text (multi-line) question
|
|
11
|
+
*
|
|
12
|
+
* @param options the question to ask
|
|
13
|
+
* @returns the answer from the user
|
|
14
|
+
*/
|
|
15
|
+
promptDialog(options: UserInterfaceToolsPromptDialogOptions): Promise<string>;
|
|
16
|
+
};
|
|
17
|
+
export type UserInterfaceToolsPromptDialogOptions = {
|
|
18
|
+
/**
|
|
19
|
+
* Prompt title
|
|
20
|
+
*
|
|
21
|
+
* Note: This is not a prompt to language model but a prompt to the user
|
|
22
|
+
* @example "Your name"
|
|
23
|
+
*/
|
|
24
|
+
promptTitle: string;
|
|
25
|
+
/**
|
|
26
|
+
* Prompt message
|
|
27
|
+
*
|
|
28
|
+
* Note: This is not a prompt to language model but a prompt to the user
|
|
29
|
+
* @example "Please enter your name, including your last name, title, etc."
|
|
30
|
+
*/
|
|
31
|
+
promptMessage: string;
|
|
32
|
+
/**
|
|
33
|
+
* Default value for the input/textarea
|
|
34
|
+
*/
|
|
35
|
+
defaultValue: string | null;
|
|
36
|
+
/**
|
|
37
|
+
* Placeholder for the input/textarea
|
|
38
|
+
*/
|
|
39
|
+
placeholder?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Priority of the prompt
|
|
42
|
+
*
|
|
43
|
+
* Note: This would be reflected for example into the UI z-index of the prompt modal
|
|
44
|
+
*/
|
|
45
|
+
priority: number_integer & number_positive;
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PromptbookExecutor } from './PromptbookExecutor';
|
|
2
|
+
/**
|
|
3
|
+
* Asserts that the execution of a promptnook is successful
|
|
4
|
+
*
|
|
5
|
+
* @param executionResult - The partial result of the promptnook execution
|
|
6
|
+
* @throws {PromptbookExecutionError} If the execution is not successful or if multiple errors occurred
|
|
7
|
+
*/
|
|
8
|
+
export declare function assertsExecutionSuccessful(executionResult: Pick<Awaited<ReturnType<PromptbookExecutor>>, 'isSuccessful' | 'errors'>): void;
|
|
9
|
+
/**
|
|
10
|
+
* TODO: [🧠] Can this return type be better typed than void
|
|
11
|
+
*/
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
|
|
2
|
+
import type { ExecutionTools } from './ExecutionTools';
|
|
3
|
+
import type { PromptbookExecutor } from './PromptbookExecutor';
|
|
4
|
+
type CreatePromptbookExecutorSettings = {
|
|
5
|
+
/**
|
|
6
|
+
* When executor does not satisfy expectations it will be retried this amount of times
|
|
7
|
+
*
|
|
8
|
+
* @default 3
|
|
9
|
+
*/
|
|
10
|
+
readonly maxExecutionAttempts: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Options for creating a promptbook executor
|
|
14
|
+
*/
|
|
15
|
+
interface CreatePromptbookExecutorOptions {
|
|
16
|
+
/**
|
|
17
|
+
* The promptbook to be executed
|
|
18
|
+
*/
|
|
19
|
+
readonly promptbook: PromptbookJson;
|
|
20
|
+
/**
|
|
21
|
+
* The execution tools to be used during the execution of the PROMPTBOOK
|
|
22
|
+
*/
|
|
23
|
+
readonly tools: ExecutionTools;
|
|
24
|
+
/**
|
|
25
|
+
* Optional settings for the PROMPTBOOK executor
|
|
26
|
+
*/
|
|
27
|
+
readonly settings?: Partial<CreatePromptbookExecutorSettings>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Creates executor function from promptbook and execution tools.
|
|
31
|
+
*
|
|
32
|
+
* @returns The executor function
|
|
33
|
+
* @throws {PromptbookLogicError} on logical error in the promptbook
|
|
34
|
+
*/
|
|
35
|
+
export declare function createPromptbookExecutor(options: CreatePromptbookExecutorOptions): PromptbookExecutor;
|
|
36
|
+
export {};
|
|
37
|
+
/**
|
|
38
|
+
* TODO: [🧠] When not meet expectations in PROMPT_DIALOG, make some way to tell the user
|
|
39
|
+
* TODO: [👧] Strongly type the executors to avoid need of remove nullables whtn noUncheckedIndexedAccess in tsconfig.json
|
|
40
|
+
* Note: CreatePromptbookExecutorOptions are just connected to PromptbookExecutor so do not extract to types folder
|
|
41
|
+
* TODO: [🧠][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
|
|
42
|
+
*/
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { AvailableModel } from '../../../LlmExecutionTools';
|
|
3
|
+
import type { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
+
import type { PromptChatResult } from '../../../PromptResult';
|
|
5
|
+
import type { PromptCompletionResult } from '../../../PromptResult';
|
|
6
|
+
import type { AnthropicClaudeExecutionToolsOptions } from './AnthropicClaudeExecutionToolsOptions';
|
|
7
|
+
/**
|
|
8
|
+
* Execution Tools for calling Anthropic Claude API.
|
|
9
|
+
*/
|
|
10
|
+
export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools {
|
|
11
|
+
private readonly options;
|
|
12
|
+
/**
|
|
13
|
+
* Anthropic Claude API client.
|
|
14
|
+
*/
|
|
15
|
+
private readonly client;
|
|
16
|
+
/**
|
|
17
|
+
* Creates Anthropic Claude Execution Tools.
|
|
18
|
+
*
|
|
19
|
+
* @param options which are relevant are directly passed to the Anthropic Claude client
|
|
20
|
+
*/
|
|
21
|
+
constructor(options: AnthropicClaudeExecutionToolsOptions);
|
|
22
|
+
/**
|
|
23
|
+
* Calls Anthropic Claude API to use a chat model.
|
|
24
|
+
*/
|
|
25
|
+
gptChat(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptChatResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Calls Anthropic Claude API to use a complete model.
|
|
28
|
+
*/
|
|
29
|
+
gptComplete(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptCompletionResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Default model for chat variant.
|
|
32
|
+
*/
|
|
33
|
+
private getDefaultChatModel;
|
|
34
|
+
/**
|
|
35
|
+
* List all available Anthropic Claude models that can be used
|
|
36
|
+
*/
|
|
37
|
+
listModels(): Array<AvailableModel>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* TODO: [🧠] Maybe handle errors via transformAnthropicError (like transformAzureError)
|
|
41
|
+
* TODO: Maybe Create some common util for gptChat and gptComplete
|
|
42
|
+
* TODO: Maybe make custom OpenaiError
|
|
43
|
+
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ClientOptions } from '@anthropic-ai/sdk';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Options for AnthropicClaudeExecutionTools
|
|
5
|
+
*
|
|
6
|
+
* This extends Anthropic's `ClientOptions` with are directly passed to the Anthropic client.
|
|
7
|
+
*/
|
|
8
|
+
export type AnthropicClaudeExecutionToolsOptions = CommonExecutionToolsOptions & ClientOptions;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { number_usd } from '../../../../types/typeAliases';
|
|
2
|
+
import type { AvailableModel } from '../../../LlmExecutionTools';
|
|
3
|
+
/**
|
|
4
|
+
* List of available Anthropic Claude models with pricing
|
|
5
|
+
*
|
|
6
|
+
* Note: Done at 2024-05-25
|
|
7
|
+
*
|
|
8
|
+
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
9
|
+
*/
|
|
10
|
+
export declare const ANTHROPIC_CLAUDE_MODELS: Array<AvailableModel & {
|
|
11
|
+
pricing?: {
|
|
12
|
+
prompt: number_usd;
|
|
13
|
+
output: number_usd;
|
|
14
|
+
};
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
18
|
+
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
19
|
+
* TODO: [🕚] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
20
|
+
*/
|