sirine1712 commited on
Commit
ddef1f6
·
verified ·
1 Parent(s): 106238b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -54,7 +54,7 @@ def calculate(expression: str) -> str:
54
  except Exception as e:
55
  return f"Calculation error: {str(e)}"
56
 
57
- # --- Agent with Proper Model Initialization ---
58
  class GAIAAgent:
59
  def __init__(self):
60
  self.system_prompt = """You are an AI assistant that answers questions using tools:
@@ -63,16 +63,16 @@ class GAIAAgent:
63
  - Be concise and accurate"""
64
 
65
  try:
66
- # Initialize with proper ChatModel instance
67
  self.agent = ToolCallingAgent(
68
  name="GAIA_Agent",
69
  description=self.system_prompt,
70
  tools=[web_search, calculate],
71
- model=client.chat.completions, # Proper model instance
72
- model_name="gpt-3.5-turbo",
73
  planning_interval=3
74
  )
75
- print("✅ Agent initialized with OpenAI model")
76
  except Exception as e:
77
  raise RuntimeError(f"Agent init failed: {str(e)}")
78
 
@@ -84,6 +84,7 @@ class GAIAAgent:
84
  except Exception as e:
85
  return f"Error: {str(e)}"
86
 
 
87
  # --- Gradio Interface ---
88
  def submit_answers(profile: gr.OAuthProfile | None):
89
  if not profile:
 
54
  except Exception as e:
55
  return f"Calculation error: {str(e)}"
56
 
57
+ # --- Agent with Proper Initialization ---
58
  class GAIAAgent:
59
  def __init__(self):
60
  self.system_prompt = """You are an AI assistant that answers questions using tools:
 
63
  - Be concise and accurate"""
64
 
65
  try:
66
+ # Initialize with proper configuration
67
  self.agent = ToolCallingAgent(
68
  name="GAIA_Agent",
69
  description=self.system_prompt,
70
  tools=[web_search, calculate],
71
+ model=client, # Pass the OpenAI client directly
72
+ model_kwargs={"model": "gpt-3.5-turbo"}, # Specify model here
73
  planning_interval=3
74
  )
75
+ print("✅ Agent initialized successfully")
76
  except Exception as e:
77
  raise RuntimeError(f"Agent init failed: {str(e)}")
78
 
 
84
  except Exception as e:
85
  return f"Error: {str(e)}"
86
 
87
+
88
  # --- Gradio Interface ---
89
  def submit_answers(profile: gr.OAuthProfile | None):
90
  if not profile: