refactor: move provider traits and utils to shared crates by AntoineToussaint · Pull Request #7303 · tensorzero/tensorzero · GitHub
Skip to content

refactor: move provider traits and utils to shared crates#7303

Open
AntoineToussaint wants to merge 2 commits intomainfrom
pr2-inference-traits-to-shared
Open

refactor: move provider traits and utils to shared crates#7303
AntoineToussaint wants to merge 2 commits intomainfrom
pr2-inference-traits-to-shared

Conversation

@AntoineToussaint
Copy link
Copy Markdown
Member

Summary

Stacks on #7302. Moves the last set of types out of tensorzero-core so 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 → new provider_trait module
  • BatchRequestRow, UnparsedBatchRequestRow (+ sqlx::FromRow<PgRow> impl)
  • deprecation_warning, is_mock_mode, get_mock_provider_api_base → new utils module
  • serialize_or_log, warn_inference_parameter_not_supportedutils module
  • deserialize_json_stringserde_helpers module

Adds async-trait and reqwest-sse-stream as deps of tensorzero-inference-types.

11 files, ~530 lines changed. No behavior change.

Test plan

  • CI green

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants