feat(voice_worker): a short voice prompt and one judgement before each v2 answer

- compact_prompt: the v2 persona in a tenth of v1's words, answers as short as
  possible, the full tool guidance only on turns with a data tool. A greeting's
  reply prompt went from about 4,500 to 1,400 tokens on Strata.
- intent_judge: the tool router judges whether the turn needs tools; the
  planner runs only when it does. prepare_intent runs the pick ahead on a
  partial transcript (worker message prepare), and the reply reuses it.
- Without stream_browser the screen-share tools are not offered.
- The time context carries the 12-hour form (10:37 was read as pm).
- A <tool_call> block written as the reply is parsed as a call, not spoken.

Evals (Qwen3.6 on Strata, EVAL_COMPACT_PROMPT=1 EVAL_INTENT_JUDGE=1):
221 passed, 4 failed (known failures); new evals/test_voice_reply_length.py
(v2 answers 234 chars against v1's 416) and test_reply_language_default.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-12 12:25:15 +09:00
parent 7623d6d002
commit 46e4e75d05
13 changed files with 721 additions and 44 deletions

View File

@@ -297,3 +297,21 @@ class TestTextToolCallGuidancePrompt:
"an example would reinforce the exact behaviour we want to "
"stop."
)
class TestToolCallBlockAsText:
"""`<tool_call>` blocks written as the reply (Qwen XML or Hermes JSON) are tool calls, not
speech, also for a tool that is not on offer (the engine then says it is not available)."""
def test_qwen_xml(self):
content = ("<tool_call>\n<function=setTimer>\n<parameter=duration>\n5 minutes\n</parameter>\n"
"</function>\n</tool_call>")
name, args, call_id = _extract(content)
assert name == "setTimer" and args == {"duration": "5 minutes"} and call_id
def test_hermes_json(self):
name, args, _ = _extract('<tool_call>\n{"name": "webSearch", "arguments": {"search_query": "x"}}\n</tool_call>')
assert name == "webSearch" and args == {"search_query": "x"}
def test_prose_mentioning_tags_is_not_a_call(self):
assert _extract("I would call <tool_call> if I could.")[0] is None