import requests
from agno.agent import Agent
from agno.media import Video
from agno.models.google import Gemini
agent = Agent(
model=Gemini(id="gemini-2.0-flash-exp"),
markdown=True,
)
url = "https://videos.pexels.com/video-files/5752729/5752729-uhd_2560_1440_30fps.mp4"
# 从 URL 下载视频文件为字节
response = requests.get(url)
video_content = response.content
agent.print_response(
"告诉我关于这个视频的信息",
videos=[Video(content=video_content)],
)
创建虚拟环境
打开 Terminal
并创建一个 python 虚拟环境。
python3 -m venv .venv
source .venv/bin/activate
设置你的 API 密钥
export GOOGLE_API_KEY=xxx
安装库
pip install -U google-genai agno
运行 Agent
python cookbook/models/google/gemini/video_input_bytes_content.py