Skip to content

Conversation

@langfuse-bot
Copy link
Collaborator

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

Important

Update API spec to add input/output schema validation fields and refine metadata type in dataset and score request classes.

  • API Specification Update:
    • Add input_schema and expected_output_schema to Dataset in dataset.py for input and output validation.
    • Add input_schema and expected_output_schema to CreateDatasetRequest in create_dataset_request.py for input and output validation.
  • Type Refinement:
    • Change metadata type to typing.Dict[str, typing.Any] in CreateScoreRequest in create_score_request.py for more specific typing.

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

Disclaimer: Experimental PR review

Greptile Overview

Updated On: 2025-11-06 17:35:58 UTC

Greptile Summary

This PR adds JSON Schema validation support for datasets and improves type safety for score metadata.

Key Changes:

  • Added input_schema and expected_output_schema optional fields to Dataset and CreateDatasetRequest for validating dataset item inputs and expected outputs
  • Added allow_population_by_field_name and populate_by_name to pydantic Config in CreateDatasetRequest to support both snake_case and camelCase field names
  • Changed metadata type in CreateScoreRequest from typing.Any to typing.Dict[str, typing.Any] for better type safety

Impact:

  • These are backward-compatible additions (all new fields are optional)
  • Schema validation will apply to both new and existing dataset items when configured
  • The metadata type refinement provides better type checking without breaking existing functionality

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Score reflects that this is an auto-generated API client update with backward-compatible changes: all new fields are optional, type refinements are narrowing (more specific), and pydantic config additions are purely additive
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
langfuse/api/resources/commons/types/dataset.py 5/5 Added input_schema and expected_output_schema fields for JSON Schema validation
langfuse/api/resources/datasets/types/create_dataset_request.py 5/5 Added schema validation fields and pydantic config for field aliasing
langfuse/api/resources/score/types/create_score_request.py 5/5 Refined metadata type from typing.Any to typing.Dict[str, typing.Any]

Sequence Diagram

sequenceDiagram
    participant Client
    participant CreateDatasetRequest
    participant Dataset
    participant API
    
    Client->>CreateDatasetRequest: Create dataset with schemas
    Note over CreateDatasetRequest: inputSchema (optional)<br/>expectedOutputSchema (optional)<br/>name, description, metadata
    CreateDatasetRequest->>API: POST /datasets
    Note over API: Validate schema fields<br/>Apply to new & existing items
    API->>Dataset: Return dataset object
    Note over Dataset: Contains inputSchema<br/>expectedOutputSchema<br/>for validation
    Dataset->>Client: Dataset with schemas
    
    Client->>API: Create/Update dataset items
    Note over API: Validate items against<br/>inputSchema & expectedOutputSchema
    API->>Client: Validated items
Loading

@langfuse-bot langfuse-bot requested a review from hassiebp November 6, 2025 17:34
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.

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@hassiebp hassiebp merged commit 52d17d3 into main Nov 6, 2025
12 checks passed
@hassiebp hassiebp deleted the api-spec-bot-25e6ad9 branch November 6, 2025 18:12
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