Skip to content

Commit e18303c

Browse files
committed
Updated parameters and removed deprecation warnings
1 parent fbf64b9 commit e18303c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

gemini-live-cam.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ async def send_text(self):
8686
if text.lower() == "q":
8787
break
8888
if self.session is not None:
89-
await self.session.send(input=text or ".", end_of_turn=True)
89+
await self.session.send_client_content(
90+
turns=types.Content(
91+
role="user",
92+
parts=[types.Part(text=text or ".")]
93+
)
94+
)
9095
else:
9196
print("Session is not initialized. Unable to send text.")
9297

@@ -162,7 +167,10 @@ async def send_realtime(self):
162167
while True:
163168
msg = await self.out_queue.get()
164169
if self.session is not None:
165-
await self.session.send(input=msg)
170+
# For audio: send as types.Blob
171+
await self.session.send_realtime_input(
172+
media=types.Blob(data=msg["data"], mime_type=msg["mime_type"])
173+
)
166174
else:
167175
print("Session is not initialized. Unable to send message.")
168176

0 commit comments

Comments
 (0)