pub struct OpenRouterClient { /* private fields */ }Expand description
Open router client.
Implementations§
Source§impl OpenRouterClient
impl OpenRouterClient
Sourcepub fn new(
api_key: SecretBox<String>,
model: String,
dim: usize,
) -> Result<Self, AppError>
pub fn new( api_key: SecretBox<String>, model: String, dim: usize, ) -> Result<Self, AppError>
Create a new instance.
Sourcepub fn new_with_base_url(
api_key: SecretBox<String>,
model: String,
dim: usize,
base_url: String,
) -> Result<Self, AppError>
pub fn new_with_base_url( api_key: SecretBox<String>, model: String, dim: usize, base_url: String, ) -> Result<Self, AppError>
Build a client posting to an explicit base_url (XDG override, tests, gateways).
Sourcepub fn default_input_type(&self) -> Option<&'static str>
pub fn default_input_type(&self) -> Option<&'static str>
Default input type.
Sourcepub async fn embed_single(
&self,
text: &str,
input_type: Option<&str>,
) -> Result<Vec<f32>, EmbedError>
pub async fn embed_single( &self, text: &str, input_type: Option<&str>, ) -> Result<Vec<f32>, EmbedError>
Embed single.
Sourcepub async fn embed_batch(
&self,
texts: &[&str],
input_type: Option<&str>,
) -> Result<Vec<Vec<f32>>, EmbedError>
pub async fn embed_batch( &self, texts: &[&str], input_type: Option<&str>, ) -> Result<Vec<Vec<f32>>, EmbedError>
Embed batch.
Auto Trait Implementations§
impl !RefUnwindSafe for OpenRouterClient
impl !UnwindSafe for OpenRouterClient
impl Freeze for OpenRouterClient
impl Send for OpenRouterClient
impl Sync for OpenRouterClient
impl Unpin for OpenRouterClient
impl UnsafeUnpin for OpenRouterClient
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more