-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
from google.adk.agents.llm_agent import Agent, LlmAgent
from google.adk.models.lite_llm import LiteLlm
from google.genai import types
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
def get_current_time(city: str) -> dict:
"""Returns the current time in a specified city."""
return {"status": "success", "city": city, "time": "10:30 AM"}
root_agent = LlmAgent(
model=LiteLlm(
model="openai/xxxxxx",
api_key="xxxxxxxxxxxxxxxxxxxxx",
api_base="https://xxxxxxxxxxxxxx/v1",
drop_params=True,
stream=False
),
name='root_agent',
description="Tells the current time in a specified city.",
instruction="You are a helpful assistant that tells the current time in cities. Use the 'get_current_time' tool for this purpose.",
tools=[get_current_time],
)
An error will be reported when using adk web to test the agent:
{"error": "litellm.InternalServerError: InternalServerError: OpenAIException - 'str' object has no attribute 'model_dump'"}
litellm.exceptions.InternalServerError: litellm.InternalServerError: InternalServerError: OpenAIException - 'str' object has no attribute 'model_dump'