Assistant confirms a command from the values it set, without a second round
run_turn takes answer_tools: false ends the turn once the tools have
answered. The assistant node uses it and says what was set ("Kitchen light
off, living room light off."), which saves one model round, about 1.1 s on
the P100. A turn without a call still streams the model's own words.
rebuild-frontend keeps the running stack's FRONTEND_HOST, so the token
issuer no longer flips between the LAN address and app.localhost.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ljdk7nDaguh9Uhi3zhcSjn
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
75e257d9e4
commit
5235ac59c2
@@ -56,7 +56,7 @@ def test_a_sentence_is_cut_once_it_ends():
|
||||
assert cut("Lights off! Anything else? ") == (["Lights off!", "Anything else?"], "")
|
||||
|
||||
|
||||
def test_only_wired_targets_are_tools_and_each_sentence_goes_out_as_written(
|
||||
def test_only_wired_targets_are_tools_a_change_is_confirmed_and_an_answer_streamed(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
):
|
||||
log: list[Any] = []
|
||||
@@ -69,7 +69,7 @@ def test_only_wired_targets_are_tools_and_each_sentence_goes_out_as_written(
|
||||
_call("delete_flow", "demo"),
|
||||
_call("living_room_setpoint", 22),
|
||||
],
|
||||
["Kitchen light off", " and heating to 22. It is ", "7.5 degrees outside."],
|
||||
["It is 7.5", " degrees outside. Wear a ", "jacket."],
|
||||
]
|
||||
)
|
||||
|
||||
@@ -87,25 +87,21 @@ def test_only_wired_targets_are_tools_and_each_sentence_goes_out_as_written(
|
||||
monkeypatch.setattr(ai_config, "load", lambda: PROVIDER)
|
||||
monkeypatch.setattr(client, "stream_completion", completion)
|
||||
monkeypatch.setattr(AssistantNode, "emit", lambda self, values: log.append(values))
|
||||
node = _node()
|
||||
|
||||
out = _ask(_node(), "turn off the kitchen light and make it warmer")
|
||||
out = _ask(node, "turn off the kitchen light and make it warmer")
|
||||
|
||||
tools = {tool["function"]["name"] for tool in seen[0]["tools"]}
|
||||
assert tools == {"kitchen_light", "living_room_setpoint"}
|
||||
system = seen[0]["messages"][0]["content"]
|
||||
assert "outside_temperature: 7.5" in system
|
||||
assert seen[0]["extra"]["reasoning_effort"] == "none"
|
||||
answers = [m["content"] for m in seen[1]["messages"] if m["role"] == "tool"]
|
||||
assert "error" in json.loads(answers[1])
|
||||
# Set as called, and the first sentence said before the second is written.
|
||||
# Set as called, and confirmed without asking the model again.
|
||||
assert len(seen) == 1
|
||||
assert log == [
|
||||
{"kitchen_light": False},
|
||||
{"living_room_setpoint": 22.0},
|
||||
"Kitchen light off",
|
||||
" and heating to 22. It is ",
|
||||
{"reply": "Kitchen light off and heating to 22."},
|
||||
"7.5 degrees outside.",
|
||||
{"reply": "It is 7.5 degrees outside."},
|
||||
{"reply": "Kitchen light off, living room setpoint to 22."},
|
||||
]
|
||||
assert out is not None
|
||||
assert [a["message"] for a in out["voice.actions"]] == [
|
||||
@@ -113,6 +109,17 @@ def test_only_wired_targets_are_tools_and_each_sentence_goes_out_as_written(
|
||||
"voice.setpoint",
|
||||
]
|
||||
|
||||
log.clear()
|
||||
_ask(node, "what is it like outside")
|
||||
# The first sentence is said before the second is written.
|
||||
assert log == [
|
||||
"It is 7.5",
|
||||
" degrees outside. Wear a ",
|
||||
{"reply": "It is 7.5 degrees outside."},
|
||||
"jacket.",
|
||||
{"reply": "Wear a jacket."},
|
||||
]
|
||||
|
||||
|
||||
def test_no_provider_or_one_that_does_not_answer_is_said(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
|
||||
Reference in New Issue
Block a user