@promptbook/remote-server
Version:
Promptbook: Run AI apps in plain human language across multiple models and platforms
42 lines (41 loc) • 2.48 kB
TypeScript
import { MultipleLlmExecutionTools } from '../../_multiple/MultipleLlmExecutionTools';
import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFromConfiguration';
/**
* Automatically configures LLM tools from environment variables in Node.js
*
* This utility function detects available LLM providers based on environment variables
* and creates properly configured LLM execution tools for each detected provider.
*
* Note: This function is not cached, every call creates new instance of `MultipleLlmExecutionTools`
*
* Supports environment variables from .env files when dotenv is configured
* Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
*
* It looks for environment variables:
* - `process.env.OPENAI_API_KEY`
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
* - ...
*
* @param options Configuration options for the LLM tools
* @returns A unified interface containing all detected and configured LLM tools
* @public exported from `@promptbook/node`
*/
export declare function $provideLlmToolsFromEnv(options?: CreateLlmToolsFromConfigurationOptions): Promise<MultipleLlmExecutionTools>;
/**
* TODO: The architecture for LLM tools configuration consists of three key functions:
* 1. `$provideLlmToolsFromEnv` - High-level function that detects available providers from env vars and returns ready-to-use LLM tools
* 2. `$provideLlmToolsConfigurationFromEnv` - Middle layer that extracts configuration objects from environment variables
* 3. `createLlmToolsFromConfiguration` - Low-level function that instantiates LLM tools from explicit configuration
*
* This layered approach allows flexibility in how tools are configured:
* - Use $provideLlmToolsFromEnv for automatic detection and setup in Node.js environments
* - Use $provideLlmToolsConfigurationFromEnv to extract config objects for modification before instantiation
* - Use createLlmToolsFromConfiguration for explicit control over tool configurations
*
* TODO: [🧠][🍛] Which name is better `$provideLlmToolsFromEnv` or `$provideLlmToolsFromEnvironment`?
* TODO: [🧠] Is there some meaningfull way how to test this util
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
* TODO: [🥃] Allow `ptbk make` without llm tools
* TODO: This should be maybe not under `_common` but under `utils`
* TODO: [®] DRY Register logic
*/