Skip to content

Add LiteLlmAgent class with documentation #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ThanabordeeN
Copy link

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
)

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.

1 participant