Asish Karthikeya Gogineni commited on
Commit
fe03c86
·
1 Parent(s): 8e40df0

fix: Use gemini-2.5-flash as default (confirmed working)

Browse files
Files changed (2) hide show
  1. app.py +6 -8
  2. code_chatbot/rag.py +5 -4
app.py CHANGED
@@ -331,16 +331,14 @@ with st.sidebar:
331
  gemini_model = st.selectbox(
332
  "Gemini Model",
333
  [
334
- "gemini-1.5-flash",
335
- "gemini-1.5-pro",
336
  "gemini-2.0-flash",
337
- "gemini-2.5-flash", # May require newer API
338
  ],
339
- index=0, # Default to 1.5 Flash (stable, free tier)
340
- help="""**Gemini 1.5 Flash** (Recommended): Stable, fast, FREE tier (15 RPM)
341
- **Gemini 1.5 Pro**: Better reasoning, 2M context, FREE tier
342
- **Gemini 2.0 Flash**: Newer model, may have lower limits
343
- **Gemini 2.5 Flash**: Latest, may require paid plan"""
344
  )
345
  st.caption(f"✨ Using {gemini_model}")
346
 
 
331
  gemini_model = st.selectbox(
332
  "Gemini Model",
333
  [
334
+ "gemini-2.5-flash", # This one was working!
 
335
  "gemini-2.0-flash",
336
+ "gemini-1.5-pro",
337
  ],
338
+ index=0, # Default to 2.5 Flash (confirmed working)
339
+ help="""**Gemini 2.5 Flash** (Recommended): Latest, confirmed working
340
+ **Gemini 2.0 Flash**: Newer model
341
+ **Gemini 1.5 Pro**: More stable for complex tasks"""
 
342
  )
343
  st.caption(f"✨ Using {gemini_model}")
344
 
code_chatbot/rag.py CHANGED
@@ -118,10 +118,11 @@ class ChatEngine:
118
  if not os.getenv("GOOGLE_API_KEY"):
119
  raise ValueError("Google API Key is required for Gemini")
120
 
121
- # Use models/ prefix for Gemini models
122
- model_name = self.model_name or "gemini-1.5-flash"
123
- if not model_name.startswith("models/"):
124
- model_name = f"models/{model_name}"
 
125
 
126
  return ChatGoogleGenerativeAI(
127
  model=model_name,
 
118
  if not os.getenv("GOOGLE_API_KEY"):
119
  raise ValueError("Google API Key is required for Gemini")
120
 
121
+ # Use model name without prefix - langchain handles it
122
+ model_name = self.model_name or "gemini-2.5-flash"
123
+ # Remove models/ prefix if present (langchain adds it)
124
+ if model_name.startswith("models/"):
125
+ model_name = model_name.replace("models/", "")
126
 
127
  return ChatGoogleGenerativeAI(
128
  model=model_name,