Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions langfuse/api/blob_storage_integrations/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,7 @@ def upsert_blob_storage_integration(
**Cloud-only deprecation gate (effective 2026-05-20):** For projects created on or after 2026-05-20 on Langfuse Cloud, `LEGACY_TRACES_OBSERVATIONS` and `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS` are rejected with HTTP 400. Omitting `exportSource` on these projects silently defaults to `OBSERVATIONS_V2` rather than the schema column default. Use `OBSERVATIONS_V2` for all new integrations. Projects created before 2026-05-20 and self-hosted deployments are unaffected.

export_field_groups : typing.Optional[typing.Sequence[BlobStorageExportFieldGroup]]
Field groups to include in each exported row.

For exportSource `OBSERVATIONS_V2` or `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS`: must include `core` if provided. When omitted on create, the column default (all groups) applies. When omitted on update, the existing value is preserved.

For exportSource `LEGACY_TRACES_OBSERVATIONS`: this field must be omitted or null. Sending an array (including an empty array) returns 400, because that source uses a fixed column set and does not honor field groups.
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.

`exportFieldGroups` requires `exportSource` to be provided in the same request.

Expand Down Expand Up @@ -434,11 +430,7 @@ async def upsert_blob_storage_integration(
**Cloud-only deprecation gate (effective 2026-05-20):** For projects created on or after 2026-05-20 on Langfuse Cloud, `LEGACY_TRACES_OBSERVATIONS` and `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS` are rejected with HTTP 400. Omitting `exportSource` on these projects silently defaults to `OBSERVATIONS_V2` rather than the schema column default. Use `OBSERVATIONS_V2` for all new integrations. Projects created before 2026-05-20 and self-hosted deployments are unaffected.

export_field_groups : typing.Optional[typing.Sequence[BlobStorageExportFieldGroup]]
Field groups to include in each exported row.

For exportSource `OBSERVATIONS_V2` or `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS`: must include `core` if provided. When omitted on create, the column default (all groups) applies. When omitted on update, the existing value is preserved.

For exportSource `LEGACY_TRACES_OBSERVATIONS`: this field must be omitted or null. Sending an array (including an empty array) returns 400, because that source uses a fixed column set and does not honor field groups.
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.

`exportFieldGroups` requires `exportSource` to be provided in the same request.

Expand Down
12 changes: 2 additions & 10 deletions langfuse/api/blob_storage_integrations/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,7 @@ def upsert_blob_storage_integration(
**Cloud-only deprecation gate (effective 2026-05-20):** For projects created on or after 2026-05-20 on Langfuse Cloud, `LEGACY_TRACES_OBSERVATIONS` and `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS` are rejected with HTTP 400. Omitting `exportSource` on these projects silently defaults to `OBSERVATIONS_V2` rather than the schema column default. Use `OBSERVATIONS_V2` for all new integrations. Projects created before 2026-05-20 and self-hosted deployments are unaffected.

export_field_groups : typing.Optional[typing.Sequence[BlobStorageExportFieldGroup]]
Field groups to include in each exported row.

For exportSource `OBSERVATIONS_V2` or `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS`: must include `core` if provided. When omitted on create, the column default (all groups) applies. When omitted on update, the existing value is preserved.

For exportSource `LEGACY_TRACES_OBSERVATIONS`: this field must be omitted or null. Sending an array (including an empty array) returns 400, because that source uses a fixed column set and does not honor field groups.
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.

`exportFieldGroups` requires `exportSource` to be provided in the same request.

Expand Down Expand Up @@ -709,11 +705,7 @@ async def upsert_blob_storage_integration(
**Cloud-only deprecation gate (effective 2026-05-20):** For projects created on or after 2026-05-20 on Langfuse Cloud, `LEGACY_TRACES_OBSERVATIONS` and `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS` are rejected with HTTP 400. Omitting `exportSource` on these projects silently defaults to `OBSERVATIONS_V2` rather than the schema column default. Use `OBSERVATIONS_V2` for all new integrations. Projects created before 2026-05-20 and self-hosted deployments are unaffected.

export_field_groups : typing.Optional[typing.Sequence[BlobStorageExportFieldGroup]]
Field groups to include in each exported row.

For exportSource `OBSERVATIONS_V2` or `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS`: must include `core` if provided. When omitted on create, the column default (all groups) applies. When omitted on update, the existing value is preserved.

For exportSource `LEGACY_TRACES_OBSERVATIONS`: this field must be omitted or null. Sending an array (including an empty array) returns 400, because that source uses a fixed column set and does not honor field groups.
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.

`exportFieldGroups` requires `exportSource` to be provided in the same request.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class BlobStorageExportFieldGroup(enum.StrEnum):
"""
Field group for the OBSERVATIONS_V2 and LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS export.
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.
"""

CORE = "core"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
class BlobStorageExportSource(enum.StrEnum):
"""
What data the integration exports.
- `LEGACY_TRACES_OBSERVATIONS`: traces, observations, and scores tables with a fixed column set. The `exportFieldGroups` field is not applicable.
- `LEGACY_TRACES_OBSERVATIONS`: traces, observations, and scores tables. Observation columns are controlled by `exportFieldGroups`; field groups without a counterpart in this data model (e.g. `trace_context`) are omitted.
- `OBSERVATIONS_V2`: same data model as the `/api/public/v2/observations` endpoint, plus scores. Columns are controlled by `exportFieldGroups`.
- `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS`: both sets. For the `OBSERVATIONS_V2` portion, columns are controlled by `exportFieldGroups`.
- `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS`: both sets. Observation columns of both portions are controlled by `exportFieldGroups`.

**Note:** `OBSERVATIONS_V2` and the enriched-observations portion of `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS` rely on the enriched observations table (Langfuse Fast Preview / v4), which is currently available on Langfuse Cloud only. See https://langfuse.com/docs/v4.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class BlobStorageIntegrationResponse(UniversalBaseModel):
FieldMetadata(alias="exportFieldGroups"),
] = pydantic.Field(default=None)
"""
Field groups included in each exported row for `OBSERVATIONS_V2` / `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS` sources. Always `null` when exportSource is `LEGACY_TRACES_OBSERVATIONS` (the field does not apply to that source; any legacy DB value is hidden from the public surface).
Field groups included in each exported observation row. An empty list is treated as all groups during export.
"""

next_sync_at: typing_extensions.Annotated[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,7 @@ class CreateBlobStorageIntegrationRequest(UniversalBaseModel):
FieldMetadata(alias="exportFieldGroups"),
] = pydantic.Field(default=None)
"""
Field groups to include in each exported row.

For exportSource `OBSERVATIONS_V2` or `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS`: must include `core` if provided. When omitted on create, the column default (all groups) applies. When omitted on update, the existing value is preserved.

For exportSource `LEGACY_TRACES_OBSERVATIONS`: this field must be omitted or null. Sending an array (including an empty array) returns 400, because that source uses a fixed column set and does not honor field groups.
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.

`exportFieldGroups` requires `exportSource` to be provided in the same request.
"""
Expand Down
12 changes: 12 additions & 0 deletions langfuse/api/scores/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def get_many(
request_options: typing.Optional[RequestOptions] = None,
) -> GetScoresResponse:
"""
**Deprecated.** Use `GET /api/public/v3/scores` instead. This endpoint
is no longer available on Langfuse v4 and later.

Get a list of scores (supports both trace and session scores)

Parameters
Expand Down Expand Up @@ -172,6 +175,9 @@ def get_by_id(
self, score_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> Score:
"""
**Deprecated.** Use `GET /api/public/v3/scores` with the `id` filter
instead. This endpoint is no longer available on Langfuse v4 and later.

Get a score (supports both trace and session scores)

Parameters
Expand Down Expand Up @@ -250,6 +256,9 @@ async def get_many(
request_options: typing.Optional[RequestOptions] = None,
) -> GetScoresResponse:
"""
**Deprecated.** Use `GET /api/public/v3/scores` instead. This endpoint
is no longer available on Langfuse v4 and later.

Get a list of scores (supports both trace and session scores)

Parameters
Expand Down Expand Up @@ -376,6 +385,9 @@ async def get_by_id(
self, score_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> Score:
"""
**Deprecated.** Use `GET /api/public/v3/scores` with the `id` filter
instead. This endpoint is no longer available on Langfuse v4 and later.

Get a score (supports both trace and session scores)

Parameters
Expand Down
12 changes: 12 additions & 0 deletions langfuse/api/scores/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def get_many(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetScoresResponse]:
"""
**Deprecated.** Use `GET /api/public/v3/scores` instead. This endpoint
is no longer available on Langfuse v4 and later.

Get a list of scores (supports both trace and session scores)

Parameters
Expand Down Expand Up @@ -241,6 +244,9 @@ def get_by_id(
self, score_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[Score]:
"""
**Deprecated.** Use `GET /api/public/v3/scores` with the `id` filter
instead. This endpoint is no longer available on Langfuse v4 and later.

Get a score (supports both trace and session scores)

Parameters
Expand Down Expand Up @@ -370,6 +376,9 @@ async def get_many(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetScoresResponse]:
"""
**Deprecated.** Use `GET /api/public/v3/scores` instead. This endpoint
is no longer available on Langfuse v4 and later.

Get a list of scores (supports both trace and session scores)

Parameters
Expand Down Expand Up @@ -558,6 +567,9 @@ async def get_by_id(
self, score_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[Score]:
"""
**Deprecated.** Use `GET /api/public/v3/scores` with the `id` filter
instead. This endpoint is no longer available on Langfuse v4 and later.

Get a score (supports both trace and session scores)

Parameters
Expand Down
34 changes: 24 additions & 10 deletions langfuse/api/scores_v3/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,22 @@ def get_many_v3(
"""
Get a list of scores with a polymorphic `value` field (v3).

This endpoint requires Langfuse v4 or later.

The `value` field type depends on `dataType`:
- `NUMERIC` → number
- `BOOLEAN` → boolean
- `CATEGORICAL`, `TEXT`, `CORRECTION` → string

Use the `fields` parameter to include optional field groups beyond the
default `core`. Unknown group names return HTTP 400.
The response always includes the core fields: id, projectId, name,
value, dataType, source, timestamp, environment, createdAt, updatedAt.

Additional field groups can be requested via the `fields` parameter:
- `details` — adds comment, configId, metadata
- `subject` — adds the subject object describing the entity the score
is attached to: kind (trace, observation, session, or experiment),
id, and traceId for observation-level scores
- `annotation` — adds authorUserId, queueId

Unknown group names return HTTP 400.

Parameters
----------
Expand All @@ -71,7 +78,7 @@ def get_many_v3(
URL-safe base64 (base64url) cursor for pagination. Use the cursor from the previous response to get the next page. Absent on the final page.

fields : typing.Optional[str]
Comma-separated field groups to include. Allowed: core, details, subject, annotation. Defaults to "core". Unknown names return HTTP 400.
Comma-separated field groups to include in addition to the always-returned core fields. Allowed: details, subject, annotation — see the endpoint description for the fields each group adds. Unknown names return HTTP 400.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 core silently removed from allowed fields values

The previous docstring listed core as an explicit allowed value for the fields parameter ("Allowed: core, details, subject, annotation. Defaults to 'core'"). The new docstring removes core from the allowed list because core fields are now always returned. If the server also starts rejecting fields=core with HTTP 400 (as the new wording "Unknown group names return HTTP 400" implies), any existing caller that explicitly passes fields="core" or fields="core,details" will receive a 400 error without any SDK-level warning. The same change appears in raw_client.py and both classes in scores_v3/raw_client.py.

Prompt To Fix With AI
This is a comment left during a code review.
Path: langfuse/api/scores_v3/client.py
Line: 81

Comment:
**`core` silently removed from allowed `fields` values**

The previous docstring listed `core` as an explicit allowed value for the `fields` parameter ("Allowed: core, details, subject, annotation. Defaults to 'core'"). The new docstring removes `core` from the allowed list because core fields are now always returned. If the server also starts rejecting `fields=core` with HTTP 400 (as the new wording "Unknown group names return HTTP 400" implies), any existing caller that explicitly passes `fields="core"` or `fields="core,details"` will receive a 400 error without any SDK-level warning. The same change appears in `raw_client.py` and both classes in `scores_v3/raw_client.py`.

How can I resolve this? If you propose a fix, please make it concise.


id : typing.Optional[str]
Comma-separated list of score IDs to filter by (OR within, AND across filters).
Expand Down Expand Up @@ -214,15 +221,22 @@ async def get_many_v3(
"""
Get a list of scores with a polymorphic `value` field (v3).

This endpoint requires Langfuse v4 or later.

The `value` field type depends on `dataType`:
- `NUMERIC` → number
- `BOOLEAN` → boolean
- `CATEGORICAL`, `TEXT`, `CORRECTION` → string

Use the `fields` parameter to include optional field groups beyond the
default `core`. Unknown group names return HTTP 400.
The response always includes the core fields: id, projectId, name,
value, dataType, source, timestamp, environment, createdAt, updatedAt.

Additional field groups can be requested via the `fields` parameter:
- `details` — adds comment, configId, metadata
- `subject` — adds the subject object describing the entity the score
is attached to: kind (trace, observation, session, or experiment),
id, and traceId for observation-level scores
- `annotation` — adds authorUserId, queueId

Unknown group names return HTTP 400.

Parameters
----------
Expand All @@ -233,7 +247,7 @@ async def get_many_v3(
URL-safe base64 (base64url) cursor for pagination. Use the cursor from the previous response to get the next page. Absent on the final page.

fields : typing.Optional[str]
Comma-separated field groups to include. Allowed: core, details, subject, annotation. Defaults to "core". Unknown names return HTTP 400.
Comma-separated field groups to include in addition to the always-returned core fields. Allowed: details, subject, annotation — see the endpoint description for the fields each group adds. Unknown names return HTTP 400.

id : typing.Optional[str]
Comma-separated list of score IDs to filter by (OR within, AND across filters).
Expand Down
34 changes: 24 additions & 10 deletions langfuse/api/scores_v3/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,22 @@ def get_many_v3(
"""
Get a list of scores with a polymorphic `value` field (v3).

This endpoint requires Langfuse v4 or later.

The `value` field type depends on `dataType`:
- `NUMERIC` → number
- `BOOLEAN` → boolean
- `CATEGORICAL`, `TEXT`, `CORRECTION` → string

Use the `fields` parameter to include optional field groups beyond the
default `core`. Unknown group names return HTTP 400.
The response always includes the core fields: id, projectId, name,
value, dataType, source, timestamp, environment, createdAt, updatedAt.

Additional field groups can be requested via the `fields` parameter:
- `details` — adds comment, configId, metadata
- `subject` — adds the subject object describing the entity the score
is attached to: kind (trace, observation, session, or experiment),
id, and traceId for observation-level scores
- `annotation` — adds authorUserId, queueId

Unknown group names return HTTP 400.

Parameters
----------
Expand All @@ -69,7 +76,7 @@ def get_many_v3(
URL-safe base64 (base64url) cursor for pagination. Use the cursor from the previous response to get the next page. Absent on the final page.

fields : typing.Optional[str]
Comma-separated field groups to include. Allowed: core, details, subject, annotation. Defaults to "core". Unknown names return HTTP 400.
Comma-separated field groups to include in addition to the always-returned core fields. Allowed: details, subject, annotation — see the endpoint description for the fields each group adds. Unknown names return HTTP 400.

id : typing.Optional[str]
Comma-separated list of score IDs to filter by (OR within, AND across filters).
Expand Down Expand Up @@ -271,15 +278,22 @@ async def get_many_v3(
"""
Get a list of scores with a polymorphic `value` field (v3).

This endpoint requires Langfuse v4 or later.

The `value` field type depends on `dataType`:
- `NUMERIC` → number
- `BOOLEAN` → boolean
- `CATEGORICAL`, `TEXT`, `CORRECTION` → string

Use the `fields` parameter to include optional field groups beyond the
default `core`. Unknown group names return HTTP 400.
The response always includes the core fields: id, projectId, name,
value, dataType, source, timestamp, environment, createdAt, updatedAt.

Additional field groups can be requested via the `fields` parameter:
- `details` — adds comment, configId, metadata
- `subject` — adds the subject object describing the entity the score
is attached to: kind (trace, observation, session, or experiment),
id, and traceId for observation-level scores
- `annotation` — adds authorUserId, queueId

Unknown group names return HTTP 400.

Parameters
----------
Expand All @@ -290,7 +304,7 @@ async def get_many_v3(
URL-safe base64 (base64url) cursor for pagination. Use the cursor from the previous response to get the next page. Absent on the final page.

fields : typing.Optional[str]
Comma-separated field groups to include. Allowed: core, details, subject, annotation. Defaults to "core". Unknown names return HTTP 400.
Comma-separated field groups to include in addition to the always-returned core fields. Allowed: details, subject, annotation — see the endpoint description for the fields each group adds. Unknown names return HTTP 400.

id : typing.Optional[str]
Comma-separated list of score IDs to filter by (OR within, AND across filters).
Expand Down