feat:Add 3 new LLM providers and optimize the readme.
This commit is contained in:
@@ -6,10 +6,16 @@ use std::time::Duration;
|
||||
pub mod ollama;
|
||||
pub mod openai;
|
||||
pub mod anthropic;
|
||||
pub mod kimi;
|
||||
pub mod deepseek;
|
||||
pub mod openrouter;
|
||||
|
||||
pub use ollama::OllamaClient;
|
||||
pub use openai::OpenAiClient;
|
||||
pub use anthropic::AnthropicClient;
|
||||
pub use kimi::KimiClient;
|
||||
pub use deepseek::DeepSeekClient;
|
||||
pub use openrouter::OpenRouterClient;
|
||||
|
||||
/// LLM provider trait
|
||||
#[async_trait]
|
||||
@@ -77,6 +83,21 @@ impl LlmClient {
|
||||
.ok_or_else(|| anyhow::anyhow!("Anthropic API key not configured"))?;
|
||||
Box::new(AnthropicClient::new(api_key, &config.anthropic.model)?)
|
||||
}
|
||||
"kimi" => {
|
||||
let api_key = config.kimi.api_key.as_ref()
|
||||
.ok_or_else(|| anyhow::anyhow!("Kimi API key not configured"))?;
|
||||
Box::new(KimiClient::with_base_url(api_key, &config.kimi.model, &config.kimi.base_url)?)
|
||||
}
|
||||
"deepseek" => {
|
||||
let api_key = config.deepseek.api_key.as_ref()
|
||||
.ok_or_else(|| anyhow::anyhow!("DeepSeek API key not configured"))?;
|
||||
Box::new(DeepSeekClient::with_base_url(api_key, &config.deepseek.model, &config.deepseek.base_url)?)
|
||||
}
|
||||
"openrouter" => {
|
||||
let api_key = config.openrouter.api_key.as_ref()
|
||||
.ok_or_else(|| anyhow::anyhow!("OpenRouter API key not configured"))?;
|
||||
Box::new(OpenRouterClient::with_base_url(api_key, &config.openrouter.model, &config.openrouter.base_url)?)
|
||||
}
|
||||
_ => bail!("Unknown LLM provider: {}", config.provider),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user