give me an example of gemini vision assistant and ...
# ask-ai
h
give me an example of gemini vision assistant and also tell me the version of livekit agent that i need for this to work
✅ 1
t
Thanks for reaching out, Ahmed. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’ll cover both parts: a concise Gemini Vision Assistant example and the LiveKit agent version you’ll need. Example (Python) — Gemini Vision Assistant using LiveKit Google plugin
Copy code
from livekit_agents import AgentSession, room_io
from livekit_agents.plugins.google import RealtimeModel

class VideoAssistant:
    async def on_start(self, ctx):
        # handle session start
        pass

    async def on_input(self, ctx, message):
        # handle text/audio input and vision frames
        pass

# create a session that enables camera/screen video input
session = AgentSession(
    model=RealtimeModel(),           # google realtime model (Gemini Live)
)

await session.start(
    agent=VideoAssistant(),
    room=ctx.room,
    room_options=room_io.RoomOptions(video_input=True),
    # optional: customize frame sampling
    # video_sampler=CustomSampler(...)
)
Notes: • The assistant uses the Gemini Live API via
google.realtime.RealtimeModel
from the Google plugin. • By default the agent samples ~1 fps while the user speaks and ~1 frame every 3 seconds otherwise; you can customize sampling with
video_sampler
. • For a full, complete recipe and more details (handling frames, outputs, and config), see the Gemini Vision recipe in the Vision guide. Required LiveKit agent version • Use
livekit-agents
with the Google plugin at version 1.5 or later. The docs show installing:
Copy code
uv add "livekit-agents[google]~=1.5"
so ensure
livekit-agents
(and the Google plugin) are at least v1.5 to support Gemini Live Vision features. If you want, I can: • Paste the full Vision recipe example, • Show a sample
video_sampler
implementation, or • Help you confirm exact package versions from your environment — which would require the output of
pip show livekit-agents
(or your lockfile). Which do you prefer? Sources: Vision | LiveKit Documentation | Gemini Live API plugin | LiveKit Documentation, with interactive elements