Update app.py
Browse files
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
|
| 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
|
| 67 |
self.agent = ToolCallingAgent(
|
| 68 |
name="GAIA_Agent",
|
| 69 |
description=self.system_prompt,
|
| 70 |
tools=[web_search, calculate],
|
| 71 |
-
model=client
|
| 72 |
-
|
| 73 |
planning_interval=3
|
| 74 |
)
|
| 75 |
-
print("✅ Agent initialized
|
| 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:
|