pub struct ContextBuilder { /* private fields */ }Expand description
Context builder for generating text chunks from entities
Implementations§
Source§impl ContextBuilder
impl ContextBuilder
Sourcepub fn new(config: ChunkingConfig) -> Self
pub fn new(config: ChunkingConfig) -> Self
Create a new context builder with configuration
Sourcepub fn build_entity_context<T: RagEntity>(&self, entity: &T) -> String
pub fn build_entity_context<T: RagEntity>(&self, entity: &T) -> String
Build context from a single entity
Sourcepub fn build_graph_context<T: RagEntity>(
&self,
root_entity: &T,
related_contexts: Vec<String>,
) -> String
pub fn build_graph_context<T: RagEntity>( &self, root_entity: &T, related_contexts: Vec<String>, ) -> String
Build context from entity with its relationships
Sourcepub fn chunk_text(&self, text: &str) -> Vec<TextChunk>
pub fn chunk_text(&self, text: &str) -> Vec<TextChunk>
Chunk a long text into overlapping segments
Sourcepub fn build_and_chunk<T: RagEntity>(&self, entity: &T) -> Vec<TextChunk>
pub fn build_and_chunk<T: RagEntity>(&self, entity: &T) -> Vec<TextChunk>
Build and chunk context from a single entity
Sourcepub fn build_and_chunk_graph<T: RagEntity>(
&self,
root_entity: &T,
related_contexts: Vec<String>,
) -> Vec<TextChunk>
pub fn build_and_chunk_graph<T: RagEntity>( &self, root_entity: &T, related_contexts: Vec<String>, ) -> Vec<TextChunk>
Build and chunk context from entity graph
Sourcepub fn build_multi_entity_context<T: RagEntity>(&self, entities: &[T]) -> String
pub fn build_multi_entity_context<T: RagEntity>(&self, entities: &[T]) -> String
Build multiple entity contexts and merge them
Sourcepub fn get_chunk_stats(&self, text: &str) -> ChunkStats
pub fn get_chunk_stats(&self, text: &str) -> ChunkStats
Get chunk statistics
Auto Trait Implementations§
impl Freeze for ContextBuilder
impl RefUnwindSafe for ContextBuilder
impl Send for ContextBuilder
impl Sync for ContextBuilder
impl Unpin for ContextBuilder
impl UnwindSafe for ContextBuilder
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