pub struct RagEngine { /* private fields */ }
Expand description
RAG engine for enhanced data generation
Implementations§
Source§impl RagEngine
impl RagEngine
Sourcepub fn add_document(
&mut self,
content: String,
metadata: HashMap<String, Value>,
) -> Result<String>
pub fn add_document( &mut self, content: String, metadata: HashMap<String, Value>, ) -> Result<String>
Add a document to the knowledge base
Sourcepub fn add_schema(&mut self, schema: &SchemaDefinition) -> Result<()>
pub fn add_schema(&mut self, schema: &SchemaDefinition) -> Result<()>
Add schema information to knowledge base
Sourcepub async fn generate_with_rag(
&self,
schema: &SchemaDefinition,
config: &DataConfig,
) -> Result<Vec<Value>>
pub async fn generate_with_rag( &self, schema: &SchemaDefinition, config: &DataConfig, ) -> Result<Vec<Value>>
Generate data using RAG-augmented prompts
Sourcepub fn keyword_search(&self, query: &str, limit: usize) -> Vec<&DocumentChunk>
pub fn keyword_search(&self, query: &str, limit: usize) -> Vec<&DocumentChunk>
Perform keyword-based search (fallback)
Sourcepub async fn compute_embeddings(&mut self) -> Result<()>
pub async fn compute_embeddings(&mut self) -> Result<()>
Compute embeddings for all document chunks
Sourcepub fn update_config(&mut self, config: RagConfig)
pub fn update_config(&mut self, config: RagConfig)
Update RAG configuration
Sourcepub fn chunk_count(&self) -> usize
pub fn chunk_count(&self) -> usize
Get number of indexed chunks
Sourcepub fn schema_count(&self) -> usize
pub fn schema_count(&self) -> usize
Get number of indexed schemas
Sourcepub fn get_chunk(&self, index: usize) -> Option<&DocumentChunk>
pub fn get_chunk(&self, index: usize) -> Option<&DocumentChunk>
Get chunk by index
Sourcepub fn has_schema(&self, name: &str) -> bool
pub fn has_schema(&self, name: &str) -> bool
Check if schema exists in knowledge base
Sourcepub async fn generate_text(&self, prompt: &str) -> Result<String>
pub async fn generate_text(&self, prompt: &str) -> Result<String>
Generate text using LLM (for intelligent mock generation)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RagEngine
impl !RefUnwindSafe for RagEngine
impl Send for RagEngine
impl Sync for RagEngine
impl Unpin for RagEngine
impl !UnwindSafe for RagEngine
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