Gaurav-2273 commited on
Commit
019ddd3
·
verified ·
1 Parent(s): 3af0b3a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -41,7 +41,15 @@ def run_sql(sql):
41
 
42
  # 3. AGENTIC LOGIC
43
  def sql_agent(user_prompt):
44
- model = genai.GenerativeModel('gemini-1.5-flash-latest')
 
 
 
 
 
 
 
 
45
  schema = get_schema()
46
 
47
  # ATTEMPT 1
 
41
 
42
  # 3. AGENTIC LOGIC
43
  def sql_agent(user_prompt):
44
+ # Force the model to use the most stable string
45
+ # Try 'gemini-1.5-flash' first, but if it fails, 'gemini-pro' is the universal fallback
46
+ try:
47
+ model = genai.GenerativeModel('gemini-1.5-flash')
48
+ # Test a small call to see if it's alive
49
+ model.generate_content("test")
50
+ except:
51
+ # Fallback to the older, most stable naming convention
52
+ model = genai.GenerativeModel('gemini-pro')
53
  schema = get_schema()
54
 
55
  # ATTEMPT 1