From 84d62403aefd8972648455ccb16fe4d101d79e2a Mon Sep 17 00:00:00 2001 From: langfuse-bot Date: Tue, 21 Jul 2026 14:43:16 +0000 Subject: [PATCH] feat(api): update API spec from langfuse/langfuse b0387f7 --- langfuse/api/legacy/metrics_v1/client.py | 4 +-- langfuse/api/legacy/metrics_v1/raw_client.py | 4 +-- langfuse/api/metrics/client.py | 32 +++++++++++++++---- langfuse/api/metrics/raw_client.py | 32 +++++++++++++++---- .../api/unstable/dashboard_widgets/client.py | 4 +-- .../unstable/dashboard_widgets/raw_client.py | 4 +-- .../types/dashboard_widget_view.py | 4 +++ .../dashboard_widget_view_with_legacy.py | 4 +++ 8 files changed, 68 insertions(+), 20 deletions(-) diff --git a/langfuse/api/legacy/metrics_v1/client.py b/langfuse/api/legacy/metrics_v1/client.py index bece982b3..22c593585 100644 --- a/langfuse/api/legacy/metrics_v1/client.py +++ b/langfuse/api/legacy/metrics_v1/client.py @@ -39,7 +39,7 @@ def metrics( JSON string containing the query parameters with the following structure: ```json { - "view": string, // Required. One of "traces", "observations", "scores-numeric", "scores-categorical" + "view": string, // Required. One of "traces", "observations", "scores-numeric", "scores-boolean", "scores-categorical" "dimensions": [ // Optional. Default: [] { "field": string // Field to group by, e.g. "name", "userId", "sessionId" @@ -138,7 +138,7 @@ async def metrics( JSON string containing the query parameters with the following structure: ```json { - "view": string, // Required. One of "traces", "observations", "scores-numeric", "scores-categorical" + "view": string, // Required. One of "traces", "observations", "scores-numeric", "scores-boolean", "scores-categorical" "dimensions": [ // Optional. Default: [] { "field": string // Field to group by, e.g. "name", "userId", "sessionId" diff --git a/langfuse/api/legacy/metrics_v1/raw_client.py b/langfuse/api/legacy/metrics_v1/raw_client.py index 61f03e541..a1a014380 100644 --- a/langfuse/api/legacy/metrics_v1/raw_client.py +++ b/langfuse/api/legacy/metrics_v1/raw_client.py @@ -36,7 +36,7 @@ def metrics( JSON string containing the query parameters with the following structure: ```json { - "view": string, // Required. One of "traces", "observations", "scores-numeric", "scores-categorical" + "view": string, // Required. One of "traces", "observations", "scores-numeric", "scores-boolean", "scores-categorical" "dimensions": [ // Optional. Default: [] { "field": string // Field to group by, e.g. "name", "userId", "sessionId" @@ -189,7 +189,7 @@ async def metrics( JSON string containing the query parameters with the following structure: ```json { - "view": string, // Required. One of "traces", "observations", "scores-numeric", "scores-categorical" + "view": string, // Required. One of "traces", "observations", "scores-numeric", "scores-boolean", "scores-categorical" "dimensions": [ // Optional. Default: [] { "field": string // Field to group by, e.g. "name", "userId", "sessionId" diff --git a/langfuse/api/metrics/client.py b/langfuse/api/metrics/client.py index ed584d99b..260624ce0 100644 --- a/langfuse/api/metrics/client.py +++ b/langfuse/api/metrics/client.py @@ -30,7 +30,7 @@ def metrics( Get metrics from the Langfuse project using a query object. V2 endpoint with optimized performance. ## V2 Differences - - Supports `observations`, `scores-numeric`, and `scores-categorical` views only (traces view not supported) + - Supports `observations`, `scores-numeric`, `scores-boolean`, and `scores-categorical` views only (traces view not supported) - Direct access to tags and release fields on observations - Backwards-compatible: traceName, traceRelease, traceVersion dimensions are still available on observations view - High cardinality dimensions are not supported and will return a 400 error (see below) @@ -98,6 +98,16 @@ def metrics( - `count` - Total number of scores - `value` - Score value (for aggregations) + ### scores-boolean + Query boolean score data. It has the same score and parent trace/observation dimensions as scores-numeric, plus: + + **Dimensions:** + - `booleanValue` - Boolean value for true/false grouping and filtering + + **Measures:** + - `count` - Total number of boolean scores + - `value` - Numeric 0/1 score value; `avg` returns the true-rate + ### scores-categorical Query categorical score data. Same dimensions as scores-numeric except uses `stringValue` instead of `value`. @@ -115,7 +125,7 @@ def metrics( - `sessionId` - Use sessionId filter instead - `parentObservationId` - Use parentObservationId filter instead - **scores-numeric / scores-categorical views:** + **scores-numeric / scores-boolean / scores-categorical views:** - `id` - Use specific filters to narrow down results - `traceId` - Use traceId filter instead - `userId` - Use userId filter instead @@ -135,7 +145,7 @@ def metrics( JSON string containing the query parameters with the following structure: ```json { - "view": string, // Required. One of "observations", "scores-numeric", "scores-categorical" + "view": string, // Required. One of "observations", "scores-numeric", "scores-boolean", "scores-categorical" "dimensions": [ // Optional. Default: [] { "field": string // Field to group by (see available dimensions above) @@ -233,7 +243,7 @@ async def metrics( Get metrics from the Langfuse project using a query object. V2 endpoint with optimized performance. ## V2 Differences - - Supports `observations`, `scores-numeric`, and `scores-categorical` views only (traces view not supported) + - Supports `observations`, `scores-numeric`, `scores-boolean`, and `scores-categorical` views only (traces view not supported) - Direct access to tags and release fields on observations - Backwards-compatible: traceName, traceRelease, traceVersion dimensions are still available on observations view - High cardinality dimensions are not supported and will return a 400 error (see below) @@ -301,6 +311,16 @@ async def metrics( - `count` - Total number of scores - `value` - Score value (for aggregations) + ### scores-boolean + Query boolean score data. It has the same score and parent trace/observation dimensions as scores-numeric, plus: + + **Dimensions:** + - `booleanValue` - Boolean value for true/false grouping and filtering + + **Measures:** + - `count` - Total number of boolean scores + - `value` - Numeric 0/1 score value; `avg` returns the true-rate + ### scores-categorical Query categorical score data. Same dimensions as scores-numeric except uses `stringValue` instead of `value`. @@ -318,7 +338,7 @@ async def metrics( - `sessionId` - Use sessionId filter instead - `parentObservationId` - Use parentObservationId filter instead - **scores-numeric / scores-categorical views:** + **scores-numeric / scores-boolean / scores-categorical views:** - `id` - Use specific filters to narrow down results - `traceId` - Use traceId filter instead - `userId` - Use userId filter instead @@ -338,7 +358,7 @@ async def metrics( JSON string containing the query parameters with the following structure: ```json { - "view": string, // Required. One of "observations", "scores-numeric", "scores-categorical" + "view": string, // Required. One of "observations", "scores-numeric", "scores-boolean", "scores-categorical" "dimensions": [ // Optional. Default: [] { "field": string // Field to group by (see available dimensions above) diff --git a/langfuse/api/metrics/raw_client.py b/langfuse/api/metrics/raw_client.py index 69c976bcc..9dfaeed4d 100644 --- a/langfuse/api/metrics/raw_client.py +++ b/langfuse/api/metrics/raw_client.py @@ -27,7 +27,7 @@ def metrics( Get metrics from the Langfuse project using a query object. V2 endpoint with optimized performance. ## V2 Differences - - Supports `observations`, `scores-numeric`, and `scores-categorical` views only (traces view not supported) + - Supports `observations`, `scores-numeric`, `scores-boolean`, and `scores-categorical` views only (traces view not supported) - Direct access to tags and release fields on observations - Backwards-compatible: traceName, traceRelease, traceVersion dimensions are still available on observations view - High cardinality dimensions are not supported and will return a 400 error (see below) @@ -95,6 +95,16 @@ def metrics( - `count` - Total number of scores - `value` - Score value (for aggregations) + ### scores-boolean + Query boolean score data. It has the same score and parent trace/observation dimensions as scores-numeric, plus: + + **Dimensions:** + - `booleanValue` - Boolean value for true/false grouping and filtering + + **Measures:** + - `count` - Total number of boolean scores + - `value` - Numeric 0/1 score value; `avg` returns the true-rate + ### scores-categorical Query categorical score data. Same dimensions as scores-numeric except uses `stringValue` instead of `value`. @@ -112,7 +122,7 @@ def metrics( - `sessionId` - Use sessionId filter instead - `parentObservationId` - Use parentObservationId filter instead - **scores-numeric / scores-categorical views:** + **scores-numeric / scores-boolean / scores-categorical views:** - `id` - Use specific filters to narrow down results - `traceId` - Use traceId filter instead - `userId` - Use userId filter instead @@ -132,7 +142,7 @@ def metrics( JSON string containing the query parameters with the following structure: ```json { - "view": string, // Required. One of "observations", "scores-numeric", "scores-categorical" + "view": string, // Required. One of "observations", "scores-numeric", "scores-boolean", "scores-categorical" "dimensions": [ // Optional. Default: [] { "field": string // Field to group by (see available dimensions above) @@ -284,7 +294,7 @@ async def metrics( Get metrics from the Langfuse project using a query object. V2 endpoint with optimized performance. ## V2 Differences - - Supports `observations`, `scores-numeric`, and `scores-categorical` views only (traces view not supported) + - Supports `observations`, `scores-numeric`, `scores-boolean`, and `scores-categorical` views only (traces view not supported) - Direct access to tags and release fields on observations - Backwards-compatible: traceName, traceRelease, traceVersion dimensions are still available on observations view - High cardinality dimensions are not supported and will return a 400 error (see below) @@ -352,6 +362,16 @@ async def metrics( - `count` - Total number of scores - `value` - Score value (for aggregations) + ### scores-boolean + Query boolean score data. It has the same score and parent trace/observation dimensions as scores-numeric, plus: + + **Dimensions:** + - `booleanValue` - Boolean value for true/false grouping and filtering + + **Measures:** + - `count` - Total number of boolean scores + - `value` - Numeric 0/1 score value; `avg` returns the true-rate + ### scores-categorical Query categorical score data. Same dimensions as scores-numeric except uses `stringValue` instead of `value`. @@ -369,7 +389,7 @@ async def metrics( - `sessionId` - Use sessionId filter instead - `parentObservationId` - Use parentObservationId filter instead - **scores-numeric / scores-categorical views:** + **scores-numeric / scores-boolean / scores-categorical views:** - `id` - Use specific filters to narrow down results - `traceId` - Use traceId filter instead - `userId` - Use userId filter instead @@ -389,7 +409,7 @@ async def metrics( JSON string containing the query parameters with the following structure: ```json { - "view": string, // Required. One of "observations", "scores-numeric", "scores-categorical" + "view": string, // Required. One of "observations", "scores-numeric", "scores-boolean", "scores-categorical" "dimensions": [ // Optional. Default: [] { "field": string // Field to group by (see available dimensions above) diff --git a/langfuse/api/unstable/dashboard_widgets/client.py b/langfuse/api/unstable/dashboard_widgets/client.py index e2ab4bb5a..0c46928a3 100644 --- a/langfuse/api/unstable/dashboard_widgets/client.py +++ b/langfuse/api/unstable/dashboard_widgets/client.py @@ -102,7 +102,7 @@ def create( This endpoint creates the widget only; place it on a dashboard via `POST /dashboards/{dashboardId}/placements`. - Supported views are `observations`, `scores-numeric`, and `scores-categorical`. + Supported views are `observations`, `scores-numeric`, `scores-boolean`, and `scores-categorical`. The legacy `traces` view is not supported by this unstable API. Widgets are created as v2 internally. @@ -446,7 +446,7 @@ async def create( This endpoint creates the widget only; place it on a dashboard via `POST /dashboards/{dashboardId}/placements`. - Supported views are `observations`, `scores-numeric`, and `scores-categorical`. + Supported views are `observations`, `scores-numeric`, `scores-boolean`, and `scores-categorical`. The legacy `traces` view is not supported by this unstable API. Widgets are created as v2 internally. diff --git a/langfuse/api/unstable/dashboard_widgets/raw_client.py b/langfuse/api/unstable/dashboard_widgets/raw_client.py index afd535f2d..d57cc7e9d 100644 --- a/langfuse/api/unstable/dashboard_widgets/raw_client.py +++ b/langfuse/api/unstable/dashboard_widgets/raw_client.py @@ -260,7 +260,7 @@ def create( This endpoint creates the widget only; place it on a dashboard via `POST /dashboards/{dashboardId}/placements`. - Supported views are `observations`, `scores-numeric`, and `scores-categorical`. + Supported views are `observations`, `scores-numeric`, `scores-boolean`, and `scores-categorical`. The legacy `traces` view is not supported by this unstable API. Widgets are created as v2 internally. @@ -1290,7 +1290,7 @@ async def create( This endpoint creates the widget only; place it on a dashboard via `POST /dashboards/{dashboardId}/placements`. - Supported views are `observations`, `scores-numeric`, and `scores-categorical`. + Supported views are `observations`, `scores-numeric`, `scores-boolean`, and `scores-categorical`. The legacy `traces` view is not supported by this unstable API. Widgets are created as v2 internally. diff --git a/langfuse/api/unstable/dashboard_widgets/types/dashboard_widget_view.py b/langfuse/api/unstable/dashboard_widgets/types/dashboard_widget_view.py index 461dba8aa..8d4a4ea1b 100644 --- a/langfuse/api/unstable/dashboard_widgets/types/dashboard_widget_view.py +++ b/langfuse/api/unstable/dashboard_widgets/types/dashboard_widget_view.py @@ -10,17 +10,21 @@ class DashboardWidgetView(enum.StrEnum): OBSERVATIONS = "observations" SCORES_NUMERIC = "scores-numeric" + SCORES_BOOLEAN = "scores-boolean" SCORES_CATEGORICAL = "scores-categorical" def visit( self, observations: typing.Callable[[], T_Result], scores_numeric: typing.Callable[[], T_Result], + scores_boolean: typing.Callable[[], T_Result], scores_categorical: typing.Callable[[], T_Result], ) -> T_Result: if self is DashboardWidgetView.OBSERVATIONS: return observations() if self is DashboardWidgetView.SCORES_NUMERIC: return scores_numeric() + if self is DashboardWidgetView.SCORES_BOOLEAN: + return scores_boolean() if self is DashboardWidgetView.SCORES_CATEGORICAL: return scores_categorical() diff --git a/langfuse/api/unstable/dashboard_widgets/types/dashboard_widget_view_with_legacy.py b/langfuse/api/unstable/dashboard_widgets/types/dashboard_widget_view_with_legacy.py index 511eda046..117d2404b 100644 --- a/langfuse/api/unstable/dashboard_widgets/types/dashboard_widget_view_with_legacy.py +++ b/langfuse/api/unstable/dashboard_widgets/types/dashboard_widget_view_with_legacy.py @@ -15,6 +15,7 @@ class DashboardWidgetViewWithLegacy(enum.StrEnum): OBSERVATIONS = "observations" SCORES_NUMERIC = "scores-numeric" + SCORES_BOOLEAN = "scores-boolean" SCORES_CATEGORICAL = "scores-categorical" TRACES = "traces" @@ -22,6 +23,7 @@ def visit( self, observations: typing.Callable[[], T_Result], scores_numeric: typing.Callable[[], T_Result], + scores_boolean: typing.Callable[[], T_Result], scores_categorical: typing.Callable[[], T_Result], traces: typing.Callable[[], T_Result], ) -> T_Result: @@ -29,6 +31,8 @@ def visit( return observations() if self is DashboardWidgetViewWithLegacy.SCORES_NUMERIC: return scores_numeric() + if self is DashboardWidgetViewWithLegacy.SCORES_BOOLEAN: + return scores_boolean() if self is DashboardWidgetViewWithLegacy.SCORES_CATEGORICAL: return scores_categorical() if self is DashboardWidgetViewWithLegacy.TRACES: