feat(api): update API spec from langfuse/langfuse 3fedbb7 (#1558)#1559
feat(api): update API spec from langfuse/langfuse 3fedbb7 (#1558)#1559
Conversation
Co-authored-by: langfuse-bot <langfuse-bot@langfuse.com>
| "CreateObservationEvent", | ||
| "CreatePromptRequest", |
There was a problem hiding this comment.
CreateScoreRequest, CreateScoreResponse, MetricsResponse, Observations, and ObservationsViews are removed from langfuse.api.__all__ and _dynamic_imports. Any user code that imports these symbols directly from langfuse.api (e.g., from langfuse.api import CreateScoreRequest) will receive an AttributeError at runtime after upgrading.
These types have been relocated to langfuse.api.legacy (available via from langfuse.api.legacy.score_v1 import CreateScoreRequest, etc.), but this is a silent breaking change for existing SDK consumers. If intentional, consider adding a deprecation entry or migration guide to help users upgrade.
Rule Used: Move imports to the top of the module instead of p... (source)
Learnt From
langfuse/langfuse-python#1387
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1af24f09e9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def scores(self): | ||
| if self._scores is None: | ||
| from .scores.client import ScoresClient # noqa: E402 | ||
|
|
||
| self._score = ScoreClient(client_wrapper=self._client_wrapper) | ||
| return self._score | ||
| self._scores = ScoresClient(client_wrapper=self._client_wrapper) |
There was a problem hiding this comment.
Preserve deprecated API client attribute aliases
Renaming the top-level client accessors without aliases (score→scores, and similarly removing other *_v2 accessors in this commit) introduces a runtime compatibility break for users upgrading from the previous SDK version: existing code that calls LangfuseAPI().score... (or other removed attributes) now raises AttributeError immediately. Since the old functionality still exists under legacy, keeping deprecated alias properties would avoid breaking existing integrations while allowing the new naming.
Useful? React with 👍 / 👎.
Disclaimer: Experimental PR review
Greptile Summary
This PR reorganizes the auto-generated Fern SDK API surface by promoting v2 endpoints to top-level modules and consolidating deprecated v1 endpoints under a new
legacynamespace. The v2 metrics, observations, and scores APIs are now the primary surface (langfuse.api.metrics,langfuse.api.observations,langfuse.api.scores), while the old v1 equivalents move tolangfuse.api.legacy.{metrics_v1,observations_v1,score_v1}.Breaking API change:
CreateScoreRequest,CreateScoreResponse,MetricsResponse,Observations, andObservationsViewsare removed fromlangfuse.api.__all__and are no longer available at the top level. Existing consumer code doingfrom langfuse.api import CreateScoreRequestwill fail withAttributeError. These types are available inlangfuse.api.legacybut this removal is undocumented.New features:
ScoresClient.get_manygains new filter parameters (dataset_run_id,session_id,queue_id,fields,filter,environment,trace_tags) and a newGetScoresResponseTraceDatatype for optional trace context in score responses.Confidence Score: 2/5
AttributeErrorfor existing SDK consumers importing removed top-level symbols without providing migration guidance.CreateScoreRequest,CreateScoreResponse,MetricsResponse,Observations, andObservationsViewsfrom the top-levellangfuse.apinamespace is a hard breaking change. While these types are available vialangfuse.api.legacy, the migration path is undocumented. Existing code doingfrom langfuse.api import CreateScoreRequestwill fail immediately after upgrade.langfuse/api/__init__.py— Breaking removal of public symbols requires documentation/deprecation strategyFlowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[LangfuseAPI / AsyncLangfuseAPI] --> B[.legacy] A --> C[.scores] A --> D[.metrics] A --> E[.observations] B --> B1[.metrics_v1\nGET api/public/metrics\nMetricsResponse] B --> B2[.observations_v1\nGET api/public/observations\nObservationsViews] B --> B3[.score_v1\nCreateScoreRequest / CreateScoreResponse] C --> C1[.get_many\nGetScoresResponse\n+ dataset_run_id, session_id,\n queue_id, fields, filter] D --> D1[.metrics\nMetricsV2Response] E --> E1[.get_many\nObservationsV2Response\n cursor-based pagination] E --> E2[.get\nObservationV2] style B fill:#f9c,stroke:#c66 style B1 fill:#fdd,stroke:#c66 style B2 fill:#fdd,stroke:#c66 style B3 fill:#fdd,stroke:#c66 style C fill:#cfc,stroke:#6a6 style D fill:#cfc,stroke:#6a6 style E fill:#cfc,stroke:#6a6Last reviewed commit: 1af24f0