danielkorat commited on
Commit
9944deb
·
verified ·
1 Parent(s): 85625b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -81,16 +81,20 @@ def wolfram_alpha(query: str)-> str:
81
 
82
  query_result = response.json().get("queryresult")
83
 
84
- if query_result is None or query_result.get("error"): # Check if there's an error in the response
85
- return f"Error: {query_result['error'].get('msg', 'Unable to fetch Wolfram response.')}"
 
86
 
87
  if pods := query_result.get("pods") is None:
 
88
  return "Wolfram did not provide an answer."
89
 
 
90
  return "; ".join(res.get("plaintext") for res in pods[0].get("subpods"))
91
 
92
- except requests.exceptions.RequestException as e:
93
- return f"Error fetching Wolfram response: {str(e)}"
 
94
 
95
 
96
  class GoogleSearchTool(Tool):
 
81
 
82
  query_result = response.json().get("queryresult")
83
 
84
+ if query_result is None or query_result.get("error", False): # Check if there's an error in the response
85
+ print("Error 1")
86
+ return f"Error: {query_result['error'].get('msg', 'Unable to fetch Wolfram response.')}"
87
 
88
  if pods := query_result.get("pods") is None:
89
+ print("Error 2")
90
  return "Wolfram did not provide an answer."
91
 
92
+ print(f"{pods[0]}=")
93
  return "; ".join(res.get("plaintext") for res in pods[0].get("subpods"))
94
 
95
+ except Exception: #requests.exceptions.RequestException as e:
96
+ raise Exception
97
+ # return f"Error fetching Wolfram response: {str(e)}"
98
 
99
 
100
  class GoogleSearchTool(Tool):