pub struct CohereAdapter { /* private fields */ }
Implementations§
Source§impl CohereAdapter
impl CohereAdapter
Sourcepub fn new() -> Result<Self, AiLibError>
pub fn new() -> Result<Self, AiLibError>
Create Cohere adapter. Requires COHERE_API_KEY env var.
Sourcepub fn with_transport(
transport: HttpTransport,
api_key: String,
base_url: String,
) -> Self
pub fn with_transport( transport: HttpTransport, api_key: String, base_url: String, ) -> Self
Create adapter with injectable transport (for testing)
Sourcepub fn with_transport_ref(
transport: DynHttpTransportRef,
api_key: String,
base_url: String,
) -> Self
pub fn with_transport_ref( transport: DynHttpTransportRef, api_key: String, base_url: String, ) -> Self
Construct using object-safe transport reference
Trait Implementations§
Source§impl ChatApi for CohereAdapter
impl ChatApi for CohereAdapter
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 CohereAdapter
impl !RefUnwindSafe for CohereAdapter
impl Send for CohereAdapter
impl Sync for CohereAdapter
impl Unpin for CohereAdapter
impl !UnwindSafe for CohereAdapter
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