Documentation
¶
Index ¶
- type ActionType
- type AgentAction
- type AgentActionSelector
- type AgentReasoner
- type AgenticMetadata
- type CRAGEvaluation
- type CRAGEvaluator
- type CRAGLabel
- type DecompositionResult
- type EntityExtractionResult
- type EntityExtractor
- type FilterExtractor
- type FusionEngine
- type GenerationResult
- type Generator
- type GraphGlobalSearcher
- type GraphLocalSearcher
- type HyDEGenerator
- type IntentClassifier
- type IntentResult
- type IntentType
- type QueryDecomposer
- type QueryRewriter
- type RAGEScores
- type RAGEvaluator
- type ResultEnhancer
- type RetrievalResult
- type Retriever
- type StepBackGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
type ActionType string
ActionType is the decision made by the Agentic reasoner on each iteration.
const ( ActionRetrieve ActionType = "retrieve" ActionReflect ActionType = "reflect" ActionFinish ActionType = "finish" )
type AgentAction ¶
type AgentAction struct {
Type ActionType // which branch to execute next
Query string // refined sub-query for the retrieve action (empty for reflect/finish)
}
AgentAction is the output of the action-selection step.
type AgentActionSelector ¶
type AgentActionSelector interface {
SelectAction(ctx context.Context, query, reasoning string, iteration, maxIterations int) (*AgentAction, error)
}
AgentActionSelector chooses the next action (retrieve / reflect / finish) based on the reasoning trace and the current iteration count relative to the allowed maximum.
type AgentReasoner ¶
type AgentReasoner interface {
Reason(ctx context.Context, query string, retrieved [][]*entity.Chunk, answer string) (reasoning string, err error)
}
AgentReasoner analyses the current retrieval state and returns a natural-language reasoning trace that summarises what has been found and what is still missing.
type AgenticMetadata ¶
type AgenticMetadata = entity.AgenticMetadata
AgenticMetadata is an alias for entity.AgenticMetadata. All methods (Validate, MergeToQuery, LoadFromQuery, SetCacheHit, GetCacheHit) are defined on entity.AgenticMetadata. Use entity.AgenticMetadata directly.
func NewAgenticMetadata ¶
func NewAgenticMetadata() *AgenticMetadata
NewAgenticMetadata creates a new AgenticMetadata instance.
type CRAGEvaluation ¶
CRAGEvaluation holds the result of CRAG quality evaluation.
type CRAGEvaluator ¶
type CRAGEvaluator interface {
Evaluate(ctx context.Context, query *entity.Query, chunks []*entity.Chunk) (*CRAGEvaluation, error)
}
CRAGEvaluator evaluates the quality of retrieved context.
type DecompositionResult ¶
DecompositionResult holds the result of query decomposition.
type EntityExtractionResult ¶
type EntityExtractionResult struct {
Entities []string
}
EntityExtractionResult holds the result of entity extraction.
type EntityExtractor ¶
type EntityExtractor interface {
Extract(ctx context.Context, query *entity.Query) (*EntityExtractionResult, error)
}
EntityExtractor extracts entities from queries.
type FilterExtractor ¶
type FilterExtractor interface {
ExtractFilters(ctx context.Context, query *entity.Query) (map[string]any, error)
}
FilterExtractor uses LLM or rules to extract hard metadata constraints from natural language.
type FusionEngine ¶
type FusionEngine interface {
// ReciprocalRankFusion (RRF) merges results from different modalities
// (e.g., Sparse + Dense, or Vector + Graph) and re-ranks them based on their reciprocal positions.
ReciprocalRankFusion(ctx context.Context, resultSets [][]*entity.Chunk, topK int) ([]*entity.Chunk, error)
}
FusionEngine is responsible for merging multiple retrieval streams.
type GenerationResult ¶
type GenerationResult struct {
Answer string
}
GenerationResult holds the generated answer.
type Generator ¶
type Generator interface {
Generate(ctx context.Context, query *entity.Query, chunks []*entity.Chunk) (*GenerationResult, error)
}
Generator generates answers based on query and retrieved context.
type GraphGlobalSearcher ¶
type GraphGlobalSearcher interface {
// Search performs a Map-Reduce over community summaries at a specific hierarchical level.
Search(ctx context.Context, query string, communityLevel int) (string, error)
}
GraphGlobalSearcher utilizes Community Detection summaries to answer macro-level questions.
type GraphLocalSearcher ¶
type GraphLocalSearcher interface {
// Search returns a textual description of the N-Hop relationship sub-graph.
Search(ctx context.Context, entities []string, maxHops int, topK int) (string, error)
}
GraphLocalSearcher performs Entity-Centric N-Hop search in the GraphStore.
type HyDEGenerator ¶
type HyDEGenerator interface {
GenerateHypotheticalDocument(ctx context.Context, query *entity.Query) (*entity.Document, error)
}
HyDEGenerator generates hypothetical documents to improve dense vector matching.
type IntentClassifier ¶
type IntentClassifier interface {
Classify(ctx context.Context, query *entity.Query) (*IntentResult, error)
}
IntentClassifier classifies user queries into different intents.
type IntentResult ¶
type IntentResult struct {
Intent IntentType
Confidence float32
Reason string
}
IntentResult holds the result of intent classification.
type IntentType ¶
type IntentType string
IntentType represents the classified intent of a query.
const ( IntentChat IntentType = "chat" IntentDomainSpecific IntentType = "domain_specific" IntentFactCheck IntentType = "fact_check" )
type QueryDecomposer ¶
type QueryDecomposer interface {
Decompose(ctx context.Context, query *entity.Query) (*DecompositionResult, error)
}
QueryDecomposer breaks down complex queries into simpler sub-queries.
type QueryRewriter ¶
type QueryRewriter interface {
Rewrite(ctx context.Context, query *entity.Query) (*entity.Query, error)
}
QueryRewriter optimizes the user's raw query (e.g., coreference resolution).
type RAGEScores ¶
type RAGEScores = entity.RAGEScores
RAGEScores is an alias for entity.RAGEScores. All score fields are defined on entity.RAGEScores as the single source of truth.
type RAGEvaluator ¶
type RAGEvaluator interface {
Evaluate(ctx context.Context, query, answer, context string) (*RAGEScores, error)
}
RAGEvaluator evaluates the quality of generated answers.
type ResultEnhancer ¶
type ResultEnhancer interface {
Enhance(ctx context.Context, results *entity.RetrievalResult) (*entity.RetrievalResult, error)
}
ResultEnhancer enhances retrieval results (e.g., reranking, pruning, expansion).
type RetrievalResult ¶
RetrievalResult holds the result of retrieval.