Models
Gemini
Example
from os import getenv
import vertexai
from phi.agent import Agent
from phi.llm.gemini import Gemini
# *********** Initialize VertexAI ***********
vertexai.init(project=getenv("PROJECT_ID"), location=getenv("LOCATION"))
agent = Agent(
llm=Gemini(model="gemini-1.0-pro-vision"),
description="You help people with their health and fitness goals.",
)
agent.print_response("Share a 2 sentence quick and healthy breakfast recipe.", markdown=True)
Usage
1
Prerequisites
- Install the Google Cloud SDK
- Create a Google Cloud project
- Enable the AI Platform API
- Authenticate with Google Cloud
gcloud auth application-default login
2
Create a virtual environment
Open the Terminal
and create a python virtual environment.
3
Install libraries
pip install -U google-cloud-aiplatform phidata
4
Export the following environment variables
export PROJECT_ID=your-project-id
export LOCATION=us-central1
5
Run Gemini Agent
python cookbook/llms/gemini/agent.py
Information
- View on Github