Skip to main content

build_llm_provider

Function build_llm_provider 

Source
pub fn build_llm_provider(
    provider: Provider,
    api_key: Option<String>,
    model: String,
    ollama_url: String,
) -> AppResult<LlmProvider>
Expand description

Builds an LLM provider configuration from CLI parameters.

Constructs the appropriate LlmProvider variant based on the selected provider type. For cloud providers (OpenAI, Anthropic), an API key is required.

§Arguments

  • provider - The LLM provider type
  • api_key - Optional API key for cloud providers
  • model - Model name to use
  • ollama_url - Base URL for Ollama server

§Returns

An LlmProvider configured for the selected provider.

§Errors

Returns an error if a cloud provider is selected without an API key.