pub struct EnhancedEmbeddings<'client, E>{ /* private fields */ }Expand description
Enhanced embeddings client with intelligent batching
Implementations§
Source§impl<'client, E> EnhancedEmbeddings<'client, E>
impl<'client, E> EnhancedEmbeddings<'client, E>
Sourcepub fn new(client: &'client Client<E>, config: BatchConfig) -> Self
pub fn new(client: &'client Client<E>, config: BatchConfig) -> Self
Create new enhanced embeddings client with custom batching config
Sourcepub fn with_default_batching(client: &'client Client<E>) -> Self
pub fn with_default_batching(client: &'client Client<E>) -> Self
Create new enhanced embeddings client with default batching
Sourcepub async fn create_direct(
&self,
request: CreateEmbeddingRequest,
) -> Result<CreateEmbeddingResponse>
pub async fn create_direct( &self, request: CreateEmbeddingRequest, ) -> Result<CreateEmbeddingResponse>
Create embeddings directly without batching (fallback method)
§Errors
Returns an error if the API request fails or if the response cannot be parsed.
Sourcepub async fn create_batched(
&self,
request: CreateEmbeddingRequest,
) -> Result<CreateEmbeddingResponse>
pub async fn create_batched( &self, request: CreateEmbeddingRequest, ) -> Result<CreateEmbeddingResponse>
Create embeddings with automatic batching optimization
§Errors
Returns an error if the request fails, batching fails, or if the response cannot be parsed.
Sourcepub async fn create_bulk(
&self,
texts: Vec<String>,
model: String,
) -> Result<Vec<CreateEmbeddingResponse>>
pub async fn create_bulk( &self, texts: Vec<String>, model: String, ) -> Result<Vec<CreateEmbeddingResponse>>
Create multiple embeddings with optimal batching
§Errors
Returns an error if any batch request fails or if responses cannot be parsed.
Sourcepub async fn get_metrics(&self) -> BatchMetrics
pub async fn get_metrics(&self) -> BatchMetrics
Get batching performance metrics
Sourcepub fn create_streaming(
&self,
texts: Vec<String>,
model: String,
) -> Result<Receiver<Result<CreateEmbeddingResponse, OpenAIError>>>
pub fn create_streaming( &self, texts: Vec<String>, model: String, ) -> Result<Receiver<Result<CreateEmbeddingResponse, OpenAIError>>>
Create streaming embeddings with batching
§Errors
Returns an error if the streaming setup fails or if channel creation fails.
Source§impl<E> EnhancedEmbeddings<'_, E>
impl<E> EnhancedEmbeddings<'_, E>
Sourcepub async fn flush_pending(&self)
pub async fn flush_pending(&self)
Flush all pending requests
Trait Implementations§
Source§impl<'client, E> Debug for EnhancedEmbeddings<'client, E>
impl<'client, E> Debug for EnhancedEmbeddings<'client, E>
Auto Trait Implementations§
impl<'client, E> Freeze for EnhancedEmbeddings<'client, E>
impl<'client, E> !RefUnwindSafe for EnhancedEmbeddings<'client, E>
impl<'client, E> Send for EnhancedEmbeddings<'client, E>
impl<'client, E> Sync for EnhancedEmbeddings<'client, E>
impl<'client, E> Unpin for EnhancedEmbeddings<'client, E>
impl<'client, E> !UnwindSafe for EnhancedEmbeddings<'client, E>
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
Source§impl<C, E> EntryToVal<C> for Ewhere
C: Collection<Entry = E>,
impl<C, E> EntryToVal<C> for Ewhere
C: Collection<Entry = E>,
Source§type Val = <C as Collection>::Val
type Val = <C as Collection>::Val
Entry in complex collections.
For example, in a HashMap, while Entry might be a ( key, value ) tuple, Val might only be the value part.Source§fn entry_to_val(self) -> <E as EntryToVal<C>>::Val
fn entry_to_val(self) -> <E as EntryToVal<C>>::Val
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> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<C, Val> ValToEntry<C> for Valwhere
C: CollectionValToEntry<Val>,
impl<C, Val> ValToEntry<C> for Valwhere
C: CollectionValToEntry<Val>,
Source§fn val_to_entry(self) -> <C as CollectionValToEntry<Val>>::Entry
fn val_to_entry(self) -> <C as CollectionValToEntry<Val>>::Entry
Invokes the val_to_entry function of the CollectionValToEntry trait to convert the value to an entry.
Source§type Entry = <C as CollectionValToEntry<Val>>::Entry
type Entry = <C as CollectionValToEntry<Val>>::Entry
Entry is defined by the Collection trait.