Spaces:
Running
Running
Update agent.py
Browse files
agent.py
CHANGED
@@ -43,47 +43,7 @@ def GoogleSearchTool(query: str) -> str:
|
|
43 |
except Exception as e:
|
44 |
return f"Error performing Google search: {str(e)}"
|
45 |
|
46 |
-
#@tool
|
47 |
-
|
48 |
-
#def ImageAnalysisTool(question: str, model: LiteLLMModel) -> str:
|
49 |
-
# """Tool for analyzing images mentioned in the question.
|
50 |
-
# Args:
|
51 |
-
# question (str): The question text which may contain an image URL.
|
52 |
-
# Returns:
|
53 |
-
# str: Image description or error message.
|
54 |
-
# """
|
55 |
-
# # Extract URL from question using regex
|
56 |
-
# url_pattern = r'https?://\S+'
|
57 |
-
#
|
58 |
-
# match = re.search(url_pattern, question)
|
59 |
-
# if not match:
|
60 |
-
# return "No image URL found in the question."
|
61 |
-
# image_url = match.group(0)
|
62 |
-
#
|
63 |
-
# headers = {
|
64 |
-
# "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
|
65 |
-
# }
|
66 |
-
# try:
|
67 |
-
# response = requests.get(image_url, headers=headers)
|
68 |
|
69 |
-
# response.raise_for_status()
|
70 |
-
# image = Image.open(BytesIO(response.content)).convert("RGB")
|
71 |
-
# except Exception as e:
|
72 |
-
# return f"Error fetching image: {e}"
|
73 |
-
#
|
74 |
-
# agent = CodeAgent(
|
75 |
-
# tools=[],
|
76 |
-
# model=model,
|
77 |
-
# max_steps=10,
|
78 |
-
# verbosity_level=2
|
79 |
-
# )
|
80 |
-
#
|
81 |
-
# response = agent.run(
|
82 |
-
# "Describe in details the chess position you see in the image.",
|
83 |
-
# images=[image]
|
84 |
-
# )
|
85 |
-
#
|
86 |
-
# return f"The image description: '{response}'"
|
87 |
|
88 |
class VisitWebpageTool(Tool):
|
89 |
name = "visit_webpage"
|
|
|
43 |
except Exception as e:
|
44 |
return f"Error performing Google search: {str(e)}"
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
class VisitWebpageTool(Tool):
|
49 |
name = "visit_webpage"
|