Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions contributing/samples/live_bidi_streaming_tools_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from google.adk.agents import LiveRequestQueue
from google.adk.agents.llm_agent import Agent
from google.adk.tools.function_tool import FunctionTool
from google.genai import Client
from google.genai import types as genai_types


Expand Down Expand Up @@ -54,6 +53,8 @@ async def monitor_video_stream(
) -> AsyncGenerator[str, None]:
"""Monitor how many people are in the video streams."""
print("start monitor_video_stream!")
from google.genai import Client

client = Client(vertexai=False)
prompt_text = (
"Count the number of people in this image. Just respond with a numeric"
Expand Down Expand Up @@ -87,7 +88,7 @@ async def monitor_video_stream(

# Call the model to generate content based on the provided image and prompt
response = client.models.generate_content(
model="gemini-2.0-flash-exp",
model="gemini-2.5-flash",
contents=contents,
config=genai_types.GenerateContentConfig(
system_instruction=(
Expand Down Expand Up @@ -121,9 +122,11 @@ def stop_streaming(function_name: str):


root_agent = Agent(
# find supported models here: https://google.github.io/adk-docs/get-started/streaming/quickstart-streaming/
model="gemini-2.0-flash-live-preview-04-09", # for Vertex project
# model="gemini-live-2.5-flash-preview", # for AI studio key
# see https://docs.cloud.google.com/vertex-ai/generative-ai/docs/migrate
# for vertex model names
model="gemini-live-2.5-flash-native-audio", # vertex
# see https://ai.google.dev/gemini-api/docs/models for AIS model names
# model='gemini-2.5-flash-native-audio-latest', # for AI studio
name="video_streaming_agent",
instruction="""
You are a monitoring agent. You can do video monitoring and stock price monitoring
Expand Down
Loading