|
18 | 18 | from google.adk.agents import LiveRequestQueue |
19 | 19 | from google.adk.agents.llm_agent import Agent |
20 | 20 | from google.adk.tools.function_tool import FunctionTool |
21 | | -from google.genai import Client |
22 | 21 | from google.genai import types as genai_types |
23 | 22 |
|
24 | 23 |
|
@@ -54,6 +53,8 @@ async def monitor_video_stream( |
54 | 53 | ) -> AsyncGenerator[str, None]: |
55 | 54 | """Monitor how many people are in the video streams.""" |
56 | 55 | print("start monitor_video_stream!") |
| 56 | + from google.genai import Client |
| 57 | + |
57 | 58 | client = Client(vertexai=False) |
58 | 59 | prompt_text = ( |
59 | 60 | "Count the number of people in this image. Just respond with a numeric" |
@@ -87,7 +88,7 @@ async def monitor_video_stream( |
87 | 88 |
|
88 | 89 | # Call the model to generate content based on the provided image and prompt |
89 | 90 | response = client.models.generate_content( |
90 | | - model="gemini-2.0-flash-exp", |
| 91 | + model="gemini-2.5-flash", |
91 | 92 | contents=contents, |
92 | 93 | config=genai_types.GenerateContentConfig( |
93 | 94 | system_instruction=( |
@@ -121,9 +122,11 @@ def stop_streaming(function_name: str): |
121 | 122 |
|
122 | 123 |
|
123 | 124 | root_agent = Agent( |
124 | | - # find supported models here: https://google.github.io/adk-docs/get-started/streaming/quickstart-streaming/ |
125 | | - model="gemini-2.0-flash-live-preview-04-09", # for Vertex project |
126 | | - # model="gemini-live-2.5-flash-preview", # for AI studio key |
| 125 | + # see https://docs.cloud.google.com/vertex-ai/generative-ai/docs/migrate |
| 126 | + # for vertex model names |
| 127 | + model="gemini-live-2.5-flash-native-audio", # vertex |
| 128 | + # see https://ai.google.dev/gemini-api/docs/models for AIS model names |
| 129 | + # model='gemini-2.5-flash-native-audio-latest', # for AI studio |
127 | 130 | name="video_streaming_agent", |
128 | 131 | instruction=""" |
129 | 132 | You are a monitoring agent. You can do video monitoring and stock price monitoring |
|
0 commit comments