pub struct OpenAiAdapter { /* private fields */ }
Expand description
OpenAI适配器,支持GPT系列模型
OpenAI adapter supporting GPT series models
Implementations§
Source§impl OpenAiAdapter
impl OpenAiAdapter
pub fn new() -> Result<Self, AiLibError>
Sourcepub fn with_transport_ref(
transport: DynHttpTransportRef,
api_key: String,
base_url: String,
) -> Result<Self, AiLibError>
pub fn with_transport_ref( transport: DynHttpTransportRef, api_key: String, base_url: String, ) -> Result<Self, AiLibError>
Construct with an injected object-safe transport reference
Trait Implementations§
Source§impl ChatApi for OpenAiAdapter
impl ChatApi for OpenAiAdapter
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 OpenAiAdapter
impl !RefUnwindSafe for OpenAiAdapter
impl Send for OpenAiAdapter
impl Sync for OpenAiAdapter
impl Unpin for OpenAiAdapter
impl !UnwindSafe for OpenAiAdapter
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