pub struct ChatClient<'a> { /* private fields */ }Expand description
Domain client for chat completions.
Implementations§
Source§impl<'a> ChatClient<'a>
impl<'a> ChatClient<'a>
Sourcepub async fn create(
&self,
request: &ChatCompletionRequest,
) -> Result<CompletionsResponse, OpenRouterError>
pub async fn create( &self, request: &ChatCompletionRequest, ) -> Result<CompletionsResponse, OpenRouterError>
Create a chat completion (POST /chat/completions).
Sourcepub async fn stream(
&self,
request: &ChatCompletionRequest,
) -> Result<BoxStream<'static, Result<CompletionsResponse, OpenRouterError>>, OpenRouterError>
pub async fn stream( &self, request: &ChatCompletionRequest, ) -> Result<BoxStream<'static, Result<CompletionsResponse, OpenRouterError>>, OpenRouterError>
Stream chat completion chunks.
Sourcepub async fn stream_tool_aware(
&self,
request: &ChatCompletionRequest,
) -> Result<ToolAwareStream, OpenRouterError>
pub async fn stream_tool_aware( &self, request: &ChatCompletionRequest, ) -> Result<ToolAwareStream, OpenRouterError>
Stream chat completion chunks with tool-call-aware aggregation.
Sourcepub async fn stream_unified(
&self,
request: &ChatCompletionRequest,
) -> Result<UnifiedStream, OpenRouterError>
pub async fn stream_unified( &self, request: &ChatCompletionRequest, ) -> Result<UnifiedStream, OpenRouterError>
Stream chat events using the unified stream abstraction.
Trait Implementations§
Source§impl<'a> Clone for ChatClient<'a>
impl<'a> Clone for ChatClient<'a>
Source§fn clone(&self) -> ChatClient<'a>
fn clone(&self) -> ChatClient<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for ChatClient<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ChatClient<'a>
impl<'a> !UnwindSafe for ChatClient<'a>
impl<'a> Freeze for ChatClient<'a>
impl<'a> Send for ChatClient<'a>
impl<'a> Sync for ChatClient<'a>
impl<'a> Unpin for ChatClient<'a>
impl<'a> UnsafeUnpin for ChatClient<'a>
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