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
+1 -1
View File
@@ -159,7 +159,7 @@ class TestBuildEventClassificationPrompt:
def test_system_prompt_is_concise(self):
result = build_event_classification_prompt("text")
assert "JSON" in result["system"]
assert len(result["system"]) < 300
assert len(result["system"]) < 1000 # expanded to include macro-vs-company filtering rules
def test_user_prompt_lists_impact_types(self):
result = build_event_classification_prompt("text")