agents.rag.simple.enhanced_v3.state¶
Enhanced RAG State Schema for SimpleRAG V3.
This module provides enhanced state management for SimpleRAG using Enhanced MultiAgent V3 with performance tracking, debug information, and comprehensive metadata.
Classes¶
Debug information for generation operations. |
|
Metadata for RAG operations. |
|
Debug information for retrieval operations. |
|
Enhanced state schema for SimpleRAG V3 pipeline. |
Module Contents¶
- class agents.rag.simple.enhanced_v3.state.GenerationDebugInfo(/, **data)¶
Bases:
pydantic.BaseModel
Debug information for generation operations.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class agents.rag.simple.enhanced_v3.state.RAGMetadata(/, **data)¶
Bases:
pydantic.BaseModel
Metadata for RAG operations.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class agents.rag.simple.enhanced_v3.state.RetrievalDebugInfo(/, **data)¶
Bases:
pydantic.BaseModel
Debug information for retrieval operations.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class agents.rag.simple.enhanced_v3.state.SimpleRAGState(/, **data)¶
Bases:
haive.core.schema.state_schema.StateSchema
Enhanced state schema for SimpleRAG V3 pipeline.
This state schema extends the basic StateSchema with RAG-specific fields and enhanced tracking capabilities when performance_mode or debug_mode are enabled.
- Core RAG Fields:
query: User query string
retrieved_documents: Documents from retrieval step
generated_answer: Final answer from generation step
- Enhanced Tracking (when enabled):
retrieval_metadata: Retrieval operation metadata
generation_metadata: Generation operation metadata
performance_metrics: Performance tracking data
debug_info: Detailed debug information
Examples
Basic usage (automatic schema selection):
# Enhanced features disabled - uses basic fields only state = SimpleRAGState(query="What is AI?")
Enhanced usage:
# Enhanced features enabled - includes all tracking state = SimpleRAGState( query="What is AI?", retrieval_metadata=RAGMetadata( timing_info={"retrieval_time": 0.5} ), debug_mode=True )
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- add_generation_debug(context_length=None, prompt_tokens=None, completion_tokens=None, generation_time=None, **kwargs)¶
Add generation debug information.
- add_retrieval_debug(query_vector_dim=None, search_time=None, total_documents=None, similarity_scores=None, **kwargs)¶
Add retrieval debug information.
- update_performance_metric(metric_name, value)¶
Update a performance metric.