symfonic.capabilities.memory.phases.entity_helpers¶
entity_helpers ¶
Internal helpers for phases_entity.build_entity_links.
Split out of phases_entity.py to keep each module under the
project's 300-line modularity budget. These helpers are not part of
the public API; the phase entrypoint re-exports them only for tests.
confidence_log_get ¶
load_existing_entity_nodes
async
¶
Load existing Entity:* semantic nodes keyed by (content, kind).
Source code in src/symfonic/capabilities/memory/phases/entity_helpers.py
resolve_or_create_entity_node
async
¶
resolve_or_create_entity_node(graph: Any, scope: TenantScope, canonical_surface: str, kind: EntityKind, *, episodic_ids: list[str], extractor_name: str, max_confidence: float, existing_entity_nodes: dict[tuple[str, str], MemoryNode]) -> tuple[MemoryNode | None, bool]
Return (node, created_new). Implements Decision 2's hybrid
identity rule with exact-match -> SequenceMatcher fallback.
existing_entity_nodes is keyed by (canonical_surface, kind)
so exact match is O(1). Fuzzy match is only attempted for the
proper-noun bucket and only against same-kind nodes (Decision 2).
Source code in src/symfonic/capabilities/memory/phases/entity_helpers.py
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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
scan_episodics
async
¶
scan_episodics(episodic_layer: Any, scope: TenantScope, extractor: EntityExtractor, *, confidence_threshold: float, max_episodics: int) -> dict[tuple[str, str], list[str]]
Return {(canonical_surface, kind): [episodic_id, ...]}.
The mention-count gate is NOT applied here -- caller decides
based on min_mention_count. Drops candidates below
confidence_threshold.