feat(api): update API spec from langfuse/langfuse d18d2a0 #1487
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Important
Update API spec to include new
OrganizationandScoreConfigDataTypeclasses, modifyScoreDataType, and suggest v2 endpoints for improved performance.Organizationclass inorganization.pyfor handling organization data.ScoreConfigDataTypeclass inscore_config_data_type.pyfor score configuration data types.ScoreDataTypeinscore_data_type.pyto includeCORRECTIONtype.ScoreConfiginscore_config.pyto useScoreConfigDataType.ScoreBodyinscore_body.pyto document score name behavior for correction scores.metrics/client.pyandobservations/client.pyfor better performance.__all__lists in__init__.pyfiles to include new classes and changes.score_configs/client.pyto reflect new class usage.This description was created by
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:
ScoreConfigDataTypeas a separate enum for score configurations (supporting NUMERIC, BOOLEAN, CATEGORICAL), distinct fromScoreDataTypewhich now includes an additional CORRECTION variant for score submissionsOrganizationmodel and embedded it within theProjectmodel to provide organizational hierarchy informationScoreConfigDataTypeinstead ofScoreDataTypefor config creation)Issue Found: The
ScoreDataTypeLiteral type inlangfuse/types.py:44is missing the new "CORRECTION" variant, creating a type mismatch with the API enum definition.Confidence Score: 4/5
langfuse/types.py- needs manual update to include "CORRECTION" in ScoreDataType LiteralImportant Files Changed
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