Skip to content

Add LiteLlmAgent class with documentation#75

Closed
ThanabordeeN wants to merge 4 commits into
google:mainfrom
ThanabordeeN:main
Closed

Add LiteLlmAgent class with documentation#75
ThanabordeeN wants to merge 4 commits into
google:mainfrom
ThanabordeeN:main

Conversation

@ThanabordeeN

Copy link
Copy Markdown

Pull Request: Introduce LiteLlmAgent for streamlined model integration

Description

This PR introduces the LiteLlmAgent class to provide a more streamlined approach for integrating with LiteLLM-supported models. The new implementation reduces complexity by wrapping model initialization details within the agent class itself, allowing developers to specify model providers and versions with simple strings rather than constructing separate model objects.

Changes

  • Added LiteLlmAgent class that handles LiteLLM model initialization internally
  • Simplified agent creation by allowing direct string references to models
  • Removed the need to manually instantiate model objects before agent creation
  • Updated documentation with usage examples

Before

from google.adk.agents import LlmAgent
from google.adk.models.lite_llm import LiteLlm

agent = LlmAgent(
    model=LiteLlm(model="openai/gpt-4o"),
    name="openai_agent",
    instruction="You are a helpful assistant powered by GPT-4o.",
    # ... other parameters
)

After

from google.adk.agents import LiteLlmAgent

agent = LiteLlmAgent(
    name="general_agent",
    model="openai/gpt-4o",
    description="Agent that answers questions and provides information.",
    instruction="You are a helpful assistant.",
    # ... other parameters
)

tutumomo pushed a commit to tutumomo/adk-python that referenced this pull request Apr 26, 2025
Add configurable polling to the UI
@hangfei

hangfei commented May 30, 2025

Copy link
Copy Markdown
Collaborator

LiteLlm can be added as a model class so this is already supported. Closing this now.

@hangfei hangfei closed this May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants