pub struct OpenAIEmbedder { /* private fields */ }Expand description
OpenAI embedding client
Requires the openai feature to be enabled.
Supports OpenAI, OpenRouter, Azure OpenAI, and other OpenAI-compatible APIs.
Implementations§
Source§impl OpenAIEmbedder
impl OpenAIEmbedder
Sourcepub fn with_config(
api_key: String,
base_url: Option<String>,
model: Option<String>,
dimensions: Option<usize>,
) -> Self
pub fn with_config( api_key: String, base_url: Option<String>, model: Option<String>, dimensions: Option<usize>, ) -> Self
Create a new OpenAI embedder with custom settings
§Arguments
api_key- API key for authenticationbase_url- API base URL (e.g., “https://openrouter.ai/api/v1” for OpenRouter)model- Model name (e.g., “openai/text-embedding-3-small” for OpenRouter)dimensions- Expected embedding dimensions (must match model output)
Sourcepub fn with_model(api_key: String, model: String, dimensions: usize) -> Self
pub fn with_model(api_key: String, model: String, dimensions: usize) -> Self
Legacy constructor for backwards compatibility
Trait Implementations§
Source§impl Embedder for OpenAIEmbedder
Available on crate feature openai only.
impl Embedder for OpenAIEmbedder
Available on crate feature
openai only.Auto Trait Implementations§
impl Freeze for OpenAIEmbedder
impl !RefUnwindSafe for OpenAIEmbedder
impl Send for OpenAIEmbedder
impl Sync for OpenAIEmbedder
impl Unpin for OpenAIEmbedder
impl UnsafeUnpin for OpenAIEmbedder
impl !UnwindSafe for OpenAIEmbedder
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<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 moreCreates a shared type from an unshared type.