From bd65b12e5da19403650cd5902ba854bce66a36ea Mon Sep 17 00:00:00 2001 From: Christian Gick Date: Mon, 16 Mar 2026 14:17:49 +0200 Subject: [PATCH] =?UTF-8?q?fix(MAT-174):=20Stricter=20LLM=20filter=20promp?= =?UTF-8?q?t=20=E2=80=94=20exclude=20when=20in=20doubt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Require ALL criteria to clearly match. Exclude general articles, category pages, unconfirmed locations. When in doubt, exclude. Co-Authored-By: Claude Opus 4.6 (1M context) --- cron/brave_search.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cron/brave_search.py b/cron/brave_search.py index 3196f76..5471891 100644 --- a/cron/brave_search.py +++ b/cron/brave_search.py @@ -15,10 +15,15 @@ LITELLM_URL = os.environ.get("LITELLM_BASE_URL", "") LITELLM_KEY = os.environ.get("LITELLM_API_KEY", "") FILTER_MODEL = os.environ.get("BASE_MODEL", "claude-haiku") -FILTER_SYSTEM_PROMPT = """You are a search result filter. Given a list of search results and filtering criteria, evaluate each result and return ONLY the ones that match the criteria. +FILTER_SYSTEM_PROMPT = """You are a strict search result filter. Given search results and filtering criteria, evaluate each result's title and description against ALL criteria. A result must clearly match EVERY criterion to be included. When in doubt, EXCLUDE. -Return a JSON array of indices (0-based) of results that match. If none match, return an empty array []. -Only return the JSON array, nothing else.""" +Rules: +- If a result is a general article, category page, or ad rather than a specific listing, EXCLUDE it. +- If the location/region cannot be confirmed from the title or description, EXCLUDE it. +- If any single criterion is not met or unclear, EXCLUDE the result. + +Return ONLY a JSON array of matching indices (0-based). If none match, return []. +No explanation, just the array.""" async def _llm_filter(results: list[dict], criteria: str) -> list[dict]: