@promptbook/remote-server 0.72.0-0 → 0.72.0-10
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 +15 -6
- package/esm/index.es.js +154 -40
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/browser.index.d.ts +3 -1
- package/esm/typings/src/_packages/cli.index.d.ts +24 -0
- package/esm/typings/src/_packages/core.index.d.ts +47 -15
- package/esm/typings/src/_packages/documents.index.d.ts +8 -0
- package/esm/typings/src/_packages/legacy-documents.index.d.ts +8 -0
- package/esm/typings/src/_packages/markdown-utils.index.d.ts +6 -0
- package/esm/typings/src/_packages/node.index.d.ts +16 -6
- package/esm/typings/src/_packages/openai.index.d.ts +4 -0
- package/esm/typings/src/_packages/pdf.index.d.ts +8 -0
- package/esm/typings/src/_packages/types.index.d.ts +61 -27
- package/esm/typings/src/_packages/utils.index.d.ts +4 -4
- package/esm/typings/src/_packages/website-crawler.index.d.ts +8 -0
- package/esm/typings/src/cli/cli-commands/about.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +13 -0
- package/esm/typings/src/cli/main.d.ts +1 -1
- package/esm/typings/src/cli/promptbookCli.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +11 -6
- package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
- package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +3 -2
- package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +27 -0
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/FORMAT/formatCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/JOKER/jokerCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/KNOWLEDGE/utils/sourceContentToName.d.ts +11 -0
- package/esm/typings/src/commands/KNOWLEDGE/utils/sourceContentToName.test.d.ts +4 -0
- package/esm/typings/src/commands/MODEL/modelCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/PERSONA/personaCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/TEMPLATE/templateCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/URL/urlCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/X_ACTION/actionCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +16 -1
- package/esm/typings/src/config.d.ts +30 -1
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +4 -15
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -1
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -0
- package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.d.ts +2 -1
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +10 -5
- package/esm/typings/src/{knowledge/dialogs → dialogs}/callback/CallbackInterfaceTools.d.ts +2 -2
- package/esm/typings/src/{knowledge/dialogs → dialogs}/callback/CallbackInterfaceToolsOptions.d.ts +3 -3
- package/esm/typings/src/{knowledge/dialogs → dialogs}/simple-prompt/SimplePromptInterfaceTools.d.ts +6 -6
- package/esm/typings/src/errors/AbstractFormatError.d.ts +11 -0
- package/esm/typings/src/errors/KnowledgeScrapeError.d.ts +9 -0
- package/esm/typings/src/errors/MissingToolsError.d.ts +9 -0
- package/esm/typings/src/execution/{CommonExecutionToolsOptions.d.ts → CommonToolsOptions.d.ts} +1 -1
- package/esm/typings/src/execution/ExecutionTools.d.ts +29 -9
- package/esm/typings/src/execution/FilesystemTools.d.ts +9 -0
- package/esm/typings/src/execution/PipelineExecutor.d.ts +1 -0
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +9 -8
- package/esm/typings/src/execution/createPipelineExecutor/$OngoingTemplateResult.d.ts +45 -0
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +23 -0
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +29 -0
- package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +13 -0
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +58 -0
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTemplate.d.ts +60 -0
- package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +15 -0
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +69 -0
- package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +34 -0
- package/esm/typings/src/execution/createPipelineExecutor/getContextForTemplate.d.ts +10 -0
- package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +27 -0
- package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +30 -0
- package/esm/typings/src/execution/createPipelineExecutor/getSamplesForTemplate.d.ts +10 -0
- package/esm/typings/src/execution/embeddingVectorToString.d.ts +1 -1
- package/esm/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +4 -0
- package/esm/typings/src/execution/utils/$provideExecutionToolsForNode.d.ts +13 -0
- package/esm/typings/src/execution/utils/checkExpectations.d.ts +2 -0
- package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -0
- package/esm/typings/src/execution/utils/usageToHuman.d.ts +3 -4
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +14 -15
- package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +31 -0
- package/esm/typings/src/formats/csv/{ListFormatDefinition.d.ts → CsvFormatDefinition.d.ts} +6 -3
- package/esm/typings/src/formats/csv/CsvFormatError.d.ts +10 -0
- package/esm/typings/src/formats/csv/CsvSettings.d.ts +13 -0
- package/esm/typings/src/formats/index.d.ts +1 -1
- package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +4 -3
- package/esm/typings/src/formats/text/TextFormatDefinition.d.ts +19 -0
- package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +4 -3
- package/esm/typings/src/llm-providers/_common/{$llmToolsMetadataRegister.d.ts → register/$llmToolsMetadataRegister.d.ts} +4 -1
- package/esm/typings/src/llm-providers/_common/{$llmToolsRegister.d.ts → register/$llmToolsRegister.d.ts} +5 -2
- package/esm/typings/src/llm-providers/_common/{createLlmToolsFromConfigurationFromEnv.d.ts → register/$provideLlmToolsConfigurationFromEnv.d.ts} +3 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForCli.d.ts +15 -0
- package/esm/typings/src/llm-providers/_common/{getLlmToolsForTestingAndScriptsAndPlayground.d.ts → register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts} +4 -3
- package/esm/typings/src/llm-providers/_common/{createLlmToolsFromEnv.d.ts → register/$provideLlmToolsFromEnv.d.ts} +6 -5
- package/esm/typings/src/llm-providers/_common/{$registeredLlmToolsMessage.d.ts → register/$registeredLlmToolsMessage.d.ts} +5 -2
- package/esm/typings/src/llm-providers/_common/{LlmToolsConfiguration.d.ts → register/LlmToolsConfiguration.d.ts} +5 -4
- package/esm/typings/src/llm-providers/_common/{LlmToolsMetadata.d.ts → register/LlmToolsMetadata.d.ts} +5 -4
- package/esm/typings/src/llm-providers/_common/{LlmToolsOptions.d.ts → register/LlmToolsOptions.d.ts} +4 -1
- package/esm/typings/src/llm-providers/_common/{createLlmToolsFromConfiguration.d.ts → register/createLlmToolsFromConfiguration.d.ts} +5 -4
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +5 -5
- package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +3 -2
- package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +4 -3
- package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +4 -3
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +6 -0
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +4 -3
- package/esm/typings/src/llm-providers/azure-openai/playground/playground.d.ts +1 -0
- package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +4 -3
- package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +4 -3
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/langtail/playground/playground.d.ts +3 -0
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/multiple/playground/playground.d.ts +3 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +10 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +4 -4
- package/esm/typings/src/llm-providers/openai/createOpenAiAssistantExecutionTools.d.ts +15 -0
- package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +2 -1
- package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +11 -1
- package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +11 -1
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Request.d.ts +16 -7
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Response.d.ts +2 -2
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Request.d.ts +7 -13
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Response.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +11 -16
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +23 -9
- package/esm/typings/src/llm-providers/remote/playground/playground.d.ts +3 -0
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
- package/esm/typings/src/personas/preparePersona.d.ts +3 -2
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +68 -0
- package/esm/typings/src/prepare/preparePipeline.d.ts +3 -2
- package/esm/typings/src/prepare/prepareTemplates.d.ts +3 -2
- package/esm/typings/src/scrapers/_common/Converter.d.ts +22 -0
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +66 -0
- package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +11 -0
- package/esm/typings/src/{knowledge/prepare-knowledge → scrapers}/_common/prepareKnowledgePieces.d.ts +5 -4
- package/esm/typings/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +11 -0
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +12 -0
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +15 -0
- package/esm/typings/src/scrapers/_common/register/$registeredScrapersMessage.d.ts +12 -0
- package/esm/typings/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +13 -0
- package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +13 -0
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +41 -0
- package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +12 -0
- package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +34 -0
- package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.test.d.ts +4 -0
- package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +11 -0
- package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +43 -0
- package/esm/typings/src/scrapers/document/DocumentScraper.test.d.ts +4 -0
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +20 -0
- package/esm/typings/src/scrapers/document/playground/document-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/document/register-constructor.d.ts +13 -0
- package/esm/typings/src/scrapers/document/register-metadata.d.ts +24 -0
- package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +43 -0
- package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.test.d.ts +4 -0
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +20 -0
- package/esm/typings/src/scrapers/document-legacy/playground/legacy-document-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +13 -0
- package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +24 -0
- package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +29 -0
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +20 -0
- package/esm/typings/src/scrapers/markdown/playground/markdown-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +13 -0
- package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +24 -0
- package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +40 -0
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +20 -0
- package/esm/typings/src/scrapers/pdf/playground/pdf-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +13 -0
- package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +24 -0
- package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +47 -0
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +20 -0
- package/esm/typings/src/scrapers/website/playground/website-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/website/register-constructor.d.ts +13 -0
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +24 -0
- package/esm/typings/src/scrapers/website/utils/markdownConverter.d.ts +12 -0
- package/esm/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/src/scripting/python/PythonExecutionTools.d.ts +3 -3
- package/esm/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +3 -3
- package/esm/typings/src/storage/{files-storage/FilesStorage.d.ts → file-cache-storage/FileCacheStorage.d.ts} +7 -5
- package/esm/typings/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +10 -0
- package/esm/typings/src/storage/{files-storage → file-cache-storage}/utils/nameToSubfolderPath.d.ts +1 -1
- package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +1 -1
- package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +1 -1
- package/esm/typings/src/storage/{utils → memory/utils}/PrefixStorage.d.ts +1 -1
- package/esm/typings/src/storage/{utils → memory/utils}/makePromptbookStorageFromWebStorage.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +9 -2
- package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +1 -0
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +2 -2
- package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +5 -0
- package/esm/typings/src/types/Prompt.d.ts +1 -0
- package/esm/typings/src/types/execution-report/executionReportJsonToString.d.ts +2 -1
- package/esm/typings/src/types/typeAliases.d.ts +27 -20
- package/esm/typings/src/utils/$Register.d.ts +19 -6
- package/esm/typings/src/utils/execCommand/$execCommand.d.ts +14 -0
- package/esm/typings/src/utils/execCommand/$execCommands.d.ts +17 -0
- package/esm/typings/src/utils/execCommand/IExecCommandOptions.d.ts +23 -0
- package/esm/typings/src/utils/execCommand/execCommandNormalizeOptions.d.ts +10 -0
- package/esm/typings/src/utils/expectation-counters/index.d.ts +3 -0
- package/esm/typings/src/utils/files/extensionToMimeType.d.ts +8 -0
- package/esm/typings/src/utils/files/getFileExtension.d.ts +8 -0
- package/esm/typings/src/utils/files/isDirectoryExisting.d.ts +14 -0
- package/esm/typings/src/utils/files/isFileExisting.d.ts +13 -0
- package/esm/typings/src/utils/files/isFileExisting.test.d.ts +1 -0
- package/esm/typings/src/utils/files/listAllFiles.d.ts +17 -0
- package/esm/typings/src/utils/files/listAllFiles.test.d.ts +1 -0
- package/esm/typings/src/utils/organization/{f.d.ts → empty_object.d.ts} +5 -1
- package/esm/typings/src/utils/organization/just_empty_object.d.ts +12 -0
- package/esm/typings/src/utils/{extractParameterNames.d.ts → parameters/extractParameterNames.d.ts} +2 -2
- package/esm/typings/src/utils/parameters/extractParameterNames.test.d.ts +1 -0
- package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +27 -0
- package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.test.d.ts +1 -0
- package/esm/typings/src/utils/{replaceParameters.d.ts → parameters/replaceParameters.d.ts} +2 -2
- package/esm/typings/src/utils/parameters/replaceParameters.test.d.ts +1 -0
- package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +2 -2
- package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +10 -0
- package/esm/typings/src/utils/validators/parameterName/validateParameterName.test.d.ts +1 -0
- package/package.json +17 -13
- package/umd/index.umd.js +154 -40
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +0 -72
- package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +0 -16
- package/esm/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +0 -37
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/playground/markdown-knowledge-playground.d.ts +0 -2
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +0 -14
- package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +0 -15
- package/esm/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +0 -22
- package/esm/typings/src/prepare/PrepareOptions.d.ts +0 -22
- package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +0 -10
- package/esm/typings/src/utils/files/$isDirectoryExisting.d.ts +0 -15
- package/esm/typings/src/utils/files/$isFileExisting.d.ts +0 -14
- package/esm/typings/src/utils/files/$listAllFiles.d.ts +0 -17
- /package/esm/typings/src/{knowledge/dialogs → dialogs}/user-interface-execution-tools.test.d.ts +0 -0
- /package/esm/typings/src/{knowledge/prepare-knowledge → scrapers}/_common/prepareKnowledgePieces.test.d.ts +0 -0
- /package/esm/typings/src/{knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts → scrapers/markdown/MarkdownScraper.test.d.ts} +0 -0
- /package/esm/typings/src/{execution/utils/usageToHuman.test.d.ts → scrapers/website/WebsiteScraper.test.d.ts} +0 -0
- /package/esm/typings/src/{knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts → scrapers/website/utils/markdownConverter.test.d.ts} +0 -0
- /package/esm/typings/src/storage/{files-storage → file-cache-storage}/utils/nameToSubfolderPath.test.d.ts +0 -0
- /package/esm/typings/src/utils/{extractParameterNames.test.d.ts → execCommand/execCommand.test.d.ts} +0 -0
- /package/esm/typings/src/utils/{files/$isDirectoryExisting.test.d.ts → execCommand/execCommandNormalizeOptions.test.d.ts} +0 -0
- /package/esm/typings/src/utils/files/{$isFileExisting.test.d.ts → extensionToMimeType.test.d.ts} +0 -0
- /package/esm/typings/src/utils/files/{$listAllFiles.test.d.ts → getFileExtension.test.d.ts} +0 -0
- /package/esm/typings/src/utils/{replaceParameters.test.d.ts → files/isDirectoryExisting.test.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -16,6 +16,16 @@ Supercharge your use of large language models
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
## ✨ New Features
|
|
20
|
+
|
|
21
|
+
- ✨ **Support of [OpenAI o1 model](https://openai.com/o1/)**
|
|
22
|
+
|
|
23
|
+
<blockquote style="color: #ff8811">
|
|
24
|
+
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
25
|
+
</blockquote>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
19
29
|
## 📦 Package `@promptbook/remote-server`
|
|
20
30
|
|
|
21
31
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
|
@@ -28,7 +38,7 @@ To install this package, run:
|
|
|
28
38
|
npm i ptbk
|
|
29
39
|
|
|
30
40
|
# Install just this package to save space
|
|
31
|
-
npm
|
|
41
|
+
npm install @promptbook/remote-server
|
|
32
42
|
```
|
|
33
43
|
|
|
34
44
|
|
|
@@ -38,10 +48,6 @@ npm i @promptbook/remote-server
|
|
|
38
48
|
|
|
39
49
|
Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
40
50
|
|
|
41
|
-
# ✨ New Features
|
|
42
|
-
|
|
43
|
-
- ✨ **Support [OpenAI o1 model](https://openai.com/o1/)**
|
|
44
|
-
|
|
45
51
|
## 🤍 The Promptbook Whitepaper
|
|
46
52
|
|
|
47
53
|
|
|
@@ -88,7 +94,6 @@ File `write-website-content.ptbk.md`:
|
|
|
88
94
|
> Instructions for creating web page content.
|
|
89
95
|
>
|
|
90
96
|
> - PIPELINE URL https://promptbook.studio/webgpt/write-website-content.ptbk.md
|
|
91
|
-
> - PROMPTBOOK VERSION 0.0.1
|
|
92
97
|
> - INPUT PARAM `{rawTitle}` Automatically suggested a site name or empty text
|
|
93
98
|
> - INPUT PARAM `{rawAssigment}` Automatically generated site entry from image recognition
|
|
94
99
|
> - OUTPUT PARAM `{websiteContent}` Web content
|
|
@@ -327,6 +332,10 @@ Or you can install them separately:
|
|
|
327
332
|
- **[@promptbook/fake-llm](https://www.npmjs.com/package/@promptbook/fake-llm)** - Mocked execution tools for testing the library and saving the tokens
|
|
328
333
|
- **[@promptbook/remote-client](https://www.npmjs.com/package/@promptbook/remote-client)** - Remote client for remote execution of promptbooks
|
|
329
334
|
- **[@promptbook/remote-server](https://www.npmjs.com/package/@promptbook/remote-server)** - Remote server for remote execution of promptbooks
|
|
335
|
+
- **[@promptbook/pdf](https://www.npmjs.com/package/@promptbook/pdf)** - Read knowledge from `.pdf` documents
|
|
336
|
+
- **[@promptbook/documents](https://www.npmjs.com/package/@promptbook/documents)** - Read knowledge from documents like `.docx`, `.odt`,…
|
|
337
|
+
- **[@promptbook/legacy-documents](https://www.npmjs.com/package/@promptbook/legacy-documents)** - Read knowledge from legacy documents like `.doc`, `.rtf`,…
|
|
338
|
+
- **[@promptbook/website-crawler](https://www.npmjs.com/package/@promptbook/website-crawler)** - Crawl knowledge from the web
|
|
330
339
|
- **[@promptbook/types](https://www.npmjs.com/package/@promptbook/types)** - Just typescript types used in the library
|
|
331
340
|
- **[@promptbook/cli](https://www.npmjs.com/package/@promptbook/cli)** - Command line interface utilities for promptbooks
|
|
332
341
|
|
package/esm/index.es.js
CHANGED
|
@@ -7,8 +7,8 @@ import spaceTrim$1, { spaceTrim } from 'spacetrim';
|
|
|
7
7
|
/**
|
|
8
8
|
* The version of the Promptbook library
|
|
9
9
|
*/
|
|
10
|
-
var PROMPTBOOK_VERSION = '0.
|
|
11
|
-
// TODO:[main] !!!! List here all the versions and annotate + put into script
|
|
10
|
+
var PROMPTBOOK_VERSION = '0.72.0-9';
|
|
11
|
+
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
12
12
|
|
|
13
13
|
/*! *****************************************************************************
|
|
14
14
|
Copyright (c) Microsoft Corporation.
|
|
@@ -354,10 +354,22 @@ $asDeeplyFrozenSerializableJson('RESERVED_PARAMETER_NAMES', [
|
|
|
354
354
|
'samples',
|
|
355
355
|
'modelName',
|
|
356
356
|
'currentDate',
|
|
357
|
+
// <- TODO: !!!!! list here all command names
|
|
357
358
|
// <- TODO: Add more like 'date', 'modelName',...
|
|
358
359
|
// <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
|
|
359
360
|
]);
|
|
360
361
|
// <- TODO: [🧜♂️]
|
|
362
|
+
/**
|
|
363
|
+
* @@@
|
|
364
|
+
*
|
|
365
|
+
* @public exported from `@promptbook/core`
|
|
366
|
+
*/
|
|
367
|
+
Object.freeze({
|
|
368
|
+
delimiter: ',',
|
|
369
|
+
quoteChar: '"',
|
|
370
|
+
newline: '\n',
|
|
371
|
+
skipEmptyLines: true,
|
|
372
|
+
});
|
|
361
373
|
/**
|
|
362
374
|
* @@@
|
|
363
375
|
*
|
|
@@ -576,6 +588,7 @@ function serializeError(error) {
|
|
|
576
588
|
*
|
|
577
589
|
* Note: Internal utility of `joinLlmExecutionTools` but exposed type
|
|
578
590
|
* @public exported from `@promptbook/types`
|
|
591
|
+
* TODO: !!!!!! Export as runtime class not just type
|
|
579
592
|
*/
|
|
580
593
|
var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
581
594
|
/**
|
|
@@ -597,9 +610,10 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
|
597
610
|
});
|
|
598
611
|
Object.defineProperty(MultipleLlmExecutionTools.prototype, "description", {
|
|
599
612
|
get: function () {
|
|
600
|
-
return this.llmExecutionTools
|
|
601
|
-
|
|
602
|
-
.
|
|
613
|
+
return this.llmExecutionTools.map(function (_a, index) {
|
|
614
|
+
var title = _a.title;
|
|
615
|
+
return "".concat(index + 1, ") `").concat(title, "`");
|
|
616
|
+
}).join('\n');
|
|
603
617
|
},
|
|
604
618
|
enumerable: false,
|
|
605
619
|
configurable: true
|
|
@@ -797,9 +811,7 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
|
797
811
|
throw new PipelineExecutionError("You have not provided any `LlmExecutionTools`");
|
|
798
812
|
}
|
|
799
813
|
else {
|
|
800
|
-
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n You have not provided any `LlmExecutionTools` that support model variant \"".concat(prompt.modelRequirements.modelVariant, "\n\n Available `LlmExecutionTools`:\n ").concat(block(_this.
|
|
801
|
-
.map(function (tools) { return "- ".concat(tools.title, " ").concat(tools.description || ''); })
|
|
802
|
-
.join('\n')), "\n\n "); }));
|
|
814
|
+
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n You have not provided any `LlmExecutionTools` that support model variant \"".concat(prompt.modelRequirements.modelVariant, "\"\n\n Available `LlmExecutionTools`:\n ").concat(block(_this.description), "\n\n "); }));
|
|
803
815
|
}
|
|
804
816
|
}
|
|
805
817
|
});
|
|
@@ -875,6 +887,85 @@ function $getGlobalScope() {
|
|
|
875
887
|
return Function('return this')();
|
|
876
888
|
}
|
|
877
889
|
|
|
890
|
+
/**
|
|
891
|
+
* @@@
|
|
892
|
+
*
|
|
893
|
+
* @param text @@@
|
|
894
|
+
* @returns @@@
|
|
895
|
+
* @example 'HELLO_WORLD'
|
|
896
|
+
* @example 'I_LOVE_PROMPTBOOK'
|
|
897
|
+
* @public exported from `@promptbook/utils`
|
|
898
|
+
*/
|
|
899
|
+
function normalizeTo_SCREAMING_CASE(text) {
|
|
900
|
+
var e_1, _a;
|
|
901
|
+
var charType;
|
|
902
|
+
var lastCharType = 'OTHER';
|
|
903
|
+
var normalizedName = '';
|
|
904
|
+
try {
|
|
905
|
+
for (var text_1 = __values(text), text_1_1 = text_1.next(); !text_1_1.done; text_1_1 = text_1.next()) {
|
|
906
|
+
var char = text_1_1.value;
|
|
907
|
+
var normalizedChar = void 0;
|
|
908
|
+
if (/^[a-z]$/.test(char)) {
|
|
909
|
+
charType = 'LOWERCASE';
|
|
910
|
+
normalizedChar = char.toUpperCase();
|
|
911
|
+
}
|
|
912
|
+
else if (/^[A-Z]$/.test(char)) {
|
|
913
|
+
charType = 'UPPERCASE';
|
|
914
|
+
normalizedChar = char;
|
|
915
|
+
}
|
|
916
|
+
else if (/^[0-9]$/.test(char)) {
|
|
917
|
+
charType = 'NUMBER';
|
|
918
|
+
normalizedChar = char;
|
|
919
|
+
}
|
|
920
|
+
else {
|
|
921
|
+
charType = 'OTHER';
|
|
922
|
+
normalizedChar = '_';
|
|
923
|
+
}
|
|
924
|
+
if (charType !== lastCharType &&
|
|
925
|
+
!(lastCharType === 'UPPERCASE' && charType === 'LOWERCASE') &&
|
|
926
|
+
!(lastCharType === 'NUMBER') &&
|
|
927
|
+
!(charType === 'NUMBER')) {
|
|
928
|
+
normalizedName += '_';
|
|
929
|
+
}
|
|
930
|
+
normalizedName += normalizedChar;
|
|
931
|
+
lastCharType = charType;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
935
|
+
finally {
|
|
936
|
+
try {
|
|
937
|
+
if (text_1_1 && !text_1_1.done && (_a = text_1.return)) _a.call(text_1);
|
|
938
|
+
}
|
|
939
|
+
finally { if (e_1) throw e_1.error; }
|
|
940
|
+
}
|
|
941
|
+
normalizedName = normalizedName.replace(/_+/g, '_');
|
|
942
|
+
normalizedName = normalizedName.replace(/_?\/_?/g, '/');
|
|
943
|
+
normalizedName = normalizedName.replace(/^_/, '');
|
|
944
|
+
normalizedName = normalizedName.replace(/_$/, '');
|
|
945
|
+
return normalizedName;
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* TODO: Tests
|
|
949
|
+
* > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: 'Moje tabule' })).toEqual('/VtG7sR9rRJqwNEdM2/Moje tabule');
|
|
950
|
+
* > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: 'ěščřžžýáíúů' })).toEqual('/VtG7sR9rRJqwNEdM2/escrzyaieuu');
|
|
951
|
+
* > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: ' ahoj ' })).toEqual('/VtG7sR9rRJqwNEdM2/ahoj');
|
|
952
|
+
* > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: ' ahoj_ahojAhoj ahoj ' })).toEqual('/VtG7sR9rRJqwNEdM2/ahoj-ahoj-ahoj-ahoj');
|
|
953
|
+
* TODO: [🌺] Use some intermediate util splitWords
|
|
954
|
+
*/
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* @@@
|
|
958
|
+
*
|
|
959
|
+
* @param text @@@
|
|
960
|
+
* @returns @@@
|
|
961
|
+
* @example 'hello_world'
|
|
962
|
+
* @example 'i_love_promptbook'
|
|
963
|
+
* @public exported from `@promptbook/utils`
|
|
964
|
+
*/
|
|
965
|
+
function normalizeTo_snake_case(text) {
|
|
966
|
+
return normalizeTo_SCREAMING_CASE(text).toLowerCase();
|
|
967
|
+
}
|
|
968
|
+
|
|
878
969
|
/**
|
|
879
970
|
* Register is @@@
|
|
880
971
|
*
|
|
@@ -883,9 +974,9 @@ function $getGlobalScope() {
|
|
|
883
974
|
* @private internal utility, exported are only signleton instances of this class
|
|
884
975
|
*/
|
|
885
976
|
var $Register = /** @class */ (function () {
|
|
886
|
-
function $Register(
|
|
887
|
-
this.
|
|
888
|
-
storageName = "_promptbook_".concat(
|
|
977
|
+
function $Register(registerName) {
|
|
978
|
+
this.registerName = registerName;
|
|
979
|
+
var storageName = "_promptbook_".concat(normalizeTo_snake_case(registerName));
|
|
889
980
|
var globalScope = $getGlobalScope();
|
|
890
981
|
if (globalScope[storageName] === undefined) {
|
|
891
982
|
globalScope[storageName] = [];
|
|
@@ -900,7 +991,6 @@ var $Register = /** @class */ (function () {
|
|
|
900
991
|
return this.storage;
|
|
901
992
|
};
|
|
902
993
|
$Register.prototype.register = function (registered) {
|
|
903
|
-
// <- TODO: What to return here
|
|
904
994
|
var packageName = registered.packageName, className = registered.className;
|
|
905
995
|
var existingRegistrationIndex = this.storage.findIndex(function (item) { return item.packageName === packageName && item.className === className; });
|
|
906
996
|
var existingRegistration = this.storage[existingRegistrationIndex];
|
|
@@ -910,6 +1000,17 @@ var $Register = /** @class */ (function () {
|
|
|
910
1000
|
else {
|
|
911
1001
|
this.storage[existingRegistrationIndex] = registered;
|
|
912
1002
|
}
|
|
1003
|
+
return {
|
|
1004
|
+
registerName: this.registerName,
|
|
1005
|
+
packageName: packageName,
|
|
1006
|
+
className: className,
|
|
1007
|
+
get isDestroyed() {
|
|
1008
|
+
return false;
|
|
1009
|
+
},
|
|
1010
|
+
destroy: function () {
|
|
1011
|
+
throw new NotYetImplementedError("Registration to ".concat(this.registerName, " is permanent in this version of Promptbook"));
|
|
1012
|
+
},
|
|
1013
|
+
};
|
|
913
1014
|
};
|
|
914
1015
|
return $Register;
|
|
915
1016
|
}());
|
|
@@ -922,6 +1023,9 @@ var $Register = /** @class */ (function () {
|
|
|
922
1023
|
* @public exported from `@promptbook/core`
|
|
923
1024
|
*/
|
|
924
1025
|
var $llmToolsRegister = new $Register('llm_execution_tools_constructors');
|
|
1026
|
+
/**
|
|
1027
|
+
* TODO: [®] DRY Register logic
|
|
1028
|
+
*/
|
|
925
1029
|
|
|
926
1030
|
/**
|
|
927
1031
|
* @@@
|
|
@@ -931,13 +1035,16 @@ var $llmToolsRegister = new $Register('llm_execution_tools_constructors');
|
|
|
931
1035
|
* @public exported from `@promptbook/core`
|
|
932
1036
|
*/
|
|
933
1037
|
var $llmToolsMetadataRegister = new $Register('llm_tools_metadata');
|
|
1038
|
+
/**
|
|
1039
|
+
* TODO: [®] DRY Register logic
|
|
1040
|
+
*/
|
|
934
1041
|
|
|
935
1042
|
/**
|
|
936
1043
|
* Creates a message with all registered LLM tools
|
|
937
1044
|
*
|
|
938
1045
|
* Note: This function is used to create a (error) message when there is no constructor for some LLM provider
|
|
939
1046
|
*
|
|
940
|
-
* @private internal function of `createLlmToolsFromConfiguration` and `
|
|
1047
|
+
* @private internal function of `createLlmToolsFromConfiguration` and `$provideLlmToolsFromEnv`
|
|
941
1048
|
*/
|
|
942
1049
|
function $registeredLlmToolsMessage() {
|
|
943
1050
|
var e_1, _a, e_2, _b;
|
|
@@ -1029,6 +1136,9 @@ function $registeredLlmToolsMessage() {
|
|
|
1029
1136
|
})
|
|
1030
1137
|
.join('\n')), "\n "); });
|
|
1031
1138
|
}
|
|
1139
|
+
/**
|
|
1140
|
+
* TODO: [®] DRY Register logic
|
|
1141
|
+
*/
|
|
1032
1142
|
|
|
1033
1143
|
/**
|
|
1034
1144
|
* @@@
|
|
@@ -1056,12 +1166,13 @@ function createLlmToolsFromConfiguration(configuration, options) {
|
|
|
1056
1166
|
return joinLlmExecutionTools.apply(void 0, __spreadArray([], __read(llmTools), false));
|
|
1057
1167
|
}
|
|
1058
1168
|
/**
|
|
1059
|
-
* TODO: [🎌]
|
|
1169
|
+
* TODO: [🎌] Together with `createLlmToolsFromConfiguration` + 'EXECUTION_TOOLS_CLASSES' gets to `@promptbook/core` ALL model providers, make this more efficient
|
|
1060
1170
|
* TODO: [🧠][🎌] Dynamically install required providers
|
|
1061
1171
|
* TODO: @@@ write discussion about this - wizzard
|
|
1062
1172
|
* TODO: [🧠][🍛] Which name is better `createLlmToolsFromConfig` or `createLlmToolsFromConfiguration`?
|
|
1063
1173
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
1064
1174
|
* TODO: This should be maybe not under `_common` but under `utils`
|
|
1175
|
+
* TODO: [®] DRY Register logic
|
|
1065
1176
|
*/
|
|
1066
1177
|
|
|
1067
1178
|
/**
|
|
@@ -1075,9 +1186,7 @@ function createLlmToolsFromConfiguration(configuration, options) {
|
|
|
1075
1186
|
*/
|
|
1076
1187
|
function startRemoteServer(options) {
|
|
1077
1188
|
var _this = this;
|
|
1078
|
-
var _a = __assign({ isAnonymousModeAllowed: false,
|
|
1079
|
-
// <- TODO: [🧠][🤺] Remove `createLlmExecutionTools`, pass just `llmExecutionTools`
|
|
1080
|
-
isAnonymousModeAllowed = _a.isAnonymousModeAllowed, isCollectionModeAllowed = _a.isCollectionModeAllowed, _b = _a.isVerbose, isVerbose = _b === void 0 ? IS_VERBOSE : _b;
|
|
1189
|
+
var _a = __assign({ isAnonymousModeAllowed: false, isApplicationModeAllowed: false, collection: null, createLlmExecutionTools: null }, options), port = _a.port, path = _a.path, collection = _a.collection, createLlmExecutionTools = _a.createLlmExecutionTools, isAnonymousModeAllowed = _a.isAnonymousModeAllowed, isApplicationModeAllowed = _a.isApplicationModeAllowed, _b = _a.isVerbose, isVerbose = _b === void 0 ? IS_VERBOSE : _b;
|
|
1081
1190
|
// <- TODO: [🦪] Some helper type to be able to use discriminant union types with destructuring
|
|
1082
1191
|
var httpServer = http.createServer({}, function (request, response) { return __awaiter(_this, void 0, void 0, function () {
|
|
1083
1192
|
var _a, _b;
|
|
@@ -1095,9 +1204,9 @@ function startRemoteServer(options) {
|
|
|
1095
1204
|
return __generator(this, function (_f) {
|
|
1096
1205
|
switch (_f.label) {
|
|
1097
1206
|
case 0:
|
|
1098
|
-
_b = (_a = "\n Server for processing promptbook remote requests is running.\n\n Version: ".concat(PROMPTBOOK_VERSION, "\n Socket.io path: ").concat(path, "/socket.io\n Anonymouse mode: ").concat(isAnonymousModeAllowed ? 'enabled' : 'disabled', "\n
|
|
1207
|
+
_b = (_a = "\n Server for processing promptbook remote requests is running.\n\n Version: ".concat(PROMPTBOOK_VERSION, "\n Socket.io path: ").concat(path, "/socket.io\n Anonymouse mode: ").concat(isAnonymousModeAllowed ? 'enabled' : 'disabled', "\n Application mode: ").concat(isApplicationModeAllowed ? 'enabled' : 'disabled', "\n ")).concat;
|
|
1099
1208
|
_c = block;
|
|
1100
|
-
if (!!
|
|
1209
|
+
if (!!isApplicationModeAllowed) return [3 /*break*/, 1];
|
|
1101
1210
|
_d = '';
|
|
1102
1211
|
return [3 /*break*/, 3];
|
|
1103
1212
|
case 1:
|
|
@@ -1120,9 +1229,7 @@ function startRemoteServer(options) {
|
|
|
1120
1229
|
}
|
|
1121
1230
|
});
|
|
1122
1231
|
}); });
|
|
1123
|
-
var server = new Server(
|
|
1124
|
-
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
1125
|
-
httpServer, {
|
|
1232
|
+
var server = new Server(httpServer, {
|
|
1126
1233
|
path: path,
|
|
1127
1234
|
transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
|
|
1128
1235
|
cors: {
|
|
@@ -1135,11 +1242,11 @@ function startRemoteServer(options) {
|
|
|
1135
1242
|
console.info(colors.gray("Client connected"), socket.id);
|
|
1136
1243
|
}
|
|
1137
1244
|
socket.on('prompt-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
|
|
1138
|
-
var _a, isAnonymous, prompt, userId, llmToolsConfiguration, llmExecutionTools, promptResult, _b, error_1;
|
|
1245
|
+
var _a, isAnonymous, prompt, appId, userId, customOptions, llmToolsConfiguration, llmExecutionTools, promptResult, _b, error_1;
|
|
1139
1246
|
return __generator(this, function (_c) {
|
|
1140
1247
|
switch (_c.label) {
|
|
1141
1248
|
case 0:
|
|
1142
|
-
_a = __assign({
|
|
1249
|
+
_a = __assign({ appId: null, customOptions: undefined, llmToolsConfiguration: null }, request), isAnonymous = _a.isAnonymous, prompt = _a.prompt, appId = _a.appId, userId = _a.userId, customOptions = _a.customOptions, llmToolsConfiguration = _a.llmToolsConfiguration;
|
|
1143
1250
|
// <- TODO: [🦪] Some helper type to be able to use discriminant union types with destructuring
|
|
1144
1251
|
if (isVerbose) {
|
|
1145
1252
|
console.info(colors.bgWhite("Prompt:"), colors.gray(JSON.stringify(request, null, 4)));
|
|
@@ -1148,10 +1255,10 @@ function startRemoteServer(options) {
|
|
|
1148
1255
|
case 1:
|
|
1149
1256
|
_c.trys.push([1, 14, 15, 16]);
|
|
1150
1257
|
if (isAnonymous === true && !isAnonymousModeAllowed) {
|
|
1151
|
-
throw new PipelineExecutionError("Anonymous mode is not allowed"); // <- TODO:[main] !!! Test
|
|
1258
|
+
throw new PipelineExecutionError("Anonymous mode is not allowed"); // <- TODO: [main] !!! Test
|
|
1152
1259
|
}
|
|
1153
|
-
if (isAnonymous === false && !
|
|
1154
|
-
throw new PipelineExecutionError("
|
|
1260
|
+
if (isAnonymous === false && !isApplicationModeAllowed) {
|
|
1261
|
+
throw new PipelineExecutionError("Application mode is not allowed"); // <- TODO: [main] !!! Test
|
|
1155
1262
|
}
|
|
1156
1263
|
llmExecutionTools = void 0;
|
|
1157
1264
|
if (!(isAnonymous === true && llmToolsConfiguration !== null)) return [3 /*break*/, 2];
|
|
@@ -1161,8 +1268,12 @@ function startRemoteServer(options) {
|
|
|
1161
1268
|
return [3 /*break*/, 5];
|
|
1162
1269
|
case 2:
|
|
1163
1270
|
if (!(isAnonymous === false && createLlmExecutionTools !== null)) return [3 /*break*/, 4];
|
|
1164
|
-
// Note:
|
|
1165
|
-
llmExecutionTools = createLlmExecutionTools(
|
|
1271
|
+
// Note: Application mode
|
|
1272
|
+
llmExecutionTools = createLlmExecutionTools({
|
|
1273
|
+
appId: appId,
|
|
1274
|
+
userId: userId,
|
|
1275
|
+
customOptions: customOptions,
|
|
1276
|
+
});
|
|
1166
1277
|
return [4 /*yield*/, collection.isResponsibleForPrompt(prompt)];
|
|
1167
1278
|
case 3:
|
|
1168
1279
|
if (!(_c.sent())) {
|
|
@@ -1211,14 +1322,14 @@ function startRemoteServer(options) {
|
|
|
1211
1322
|
if (isVerbose) {
|
|
1212
1323
|
console.info(colors.bgGreen("PromptResult:"), colors.green(JSON.stringify(promptResult, null, 4)));
|
|
1213
1324
|
}
|
|
1214
|
-
socket.emit('prompt-response', { promptResult: promptResult });
|
|
1325
|
+
socket.emit('prompt-response', { promptResult: promptResult } /* <- TODO: [🤛] */);
|
|
1215
1326
|
return [3 /*break*/, 16];
|
|
1216
1327
|
case 14:
|
|
1217
1328
|
error_1 = _c.sent();
|
|
1218
1329
|
if (!(error_1 instanceof Error)) {
|
|
1219
1330
|
throw error_1;
|
|
1220
1331
|
}
|
|
1221
|
-
socket.emit('error', serializeError(error_1));
|
|
1332
|
+
socket.emit('error', serializeError(error_1) /* <- TODO: [🤛] */);
|
|
1222
1333
|
return [3 /*break*/, 16];
|
|
1223
1334
|
case 15:
|
|
1224
1335
|
socket.disconnect();
|
|
@@ -1229,11 +1340,11 @@ function startRemoteServer(options) {
|
|
|
1229
1340
|
}); });
|
|
1230
1341
|
// TODO: [👒] Listing models (and checking configuration) probbably should go through REST API not Socket.io
|
|
1231
1342
|
socket.on('listModels-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
|
|
1232
|
-
var _a, isAnonymous, llmToolsConfiguration, llmExecutionTools, models, error_2;
|
|
1343
|
+
var _a, isAnonymous, appId, userId, customOptions, llmToolsConfiguration, llmExecutionTools, models, error_2;
|
|
1233
1344
|
return __generator(this, function (_b) {
|
|
1234
1345
|
switch (_b.label) {
|
|
1235
1346
|
case 0:
|
|
1236
|
-
_a = __assign({ llmToolsConfiguration: null }, request), isAnonymous = _a.isAnonymous, llmToolsConfiguration = _a.llmToolsConfiguration;
|
|
1347
|
+
_a = __assign({ appId: null, customOptions: undefined, llmToolsConfiguration: null }, request), isAnonymous = _a.isAnonymous, appId = _a.appId, userId = _a.userId, customOptions = _a.customOptions, llmToolsConfiguration = _a.llmToolsConfiguration;
|
|
1237
1348
|
// <- TODO: [🦪] Some helper type to be able to use discriminant union types with destructuring
|
|
1238
1349
|
if (isVerbose) {
|
|
1239
1350
|
console.info(colors.bgWhite("Listing models"));
|
|
@@ -1242,10 +1353,10 @@ function startRemoteServer(options) {
|
|
|
1242
1353
|
case 1:
|
|
1243
1354
|
_b.trys.push([1, 3, 4, 5]);
|
|
1244
1355
|
if (isAnonymous === true && !isAnonymousModeAllowed) {
|
|
1245
|
-
throw new PipelineExecutionError("Anonymous mode is not allowed"); // <- TODO:[main] !!! Test
|
|
1356
|
+
throw new PipelineExecutionError("Anonymous mode is not allowed"); // <- TODO: [main] !!! Test
|
|
1246
1357
|
}
|
|
1247
|
-
if (isAnonymous === false && !
|
|
1248
|
-
throw new PipelineExecutionError("
|
|
1358
|
+
if (isAnonymous === false && !isApplicationModeAllowed) {
|
|
1359
|
+
throw new PipelineExecutionError("Application mode is not allowed"); // <- TODO: [main] !!! Test
|
|
1249
1360
|
}
|
|
1250
1361
|
llmExecutionTools = void 0;
|
|
1251
1362
|
if (isAnonymous === true) {
|
|
@@ -1254,14 +1365,17 @@ function startRemoteServer(options) {
|
|
|
1254
1365
|
llmExecutionTools = createLlmToolsFromConfiguration(llmToolsConfiguration, { isVerbose: isVerbose });
|
|
1255
1366
|
}
|
|
1256
1367
|
else {
|
|
1257
|
-
// Note:
|
|
1258
|
-
llmExecutionTools = createLlmExecutionTools(
|
|
1259
|
-
|
|
1368
|
+
// Note: Application mode
|
|
1369
|
+
llmExecutionTools = createLlmExecutionTools({
|
|
1370
|
+
appId: appId,
|
|
1371
|
+
userId: userId,
|
|
1372
|
+
customOptions: customOptions,
|
|
1373
|
+
});
|
|
1260
1374
|
}
|
|
1261
1375
|
return [4 /*yield*/, llmExecutionTools.listModels()];
|
|
1262
1376
|
case 2:
|
|
1263
1377
|
models = _b.sent();
|
|
1264
|
-
socket.emit('listModels-response', { models: models });
|
|
1378
|
+
socket.emit('listModels-response', { models: models } /* <- TODO: [🤛] */);
|
|
1265
1379
|
return [3 /*break*/, 5];
|
|
1266
1380
|
case 3:
|
|
1267
1381
|
error_2 = _b.sent();
|