diff --git a/src/clean_agent_preview.py b/src/clean_agent_preview.py index 9b0f59c80..465369775 100644 --- a/src/clean_agent_preview.py +++ b/src/clean_agent_preview.py @@ -5179,14 +5179,18 @@ async def stream_preview(*, endpoint_url, model, messages, headers, turn_contrac prefer_official=bool(re.search(r'\bofficial\b', direct_user_text, re.I)), query=args.get('query', ''), ) - if requested_links and source_links: + source_only_request = not re.search( + r'\b(?:latest|latset|current|recent|today|compare|explain|summari[sz]e)\b', + direct_user_text, re.I, + ) + if requested_links and source_links and source_only_request: # For an exact requested link count, evidence owns # the final rendering so model prose cannot add a # wrong or duplicate source. structured_terminal_response = '\n'.join( link for _, link in source_links[:requested_links] ) - elif (requested_links + elif (requested_links and not source_links and re.search(r'\bofficial\b', direct_user_text, re.I)): if not official_source_retry_attempted and round_number < round_limit: official_source_retry_attempted = True diff --git a/src/turn_contract.py b/src/turn_contract.py index 07b432c44..78acabf92 100644 --- a/src/turn_contract.py +++ b/src/turn_contract.py @@ -3980,14 +3980,14 @@ def broad_web_briefing_request(message: str) -> bool: """Recognize requests that need broad, current, multi-source Web evidence.""" text = _normalize_request_lead(message) if re.search( - r"\b(?:what(?:'s|\s+is)\s+(?:new|happening)|anything\s+new|" + r"\b(?:what(?:['’]?s|\s+is)\s+(?:new|happening)|anything\s+new|" r"catch\s+me\s+up|give\s+me\s+(?:an?\s+)?update|" r"what\s+should\s+i\s+know)\b", text, re.I, ): return True - if re.search(r"\b(?:news|headlines?|top\s+stories|news\s+roundup)\b", text, re.I): + if re.search(r"\b(?:news|neews|nees|headlines?|top\s+stories|news\s+roundup)\b", text, re.I): return True if re.search(r"\b(?:research|investigate|deep[ -]?dive)\b", text, re.I): return True diff --git a/tests/test_turn_contract.py b/tests/test_turn_contract.py index e3dfaa437..8ce9e0db2 100644 --- a/tests/test_turn_contract.py +++ b/tests/test_turn_contract.py @@ -32,6 +32,9 @@ from src.turn_contract import ( 'Compare the latest AI models', 'Best laptops right now', 'Recommend a laptop based on current reviews', + 'latset ai neews?', + 'whats new in japan rn', + 'what’s new in Sweden', ]) def test_broad_web_briefings_share_one_search_semantic(prompt): from src.turn_contract import broad_web_briefing_request