Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/spark-adapters/blob/main/src/providers/mod.rs # spark-adapters Hardware abstraction adapters for local AI accelerators Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `spark-adapters / src / providers / mod.rs` 36 lines ยท 1063 bytes Raw Blame History 1 pub mod anthropic; 2 pub mod openai; 3 4 pub use anthropic::*; 5 pub use openai::*; 6 7 use reqwest::Client; 8 use crate::models::{ChatMessage, ProviderType}; 9 10 pub async fn call_provider_unary( 11 client: &Client, 12 provider: ProviderType, 13 endpoint: &str, 14 model: &str, 15 api_key: Option<&str>, 16 messages: &[ChatMessage], 17 temperature: Option, 18 ) -> Result<(String, Option, usize), String> { 19 match provider { 20 ProviderType::Anthropic => { 21 let key = api_key.ok_or_else(|| "Anthropic requires an API key".to_string())?; 22 call_anthropic_unary(client, endpoint, model, key, messages, temperature).await 23 } 24 ProviderType::OpenAI 25 | ProviderType::OpenRouter 26 | ProviderType::Gemini 27 | ProviderType::Groq 28 | ProviderType::DeepSeek 29 | ProviderType::Together 30 | ProviderType::Mistral 31 | ProviderType::Ollama 32 | ProviderType::LocalMax => { 33 call_openai_unary(client, endpoint, model, api_key, messages, temperature).await 34 } 35 } 36 }