mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-11-04 04:02:21 +01:00
recognize casual news requests and prevent premature source-only completion
This commit is contained in:
@@ -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)),
|
prefer_official=bool(re.search(r'\bofficial\b', direct_user_text, re.I)),
|
||||||
query=args.get('query', ''),
|
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
|
# For an exact requested link count, evidence owns
|
||||||
# the final rendering so model prose cannot add a
|
# the final rendering so model prose cannot add a
|
||||||
# wrong or duplicate source.
|
# wrong or duplicate source.
|
||||||
structured_terminal_response = '\n'.join(
|
structured_terminal_response = '\n'.join(
|
||||||
link for _, link in source_links[:requested_links]
|
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)):
|
and re.search(r'\bofficial\b', direct_user_text, re.I)):
|
||||||
if not official_source_retry_attempted and round_number < round_limit:
|
if not official_source_retry_attempted and round_number < round_limit:
|
||||||
official_source_retry_attempted = True
|
official_source_retry_attempted = True
|
||||||
|
|||||||
@@ -3980,14 +3980,14 @@ def broad_web_briefing_request(message: str) -> bool:
|
|||||||
"""Recognize requests that need broad, current, multi-source Web evidence."""
|
"""Recognize requests that need broad, current, multi-source Web evidence."""
|
||||||
text = _normalize_request_lead(message)
|
text = _normalize_request_lead(message)
|
||||||
if re.search(
|
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"catch\s+me\s+up|give\s+me\s+(?:an?\s+)?update|"
|
||||||
r"what\s+should\s+i\s+know)\b",
|
r"what\s+should\s+i\s+know)\b",
|
||||||
text,
|
text,
|
||||||
re.I,
|
re.I,
|
||||||
):
|
):
|
||||||
return True
|
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
|
return True
|
||||||
if re.search(r"\b(?:research|investigate|deep[ -]?dive)\b", text, re.I):
|
if re.search(r"\b(?:research|investigate|deep[ -]?dive)\b", text, re.I):
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ from src.turn_contract import (
|
|||||||
'Compare the latest AI models',
|
'Compare the latest AI models',
|
||||||
'Best laptops right now',
|
'Best laptops right now',
|
||||||
'Recommend a laptop based on current reviews',
|
'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):
|
def test_broad_web_briefings_share_one_search_semantic(prompt):
|
||||||
from src.turn_contract import broad_web_briefing_request
|
from src.turn_contract import broad_web_briefing_request
|
||||||
|
|||||||
Reference in New Issue
Block a user