mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-06 06:52:20 +02:00
Separate documentation freshness years from product identifiers
This commit is contained in:
@@ -86,6 +86,9 @@ async function send(page, prompt) {
|
||||
selection_mode: contract?.selection_mode ?? null,
|
||||
policy_decisions: metrics?.policy_decisions || [],
|
||||
proposed_calls: (metrics?.clean_v3_turn || []).flatMap(message => message.tool_calls || []),
|
||||
runtime_trace: metrics?.clean_v3_turn || [],
|
||||
actual_temperature: metrics?.temperature ?? null,
|
||||
actual_max_output_tokens: metrics?.max_output_tokens ?? null,
|
||||
tools: starts, outputs, final,
|
||||
evidence: events.filter(event => event.type === 'tool_output').map(event => ({
|
||||
tool: canonical(event.tool), arguments: event.command,
|
||||
|
||||
@@ -260,6 +260,16 @@ def _result_has_query_overlap(query: str, result: dict) -> bool:
|
||||
if entity_terms and entity_terms[0] not in result_tokens:
|
||||
return False
|
||||
model_numbers = {token for token in ordered_query_tokens if token.isdigit()}
|
||||
# Temporal qualifiers are not product identifiers. In particular,
|
||||
# query normalization may append "latest 2026" to a documentation
|
||||
# lookup; an evergreen official page need not put that year in its
|
||||
# title/snippet/URL. Retain actual product numbers (including years
|
||||
# used as model names without an explicit temporal qualifier).
|
||||
temporal_years = set(re.findall(
|
||||
r'\b(?:latest|current|updated|as\s+of)\s+(20\d{2})\b',
|
||||
str(query or ''), re.I,
|
||||
))
|
||||
model_numbers -= temporal_years
|
||||
if model_numbers and not model_numbers.issubset(result_tokens):
|
||||
return False
|
||||
|
||||
|
||||
@@ -5662,6 +5662,8 @@ async def stream_preview(*, endpoint_url, model, messages, headers, turn_contrac
|
||||
'request_context_tokens': last_request_tokens,
|
||||
'tool_schema_count': len(offered),
|
||||
'agent_rounds': rounds_used,
|
||||
'temperature': temperature,
|
||||
'max_output_tokens': request_max_tokens,
|
||||
'tool_calls': calls,
|
||||
'tool_events': executions, 'clean_v3_turn': text_only_clean_trace(history[initial_length:]),
|
||||
'policy_decisions': policy_decisions,
|
||||
|
||||
@@ -2,6 +2,20 @@ from services.search import core
|
||||
import pytest
|
||||
|
||||
|
||||
def test_documentation_freshness_year_is_not_a_product_model_number():
|
||||
result = {'title': 'Enhanced Tracking Protection in Firefox',
|
||||
'url': 'https://support.mozilla.org/en-US/kb/enhanced-tracking-protection-firefox-desktop',
|
||||
'snippet': 'Firefox privacy settings and tracking protection documentation.'}
|
||||
assert core._result_has_query_overlap('Mozilla Firefox privacy documentation latest 2026', result)
|
||||
|
||||
|
||||
def test_documentation_filter_keeps_real_product_number_requirements():
|
||||
result = {'title': 'WIKING Miro 3 manual', 'url': 'https://example.org/wiking-miro-3', 'snippet': 'WIKING Miro installation guide'}
|
||||
assert core._result_has_query_overlap('WIKING Miro 3 manual latest 2026', result)
|
||||
assert not core._result_has_query_overlap('WIKING Miro 4 manual latest 2026', result)
|
||||
assert not core._result_has_query_overlap('WIKING Miro 2026 manual', result)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('comprehensive', [False, True])
|
||||
@pytest.mark.parametrize('transient_error', [False, True])
|
||||
def test_empty_results_advance_provider_but_transport_errors_get_one_retry(monkeypatch, tmp_path, comprehensive, transient_error):
|
||||
|
||||
@@ -85,6 +85,9 @@ async def test_runtime_does_not_append_unverified_search_result_as_citation(monk
|
||||
assert 'old-release' not in final
|
||||
assert '[Source:' not in final
|
||||
assert not any(event.get('type') == 'error' for event in events)
|
||||
metrics = next(event['data'] for event in events if event.get('type') == 'metrics')
|
||||
assert metrics['temperature'] == 0.0
|
||||
assert metrics['max_output_tokens'] == 768
|
||||
|
||||
|
||||
def test_news_intent_survives_query_rewording_without_changing_other_fresh_queries():
|
||||
|
||||
Reference in New Issue
Block a user