Spaces:
Sleeping
Sleeping
updated image processing
Browse files
agent.py
CHANGED
@@ -1585,17 +1585,7 @@ class TurboNerd:
|
|
1585 |
# Example usage:
|
1586 |
if __name__ == "__main__":
|
1587 |
agent = TurboNerd(max_iterations=25)
|
1588 |
-
response = agent("""
|
1589 |
-
|
1590 |
-
|*|a|b|c|d|e|
|
1591 |
-
|---|---|---|---|---|---|
|
1592 |
-
|a|a|b|c|b|d|
|
1593 |
-
|b|b|c|a|e|c|
|
1594 |
-
|c|c|a|b|b|a|
|
1595 |
-
|d|b|e|b|e|d|
|
1596 |
-
|e|d|b|a|d|c|
|
1597 |
-
|
1598 |
-
provide the subset of S involved in any possible counter-examples that prove * is not commutative. Provide your answer as a comma separated list of the elements in the set in alphabetical order.""")
|
1599 |
print("\nFinal Response:")
|
1600 |
print(response)
|
1601 |
|
|
|
1585 |
# Example usage:
|
1586 |
if __name__ == "__main__":
|
1587 |
agent = TurboNerd(max_iterations=25)
|
1588 |
+
response = agent("""The attached Excel file contains the sales of menu items for a local fast-food chain. What were the total sales that the chain made from food (not including drinks)? Express your answer in USD with two decimal places. TEMPP\excel.xlsx """)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1589 |
print("\nFinal Response:")
|
1590 |
print(response)
|
1591 |
|
tools.py
CHANGED
@@ -273,14 +273,12 @@ def run_python_code(code: str):
|
|
273 |
|
274 |
return '\n'.join(cleaned_output)
|
275 |
|
276 |
-
except SyntaxError as e:
|
277 |
-
return f"Syntax Error: {str(e)}"
|
278 |
-
except NameError as e:
|
279 |
-
return f"Name Error: {str(e)}"
|
280 |
-
except ZeroDivisionError as e:
|
281 |
-
return f"Zero Division Error: {str(e)}"
|
282 |
except Exception as e:
|
283 |
-
|
|
|
|
|
|
|
|
|
284 |
|
285 |
def scrape_webpage(url: str, keywords: Optional[List[str]] = None) -> str:
|
286 |
"""
|
@@ -1204,7 +1202,7 @@ def process_image(image_path: str, image_url: Optional[str] = None, file_content
|
|
1204 |
{
|
1205 |
"role": "user",
|
1206 |
"content": [
|
1207 |
-
{"type": "text", "text": "Describe this image in detail, including the main subject, colors, setting, and any notable features. Be factual and objective. For a chess posistion,
|
1208 |
{
|
1209 |
"type": "image_url",
|
1210 |
"image_url": {
|
|
|
273 |
|
274 |
return '\n'.join(cleaned_output)
|
275 |
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
except Exception as e:
|
277 |
+
# Get the error type name without the "Error" suffix if it exists
|
278 |
+
error_type = type(e).__name__.replace('Error', '')
|
279 |
+
# Add a space between camel case words
|
280 |
+
error_type = re.sub(r'([a-z])([A-Z])', r'\1 \2', error_type)
|
281 |
+
return f"{error_type} Error: {str(e)}. Try again with a different code or try a different tool."
|
282 |
|
283 |
def scrape_webpage(url: str, keywords: Optional[List[str]] = None) -> str:
|
284 |
"""
|
|
|
1202 |
{
|
1203 |
"role": "user",
|
1204 |
"content": [
|
1205 |
+
{"type": "text", "text": "Describe this image in detail, including the main subject, colors, setting, and any notable features. Be factual and objective. For a chess posistion, 1. List all the pieces and their positions (e.g., 'White King at e1', 'Black Queen at d8') 2. List any special conditions (castling rights, en passant, etc.) 3. Provide the position in FEN notation 4. Convert the position to PGN format"},
|
1206 |
{
|
1207 |
"type": "image_url",
|
1208 |
"image_url": {
|