noumanjavaid commited on
Commit
d6a8d5f
·
verified ·
1 Parent(s): d66bc6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -165,9 +165,8 @@ class GeminiInteractionLoop:
165
  return
166
  try:
167
  logging.info(f"Sending text to Gemini: '{user_text[:50]}...'")
168
- # Format text as a Content object for the Gemini API
169
- content = types.Content(parts=[types.Part(text=user_text)])
170
- await self.gemini_session.send(content)
171
  except Exception as e:
172
  logging.error(
173
  f"Error sending text message to Gemini: {e}", exc_info=True)
@@ -434,9 +433,8 @@ class GeminiInteractionLoop:
434
  f"Gemini session established with API for model {MODEL_NAME}.")
435
  try:
436
  logging.info("Sending system prompt to Gemini...")
437
- # Format system prompt as a Content object for the Gemini API
438
- content = types.Content(parts=[types.Part(text=MEDICAL_ASSISTANT_SYSTEM_PROMPT)])
439
- await self.gemini_session.send(content)
440
  logging.info("System prompt sent successfully.")
441
  except Exception as e:
442
  logging.error(
 
165
  return
166
  try:
167
  logging.info(f"Sending text to Gemini: '{user_text[:50]}...'")
168
+ # Send text using input parameter format
169
+ await self.gemini_session.send(input={"text": user_text})
 
170
  except Exception as e:
171
  logging.error(
172
  f"Error sending text message to Gemini: {e}", exc_info=True)
 
433
  f"Gemini session established with API for model {MODEL_NAME}.")
434
  try:
435
  logging.info("Sending system prompt to Gemini...")
436
+ # Send system prompt using input parameter format
437
+ await self.gemini_session.send(input={"text": MEDICAL_ASSISTANT_SYSTEM_PROMPT})
 
438
  logging.info("System prompt sent successfully.")
439
  except Exception as e:
440
  logging.error(