feat(api): update API spec from langfuse/langfuse b5be2b1#1552
Open
langfuse-bot wants to merge 1 commit intomainfrom
Open
feat(api): update API spec from langfuse/langfuse b5be2b1#1552langfuse-bot wants to merge 1 commit intomainfrom
langfuse-bot wants to merge 1 commit intomainfrom
Conversation
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={ |
Contributor
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 newlegacysub-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:
langfuse/api/legacy/package grouping deprecated V1-endpoint clientsscoremodule absorbsGetScoresResponse*types and GET list/get-by-id methods;score_v1under legacy handles POST create and DELETEmetrics/raw_client.pyendpoint silently changes fromapi/public/metrics→api/public/v2/metrics— V2 no longer supports the"traces"view, causing 400 errors for existing callers usingclient.metrics.metrics(query='{"view":"traces",...}')CreateScoreRequest,CreateScoreResponse,Observations,ObservationsViews,MetricsV2Response) — consumers importing these directly will faceImportErrorConfidence Score: 2/5
client.metrics.metrics(query='{"view":"traces",...}')will fail with 400 errors after this update. While a migration path exists viaclient.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.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:#009900Last reviewed commit: a309bd5