Skip to main content

StreamingCapable

Trait StreamingCapable 

Source
pub trait StreamingCapable: Model {
    // Provided methods
    fn extract_entities_streaming(
        &self,
        chunk: &str,
        offset: usize,
    ) -> Result<Vec<Entity>, Error> { ... }
    fn recommended_chunk_size(&self) -> usize { ... }
}
Expand description

Trait for models that support streaming/chunked extraction.

Useful for processing very long documents by splitting them into chunks and extracting entities from each chunk with proper offset tracking.

Provided Methods§

Source

fn extract_entities_streaming( &self, chunk: &str, offset: usize, ) -> Result<Vec<Entity>, Error>

Extract entities from a chunk of text, adjusting offsets by the chunk’s position.

§Arguments
  • chunk - A portion of the full document text
  • offset - Character offset of this chunk within the full document
§Returns

Entities with offsets adjusted to their position in the full document.

Source

fn recommended_chunk_size(&self) -> usize

Get the recommended chunk size for streaming extraction.

Returns the optimal number of characters per chunk for this model. Default implementation returns 10,000 characters.

Implementors§