Skip to content

Conversation

@langfuse-bot
Copy link
Collaborator

@langfuse-bot langfuse-bot commented Dec 23, 2025

Important

Update API spec to include new Organization and ScoreConfigDataType classes, modify ScoreDataType, and suggest v2 endpoints for improved performance.

  • New Classes:
    • Add Organization class in organization.py for handling organization data.
    • Add ScoreConfigDataType class in score_config_data_type.py for score configuration data types.
  • Class Modifications:
    • Update ScoreDataType in score_data_type.py to include CORRECTION type.
    • Modify ScoreConfig in score_config.py to use ScoreConfigDataType.
    • Update ScoreBody in score_body.py to document score name behavior for correction scores.
  • Client Updates:
    • Suggest using v2 endpoints in metrics/client.py and observations/client.py for better performance.
  • Imports and Exports:
    • Update imports and __all__ lists in __init__.py files to include new classes and changes.
  • Miscellaneous:
    • Update example code snippets in score_configs/client.py to reflect new class usage.

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

Disclaimer: Experimental PR review

Greptile Summary

This PR updates the auto-generated API client to match the upstream Langfuse API specification. The key changes include:

  • Type System Refactoring: Introduced ScoreConfigDataType as a separate enum for score configurations (supporting NUMERIC, BOOLEAN, CATEGORICAL), distinct from ScoreDataType which now includes an additional CORRECTION variant for score submissions
  • Organization Context: Added Organization model and embedded it within the Project model to provide organizational hierarchy information
  • API Evolution Notes: Added deprecation notices to v1 metrics and observations endpoints, recommending migration to v2 endpoints with better performance and cursor-based pagination
  • Documentation Updates: Updated code examples and API reference documentation to reflect the corrected type usage (ScoreConfigDataType instead of ScoreDataType for config creation)

Issue Found: The ScoreDataType Literal type in langfuse/types.py:44 is missing the new "CORRECTION" variant, creating a type mismatch with the API enum definition.

Confidence Score: 4/5

  • This PR is safe to merge with one minor fix needed
  • Auto-generated API spec update with clean type refactoring, but missing update to user-facing Literal type in types.py for the new CORRECTION variant
  • Pay attention to langfuse/types.py - needs manual update to include "CORRECTION" in ScoreDataType Literal

Important Files Changed

Filename Overview
langfuse/api/resources/commons/types/score_config_data_type.py Added new enum type for score config data types (NUMERIC, BOOLEAN, CATEGORICAL)
langfuse/api/resources/commons/types/score_data_type.py Added CORRECTION variant to ScoreDataType enum
langfuse/api/resources/commons/types/score_config.py Updated to use ScoreConfigDataType instead of ScoreDataType
langfuse/api/resources/projects/types/organization.py Added new Organization model with id and name fields
langfuse/api/resources/projects/types/project.py Added organization field to Project model

Sequence Diagram

sequenceDiagram
    participant Client as Client Code
    participant API as API Layer
    participant ScoreConfig as ScoreConfig Model
    participant Project as Project Model
    participant Org as Organization Model
    
    Note over Client,API: Score Configuration Flow
    Client->>API: Create Score Config Request
    API->>ScoreConfig: Validate with ScoreConfigDataType
    Note over ScoreConfig: Uses ScoreConfigDataType enum<br/>(NUMERIC, BOOLEAN, CATEGORICAL)
    ScoreConfig-->>API: Config Created
    API-->>Client: Return ScoreConfig
    
    Note over Client,API: Score Submission Flow
    Client->>API: Submit Score
    API->>API: Validate with ScoreDataType
    Note over API: Uses ScoreDataType enum<br/>(NUMERIC, BOOLEAN, CATEGORICAL, CORRECTION)
    API-->>Client: Score Created
    
    Note over Client,API: Project Query Flow
    Client->>API: Get Project
    API->>Project: Retrieve Project
    Project->>Org: Include Organization
    Note over Org: New Organization model<br/>with id and name
    Org-->>Project: Organization data
    Project-->>API: Project with Organization
    API-->>Client: Return Project
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.

Additional Comments (1)

  1. langfuse/types.py, line 44 (link)

    logic: ScoreDataType Literal type needs to include "CORRECTION" to match the API enum

    The API's ScoreDataType enum now includes a CORRECTION variant (added in langfuse/api/resources/commons/types/score_data_type.py:13), but this user-facing type definition in types.py only includes the original three types.

17 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

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.

2 participants