{{ message }}
refactor: extract tensorzero-providers crate from tensorzero-core#7304
Closed
AntoineToussaint wants to merge 4 commits intopr2-inference-traits-to-sharedfrom
Closed
refactor: extract tensorzero-providers crate from tensorzero-core#7304AntoineToussaint wants to merge 4 commits intopr2-inference-traits-to-sharedfrom
AntoineToussaint wants to merge 4 commits intopr2-inference-traits-to-sharedfrom
Conversation
Move 25 provider files (~52K LOC) from `tensorzero-core/src/providers/` into a new `tensorzero-providers` crate. The providers crate does NOT depend on `tensorzero-core` — the dependency is `core → providers`. Key changes: - All `use crate::` imports in moved files rewritten to canonical shared crate paths (`tensorzero_inference_types::*`, `tensorzero_types::*`, `tensorzero_error::*`, `tensorzero_http::*`) - `From` impls between `Stored*` types and provider types (OpenAIAPIType, ContentBlockType, grader types) moved from core to providers (orphan rule) - `From<&FunctionTool> for FunctionToolDef` added in core for optimizer call sites that pass tools to provider constructors - `GCPVertexGeminiSupervisedRow` refactored to own `Vec<FunctionToolDef>` internally, serialized as `GCPVertexGeminiSFTTool` via `serialize_with` - Extension trait `LazyRenderedSampleGCPVertexGeminiExt` in core's optimization module for building supervised rows - Optimizer row types (openai, fireworks, together) similarly updated to own `FunctionToolDef`s via `tool_serializer` helpers - `serialize_or_log` and `warn_inference_parameter_not_supported` moved to `tensorzero_inference_types::utils` - `tensorzero-core/src/providers/mod.rs` replaced with re-export shim - `gcp_vertex_gemini/optimization.rs` stays in core (depends on core types) Production code compiles cleanly (`cargo check --all-features`, `cargo clippy --all-features -- -D warnings`). Inline `#[cfg(test)] mod tests` blocks in provider files have ~95 remaining compile errors from core-only test infrastructure references (`ToolCallConfig`, `jsonschema_util`, `tensorzero_unsafe_helpers`, test_helpers tool constants). These need follow-up work to port the test infrastructure to shared crates. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix inline test code across all provider files to work with the new crate structure: - Replace WEATHER_TOOL/QUERY_TOOL with WEATHER_TOOL_DEF/QUERY_TOOL_DEF - Replace .name()/.parameters() method calls with .name/.parameters field access - Replace ToolCallConfig with ProviderToolCallConfig (tools field instead of static_tools_available/dynamic_tools_available) - Replace crate::utils::testing::capture_logs with crate::test_helpers::capture_logs - Fix ObjectStoragePointer import path (tensorzero_types:: not inference_types::) - Fix ferris.png include_bytes! path for new crate location - Fix JSONSchema -> serde_json::Value for test usage - Add tensorzero-unsafe-helpers as dev-dep for env var test helpers - Add missing imports in core's openai_rft test module - Make GCPVertexGeminiSupervisedRow fields pub for test assertions - Fix optimizer row .tools -> .tool_defs field access in tests - Wire e2e_tests feature through tensorzero-stored-config to fix StorageKind::S3Compatible prefix field issue 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>
- Add tensorzero-providers gcp_vertex_gemini path to pre-commit detect-private-key exclusion (test fixture with fake RSA key) - Gate PartialEq derives on provider request structs behind `feature = "e2e_tests"` instead of `test` (cfg(test) doesn't propagate to dependency crates in cargo hack --each-feature) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cargo hack --each-feature runs clippy with --no-default-features, which means e2e_tests is disabled and PartialEq derives gated behind it (on ErrorDetails, RequestMessage, etc.) are missing. Provider test code uses assert_eq! on these types. Fix by adding e2e_tests-enabled dev-dependencies for tensorzero-error and tensorzero-inference-types, so test targets always have PartialEq available regardless of feature flags. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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 #7303. Extracts
crates/tensorzero-core/src/providers/(~52K LOC, 25 files) into a standalonetensorzero-providerscrate.tensorzero-providersdoes NOT depend ontensorzero-core. Dependency direction iscore → providers.git mv(history preserved)use crate::imports rewritten to canonical shared-crate pathsFromimpls betweenStored*and provider types relocated to providers (orphan rule)From<&FunctionTool> for FunctionToolDefadded in core for optimizer call sitesGCPVertexGeminiSupervisedRowrefactored to ownVec<FunctionToolDef>tool_serializerhelpersgcp_vertex_gemini/optimization.rsstays in core (depends onLazyRenderedSample)dummy.rsandtest_helpers.rsstay in coretensorzero-core/src/providers/mod.rsis now a re-export shim~49 files, mostly mechanical file moves + import rewrites.
Test plan
🤖 Generated with Claude Code