handling helicone errors
parent
1403d8d4db
commit
14c49fa7ea
|
@ -7,7 +7,7 @@ from typing import Any, Callable
|
|||
import pytest
|
||||
|
||||
from 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_helicone
|
||||
from agbenchmark.reports.ReportManager import ReportManager
|
||||
from agbenchmark.start_benchmark import CONFIG_PATH, REGRESSION_TESTS_PATH, REPORTS_PATH
|
||||
from agbenchmark.utils.data_types import DIFFICULTY_MAP, DifficultyLevel, SuiteConfig
|
||||
|
|
|
@ -15,9 +15,9 @@ def get_data_from_helicone(challenge: str) -> Optional[float]:
|
|||
|
||||
# Define the query, variables, and operation name
|
||||
query = """
|
||||
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)
|
||||
)
|
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -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')}"
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue