Skip to main content

BatchCapable

Trait BatchCapable 

Source
pub trait BatchCapable: Model {
    // Provided methods
    fn extract_entities_batch(
        &self,
        texts: &[&str],
        language: Option<&str>,
    ) -> Result<Vec<Vec<Entity>>> { ... }
    fn optimal_batch_size(&self) -> Option<usize> { ... }
}
Expand description

Trait for models that support batch processing.

Models implementing this trait can process multiple texts efficiently, potentially using parallel processing or optimized batch operations.

Provided Methods§

Source

fn extract_entities_batch( &self, texts: &[&str], language: Option<&str>, ) -> Result<Vec<Vec<Entity>>>

Extract entities from multiple texts in a batch.

§Arguments
  • texts - Slice of text strings to process
  • language - Optional language hint for the texts
§Returns

A vector of entity vectors, one per input text

Source

fn optimal_batch_size(&self) -> Option<usize>

Get the optimal batch size for this model, if applicable.

Returns None if the model doesn’t have a specific optimal batch size, or Some(n) if there’s a recommended batch size for best performance.

Implementors§