pub struct OpenRouterProvider { /* private fields */ }Expand description
OpenRouter LLM provider (OpenAI-compatible API).
Supports both non-streaming (complete) and streaming (stream_complete)
modes. Streaming uses OpenAI’s SSE format with choices[].delta chunks.
Implementations§
Trait Implementations§
Source§impl LlmProvider for OpenRouterProvider
impl LlmProvider for OpenRouterProvider
Source§async fn complete(
&self,
request: CompletionRequest,
) -> Result<CompletionResponse, Error>
async fn complete( &self, request: CompletionRequest, ) -> Result<CompletionResponse, Error>
Send a completion request and wait for the full response.
Source§async fn stream_complete(
&self,
request: CompletionRequest,
on_text: &OnText,
) -> Result<CompletionResponse, Error>
async fn stream_complete( &self, request: CompletionRequest, on_text: &OnText, ) -> Result<CompletionResponse, Error>
Stream a completion, calling
on_text for each text delta as it arrives. Read moreAuto Trait Implementations§
impl Freeze for OpenRouterProvider
impl !RefUnwindSafe for OpenRouterProvider
impl Send for OpenRouterProvider
impl Sync for OpenRouterProvider
impl Unpin for OpenRouterProvider
impl UnsafeUnpin for OpenRouterProvider
impl !UnwindSafe for OpenRouterProvider
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
Source§impl<P> DynLlmProvider for Pwhere
P: LlmProvider,
impl<P> DynLlmProvider for Pwhere
P: LlmProvider,
Source§fn complete<'a>(
&'a self,
request: CompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, Error>> + Send + 'a>>
fn complete<'a>( &'a self, request: CompletionRequest, ) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, Error>> + Send + 'a>>
Boxed-future version of
LlmProvider::complete for object-safe dispatch.Source§fn stream_complete<'a>(
&'a self,
request: CompletionRequest,
on_text: &'a (dyn Fn(&str) + Sync + Send + 'static),
) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, Error>> + Send + 'a>>
fn stream_complete<'a>( &'a self, request: CompletionRequest, on_text: &'a (dyn Fn(&str) + Sync + Send + 'static), ) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, Error>> + Send + 'a>>
Boxed-future version of
LlmProvider::stream_complete for object-safe dispatch.Source§fn model_name(&self) -> Option<&str>
fn model_name(&self) -> Option<&str>
Return the model identifier, if known.