Upload 4 files
Browse files- agentic/langgraph_agent.py +3 -2
- agentic/tools.py +19 -2
- requirements.txt +2 -1
agentic/langgraph_agent.py
CHANGED
|
@@ -34,14 +34,15 @@ class LangGraphAgent4GAIA:
|
|
| 34 |
tools = [
|
| 35 |
multiply,
|
| 36 |
add,
|
|
|
|
| 37 |
subtract,
|
| 38 |
divide,
|
| 39 |
modulo,
|
| 40 |
-
add_list,
|
| 41 |
web_search,
|
| 42 |
arxiv_search,
|
| 43 |
wiki_search,
|
| 44 |
-
read_xlsx_file
|
|
|
|
| 45 |
]
|
| 46 |
|
| 47 |
# 1. Build graph
|
|
|
|
| 34 |
tools = [
|
| 35 |
multiply,
|
| 36 |
add,
|
| 37 |
+
add_list,
|
| 38 |
subtract,
|
| 39 |
divide,
|
| 40 |
modulo,
|
|
|
|
| 41 |
web_search,
|
| 42 |
arxiv_search,
|
| 43 |
wiki_search,
|
| 44 |
+
read_xlsx_file,
|
| 45 |
+
get_python_file
|
| 46 |
]
|
| 47 |
|
| 48 |
# 1. Build graph
|
agentic/tools.py
CHANGED
|
@@ -63,6 +63,7 @@ def modulo(a: int, b: int) -> int:
|
|
| 63 |
"""
|
| 64 |
return a % b
|
| 65 |
|
|
|
|
| 66 |
def add_list(lst: List[float]) -> float:
|
| 67 |
"""Sum up a list of numbers.
|
| 68 |
|
|
@@ -124,7 +125,6 @@ def read_xlsx_file(file_location: str) -> str:
|
|
| 124 |
Args:
|
| 125 |
file_location (str): Path to the xlsx file.
|
| 126 |
"""
|
| 127 |
-
# Build the full file URL
|
| 128 |
base_name = file_location.split(".")[0]
|
| 129 |
file_url = f"https://agents-course-unit4-scoring.hf.space/files/{base_name}"
|
| 130 |
|
|
@@ -143,4 +143,21 @@ def read_xlsx_file(file_location: str) -> str:
|
|
| 143 |
text_output += sheet_df.to_string(index=False)
|
| 144 |
text_output += "\n\n"
|
| 145 |
|
| 146 |
-
return f"xlsx file content:\n{text_output.strip()}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
"""
|
| 64 |
return a % b
|
| 65 |
|
| 66 |
+
@tool
|
| 67 |
def add_list(lst: List[float]) -> float:
|
| 68 |
"""Sum up a list of numbers.
|
| 69 |
|
|
|
|
| 125 |
Args:
|
| 126 |
file_location (str): Path to the xlsx file.
|
| 127 |
"""
|
|
|
|
| 128 |
base_name = file_location.split(".")[0]
|
| 129 |
file_url = f"https://agents-course-unit4-scoring.hf.space/files/{base_name}"
|
| 130 |
|
|
|
|
| 143 |
text_output += sheet_df.to_string(index=False)
|
| 144 |
text_output += "\n\n"
|
| 145 |
|
| 146 |
+
return f"xlsx file content:\n{text_output.strip()}"
|
| 147 |
+
|
| 148 |
+
@tool
|
| 149 |
+
def get_python_file(file_location: str) -> str:
|
| 150 |
+
"""
|
| 151 |
+
Get the content of a Python file from a path.
|
| 152 |
+
Args:
|
| 153 |
+
file_location: path to the Python file.
|
| 154 |
+
"""
|
| 155 |
+
base_name = file_location.split(".")[0]
|
| 156 |
+
file_url = f"https://agents-course-unit4-scoring.hf.space/files/{base_name}"
|
| 157 |
+
|
| 158 |
+
# Download the file
|
| 159 |
+
response = requests.get(file_url)
|
| 160 |
+
if response.status_code != 200:
|
| 161 |
+
raise RuntimeError(f"Failed to download file: {file_url}")
|
| 162 |
+
|
| 163 |
+
return f'python file:\n{response.content}'
|
requirements.txt
CHANGED
|
@@ -17,4 +17,5 @@ pymupdf
|
|
| 17 |
wikipedia
|
| 18 |
pgvector
|
| 19 |
python-dotenv
|
| 20 |
-
beautifulsoup4
|
|
|
|
|
|
| 17 |
wikipedia
|
| 18 |
pgvector
|
| 19 |
python-dotenv
|
| 20 |
+
beautifulsoup4
|
| 21 |
+
openpyxl
|