codenib.ops.expand
¶
Classes:
| Name | Description |
|---|---|
ExpandContext |
Shared resources for graph expansion operators. |
Functions:
| Name | Description |
|---|---|
nodeinfo_to_queried |
Convert NodeInfo list to QueriedNode list, assigning rank-based scores. |
hydrate_candidate_contents |
Fill missing candidate content from persisted source spans. |
expand_graph_neighbors |
Return graph neighbors for retrieval candidates. |
ExpandContext
dataclass
¶
ExpandContext(
code_graph: CodeGraph | None = None,
lsp_provider: Any | None = None,
default_top_k: int = 50,
default_hops: int = 2,
default_direction: str = "both",
default_method: str = "bfs",
default_damping: float = 0.85,
filter_tests: bool = True,
)
Shared resources for graph expansion operators.
nodeinfo_to_queried
¶
nodeinfo_to_queried(nodes: list[NodeInfo]) -> list[QueriedNode]
Convert NodeInfo list to QueriedNode list, assigning rank-based scores.
Source code in codenib/ops/expand.py
hydrate_candidate_contents
¶
hydrate_candidate_contents(
candidates: Sequence[QueriedNode],
*,
repo_path: str | None,
git_commit: str | None = None
) -> list[QueriedNode]
Fill missing candidate content from persisted source spans.
Source code in codenib/ops/expand.py
expand_graph_neighbors
¶
expand_graph_neighbors(
context: ExpandContext,
seeds: Sequence[QueriedNode],
*,
per_seed: int = 5,
direction: str = "both",
repo_path: str | None = None,
include_content: bool = False,
symbol_only: bool = True,
require_span: bool = True,
score_scale: float = 0.5,
edge_types: Sequence[str] | None = (EDGE_TYPE_REFERENCE,)
) -> list[QueriedNode]
Return graph neighbors for retrieval candidates.
This is the retrieval-pipeline counterpart to the agent-facing graph navigation helpers: keep dense candidates as seeds, append compact graph neighbors, and leave ranking to the downstream reranker. Only one-hop predecessor/successor expansion is performed; no BFS/PPR is hidden here. Expansion follows reference edges by default so containment does not consume the dependency-neighbor budget.
Source code in codenib/ops/expand.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |