mirror of
https://github.com/home-assistant/core.git
synced 2025-09-06 21:31:34 +02:00
Remove native field from conversation chatlog delta listeners (#150389)
This commit is contained in:
@@ -342,7 +342,12 @@ class ChatLog:
|
||||
name=f"llm_tool_{tool_call.id}",
|
||||
)
|
||||
if self.delta_listener:
|
||||
self.delta_listener(self, delta) # type: ignore[arg-type]
|
||||
if filtered_delta := {
|
||||
k: v for k, v in delta.items() if k != "native"
|
||||
}:
|
||||
# We do not want to send the native content to the listener
|
||||
# as it is not JSON serializable
|
||||
self.delta_listener(self, filtered_delta)
|
||||
continue
|
||||
|
||||
# Starting a new message
|
||||
|
@@ -568,7 +568,8 @@ async def test_add_delta_content_stream(
|
||||
"""Yield deltas."""
|
||||
for d in deltas:
|
||||
yield d
|
||||
expected_delta.append(d)
|
||||
if filtered_delta := {k: v for k, v in d.items() if k != "native"}:
|
||||
expected_delta.append(filtered_delta)
|
||||
|
||||
captured_deltas = []
|
||||
|
||||
|
Reference in New Issue
Block a user