AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
Return none as fallback Helicone (#228)
merwanehamadice24857a7480
diff --git a/agbenchmark/utils/get_data_from_helicone.py b/agbenchmark/utils/get_data_from_helicone.pyindex 87dfe0aeff..07a9c11f5d 100644--- a/agbenchmark/utils/get_data_from_helicone.py+++ b/agbenchmark/utils/get_data_from_helicone.py@@ -58,21 +58,21 @@ query ExampleQuery($properties: [PropertyFilter!]){"operationName": operation_name,},)- response.raise_for_status() # Raises a HTTPError if the response was an unsuccessful status codedata = response.json()except requests.HTTPError as http_err:print(f"HTTP error occurred: {http_err}")- raise # Re-raise the exception to stop execution+ return None # Re-raise the exception to stop executionexcept json.JSONDecodeError:print(f"Invalid JSON response: {response.text if response else 'No response'}")- raise+ return Noneexcept Exception as err:print(f"Other error occurred: {err}")- raise+ return Noneif data is None or data.get("data") is None:- raise ValueError("Invalid response received from server: no data")+ print("Invalid response received from server: no data")+ return Nonereturn (data.get("data", {}).get("aggregatedHeliconeRequest", {}).get("costUSD", None)