pub trait RAGEngine: Send + Sync {
// Required methods
fn initialize<'life0, 'async_trait>(
&'life0 self,
config: RAGConfig,
) -> Pin<Box<dyn Future<Output = Result<(), RAGError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn process_query<'life0, 'async_trait>(
&'life0 self,
request: RAGRequest,
) -> Pin<Box<dyn Future<Output = Result<RAGResponse, RAGError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn analyze_query<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
context: Option<AgentContext>,
) -> Pin<Box<dyn Future<Output = Result<AnalyzedQuery, RAGError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn retrieve_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 AnalyzedQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, RAGError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn rank_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
documents: Vec<Document>,
query: &'life1 AnalyzedQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<RankedDocument>, RAGError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn augment_context<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 AnalyzedQuery,
documents: Vec<RankedDocument>,
) -> Pin<Box<dyn Future<Output = Result<AugmentedContext, RAGError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn generate_response<'life0, 'async_trait>(
&'life0 self,
context: AugmentedContext,
) -> Pin<Box<dyn Future<Output = Result<GeneratedResponse, RAGError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn validate_response<'life0, 'life1, 'async_trait>(
&'life0 self,
response: &'life1 GeneratedResponse,
agent_id: AgentId,
) -> Pin<Box<dyn Future<Output = Result<ValidationResult, RAGError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn ingest_documents<'life0, 'async_trait>(
&'life0 self,
documents: Vec<DocumentInput>,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentId>, RAGError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_document<'life0, 'async_trait>(
&'life0 self,
document_id: DocumentId,
document: DocumentInput,
) -> Pin<Box<dyn Future<Output = Result<(), RAGError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete_document<'life0, 'async_trait>(
&'life0 self,
document_id: DocumentId,
) -> Pin<Box<dyn Future<Output = Result<(), RAGError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<RAGStats, RAGError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
RAG Engine trait defining the core RAG pipeline operations
Required Methods§
Sourcefn initialize<'life0, 'async_trait>(
&'life0 self,
config: RAGConfig,
) -> Pin<Box<dyn Future<Output = Result<(), RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 self,
config: RAGConfig,
) -> Pin<Box<dyn Future<Output = Result<(), RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initialize the RAG engine with configuration
Sourcefn process_query<'life0, 'async_trait>(
&'life0 self,
request: RAGRequest,
) -> Pin<Box<dyn Future<Output = Result<RAGResponse, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process_query<'life0, 'async_trait>(
&'life0 self,
request: RAGRequest,
) -> Pin<Box<dyn Future<Output = Result<RAGResponse, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Process a complete RAG query through the pipeline
Sourcefn analyze_query<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
context: Option<AgentContext>,
) -> Pin<Box<dyn Future<Output = Result<AnalyzedQuery, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn analyze_query<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
context: Option<AgentContext>,
) -> Pin<Box<dyn Future<Output = Result<AnalyzedQuery, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Analyze and expand the input query
Sourcefn retrieve_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 AnalyzedQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn retrieve_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 AnalyzedQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve relevant documents from the knowledge base
Sourcefn rank_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
documents: Vec<Document>,
query: &'life1 AnalyzedQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<RankedDocument>, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn rank_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
documents: Vec<Document>,
query: &'life1 AnalyzedQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<RankedDocument>, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Rank documents by relevance and other factors
Sourcefn augment_context<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 AnalyzedQuery,
documents: Vec<RankedDocument>,
) -> Pin<Box<dyn Future<Output = Result<AugmentedContext, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn augment_context<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 AnalyzedQuery,
documents: Vec<RankedDocument>,
) -> Pin<Box<dyn Future<Output = Result<AugmentedContext, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Augment context with retrieved information
Sourcefn generate_response<'life0, 'async_trait>(
&'life0 self,
context: AugmentedContext,
) -> Pin<Box<dyn Future<Output = Result<GeneratedResponse, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn generate_response<'life0, 'async_trait>(
&'life0 self,
context: AugmentedContext,
) -> Pin<Box<dyn Future<Output = Result<GeneratedResponse, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate response using augmented context (mock implementation)
Sourcefn validate_response<'life0, 'life1, 'async_trait>(
&'life0 self,
response: &'life1 GeneratedResponse,
agent_id: AgentId,
) -> Pin<Box<dyn Future<Output = Result<ValidationResult, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn validate_response<'life0, 'life1, 'async_trait>(
&'life0 self,
response: &'life1 GeneratedResponse,
agent_id: AgentId,
) -> Pin<Box<dyn Future<Output = Result<ValidationResult, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Validate response for policy compliance
Sourcefn ingest_documents<'life0, 'async_trait>(
&'life0 self,
documents: Vec<DocumentInput>,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentId>, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn ingest_documents<'life0, 'async_trait>(
&'life0 self,
documents: Vec<DocumentInput>,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentId>, RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add documents to the knowledge base
Sourcefn update_document<'life0, 'async_trait>(
&'life0 self,
document_id: DocumentId,
document: DocumentInput,
) -> Pin<Box<dyn Future<Output = Result<(), RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_document<'life0, 'async_trait>(
&'life0 self,
document_id: DocumentId,
document: DocumentInput,
) -> Pin<Box<dyn Future<Output = Result<(), RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update document in knowledge base
Sourcefn delete_document<'life0, 'async_trait>(
&'life0 self,
document_id: DocumentId,
) -> Pin<Box<dyn Future<Output = Result<(), RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_document<'life0, 'async_trait>(
&'life0 self,
document_id: DocumentId,
) -> Pin<Box<dyn Future<Output = Result<(), RAGError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete document from knowledge base