fix: default model to qwen3.5:9b + improve event classifier prompt

- Migration 026 and OllamaConfig now default to qwen3.5:9b instead of
  llama3.1:8b. Existing deployments keep their current model (qwen3.5:9b-fast)
  since the migration uses WHERE NOT EXISTS on slug.

- Event classifier system prompt expanded with macro-vs-company filtering:
  explicitly instructs the model to NOT classify single-company news
  (lawsuits, earnings, management changes, debt crises) as macro events.
  Sets severity=low and confidence<0.3 for company-specific articles.
  Reserves 'critical' severity for multi-country/global market events.
  Prevents over-tagging event_types by requiring direct description.

- Updated test_system_prompt_is_concise threshold to accommodate the
  expanded prompt (300 → 1000 chars).
This commit is contained in:
Celes Renata
2026-04-17 02:53:38 +00:00
parent 90614dd7bb
commit c501ccea40
4 changed files with 123 additions and 12 deletions
+3 -2
View File
@@ -41,7 +41,7 @@ class MinioConfig:
@dataclass
class OllamaConfig:
base_url: str = "http://localhost:11434"
model: str = "llama3.1:8b"
model: str = "qwen3.5:9b"
timeout: int = 120
max_retries: int = 2
retry_base_delay: float = 1.0
@@ -51,6 +51,7 @@ class OllamaConfig:
stall_timeout: float = 30.0
loop_window: int = 64
loop_threshold: float = 0.5
context_window: int = 0 # Ollama num_ctx; 0 = use model default
@dataclass
@@ -240,7 +241,7 @@ def load_config() -> AppConfig:
),
ollama=OllamaConfig(
base_url=os.getenv("OLLAMA_BASE_URL", "http://localhost:11434"),
model=os.getenv("OLLAMA_MODEL", "llama3.1:8b"),
model=os.getenv("OLLAMA_MODEL", "qwen3.5:9b"),
timeout=int(os.getenv("OLLAMA_TIMEOUT", "120")),
max_retries=int(os.getenv("OLLAMA_MAX_RETRIES", "2")),
retry_base_delay=float(os.getenv("OLLAMA_RETRY_BASE_DELAY", "1.0")),