Spaces:
Sleeping
Sleeping
Update gaia_agent.py
Browse files- gaia_agent.py +17 -1
gaia_agent.py
CHANGED
|
@@ -204,7 +204,23 @@ def df_to_column_row_map(df):
|
|
| 204 |
|
| 205 |
def excel_csv_reader(file_path: str, query: str = "") -> str:
|
| 206 |
"""
|
| 207 |
-
Reads a CSV or Excel file and
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
"""
|
| 209 |
try:
|
| 210 |
_, ext = os.path.splitext(file_path.lower())
|
|
|
|
| 204 |
|
| 205 |
def excel_csv_reader(file_path: str, query: str = "") -> str:
|
| 206 |
"""
|
| 207 |
+
Reads a CSV or Excel file and returns its contents as a dictionary array.
|
| 208 |
+
|
| 209 |
+
If no file path or filename is provided, the agent must:
|
| 210 |
+
1. Infer whether the user is referring to a CSV or Excel file based on context.
|
| 211 |
+
2. Search the workspace for a matching file (e.g., any .csv or .xlsx file).
|
| 212 |
+
3. If multiple matches exist, choose the most relevant one based on the query.
|
| 213 |
+
|
| 214 |
+
Default fallback paths:
|
| 215 |
+
- /<inferred>.csv
|
| 216 |
+
- /<inferred>.xlsx
|
| 217 |
+
|
| 218 |
+
Args:
|
| 219 |
+
file_path (str, optional): The full path or filename. If omitted, the agent must auto-detect the correct file.
|
| 220 |
+
|
| 221 |
+
Returns:
|
| 222 |
+
str: The parsed content as a dictionary array or an explicit error message if the file cannot be found or inferred.
|
| 223 |
+
|
| 224 |
"""
|
| 225 |
try:
|
| 226 |
_, ext = os.path.splitext(file_path.lower())
|