Skip to content

feat(api): update API spec from langfuse/langfuse 966662e#1508

Open
langfuse-bot wants to merge 2 commits intomainfrom
api-spec-bot-966662e
Open

feat(api): update API spec from langfuse/langfuse 966662e#1508
langfuse-bot wants to merge 2 commits intomainfrom
api-spec-bot-966662e

Conversation

@langfuse-bot
Copy link
Collaborator

@langfuse-bot langfuse-bot commented Feb 3, 2026

Important

This PR adds a new CORRECTION score type and dataset versioning capabilities to the Langfuse API, ensuring backward compatibility.

  • Behavior:
    • Introduces CORRECTION score type in correction_score.py and integrates it into Score union in score.py.
    • Adds Score_Correction and GetScoresResponseData_Correction to handle correction scores.
    • Implements dataset versioning in DatasetItemsClient.list() with optional version parameter.
  • Models:
    • Adds CorrectionScore class extending BaseScore with value and stringValue fields.
    • Updates CreateDatasetRunItemRequest with datasetVersion field for versioning.
  • Misc:
    • Updates imports and exports in __init__.py files to include new types.
    • Adds test test_get_dataset_with_version() to verify dataset versioning.

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


Disclaimer: Experimental PR review

Greptile Overview

Greptile Summary

This PR updates the Python SDK API specification from the upstream Langfuse repository (commit 966662e), adding two major features:

1. Correction Score Type

  • Introduces a new CORRECTION score data type alongside existing NUMERIC, CATEGORICAL, and BOOLEAN types
  • Adds CorrectionScore class extending BaseScore with value (always 0) and stringValue fields
  • Adds Score_Correction and GetScoresResponseData_Correction variants to union types
  • Updates all import/export chains to include the new correction types

2. Dataset Versioning

  • Adds optional version parameter to DatasetItemsClient.list() method to retrieve dataset items at a specific point in time
  • Adds optional datasetVersion field to CreateDatasetRunItemRequest to pin experiment runs to specific dataset versions
  • Both use ISO 8601 timestamps (RFC 3339) in UTC format

The changes are auto-generated by Fern from the API definition, ensuring consistency with the backend API. All modified files follow established patterns for Pydantic models, client methods, and type unions. The changes are purely additive—no existing functionality is removed or modified.

Confidence Score: 5/5

  • This PR is safe to merge with no issues found
  • All changes are auto-generated from the upstream API specification using Fern, following consistent patterns throughout the codebase. The additions are purely additive with no breaking changes. Type safety is maintained through proper Pydantic models and union types. The code follows existing conventions for serialization, field aliases, and model configuration.
  • No files require special attention

Important Files Changed

Filename Overview
langfuse/api/resources/commons/types/correction_score.py New Pydantic model for correction scores extending BaseScore with value (float) and stringValue fields
langfuse/api/resources/commons/types/score.py Added Score_Correction variant to the Score union type with CORRECTION data type
langfuse/api/resources/dataset_items/client.py Added optional version parameter to list() method for point-in-time dataset item retrieval
langfuse/api/resources/dataset_run_items/types/create_dataset_run_item_request.py Added optional datasetVersion timestamp field to specify dataset version for experiment runs
langfuse/api/resources/score_v_2/types/get_scores_response_data_correction.py New response model for correction scores extending CorrectionScore with optional trace data

Sequence Diagram

sequenceDiagram
    participant Client
    participant DatasetItemsAPI
    participant ScoreAPI
    participant Database

    Note over Client,Database: New Correction Score Feature
    Client->>ScoreAPI: Create/Get Score (with CORRECTION type)
    ScoreAPI->>Database: Store/Retrieve CorrectionScore
    Database-->>ScoreAPI: Return correction with value=0, stringValue
    ScoreAPI-->>Client: Return Score_Correction

    Note over Client,Database: Dataset Versioning Feature
    Client->>DatasetItemsAPI: list(version="2026-01-21T14:35:42Z")
    DatasetItemsAPI->>Database: Query items at timestamp
    Database-->>DatasetItemsAPI: Return historical dataset items
    DatasetItemsAPI-->>Client: PaginatedDatasetItems

    Client->>DatasetItemsAPI: create_dataset_run_item(datasetVersion="2026-01-21T14:35:42Z")
    DatasetItemsAPI->>Database: Link run to dataset version
    Database-->>DatasetItemsAPI: Confirm run created
    DatasetItemsAPI-->>Client: Dataset run item created
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

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