Skip to content

Commit fbb2c5d

Browse files
committed
fix: clamp overly aggressive edge_rank_threshold to preserve evidence
1 parent 71c9fdc commit fbb2c5d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/kg_agent_loop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ def _tool_declarations(self) -> list[types.Tool]:
621621
"Hybrid Graph-RAG: vector/fulltext seed search over kg_nodes, then expand kg_edges N hops "
622622
"and return a compact subgraph plus provenance citations with youtube timecoded URLs. "
623623
"Also retrieves bill excerpt citations for legislation questions. "
624-
"Use edge_rank_threshold to filter low-quality edges (0.05 recommended after normalization)."
624+
"Use edge_rank_threshold to filter low-quality edges (recommended: 0.001 or omit for no filtering)."
625625
),
626626
parameters_json_schema=tool_schema,
627627
)

lib/kg_hybrid_graph_rag.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,9 +914,13 @@ def kg_hybrid_graph_rag(
914914
max_citations: Maximum citations to return (default: 12)
915915
edge_rank_threshold: Optional threshold to filter edges by edge_rank_score.
916916
Only returns edges with score >= threshold.
917-
Recommended: 0.05 after normalization, or 0.00001 before normalization.
917+
Recommended: 0.001 or omit for no filtering.
918918
None means no threshold filtering (default: None)
919919
"""
920+
# Guard against overly aggressive thresholds that filter out most edges
921+
if edge_rank_threshold is not None and edge_rank_threshold >= 0.05:
922+
edge_rank_threshold = None
923+
920924
query = (query or "").strip()
921925
if not query:
922926
return {

0 commit comments

Comments
 (0)