Große Modularisierung WP19b
This commit is contained in:
1 parent
37ec8b614e
commit
19d899b277
11 files changed
+659
-485
No files matched your search
@@ -1,11 +1,15 @@
|
||||
"""
|
||||
FILE: app/core/ingestion/ingestion_validation.py
|
||||
DESCRIPTION: WP-15b semantische Validierung von Kanten gegen den LocalBatchCache.
|
||||
AUDIT v2.12.3: Integration der zentralen Text-Bereinigung (WP-14).
|
||||
"""
|
||||
import logging
|
||||
from typing import Dict, Any
|
||||
from app.core.parser import NoteContext
|
||||
|
||||
# ENTSCHEIDENDER FIX: Import der neutralen Bereinigungs-Logik zur Vermeidung von Circular Imports
|
||||
from app.core.registry import clean_llm_text
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
async def validate_edge_candidate(
|
||||
@@ -15,7 +19,10 @@ async def validate_edge_candidate(
|
||||
llm_service: Any,
|
||||
provider: str
|
||||
) -> bool:
|
||||
"""WP-15b: Validiert einen Kandidaten semantisch gegen das Ziel im Cache."""
|
||||
"""
|
||||
WP-15b: Validiert einen Kandidaten semantisch gegen das Ziel im Cache.
|
||||
Nutzt clean_llm_text zur Entfernung von Steuerzeichen vor der Auswertung.
|
||||
"""
|
||||
target_id = edge.get("to")
|
||||
target_ctx = batch_cache.get(target_id)
|
||||
|
||||
@@ -40,7 +47,13 @@ async def validate_edge_candidate(
|
||||
edge_kind=edge.get("kind", "related_to")
|
||||
)
|
||||
|
||||
response = await llm_service.generate_raw_response(prompt, priority="background")
|
||||
# Die Antwort vom Service anfordern
|
||||
raw_response = await llm_service.generate_raw_response(prompt, priority="background")
|
||||
|
||||
# WP-14 Fix: Zusätzliche Bereinigung zur Sicherstellung der Interpretierbarkeit
|
||||
response = clean_llm_text(raw_response)
|
||||
|
||||
# Semantische Prüfung des Ergebnisses
|
||||
is_valid = "YES" in response.upper()
|
||||
|
||||
if is_valid:
|
||||
@@ -50,4 +63,5 @@ async def validate_edge_candidate(
|
||||
return is_valid
|
||||
except Exception as e:
|
||||
logger.warning(f"⚠️ Validation error for {target_id}: {e}")
|
||||
# Im Zweifel (Timeout/Fehler) erlauben wir die Kante, um Datenverlust zu vermeiden
|
||||
return True
|
||||
Reference in new issue
Block a user