pub struct GenericAdapter { /* private fields */ }
Expand description
配置驱动的通用适配器,支持OpenAI兼容API
Configuration-driven generic adapter for OpenAI-compatible APIs
Implementations§
Source§impl GenericAdapter
impl GenericAdapter
pub fn new(config: ProviderConfig) -> Result<Self, AiLibError>
Sourcepub fn with_transport(
config: ProviderConfig,
transport: HttpTransport,
) -> Result<Self, AiLibError>
pub fn with_transport( config: ProviderConfig, transport: HttpTransport, ) -> Result<Self, AiLibError>
Create adapter with custom transport layer (for testing)
Sourcepub fn with_transport_ref(
config: ProviderConfig,
transport: DynHttpTransportRef,
) -> Result<Self, AiLibError>
pub fn with_transport_ref( config: ProviderConfig, transport: DynHttpTransportRef, ) -> Result<Self, AiLibError>
Accept an object-safe transport reference directly
Trait Implementations§
Source§impl ChatApi for GenericAdapter
impl ChatApi for GenericAdapter
Source§fn chat_completion<'life0, 'async_trait>(
&'life0 self,
request: ChatCompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatCompletionResponse, AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chat_completion<'life0, 'async_trait>(
&'life0 self,
request: ChatCompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatCompletionResponse, AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send chat completion request Read more
Source§fn chat_completion_stream<'life0, 'async_trait>(
&'life0 self,
request: ChatCompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Result<ChatCompletionChunk, AiLibError>> + Send + Unpin>, AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chat_completion_stream<'life0, 'async_trait>(
&'life0 self,
request: ChatCompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Result<ChatCompletionChunk, AiLibError>> + Send + Unpin>, AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Streaming chat completion request Read more
Auto Trait Implementations§
impl Freeze for GenericAdapter
impl !RefUnwindSafe for GenericAdapter
impl Send for GenericAdapter
impl Sync for GenericAdapter
impl Unpin for GenericAdapter
impl !UnwindSafe for GenericAdapter
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