pub fn create_llm_client(
config: LlmConfig,
) -> Result<Box<dyn LlmClient>, VlorQLError>Expand description
Creates an LLM client from a populated LlmConfig.
The factory inspects the provider field, performs provider-specific
validation (e.g. requiring an API key for hosted providers) and returns a
boxed LlmClient.
§Errors
Returns a VlorQLError::Config when the API key is missing for a hosted
provider or the model name is empty.
§Examples
use vlorql_llm::{LlmConfig, LlmProvider, create_llm_client};
let config = LlmConfig {
provider: LlmProvider::Ollama,
model: "llama3.2".to_owned(),
api_key: None,
..LlmConfig::default()
};
let client = create_llm_client(config);
assert!(client.is_ok());