pub struct EmbeddingService { /* private fields */ }Expand description
Service for generating embeddings from spectrograms.
This is the main application service for the embedding bounded context. It coordinates between the model manager, ONNX inference, and domain entities.
Implementations§
Source§impl EmbeddingService
impl EmbeddingService
Sourcepub fn new(model_manager: Arc<ModelManager>, batch_size: usize) -> Self
pub fn new(model_manager: Arc<ModelManager>, batch_size: usize) -> Self
Create a new embedding service.
§Arguments
model_manager- The model manager for ONNX model accessbatch_size- Maximum batch size for inference
Sourcepub fn with_config(
model_manager: Arc<ModelManager>,
config: EmbeddingServiceConfig,
) -> Self
pub fn with_config( model_manager: Arc<ModelManager>, config: EmbeddingServiceConfig, ) -> Self
Create with custom configuration
Sourcepub async fn embed_segment(
&self,
spectrogram: &Spectrogram,
) -> Result<EmbeddingOutput, EmbeddingError>
pub async fn embed_segment( &self, spectrogram: &Spectrogram, ) -> Result<EmbeddingOutput, EmbeddingError>
Sourcepub async fn embed_batch(
&self,
spectrograms: &[Spectrogram],
) -> Result<Vec<EmbeddingOutput>, EmbeddingError>
pub async fn embed_batch( &self, spectrograms: &[Spectrogram], ) -> Result<Vec<EmbeddingOutput>, EmbeddingError>
Sourcepub fn create_batch(&self, segment_ids: Vec<SegmentId>) -> EmbeddingBatch
pub fn create_batch(&self, segment_ids: Vec<SegmentId>) -> EmbeddingBatch
Create a batch tracking object for monitoring progress.
Sourcepub fn model_version(&self) -> String
pub fn model_version(&self) -> String
Get the current model version being used.
Auto Trait Implementations§
impl Freeze for EmbeddingService
impl !RefUnwindSafe for EmbeddingService
impl Send for EmbeddingService
impl Sync for EmbeddingService
impl Unpin for EmbeddingService
impl !UnwindSafe for EmbeddingService
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 more