Skip to main content

AudioEmbeddingModel

Trait AudioEmbeddingModel 

Source
pub trait AudioEmbeddingModel: ModelInfo {
    // Required methods
    fn embed<'life0, 'async_trait>(
        &'life0 self,
        audios: Vec<AudioInput>,
    ) -> Pin<Box<dyn Future<Output = Result<EmbedResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn dimensions(&self) -> u32;

    // Provided method
    fn warmup<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

A model that produces dense vector embeddings from audio.

One vector is returned per input audio, each of dimension dimensions. Use cases include CLAP-style audio similarity, music tagging, and audio-text retrieval.

Required Methods§

Source

fn embed<'life0, 'async_trait>( &'life0 self, audios: Vec<AudioInput>, ) -> Pin<Box<dyn Future<Output = Result<EmbedResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Embed a batch of audio inputs.

§Errors

Returns an error if the provider cannot decode an input or runs out of memory.

Source

fn dimensions(&self) -> u32

The dimensionality of vectors produced by this model.

Provided Methods§

Source

fn warmup<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Optional warmup hook. The default is a no-op.

§Errors

Returns an error if the underlying model fails to initialize.

Implementors§