Model Providers
Google Gemini
Installation
Install AG2 with Gemini features:
Dependencies of This Notebook
In this notebook, we will explore how to use Gemini in AG2 alongside other tools. Install the necessary dependencies with the following command:
If you have been using autogen
or pyautogen
, all you need to do is upgrade it using:
or
as pyautogen
, autogen
, and ag2
are aliases for the same PyPI package.
Features
There’s no need to handle OpenAI or Google’s GenAI packages separately; AG2 manages all of these for you. You can easily create different agents with various backend LLMs using the assistant agent. All models and agents are readily accessible at your fingertips.
Support features:
- Function/tool calling
- Structured Outputs (Notebook example)
- Token usage and cost correctly as per Google’s API costs (as of December 2024)
Main Distinctions
- Gemini accepts system instructions to guide model behavior. If provided, a system message is passed to Gemini’s
system_instruction
field. - If no API key is specified for Gemini, then authentication will happen using the default google auth mechanism for Google Cloud. Service accounts are also supported, where the JSON key file has to be provided.
Sample OAI_CONFIG_LIST
Gemini coding example
Gemini vision example
Gemini’s models have vision capabilitiesso we can create multimodal agents.
Here, we ask a question about