Spaces:
Configuration error
Configuration error
Alejandro Ardila commited on
Commit ·
6acdf38
1
Parent(s): 668ba52
Fixed runtime errors.
Browse files- app.py +1 -1
- src/agent/basic_agent.py +1 -1
- src/agent/tools/__init__.py +4 -2
- src/agent/tools/coding_tools.py +2 -2
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import gradio as gr
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
-
from agent.basic_agent import BasicAgent
|
| 7 |
# (Keep Constants as is)
|
| 8 |
# --- Constants ---
|
| 9 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
+
from src.agent.basic_agent import BasicAgent
|
| 7 |
# (Keep Constants as is)
|
| 8 |
# --- Constants ---
|
| 9 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
src/agent/basic_agent.py
CHANGED
|
@@ -30,7 +30,7 @@ class BasicAgent:
|
|
| 30 |
self.graph = builder.compile()
|
| 31 |
print("BasicAgent initialized.")
|
| 32 |
|
| 33 |
-
def __call__(self, question: str) ->
|
| 34 |
print(f"Agent received question...")
|
| 35 |
message = HumanMessage(content=question)
|
| 36 |
answer = self.graph.invoke({"messages": [message]})
|
|
|
|
| 30 |
self.graph = builder.compile()
|
| 31 |
print("BasicAgent initialized.")
|
| 32 |
|
| 33 |
+
def __call__(self, question: str) -> str:
|
| 34 |
print(f"Agent received question...")
|
| 35 |
message = HumanMessage(content=question)
|
| 36 |
answer = self.graph.invoke({"messages": [message]})
|
src/agent/tools/__init__.py
CHANGED
|
@@ -1,8 +1,10 @@
|
|
| 1 |
from .math_tools import math_tools
|
| 2 |
from .web_tools import web_tools
|
|
|
|
| 3 |
|
| 4 |
# Consolidate all tools into a single exportable array
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
# For backward compatibility, also export individual tool categories
|
| 8 |
-
__all__ = ['tools', 'math_tools', 'web_tools']
|
|
|
|
| 1 |
from .math_tools import math_tools
|
| 2 |
from .web_tools import web_tools
|
| 3 |
+
from .coding_tools import code_agent
|
| 4 |
|
| 5 |
# Consolidate all tools into a single exportable array
|
| 6 |
+
coding_tools = [code_agent]
|
| 7 |
+
tools = web_tools + math_tools + coding_tools
|
| 8 |
|
| 9 |
# For backward compatibility, also export individual tool categories
|
| 10 |
+
__all__ = ['tools', 'math_tools', 'web_tools', 'coding_tools']
|
src/agent/tools/coding_tools.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
from langchain_core.tools import tool
|
| 2 |
-
from smolagents import CodeAgent,
|
| 3 |
|
| 4 |
|
| 5 |
imports = ['datetime', 'pandas', 'numpy', 'python-chess', 'set', 'math']
|
| 6 |
-
agent = CodeAgent(tools=[], model=
|
| 7 |
|
| 8 |
@tool
|
| 9 |
def code_agent(question: str) -> str:
|
|
|
|
| 1 |
from langchain_core.tools import tool
|
| 2 |
+
from smolagents import CodeAgent, InferenceClientModel
|
| 3 |
|
| 4 |
|
| 5 |
imports = ['datetime', 'pandas', 'numpy', 'python-chess', 'set', 'math']
|
| 6 |
+
agent = CodeAgent(tools=[], model=InferenceClientModel(), additional_authorized_imports=imports, max_steps=10,)
|
| 7 |
|
| 8 |
@tool
|
| 9 |
def code_agent(question: str) -> str:
|