Skip to content

Conversation

@langfuse-bot
Copy link
Collaborator

@langfuse-bot langfuse-bot commented Nov 12, 2025

Important

Update value field to non-optional float with default 0 in score-related classes across multiple files.

  • Behavior:
    • Change value field from Optional[float] to float in CategoricalScore, CategoricalScoreV1, Score_Categorical, ScoreV1_Categorical, and GetScoresResponseData_Categorical.
    • value defaults to 0 if no config is linked.
  • Files Affected:
    • categorical_score.py, categorical_score_v_1.py, score.py, score_v_1.py, get_scores_response_data.py.

This description was created by Ellipsis for 51ca4c5. You can customize this summary. It will automatically update as commits are pushed.

Disclaimer: Experimental PR review

Greptile Overview

Greptile Summary

Updated API type definitions for categorical scores to make the value field required instead of optional across all score-related models.

  • Changed value: Optional[float] to value: float in CategoricalScore, CategoricalScoreV1, and all categorical score variant classes
  • Updated documentation to reflect that value defaults to 0 when no config is linked (previously stated "Only defined if a config is linked")
  • Affects 5 auto-generated files from the Fern API specification
  • Changes align with backend API behavior where categorical score values are always provided

The changes are consistent across all affected type definitions and properly synchronized with the upstream API specification from langfuse/langfuse.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • These are auto-generated type definition files synchronized with the upstream API spec. The changes are consistent, well-documented, and properly tested (existing test in test_core_sdk.py:214 expects value=0 for categorical scores without config). The change from Optional to required aligns with backend behavior.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
langfuse/api/resources/commons/types/categorical_score.py 5/5 Changed value from Optional[float] to required float field with updated documentation
langfuse/api/resources/commons/types/categorical_score_v_1.py 5/5 Changed value from Optional[float] to required float field with updated documentation
langfuse/api/resources/commons/types/score.py 5/5 Changed value from Optional[float] to required float in Score_Categorical class
langfuse/api/resources/commons/types/score_v_1.py 5/5 Changed value from Optional[float] to required float in ScoreV1_Categorical class
langfuse/api/resources/score_v_2/types/get_scores_response_data.py 5/5 Changed value from Optional[float] to required float in GetScoresResponseData_Categorical class

Sequence Diagram

sequenceDiagram
    participant API as Langfuse API
    participant Client as Python SDK
    participant App as Application Code
    
    Note over API,Client: API Spec Update (db01ff9)
    
    API->>Client: Updated API Spec
    Note over Client: Auto-generated code changes
    
    Client->>Client: Update CategoricalScore classes
    Note over Client: value: Optional[float] → value: float
    
    App->>Client: Fetch categorical score
    Client->>API: GET score data
    API-->>Client: JSON response with value field
    Note over API: Backend now always<br/>returns value (0 if no config)
    Client->>Client: Deserialize to CategoricalScore
    Note over Client: Pydantic validation<br/>requires value field
    Client-->>App: CategoricalScore object
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@hassiebp hassiebp merged commit 9ec9f4a into main Nov 12, 2025
12 checks passed
@hassiebp hassiebp deleted the api-spec-bot-db01ff9 branch November 12, 2025 12:36
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.

3 participants