pub struct CompatibleProvider { /* private fields */ }Expand description
LlmProvider adapter for OpenAI-compatible REST endpoints.
Delegates all operations to an inner OpenAiProvider while exposing a
configurable provider_name for logging and routing identification.
Implementations§
Source§impl CompatibleProvider
impl CompatibleProvider
Sourcepub fn new(cfg: CompatibleConfig) -> Self
pub fn new(cfg: CompatibleConfig) -> Self
Create a new provider from a CompatibleConfig.
Source§impl CompatibleProvider
impl CompatibleProvider
Sourcepub async fn list_models_remote(&self) -> Result<Vec<RemoteModelInfo>, LlmError>
pub async fn list_models_remote(&self) -> Result<Vec<RemoteModelInfo>, LlmError>
Fetch models via the inner OpenAiProvider. Cache slug is derived from base URL.
§Errors
Returns an error if the API request fails.
Source§impl CompatibleProvider
impl CompatibleProvider
Sourcepub fn set_status_tx(&mut self, tx: StatusTx)
pub fn set_status_tx(&mut self, tx: StatusTx)
Attach a status channel for streaming progress events to the TUI.
Sourcepub fn with_generation_overrides(self, overrides: GenerationOverrides) -> Self
pub fn with_generation_overrides(self, overrides: GenerationOverrides) -> Self
Override generation parameters (temperature, top-p, etc.) for all subsequent calls.
Sourcepub fn with_output_schema_forwarding(
self,
enabled: bool,
hint_bytes: usize,
max_description_bytes: usize,
) -> Self
pub fn with_output_schema_forwarding( self, enabled: bool, hint_bytes: usize, max_description_bytes: usize, ) -> Self
Forward MCP tool output schemas as JSON hints appended to tool descriptions.
Delegates to the inner OpenAiProvider. When enabled is false the call is a no-op.
hint_bytes caps the JSON representation; max_description_bytes caps the combined
description string.
Trait Implementations§
Source§impl Clone for CompatibleProvider
impl Clone for CompatibleProvider
Source§impl Debug for CompatibleProvider
impl Debug for CompatibleProvider
Source§impl LlmProvider for CompatibleProvider
impl LlmProvider for CompatibleProvider
Source§fn context_window(&self) -> Option<usize>
fn context_window(&self) -> Option<usize>
Source§async fn chat(&self, messages: &[Message]) -> Result<String, LlmError>
async fn chat(&self, messages: &[Message]) -> Result<String, LlmError>
Source§async fn chat_with_extras(
&self,
messages: &[Message],
) -> Result<(String, ChatExtras), LlmError>
async fn chat_with_extras( &self, messages: &[Message], ) -> Result<(String, ChatExtras), LlmError>
Source§async fn chat_stream(
&self,
messages: &[Message],
) -> Result<ChatStream, LlmError>
async fn chat_stream( &self, messages: &[Message], ) -> Result<ChatStream, LlmError>
Source§fn supports_streaming(&self) -> bool
fn supports_streaming(&self) -> bool
Source§async fn embed(&self, text: &str) -> Result<Vec<f32>, LlmError>
async fn embed(&self, text: &str) -> Result<Vec<f32>, LlmError>
Source§async fn embed_batch(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>, LlmError>
async fn embed_batch(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>, LlmError>
Source§fn supports_embeddings(&self) -> bool
fn supports_embeddings(&self) -> bool
Source§fn model_identifier(&self) -> &str
fn model_identifier(&self) -> &str
gpt-4o-mini, claude-sonnet-4-6).
Used by cost-estimation heuristics. Returns "" when not applicable.Source§fn list_models(&self) -> Vec<String>
fn list_models(&self) -> Vec<String>
Source§fn supports_structured_output(&self) -> bool
fn supports_structured_output(&self) -> bool
Source§async fn chat_typed<T>(&self, messages: &[Message]) -> Result<T, LlmError>
async fn chat_typed<T>(&self, messages: &[Message]) -> Result<T, LlmError>
T. Read moreSource§async fn chat_with_tools(
&self,
messages: &[Message],
tools: &[ToolDefinition],
) -> Result<ChatResponse, LlmError>
async fn chat_with_tools( &self, messages: &[Message], tools: &[ToolDefinition], ) -> Result<ChatResponse, LlmError>
Source§fn last_cache_usage(&self) -> Option<(u64, u64)>
fn last_cache_usage(&self) -> Option<(u64, u64)>
(cache_creation_tokens, cache_read_tokens).Source§fn last_usage(&self) -> Option<(u64, u64)>
fn last_usage(&self) -> Option<(u64, u64)>
(input_tokens, output_tokens).Source§fn debug_request_json(
&self,
messages: &[Message],
tools: &[ToolDefinition],
stream: bool,
) -> Value
fn debug_request_json( &self, messages: &[Message], tools: &[ToolDefinition], stream: bool, ) -> Value
Source§fn supports_vision(&self) -> bool
fn supports_vision(&self) -> bool
Source§fn supports_tool_use(&self) -> bool
fn supports_tool_use(&self) -> bool
tool_use / function calling.Source§fn last_reasoning_tokens(&self) -> Option<u64>
fn last_reasoning_tokens(&self) -> Option<u64>
Source§fn take_compaction_summary(&self) -> Option<String>
fn take_compaction_summary(&self) -> Option<String>
Auto Trait Implementations§
impl !Freeze for CompatibleProvider
impl !RefUnwindSafe for CompatibleProvider
impl !UnwindSafe for CompatibleProvider
impl Send for CompatibleProvider
impl Sync for CompatibleProvider
impl Unpin for CompatibleProvider
impl UnsafeUnpin for CompatibleProvider
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> LlmProviderDyn for T
impl<T> LlmProviderDyn for T
Source§fn context_window(&self) -> Option<usize>
fn context_window(&self) -> Option<usize>
None if unknown.Source§fn chat<'a>(
&'a self,
messages: &'a [Message],
) -> Pin<Box<dyn Future<Output = Result<String, LlmError>> + Send + 'a>>
fn chat<'a>( &'a self, messages: &'a [Message], ) -> Pin<Box<dyn Future<Output = Result<String, LlmError>> + Send + 'a>>
Source§fn chat_stream<'a>(
&'a self,
messages: &'a [Message],
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StreamChunk, LlmError>> + Send>>, LlmError>> + Send + 'a>>
fn chat_stream<'a>( &'a self, messages: &'a [Message], ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StreamChunk, LlmError>> + Send>>, LlmError>> + Send + 'a>>
Source§fn supports_streaming(&self) -> bool
fn supports_streaming(&self) -> bool
Source§fn embed<'a>(
&'a self,
text: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, LlmError>> + Send + 'a>>
fn embed<'a>( &'a self, text: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, LlmError>> + Send + 'a>>
Source§fn embed_batch<'a>(
&'a self,
texts: &'a [&'a str],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, LlmError>> + Send + 'a>>
fn embed_batch<'a>( &'a self, texts: &'a [&'a str], ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, LlmError>> + Send + 'a>>
Source§fn supports_embeddings(&self) -> bool
fn supports_embeddings(&self) -> bool
Source§fn model_identifier(&self) -> &str
fn model_identifier(&self) -> &str
gpt-4o-mini, claude-sonnet-4-6).Source§fn supports_vision(&self) -> bool
fn supports_vision(&self) -> bool
Source§fn supports_tool_use(&self) -> bool
fn supports_tool_use(&self) -> bool
tool_use / function calling.Source§fn chat_with_tools<'a>(
&'a self,
messages: &'a [Message],
tools: &'a [ToolDefinition],
) -> Pin<Box<dyn Future<Output = Result<ChatResponse, LlmError>> + Send + 'a>>
fn chat_with_tools<'a>( &'a self, messages: &'a [Message], tools: &'a [ToolDefinition], ) -> Pin<Box<dyn Future<Output = Result<ChatResponse, LlmError>> + Send + 'a>>
Source§fn last_cache_usage(&self) -> Option<(u64, u64)>
fn last_cache_usage(&self) -> Option<(u64, u64)>
(cache_creation_tokens, cache_read_tokens).Source§fn last_usage(&self) -> Option<(u64, u64)>
fn last_usage(&self) -> Option<(u64, u64)>
(input_tokens, output_tokens).