pub struct OpenAIEmbedding { /* private fields */ }Expand description
OpenAI embedding provider
Implementations§
Source§impl OpenAIEmbedding
impl OpenAIEmbedding
Sourcepub fn with_model(self, model: impl Into<String>, dimension: usize) -> Self
pub fn with_model(self, model: impl Into<String>, dimension: usize) -> Self
Use a specific model
Trait Implementations§
Source§impl EmbeddingProvider for OpenAIEmbedding
impl EmbeddingProvider for OpenAIEmbedding
Source§fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate embedding for a single text
Source§fn embed_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Generate embeddings for multiple texts
Auto Trait Implementations§
impl Freeze for OpenAIEmbedding
impl !RefUnwindSafe for OpenAIEmbedding
impl Send for OpenAIEmbedding
impl Sync for OpenAIEmbedding
impl Unpin for OpenAIEmbedding
impl UnsafeUnpin for OpenAIEmbedding
impl !UnwindSafe for OpenAIEmbedding
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