pub enum AnyProvider {
OpenAiCompat(OpenAiCompatProvider),
Sockudo(SockudoProvider),
}Expand description
Concrete wrapper over all built-in provider backends.
The Provider trait is not dyn-compatible (its async methods use
RPITIT return types), so dynamic dispatch over a runtime-selected
backend goes through this enum instead of Arc<Mutex<dyn Provider>>.
Commands and the agent loop share an Arc<Mutex<AnyProvider>>.
Variants§
OpenAiCompat(OpenAiCompatProvider)
Sockudo(SockudoProvider)
Implementations§
Source§impl AnyProvider
impl AnyProvider
Sourcepub fn build(
kind: ProviderKind,
base_url: String,
api_key: Option<SecretString>,
timeout_secs: u64,
max_retries: u32,
sockudo: SockudoCredentials,
) -> Result<Self, String>
pub fn build( kind: ProviderKind, base_url: String, api_key: Option<SecretString>, timeout_secs: u64, max_retries: u32, sockudo: SockudoCredentials, ) -> Result<Self, String>
Build the provider for kind from resolved settings values.
url and credentials come from the caller (CLI flags / settings);
timeout_secs/max_retries are the effective per-provider values
from Settings::effective_timeout_secs()/effective_max_retries().
Trait Implementations§
Source§impl Provider for AnyProvider
impl Provider for AnyProvider
Source§async fn health_check(&self) -> Result<(), String>
async fn health_check(&self) -> Result<(), String>
Check whether the backend is reachable and healthy. Read more
Source§async fn list_models(&self) -> Vec<String>
async fn list_models(&self) -> Vec<String>
List model names available on the backend. Read more
Source§fn select_model(&mut self, name: String)
fn select_model(&mut self, name: String)
Select the model used for subsequent
Provider::chat requests.Source§fn current_model(&self) -> Option<String>
fn current_model(&self) -> Option<String>
The currently selected model, if any.
Source§async fn chat(
&mut self,
messages: Vec<Message>,
tools: Vec<ToolDefinition>,
) -> Result<Receiver<ChatMessageResponse>, String>
async fn chat( &mut self, messages: Vec<Message>, tools: Vec<ToolDefinition>, ) -> Result<Receiver<ChatMessageResponse>, String>
Send a chat request and return a receiver for streaming response chunks. Read more
Source§fn set_timeout(&mut self, timeout_secs: u64)
fn set_timeout(&mut self, timeout_secs: u64)
Set the request timeout in seconds. Only meaningful for providers that use timeouts.
Source§fn set_retries(&mut self, max_retries: u32)
fn set_retries(&mut self, max_retries: u32)
Set the maximum number of retries. Only meaningful for providers that use retries.
Auto Trait Implementations§
impl !RefUnwindSafe for AnyProvider
impl !UnwindSafe for AnyProvider
impl Forget for AnyProvider
impl Freeze for AnyProvider
impl Send for AnyProvider
impl Sync for AnyProvider
impl Unpin for AnyProvider
impl UnsafeUnpin for AnyProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more