diff --git a/homeassistant/helpers/intent.py b/homeassistant/helpers/intent.py index d7c0f90e2f9..faf16ad572c 100644 --- a/homeassistant/helpers/intent.py +++ b/homeassistant/helpers/intent.py @@ -1362,6 +1362,8 @@ class IntentResponse: if self.reprompt: response_dict["reprompt"] = self.reprompt + if self.speech_slots: + response_dict["speech_slots"] = self.speech_slots response_data: dict[str, Any] = {} diff --git a/tests/helpers/test_llm.py b/tests/helpers/test_llm.py index 6ac17a2fe0e..b4a768c4429 100644 --- a/tests/helpers/test_llm.py +++ b/tests/helpers/test_llm.py @@ -149,8 +149,13 @@ async def test_assist_api( assert test_context.json_fragment # To reproduce an error case in tracing intent_response = intent.IntentResponse("*") - intent_response.matched_states = [State("light.matched", "on")] - intent_response.unmatched_states = [State("light.unmatched", "on")] + intent_response.async_set_states( + [State("light.matched", "on")], [State("light.unmatched", "on")] + ) + intent_response.async_set_speech("Some speech") + intent_response.async_set_card("Card title", "card content") + intent_response.async_set_speech_slots({"hello": 1}) + intent_response.async_set_reprompt("Do it again") tool_input = llm.ToolInput( tool_name="test_intent", tool_args={"area": "kitchen", "floor": "ground_floor"}, @@ -181,8 +186,22 @@ async def test_assist_api( "success": [], "targets": [], }, + "reprompt": { + "plain": { + "extra_data": None, + "reprompt": "Do it again", + }, + }, "response_type": "action_done", - "speech": {}, + "speech": { + "plain": { + "extra_data": None, + "speech": "Some speech", + }, + }, + "speech_slots": { + "hello": 1, + }, } # Call with a device/area/floor @@ -227,7 +246,21 @@ async def test_assist_api( "targets": [], }, "response_type": "action_done", - "speech": {}, + "reprompt": { + "plain": { + "extra_data": None, + "reprompt": "Do it again", + }, + }, + "speech": { + "plain": { + "extra_data": None, + "speech": "Some speech", + }, + }, + "speech_slots": { + "hello": 1, + }, }