@promptbook/anthropic-claude 0.52.0-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +708 -0
- package/esm/index.es.js +2 -0
- package/esm/index.es.js.map +1 -0
- package/esm/typings/_packages/cli.index.d.ts +8 -0
- package/esm/typings/_packages/core.index.d.ts +19 -0
- package/esm/typings/_packages/execute-javascript.index.d.ts +46 -0
- package/esm/typings/_packages/langtail.index.d.ts +3 -0
- package/esm/typings/_packages/mock.index.d.ts +6 -0
- package/esm/typings/_packages/openai.index.d.ts +4 -0
- package/esm/typings/_packages/remote-client.index.d.ts +4 -0
- package/esm/typings/_packages/remote-server.index.d.ts +3 -0
- package/esm/typings/_packages/types.index.d.ts +28 -0
- package/esm/typings/_packages/utils.index.d.ts +73 -0
- package/esm/typings/_packages/wizzard.index.d.ts +5 -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 +24 -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 +12 -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/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 +30 -0
- package/esm/typings/execution/LlmExecutionTools.d.ts +48 -0
- package/esm/typings/execution/PromptResult.d.ts +74 -0
- package/esm/typings/execution/PromptbookExecutor.d.ts +37 -0
- package/esm/typings/execution/ScriptExecutionTools.d.ts +37 -0
- package/esm/typings/execution/UserInterfaceTools.d.ts +45 -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/langtail/LangtailExecutionTools.d.ts +10 -0
- package/esm/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionToolsOptions.d.ts +11 -0
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +26 -0
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +23 -0
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/fakeTextToExpectations.d.ts +15 -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/openai/OpenAiExecutionTools.d.ts +45 -0
- package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +16 -0
- package/esm/typings/execution/plugins/llm-execution-tools/openai/computeOpenaiUsage.d.ts +8 -0
- package/esm/typings/execution/plugins/llm-execution-tools/openai/computeUsage.d.ts +13 -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/models.d.ts +25 -0
- package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +40 -0
- package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionToolsOptions.d.ts +23 -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 +27 -0
- package/esm/typings/execution/plugins/llm-execution-tools/remote/startRemoteServer.d.ts +17 -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 +20 -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 +15 -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 +15 -0
- package/esm/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools.d.ts +14 -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 +16 -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/checkExpectations.d.ts +25 -0
- package/esm/typings/execution/utils/checkExpectations.test.d.ts +1 -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/library/PromptbookLibrary.d.ts +25 -0
- package/esm/typings/library/SimplePromptbookLibrary.d.ts +36 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +14 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +26 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromSources.d.ts +15 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromUrl.d.ts +13 -0
- package/esm/typings/library/constructors/createPromptbookSublibrary.d.ts +15 -0
- package/esm/typings/types/Command.d.ts +98 -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 +54 -0
- package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +137 -0
- package/esm/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +25 -0
- package/esm/typings/types/PromptbookJson/PromptbookJson.d.ts +51 -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 +42 -0
- package/esm/typings/types/execution-report/ExecutionReportJson.d.ts +56 -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 +432 -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 +5 -0
- package/esm/typings/utils/extractParameters.d.ts +8 -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 +10 -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 +7 -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 +13 -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 +8 -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/esm/typings/wizzard/Wizzard.d.ts +4 -0
- package/esm/typings/wizzard/sample.d.ts +6 -0
- package/package.json +53 -0
- package/umd/index.umd.js +9 -0
- package/umd/index.umd.js.map +1 -0
- package/umd/typings/_packages/cli.index.d.ts +8 -0
- package/umd/typings/_packages/core.index.d.ts +19 -0
- package/umd/typings/_packages/execute-javascript.index.d.ts +46 -0
- package/umd/typings/_packages/langtail.index.d.ts +3 -0
- package/umd/typings/_packages/mock.index.d.ts +6 -0
- package/umd/typings/_packages/openai.index.d.ts +4 -0
- package/umd/typings/_packages/remote-client.index.d.ts +4 -0
- package/umd/typings/_packages/remote-server.index.d.ts +3 -0
- package/umd/typings/_packages/types.index.d.ts +28 -0
- package/umd/typings/_packages/utils.index.d.ts +73 -0
- package/umd/typings/_packages/wizzard.index.d.ts +5 -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 +24 -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 +12 -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/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 +30 -0
- package/umd/typings/execution/LlmExecutionTools.d.ts +48 -0
- package/umd/typings/execution/PromptResult.d.ts +74 -0
- package/umd/typings/execution/PromptbookExecutor.d.ts +37 -0
- package/umd/typings/execution/ScriptExecutionTools.d.ts +37 -0
- package/umd/typings/execution/UserInterfaceTools.d.ts +45 -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/langtail/LangtailExecutionTools.d.ts +10 -0
- package/umd/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionToolsOptions.d.ts +11 -0
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +26 -0
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +23 -0
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/fakeTextToExpectations.d.ts +15 -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/openai/OpenAiExecutionTools.d.ts +45 -0
- package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +16 -0
- package/umd/typings/execution/plugins/llm-execution-tools/openai/computeOpenaiUsage.d.ts +8 -0
- package/umd/typings/execution/plugins/llm-execution-tools/openai/computeUsage.d.ts +13 -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/models.d.ts +25 -0
- package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +40 -0
- package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionToolsOptions.d.ts +23 -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 +27 -0
- package/umd/typings/execution/plugins/llm-execution-tools/remote/startRemoteServer.d.ts +17 -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 +20 -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 +15 -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 +15 -0
- package/umd/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools.d.ts +14 -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 +16 -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/checkExpectations.d.ts +25 -0
- package/umd/typings/execution/utils/checkExpectations.test.d.ts +1 -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/library/PromptbookLibrary.d.ts +25 -0
- package/umd/typings/library/SimplePromptbookLibrary.d.ts +36 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +14 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +26 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromSources.d.ts +15 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromUrl.d.ts +13 -0
- package/umd/typings/library/constructors/createPromptbookSublibrary.d.ts +15 -0
- package/umd/typings/types/Command.d.ts +98 -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 +54 -0
- package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +137 -0
- package/umd/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +25 -0
- package/umd/typings/types/PromptbookJson/PromptbookJson.d.ts +51 -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 +42 -0
- package/umd/typings/types/execution-report/ExecutionReportJson.d.ts +56 -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 +432 -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 +5 -0
- package/umd/typings/utils/extractParameters.d.ts +8 -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 +10 -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 +7 -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 +13 -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 +8 -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
- package/umd/typings/wizzard/Wizzard.d.ts +4 -0
- package/umd/typings/wizzard/sample.d.ts +6 -0
|
@@ -0,0 +1,48 @@
|
|
|
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, string_title } from '../types/typeAliases';
|
|
5
|
+
import type { PromptChatResult, PromptCompletionResult } from './PromptResult';
|
|
6
|
+
/**
|
|
7
|
+
* Container for all the tools needed to execute prompts to large language models like GPT-4
|
|
8
|
+
* On its interface it exposes common methods for prompt execution.
|
|
9
|
+
* Inside (in constructor) it calls OpenAI, Azure, GPU, proxy, cache, logging,...
|
|
10
|
+
*
|
|
11
|
+
* @see https://github.com/webgptorg/promptbook#llm-execution-tools
|
|
12
|
+
*/
|
|
13
|
+
export type LlmExecutionTools = {
|
|
14
|
+
/**
|
|
15
|
+
* Use a chat model
|
|
16
|
+
*/
|
|
17
|
+
gptChat(prompt: Prompt): Promise<PromptChatResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Use a completion model
|
|
20
|
+
*/
|
|
21
|
+
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
22
|
+
/**
|
|
23
|
+
* List all available models that can be used
|
|
24
|
+
*/
|
|
25
|
+
listModels(): Promisable<Array<AvailableModel>>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Represents a model that can be used for prompt execution
|
|
29
|
+
*/
|
|
30
|
+
export type AvailableModel = {
|
|
31
|
+
/**
|
|
32
|
+
* The model title
|
|
33
|
+
*/
|
|
34
|
+
readonly modelTitle: string_title;
|
|
35
|
+
/**
|
|
36
|
+
* The model name aviailable
|
|
37
|
+
*/
|
|
38
|
+
readonly modelName: string_model_name;
|
|
39
|
+
/**
|
|
40
|
+
* Variant of the model
|
|
41
|
+
*/
|
|
42
|
+
readonly modelVariant: ModelVariant;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* TODO: [๐][โ] Some heuristic to pick the best model in listed models
|
|
46
|
+
* TODO: [๐ณ] gptChat -> chat, gptComplete -> complete, translate
|
|
47
|
+
* TODO: [๐ง ] Should or should not there be a word "GPT" in both gptComplete and gptChat
|
|
48
|
+
*/
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { number_positive_or_zero, number_tokens, number_usd, string_date_iso8601, string_model_name } from '.././types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Prompt result is the simplest concept of execution.
|
|
4
|
+
* It is the result of executing one prompt _(NOT a template)_.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/webgptorg/promptbook#prompt-result
|
|
7
|
+
*/
|
|
8
|
+
export type PromptResult = PromptCompletionResult | PromptChatResult;
|
|
9
|
+
/**
|
|
10
|
+
* Prompt completion result
|
|
11
|
+
* It contains only the following text NOT the whole completion
|
|
12
|
+
*/
|
|
13
|
+
export type PromptCompletionResult = PromptCommonResult;
|
|
14
|
+
/**
|
|
15
|
+
* Prompt chat result
|
|
16
|
+
*/
|
|
17
|
+
export type PromptChatResult = PromptCommonResult & {};
|
|
18
|
+
export type PromptCommonResult = {
|
|
19
|
+
/**
|
|
20
|
+
* Exact text response from the model
|
|
21
|
+
*/
|
|
22
|
+
readonly content: string;
|
|
23
|
+
/**
|
|
24
|
+
* Name of the model used to generate the response
|
|
25
|
+
*/
|
|
26
|
+
readonly model: string_model_name;
|
|
27
|
+
/**
|
|
28
|
+
* Timing
|
|
29
|
+
*/
|
|
30
|
+
readonly timing: {
|
|
31
|
+
/**
|
|
32
|
+
* Start of the execution
|
|
33
|
+
*/
|
|
34
|
+
start: string_date_iso8601;
|
|
35
|
+
/**
|
|
36
|
+
* First token generated
|
|
37
|
+
*/
|
|
38
|
+
firstToken?: string_date_iso8601;
|
|
39
|
+
/**
|
|
40
|
+
* End of the execution
|
|
41
|
+
*/
|
|
42
|
+
complete: string_date_iso8601;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Usage of the prompt execution
|
|
46
|
+
*/
|
|
47
|
+
readonly usage: {
|
|
48
|
+
/**
|
|
49
|
+
* Cost of the execution in USD
|
|
50
|
+
*
|
|
51
|
+
* If the cost is unknown, the value is `'UNKNOWN'`
|
|
52
|
+
*/
|
|
53
|
+
price: (number_positive_or_zero & number_usd) | 'UNKNOWN';
|
|
54
|
+
/**
|
|
55
|
+
* Number of tokens used in the input aka. `prompt_tokens`
|
|
56
|
+
*/
|
|
57
|
+
inputTokens: number_tokens;
|
|
58
|
+
/**
|
|
59
|
+
* Number of tokens used in the output aka. `completion_tokens`
|
|
60
|
+
*/
|
|
61
|
+
outputTokens: number_tokens;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Raw response from the model
|
|
65
|
+
*/
|
|
66
|
+
readonly rawResponse: object;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* TODO: [๐ง ] Maybe timing more accurate then seconds?
|
|
70
|
+
* TODO: [๐ง ] Should here be link to the prompt?
|
|
71
|
+
* TODO: [๐ง ] Maybe type raw properly - not onject but OpenAI.result.whatever
|
|
72
|
+
* TODO: [๐ง ] Maybe remove redundant raw.choices.text
|
|
73
|
+
* TODO: Log raw even if prompt failed - log the raw error
|
|
74
|
+
*/
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* 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)_.
|
|
7
|
+
* Executor is made by combining execution tools and promptbook library.
|
|
8
|
+
*
|
|
9
|
+
* It can be created with `createPromptbookExecutor` function.
|
|
10
|
+
*
|
|
11
|
+
* @see https://github.com/webgptorg/promptbook#executor
|
|
12
|
+
*/
|
|
13
|
+
export type PromptbookExecutor = {
|
|
14
|
+
(inputParameters: Record<string_name, string>, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<{
|
|
15
|
+
/**
|
|
16
|
+
* Whether the execution was successful
|
|
17
|
+
*/
|
|
18
|
+
isSuccessful: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Errors that occured during the execution
|
|
21
|
+
*/
|
|
22
|
+
errors: Array<Error>;
|
|
23
|
+
/**
|
|
24
|
+
* The report of the execution
|
|
25
|
+
*/
|
|
26
|
+
executionReport: ExecutionReportJson;
|
|
27
|
+
/**
|
|
28
|
+
* Result parameters of the execution
|
|
29
|
+
*
|
|
30
|
+
* Note: If the execution was not successful, there are only some of the result parameters
|
|
31
|
+
*/
|
|
32
|
+
outputParameters: Record<string_name, string>;
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* TODO: [๐ง ] Should this file be in /execution or /types folder?
|
|
37
|
+
*/
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { string_name, string_script } from '.././types/typeAliases';
|
|
2
|
+
import type { ScriptLanguage } from '../types/ScriptLanguage';
|
|
3
|
+
/**
|
|
4
|
+
* Represents all the tools needed to EXECUTE SCRIPTs
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/webgptorg/promptbook#script-execution-tools
|
|
7
|
+
*/
|
|
8
|
+
export type ScriptExecutionTools = {
|
|
9
|
+
execute(options: ScriptExecutionToolsExecuteOptions): Promise<string>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Input for the script execution
|
|
13
|
+
*/
|
|
14
|
+
export type ScriptExecutionToolsExecuteOptions = {
|
|
15
|
+
/**
|
|
16
|
+
* Language of the script
|
|
17
|
+
*/
|
|
18
|
+
scriptLanguage: ScriptLanguage;
|
|
19
|
+
/**
|
|
20
|
+
* Parameters for the script
|
|
21
|
+
* Theese parameters are passed to the script as variables
|
|
22
|
+
* For example: { "name": "John" } => const name = "John";
|
|
23
|
+
*/
|
|
24
|
+
parameters: Record<string_name, string>;
|
|
25
|
+
/**
|
|
26
|
+
* The content of the script to execute
|
|
27
|
+
* - It can be a single statement
|
|
28
|
+
* - It can be multiple statements separated by semicolon and return
|
|
29
|
+
* - It can be a function (but you need to call it)
|
|
30
|
+
* - It can be IIFE (immediately invoked function expression)
|
|
31
|
+
* - It can use the parameters as variables and functions from global scope
|
|
32
|
+
*/
|
|
33
|
+
script: string_script;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* TODO: [๐ง ][๐] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
|
|
37
|
+
*/
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { number_integer, number_positive } from '../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Represents all the tools needed to interact with the user.
|
|
4
|
+
*
|
|
5
|
+
* @see https://github.com/webgptorg/promptbook#user-interface-tools
|
|
6
|
+
*/
|
|
7
|
+
export type UserInterfaceTools = {
|
|
8
|
+
/**
|
|
9
|
+
* Asks the user to answer a free-text (multi-line) question
|
|
10
|
+
*
|
|
11
|
+
* @param options the question to ask
|
|
12
|
+
* @returns the answer from the user
|
|
13
|
+
*/
|
|
14
|
+
promptDialog(options: UserInterfaceToolsPromptDialogOptions): Promise<string>;
|
|
15
|
+
};
|
|
16
|
+
export type UserInterfaceToolsPromptDialogOptions = {
|
|
17
|
+
/**
|
|
18
|
+
* Prompt title
|
|
19
|
+
*
|
|
20
|
+
* Note: This is not a prompt to language model but a prompt to the user
|
|
21
|
+
* @example "Your name"
|
|
22
|
+
*/
|
|
23
|
+
promptTitle: string;
|
|
24
|
+
/**
|
|
25
|
+
* Prompt message
|
|
26
|
+
*
|
|
27
|
+
* Note: This is not a prompt to language model but a prompt to the user
|
|
28
|
+
* @example "Please enter your name, including your last name, title, etc."
|
|
29
|
+
*/
|
|
30
|
+
promptMessage: string;
|
|
31
|
+
/**
|
|
32
|
+
* Default value for the input/textarea
|
|
33
|
+
*/
|
|
34
|
+
defaultValue: string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Placeholder for the input/textarea
|
|
37
|
+
*/
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Priority of the prompt
|
|
41
|
+
*
|
|
42
|
+
* Note: This would be reflected for example into the UI z-index of the prompt modal
|
|
43
|
+
*/
|
|
44
|
+
priority: number_integer & number_positive;
|
|
45
|
+
};
|
|
@@ -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 { PromptbookJson } from '../_packages/types.index';
|
|
2
|
+
import { ExecutionTools } from './ExecutionTools';
|
|
3
|
+
import { 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
|
+
*/
|
package/esm/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
2
|
+
import { OpenAiExecutionTools } from '../openai/OpenAiExecutionTools';
|
|
3
|
+
/**
|
|
4
|
+
* Execution Tools for calling OpenAI API.
|
|
5
|
+
*/
|
|
6
|
+
export declare class LangtailExecutionTools extends OpenAiExecutionTools implements LlmExecutionTools {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* TODO: [๐][โ] Allow to list the available prompts in Langtail
|
|
10
|
+
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OpenAiExecutionToolsOptions } from '../openai/OpenAiExecutionToolsOptions';
|
|
2
|
+
/**
|
|
3
|
+
* Options for LangtailExecutionTools
|
|
4
|
+
*
|
|
5
|
+
* This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
|
|
6
|
+
* Rest is used by the `OpenAiExecutionTools`.
|
|
7
|
+
*/
|
|
8
|
+
export type LangtailExecutionToolsOptions = OpenAiExecutionToolsOptions;
|
|
9
|
+
/**
|
|
10
|
+
* TODO: !!! Use or remove
|
|
11
|
+
*/
|
package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
5
|
+
/**
|
|
6
|
+
* Mocked execution Tools for just echoing the requests for testing purposes.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
|
|
9
|
+
private readonly options;
|
|
10
|
+
constructor(options: CommonExecutionToolsOptions);
|
|
11
|
+
/**
|
|
12
|
+
* Mocks chat model
|
|
13
|
+
*/
|
|
14
|
+
gptChat(prompt: Prompt): Promise<PromptChatResult>;
|
|
15
|
+
/**
|
|
16
|
+
* Mocks completion model
|
|
17
|
+
*/
|
|
18
|
+
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
19
|
+
/**
|
|
20
|
+
* List all available mocked-models that can be used
|
|
21
|
+
*/
|
|
22
|
+
listModels(): Array<AvailableModel>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* TODO: Allow in spaceTrim: nesting with > ${block(prompt.request)}, same as replace params
|
|
26
|
+
*/
|
package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
5
|
+
/**
|
|
6
|
+
* Mocked execution Tools for just faking expected responses for testing purposes
|
|
7
|
+
*/
|
|
8
|
+
export declare class MockedFackedLlmExecutionTools implements LlmExecutionTools {
|
|
9
|
+
private readonly options;
|
|
10
|
+
constructor(options: CommonExecutionToolsOptions);
|
|
11
|
+
/**
|
|
12
|
+
* Fakes chat model
|
|
13
|
+
*/
|
|
14
|
+
gptChat(prompt: Prompt): Promise<PromptChatResult & PromptCompletionResult>;
|
|
15
|
+
/**
|
|
16
|
+
* Fakes completion model
|
|
17
|
+
*/
|
|
18
|
+
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
19
|
+
/**
|
|
20
|
+
* List all available fake-models that can be used
|
|
21
|
+
*/
|
|
22
|
+
listModels(): Array<AvailableModel>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Expectations } from '../../../../types/PromptbookJson/PromptTemplateJson';
|
|
2
|
+
import { PostprocessingFunction } from '../../script-execution-tools/javascript/JavascriptExecutionToolsOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Gets the expectations and creates a fake text that meets the expectations
|
|
5
|
+
*
|
|
6
|
+
* Note: You can provide postprocessing functions to modify the text before checking the expectations
|
|
7
|
+
* The result will be the text BEFORE the postprocessing
|
|
8
|
+
*
|
|
9
|
+
* @private internal util for MockedFackedLlmExecutionTools
|
|
10
|
+
*/
|
|
11
|
+
export declare function $fakeTextToExpectations(expectations: Expectations, postprocessing?: Array<PostprocessingFunction>): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* TODO: [๐] Implement better - create FakeLLM from this
|
|
14
|
+
* TODO: [๐] Unite object for expecting amount and format - use here also a format
|
|
15
|
+
*/
|
package/esm/typings/execution/plugins/llm-execution-tools/mocked/fakeTextToExpectations.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
|
+
import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions';
|
|
5
|
+
/**
|
|
6
|
+
* Execution Tools for calling OpenAI API.
|
|
7
|
+
*/
|
|
8
|
+
export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
9
|
+
private readonly options;
|
|
10
|
+
/**
|
|
11
|
+
* OpenAI API client.
|
|
12
|
+
*/
|
|
13
|
+
private readonly openai;
|
|
14
|
+
/**
|
|
15
|
+
* Creates OpenAI Execution Tools.
|
|
16
|
+
*
|
|
17
|
+
* @param options which are relevant are directly passed to the OpenAI client
|
|
18
|
+
*/
|
|
19
|
+
constructor(options: OpenAiExecutionToolsOptions);
|
|
20
|
+
/**
|
|
21
|
+
* Calls OpenAI API to use a chat model.
|
|
22
|
+
*/
|
|
23
|
+
gptChat(prompt: Prompt): Promise<PromptChatResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Calls OpenAI API to use a complete model.
|
|
26
|
+
*/
|
|
27
|
+
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Default model for chat variant.
|
|
30
|
+
*/
|
|
31
|
+
private getDefaultChatModel;
|
|
32
|
+
/**
|
|
33
|
+
* Default model for completion variant.
|
|
34
|
+
*/
|
|
35
|
+
private getDefaultCompletionModel;
|
|
36
|
+
/**
|
|
37
|
+
* List all available OpenAI models that can be used
|
|
38
|
+
*/
|
|
39
|
+
listModels(): Array<AvailableModel>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* TODO: [๐][โ] Allow to list compatible models with each variant
|
|
43
|
+
* TODO: Maybe Create some common util for gptChat and gptComplete
|
|
44
|
+
* TODO: Maybe make custom OpenaiError
|
|
45
|
+
*/
|
package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ClientOptions } from 'openai';
|
|
2
|
+
import type { string_token } from '../../../.././types/typeAliases';
|
|
3
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
4
|
+
/**
|
|
5
|
+
* Options for OpenAiExecutionTools
|
|
6
|
+
*
|
|
7
|
+
* This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
|
|
8
|
+
* Rest is used by the `OpenAiExecutionTools`.
|
|
9
|
+
*/
|
|
10
|
+
export type OpenAiExecutionToolsOptions = CommonExecutionToolsOptions & ClientOptions & {
|
|
11
|
+
/**
|
|
12
|
+
* A unique identifier representing your end-user, which can help OpenAI to monitor
|
|
13
|
+
* and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
|
|
14
|
+
*/
|
|
15
|
+
user?: string_token;
|
|
16
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type OpenAI from 'openai';
|
|
2
|
+
import type { PromptResult } from '../../../PromptResult';
|
|
3
|
+
/**
|
|
4
|
+
* Computes the usage of the OpenAI API based on the response from OpenAI
|
|
5
|
+
*
|
|
6
|
+
* @throws {PromptbookExecutionError} If the usage is not defined in the response from OpenAI
|
|
7
|
+
*/
|
|
8
|
+
export declare function computeOpenaiUsage(rawResponse: Pick<OpenAI.Chat.Completions.ChatCompletion | OpenAI.Completions.Completion, 'model' | 'usage'>): PromptResult['usage'];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String value found on openai page
|
|
3
|
+
*
|
|
4
|
+
* @private within the library, used only as internal helper for `OPENAI_MODELS` and `computeUsage`
|
|
5
|
+
*/
|
|
6
|
+
type string_openai_price = `$${number}.${number} / ${number}M tokens`;
|
|
7
|
+
/**
|
|
8
|
+
* Function computeUsage will create price per one token based on the string value found on openai page
|
|
9
|
+
*
|
|
10
|
+
* @private within the library, used only as internal helper for `OPENAI_MODELS`
|
|
11
|
+
*/
|
|
12
|
+
export declare function computeUsage(value: string_openai_price): number;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { number_usd } from '../../../../types/typeAliases';
|
|
2
|
+
import type { AvailableModel } from '../../../LlmExecutionTools';
|
|
3
|
+
/**
|
|
4
|
+
* List of available OpenAI models with pricing
|
|
5
|
+
*
|
|
6
|
+
* Note: Done at 2024-05-20
|
|
7
|
+
*
|
|
8
|
+
* @see https://platform.openai.com/docs/models/
|
|
9
|
+
* @see https://openai.com/api/pricing/
|
|
10
|
+
*/
|
|
11
|
+
export declare const OPENAI_MODELS: Array<AvailableModel & {
|
|
12
|
+
pricing?: {
|
|
13
|
+
prompt: number_usd;
|
|
14
|
+
output: number_usd;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* TODO: [๐ง ] Some mechanism to propagate unsureness
|
|
19
|
+
* TODO: [๐] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
20
|
+
* @see https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4
|
|
21
|
+
* @see https://openai.com/api/pricing/
|
|
22
|
+
* @see /other/playground/playground.ts
|
|
23
|
+
* TODO: [๐] Make better
|
|
24
|
+
* TODO: Change model titles to human eg: "gpt-4-turbo-2024-04-09" -> "GPT-4 Turbo (2024-04-09)"
|
|
25
|
+
*/
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
|
+
import type { RemoteLlmExecutionToolsOptions } from './RemoteLlmExecutionToolsOptions';
|
|
5
|
+
/**
|
|
6
|
+
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
7
|
+
*
|
|
8
|
+
* You can simply use `RemoteExecutionTools` on client-side javascript and connect to your remote server.
|
|
9
|
+
* This is useful to make all logic on browser side but not expose your API keys or no need to use customer's GPU.
|
|
10
|
+
*
|
|
11
|
+
* @see https://github.com/webgptorg/promptbook#remote-server
|
|
12
|
+
*/
|
|
13
|
+
export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
|
|
14
|
+
private readonly options;
|
|
15
|
+
constructor(options: RemoteLlmExecutionToolsOptions);
|
|
16
|
+
/**
|
|
17
|
+
* Creates a connection to the remote proxy server.
|
|
18
|
+
*/
|
|
19
|
+
private makeConnection;
|
|
20
|
+
/**
|
|
21
|
+
* Calls remote proxy server to use a chat model.
|
|
22
|
+
*/
|
|
23
|
+
gptChat(prompt: Prompt): Promise<PromptChatResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Calls remote proxy server to use a completion model.
|
|
26
|
+
*/
|
|
27
|
+
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Calls remote proxy server to use both completion or chat model.
|
|
30
|
+
*/
|
|
31
|
+
private gptCommon;
|
|
32
|
+
/**
|
|
33
|
+
* List all available models that can be used
|
|
34
|
+
*/
|
|
35
|
+
listModels(): Promise<Array<AvailableModel>>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* TODO: [๐][โ] Allow to list compatible models with each variant
|
|
39
|
+
* TODO: [๐คนโโ๏ธ] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
|
|
40
|
+
*/
|
package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionToolsOptions.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { client_id, string_uri } from '../../../../types/typeAliases';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Options for RemoteLlmExecutionTools
|
|
5
|
+
*/
|
|
6
|
+
export type RemoteLlmExecutionToolsOptions = CommonExecutionToolsOptions & {
|
|
7
|
+
/**
|
|
8
|
+
* URL of the remote PROMPTBOOK server
|
|
9
|
+
* On this server will be connected to the socket.io server
|
|
10
|
+
*/
|
|
11
|
+
readonly remoteUrl: URL;
|
|
12
|
+
/**
|
|
13
|
+
* Path for the Socket.io server to listen
|
|
14
|
+
*
|
|
15
|
+
* @default '/socket.io'
|
|
16
|
+
* @example '/promptbook/socket.io'
|
|
17
|
+
*/
|
|
18
|
+
readonly path: string_uri;
|
|
19
|
+
/**
|
|
20
|
+
* Your client ID
|
|
21
|
+
*/
|
|
22
|
+
readonly clientId: client_id;
|
|
23
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Socket.io error for remote text generation
|
|
3
|
+
*
|
|
4
|
+
* This is sent from server to client when error occurs and stops the process
|
|
5
|
+
*/
|
|
6
|
+
export interface Promptbook_Server_Error {
|
|
7
|
+
/**
|
|
8
|
+
* The error message which caused the error
|
|
9
|
+
*/
|
|
10
|
+
readonly errorMessage: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TaskProgress } from '../../../../../types/TaskProgress';
|
|
2
|
+
/**
|
|
3
|
+
* Socket.io progress for remote text generation
|
|
4
|
+
*
|
|
5
|
+
* This is sent from server to client arbitrarily and may be sent multiple times
|
|
6
|
+
*/
|
|
7
|
+
export interface Promptbook_Server_Progress {
|
|
8
|
+
/**
|
|
9
|
+
* The progress of text generation
|
|
10
|
+
*/
|
|
11
|
+
readonly taskProgress: TaskProgress;
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { client_id } from '../../../../../types/typeAliases';
|
|
2
|
+
import type { Prompt } from '../../../../../types/Prompt';
|
|
3
|
+
/**
|
|
4
|
+
* Socket.io progress for remote text generation
|
|
5
|
+
*
|
|
6
|
+
* This is a request from client to server
|
|
7
|
+
*/
|
|
8
|
+
export interface Promptbook_Server_Request {
|
|
9
|
+
/**
|
|
10
|
+
* Client responsible for the requests
|
|
11
|
+
*/
|
|
12
|
+
readonly clientId: client_id;
|
|
13
|
+
/**
|
|
14
|
+
* The Prompt to execute
|
|
15
|
+
*/
|
|
16
|
+
readonly prompt: Prompt;
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PromptResult } from '../../../../PromptResult';
|
|
2
|
+
/**
|
|
3
|
+
* Socket.io error for remote text generation
|
|
4
|
+
*
|
|
5
|
+
* This is sent from server to client when the generated text is completed
|
|
6
|
+
*/
|
|
7
|
+
export interface Promptbook_Server_Response {
|
|
8
|
+
/**
|
|
9
|
+
* The result of the prompt
|
|
10
|
+
*/
|
|
11
|
+
promptResult: PromptResult;
|
|
12
|
+
}
|