Skip to content

feat(api): update API spec from langfuse/langfuse b5be2b1#1552

Open
langfuse-bot wants to merge 1 commit intomainfrom
api-spec-bot-b5be2b1
Open

feat(api): update API spec from langfuse/langfuse b5be2b1#1552
langfuse-bot wants to merge 1 commit intomainfrom
api-spec-bot-b5be2b1

Conversation

@langfuse-bot
Copy link
Collaborator

@langfuse-bot langfuse-bot commented Mar 5, 2026

Disclaimer: Experimental PR review

Greptile Summary

This auto-generated PR (via Fern) reorganizes the Langfuse Python SDK's API client to align with the updated server API spec. The core change is a namespace consolidation: previously separate top-level modules (score_v2, observations_v2, metrics_v2) are retired and their V1-endpoint equivalents are moved under a new legacy sub-client (client.legacy.metrics_v1, client.legacy.observations_v1, client.legacy.score_v1). The primary-named clients (score, observations, metrics) now uniformly target V2 endpoints.

Key changes:

  • New langfuse/api/legacy/ package grouping deprecated V1-endpoint clients
  • score module absorbs GetScoresResponse* types and GET list/get-by-id methods; score_v1 under legacy handles POST create and DELETE
  • Breaking change: metrics/raw_client.py endpoint silently changes from api/public/metricsapi/public/v2/metrics — V2 no longer supports the "traces" view, causing 400 errors for existing callers using client.metrics.metrics(query='{"view":"traces",...}')
  • Several public symbols removed from their previous modules (CreateScoreRequest, CreateScoreResponse, Observations, ObservationsViews, MetricsV2Response) — consumers importing these directly will face ImportError

Confidence Score: 2/5

  • PR contains one breaking change in the metrics endpoint that silently drops support for the "traces" view, causing 400 errors for affected users.
  • This auto-generated spec update introduces a silent breaking change: the metrics endpoint silently moves from V1 to V2, which no longer supports the "traces" view. Existing code using client.metrics.metrics(query='{"view":"traces",...}') will fail with 400 errors after this update. While a migration path exists via client.legacy.metrics_v1, callers are not warned of the change. The PR also removes several public symbols without a deprecation path. The auto-generated nature of the PR means style and organizational issues are not actionable by the author.
  • langfuse/api/metrics/raw_client.py (endpoint breaking change)

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[LangfuseAPI / AsyncLangfuseAPI] --> B[client.score]
    A --> C[client.metrics]
    A --> D[client.observations]
    A --> E[client.legacy]

    B --> B1["GET /api/public/v2/scores\n(list + get_by_id)\n← was score_v2"]
    C --> C1["GET /api/public/v2/metrics\n← was metrics_v2\n⚠️ no 'traces' view"]
    D --> D1["GET /api/public/v2/observations\n(ObservationsV2Meta/Response)\n← was observations_v2"]

    E --> F[legacy.score_v1]
    E --> G[legacy.metrics_v1]
    E --> H[legacy.observations_v1]

    F --> F1["POST /api/public/scores (create)\nDELETE /api/public/scores/:id\n← was score (v1 endpoint)"]
    G --> G1["GET /api/public/metrics\n(supports 'traces' view)\n← was metrics (v1 endpoint)"]
    H --> H1["GET /api/public/observations\n(page-based pagination)\n← was observations (v1 endpoint)"]

    style C1 fill:#ffcccc,stroke:#cc0000
    style B1 fill:#ccffcc,stroke:#009900
    style D1 fill:#ccffcc,stroke:#009900
Loading

Last reviewed commit: a309bd5

Greptile also left 1 inline comment on this PR.

@langfuse-bot langfuse-bot requested a review from hassiebp March 5, 2026 18:11
Comment on lines 187 to 192
HttpResponse[MetricsResponse]
"""
_response = self._client_wrapper.httpx_client.request(
"api/public/metrics",
"api/public/v2/metrics",
method="GET",
params={
Copy link
Contributor

Choose a reason for hiding this comment

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

Breaking change in metrics endpoint: The metrics() method endpoint silently changed from "api/public/metrics" (V1) to "api/public/v2/metrics" (V2).

V2 no longer supports the "traces" view — any existing user calling client.metrics.metrics(query='{"view":"traces",...}') will now receive 400 errors. The old behavior is still available via client.legacy.metrics_v1.metrics(), but callers using client.metrics have no indication the underlying endpoint has changed.

Consider:

  • Adding a deprecation warning when the "traces" view is detected in the query
  • Or incrementing the library version to signal this breaking change
  • Or adding a migration note to the docstring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant