@promptbook/remote-server 0.70.0-1 → 0.71.0-12
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 +33 -59
- package/esm/index.es.js +134 -25
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +0 -3
- package/esm/typings/src/_packages/browser.index.d.ts +3 -1
- package/esm/typings/src/_packages/cli.index.d.ts +20 -0
- package/esm/typings/src/_packages/core.index.d.ts +45 -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 +14 -6
- package/esm/typings/src/_packages/pdf.index.d.ts +8 -0
- package/esm/typings/src/_packages/types.index.d.ts +53 -25
- 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 +2 -2
- 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 -7
- package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +27 -0
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -3
- 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 +4 -4
- package/esm/typings/src/config.d.ts +32 -3
- 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 +5 -5
- 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 +20 -8
- 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 +3 -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/{getLlmToolsForCli.d.ts → register/$provideLlmToolsForCli.d.ts} +4 -3
- package/esm/typings/src/llm-providers/_common/{getLlmToolsForTestingAndScriptsAndPlayground.d.ts → register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts} +4 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +27 -0
- 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/_common/utils/cache/CacheItem.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +3 -3
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +2 -2
- 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 +8 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +2 -2
- 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/playground/playground.d.ts +3 -0
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -2
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +2 -2
- 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/OpenAiExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +2 -1
- package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +4 -3
- package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +4 -3
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Request.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Request.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +3 -3
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +2 -2
- package/esm/typings/src/llm-providers/remote/playground/playground.d.ts +3 -0
- package/esm/typings/src/personas/preparePersona.d.ts +4 -3
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +68 -0
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +1 -1
- package/esm/typings/src/prepare/preparePipeline.d.ts +3 -2
- package/esm/typings/src/prepare/prepareTemplates.d.ts +4 -3
- 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/$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 +33 -0
- package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.test.d.ts +4 -0
- package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +13 -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 +2 -2
- package/esm/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +2 -2
- package/esm/typings/src/storage/{files-storage/FilesStorage.d.ts → file-cache-storage/FileCacheStorage.d.ts} +4 -4
- 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 +3 -3
- package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +5 -0
- package/esm/typings/src/types/execution-report/executionReportJsonToString.d.ts +2 -1
- package/esm/typings/src/types/typeAliases.d.ts +16 -12
- 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/$isDirectoryExisting.d.ts +3 -3
- package/esm/typings/src/utils/files/$isFileExisting.d.ts +3 -3
- package/esm/typings/src/utils/files/$listAllFiles.d.ts +5 -4
- 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/getFileExtension.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/serialization/checkSerializableAsJson.d.ts +1 -1
- package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +1 -1
- 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 +134 -25
- 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/createLlmToolsFromEnv.d.ts +0 -25
- 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/{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/{personas/preparePersona.test.d.ts → utils/execCommand/execCommand.test.d.ts} +0 -0
- /package/esm/typings/src/utils/{extractParameterNames.test.d.ts → execCommand/execCommandNormalizeOptions.test.d.ts} +0 -0
- /package/esm/typings/src/utils/{replaceParameters.test.d.ts → files/extensionToMimeType.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,24 +38,27 @@ 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
|
|
|
35
45
|
|
|
46
|
+
|
|
36
47
|
---
|
|
37
48
|
|
|
38
49
|
Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
39
50
|
|
|
40
51
|
## 🤍 The Promptbook Whitepaper
|
|
41
52
|
|
|
53
|
+
|
|
54
|
+
|
|
42
55
|
If you have a simple, single prompt for ChatGPT, GPT-4, Anthropic Claude, Google Gemini, Llama 2, or whatever, it doesn't matter how you integrate it. Whether it's calling a REST API directly, using the SDK, hardcoding the prompt into the source code, or importing a text file, the process remains the same.
|
|
43
56
|
|
|
44
57
|
But often you will struggle with the limitations of LLMs, such as hallucinations, off-topic responses, poor quality output, language drift, word repetition repetition repetition repetition or misuse, lack of context, or just plain w𝒆𝐢rd responses. When this happens, you generally have three options:
|
|
45
58
|
|
|
46
59
|
1. **Fine-tune** the model to your specifications or even train your own.
|
|
47
60
|
2. **Prompt-engineer** the prompt to the best shape you can achieve.
|
|
48
|
-
3.
|
|
61
|
+
3. Orchestrate **multiple prompts** in a [pipeline](https://github.com/webgptorg/promptbook/discussions/64) to get the best result.
|
|
49
62
|
|
|
50
63
|
In all of these situations, but especially in 3., the Promptbook library can make your life easier.
|
|
51
64
|
|
|
@@ -57,7 +70,9 @@ In all of these situations, but especially in 3., the Promptbook library can mak
|
|
|
57
70
|
- Promptbook has built in versioning. You can test multiple **A/B versions** of pipelines and see which one works best.
|
|
58
71
|
- Promptbook is designed to do [**RAG** (Retrieval-Augmented Generation)](https://github.com/webgptorg/promptbook/discussions/41) and other advanced techniques. You can use **knowledge** to improve the quality of the output.
|
|
59
72
|
|
|
60
|
-
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
## 🧔 Pipeline _(for prompt-engeneers)_
|
|
61
76
|
|
|
62
77
|
**P**romp**t** **b**oo**k** markdown file (or `.ptbk.md` file) is document that describes a **pipeline** - a series of prompts that are chained together to form somewhat reciepe for transforming natural language input.
|
|
63
78
|
|
|
@@ -79,7 +94,6 @@ File `write-website-content.ptbk.md`:
|
|
|
79
94
|
> Instructions for creating web page content.
|
|
80
95
|
>
|
|
81
96
|
> - PIPELINE URL https://promptbook.studio/webgpt/write-website-content.ptbk.md
|
|
82
|
-
> - PROMPTBOOK VERSION 0.0.1
|
|
83
97
|
> - INPUT PARAM `{rawTitle}` Automatically suggested a site name or empty text
|
|
84
98
|
> - INPUT PARAM `{rawAssigment}` Automatically generated site entry from image recognition
|
|
85
99
|
> - OUTPUT PARAM `{websiteContent}` Web content
|
|
@@ -318,6 +332,10 @@ Or you can install them separately:
|
|
|
318
332
|
- **[@promptbook/fake-llm](https://www.npmjs.com/package/@promptbook/fake-llm)** - Mocked execution tools for testing the library and saving the tokens
|
|
319
333
|
- **[@promptbook/remote-client](https://www.npmjs.com/package/@promptbook/remote-client)** - Remote client for remote execution of promptbooks
|
|
320
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
|
|
321
339
|
- **[@promptbook/types](https://www.npmjs.com/package/@promptbook/types)** - Just typescript types used in the library
|
|
322
340
|
- **[@promptbook/cli](https://www.npmjs.com/package/@promptbook/cli)** - Command line interface utilities for promptbooks
|
|
323
341
|
|
|
@@ -374,6 +392,8 @@ The following glossary is used to clarify certain concepts:
|
|
|
374
392
|
- When you want to **version** your prompts and **test multiple versions**
|
|
375
393
|
- When you want to **log** the execution of prompts and backtrace the issues
|
|
376
394
|
|
|
395
|
+
[See more](https://github.com/webgptorg/promptbook/discussions/111)
|
|
396
|
+
|
|
377
397
|
### ➖ When not to use
|
|
378
398
|
|
|
379
399
|
- When you have already implemented single simple prompt and it works fine for your job
|
|
@@ -383,6 +403,8 @@ The following glossary is used to clarify certain concepts:
|
|
|
383
403
|
- When your main focus is on something other than text - like images, audio, video, spreadsheets _(other media types may be added in the future, [see discussion](https://github.com/webgptorg/promptbook/discussions/103))_
|
|
384
404
|
- When you need to use recursion _([see the discussion](https://github.com/webgptorg/promptbook/discussions/38))_
|
|
385
405
|
|
|
406
|
+
[See more](https://github.com/webgptorg/promptbook/discussions/112)
|
|
407
|
+
|
|
386
408
|
## 🐜 Known issues
|
|
387
409
|
|
|
388
410
|
- [🤸♂️ Iterations not working yet](https://github.com/webgptorg/promptbook/discussions/55)
|
|
@@ -395,63 +417,15 @@ The following glossary is used to clarify certain concepts:
|
|
|
395
417
|
|
|
396
418
|
## ❔ FAQ
|
|
397
419
|
|
|
398
|
-
|
|
399
|
-
|
|
400
420
|
If you have a question [start a discussion](https://github.com/webgptorg/promptbook/discussions/), [open an issue](https://github.com/webgptorg/promptbook/issues) or [write me an email](https://www.pavolhejny.com/contact).
|
|
401
421
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
We are considering creating a bridge/converter between these two libraries.
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
### Promptbooks vs. OpenAI`s GPTs
|
|
415
|
-
|
|
416
|
-
GPTs are chat assistants that can be assigned to specific tasks and materials. But they are still chat assistants. Promptbooks are a way to orchestrate many more predefined tasks to have much tighter control over the process. Promptbooks are not a good technology for creating human-like chatbots, GPTs are not a good technology for creating outputs with specific requirements.
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
### Where should I store my promptbooks?
|
|
433
|
-
|
|
434
|
-
If you use raw SDKs, you just put prompts in the sourcecode, mixed in with typescript, javascript, python or whatever programming language you use.
|
|
435
|
-
|
|
436
|
-
If you use promptbooks, you can store them in several places, each with its own advantages and disadvantages:
|
|
437
|
-
|
|
438
|
-
1. As **source code**, typically git-committed. In this case you can use the versioning system and the promptbooks will be tightly coupled with the version of the application. You still get the power of promptbooks, as you separate the concerns of the prompt-engineer and the programmer.
|
|
439
|
-
|
|
440
|
-
2. As data in a **database** In this case, promptbooks are like posts / articles on the blog. They can be modified independently of the application. You don't need to redeploy the application to change the promptbooks. You can have multiple versions of promptbooks for each user. You can have a web interface for non-programmers to create and modify promptbooks. But you lose the versioning system and you still have to consider the interface between the promptbooks and the application _(= input and output parameters)_.
|
|
441
|
-
|
|
442
|
-
3. In a **configuration** in environment variables. This is a good way to store promptbooks if you have an application with multiple deployments and you want to have different but simple promptbooks for each deployment and you don't need to change them often.
|
|
443
|
-
|
|
444
|
-
### What should I do when I need same promptbook in multiple human languages?
|
|
445
|
-
|
|
446
|
-
A single promptbook can be written for several _(human)_ languages at once. However, we recommend that you have separate promptbooks for each language.
|
|
447
|
-
|
|
448
|
-
In large language models, you will get better results if you have prompts in the same language as the user input.
|
|
449
|
-
|
|
450
|
-
The best way to manage this is to have suffixed promptbooks like `write-website-content.en.ptbk.md` and `write-website-content.cs.ptbk.md` for each supported language.
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
422
|
+
- [❔ Why not just use the OpenAI SDK / Anthropic Claude SDK / ...?](https://github.com/webgptorg/promptbook/discussions/114)
|
|
423
|
+
- [❔ How is it different from the OpenAI`s GPTs?](https://github.com/webgptorg/promptbook/discussions/118)
|
|
424
|
+
- [❔ How is it different from the Langchain?](https://github.com/webgptorg/promptbook/discussions/115)
|
|
425
|
+
- [❔ How is it different from the DSPy?](https://github.com/webgptorg/promptbook/discussions/117)
|
|
426
|
+
- [❔ How is it different from _anything_?](https://github.com/webgptorg/promptbook/discussions?discussions_q=is%3Aopen+label%3A%22Promptbook+vs%22)
|
|
427
|
+
- [❔ Is Promptbook using RAG _(Retrieval-Augmented Generation)_?](https://github.com/webgptorg/promptbook/discussions/123)
|
|
428
|
+
- [❔ Is Promptbook using function calling?](https://github.com/webgptorg/promptbook/discussions/124)
|
|
455
429
|
|
|
456
430
|
## ⌚ Changelog
|
|
457
431
|
|
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: !!!! List here all the versions and annotate + put into script
|
|
10
|
+
var PROMPTBOOK_VERSION = '0.71.0-11';
|
|
11
|
+
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
12
12
|
|
|
13
13
|
/*! *****************************************************************************
|
|
14
14
|
Copyright (c) Microsoft Corporation.
|
|
@@ -318,7 +318,7 @@ function checkSerializableAsJson(name, value) {
|
|
|
318
318
|
}
|
|
319
319
|
/**
|
|
320
320
|
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
321
|
-
* TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
|
|
321
|
+
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
322
322
|
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
323
323
|
*/
|
|
324
324
|
|
|
@@ -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
|
/**
|
|
@@ -1120,9 +1231,7 @@ function startRemoteServer(options) {
|
|
|
1120
1231
|
}
|
|
1121
1232
|
});
|
|
1122
1233
|
}); });
|
|
1123
|
-
var server = new Server(
|
|
1124
|
-
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
1125
|
-
httpServer, {
|
|
1234
|
+
var server = new Server(httpServer, {
|
|
1126
1235
|
path: path,
|
|
1127
1236
|
transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
|
|
1128
1237
|
cors: {
|
|
@@ -1148,10 +1257,10 @@ function startRemoteServer(options) {
|
|
|
1148
1257
|
case 1:
|
|
1149
1258
|
_c.trys.push([1, 14, 15, 16]);
|
|
1150
1259
|
if (isAnonymous === true && !isAnonymousModeAllowed) {
|
|
1151
|
-
throw new PipelineExecutionError("Anonymous mode is not allowed"); // <- TODO: !!! Test
|
|
1260
|
+
throw new PipelineExecutionError("Anonymous mode is not allowed"); // <- TODO: [main] !!! Test
|
|
1152
1261
|
}
|
|
1153
1262
|
if (isAnonymous === false && !isCollectionModeAllowed) {
|
|
1154
|
-
throw new PipelineExecutionError("Collection mode is not allowed"); // <- TODO: !!! Test
|
|
1263
|
+
throw new PipelineExecutionError("Collection mode is not allowed"); // <- TODO: [main] !!! Test
|
|
1155
1264
|
}
|
|
1156
1265
|
llmExecutionTools = void 0;
|
|
1157
1266
|
if (!(isAnonymous === true && llmToolsConfiguration !== null)) return [3 /*break*/, 2];
|
|
@@ -1211,14 +1320,14 @@ function startRemoteServer(options) {
|
|
|
1211
1320
|
if (isVerbose) {
|
|
1212
1321
|
console.info(colors.bgGreen("PromptResult:"), colors.green(JSON.stringify(promptResult, null, 4)));
|
|
1213
1322
|
}
|
|
1214
|
-
socket.emit('prompt-response', { promptResult: promptResult });
|
|
1323
|
+
socket.emit('prompt-response', { promptResult: promptResult } /* <- TODO: [🤛] */);
|
|
1215
1324
|
return [3 /*break*/, 16];
|
|
1216
1325
|
case 14:
|
|
1217
1326
|
error_1 = _c.sent();
|
|
1218
1327
|
if (!(error_1 instanceof Error)) {
|
|
1219
1328
|
throw error_1;
|
|
1220
1329
|
}
|
|
1221
|
-
socket.emit('error', serializeError(error_1));
|
|
1330
|
+
socket.emit('error', serializeError(error_1) /* <- TODO: [🤛] */);
|
|
1222
1331
|
return [3 /*break*/, 16];
|
|
1223
1332
|
case 15:
|
|
1224
1333
|
socket.disconnect();
|
|
@@ -1242,10 +1351,10 @@ function startRemoteServer(options) {
|
|
|
1242
1351
|
case 1:
|
|
1243
1352
|
_b.trys.push([1, 3, 4, 5]);
|
|
1244
1353
|
if (isAnonymous === true && !isAnonymousModeAllowed) {
|
|
1245
|
-
throw new PipelineExecutionError("Anonymous mode is not allowed"); // <- TODO: !!! Test
|
|
1354
|
+
throw new PipelineExecutionError("Anonymous mode is not allowed"); // <- TODO: [main] !!! Test
|
|
1246
1355
|
}
|
|
1247
1356
|
if (isAnonymous === false && !isCollectionModeAllowed) {
|
|
1248
|
-
throw new PipelineExecutionError("Collection mode is not allowed"); // <- TODO: !!! Test
|
|
1357
|
+
throw new PipelineExecutionError("Collection mode is not allowed"); // <- TODO: [main] !!! Test
|
|
1249
1358
|
}
|
|
1250
1359
|
llmExecutionTools = void 0;
|
|
1251
1360
|
if (isAnonymous === true) {
|
|
@@ -1261,7 +1370,7 @@ function startRemoteServer(options) {
|
|
|
1261
1370
|
return [4 /*yield*/, llmExecutionTools.listModels()];
|
|
1262
1371
|
case 2:
|
|
1263
1372
|
models = _b.sent();
|
|
1264
|
-
socket.emit('listModels-response', { models: models });
|
|
1373
|
+
socket.emit('listModels-response', { models: models } /* <- TODO: [🤛] */);
|
|
1265
1374
|
return [3 /*break*/, 5];
|
|
1266
1375
|
case 3:
|
|
1267
1376
|
error_2 = _b.sent();
|