From c75cb08aae72cf9b6242e40448b372c19e9e4893 Mon Sep 17 00:00:00 2001 From: tronikos Date: Wed, 29 May 2024 05:02:59 -0700 Subject: [PATCH] Fix LLM tracing for Google Generative AI (#118359) Fix LLM tracing for Gemini --- homeassistant/helpers/llm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/helpers/llm.py b/homeassistant/helpers/llm.py index b472e7f7adf..b87a4b8dcb0 100644 --- a/homeassistant/helpers/llm.py +++ b/homeassistant/helpers/llm.py @@ -3,7 +3,7 @@ from __future__ import annotations from abc import ABC, abstractmethod -from dataclasses import asdict, dataclass +from dataclasses import dataclass from enum import Enum from typing import Any @@ -138,7 +138,8 @@ class APIInstance: async def async_call_tool(self, tool_input: ToolInput) -> JsonObjectType: """Call a LLM tool, validate args and return the response.""" async_conversation_trace_append( - ConversationTraceEventType.LLM_TOOL_CALL, asdict(tool_input) + ConversationTraceEventType.LLM_TOOL_CALL, + {"tool_name": tool_input.tool_name, "tool_args": str(tool_input.tool_args)}, ) for tool in self.tools: