pub struct GenericProvider { /* private fields */ }Expand description
Generic LLM provider built on top of any RawAdapter.
Handles HTTP client management, retry logic, and automatically
implements LlmProvider.
Implementations§
Source§impl GenericProvider
impl GenericProvider
pub fn new(adapter: Box<dyn RawAdapter>) -> Self
pub fn with_config(adapter: Box<dyn RawAdapter>, config: ProviderConfig) -> Self
Sourcepub fn with_http_client(
adapter: Box<dyn RawAdapter>,
client: Arc<dyn HttpClient>,
config: ProviderConfig,
) -> Self
pub fn with_http_client( adapter: Box<dyn RawAdapter>, client: Arc<dyn HttpClient>, config: ProviderConfig, ) -> Self
Build a provider on top of a caller-supplied HttpClient.
Use this to stub transport in tests, share a connection pool wrapper,
or route requests through custom middleware (logging, proxies, signing).
The config still controls retry/backoff behaviour.
Sourcepub fn adapter(&self) -> &dyn RawAdapter
pub fn adapter(&self) -> &dyn RawAdapter
Get a reference to the inner adapter.
Trait Implementations§
Source§impl LlmProvider for GenericProvider
impl LlmProvider for GenericProvider
Source§fn stream<'life0, 'async_trait>(
&'life0 self,
request: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatStream, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stream<'life0, 'async_trait>(
&'life0 self,
request: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatStream, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Streaming call (returns chunks in real-time). Read more
Source§fn chat<'life0, 'async_trait>(
&'life0 self,
request: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chat<'life0, 'async_trait>(
&'life0 self,
request: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Non-streaming call (returns complete result at once). Read more
Source§fn capabilities(&self) -> Capabilities
fn capabilities(&self) -> Capabilities
Get provider capabilities.
Source§fn info(&self) -> ProviderInfo
fn info(&self) -> ProviderInfo
Get provider info.
Auto Trait Implementations§
impl !RefUnwindSafe for GenericProvider
impl !UnwindSafe for GenericProvider
impl Freeze for GenericProvider
impl Send for GenericProvider
impl Sync for GenericProvider
impl Unpin for GenericProvider
impl UnsafeUnpin for GenericProvider
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