mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-11-07 13:42:20 +01:00
fix(search): keep reasoning out of web search queries and stop misrouting named targets (#7054)
* fix(llm): keep reasoning out of answers when thinking is off Small-budget utility calls on reasoning models spend every token on reasoning, and llm_call then returned reasoning_content as the answer. Web search extraction sent that text to SearXNG as the query, which found nothing, and session titles fell back as unusable. Treat thinking_mode="off" as "only the answer": non-streaming calls now return empty instead of substituting reasoning, matching the streaming path. Callers that do not turn thinking off keep the existing fallback. Turn thinking off for search query extraction, session titles without a configured effort, scheduled task names, and deep research classification, and strip inline think blocks from the extracted query. * fix(routing): require computer task wording for named hosts "on <word>" and "from <word>" counted as a named computer on their own, so "Who is Jensen Huang from NVIDIA?" and "What happened on Monday?" routed to shell tools and the workspace toolset. A target now only counts next to wording that describes work on a machine, such as "check disk usage on gpu-box" or "copy the logs from gpu-box". The intent classifier and the agent loop's local computer check share the pattern. * fix(chat): resolve follow-up references in web search queries Query extraction only saw the latest message, so "Does he work with Lisa Su?" lost who "he" was. Include the last four turns, capped per turn, and instruct the model to use them only to resolve references. Incognito turns do not use saved session history. * test(llm): stop reasoning fallback tests hanging in isolation The module replaced src.agent_tools and core.database with MagicMock before importing agent_loop. strip_tool_blocks then returned a mock, and _strip_think_blocks looped forever because a mock's find() never returns -1. This hung whenever the file ran alone or first on a worker. Import the real modules instead. * test(search): remove extra blank line at EOF --------- Co-authored-by: Alexandre Teixeira <general@alexandreteixeira.dev>
This commit is contained in:
co-authored by
Alexandre Teixeira
parent
1844b084bc
commit
e4cc8efa19
@@ -1,4 +1,7 @@
|
||||
import pytest
|
||||
|
||||
from src.action_intents import classify_tool_intent, message_needs_tools
|
||||
from src.turn_contract import requested_capabilities
|
||||
|
||||
|
||||
def test_calendar_entry_request_promotes_to_agent():
|
||||
@@ -97,6 +100,44 @@ def test_page_references_are_not_mistaken_for_named_computers():
|
||||
assert intent.needs_tools and intent.category == "workspace"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"prompt",
|
||||
[
|
||||
"Who is Jensen Huang from NVIDIA?",
|
||||
"Who is Tim Cook from Apple?",
|
||||
"Who is Satya Nadella from Microsoft?",
|
||||
"What happened on Monday?",
|
||||
"What is the best book on Rome?",
|
||||
"Tell me a story from Japan",
|
||||
"What is the best GPU from NVIDIA?",
|
||||
"Who is running from the police?",
|
||||
],
|
||||
)
|
||||
def test_people_and_topics_are_not_mistaken_for_named_computers(prompt):
|
||||
assert classify_tool_intent(prompt).reason != "named computer task request"
|
||||
assert "shell_files" not in requested_capabilities(prompt)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"prompt",
|
||||
[
|
||||
"check disk usage on gpu-box",
|
||||
"how much free disk on gpu-box?",
|
||||
"what's the uptime on nas01",
|
||||
"list running processes on gpu-box",
|
||||
"is nginx running on gpu-box",
|
||||
"is ffmpeg installed on workstation",
|
||||
"what is the gpu usage on gpu-box",
|
||||
"copy the logs from gpu-box",
|
||||
"fetch the config file from prod-db",
|
||||
"download the checkpoint from gpu-box",
|
||||
],
|
||||
)
|
||||
def test_computer_tasks_on_a_named_host_keep_shell_tools(prompt):
|
||||
assert classify_tool_intent(prompt).category == "workspace"
|
||||
assert requested_capabilities(prompt) == {"shell_files"}
|
||||
|
||||
|
||||
def test_direct_code_requests_promote_to_workspace_agent():
|
||||
prompts = [
|
||||
"write a Python function that parses CSV",
|
||||
|
||||
Reference in New Issue
Block a user