feat(api): update API spec from langfuse/langfuse d59b6a3 #1489
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
This PR updates the API spec by adding
OrganizationandScoreConfigDataTypeclasses, enhancing existing classes, and improving API client functionality and documentation.Organizationclass inorganization.pyfor project association.ScoreConfigDataTypeclass inscore_config_data_type.pyfor score configuration.ScoreDataTypeinscore_data_type.pyto includeCORRECTIONtype.ScoreBodyinscore_body.pyto include a description fornamefield.fieldsparameter toget()inscore_v_2/client.pyfor field selection.fieldsparameter toget_many()inobservations/client.pyfor field selection.metrics/client.pyandobservations/client.pyfor better performance.__init__.pyfiles to include new classes.__all__in__init__.pyfiles to include new classes.This description was created by
for 518f2d1. 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 API specification. Introduces type separation between score configurations and actual scores, adds organization context to projects, and enhances API v2 endpoints with field selection capabilities.
Key changes:
ScoreConfigDataTypeenum (NUMERIC, BOOLEAN, CATEGORICAL) separate fromScoreDataType(which includes CORRECTION) - this correctly reflects that score configs don't support CORRECTION typeOrganizationmodel and made it a required field onProject- breaking change for API consumers expecting previous Project schemafieldsparameter to Score V2 endpoint for selective field retrievalConfidence Score: 4/5
organizationfield to Project is a breaking change that will affect consumers. Score reduced from 5 to 4 due to this backward compatibility concern, though the change properly reflects the upstream API.langfuse/api/resources/projects/types/project.py- the required organization field is a breaking changeImportant Files Changed
Sequence Diagram
sequenceDiagram participant API as Langfuse API participant Client as Python SDK participant App as Application Code Note over API,App: Score Config Creation Flow App->>Client: Create score config with ScoreConfigDataType Client->>Client: Use ScoreConfigDataType enum (NUMERIC, BOOLEAN, CATEGORICAL) Client->>API: POST /api/public/score-configs API-->>Client: Return ScoreConfig with ScoreConfigDataType Client-->>App: ScoreConfig object Note over API,App: Score Creation Flow App->>Client: Create score with optional ScoreDataType Client->>Client: Use ScoreDataType enum (includes CORRECTION) Client->>API: POST score with value API-->>Client: Return Score Client-->>App: Score object Note over API,App: Project Retrieval Flow App->>Client: Get project details Client->>API: GET /api/public/projects API-->>Client: Return Project with Organization Client->>Client: Deserialize Project with nested Organization Client-->>App: Project object with organization field Note over API,App: Score V2 Query with Field Selection App->>Client: Query scores with field filter Client->>API: GET /api/public/v2/scores?fields=score API-->>Client: Return filtered score data Client-->>App: GetScoresResponse