feat: add filter parameter to score API client #729
+7
−0
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
Adds
filterparameter toGetScoresRequestand updatesScoreV2class to handle it for score filtering.filterparameter toGetScoresRequestinGetScoresRequest.tsfor filtering scores by metadata and other criteria.ScoreV2class inClient.tsto handlefilterparameter in query parameters.GetScoresRequest.tsto reflect newfilterparameter.This description was created by
for b1b0f57. 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 generated ScoreV2 API client to accept a new
filterquery parameter onGetScoresRequestand forwards it through toGET /api/public/v2/scores.The only issue spotted is in the new
filterJSDoc: it claims the value is a JSON-stringified array, but the example is shown as an unquoted array literal. That mismatch can lead JS callers to pass an array/object, which would be serialized into bracketed query params rather than a singlefilterJSON string expected by the API.Confidence Score: 4/5
filterpassthrough) and aligns with existing query parameter handling. The main risk is user-facing: the new JSDoc example can cause incorrectfilterserialization in JS usage.Important Files Changed
filterfrom GetScoresRequest into GET /api/public/v2/scores query params.filter?: stringto GetScoresRequest; JSDoc example currently contradicts the "JSON string" requirement and can mislead JS callers.Sequence Diagram
sequenceDiagram participant App as Caller participant Score as ScoreV2 client participant Fetch as core.fetcher participant API as Langfuse API App->>Score: get({ ..., filter }) Score->>Score: build _queryParams incl. filter Score->>Fetch: fetcher({ url, method: GET, queryParameters }) Fetch->>API: GET /api/public/v2/scores?filter=... API-->>Fetch: 2xx/4xx response Fetch-->>Score: parsed response or error Score-->>App: GetScoresResponse / throws