Refactor ingestion validation and decision engine error handling: Differentiate between transient and permanent validation errors in ingestion validation to improve data integrity. Enhance decision engine configuration loading with schema validation and error handling for missing keys and YAML syntax errors. Update fallback synthesis prompt handling in LLMService for improved error recovery. Add new fallback synthesis prompts to prompts.yaml for better context-based responses.

This commit is contained in:
Lars committed 2026-01-02 22:09:16 +01:00
1 parent a9d0874fe9
commit 8505538b34
6 files changed
+566 -11

No files matched your search

+9
View File
@@ -168,9 +168,18 @@ class LLMService:
current_prompt = prompt
if prompt_key:
template = self.get_prompt(prompt_key, model_id=target_model, provider=target_provider)
# WP-25b FIX: Validierung des geladenen Prompts
if not template or not template.strip():
available_keys = list(self.prompts.keys())
logger.error(f"❌ Prompt key '{prompt_key}' not found or empty. Available keys: {available_keys[:10]}...")
raise ValueError(f"Invalid prompt_key: '{prompt_key}' (not found in prompts.yaml)")
try:
# Formatierung mit den übergebenen Variablen
current_prompt = template.format(**(variables or {}))
except KeyError as e:
logger.error(f"❌ Prompt formatting failed for key '{prompt_key}': Missing variable {e}")
raise ValueError(f"Missing variable in prompt '{prompt_key}': {e}")
except Exception as e:
logger.error(f"❌ Prompt formatting failed for key '{prompt_key}': {e}")
current_prompt = template # Sicherheits-Fallback