Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, t
|
|
| 2 |
import datetime
|
| 3 |
import pytz
|
| 4 |
import yaml
|
|
|
|
| 5 |
from skyfield.api import load, Topos, load_file
|
| 6 |
from skyfield import almanac
|
| 7 |
from tools.final_answer import FinalAnswerTool
|
|
@@ -21,8 +22,7 @@ from opentelemetry.sdk.trace import TracerProvider
|
|
| 21 |
|
| 22 |
from openinference.instrumentation.smolagents import SmolagentsInstrumentor
|
| 23 |
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
| 24 |
-
from opentelemetry.sdk
|
| 25 |
-
.trace.export import SimpleSpanProcessor
|
| 26 |
|
| 27 |
trace_provider = TracerProvider()
|
| 28 |
trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter()))
|
|
@@ -303,6 +303,12 @@ agent = CodeAgent(
|
|
| 303 |
max_steps=6,
|
| 304 |
verbosity_level=1,
|
| 305 |
prompt_templates=prompt_templates
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
)
|
| 307 |
|
| 308 |
if __name__ == "__main__":
|
|
|
|
| 2 |
import datetime
|
| 3 |
import pytz
|
| 4 |
import yaml
|
| 5 |
+
|
| 6 |
from skyfield.api import load, Topos, load_file
|
| 7 |
from skyfield import almanac
|
| 8 |
from tools.final_answer import FinalAnswerTool
|
|
|
|
| 22 |
|
| 23 |
from openinference.instrumentation.smolagents import SmolagentsInstrumentor
|
| 24 |
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
| 25 |
+
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
|
|
|
|
| 26 |
|
| 27 |
trace_provider = TracerProvider()
|
| 28 |
trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter()))
|
|
|
|
| 303 |
max_steps=6,
|
| 304 |
verbosity_level=1,
|
| 305 |
prompt_templates=prompt_templates
|
| 306 |
+
safe_mode=True, # Enable safe code execution
|
| 307 |
+
timeout=100, # Seconds before execution timeout
|
| 308 |
+
max_memory=512, # MB memory limit
|
| 309 |
+
file_system_access=False, # Disable disk write access
|
| 310 |
+
network_access=False, # Block network operations
|
| 311 |
+
max_code_iterations=100, # Prevent infinite loops )
|
| 312 |
)
|
| 313 |
|
| 314 |
if __name__ == "__main__":
|