fix: GoogleLLM, agent and handler according to the new genai SDK

This commit is contained in:
Siddhant Rai
2025-01-18 19:56:25 +05:30
parent ec270a3b54
commit 904b0bf2da
4 changed files with 116 additions and 158 deletions

View File

@@ -1,7 +1,5 @@
import json
from google.protobuf.json_format import MessageToDict
class ToolActionParser:
def __init__(self, llm_type):
@@ -22,8 +20,7 @@ class ToolActionParser:
return tool_id, action_name, call_args
def _parse_google_llm(self, call):
call = MessageToDict(call._pb)
call_args = call["args"]
tool_id = call["name"].split("_")[-1]
action_name = call["name"].rsplit("_", 1)[0]
call_args = call.args
tool_id = call.name.split("_")[-1]
action_name = call.name.rsplit("_", 1)[0]
return tool_id, action_name, call_args