- Notifications
You must be signed in to change notification settings - Fork746
Add support for extra_headers/extra_body in relay mode#5119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
The relay gateway now forwards these options to the downstreamgateway (after performing variant-level filtering on the relaygateway).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull request overview
This PR implements support for forwardingextra_body andextra_headers parameters in relay mode. Previously, these options were not forwarded to the downstream gateway. The implementation ensures that variant-level filtering is performed on the relay gateway before forwarding, while model/provider-level filtering is deferred to the downstream gateway where the actual model invocations occur.
Key Changes:
- Relay gateway now forwards extra_body/extra_headers to downstream gateway with appropriate transformations
- Validation logic updated to skip model/provider filter validation in relay mode
- Comprehensive test suite added covering various forwarding scenarios
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tensorzero-core/src/relay.rs | Integrates new preparation functions for extra_body and extra_headers forwarding |
| tensorzero-core/src/inference/types/extra_body.rs | Addsprepare_relay_extra_body andprepare_relay_extra_headers functions to transform and forward options appropriately |
| tensorzero-core/src/inference/types/extra_stuff.rs | Updates validation to skip model/provider filter checks in relay mode |
| tensorzero-core/src/endpoints/inference.rs | Passes relay configuration to validation functions |
| gateway/tests/relay_extra_body.rs | Comprehensive test suite covering config-level, inference-level, variant-level forwarding and edge cases |
| gateway/tests/relay_basic.rs | Refactored to use shared relay test utilities from common module |
| gateway/tests/common/relay.rs | New shared module with relay test environment setup helpers |
| gateway/tests/common/mod.rs | Registers new relay submodule |
Comments suppressed due to low confidence (1)
gateway/tests/relay_basic.rs:24
- Malformed comment separator - contains extra spaces and equal signs in the wrong pattern
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
gateway/tests/relay_basic.rs:24
- The comment separator line has irregular spacing with extra spaces between the equals signs. This should be corrected to match the consistent formatting used in the rest of the file.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
gateway/tests/relay_basic.rs:24
- The comment separator line is malformed with extra equals signs in the middle. It should be a consistent line of equals signs.
Uh oh!
There was an error while loading.Please reload this page.
virajmehta left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Generally LGTM, a few small requests for unit tests. Thanks!
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
gateway/tests/relay_basic.rs:24
- The comment delimiter is malformed with extra spaces:
// =========== =================================================================. This should be a single continuous line of equals signs.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
7e4ebacUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
The relay gateway now forwards these options to the downstream gateway (after performing variant-level filtering on the relay gateway).
Important
Add support for forwarding
extra_headersandextra_bodyin relay mode to downstream gateway.extra_headersandextra_bodyto downstream gateway after variant-level filtering.prepare_relay_extra_body()andprepare_relay_extra_headers()inextra_body.rsto handle relay-specific logic.validate_inference_filters()inextra_stuff.rsto skip validation in relay mode.relay_extra_body.rsto verify forwarding ofextra_headersandextra_body.relay_basic.rsandcommon/relay.rs.This description was created by
for1e39dd3. You cancustomize this summary. It will automatically update as commits are pushed.