feat(gateway): map content filter types - #1345
Conversation
Add the finish reason "IMAGE_RECITATION" to the list of reasons unified under CONTENT_FILTER in getUnifiedFinishReason. Also update corresponding tests to cover this new case. Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
WalkthroughThis PR adds support for two new Google AI finish reasons ("IMAGE_RECITATION" and "IMAGE_OTHER") for google-ai-studio and google-vertex providers, mapping them to the CONTENT_FILTER unified finish reason. Test coverage is expanded to validate the new mappings. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5–10 minutes
Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (8)**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx,js,jsx,json,md}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
apps/{gateway,api}/**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{js,ts,tsx,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
{apps/api,apps/gateway,packages/db}/**/*.ts📄 CodeRabbit inference engine (AGENTS.md)
Files:
apps/{gateway,api}/src/**/*.ts📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.spec.ts📄 CodeRabbit inference engine (CLAUDE.md)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR extends the gateway's finish reason mapping to properly handle two additional Google AI image-related content filter types: IMAGE_RECITATION and IMAGE_OTHER. These are now correctly mapped to the unified CONTENT_FILTER finish reason.
Key changes:
- Added
IMAGE_RECITATIONto the content filter condition chain for Google providers - Added comprehensive test coverage for both
IMAGE_RECITATIONandIMAGE_OTHERmappings
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/gateway/src/lib/logs.ts | Added IMAGE_RECITATION to the content filter finish reason mapping for Google providers |
| apps/gateway/src/lib/logs.spec.ts | Added test cases to verify IMAGE_RECITATION and IMAGE_OTHER correctly map to CONTENT_FILTER |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Changes
Gateway Logs
Tests
Files touched
Test plan
🌿 Generated by Terry
ℹ️ Tag @terragon-labs to ask questions and address PR feedback
📎 Task: https://www.terragonlabs.com/task/26e3b6bf-98a2-44a0-b57e-84e6aa8145cd
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.