Spaces:
Configuration error
Configuration error
Commit
·
b66056e
1
Parent(s):
d13c983
Debug
Browse files- app.py +6 -0
- custom_tools.py +1 -42
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -235,5 +235,11 @@ if __name__ == "__main__":
|
|
| 235 |
|
| 236 |
print("-"*(60 + len(" App Starting ")) + "\n")
|
| 237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
print("Launching Gradio Interface for Basic Agent Evaluation...")
|
| 239 |
demo.launch(debug=True, share=False)
|
|
|
|
| 235 |
|
| 236 |
print("-"*(60 + len(" App Starting ")) + "\n")
|
| 237 |
|
| 238 |
+
import pkg_resources
|
| 239 |
+
packages = pkg_resources.working_set
|
| 240 |
+
packages_list = ["%s==%s" % (i.key, i.version) for i in packages]
|
| 241 |
+
print(packages_list)
|
| 242 |
+
|
| 243 |
+
|
| 244 |
print("Launching Gradio Interface for Basic Agent Evaluation...")
|
| 245 |
demo.launch(debug=True, share=False)
|
custom_tools.py
CHANGED
|
@@ -137,42 +137,6 @@ def wiki_search(query: str) -> str:
|
|
| 137 |
except Exception as e:
|
| 138 |
return f"An unexpected error occurred: {e}"
|
| 139 |
|
| 140 |
-
|
| 141 |
-
@tool
|
| 142 |
-
def add_numbers(numbers_list: List[float]) -> Union[float, str]:
|
| 143 |
-
"""
|
| 144 |
-
Add a list of numbers and return the sum.
|
| 145 |
-
|
| 146 |
-
Args:
|
| 147 |
-
numbers_list (List[float]): A list of numbers to be added.
|
| 148 |
-
|
| 149 |
-
Returns:
|
| 150 |
-
Union[float, str]: The sum of the numbers in the list or an error message if an exception occurs.
|
| 151 |
-
|
| 152 |
-
Example:
|
| 153 |
-
add_numbers([1.5, 2.5, 3.0]) -> 7.0
|
| 154 |
-
"""
|
| 155 |
-
try:
|
| 156 |
-
if not numbers_list:
|
| 157 |
-
return 0.0
|
| 158 |
-
|
| 159 |
-
# Check if all elements in the list are numbers
|
| 160 |
-
for num in numbers_list:
|
| 161 |
-
if not isinstance(num, (int, float)):
|
| 162 |
-
raise ValueError(f"All elements in the list must be numbers. Found: {type(num)}")
|
| 163 |
-
|
| 164 |
-
return sum(numbers_list)
|
| 165 |
-
|
| 166 |
-
except TypeError as te:
|
| 167 |
-
return f"TypeError: {te}. Please ensure the input is a list of numbers."
|
| 168 |
-
|
| 169 |
-
except ValueError as ve:
|
| 170 |
-
return f"ValueError: {ve}"
|
| 171 |
-
|
| 172 |
-
except Exception as e:
|
| 173 |
-
return f"An unexpected error occurred: {e}"
|
| 174 |
-
|
| 175 |
-
|
| 176 |
@tool
|
| 177 |
def sum_excel_cols(task_id: str, file_name: str, column_names: List[str]) -> float:
|
| 178 |
"""
|
|
@@ -314,11 +278,7 @@ def analyze_image(task_id: str, file_name: str, question: str) -> str:
|
|
| 314 |
Returns:
|
| 315 |
str: The answer to the question.
|
| 316 |
"""
|
| 317 |
-
try:
|
| 318 |
-
# Returns the right answer because free vision language models are not good enough to provide the right answer.
|
| 319 |
-
if file_name=="cca530fc-4052-43b2-b130-b30968d8aa44.png":
|
| 320 |
-
return "Qd1#"
|
| 321 |
-
|
| 322 |
if not os.path.exists(file_name):
|
| 323 |
file_status = download_file(task_id, file_name)
|
| 324 |
|
|
@@ -374,7 +334,6 @@ custom_tools = [
|
|
| 374 |
wiki_search,
|
| 375 |
web_search,
|
| 376 |
url_search,
|
| 377 |
-
# add_numbers,
|
| 378 |
sum_excel_cols,
|
| 379 |
youtube_transcript,
|
| 380 |
analyse_youtube_video,
|
|
|
|
| 137 |
except Exception as e:
|
| 138 |
return f"An unexpected error occurred: {e}"
|
| 139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
@tool
|
| 141 |
def sum_excel_cols(task_id: str, file_name: str, column_names: List[str]) -> float:
|
| 142 |
"""
|
|
|
|
| 278 |
Returns:
|
| 279 |
str: The answer to the question.
|
| 280 |
"""
|
| 281 |
+
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 282 |
if not os.path.exists(file_name):
|
| 283 |
file_status = download_file(task_id, file_name)
|
| 284 |
|
|
|
|
| 334 |
wiki_search,
|
| 335 |
web_search,
|
| 336 |
url_search,
|
|
|
|
| 337 |
sum_excel_cols,
|
| 338 |
youtube_transcript,
|
| 339 |
analyse_youtube_video,
|
requirements.txt
CHANGED
|
@@ -6,7 +6,7 @@ langchain_community==0.3.26
|
|
| 6 |
langchain-google-genai==2.1.6
|
| 7 |
langchain-groq==0.3.5
|
| 8 |
langchain-mistralai==0.2.10
|
| 9 |
-
langgraph==0.
|
| 10 |
mistralai==1.7.0
|
| 11 |
opencv-python==4.10.0.84
|
| 12 |
openpyxl==3.1.5
|
|
|
|
| 6 |
langchain-google-genai==2.1.6
|
| 7 |
langchain-groq==0.3.5
|
| 8 |
langchain-mistralai==0.2.10
|
| 9 |
+
langgraph==0.5.1
|
| 10 |
mistralai==1.7.0
|
| 11 |
opencv-python==4.10.0.84
|
| 12 |
openpyxl==3.1.5
|