Skip to content

Conversation

@langfuse-bot
Copy link
Collaborator

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

Important

This PR updates API data types and models, introduces new types for score configurations and organizations, and suggests using v2 endpoints for improved performance.

  • Data Types:
    • Add ScoreConfigDataType in score_config_data_type.py for score configuration.
    • Add Organization model in organization.py for project association.
    • Update ScoreDataType in score_data_type.py to include CORRECTION type.
  • API Clients:
    • Update metrics() in metrics/client.py to suggest using v2 endpoint for better performance.
    • Update get_many() in observations/client.py to suggest using v2 endpoint for pagination and field selection.
  • Models:
    • Update ScoreConfig in score_config.py to use ScoreConfigDataType.
    • Update Project in project.py to include Organization field.
  • Imports and Exports:
    • Add Organization and ScoreConfigDataType to __init__.py files in relevant directories.
  • Documentation:
    • Add notes in reference.md to guide users towards v2 endpoints for metrics and observations.

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

Disclaimer: Experimental PR review

Greptile Summary

Auto-generated API client update from upstream langfuse/langfuse repository that introduces several type system improvements and new features.

Key Changes:

  • Introduced ScoreConfigDataType enum separate from ScoreDataType to properly distinguish between score configuration types (used when creating configs) and actual score data types (used when creating scores)
  • Added CORRECTION type to ScoreDataType enum for correction scores with updated visit pattern
  • Added new Organization model and linked it to Project model via new organization field
  • Updated all score config-related code to use ScoreConfigDataType instead of ScoreDataType for proper type separation
  • Added deprecation notices in metrics and observations endpoints recommending v2 endpoints for better performance
  • Updated documentation examples and reference materials to reflect new type structure

All changes are auto-generated via Fern from the API definition, ensuring consistency with the upstream API specification. The changes maintain backward compatibility while improving type safety and API clarity.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • All changes are auto-generated from the upstream API specification using Fern, ensuring consistency and correctness. The changes introduce proper type separation (ScoreConfigDataType vs ScoreDataType), add new functionality (CORRECTION score type, Organization model), and improve documentation. No custom logic or potential bugs introduced. All imports are correctly placed at module level, exports properly updated, and type annotations consistent throughout.
  • No files require special attention

Important Files Changed

Filename Overview
langfuse/api/resources/commons/types/score_config_data_type.py Added new enum type ScoreConfigDataType for score configurations (NUMERIC, BOOLEAN, CATEGORICAL) - auto-generated code, no issues
langfuse/api/resources/commons/types/score_data_type.py Added CORRECTION type to ScoreDataType enum and updated visit method - auto-generated code, no issues
langfuse/api/resources/commons/types/score_config.py Updated import and type from ScoreDataType to ScoreConfigDataType - correct separation of concerns
langfuse/api/resources/score_configs/types/create_score_config_request.py Updated import and type from ScoreDataType to ScoreConfigDataType for config creation - correct API separation
langfuse/api/resources/projects/types/organization.py Added new Organization model with id and name fields - standard Pydantic model, no issues
langfuse/api/resources/projects/types/project.py Added organization field to Project model - properly typed with Organization model

Sequence Diagram

sequenceDiagram
    participant Client as Client Code
    participant API as Langfuse API
    participant ScoreConfig as Score Config Types
    participant Project as Project Types
    
    Note over Client,Project: API Spec Update Changes
    
    Client->>API: Create Score Config
    API->>ScoreConfig: Use ScoreConfigDataType
    Note over ScoreConfig: New enum: NUMERIC, BOOLEAN, CATEGORICAL<br/>(separate from ScoreDataType)
    ScoreConfig-->>API: Config Created
    API-->>Client: Return ScoreConfig
    
    Client->>API: Create Score (with CORRECTION type)
    API->>ScoreConfig: Use ScoreDataType
    Note over ScoreConfig: ScoreDataType now includes<br/>CORRECTION type
    ScoreConfig-->>API: Score Created
    API-->>Client: Return Score
    
    Client->>API: Get Project Details
    API->>Project: Include Organization
    Note over Project: Project now includes<br/>organization field
    Project-->>API: Project with Organization
    API-->>Client: Return Project + Organization
    
    Note over Client,API: Deprecation Notices
    Client->>API: GET /metrics (v1)
    Note over API: Suggests using v2 endpoint
    API-->>Client: Metrics data
    
    Client->>API: GET /observations (v1)
    Note over API: Suggests using v2 endpoint
    API-->>Client: Observations data
Loading

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