Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: document max scores limit behaviour on scores v2 API route (#13567)

Valery Meleshkin23aa702b5d67
diff --git a/fern/apis/server/definition/scores.yml b/fern/apis/server/definition/scores.yml
index 9dd954635b..7433859aa4 100644
--- a/fern/apis/server/definition/scores.yml
+++ b/fern/apis/server/definition/scores.yml
@@ -18,7 +18,7 @@ service:
docs: Page number, starts at 1.
limit:
type: optional<integer>
- docs: Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit.
+ docs: Limit of items per page. Maximum 100. Defaults to 50. Requests with a limit greater than 100 return HTTP 400. If you encounter api issues due to too large page sizes, try to reduce the limit.
userId:
type: optional<string>
docs: Retrieve only scores with this userId associated to the trace.
diff --git a/web/public/generated/api/openapi.yml b/web/public/generated/api/openapi.yml
index 5c9941984d..a9a5356275 100644
--- a/web/public/generated/api/openapi.yml
+++ b/web/public/generated/api/openapi.yml
@@ -5285,8 +5285,9 @@ paths:
- name: limit
in: query
description: >-
- Limit of items per page. If you encounter api issues due to too
- large page sizes, try to reduce the limit.
+ Limit of items per page. Maximum 100. Defaults to 50. Requests with
+ a limit greater than 100 return HTTP 400. If you encounter api
+ issues due to too large page sizes, try to reduce the limit.
required: false
schema:
type: integer
diff --git a/web/src/__tests__/server/scores-api-v2.servertest.ts b/web/src/__tests__/server/scores-api-v2.servertest.ts
index c26433c25e..09716d6d88 100644
--- a/web/src/__tests__/server/scores-api-v2.servertest.ts
+++ b/web/src/__tests__/server/scores-api-v2.servertest.ts
@@ -1166,6 +1166,31 @@ describe("/api/public/v2/scores API Endpoint", () => {
});
});
+ describe("should validate pagination", () => {
+ it("rejects limit > 100 with HTTP 400", async () => {
+ expect.assertions(5);
+ try {
+ await makeZodVerifiedAPICall(
+ z.object({
+ message: z.string(),
+ error: z.array(z.object({})),
+ }),
+ "GET",
+ `/api/public/v2/scores?limit=101`,
+ undefined,
+ authentication,
+ );
+ } catch (error) {
+ const msg = (error as Error).message;
+ expect(msg).toContain("status 400");
+ expect(msg).toContain('"message":"Invalid request data"');
+ expect(msg).toContain('"path":["limit"]');
+ expect(msg).toContain('"code":"too_big"');
+ expect(msg).toContain('"maximum":100');
+ }
+ });
+ });
+
it("should filter scores by score IDs", async () => {
const getScore = await makeZodVerifiedAPICall(
GetScoresResponseV2,