Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -96,22 +96,20 @@ class BasicAgent:
|
|
96 |
print(f"β
Model loaded on device: {self.model.model.device}")
|
97 |
else:
|
98 |
print("β
Model loaded (device info not directly accessible)")
|
99 |
-
|
100 |
-
# Initialize the search tool
|
101 |
-
self.search_tool = DuckDuckGoSearchTool()
|
102 |
|
103 |
# Create CodeAgent with DuckDuckGoSearchTool and additional imports
|
104 |
self.agent = CodeAgent(
|
105 |
-
tools=[
|
106 |
model=self.model,
|
107 |
max_steps=30,
|
108 |
additional_authorized_imports=[
|
109 |
-
'math', 'statistics', 're',
|
110 |
'requests', 'json', # Web requests and JSON
|
111 |
-
'pandas', 'numpy',
|
112 |
'zipfile', 'os', # File processing
|
113 |
'datetime', 'time' # Date/time operations
|
114 |
-
]
|
|
|
115 |
)
|
116 |
|
117 |
self.tools_available = True
|
@@ -132,7 +130,7 @@ class BasicAgent:
|
|
132 |
"""Run question through smolagents CodeAgent with enhanced prompting."""
|
133 |
try:
|
134 |
# Use the global CURRENT_PROMPT variable
|
135 |
-
formatted_question = CURRENT_PROMPT.format(question=question)
|
136 |
|
137 |
print(f"π Processing question: {question}")
|
138 |
print(f"π§ Available tools: {[tool.__class__.__name__ for tool in self.agent.tools]}")
|
|
|
96 |
print(f"β
Model loaded on device: {self.model.model.device}")
|
97 |
else:
|
98 |
print("β
Model loaded (device info not directly accessible)")
|
|
|
|
|
|
|
99 |
|
100 |
# Create CodeAgent with DuckDuckGoSearchTool and additional imports
|
101 |
self.agent = CodeAgent(
|
102 |
+
tools=[],
|
103 |
model=self.model,
|
104 |
max_steps=30,
|
105 |
additional_authorized_imports=[
|
106 |
+
'math', 'statistics', 're', # Basic computation
|
107 |
'requests', 'json', # Web requests and JSON
|
108 |
+
'pandas', 'numpy', 'openpyxl',# Data analysis
|
109 |
'zipfile', 'os', # File processing
|
110 |
'datetime', 'time' # Date/time operations
|
111 |
+
],
|
112 |
+
add_base_tools=True,
|
113 |
)
|
114 |
|
115 |
self.tools_available = True
|
|
|
130 |
"""Run question through smolagents CodeAgent with enhanced prompting."""
|
131 |
try:
|
132 |
# Use the global CURRENT_PROMPT variable
|
133 |
+
formatted_question = question #CURRENT_PROMPT.format(question=question)
|
134 |
|
135 |
print(f"π Processing question: {question}")
|
136 |
print(f"π§ Available tools: {[tool.__class__.__name__ for tool in self.agent.tools]}")
|