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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -165,8 +165,9 @@ class GeminiInteractionLoop:
165
  return
166
  try:
167
  logging.info(f"Sending text to Gemini: '{user_text[:50]}...'")
168
- # Send text directly using the send method
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,8 +434,9 @@ class GeminiInteractionLoop:
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 the correct 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(
 
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
  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(