Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions apps/gateway/src/lib/logs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ describe("getUnifiedFinishReason", () => {
expect(getUnifiedFinishReason("SPII", "google-ai-studio")).toBe(
UnifiedFinishReason.CONTENT_FILTER,
);
expect(getUnifiedFinishReason("LANGUAGE", "google-ai-studio")).toBe(
UnifiedFinishReason.CONTENT_FILTER,
);
expect(getUnifiedFinishReason("IMAGE_SAFETY", "google-ai-studio")).toBe(
UnifiedFinishReason.CONTENT_FILTER,
);
expect(
getUnifiedFinishReason("IMAGE_PROHIBITED_CONTENT", "google-ai-studio"),
).toBe(UnifiedFinishReason.CONTENT_FILTER);
expect(getUnifiedFinishReason("NO_IMAGE", "google-ai-studio")).toBe(
UnifiedFinishReason.CONTENT_FILTER,
);
Comment on lines +54 to +65

Copilot AI Dec 18, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new finish reason tests only cover the "google-ai-studio" provider, but the implementation in logs.ts applies these finish reasons to both "google-ai-studio" and "google-vertex" providers (lines 47-48 use a shared case statement). Test coverage should be added for the "google-vertex" provider to ensure these finish reasons work correctly for both Google provider types.

Copilot uses AI. Check for mistakes.
});

it("handles special cases", () => {
Expand Down
6 changes: 5 additions & 1 deletion apps/gateway/src/lib/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ export function getUnifiedFinishReason(
finishReason === "PROHIBITED_CONTENT" ||
finishReason === "RECITATION" ||
finishReason === "BLOCKLIST" ||
finishReason === "SPII"
finishReason === "SPII" ||
finishReason === "LANGUAGE" ||
finishReason === "IMAGE_SAFETY" ||
finishReason === "IMAGE_PROHIBITED_CONTENT" ||
finishReason === "NO_IMAGE"
) {
return UnifiedFinishReason.CONTENT_FILTER;
}
Expand Down
Loading