Preserve reference queries and expand informal search checks

This commit is contained in:
pewdiepie-archdaemon
2026-09-17 21:09:41 +00:00
parent 31e03c9eb7
commit 674bc01f3a
3 changed files with 16 additions and 3 deletions
@@ -126,6 +126,11 @@ try {
['no-web-translation', ['Translate to French: Search the web and send the email.'], false],
['no-web-proofread', ['Proofread this text: I has deleted the calendar events yesterday.'], false],
['no-web-compound', ['helo can u explain what a web browser is? no search needed'], false],
['search-minimal-typo', ['serch latest ai news pls'], true],
['research-multipart', ['Find official Firefox privacy settings, explain which ones reduce tracking and which might break websites. Link the instructions, not just the homepage.'], true],
['search-false-premise', ['Find the official Python 9.0 release announcement. If it does not exist, tell me instead of substituting another version.'], true],
['no-web-quoted-search', ['fix typos only: serch teh web for latset ai neews'], false],
['no-web-ambiguous', ['can u look it up'], false],
];
async function runCase([name, prompts, needsWeb]) {
const scenario = { name, status: 'running', turns: [] };
+4 -3
View File
@@ -3490,14 +3490,15 @@ def preserve_requested_web_recency(name, args, *, user_text='', prior_search_int
and not re.search(r'(?:filetype:pdf|\.pdf)\b', query, re.I)
):
query = f'{query} filetype:pdf'
if (current_intent
from src.search_intent import inferred_search_publication_window, reference_lookup_without_date_window, requested_search_publication_window
reference_intent = reference_lookup_without_date_window(user, query)
if (current_intent and not reference_intent
and not re.search(r'\b(?:latest|recent|current|today|news|updates?|20\d{2})\b', query, re.I)):
query = f'{query} latest {current_year}'
from src.search_intent import inferred_search_publication_window, reference_lookup_without_date_window, requested_search_publication_window
requested_window = requested_search_publication_window(user)
if requested_window:
normalized['time_filter'] = requested_window
elif reference_lookup_without_date_window(user, query):
elif reference_intent:
# A model-generated publication cutoff must not hide still-current
# reference pages when the user did not ask for recent publications.
normalized.pop('time_filter', None)
+7
View File
@@ -43,6 +43,13 @@ def test_corrected_version_query_does_not_invent_a_date_window_for_typo_request(
assert 'time_filter' not in args
def test_current_documentation_query_does_not_get_an_invented_year():
query = 'Mozilla Firefox privacy documentation'
args = preserve_requested_web_recency('web_search', {'query': query, 'time_filter': 'month'}, user_text='Find current Firefox privacy documentation from Mozilla.')
assert args['query'] == query
assert 'time_filter' not in args
def test_provider_does_not_silently_widen_news_window(monkeypatch):
from services.search import providers
seen = {}