pub struct ProviderConfigs;
Expand description
预定义的提供商配置,支持多种AI服务
Predefined provider configurations for multiple AI services
Implementations§
Source§impl ProviderConfigs
impl ProviderConfigs
Sourcepub fn groq() -> ProviderConfig
pub fn groq() -> ProviderConfig
Examples found in repository?
6fn main() -> Result<(), Box<dyn std::error::Error>> {
7 let cfg = HttpTransportConfig {
8 timeout: Duration::from_secs(30),
9 proxy: None,
10 pool_max_idle_per_host: Some(16),
11 pool_idle_timeout: Some(Duration::from_secs(60)),
12 };
13
14 let transport = HttpTransport::new_with_config(cfg)?;
15 let provider_cfg = ProviderConfigs::groq();
16 let _adapter = GenericAdapter::with_transport(provider_cfg, transport)?;
17
18 println!("Created adapter using HttpTransportConfig");
19 Ok(())
20}
More examples
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8 // Build a reqwest client with custom pool settings
9 let reqwest_client = Client::builder()
10 .pool_max_idle_per_host(32)
11 .pool_idle_timeout(Duration::from_secs(90))
12 .timeout(Duration::from_secs(30))
13 .build()?;
14
15 // Wrap into library transport and inject
16 let transport = HttpTransport::with_client(reqwest_client, Duration::from_secs(30));
17
18 let config = ProviderConfigs::groq();
19 let _adapter = GenericAdapter::with_transport(config, transport)?;
20
21 println!("Created generic adapter with custom transport");
22 Ok(())
23}
pub fn openai() -> ProviderConfig
pub fn deepseek() -> ProviderConfig
pub fn ollama() -> ProviderConfig
Sourcepub fn xai_grok() -> ProviderConfig
pub fn xai_grok() -> ProviderConfig
xAI / Grok configuration - OpenAI-compatible hosted offering
Sourcepub fn azure_openai() -> ProviderConfig
pub fn azure_openai() -> ProviderConfig
Azure OpenAI configuration - highly compatible but often uses resource-specific base URL
Sourcepub fn huggingface() -> ProviderConfig
pub fn huggingface() -> ProviderConfig
Hugging Face Inference API - configured to reuse generic adapter; may need adjustments per model
Sourcepub fn together_ai() -> ProviderConfig
pub fn together_ai() -> ProviderConfig
Together AI - OpenAI-compatible chat API
Sourcepub fn groq_as_generic() -> ProviderConfig
pub fn groq_as_generic() -> ProviderConfig
Groq configuration - proving OpenAI compatibility
Sourcepub fn qwen() -> ProviderConfig
pub fn qwen() -> ProviderConfig
Qwen / 通义千问 (Alibaba Cloud) - OpenAI-compatible mode Uses DASHSCOPE_API_KEY and optional DASHSCOPE_BASE_URL to override the base URL.
Sourcepub fn baidu_wenxin() -> ProviderConfig
pub fn baidu_wenxin() -> ProviderConfig
百度文心一言(Wenxin / ERNIE) - OpenAI 兼容模式(通过千帆/控制台配置) 使用环境变量: BAIDU_WENXIN_BASE_URL (可选), BAIDU_WENXIN_API_KEY, BAIDU_WENXIN_SECRET
Sourcepub fn tencent_hunyuan() -> ProviderConfig
pub fn tencent_hunyuan() -> ProviderConfig
腾讯混元(Hunyuan) - 腾讯云 OpenAI 兼容端点 使用环境变量: TENCENT_HUNYUAN_BASE_URL (可选), TENCENT_HUNYUAN_API_KEY
Sourcepub fn iflytek_spark() -> ProviderConfig
pub fn iflytek_spark() -> ProviderConfig
讯飞星火(iFlytek Spark) - OpenAI 兼容端点示例 使用环境变量: IFLYTEK_BASE_URL (可选), IFLYTEK_API_KEY
Sourcepub fn moonshot() -> ProviderConfig
pub fn moonshot() -> ProviderConfig
月之暗面 / Moonshot (Kimi) - OpenAI 兼容端点 使用环境变量: MOONSHOT_BASE_URL (可选), MOONSHOT_API_KEY
Sourcepub fn anthropic() -> ProviderConfig
pub fn anthropic() -> ProviderConfig
Anthropic Claude configuration - requires special handling