Repository navigation
feat(provider): add zdr to ProviderPreferences - #53
Conversation
OpenRouter's provider-routing object takes a per-request `zdr` boolean that restricts routing to providers with a zero data retention policy. `ProviderPreferences` covered `order`, `only`, `sort`, `allow_fallbacks`, and `data_collection` but had no way to set it, so callers who needed ZDR routing had to hand-build the provider payload. `data_collection: deny` is not a substitute. It only stops a provider from collecting prompts for training, and providers that retain request data for logging or abuse monitoring still pass that filter. `zdr: true` is the flag that excludes them. The field is optional and encodes only when set, so existing requests serialize byte-for-byte as before. `EmbeddingsRequest` reuses the same struct and picks the field up for free. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
ChangesZero Data Retention Provider Preference
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This adds optional zero-data-retention routing to provider preferences without changing payloads when unset. The new value is serialized through chat requests and covered for enabled, disabled, and omitted cases, with no current merge-blocking risk identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. A rabbit packed a flag so neat Comment |
Adds an optional
zdr: Bool?toProviderPreferences, mapping to OpenRouter's per-requestzdrflag on the provider-routing object. It is the last init parameter and defaults tonil, it encodes only when set, andEmbeddingsRequestpicks it up for free because it reuses the same struct. Nothing else was reordered or renamed, andEquatablestill holds.data_collection: denywas the closest thing available and it is not the same guarantee. It stops a provider from collecting prompts for training, but a provider that retains request data for logging or abuse monitoring still passes that filter.zdr: trueis what excludes retention-only providers, so callers who needed zero-data-retention routing previously had to hand-build the provider payload instead of using this type.Tests: 188 tests in 21 suites pass (
swift build && swift test), up from 184 — four new cases coveringzdrencoding, key omission when unset, azdr: falsedecode round-trip, and aChatRequestencoding"provider":{"zdr":true}. README's provider-preferences table and the embeddings field list mentionzdr.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation