File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 1818async def generate_content () -> list [str ]:
1919 # [START googlegenaisdk_live_with_txt]
2020 from google import genai
21- from google .genai .types import LiveConnectConfig , HttpOptions , Modality
21+ from google .genai .types import (
22+ Content ,
23+ LiveConnectConfig ,
24+ HttpOptions ,
25+ Modality ,
26+ Part ,
27+ )
2228
2329 client = genai .Client (http_options = HttpOptions (api_version = "v1beta1" ))
24- model_id = "gemini-2.0-flash-exp "
30+ model_id = "gemini-2.0-flash-live-preview-04-09 "
2531
2632 async with client .aio .live .connect (
2733 model = model_id ,
2834 config = LiveConnectConfig (response_modalities = [Modality .TEXT ]),
2935 ) as session :
3036 text_input = "Hello? Gemini, are you there?"
3137 print ("> " , text_input , "\n " )
32- await session .send (input = text_input , end_of_turn = True )
38+ await session .send_client_content (
39+ turns = Content (role = "user" , parts = [Part (text = text_input )])
40+ )
3341
3442 response = []
3543
Original file line number Diff line number Diff line change 1- google-genai == 1.7 .0
1+ google-genai == 1.10 .0
You can’t perform that action at this time.
0 commit comments