recognize casual news requests and prevent premature source-only completion

This commit is contained in:
pewdiepie-archdaemon
2026-09-17 20:03:32 +00:00
parent da215cf242
commit 2d938b1650
3 changed files with 11 additions and 4 deletions
+6 -2
View File
@@ -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
+2 -2
View File
@@ -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
+3
View File
@@ -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