Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, tool
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import datetime
|
| 4 |
import pytz
|
|
@@ -54,9 +55,17 @@ def simple_calculator(expression: str) -> str:
|
|
| 54 |
except:
|
| 55 |
return "❌ Invalid math expression"
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
# ==================== CREATE AGENT ====================
|
| 58 |
-
# ✨ NO FinalAnswerTool needed!
|
| 59 |
agent = CodeAgent(
|
|
|
|
| 60 |
tools=[
|
| 61 |
DuckDuckGoSearchTool(), # Web search
|
| 62 |
get_current_time_in_timezone, # Time tool
|
|
|
|
| 1 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, tool
|
| 2 |
+
from smolagents.models import LiteLLMModel # ✨ ADD THIS
|
| 3 |
import gradio as gr
|
| 4 |
import datetime
|
| 5 |
import pytz
|
|
|
|
| 55 |
except:
|
| 56 |
return "❌ Invalid math expression"
|
| 57 |
|
| 58 |
+
# ==================== CREATE MODEL ====================
|
| 59 |
+
# ✨ ADD THIS: Create a model object
|
| 60 |
+
model = LiteLLMModel(
|
| 61 |
+
model="gpt-3.5-turbo", # Free model that works
|
| 62 |
+
api_base="https://api.openai.com/v1", # OpenAI endpoint
|
| 63 |
+
temperature=0.5
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
# ==================== CREATE AGENT ====================
|
|
|
|
| 67 |
agent = CodeAgent(
|
| 68 |
+
model=model, # ✨ ADD THIS: Pass the model object
|
| 69 |
tools=[
|
| 70 |
DuckDuckGoSearchTool(), # Web search
|
| 71 |
get_current_time_in_timezone, # Time tool
|