Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(warehouse): add helicone properties and eval_scores tables (#110726)

Tom Owers23054023902d
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
index 3c4fb5585a8f..8fa4f67c4922 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
@@ -3951,18 +3951,18 @@ Note: Could not reach any vendor-hosted doc this run: the Notion doc URL in the
## Helicone — gaps
-Today (4): `prompts`, `requests`, `sessions`, `users`
+Today (6): `eval_scores`, `prompts`, `properties`, `requests`, `sessions`, `users`
Diffed against: <https://docs.helicone.ai/llms.txt>
-- [ ] `POST /v1/evals/query` — evaluation results per request — the core quality metric Helicone users chart (high)
-- [ ] `GET /v1/evals/scores` — lookup of the eval score definitions that eval results reference (high)
-- [ ] `POST /v1/property/query` — custom properties attached to requests; the dimension almost every Helicone breakdown is sliced by (high)
+- ~~`POST /v1/evals/query`~~ — not table material: it returns one aggregate row per score name (avg/min/max/count plus hourly series over the requested window) and ignores `limit`/`offset`; the per-request scores it rolls up are already on `requests.scores`
+- [x] `GET /v1/evals/scores` — lookup of the eval score names that eval results reference (high). Added as `eval_scores`. It returns score names only, not definitions.
+- [x] `POST /v1/property/query` — catalog of the custom property keys attached to requests (high). Added as `properties`. It returns the org's non-hidden keys; per-request values are already on `requests.request_properties`.
- [ ] `POST /v1/user/metrics/query` — per-user aggregated cost/token/request metrics, complements the raw users table we sync (medium)
- [ ] `POST /v1/session/metrics/query` — per-session cost and latency rollups for the sessions we already sync (medium)
- [ ] `GET /v1/public/model-registry/models` — lookup table resolving model ids on requests to provider, context window and pricing (medium)
- [ ] `POST /v1/dashboard/scores/query` — dashboard scoring metrics over time (medium)
-- [ ] `GET /v1/request/inputs` — prompt-template variable values per request — joins requests to the prompts we already sync (medium)
+- ~~`GET /v1/request/inputs`~~ — not table material: the API only serves `GET /v1/request/{requestId}/inputs`, a point lookup that would mean one call per logged request; requests already carry `prompt_id` and `prompt_version` for the join to prompts
- [ ] `POST /v1/evals/score-distributions/query` — score distribution breakdowns for eval reporting (low)
- [ ] `GET /v1/prompt-2025/tags` — prompt tag lookup for grouping the prompts table (low)
- [ ] `GET /v1/prompt-2025/environments` — environment lookup so prompt versions can be attributed to prod/staging (low)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/canonical_descriptions.py
index 015b882a0efe..d7a0d0690ec4 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/canonical_descriptions.py
@@ -88,4 +88,21 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"created_at": "Timestamp when the prompt was created.",
},
},
+ "properties": {
+ "description": (
+ "Catalog of the custom property keys (set via Helicone-Property-* headers) seen on the "
+ "organization's requests, excluding keys hidden in Helicone."
+ ),
+ "docs_url": "https://docs.helicone.ai/rest/property/post-v1propertyquery",
+ "columns": {
+ "property": "Custom property key. Per-request values are in the requests table's request_properties column.",
+ },
+ },
+ "eval_scores": {
+ "description": "Catalog of the evaluation score names recorded on the organization's requests.",
+ "docs_url": "https://docs.helicone.ai/rest/evals/get-v1evalsscores",
+ "columns": {
+ "score": "Evaluation score name. Per-request values are in the requests table's scores column.",
+ },
+ },
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/helicone.py b/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/helicone.py
index 996a899577e3..19e74a31c11a 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/helicone.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/helicone.py
@@ -11,10 +11,12 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.htt
from products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManager
from products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceResponse
from products.warehouse_sources.backend.temporal.data_imports.sources.helicone.settings import (
+ EVAL_SCORES_ENDPOINT,
HELICONE_ENDPOINTS,
HELICONE_HOSTS,
PROMPTS_ENDPOINT,
PROMPTS_PAGE_SIZE,
+ PROPERTIES_ENDPOINT,
REQUESTS_DEFAULT_LOOKBACK_DAYS,
REQUESTS_ENDPOINT,
REQUESTS_PAGE_SIZE,
@@ -65,7 +67,7 @@ def _format_timestamp(value: Any) -> str | None:
return None
-def _extract_data(body: Any, url: str) -> list[dict[str, Any]]:
+def _extract_data(body: Any, url: str) -> list[Any]:
"""Unwrap Helicone's `{"data": [...], "error": null}` result union.
The prompts endpoint documents a bare array response, so lists pass through as-is.
@@ -93,7 +95,21 @@ def _post(
session: requests.Session, url: str, headers: dict[str, str], body: dict[str, Any], logger: FilteringBoundLogger
) -> Any:
response = session.post(url, headers=headers, json=body, timeout=REQUEST_TIMEOUT_SECONDS)
+ return _parse_response(response, url, logger)
+
+@retry(
+ retry=retry_if_exception_type((HeliconeRetryableError, requests.ReadTimeout, requests.ConnectionError)),
+ stop=stop_after_attempt(RETRY_MAX_ATTEMPTS),
+ wait=wait_exponential_jitter(initial=2, max=60),
+ reraise=True,
+)
+def _get(session: requests.Session, url: str, headers: dict[str, str], logger: FilteringBoundLogger) -> Any:
+ response = session.get(url, headers=headers, timeout=REQUEST_TIMEOUT_SECONDS)
+ return _parse_response(response, url, logger)
+
+
+def _parse_response(response: requests.Response, url: str, logger: FilteringBoundLogger) -> Any:
if response.status_code == 429 or response.status_code >= 500:
raise HeliconeRetryableError(f"Helicone API error (retryable): status={response.status_code}, url={url}")
@@ -284,6 +300,33 @@ def _prompts_rows(
break
+def _properties_rows(
+ session: requests.Session,
+ host: str,
+ headers: dict[str, str],
+ logger: FilteringBoundLogger,
+) -> Iterator[list[dict[str, Any]]]:
+ url = f"{host}{HELICONE_ENDPOINTS[PROPERTIES_ENDPOINT].path}"
+ # Unpaginated: returns the org's distinct, non-hidden property keys as `{"property": key}` rows.
+ rows = _extract_data(_post(session, url, headers, {}, logger), url)
+ if rows:
+ yield rows
+
+
+def _eval_scores_rows(
+ session: requests.Session,
+ host: str,
+ headers: dict[str, str],
+ logger: FilteringBoundLogger,
+) -> Iterator[list[dict[str, Any]]]:
+ url = f"{host}{HELICONE_ENDPOINTS[EVAL_SCORES_ENDPOINT].path}"
+ # Unpaginated: returns a bare list of distinct score names, so wrap each one into a row.
+ names = _extract_data(_get(session, url, headers, logger), url)
+ rows = [{"score": name} for name in names if isinstance(name, str)]
+ if rows:
+ yield rows
+
+
def _get_rows(
api_key: str,
region: str,
@@ -319,6 +362,10 @@ def _get_rows(
yield from _users_rows(session, host, headers, logger)
elif endpoint == PROMPTS_ENDPOINT:
yield from _prompts_rows(session, host, headers, logger, resumable_source_manager)
+ elif endpoint == PROPERTIES_ENDPOINT:
+ yield from _properties_rows(session, host, headers, logger)
+ elif endpoint == EVAL_SCORES_ENDPOINT:
+ yield from _eval_scores_rows(session, host, headers, logger)
else:
raise ValueError(f"Unknown Helicone endpoint: {endpoint}")
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/settings.py
index 8790fcd2808d..75cd9dcf32f7 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/settings.py
@@ -14,6 +14,8 @@ REQUESTS_ENDPOINT = "requests"
SESSIONS_ENDPOINT = "sessions"
USERS_ENDPOINT = "users"
PROMPTS_ENDPOINT = "prompts"
+PROPERTIES_ENDPOINT = "properties"
+EVAL_SCORES_ENDPOINT = "eval_scores"
# /v1/request/query-clickhouse is Helicone's bulk-export endpoint; their export CLI pages it with
# limit/offset up to 10k rows per request. Rows can embed full request/response bodies, so we keep
@@ -78,6 +80,18 @@ HELICONE_ENDPOINTS: dict[str, HeliconeEndpointConfig] = {
path="/v1/prompt-2025/query",
primary_keys=["id"],
),
+ # Org-wide catalogs of the custom property keys and eval score names seen on requests. The
+ # per-request values already ride on the requests table (`properties`, `scores`).
+ PROPERTIES_ENDPOINT: HeliconeEndpointConfig(
+ name=PROPERTIES_ENDPOINT,
+ path="/v1/property/query",
+ primary_keys=["property"],
+ ),
+ EVAL_SCORES_ENDPOINT: HeliconeEndpointConfig(
+ name=EVAL_SCORES_ENDPOINT,
+ path="/v1/evals/scores",
+ primary_keys=["score"],
+ ),
}
ENDPOINTS = tuple(HELICONE_ENDPOINTS.keys())
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/tests/test_helicone.py b/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/tests/test_helicone.py
index c3bc8d6f378d..f0b0b32df15f 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/tests/test_helicone.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/tests/test_helicone.py
@@ -11,9 +11,11 @@ from parameterized import parameterized
from products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManager
from products.warehouse_sources.backend.temporal.data_imports.sources.helicone.helicone import (
HeliconeResumeConfig,
+ _eval_scores_rows,
_extract_data,
_format_timestamp,
_prompts_rows,
+ _properties_rows,
_requests_rows,
_sessions_rows,
_users_rows,
@@ -21,7 +23,9 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.helicone.h
validate_credentials,
)
from products.warehouse_sources.backend.temporal.data_imports.sources.helicone.settings import (
+ EVAL_SCORES_ENDPOINT,
PROMPTS_ENDPOINT,
+ PROPERTIES_ENDPOINT,
REQUESTS_ENDPOINT,
SESSIONS_ENDPOINT,
USERS_ENDPOINT,
@@ -299,6 +303,37 @@ class TestPromptsRows:
assert manager.save_state.call_args_list[0].args[0].offset == 4
+class TestPropertiesRows:
+ def test_posts_empty_body_and_yields_property_rows(self) -> None:
+ session = _session_returning(
+ [_response(json_body={"data": [{"property": "environment"}, {"property": "feature"}], "error": None})]
+ )
+
+ batches = list(_properties_rows(session, "https://api.helicone.ai", {}, mock.MagicMock()))
+
+ assert batches == [[{"property": "environment"}, {"property": "feature"}]]
+ assert session.post.call_args.args[0] == "https://api.helicone.ai/v1/property/query"
+ assert session.post.call_args.kwargs["json"] == {}
+
+
+class TestEvalScoresRows:
+ def test_gets_and_wraps_score_names_into_rows(self) -> None:
+ session = mock.MagicMock(spec=requests.Session)
+ session.get.return_value = _response(json_body={"data": ["accuracy", "helpfulness"], "error": None})
+
+ batches = list(_eval_scores_rows(session, "https://api.helicone.ai", {}, mock.MagicMock()))
+
+ assert batches == [[{"score": "accuracy"}, {"score": "helpfulness"}]]
+ assert session.get.call_args.args[0] == "https://api.helicone.ai/v1/evals/scores"
+ session.post.assert_not_called()
+
+ def test_empty_result_yields_nothing(self) -> None:
+ session = mock.MagicMock(spec=requests.Session)
+ session.get.return_value = _response(json_body={"data": [], "error": None})
+
+ assert list(_eval_scores_rows(session, "https://api.helicone.ai", {}, mock.MagicMock())) == []
+
+
class TestHeliconeSourceResponse:
def test_requests_response_metadata(self) -> None:
response = helicone_source(
@@ -321,6 +356,8 @@ class TestHeliconeSourceResponse:
(SESSIONS_ENDPOINT, ["session_id"]),
(USERS_ENDPOINT, ["user_id"]),
(PROMPTS_ENDPOINT, ["id"]),
+ (PROPERTIES_ENDPOINT, ["property"]),
+ (EVAL_SCORES_ENDPOINT, ["score"]),
]
)
def test_full_refresh_response_metadata(self, endpoint: str, expected_primary_keys: list[str]) -> None:
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/tests/test_helicone_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/tests/test_helicone_source.py
index 14f73b277183..b58e80247a04 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/tests/test_helicone_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/helicone/tests/test_helicone_source.py
@@ -11,14 +11,22 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.generated_
)
from products.warehouse_sources.backend.temporal.data_imports.sources.helicone.settings import (
ENDPOINTS,
+ EVAL_SCORES_ENDPOINT,
PROMPTS_ENDPOINT,
+ PROPERTIES_ENDPOINT,
REQUESTS_ENDPOINT,
SESSIONS_ENDPOINT,
USERS_ENDPOINT,
)
from products.warehouse_sources.backend.temporal.data_imports.sources.helicone.source import HeliconeSource
-FULL_REFRESH_ENDPOINTS = [SESSIONS_ENDPOINT, USERS_ENDPOINT, PROMPTS_ENDPOINT]
+FULL_REFRESH_ENDPOINTS = [
+ SESSIONS_ENDPOINT,
+ USERS_ENDPOINT,
+ PROMPTS_ENDPOINT,
+ PROPERTIES_ENDPOINT,
+ EVAL_SCORES_ENDPOINT,
+]
class TestHeliconeSource: