Skip to content

feat(api): update API spec from langfuse/langfuse d32b852#1692

Closed
langfuse-bot wants to merge 1 commit into
mainfrom
api-spec-bot-d32b852
Closed

feat(api): update API spec from langfuse/langfuse d32b852#1692
langfuse-bot wants to merge 1 commit into
mainfrom
api-spec-bot-d32b852

Conversation

@langfuse-bot

@langfuse-bot langfuse-bot commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Greptile Summary

This PR adds a new scores_v3 module implementing the GET /api/public/v3/scores endpoint (requires Langfuse v4+), which returns a polymorphic value field typed via a discriminated union on dataType.

  • New ScoresV3Client / AsyncScoresV3Client are wired into the top-level LangfuseAPI / AsyncLangfuseAPI clients as a lazy-initialized scores_v3 property, following the same pattern as existing sub-clients.
  • A full set of new Pydantic models (ScoreV3, ScoreSubjectV3, BaseScoreV3, and concrete subtypes) model the five score data types (NUMERIC, BOOLEAN, CATEGORICAL, TEXT, CORRECTION) and four subject kinds (trace, observation, session, experiment) using discriminated unions.

Confidence Score: 4/5

Safe to merge; the new scores_v3 module is additive and isolated, with no changes to existing endpoints.

All 20 changed files are either new auto-generated modules or additive registrations in init.py and client.py. The Pydantic models, discriminated unions, and HTTP error handling follow established codebase patterns correctly. The only non-spec item is a style-rule violation where runtime imports are placed inside property methods rather than at module level.

langfuse/api/client.py — the two scores_v3 property methods both contain inline imports that deviate from the team's import-placement rule.

Class Diagram

%%{init: {'theme': 'neutral'}}%%
classDiagram
    class LangfuseAPI {
        +scores_v3 ScoresV3Client
    }
    class AsyncLangfuseAPI {
        +scores_v3 AsyncScoresV3Client
    }
    class ScoresV3Client {
        +get_many_v3() GetScoresV3Response
    }
    class AsyncScoresV3Client {
        +get_many_v3() GetScoresV3Response
    }
    class RawScoresV3Client {
        +get_many_v3() HttpResponse[GetScoresV3Response]
    }
    class GetScoresV3Response {
        +data List[ScoreV3]
        +meta GetScoresV3Meta
    }
    class ScoreV3 {
        <<Union discriminator=data_type>>
    }
    class BaseScoreV3 {
        +id str
        +project_id str
        +subject Optional[ScoreSubjectV3]
    }
    class ScoreSubjectV3 {
        <<Union discriminator=kind>>
    }
    LangfuseAPI --> ScoresV3Client
    AsyncLangfuseAPI --> AsyncScoresV3Client
    ScoresV3Client --> RawScoresV3Client
    ScoresV3Client ..> GetScoresV3Response
    GetScoresV3Response --> ScoreV3
    ScoreV3 --> BaseScoreV3
    BaseScoreV3 --> ScoreSubjectV3
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
langfuse/api/client.py:248-251
**Import inside property method**

Both the `LangfuseAPI.scores_v3` and `AsyncLangfuseAPI.scores_v3` properties (the same pattern is at line ~272 in the async class) contain runtime imports inside the method body (`from .scores_v3.client import ScoresV3Client`) rather than at module level. The `# noqa: E402` comment suppresses the linter warning but does not satisfy the team's rule that imports should be placed at the top of the module. The import at module level under `if typing.TYPE_CHECKING:` covers static analysis but the runtime import path still lives inside the property.

Reviews (1): Last reviewed commit: "feat(api): update API spec from langfuse..." | Re-trigger Greptile

Context used:

  • Rule used - Move imports to the top of the module instead of p... (source)

Learned From
langfuse/langfuse-python#1387

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

@claude review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM, mechanical auto-generated API spec update adding the scores_v3 module.

Extended reasoning...

Overview

This PR is an auto-generated update from the Fern API spec (langfuse/langfuse d32b852). It adds a new scores_v3 API module that exposes GET /api/public/v3/scores and the corresponding polymorphic score types (Numeric/Boolean/Categorical/Text/Correction) along with a discriminated ScoreSubjectV3 union (trace/observation/session/experiment). The only edits to existing files are additive: new entries in langfuse/api/__init__.py (_dynamic_imports, __all__, TYPE_CHECKING block) and a new lazy-loaded scores_v3 property on both LangfuseAPI and AsyncLangfuseAPI in langfuse/api/client.py.

Security risks

None identified. This is purely an additive type/client surface; no auth, crypto, serialization, or transport code is changed. The new client reuses the existing SyncClientWrapper/AsyncClientWrapper and error types from commons.

Level of scrutiny

Low. Every file carries the # This file was auto-generated by Fern from our API Definition header and mirrors the structure of sibling modules (e.g., scores, scores_v1). The patterns for lazy imports, raw clients, and discriminated unions match conventions already established and reviewed in this codebase. The bug hunting system found no issues.

Other factors

The PR is opened by automation in response to an upstream API spec change, and the trigger comment @claude review is the only timeline activity. No outstanding reviewer comments. Approving without a human in the loop is appropriate for this class of codegen-only update.

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