Integrate symmetric edge logic and discovery API: Update ingestion processor and validation to support automatic inverse edge generation. Enhance edge registry for dual vocabulary and schema management. Introduce new discovery endpoint for proactive edge suggestions, improving graph topology and edge validation processes.

This commit is contained in:
Lars committed 2026-01-09 13:57:10 +01:00
1 parent 745352ff3f
commit 4802eba27b
4 files changed
+344 -109

No files matched your search

+22 -12
View File
@@ -1,11 +1,12 @@
"""
FILE: app/core/ingestion/ingestion_processor.py
DESCRIPTION: Der zentrale IngestionService (Orchestrator).
WP-24c: Integration der Symmetrie-Logik (Automatische inverse Kanten).
WP-25a: Integration der Mixture of Experts (MoE) Architektur.
WP-15b: Two-Pass Workflow mit globalem Kontext-Cache.
WP-20/22: Cloud-Resilienz und Content-Lifecycle integriert.
AUDIT v2.14.0: Synchronisierung der Profil-Auflösung mit MoE-Experten.
VERSION: 2.14.0 (WP-25a: MoE & Profile Support)
AUDIT v3.0.0: Synchronisierung der bidirektionalen Graph-Logik.
VERSION: 3.0.0 (WP-24c: Symmetric Graph Ingestion)
STATUS: Active
"""
import logging
@@ -29,10 +30,11 @@ from app.services.embeddings_client import EmbeddingsClient
from app.services.edge_registry import registry as edge_registry
from app.services.llm_service import LLMService
# Package-Interne Imports (Refactoring WP-14)
# Package-Interne Imports (Refactoring WP-14 / WP-24c)
from .ingestion_utils import load_type_registry, resolve_note_type, get_chunk_config_by_profile
from .ingestion_db import fetch_note_payload, artifacts_missing, purge_artifacts
from .ingestion_validation import validate_edge_candidate
# WP-24c: Import der erweiterten Symmetrie-Logik
from .ingestion_validation import validate_edge_candidate, validate_and_symmetrize
from .ingestion_note_payload import make_note_payload
from .ingestion_chunk_payload import make_chunk_payloads
@@ -167,18 +169,26 @@ class IngestionService:
# WP-15b: Chunker-Aufruf bereitet den Candidate-Pool pro Chunk vor.
chunks = await assemble_chunks(note_id, body_text, note_type, config=chunk_cfg)
# Semantische Kanten-Validierung (Smart Edge Allocation via MoE-Profil)
# Semantische Kanten-Validierung & Symmetrie (WP-24c / WP-25a)
for ch in chunks:
filtered = []
new_pool = []
for cand in getattr(ch, "candidate_pool", []):
# WP-25a: Nutzt nun das spezialisierte Validierungs-Profil
# WP-24c: Nutzung des erweiterten Symmetrie-Gateways
if cand.get("provenance") == "global_pool" and enable_smart:
if await validate_edge_candidate(ch.text, cand, self.batch_cache, self.llm, profile_name="ingest_validator"):
filtered.append(cand)
# Erzeugt Primär- und Inverse Kanten falls validiert
res_batch = await validate_and_symmetrize(
chunk_text=ch.text,
edge=cand,
source_id=note_id,
batch_cache=self.batch_cache,
llm_service=self.llm,
profile_name="ingest_validator"
)
new_pool.extend(res_batch)
else:
# Explizite Kanten (Wikilinks/Callouts) werden ungeprüft übernommen
filtered.append(cand)
ch.candidate_pool = filtered
# Explizite Kanten (Wikilinks/Callouts) werden übernommen
new_pool.append(cand)
ch.candidate_pool = new_pool
# Payload-Erstellung für die Chunks
chunk_pls = make_chunk_payloads(