From 4c0157ee9bad692cc328b83d45fdd284400f8f03 Mon Sep 17 00:00:00 2001 From: Niklas Semmler Date: Fri, 23 Oct 2026 15:44:20 +0200 Subject: [PATCH] feat(api): add score metadata and provenance blob export field groups Takes only the blob storage integration files from the generated API client update; the remaining spec changes ship separately. Co-Authored-By: Claude Opus 5.5 (1M context) --- langfuse/api/blob_storage_integrations/client.py | 4 ++-- langfuse/api/blob_storage_integrations/raw_client.py | 4 ++-- .../types/blob_storage_export_field_group.py | 12 +++++++++++- .../types/blob_storage_integration_response.py | 2 +- .../types/create_blob_storage_integration_request.py | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/langfuse/api/blob_storage_integrations/client.py b/langfuse/api/blob_storage_integrations/client.py index 0e609769d..242eeb2e8 100644 --- a/langfuse/api/blob_storage_integrations/client.py +++ b/langfuse/api/blob_storage_integrations/client.py @@ -159,7 +159,7 @@ def upsert_blob_storage_integration( **Cloud-only integration deprecation gate (effective 2026-06-22):** On Langfuse Cloud, legacy export sources are only accepted for blob storage integrations created before 2026-06-22, regardless of project age. Requests that would create a new integration with `LEGACY_TRACES_OBSERVATIONS` or `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS` are rejected with HTTP 400. Use `OBSERVATIONS_V2` instead. Self-hosted deployments are unaffected. export_field_groups : typing.Optional[typing.Sequence[BlobStorageExportFieldGroup]] - Field groups to include in each exported observation row. Applies to all export sources; must include `core` if provided. When omitted on create, the column default (all groups) applies. When omitted on update, the existing value is preserved. + Field groups to include in each exported observation and score row. Applies to all export sources; must include the observation `core` group if provided. Core score columns are always exported; score groups add columns on top. When omitted on create, all observation groups are selected and no score groups. When omitted on update, the existing value is preserved. `exportFieldGroups` requires `exportSource` to be provided in the same request. @@ -438,7 +438,7 @@ async def upsert_blob_storage_integration( **Cloud-only integration deprecation gate (effective 2026-06-22):** On Langfuse Cloud, legacy export sources are only accepted for blob storage integrations created before 2026-06-22, regardless of project age. Requests that would create a new integration with `LEGACY_TRACES_OBSERVATIONS` or `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS` are rejected with HTTP 400. Use `OBSERVATIONS_V2` instead. Self-hosted deployments are unaffected. export_field_groups : typing.Optional[typing.Sequence[BlobStorageExportFieldGroup]] - Field groups to include in each exported observation row. Applies to all export sources; must include `core` if provided. When omitted on create, the column default (all groups) applies. When omitted on update, the existing value is preserved. + Field groups to include in each exported observation and score row. Applies to all export sources; must include the observation `core` group if provided. Core score columns are always exported; score groups add columns on top. When omitted on create, all observation groups are selected and no score groups. When omitted on update, the existing value is preserved. `exportFieldGroups` requires `exportSource` to be provided in the same request. diff --git a/langfuse/api/blob_storage_integrations/raw_client.py b/langfuse/api/blob_storage_integrations/raw_client.py index 827ab1a4b..5e7fcd6f9 100644 --- a/langfuse/api/blob_storage_integrations/raw_client.py +++ b/langfuse/api/blob_storage_integrations/raw_client.py @@ -216,7 +216,7 @@ def upsert_blob_storage_integration( **Cloud-only integration deprecation gate (effective 2026-06-22):** On Langfuse Cloud, legacy export sources are only accepted for blob storage integrations created before 2026-06-22, regardless of project age. Requests that would create a new integration with `LEGACY_TRACES_OBSERVATIONS` or `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS` are rejected with HTTP 400. Use `OBSERVATIONS_V2` instead. Self-hosted deployments are unaffected. export_field_groups : typing.Optional[typing.Sequence[BlobStorageExportFieldGroup]] - Field groups to include in each exported observation row. Applies to all export sources; must include `core` if provided. When omitted on create, the column default (all groups) applies. When omitted on update, the existing value is preserved. + Field groups to include in each exported observation and score row. Applies to all export sources; must include the observation `core` group if provided. Core score columns are always exported; score groups add columns on top. When omitted on create, all observation groups are selected and no score groups. When omitted on update, the existing value is preserved. `exportFieldGroups` requires `exportSource` to be provided in the same request. @@ -713,7 +713,7 @@ async def upsert_blob_storage_integration( **Cloud-only integration deprecation gate (effective 2026-06-22):** On Langfuse Cloud, legacy export sources are only accepted for blob storage integrations created before 2026-06-22, regardless of project age. Requests that would create a new integration with `LEGACY_TRACES_OBSERVATIONS` or `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS` are rejected with HTTP 400. Use `OBSERVATIONS_V2` instead. Self-hosted deployments are unaffected. export_field_groups : typing.Optional[typing.Sequence[BlobStorageExportFieldGroup]] - Field groups to include in each exported observation row. Applies to all export sources; must include `core` if provided. When omitted on create, the column default (all groups) applies. When omitted on update, the existing value is preserved. + Field groups to include in each exported observation and score row. Applies to all export sources; must include the observation `core` group if provided. Core score columns are always exported; score groups add columns on top. When omitted on create, all observation groups are selected and no score groups. When omitted on update, the existing value is preserved. `exportFieldGroups` requires `exportSource` to be provided in the same request. diff --git a/langfuse/api/blob_storage_integrations/types/blob_storage_export_field_group.py b/langfuse/api/blob_storage_integrations/types/blob_storage_export_field_group.py index 32bdbf89d..a38aeaf75 100644 --- a/langfuse/api/blob_storage_integrations/types/blob_storage_export_field_group.py +++ b/langfuse/api/blob_storage_integrations/types/blob_storage_export_field_group.py @@ -9,7 +9,9 @@ class BlobStorageExportFieldGroup(enum.StrEnum): """ - Field group selecting which observation columns are included in the export. Applies to all export sources; groups without a counterpart in the legacy data model (e.g. `trace_context`) are omitted from the legacy observations export. + Field group selecting which columns are included in the export. Applies to all export sources. + - Observation groups (`core` through `trace_context`) select observation columns; groups without a counterpart in the legacy data model (e.g. `trace_context`) are omitted from the legacy observations export. + - Score groups (`score_` prefix) add optional columns to the scores export. The core score columns (`id`, `timestamp`, `trace_id`, `name`, `value`, …) are always exported and are not a selectable group; score groups add columns on top of them. `score_metadata` adds the score `metadata` column. `score_provenance` adds the references to where a score came from: `author_user_id`, `config_id`, `queue_id`, `evaluator_id`, `evaluation_rule_id`, `execution_trace_id`. Score groups are never selected by default. """ CORE = "core" @@ -23,6 +25,8 @@ class BlobStorageExportFieldGroup(enum.StrEnum): METRICS = "metrics" TOOLS = "tools" TRACE_CONTEXT = "trace_context" + SCORE_METADATA = "score_metadata" + SCORE_PROVENANCE = "score_provenance" def visit( self, @@ -37,6 +41,8 @@ def visit( metrics: typing.Callable[[], T_Result], tools: typing.Callable[[], T_Result], trace_context: typing.Callable[[], T_Result], + score_metadata: typing.Callable[[], T_Result], + score_provenance: typing.Callable[[], T_Result], ) -> T_Result: if self is BlobStorageExportFieldGroup.CORE: return core() @@ -60,3 +66,7 @@ def visit( return tools() if self is BlobStorageExportFieldGroup.TRACE_CONTEXT: return trace_context() + if self is BlobStorageExportFieldGroup.SCORE_METADATA: + return score_metadata() + if self is BlobStorageExportFieldGroup.SCORE_PROVENANCE: + return score_provenance() diff --git a/langfuse/api/blob_storage_integrations/types/blob_storage_integration_response.py b/langfuse/api/blob_storage_integrations/types/blob_storage_integration_response.py index 3cbaba167..343a03d58 100644 --- a/langfuse/api/blob_storage_integrations/types/blob_storage_integration_response.py +++ b/langfuse/api/blob_storage_integrations/types/blob_storage_integration_response.py @@ -53,7 +53,7 @@ class BlobStorageIntegrationResponse(UniversalBaseModel): FieldMetadata(alias="exportFieldGroups"), ] = pydantic.Field(default=None) """ - Field groups included in each exported observation row. An empty list is treated as all groups during export. + Field groups included in each exported observation and score row. An empty list is treated as all observation groups and no score groups during export. Core score columns are always exported. """ next_sync_at: typing_extensions.Annotated[ diff --git a/langfuse/api/blob_storage_integrations/types/create_blob_storage_integration_request.py b/langfuse/api/blob_storage_integrations/types/create_blob_storage_integration_request.py index 600a8be84..65fc84e5c 100644 --- a/langfuse/api/blob_storage_integrations/types/create_blob_storage_integration_request.py +++ b/langfuse/api/blob_storage_integrations/types/create_blob_storage_integration_request.py @@ -111,7 +111,7 @@ class CreateBlobStorageIntegrationRequest(UniversalBaseModel): FieldMetadata(alias="exportFieldGroups"), ] = pydantic.Field(default=None) """ - Field groups to include in each exported observation row. Applies to all export sources; must include `core` if provided. When omitted on create, the column default (all groups) applies. When omitted on update, the existing value is preserved. + Field groups to include in each exported observation and score row. Applies to all export sources; must include the observation `core` group if provided. Core score columns are always exported; score groups add columns on top. When omitted on create, all observation groups are selected and no score groups. When omitted on update, the existing value is preserved. `exportFieldGroups` requires `exportSource` to be provided in the same request. """