@promptbook/remote-server 0.72.0-9 → 0.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -252
- package/esm/index.es.js +76 -69
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +24 -18
- package/esm/typings/src/_packages/node.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +18 -12
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +2 -2
- package/esm/typings/src/collection/collectionToJson.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -1
- package/esm/typings/src/commands/TEMPLATE/TemplateTypes.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +5 -5
- package/esm/typings/src/config.d.ts +22 -15
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -3
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -2
- package/esm/typings/src/executables/$provideExecutablesForNode.d.ts +12 -0
- package/esm/typings/src/executables/apps/locateLibreoffice.d.ts +11 -0
- package/esm/typings/src/executables/apps/locatePandoc.d.ts +11 -0
- package/esm/typings/src/executables/locateApp.d.ts +33 -0
- package/esm/typings/src/executables/locateApp.test.d.ts +1 -0
- package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +12 -0
- package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +12 -0
- package/esm/typings/src/executables/platforms/locateAppOnWindows.d.ts +12 -0
- package/esm/typings/src/execution/EmbeddingVector.d.ts +1 -1
- package/esm/typings/src/execution/Executables.d.ts +18 -0
- package/esm/typings/src/execution/ExecutionTools.d.ts +9 -3
- package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +2 -2
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -2
- package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +3 -2
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +29 -6
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +2 -11
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTemplate.d.ts +4 -13
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +9 -14
- package/esm/typings/src/execution/createPipelineExecutor/{getSamplesForTemplate.d.ts → getExamplesForTemplate.d.ts} +1 -1
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +11 -3
- package/esm/typings/src/execution/utils/addUsage.d.ts +1 -1
- package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -1
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +4 -4
- package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForCli.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +7 -0
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +4 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +2 -1
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +4 -5
- package/esm/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +0 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +4 -4
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Request.d.ts +15 -6
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Response.d.ts +4 -4
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Request.d.ts +6 -12
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Response.d.ts +3 -3
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +9 -14
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +23 -8
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
- package/esm/typings/src/personas/preparePersona.d.ts +1 -1
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +4 -23
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +2 -2
- package/esm/typings/src/prepare/prepareTemplates.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +2 -9
- package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +1 -1
- package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +2 -2
- package/esm/typings/src/scrapers/document/DocumentScraper.test.d.ts +1 -1
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +3 -3
- package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.test.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/MarkdownScraper.test.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +2 -2
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +6 -3
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/website/utils/createShowdownConverter.d.ts +7 -0
- package/esm/typings/src/scrapers/website/utils/createShowdownConverter.test.d.ts +1 -0
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
- package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +1 -1
- package/esm/typings/src/types/Arrayable.d.ts +1 -1
- package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +7 -0
- package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +4 -4
- package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +2 -2
- package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +2 -2
- package/esm/typings/src/types/Prompt.d.ts +2 -1
- package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +11 -8
- package/esm/typings/src/utils/$Register.d.ts +1 -1
- package/esm/typings/src/utils/FromtoItems.d.ts +1 -1
- package/esm/typings/src/utils/arrayableToArray.d.ts +1 -1
- package/esm/typings/src/utils/emojis.d.ts +1 -1
- package/esm/typings/src/utils/execCommand/$execCommand.d.ts +4 -2
- package/esm/typings/src/utils/execCommand/$execCommandNormalizeOptions.d.ts +12 -0
- package/esm/typings/src/utils/execCommand/$execCommands.d.ts +1 -0
- package/esm/typings/src/utils/execCommand/ExecCommandOptions.d.ts +45 -0
- package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
- package/esm/typings/src/utils/files/isExecutable.d.ts +11 -0
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +1 -1
- package/esm/typings/src/utils/normalization/IKeywords.d.ts +2 -2
- package/esm/typings/src/utils/normalization/parseKeywords.d.ts +2 -2
- package/esm/typings/src/utils/normalization/parseKeywordsFromString.d.ts +2 -2
- package/esm/typings/src/utils/normalization/searchKeywords.d.ts +2 -2
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +1 -1
- package/esm/typings/src/utils/organization/keepUnused.d.ts +1 -1
- package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
- package/esm/typings/src/utils/sets/intersection.d.ts +1 -1
- package/esm/typings/src/utils/sets/union.d.ts +1 -1
- package/esm/typings/src/utils/unwrapResult.d.ts +4 -4
- package/package.json +6 -4
- package/umd/index.umd.js +76 -69
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +0 -29
- package/esm/typings/src/scrapers/website/utils/markdownConverter.d.ts +0 -12
- package/esm/typings/src/utils/execCommand/IExecCommandOptions.d.ts +0 -23
- package/esm/typings/src/utils/execCommand/execCommandNormalizeOptions.d.ts +0 -10
- /package/esm/typings/src/{scrapers/website/WebsiteScraper.test.d.ts → executables/apps/locateLibreoffice.test.d.ts} +0 -0
- /package/esm/typings/src/{scrapers/website/utils/markdownConverter.test.d.ts → executables/apps/locatePandoc.test.d.ts} +0 -0
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ExecCommandOptions } from './ExecCommandOptions';
|
|
2
2
|
/**
|
|
3
3
|
* Run one command in a shell
|
|
4
4
|
*
|
|
5
|
+
*
|
|
5
6
|
* Note: There are 2 similar functions in the codebase:
|
|
6
7
|
* - `$execCommand` which runs a single command
|
|
7
8
|
* - `$execCommands` which runs multiple commands
|
|
9
|
+
* Note: `$` is used to indicate that this function is not a pure function - it runs a command in a shell
|
|
8
10
|
*
|
|
9
11
|
* @public exported from `@promptbook/node`
|
|
10
12
|
*/
|
|
11
|
-
export declare function $execCommand(options:
|
|
13
|
+
export declare function $execCommand(options: ExecCommandOptions): Promise<string>;
|
|
12
14
|
/**
|
|
13
15
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
14
16
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ExecCommandOptions } from './ExecCommandOptions';
|
|
2
|
+
import type { ExecCommandOptionsAdvanced } from './ExecCommandOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Normalize options for `execCommand` and `execCommands`
|
|
5
|
+
*
|
|
6
|
+
* Note: `$` is used to indicate that this function behaves differently according to `process.platform`
|
|
7
|
+
*
|
|
8
|
+
* @private internal utility of `execCommand` and `execCommands`
|
|
9
|
+
*/
|
|
10
|
+
export declare function $execCommandNormalizeOptions(options: ExecCommandOptions): Pick<ExecCommandOptionsAdvanced, 'command' | 'args' | 'cwd' | 'crashOnError' | 'timeout' | 'isVerbose'> & {
|
|
11
|
+
humanReadableCommand: string;
|
|
12
|
+
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Note: There are 2 similar functions in the codebase:
|
|
5
5
|
* - `$execCommand` which runs a single command
|
|
6
6
|
* - `$execCommands` which runs multiple commands
|
|
7
|
+
* Note: `$` is used to indicate that this function is not a pure function - it runs a commands in a shell
|
|
7
8
|
*
|
|
8
9
|
* @public exported from `@promptbook/node`
|
|
9
10
|
*/
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use sth from type-fest or move this to type helpers
|
|
3
|
+
*/
|
|
4
|
+
type RequiredAndOptional<TBase, TRequired extends keyof TBase, TOptional extends keyof TBase> = Pick<TBase, TRequired> & Partial<Pick<TBase, TOptional>>;
|
|
5
|
+
/**
|
|
6
|
+
* Simple options for `execCommand`
|
|
7
|
+
*/
|
|
8
|
+
export type ExecCommandOptions = string | RequiredAndOptional<ExecCommandOptionsAdvanced, 'command', 'args' | 'cwd' | 'crashOnError' | 'timeout' | 'isVerbose'>;
|
|
9
|
+
/**
|
|
10
|
+
* Advanced options for `execCommand`
|
|
11
|
+
*/
|
|
12
|
+
export type ExecCommandOptionsAdvanced = {
|
|
13
|
+
/**
|
|
14
|
+
* Command to run
|
|
15
|
+
*/
|
|
16
|
+
readonly command: string;
|
|
17
|
+
/**
|
|
18
|
+
* Arguments for the command
|
|
19
|
+
*/
|
|
20
|
+
readonly args: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Current working directory
|
|
23
|
+
*
|
|
24
|
+
* @default process.cwd()
|
|
25
|
+
*/
|
|
26
|
+
readonly cwd: string;
|
|
27
|
+
/**
|
|
28
|
+
* If `true` then the command will throw an error if the return code is not `0`
|
|
29
|
+
*/
|
|
30
|
+
readonly crashOnError: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Timeout in milliseconds
|
|
33
|
+
*/
|
|
34
|
+
readonly timeout: number;
|
|
35
|
+
/**
|
|
36
|
+
* If `true` then the command and entire CLI output will be logged to the console
|
|
37
|
+
*
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
readonly isVerbose?: boolean;
|
|
41
|
+
};
|
|
42
|
+
export {};
|
|
43
|
+
/**
|
|
44
|
+
* TODO: [⏳] Make DEFAULT_TIMEOUT_MS as global constant
|
|
45
|
+
*/
|
|
@@ -4,7 +4,7 @@ import type { ExpectationAmount } from '../../types/PipelineJson/Expectations';
|
|
|
4
4
|
*
|
|
5
5
|
* @public exported from `@promptbook/utils`
|
|
6
6
|
*/
|
|
7
|
-
export declare function splitIntoSentences(text: string):
|
|
7
|
+
export declare function splitIntoSentences(text: string): ReadonlyArray<string>;
|
|
8
8
|
/**
|
|
9
9
|
* Counts number of sentences in the text
|
|
10
10
|
*
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FilesystemTools } from '../../execution/FilesystemTools';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the file is executable
|
|
4
|
+
*
|
|
5
|
+
* @private within the repository
|
|
6
|
+
*/
|
|
7
|
+
export declare function isExecutable(path: string, fs: FilesystemTools): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Note: Not [~🟢~] because it is not directly dependent on `fs
|
|
10
|
+
* TODO: [🖇] What about symlinks?
|
|
11
|
+
*/
|
|
@@ -30,7 +30,7 @@ export type CodeBlock = {
|
|
|
30
30
|
* @throws {ParseError} if block is not closed properly
|
|
31
31
|
* @public exported from `@promptbook/markdown-utils`
|
|
32
32
|
*/
|
|
33
|
-
export declare function extractAllBlocksFromMarkdown(markdown: string_markdown):
|
|
33
|
+
export declare function extractAllBlocksFromMarkdown(markdown: string_markdown): ReadonlyArray<CodeBlock>;
|
|
34
34
|
/**
|
|
35
35
|
* TODO: Maybe name for `blockNotation` instead of '```' and '>'
|
|
36
36
|
*/
|
|
@@ -5,7 +5,7 @@ import type { string_markdown_section } from '../../types/typeAliases';
|
|
|
5
5
|
*
|
|
6
6
|
* @public exported from `@promptbook/markdown-utils`
|
|
7
7
|
*/
|
|
8
|
-
export declare function splitMarkdownIntoSections(markdown: string_markdown):
|
|
8
|
+
export declare function splitMarkdownIntoSections(markdown: string_markdown): ReadonlyArray<string_markdown_section>;
|
|
9
9
|
/**
|
|
10
10
|
* TODO: [🏛] This can be part of markdown builder
|
|
11
11
|
* Note: [🕞] In past (commit 42086e1603cbed506482997c00a8ee979af0a247) there was much more
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Semantic helper
|
|
3
3
|
*
|
|
4
4
|
* Keyword is string without diacritics in lowercase [a-z1-9]
|
|
5
|
-
* Words are splitted between multiple keywords @see
|
|
5
|
+
* Words are splitted between multiple keywords @see Keywords
|
|
6
6
|
*
|
|
7
7
|
* For example `"keyword"`
|
|
8
8
|
*
|
|
@@ -15,7 +15,7 @@ export type string_keyword = string;
|
|
|
15
15
|
*
|
|
16
16
|
* @public exported from `@promptbook/utils`
|
|
17
17
|
*/
|
|
18
|
-
export type
|
|
18
|
+
export type Keywords = Set<string_keyword>;
|
|
19
19
|
/**
|
|
20
20
|
* TODO: [🌮] Keywords with weight
|
|
21
21
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { really_unknown } from '../organization/really_unknown';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Keywords } from './IKeywords';
|
|
3
3
|
/**
|
|
4
4
|
* Parses keywords from any object and recursively walks through
|
|
5
5
|
*
|
|
@@ -9,7 +9,7 @@ import type { IKeywords } from './IKeywords';
|
|
|
9
9
|
* @returns {Set} of keywords without diacritics in lowercase
|
|
10
10
|
* @public exported from `@promptbook/utils`
|
|
11
11
|
*/
|
|
12
|
-
export declare function parseKeywords(input: really_unknown):
|
|
12
|
+
export declare function parseKeywords(input: really_unknown): Keywords;
|
|
13
13
|
/**
|
|
14
14
|
* Note: Not using spread in input param because of keeping second parameter for options
|
|
15
15
|
* TODO: [🌺] Use some intermediate util splitWords
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Keywords } from './IKeywords';
|
|
2
2
|
/**
|
|
3
3
|
* Parses keywords from a string
|
|
4
4
|
*
|
|
@@ -6,4 +6,4 @@ import type { IKeywords } from './IKeywords';
|
|
|
6
6
|
* @returns {Set} of keywords without diacritics in lowercase
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
8
8
|
*/
|
|
9
|
-
export declare function parseKeywordsFromString(input: string):
|
|
9
|
+
export declare function parseKeywordsFromString(input: string): Keywords;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Keywords } from './IKeywords';
|
|
2
2
|
/**
|
|
3
3
|
* @@@
|
|
4
4
|
*
|
|
@@ -7,4 +7,4 @@ import type { IKeywords } from './IKeywords';
|
|
|
7
7
|
* @returns
|
|
8
8
|
* @public exported from `@promptbook/utils`
|
|
9
9
|
*/
|
|
10
|
-
export declare function searchKeywords(haystack:
|
|
10
|
+
export declare function searchKeywords(haystack: Keywords, needle: Keywords): boolean;
|
|
@@ -13,4 +13,4 @@ import type { really_any } from './really_any';
|
|
|
13
13
|
* @returns void
|
|
14
14
|
* @private within the repository
|
|
15
15
|
*/
|
|
16
|
-
export declare function keepUnused<TTypeToKeep1 = really_any, TTypeToKeep2 = really_any, TTypeToKeep3 = really_any>(...valuesToKeep:
|
|
16
|
+
export declare function keepUnused<TTypeToKeep1 = really_any, TTypeToKeep2 = really_any, TTypeToKeep3 = really_any>(...valuesToKeep: ReadonlyArray<really_any>): void;
|
|
@@ -3,7 +3,7 @@ import type { number_seed } from '../../types/typeAliases';
|
|
|
3
3
|
* Generates random seed
|
|
4
4
|
*
|
|
5
5
|
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
6
|
-
* Warning: This function is
|
|
6
|
+
* Warning: This function is NOT cryptographically secure (it uses Math.random internally)
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
8
8
|
*/
|
|
9
9
|
export declare function $randomSeed(): number_seed;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
5
5
|
* @public exported from `@promptbook/utils`
|
|
6
6
|
*/
|
|
7
|
-
export declare function intersection<TItem>(...sets:
|
|
7
|
+
export declare function intersection<TItem>(...sets: ReadonlyArray<Set<TItem>>): Set<TItem>;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
5
5
|
* @public exported from `@promptbook/utils`
|
|
6
6
|
*/
|
|
7
|
-
export declare function union<TItem>(...sets:
|
|
7
|
+
export declare function union<TItem>(...sets: ReadonlyArray<Set<TItem>>): Set<TItem>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Additional options for `unwrapResult`
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
type UnwrapResultOptions = {
|
|
5
5
|
/**
|
|
6
6
|
* If true, the text is trimmed before processing
|
|
7
7
|
*/
|
|
8
|
-
isTrimmed?: boolean;
|
|
8
|
+
readonly isTrimmed?: boolean;
|
|
9
9
|
/**
|
|
10
10
|
* If true, the introduce sentence is removed
|
|
11
11
|
*
|
|
@@ -15,8 +15,8 @@ interface UnwrapResultOptions {
|
|
|
15
15
|
*
|
|
16
16
|
* @default true
|
|
17
17
|
*/
|
|
18
|
-
isIntroduceSentenceRemoved?: boolean;
|
|
19
|
-
}
|
|
18
|
+
readonly isIntroduceSentenceRemoved?: boolean;
|
|
19
|
+
};
|
|
20
20
|
/**
|
|
21
21
|
* Removes quotes and optional introduce text from a string
|
|
22
22
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.73.0",
|
|
4
4
|
"description": "Supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"contributors": [
|
|
12
12
|
"Pavol Hejný <me@pavolhejny.com> (https://www.pavolhejny.com/)"
|
|
13
13
|
],
|
|
14
|
+
"todo-0": "TODO: [❇️] Make better list of keywords",
|
|
14
15
|
"keywords": [
|
|
15
16
|
"ai",
|
|
16
17
|
"llm",
|
|
@@ -30,7 +31,8 @@
|
|
|
30
31
|
"o1",
|
|
31
32
|
"o1-mini",
|
|
32
33
|
"o1-preview",
|
|
33
|
-
"anthropic"
|
|
34
|
+
"anthropic",
|
|
35
|
+
"LLMOps"
|
|
34
36
|
],
|
|
35
37
|
"license": "CC-BY-4.0",
|
|
36
38
|
"bugs": {
|
|
@@ -51,11 +53,11 @@
|
|
|
51
53
|
"module": "./esm/index.es.js",
|
|
52
54
|
"typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
|
|
53
55
|
"peerDependencies": {
|
|
54
|
-
"@promptbook/core": "0.
|
|
56
|
+
"@promptbook/core": "0.73.0"
|
|
55
57
|
},
|
|
56
58
|
"dependencies": {
|
|
57
59
|
"colors": "1.4.0",
|
|
58
60
|
"socket.io": "4.7.2",
|
|
59
|
-
"spacetrim": "0.11.
|
|
61
|
+
"spacetrim": "0.11.59"
|
|
60
62
|
}
|
|
61
63
|
}
|
package/umd/index.umd.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
/**
|
|
15
15
|
* The version of the Promptbook library
|
|
16
16
|
*/
|
|
17
|
-
var PROMPTBOOK_VERSION = '0.72.0
|
|
17
|
+
var PROMPTBOOK_VERSION = '0.72.0';
|
|
18
18
|
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
19
19
|
|
|
20
20
|
/*! *****************************************************************************
|
|
@@ -358,10 +358,10 @@
|
|
|
358
358
|
'content',
|
|
359
359
|
'context',
|
|
360
360
|
'knowledge',
|
|
361
|
-
'
|
|
361
|
+
'examples',
|
|
362
362
|
'modelName',
|
|
363
363
|
'currentDate',
|
|
364
|
-
// <- TODO:
|
|
364
|
+
// <- TODO: list here all command names
|
|
365
365
|
// <- TODO: Add more like 'date', 'modelName',...
|
|
366
366
|
// <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
|
|
367
367
|
]);
|
|
@@ -382,7 +382,7 @@
|
|
|
382
382
|
*
|
|
383
383
|
* @public exported from `@promptbook/core`
|
|
384
384
|
*/
|
|
385
|
-
var
|
|
385
|
+
var DEFAULT_IS_VERBOSE = false;
|
|
386
386
|
/**
|
|
387
387
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
388
388
|
*/
|
|
@@ -594,8 +594,7 @@
|
|
|
594
594
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
595
595
|
*
|
|
596
596
|
* Note: Internal utility of `joinLlmExecutionTools` but exposed type
|
|
597
|
-
* @public exported from `@promptbook/
|
|
598
|
-
* TODO: !!!!!! Export as runtime class not just type
|
|
597
|
+
* @public exported from `@promptbook/core`
|
|
599
598
|
*/
|
|
600
599
|
var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
601
600
|
/**
|
|
@@ -994,7 +993,7 @@
|
|
|
994
993
|
this.storage = globalScope[storageName];
|
|
995
994
|
}
|
|
996
995
|
$Register.prototype.list = function () {
|
|
997
|
-
// <- TODO: ReadonlyDeep<
|
|
996
|
+
// <- TODO: ReadonlyDeep<ReadonlyArray<TRegistered>>
|
|
998
997
|
return this.storage;
|
|
999
998
|
};
|
|
1000
999
|
$Register.prototype.register = function (registered) {
|
|
@@ -1157,7 +1156,7 @@
|
|
|
1157
1156
|
*/
|
|
1158
1157
|
function createLlmToolsFromConfiguration(configuration, options) {
|
|
1159
1158
|
if (options === void 0) { options = {}; }
|
|
1160
|
-
var _a = options.isVerbose, isVerbose = _a === void 0 ?
|
|
1159
|
+
var _a = options.isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a, userId = options.userId;
|
|
1161
1160
|
var llmTools = configuration.map(function (llmConfiguration) {
|
|
1162
1161
|
var registeredItem = $llmToolsRegister
|
|
1163
1162
|
.list()
|
|
@@ -1168,7 +1167,7 @@
|
|
|
1168
1167
|
if (registeredItem === undefined) {
|
|
1169
1168
|
throw new Error(spaceTrim__default["default"](function (block) { return "\n There is no constructor for LLM provider `".concat(llmConfiguration.className, "` from `").concat(llmConfiguration.packageName, "`\n\n You have probably forgotten install and import the provider package.\n To fix this issue, you can:\n\n Install:\n\n > npm install ").concat(llmConfiguration.packageName, "\n\n And import:\n\n > import '").concat(llmConfiguration.packageName, "';\n\n\n ").concat(block($registeredLlmToolsMessage()), "\n "); }));
|
|
1170
1169
|
}
|
|
1171
|
-
return registeredItem(__assign({ isVerbose: isVerbose }, llmConfiguration.options));
|
|
1170
|
+
return registeredItem(__assign({ isVerbose: isVerbose, userId: userId }, llmConfiguration.options));
|
|
1172
1171
|
});
|
|
1173
1172
|
return joinLlmExecutionTools.apply(void 0, __spreadArray([], __read(llmTools), false));
|
|
1174
1173
|
}
|
|
@@ -1193,9 +1192,7 @@
|
|
|
1193
1192
|
*/
|
|
1194
1193
|
function startRemoteServer(options) {
|
|
1195
1194
|
var _this = this;
|
|
1196
|
-
var _a = __assign({ isAnonymousModeAllowed: false,
|
|
1197
|
-
// <- TODO: [🧠][🤺] Remove `createLlmExecutionTools`, pass just `llmExecutionTools`
|
|
1198
|
-
isAnonymousModeAllowed = _a.isAnonymousModeAllowed, isCollectionModeAllowed = _a.isCollectionModeAllowed, _b = _a.isVerbose, isVerbose = _b === void 0 ? IS_VERBOSE : _b;
|
|
1195
|
+
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 ? DEFAULT_IS_VERBOSE : _b;
|
|
1199
1196
|
// <- TODO: [🦪] Some helper type to be able to use discriminant union types with destructuring
|
|
1200
1197
|
var httpServer = http__default["default"].createServer({}, function (request, response) { return __awaiter(_this, void 0, void 0, function () {
|
|
1201
1198
|
var _a, _b;
|
|
@@ -1213,9 +1210,9 @@
|
|
|
1213
1210
|
return __generator(this, function (_f) {
|
|
1214
1211
|
switch (_f.label) {
|
|
1215
1212
|
case 0:
|
|
1216
|
-
_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
|
|
1213
|
+
_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;
|
|
1217
1214
|
_c = block;
|
|
1218
|
-
if (!!
|
|
1215
|
+
if (!!isApplicationModeAllowed) return [3 /*break*/, 1];
|
|
1219
1216
|
_d = '';
|
|
1220
1217
|
return [3 /*break*/, 3];
|
|
1221
1218
|
case 1:
|
|
@@ -1251,145 +1248,155 @@
|
|
|
1251
1248
|
console.info(colors__default["default"].gray("Client connected"), socket.id);
|
|
1252
1249
|
}
|
|
1253
1250
|
socket.on('prompt-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
|
|
1254
|
-
var _a, isAnonymous, prompt, userId, llmToolsConfiguration, llmExecutionTools, promptResult, _b, error_1;
|
|
1251
|
+
var _a, isAnonymous, prompt, appId, userId, customOptions, llmToolsConfiguration, llmExecutionTools, promptResult, _b, error_1;
|
|
1255
1252
|
return __generator(this, function (_c) {
|
|
1256
1253
|
switch (_c.label) {
|
|
1257
1254
|
case 0:
|
|
1258
|
-
_a = __assign({
|
|
1255
|
+
_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;
|
|
1259
1256
|
// <- TODO: [🦪] Some helper type to be able to use discriminant union types with destructuring
|
|
1260
1257
|
if (isVerbose) {
|
|
1261
1258
|
console.info(colors__default["default"].bgWhite("Prompt:"), colors__default["default"].gray(JSON.stringify(request, null, 4)));
|
|
1262
1259
|
}
|
|
1263
1260
|
_c.label = 1;
|
|
1264
1261
|
case 1:
|
|
1265
|
-
_c.trys.push([1,
|
|
1262
|
+
_c.trys.push([1, 15, 16, 17]);
|
|
1266
1263
|
if (isAnonymous === true && !isAnonymousModeAllowed) {
|
|
1267
1264
|
throw new PipelineExecutionError("Anonymous mode is not allowed"); // <- TODO: [main] !!! Test
|
|
1268
1265
|
}
|
|
1269
|
-
if (isAnonymous === false && !
|
|
1270
|
-
throw new PipelineExecutionError("
|
|
1266
|
+
if (isAnonymous === false && !isApplicationModeAllowed) {
|
|
1267
|
+
throw new PipelineExecutionError("Application mode is not allowed"); // <- TODO: [main] !!! Test
|
|
1271
1268
|
}
|
|
1272
1269
|
llmExecutionTools = void 0;
|
|
1273
1270
|
if (!(isAnonymous === true && llmToolsConfiguration !== null)) return [3 /*break*/, 2];
|
|
1274
1271
|
// Note: Anonymouse mode
|
|
1275
1272
|
// TODO: Maybe check that configuration is not empty
|
|
1276
1273
|
llmExecutionTools = createLlmToolsFromConfiguration(llmToolsConfiguration, { isVerbose: isVerbose });
|
|
1277
|
-
return [3 /*break*/,
|
|
1274
|
+
return [3 /*break*/, 6];
|
|
1278
1275
|
case 2:
|
|
1279
|
-
if (!(isAnonymous === false && createLlmExecutionTools !== null)) return [3 /*break*/,
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1276
|
+
if (!(isAnonymous === false && createLlmExecutionTools !== null)) return [3 /*break*/, 5];
|
|
1277
|
+
return [4 /*yield*/, createLlmExecutionTools({
|
|
1278
|
+
appId: appId,
|
|
1279
|
+
userId: userId,
|
|
1280
|
+
customOptions: customOptions,
|
|
1281
|
+
})];
|
|
1283
1282
|
case 3:
|
|
1283
|
+
// Note: Application mode
|
|
1284
|
+
llmExecutionTools = _c.sent();
|
|
1285
|
+
return [4 /*yield*/, collection.isResponsibleForPrompt(prompt)];
|
|
1286
|
+
case 4:
|
|
1284
1287
|
if (!(_c.sent())) {
|
|
1285
1288
|
throw new PipelineExecutionError("Pipeline is not in the collection of this server");
|
|
1286
1289
|
}
|
|
1287
|
-
return [3 /*break*/,
|
|
1288
|
-
case
|
|
1289
|
-
case
|
|
1290
|
+
return [3 /*break*/, 6];
|
|
1291
|
+
case 5: throw new PipelineExecutionError("You must provide either llmToolsConfiguration or non-anonymous mode must be propperly configured");
|
|
1292
|
+
case 6:
|
|
1290
1293
|
promptResult = void 0;
|
|
1291
1294
|
_b = prompt.modelRequirements.modelVariant;
|
|
1292
1295
|
switch (_b) {
|
|
1293
|
-
case 'CHAT': return [3 /*break*/,
|
|
1294
|
-
case 'COMPLETION': return [3 /*break*/,
|
|
1295
|
-
case 'EMBEDDING': return [3 /*break*/,
|
|
1296
|
+
case 'CHAT': return [3 /*break*/, 7];
|
|
1297
|
+
case 'COMPLETION': return [3 /*break*/, 9];
|
|
1298
|
+
case 'EMBEDDING': return [3 /*break*/, 11];
|
|
1296
1299
|
}
|
|
1297
|
-
return [3 /*break*/,
|
|
1298
|
-
case
|
|
1300
|
+
return [3 /*break*/, 13];
|
|
1301
|
+
case 7:
|
|
1299
1302
|
if (llmExecutionTools.callChatModel === undefined) {
|
|
1300
1303
|
// Note: [0] This check should not be a thing
|
|
1301
1304
|
throw new PipelineExecutionError("Chat model is not available");
|
|
1302
1305
|
}
|
|
1303
1306
|
return [4 /*yield*/, llmExecutionTools.callChatModel(prompt)];
|
|
1304
|
-
case 7:
|
|
1305
|
-
promptResult = _c.sent();
|
|
1306
|
-
return [3 /*break*/, 13];
|
|
1307
1307
|
case 8:
|
|
1308
|
+
promptResult = _c.sent();
|
|
1309
|
+
return [3 /*break*/, 14];
|
|
1310
|
+
case 9:
|
|
1308
1311
|
if (llmExecutionTools.callCompletionModel === undefined) {
|
|
1309
1312
|
// Note: [0] This check should not be a thing
|
|
1310
1313
|
throw new PipelineExecutionError("Completion model is not available");
|
|
1311
1314
|
}
|
|
1312
1315
|
return [4 /*yield*/, llmExecutionTools.callCompletionModel(prompt)];
|
|
1313
|
-
case 9:
|
|
1314
|
-
promptResult = _c.sent();
|
|
1315
|
-
return [3 /*break*/, 13];
|
|
1316
1316
|
case 10:
|
|
1317
|
+
promptResult = _c.sent();
|
|
1318
|
+
return [3 /*break*/, 14];
|
|
1319
|
+
case 11:
|
|
1317
1320
|
if (llmExecutionTools.callEmbeddingModel === undefined) {
|
|
1318
1321
|
// Note: [0] This check should not be a thing
|
|
1319
1322
|
throw new PipelineExecutionError("Embedding model is not available");
|
|
1320
1323
|
}
|
|
1321
1324
|
return [4 /*yield*/, llmExecutionTools.callEmbeddingModel(prompt)];
|
|
1322
|
-
case
|
|
1325
|
+
case 12:
|
|
1323
1326
|
promptResult = _c.sent();
|
|
1324
|
-
return [3 /*break*/,
|
|
1325
|
-
case
|
|
1326
|
-
case
|
|
1327
|
+
return [3 /*break*/, 14];
|
|
1328
|
+
case 13: throw new PipelineExecutionError("Unknown model variant \"".concat(prompt.modelRequirements.modelVariant, "\""));
|
|
1329
|
+
case 14:
|
|
1327
1330
|
if (isVerbose) {
|
|
1328
1331
|
console.info(colors__default["default"].bgGreen("PromptResult:"), colors__default["default"].green(JSON.stringify(promptResult, null, 4)));
|
|
1329
1332
|
}
|
|
1330
1333
|
socket.emit('prompt-response', { promptResult: promptResult } /* <- TODO: [🤛] */);
|
|
1331
|
-
return [3 /*break*/,
|
|
1332
|
-
case
|
|
1334
|
+
return [3 /*break*/, 17];
|
|
1335
|
+
case 15:
|
|
1333
1336
|
error_1 = _c.sent();
|
|
1334
1337
|
if (!(error_1 instanceof Error)) {
|
|
1335
1338
|
throw error_1;
|
|
1336
1339
|
}
|
|
1337
1340
|
socket.emit('error', serializeError(error_1) /* <- TODO: [🤛] */);
|
|
1338
|
-
return [3 /*break*/,
|
|
1339
|
-
case
|
|
1341
|
+
return [3 /*break*/, 17];
|
|
1342
|
+
case 16:
|
|
1340
1343
|
socket.disconnect();
|
|
1341
1344
|
return [7 /*endfinally*/];
|
|
1342
|
-
case
|
|
1345
|
+
case 17: return [2 /*return*/];
|
|
1343
1346
|
}
|
|
1344
1347
|
});
|
|
1345
1348
|
}); });
|
|
1346
1349
|
// TODO: [👒] Listing models (and checking configuration) probbably should go through REST API not Socket.io
|
|
1347
1350
|
socket.on('listModels-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
|
|
1348
|
-
var _a, isAnonymous, llmToolsConfiguration, llmExecutionTools, models, error_2;
|
|
1351
|
+
var _a, isAnonymous, appId, userId, customOptions, llmToolsConfiguration, llmExecutionTools, models, error_2;
|
|
1349
1352
|
return __generator(this, function (_b) {
|
|
1350
1353
|
switch (_b.label) {
|
|
1351
1354
|
case 0:
|
|
1352
|
-
_a = __assign({ llmToolsConfiguration: null }, request), isAnonymous = _a.isAnonymous, llmToolsConfiguration = _a.llmToolsConfiguration;
|
|
1355
|
+
_a = __assign({ appId: null, customOptions: undefined, llmToolsConfiguration: null }, request), isAnonymous = _a.isAnonymous, appId = _a.appId, userId = _a.userId, customOptions = _a.customOptions, llmToolsConfiguration = _a.llmToolsConfiguration;
|
|
1353
1356
|
// <- TODO: [🦪] Some helper type to be able to use discriminant union types with destructuring
|
|
1354
1357
|
if (isVerbose) {
|
|
1355
1358
|
console.info(colors__default["default"].bgWhite("Listing models"));
|
|
1356
1359
|
}
|
|
1357
1360
|
_b.label = 1;
|
|
1358
1361
|
case 1:
|
|
1359
|
-
_b.trys.push([1,
|
|
1362
|
+
_b.trys.push([1, 6, 7, 8]);
|
|
1360
1363
|
if (isAnonymous === true && !isAnonymousModeAllowed) {
|
|
1361
1364
|
throw new PipelineExecutionError("Anonymous mode is not allowed"); // <- TODO: [main] !!! Test
|
|
1362
1365
|
}
|
|
1363
|
-
if (isAnonymous === false && !
|
|
1364
|
-
throw new PipelineExecutionError("
|
|
1366
|
+
if (isAnonymous === false && !isApplicationModeAllowed) {
|
|
1367
|
+
throw new PipelineExecutionError("Application mode is not allowed"); // <- TODO: [main] !!! Test
|
|
1365
1368
|
}
|
|
1366
1369
|
llmExecutionTools = void 0;
|
|
1367
|
-
if (isAnonymous === true)
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
|
|
1370
|
+
if (!(isAnonymous === true)) return [3 /*break*/, 2];
|
|
1371
|
+
// Note: Anonymouse mode
|
|
1372
|
+
// TODO: Maybe check that configuration is not empty
|
|
1373
|
+
llmExecutionTools = createLlmToolsFromConfiguration(llmToolsConfiguration, { isVerbose: isVerbose });
|
|
1374
|
+
return [3 /*break*/, 4];
|
|
1375
|
+
case 2: return [4 /*yield*/, createLlmExecutionTools({
|
|
1376
|
+
appId: appId,
|
|
1377
|
+
userId: userId,
|
|
1378
|
+
customOptions: customOptions,
|
|
1379
|
+
})];
|
|
1380
|
+
case 3:
|
|
1381
|
+
// Note: Application mode
|
|
1382
|
+
llmExecutionTools = _b.sent();
|
|
1383
|
+
_b.label = 4;
|
|
1384
|
+
case 4: return [4 /*yield*/, llmExecutionTools.listModels()];
|
|
1385
|
+
case 5:
|
|
1379
1386
|
models = _b.sent();
|
|
1380
1387
|
socket.emit('listModels-response', { models: models } /* <- TODO: [🤛] */);
|
|
1381
|
-
return [3 /*break*/,
|
|
1382
|
-
case
|
|
1388
|
+
return [3 /*break*/, 8];
|
|
1389
|
+
case 6:
|
|
1383
1390
|
error_2 = _b.sent();
|
|
1384
1391
|
if (!(error_2 instanceof Error)) {
|
|
1385
1392
|
throw error_2;
|
|
1386
1393
|
}
|
|
1387
1394
|
socket.emit('error', serializeError(error_2));
|
|
1388
|
-
return [3 /*break*/,
|
|
1389
|
-
case
|
|
1395
|
+
return [3 /*break*/, 8];
|
|
1396
|
+
case 7:
|
|
1390
1397
|
socket.disconnect();
|
|
1391
1398
|
return [7 /*endfinally*/];
|
|
1392
|
-
case
|
|
1399
|
+
case 8: return [2 /*return*/];
|
|
1393
1400
|
}
|
|
1394
1401
|
});
|
|
1395
1402
|
}); });
|