Fix LLM tracing for Google Generative AI (#118359)

Fix LLM tracing for Gemini
This commit is contained in:
tronikos 2024-05-29 05:02:59 -07:00 committed by GitHub
parent b7ee90a53c
commit c75cb08aae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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: