{{ message }}
refactor: move provider traits and utils to shared crates#7303
Open
AntoineToussaint wants to merge 2 commits intomainfrom
Open
refactor: move provider traits and utils to shared crates#7303AntoineToussaint wants to merge 2 commits intomainfrom
AntoineToussaint wants to merge 2 commits intomainfrom
Conversation
This was referenced Apr 16, 2026
Move shared types and utilities out of tensorzero-core into tensorzero-inference-types, in preparation for extracting crates/tensorzero-core/src/providers/ into a standalone tensorzero-providers crate in a follow-up PR. Moved (re-exported from core for backward compatibility): - `InferenceProvider`, `WrappedProvider`, `TensorZeroEventError` from `tensorzero-core/src/inference/mod.rs` to a new `tensorzero-inference-types::provider_trait` module. The trait is the linchpin every provider implements; relocating it lets the providers crate live without depending on tensorzero-core. - `BatchRequestRow` and `UnparsedBatchRequestRow` (plus their `sqlx::FromRow` impl for `PgRow`) into `tensorzero-inference-types`. The orphan rule means the FromRow impl had to follow the type. - `deprecation_warning`, `is_mock_mode`, `get_mock_provider_api_base` into a new `tensorzero-inference-types::utils` module. Also exposes `tensorzero-inference-types::serde_helpers` and adds `deserialize_json_string` to it (needed by the moved BatchRequestRow). Adds `async-trait` and `reqwest-sse-stream` as deps of `tensorzero-inference-types`. No behavior change. `cargo check --all-targets --all-features` and `cargo clippy --all-targets --all-features -- -D warnings` both pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2d6c9ad to
dd22682
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Stacks on #7302. Moves the last set of types out of
tensorzero-coreso the follow-up PR can extract providers into a standalone crate.Moved into
tensorzero-inference-types(re-exported from core for backward compatibility):InferenceProvider,WrappedProvider,TensorZeroEventError→ newprovider_traitmoduleBatchRequestRow,UnparsedBatchRequestRow(+sqlx::FromRow<PgRow>impl)deprecation_warning,is_mock_mode,get_mock_provider_api_base→ newutilsmoduleserialize_or_log,warn_inference_parameter_not_supported→utilsmoduledeserialize_json_string→serde_helpersmoduleAdds
async-traitandreqwest-sse-streamas deps oftensorzero-inference-types.11 files, ~530 lines changed. No behavior change.
Test plan
🤖 Generated with Claude Code