UNPKG

@promptbook/remote-server

Version:

Promptbook: Run AI apps in plain human language across multiple models and platforms

60 lines (59 loc) 2.35 kB
import { Promisable } from 'type-fest'; import type { Identification } from '../../../remote-server/socket-types/_subtypes/Identification'; import type { string_app_id } from '../../../types/typeAliases'; import type { string_url } from '../../../types/typeAliases'; import type { really_any } from '../../../utils/organization/really_any'; import type { CacheLlmToolsOptions } from '../utils/cache/CacheLlmToolsOptions'; import type { LlmExecutionToolsWithTotalUsage } from '../utils/count-total-usage/LlmExecutionToolsWithTotalUsage'; type ProvideLlmToolsForWizardOrCliOptions = { /** * If true, user will be always prompted for login * * Note: This is used in `ptbk login` command */ isLoginloaded?: true; } & Pick<CacheLlmToolsOptions, 'isCacheReloaded'> & ({ /** * Use local keys and execute LLMs directly */ readonly strategy: 'BRING_YOUR_OWN_KEYS'; } | { /** * Do not use local keys but login to Promptbook server and execute LLMs there */ readonly strategy: 'REMOTE_SERVER'; /** * URL of the remote server * * @default `DEFAULT_REMOTE_SERVER_URL` */ readonly remoteServerUrl?: string_url; /** * Identifier of the application which will be passed to the remote server identification * * Note: This can be some id or some semantic name like "email-agent" */ readonly appId: string_app_id; /** * * * Note: When login prompt fails, `process.exit(1)` is called */ loginPrompt(): Promisable<Identification<really_any>>; }); /** * Returns LLM tools for CLI * * Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file and also writes this .env file * * @private within the repository - for CLI utils */ export declare function $provideLlmToolsForWizardOrCli(options?: ProvideLlmToolsForWizardOrCliOptions): Promise<LlmExecutionToolsWithTotalUsage>; export {}; /** * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment * TODO: [👷‍♂️] @@@ Manual about construction of llmTools * TODO: [🥃] Allow `ptbk make` without llm tools * TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal` * TODO: [®] DRY Register logic */