From b6af61f7a4f980b31386b084eddb7b621200f0e5 Mon Sep 17 00:00:00 2001 From: rlrghb <254179942+rlrghb@users.noreply.github.com> Date: Mon, 7 Sep 2026 08:36:32 -0700 Subject: [PATCH] Fix llama.cpp streaming capability reporting (#179886) --- .../components/llama_cpp/conversation.py | 3 ++- tests/components/llama_cpp/test_conversation.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/llama_cpp/conversation.py b/homeassistant/components/llama_cpp/conversation.py index 44ff4c07d7fe..3f413b32e832 100644 --- a/homeassistant/components/llama_cpp/conversation.py +++ b/homeassistant/components/llama_cpp/conversation.py @@ -9,7 +9,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from . import LlamaCppConfigEntry -from .const import DOMAIN +from .const import CONF_STREAMING, DOMAIN from .entity import LlamaCppBaseLLMEntity @@ -36,6 +36,7 @@ class LlamaCppConversationEntity( def __init__(self, entry: ConfigEntry, subentry: ConfigSubentry) -> None: """Initialize the agent.""" super().__init__(entry, subentry) + self._attr_supports_streaming = bool(entry.data.get(CONF_STREAMING, False)) if self.subentry.data.get(CONF_LLM_HASS_API): self._attr_supported_features = ( conversation.ConversationEntityFeature.CONTROL diff --git a/tests/components/llama_cpp/test_conversation.py b/tests/components/llama_cpp/test_conversation.py index b9e7c970aba9..3132ba38c9aa 100644 --- a/tests/components/llama_cpp/test_conversation.py +++ b/tests/components/llama_cpp/test_conversation.py @@ -102,6 +102,22 @@ async def test_conversation_entity( assert mock_chat_log.content[1:] == snapshot +@pytest.mark.parametrize( + ("config_entry_data", "supports_streaming"), + [({CONF_STREAMING: True}, True), ({CONF_STREAMING: False}, False)], +) +async def test_conversation_entity_streaming_support( + hass: HomeAssistant, supports_streaming: bool +) -> None: + """Verify the conversation entity advertises streaming support.""" + agent_info = conversation.async_get_agent_info( + hass, "conversation.llama_cpp_conversation" + ) + + assert agent_info is not None + assert agent_info.supports_streaming is supports_streaming + + @pytest.mark.parametrize(("config_entry_options"), [ASSIST_OPTIONS]) async def test_function_call( hass: HomeAssistant,