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.
handling helicone errors
Silen Naihin14c49fa7ead4
diff --git a/agbenchmark/reports/reports.py b/agbenchmark/reports/reports.pyindex 25abc1f785..9abe5ea374 100644--- a/agbenchmark/reports/reports.py+++ b/agbenchmark/reports/reports.py@@ -7,7 +7,7 @@ from typing import Any, Callableimport pytestfrom agbenchmark.agent_interface import MOCK_FLAG-from agbenchmark.get_data_from_helicone import get_data_from_helicone+from agbenchmark.utils.get_data_from_helicone import get_data_from_heliconefrom agbenchmark.reports.ReportManager import ReportManagerfrom agbenchmark.start_benchmark import CONFIG_PATH, REGRESSION_TESTS_PATH, REPORTS_PATHfrom agbenchmark.utils.data_types import DIFFICULTY_MAP, DifficultyLevel, SuiteConfigdiff --git a/agbenchmark/get_data_from_helicone.py b/agbenchmark/utils/get_data_from_helicone.pysimilarity index 58%rename from agbenchmark/get_data_from_helicone.pyrename to agbenchmark/utils/get_data_from_helicone.pyindex 1a58565ae0..db823a588b 100644--- a/agbenchmark/get_data_from_helicone.py+++ b/agbenchmark/utils/get_data_from_helicone.py@@ -15,9 +15,9 @@ def get_data_from_helicone(challenge: str) -> Optional[float]:# Define the query, variables, and operation namequery = """-query ExampleQuery {- aggregatedHeliconeRequest {- cost+query ExampleQuery($properties: [PropertyFilter!]){+ aggregatedHeliconeRequest(properties: $properties) {+ costUSD}}"""@@ -43,11 +43,23 @@ query ExampleQuery {operation_name = "ExampleQuery"# Make the request- response = requests.post(- url,- headers=headers,- json={"query": query, "variables": variables, "operationName": operation_name},- )- data = response.json()-- return data.get("data", {}).get("aggregatedHeliconeRequest", {}).get("cost", None)+ try:+ response = requests.post(+ url,+ headers=headers,+ json={+ "query": query,+ "variables": variables,+ "operationName": operation_name,+ },+ )+ response.raise_for_status() # Raises a HTTPError if the response was an unsuccessful status code+ data = response.json()+ except requests.HTTPError as http_err:+ print(f"HTTP error occurred: {http_err}")+ except Exception as err:+ print(f"Other error occurred: {err}")+ else:+ return (+ data.get("data", {}).get("aggregatedHeliconeRequest", {}).get("cost", None)+ )diff --git a/reports/Auto-GPT/folder3_07-31-11-25/report.json b/reports/Auto-GPT/folder3_07-31-11-25/report.jsondeleted file mode 100644index fc34b420bc..0000000000--- a/reports/Auto-GPT/folder3_07-31-11-25/report.json+++ /dev/null@@ -1,14 +0,0 @@-{- "command": "agbenchmark start",- "completion_time": "2023-07-31-11:26",- "benchmark_start_time": "2023-07-31-11:25",- "metrics": {- "run_time": "42.59 seconds",- "highest_difficulty": "No successful tests"- },- "tests": {},- "config": {- "workspace": "auto_gpt_workspace",- "entry_path": "agbenchmark.benchmarks"- }-}\ No newline at end of filediff --git a/reports/BabyAGI/folder4_07-31-11-28/report.json b/reports/BabyAGI/folder4_07-31-11-28/report.jsondeleted file mode 100644index 5d58bbb329..0000000000--- a/reports/BabyAGI/folder4_07-31-11-28/report.json+++ /dev/null@@ -1,13 +0,0 @@-{- "command": "agbenchmark start",- "completion_time": "2023-07-31-11:29",- "benchmark_start_time": "2023-07-31-11:28",- "metrics": {- "run_time": "61.6 seconds",- "highest_difficulty": "No successful tests"- },- "tests": {},- "config": {- "workspace": "babycoder/playground"- }-}\ No newline at end of filediff --git a/reports/beebot/folder4_07-31-11-25/report.json b/reports/beebot/folder4_07-31-11-25/report.jsondeleted file mode 100644index 723b530c92..0000000000--- a/reports/beebot/folder4_07-31-11-25/report.json+++ /dev/null@@ -1,13 +0,0 @@-{- "command": "agbenchmark start",- "completion_time": "2023-07-31-11:26",- "benchmark_start_time": "2023-07-31-11:25",- "metrics": {- "run_time": "61.01 seconds",- "highest_difficulty": "No successful tests"- },- "tests": {},- "config": {- "workspace": "workspace"- }-}\ No newline at end of filediff --git a/reports/gpt-engineer/folder3_07-31-11-24/report.json b/reports/gpt-engineer/folder3_07-31-11-24/report.jsondeleted file mode 100644index f7053b4964..0000000000--- a/reports/gpt-engineer/folder3_07-31-11-24/report.json+++ /dev/null@@ -1,14 +0,0 @@-{- "command": "agbenchmark start",- "completion_time": "2023-07-31-11:25",- "benchmark_start_time": "2023-07-31-11:24",- "metrics": {- "run_time": "60.99 seconds",- "highest_difficulty": "No successful tests"- },- "tests": {},- "config": {- "workspace": "projects/my-new-project/workspace",- "entry_path": "agbenchmark.benchmarks"- }-}\ No newline at end of filediff --git a/reports/mini-agi/folder5_07-31-11-25/report.json b/reports/mini-agi/folder5_07-31-11-25/report.jsondeleted file mode 100644index d77dfda0ac..0000000000--- a/reports/mini-agi/folder5_07-31-11-25/report.json+++ /dev/null@@ -1,13 +0,0 @@-{- "command": "agbenchmark start",- "completion_time": "2023-07-31-11:25",- "benchmark_start_time": "2023-07-31-11:25",- "metrics": {- "run_time": "18.86 seconds",- "highest_difficulty": "No successful tests"- },- "tests": {},- "config": {- "workspace": "${os.path.join(Path.home(), 'miniagi')}"- }-}\ No newline at end of filediff --git a/reports/smol-developer/folder4_07-31-11-24/report.json b/reports/smol-developer/folder4_07-31-11-24/report.jsondeleted file mode 100644index c6a1bacc8a..0000000000--- a/reports/smol-developer/folder4_07-31-11-24/report.json+++ /dev/null@@ -1,14 +0,0 @@-{- "command": "agbenchmark start",- "completion_time": "2023-07-31-11:24",- "benchmark_start_time": "2023-07-31-11:24",- "metrics": {- "run_time": "7.39 seconds",- "highest_difficulty": "No successful tests"- },- "tests": {},- "config": {- "workspace": "generated",- "entry_path": "agbenchmark.benchmarks"- }-}\ No newline at end of file