Update EdgeDTO to support extended provenance values and modify explanation building in retriever.py to accommodate new provenance types. This enhances the handling of edge data for improved accuracy in retrieval processes.
This commit is contained in:
parent
2445f7cb2b
commit
1df89205ac
|
|
@ -232,7 +232,8 @@ def _build_explanation(
|
||||||
top_edges = sorted(edges_dto, key=lambda e: e.confidence, reverse=True)
|
top_edges = sorted(edges_dto, key=lambda e: e.confidence, reverse=True)
|
||||||
for e in top_edges[:3]:
|
for e in top_edges[:3]:
|
||||||
peer = e.source if e.direction == "in" else e.target
|
peer = e.source if e.direction == "in" else e.target
|
||||||
prov_txt = "Bestätigte" if e.provenance == "explicit" else "KI-basierte"
|
# WP-24c v4.5.3: Unterstütze alle explicit-Varianten (explicit, explicit:callout, etc.)
|
||||||
|
prov_txt = "Bestätigte" if e.provenance and e.provenance.startswith("explicit") else "KI-basierte"
|
||||||
boost_txt = f" [Boost x{applied_boosts.get(e.kind)}]" if applied_boosts and e.kind in applied_boosts else ""
|
boost_txt = f" [Boost x{applied_boosts.get(e.kind)}]" if applied_boosts and e.kind in applied_boosts else ""
|
||||||
|
|
||||||
reasons.append(Reason(
|
reasons.append(Reason(
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,14 @@ class EdgeDTO(BaseModel):
|
||||||
target: str
|
target: str
|
||||||
weight: float
|
weight: float
|
||||||
direction: Literal["out", "in", "undirected"] = "out"
|
direction: Literal["out", "in", "undirected"] = "out"
|
||||||
provenance: Optional[Literal["explicit", "rule", "smart", "structure"]] = "explicit"
|
# WP-24c v4.5.3: Erweiterte Provenance-Werte für Chunk-Aware Edges
|
||||||
|
# Unterstützt alle tatsächlich verwendeten Provenance-Typen im System
|
||||||
|
provenance: Optional[Literal[
|
||||||
|
"explicit", "rule", "smart", "structure",
|
||||||
|
"explicit:callout", "explicit:wikilink", "explicit:note_zone", "explicit:note_scope",
|
||||||
|
"inline:rel", "callout:edge", "semantic_ai", "structure:belongs_to", "structure:order",
|
||||||
|
"derived:backlink", "edge_defaults", "global_pool"
|
||||||
|
]] = "explicit"
|
||||||
confidence: float = 1.0
|
confidence: float = 1.0
|
||||||
target_section: Optional[str] = None
|
target_section: Optional[str] = None
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user