Skip to content

feat(rig-typesafeai): send OpenRouter provider preferences from JevConfig - #2872

Closed
tmihalicka wants to merge 1 commit into
0xPlaygrounds:mainfrom
tmihalicka:feat/typesafeai-provider-preferences
Closed

tmihalicka wants to merge 1 commit into
0xPlaygrounds:mainfrom
tmihalicka:feat/typesafeai-provider-preferences

Conversation

@tmihalicka

@tmihalicka tmihalicka commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

Lets rig-typesafeai's JevConfig send OpenRouter's provider routing preferences (zdr, data_collection, only, …) with a Jev evaluation.

Fixes #2871

  • JevConfig::provider(ProviderPreferences): an optional setting, serialized beside model in the /systemone body only when set. TypeSafe's own API never sees it unless a caller sets it.
  • Reuses rig-core's OpenRouter ProviderPreferences rather than adding a parallel type.
  • ProviderPreferences and the types inside it now derive Deserialize. JevConfig is serializable configuration that can be reloaded. Without this, JevConfig could only skip the field when deserializing, so a reloaded config would silently drop its zero-retention requirement.
JevConfig::new(openrouter_key)
    .model("typesafe/jev-1.14")
    .with_endpoint("https://openrouter.ai/api/v1/systemone")
    .provider(
        ProviderPreferences::new()
            .zdr(true)
            .data_collection(DataCollection::Deny),
    )

Changelog

  • (rig-typesafeai) JevConfig::provider sends OpenRouter's routing preferences, such as zero data retention, with a Jev evaluation through OpenRouter's /systemone.
  • (rig-core) OpenRouter's ProviderPreferences and the types inside it implement Deserialize, so configuration holding them reloads intact.

Migration

None.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

  • cargo fmt --all -- --check
  • cargo nextest run --locked --profile local -p rig-core openrouter::extension: 26 passed
  • cargo nextest run --locked --profile local -p rig-typesafeai: 24 passed
  • cargo clippy --locked -p rig-core -p rig-typesafeai --all-targets -- -D warnings, and -p rig-cassette --all-features --test openrouter
  • Cassettes recorded: openrouter/jev/evaluation_sends_provider_preferences and openrouter/jev/evaluation_with_an_unservable_route_is_refused, against live OpenRouter with typesafe/jev-1.13. Diffs reviewed by hand; cargo xtask cassette scan --base origin/main: 0 hits.
  • Cassettes replayed: cargo test --locked -p rig-cassette --all-features --test openrouter -- jev::: 3 passed, including the existing evaluation_reads_the_reported_cost
  • cargo xtask check-test-layout
  • cargo xtask verify --affected --base origin/main: not run to completion. protoc isn't installed on my machine, and lance-encoding (from rig-lancedb) needs it to build, so I've left the full affected run to CI.

Checklist:

  • I have updated READMEs and Rust docs affected by this change
  • I have added tests that prove my fix is effective or that my feature works
  • I did not edit CHANGELOG.md or MIGRATING.md (they are generated at release)

Notes

  • Unit tests: sends_provider_preferences_only_when_set checks the encoded body with and without the setting. provider_preferences_survive_reloading_the_configuration checks the serde round trip, where only the credential has to be supplied again. provider_preferences_read_back_as_written checks that every ProviderPreferences field, including both forms of the untagged enums, reads back as written.
  • Cassettes: two new OpenRouter scenarios. evaluation_sends_provider_preferences sends zero-retention preferences; the replay matches the recorded body, so it fails if provider stops being sent. evaluation_with_an_unservable_route_is_refused shows OpenRouter applies the object: only: ["openai"] is refused with a 404 because TypeSafe is Jev's only provider.
  • Test helper: with_openrouter_jev_cassette_result takes a configure closure for the JevConfig, and the existing scenario passes it through unchanged.
  • Out of scope: provider_request_id stays None through OpenRouter, as noted in the issue.

…nfig

JevConfig::provider sets OpenRouter's routing preferences, such as zero
data retention, sent beside the model in the /systemone body when set.
It reuses rig-core's OpenRouter ProviderPreferences, which now derives
Deserialize so a reloaded JevConfig keeps the setting.

Fixes 0xPlaygrounds#2871
@gold-silver-copper

Copy link
Copy Markdown
Collaborator

Closed by #3118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(rig-typesafeai): let JevConfig send OpenRouter's provider routing preferences

2 participants