Documentation
¶
Index ¶
- func WriteMetricsSnapshot(metrics SearchMetrics) (string, error)
- type ComparisonMetrics
- type Engine
- func (e *Engine) Bindings(label string) string
- func (e *Engine) Explain(label string) string
- func (e *Engine) FindNode(term string) (types.Node, bool)
- func (e *Engine) Graph() *types.Graph
- func (e *Engine) Neighbors(label string) ([]Neighbor, error)
- func (e *Engine) NodeByID(id string) (types.Node, bool)
- func (e *Engine) Path(fromLabel, toLabel string) string
- func (e *Engine) Query(input string) string
- func (e *Engine) Route(input string) string
- func (e *Engine) Search(term string, limit int) []types.Node
- func (e *Engine) Stats() GraphStats
- type GraphStats
- type Neighbor
- type SearchHit
- type SearchMetrics
- type SearchProfile
- type SearchProvenance
- type SearchResponse
- type SearchRoute
- type SearchRouting
- type SearchRun
- type Searcher
- type StrategyMetrics
- type SupportEdge
- type SupportGraph
- type SupportNode
- type VectorRuntime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteMetricsSnapshot ¶ added in v1.4.0
func WriteMetricsSnapshot(metrics SearchMetrics) (string, error)
WriteMetricsSnapshot persists one retrieval comparison under ~/.vela/retrieval-history.
Types ¶
type ComparisonMetrics ¶ added in v1.4.0
type ComparisonMetrics struct {
OverlapAtK int `json:"overlap_at_k"`
OverlapRatio float64 `json:"overlap_ratio"`
AddedByFederated int `json:"added_by_federated"`
AddedBySource map[string]int `json:"added_by_source"`
AncoraLatencyGap int64 `json:"ancora_latency_gap_ms"`
GraphLatencyMs int64 `json:"graph_latency_ms"`
}
ComparisonMetrics highlights what federated retrieval changed vs the Ancora baseline.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine wraps a loaded graph and answers queries against it.
func LoadFromFile ¶
LoadFromFile reads graph.json and constructs a query Engine.
func (*Engine) Bindings ¶ added in v1.4.0
Bindings returns queryable memory reference binder state for the given node.
func (*Engine) FindNode ¶ added in v1.5.0
FindNode resolves a node by ID, exact label, or fuzzy label match.
func (*Engine) Neighbors ¶ added in v1.5.0
Neighbors returns all incoming and outgoing edges for the given node.
func (*Engine) Path ¶
Path finds the shortest directed path from nodeA to nodeB. Returns a human-readable string.
func (*Engine) Stats ¶ added in v1.5.0
func (e *Engine) Stats() GraphStats
Stats returns a structured graph summary.
type GraphStats ¶ added in v1.5.0
type GraphStats struct {
NodeCount int
EdgeCount int
CommunityCount int
NodeTypes map[string]int
ConfidenceTypes map[string]int
}
GraphStats summarizes the graph contents for diagnostics and MCP output.
type Neighbor ¶ added in v1.5.0
Neighbor describes a directly connected node and the edge relating it.
type SearchHit ¶ added in v1.4.0
type SearchHit struct {
ID string `json:"id"`
CanonicalID string `json:"canonical_id,omitempty"`
Label string `json:"label"`
Kind string `json:"kind,omitempty"`
Path string `json:"path,omitempty"`
Snippet string `json:"snippet,omitempty"`
Support []string `json:"support,omitempty"`
SupportGraph *SupportGraph `json:"support_graph,omitempty"`
Score float64 `json:"score"`
PrimarySource string `json:"primary_source"`
PrimaryLayer string `json:"primary_layer,omitempty"`
Sources []string `json:"sources"`
Layers []string `json:"layers,omitempty"`
Contributions map[string]float64 `json:"contributions,omitempty"`
Signals map[string]float64 `json:"signals,omitempty"`
LayerContributions map[string]float64 `json:"layer_contributions,omitempty"`
Provenance []SearchProvenance `json:"provenance,omitempty"`
}
SearchHit is a ranked retrieval result.
type SearchMetrics ¶ added in v1.4.0
type SearchMetrics struct {
GeneratedAt string `json:"generated_at"`
Query string `json:"query"`
Limit int `json:"limit"`
AncoraOnly StrategyMetrics `json:"ancora_only"`
Federated StrategyMetrics `json:"federated"`
Comparison ComparisonMetrics `json:"comparison"`
VectorRuntime *VectorRuntime `json:"vector_runtime,omitempty"`
}
SearchMetrics records the baseline and federated retrieval comparison for one query.
type SearchProfile ¶ added in v1.4.0
type SearchProfile string
SearchProfile selects which retrieval stack to run.
const ( SearchProfileFederated SearchProfile = "federated" SearchProfileAncora SearchProfile = "ancora" SearchProfileGraph SearchProfile = "graph" SearchProfileGraphHybrid SearchProfile = "graph-hybrid" SearchProfileLexical SearchProfile = "lexical" SearchProfileStructural SearchProfile = "structural" SearchProfileVector SearchProfile = "vector" )
type SearchProvenance ¶ added in v1.4.0
type SearchResponse ¶ added in v1.4.0
type SearchResponse struct {
Query string `json:"query"`
Hits []SearchHit `json:"hits"`
Routing SearchRouting `json:"routing,omitempty"`
Metrics SearchMetrics `json:"metrics"`
}
SearchResponse is the federated result set plus comparison metrics.
type SearchRoute ¶ added in v1.4.0
type SearchRouting ¶ added in v1.4.0
type SearchRouting struct {
Tokens []string `json:"tokens,omitempty"`
RoutedRepos []SearchRoute `json:"routed_repos,omitempty"`
Fallback bool `json:"fallback"`
}
type SearchRun ¶ added in v1.4.0
type SearchRun struct {
Profile SearchProfile `json:"profile"`
Query string `json:"query"`
Hits []SearchHit `json:"hits"`
Metrics StrategyMetrics `json:"metrics"`
}
SearchRun is one retrieval execution for a selected profile.
type Searcher ¶ added in v1.4.0
type Searcher struct {
// contains filtered or unexported fields
}
Searcher runs Ancora-only and federated retrieval against the current graph.
func NewSearcher ¶ added in v1.4.0
NewSearcher wires a graph engine with an optional Ancora DB path.
func (*Searcher) RunProfile ¶ added in v1.4.0
RunProfile runs one selected retrieval stack for evaluation/benchmarking.
func (*Searcher) Search ¶ added in v1.4.0
func (s *Searcher) Search(input string, limit int) (SearchResponse, error)
Search returns federated results and baseline comparison metrics.
func (*Searcher) WithTraversal ¶ added in v1.4.0
func (s *Searcher) WithTraversal(opts retrieval.TraversalOptions) *Searcher
WithTraversal updates graph traversal controls for graph-side search.
type StrategyMetrics ¶ added in v1.4.0
type StrategyMetrics struct {
LatencyMs int64 `json:"latency_ms"`
Candidates int `json:"candidates"`
Returned int `json:"returned"`
SourceContribution map[string]int `json:"source_contribution"`
SignalContribution map[string]int `json:"signal_contribution,omitempty"`
RankingComposition []string `json:"ranking_composition"`
DistinctKinds int `json:"distinct_kinds"`
HybridResults int `json:"hybrid_results,omitempty"`
}
StrategyMetrics captures signals that matter when comparing retrieval modes.
type SupportEdge ¶ added in v1.4.0
type SupportEdge struct {
FromID string `json:"from_id"`
ToID string `json:"to_id"`
Relation string `json:"relation"`
Direction string `json:"direction,omitempty"`
Hop int `json:"hop,omitempty"`
EvidenceType string `json:"evidence_type,omitempty"`
SourceArtifact string `json:"source_artifact,omitempty"`
Confidence string `json:"confidence,omitempty"`
Verification string `json:"verification,omitempty"`
}
SupportEdge is one supporting edge in a result subgraph.
type SupportGraph ¶ added in v1.4.0
type SupportGraph struct {
Nodes []SupportNode `json:"nodes,omitempty"`
Edges []SupportEdge `json:"edges,omitempty"`
}
SupportGraph is a compact structured subgraph attached to a hit.
type SupportNode ¶ added in v1.4.0
type SupportNode struct {
ID string `json:"id"`
Label string `json:"label"`
Kind string `json:"kind,omitempty"`
Path string `json:"path,omitempty"`
}
SupportNode is one supporting node in a result subgraph.
type VectorRuntime ¶ added in v1.4.0
type VectorRuntime struct {
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
SearchMode string `json:"search_mode,omitempty"`
IndexBackend string `json:"index_backend,omitempty"`
RequestedBackend string `json:"requested_backend,omitempty"`
SQLiteVecEnabled bool `json:"sqlite_vec_enabled,omitempty"`
SQLiteVecReason string `json:"sqlite_vec_reason,omitempty"`
EmbeddingDims int `json:"embedding_dims,omitempty"`
}