Video Input (Bytes Content)
Code
1import requests2from kern.agent import Agent3from kern.media import Video4from kern.models.google import Gemini56agent = Agent(7 model=Gemini(id="gemini-2.0-flash-exp"),8 markdown=True,9)1011url = "https://videos.pexels.com/video-files/5752729/5752729-uhd_2560_1440_30fps.mp4"1213# Download the video file from the URL as bytes14response = requests.get(url)15video_content = response.content1617agent.print_response(18 "Tell me about this video",19 videos=[Video(content=video_content)],20)Usage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateSet your API key
1export GOOGLE_API_KEY=xxxInstall dependencies
1uv pip install -U google-genai kern-aiRun Agent
1python cookbook/11_models/google/gemini/video_input_bytes_content.py