Skip to content

Commit 4637311

Browse files
authored
Merge branch 'main' into feat/storybook-ci-tests
2 parents 157e93f + f8b2bc3 commit 4637311

File tree

218 files changed

+8050
-2315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+8050
-2315
lines changed

.cargo/config.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ test-clickhouse = [
7575
"--profile",
7676
"clickhouse",
7777
]
78+
test-clickhouse-fast = [
79+
"nextest",
80+
"run",
81+
"--features",
82+
"e2e_tests",
83+
"--profile",
84+
"clickhouse",
85+
"--retries",
86+
"0",
87+
"--no-fail-fast",
88+
]
7889
test-rate-limit-load = [
7990
"run",
8091
"--release",

.github/workflows/build-gateway-container.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ jobs:
5050

5151
- name: Login to Namespace registry
5252
run: nsc docker login
53+
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}
5354

5455
- name: Push `gateway` container to Namespace registry
5556
run: docker push nscr.io/igvf4asmf8kri/gateway:sha-${{ github.sha }}
57+
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}

.github/workflows/build-mock-inference-container.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ jobs:
4848

4949
- name: Login to Namespace registry
5050
run: nsc docker login
51+
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}
5152

5253
- name: Push `mock-inference` container to Namespace registry
5354
run: docker push nscr.io/igvf4asmf8kri/mock-inference-provider:sha-${{ github.sha }}
55+
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Run `cargo fmt`.
99
- Run `cargo clippy --all-targets --all-features -- -D warnings` to catch warnings and errors.
1010
- Run unit tests with `cargo test-unit-fast` which uses `nextest` under the hood.
11+
- When writing tests, key assertions should include a custom message stating the expected behavior.
1112

1213
## For APIs
1314

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ metrics-exporter-prometheus = { version = "0.18.0", features = [
9898
"http-listener",
9999
], default-features = false }
100100
schemars = "1.1.0"
101+
blake3 = "1.8.2"
101102
moka = { version = "0.12.10", features = ["sync"] }
102103

103104
[workspace.lints.rust]

clients/python/src/lib.rs

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
/// and defines methods on them.
1212
use std::{collections::HashMap, path::PathBuf, sync::Arc, time::Duration};
1313

14-
use evaluations::{EvaluationCoreArgs, EvaluationVariant, run_evaluation_core_streaming};
14+
use evaluations::{
15+
EvaluationCoreArgs, EvaluationFunctionConfig, EvaluationFunctionConfigTable, EvaluationVariant,
16+
run_evaluation_core_streaming,
17+
};
1518
use futures::StreamExt;
1619
use pyo3::{
1720
IntoPyObjectExt,
@@ -43,8 +46,8 @@ use tensorzero_core::{
4346
OptimizationJobInfoPyClass, OptimizationJobStatus, UninitializedOptimizerInfo,
4447
dicl::UninitializedDiclOptimizationConfig, fireworks_sft::UninitializedFireworksSFTConfig,
4548
gcp_vertex_gemini_sft::UninitializedGCPVertexGeminiSFTConfig,
46-
openai_rft::UninitializedOpenAIRFTConfig, openai_sft::UninitializedOpenAISFTConfig,
47-
together_sft::UninitializedTogetherSFTConfig,
49+
gepa::UninitializedGEPAConfig, openai_rft::UninitializedOpenAIRFTConfig,
50+
openai_sft::UninitializedOpenAISFTConfig, together_sft::UninitializedTogetherSFTConfig,
4851
},
4952
tool::ProviderTool,
5053
variant::{
@@ -107,6 +110,7 @@ fn tensorzero(m: &Bound<'_, PyModule>) -> PyResult<()> {
107110
m.add_class::<UninitializedFireworksSFTConfig>()?;
108111
m.add_class::<UninitializedDiclOptimizationConfig>()?;
109112
m.add_class::<UninitializedGCPVertexGeminiSFTConfig>()?;
113+
m.add_class::<UninitializedGEPAConfig>()?;
110114
m.add_class::<UninitializedTogetherSFTConfig>()?;
111115
m.add_class::<Datapoint>()?;
112116
m.add_class::<ResolvedInput>()?;
@@ -1431,10 +1435,32 @@ impl TensorZeroGateway {
14311435
})
14321436
.transpose()?;
14331437

1438+
// Extract evaluation config from app_state
1439+
let evaluation_config = app_state
1440+
.config
1441+
.evaluations
1442+
.get(&evaluation_name)
1443+
.ok_or_else(|| {
1444+
pyo3::exceptions::PyValueError::new_err(format!(
1445+
"evaluation '{evaluation_name}' not found"
1446+
))
1447+
})?
1448+
.clone();
1449+
1450+
// Build function configs table from all functions in the config
1451+
let function_configs: EvaluationFunctionConfigTable = app_state
1452+
.config
1453+
.functions
1454+
.iter()
1455+
.map(|(name, func)| (name.clone(), EvaluationFunctionConfig::from(func.as_ref())))
1456+
.collect();
1457+
let function_configs = Arc::new(function_configs);
1458+
14341459
let core_args = EvaluationCoreArgs {
14351460
tensorzero_client: client.clone(),
14361461
clickhouse_client: app_state.clickhouse_connection_info.clone(),
1437-
config: app_state.config.clone(),
1462+
evaluation_config,
1463+
function_configs,
14381464
evaluation_name,
14391465
evaluation_run_id,
14401466
dataset_name,
@@ -2646,10 +2672,32 @@ impl AsyncTensorZeroGateway {
26462672

26472673
let evaluation_run_id = uuid::Uuid::now_v7();
26482674

2675+
// Extract evaluation config from app_state
2676+
let evaluation_config = app_state
2677+
.config
2678+
.evaluations
2679+
.get(&evaluation_name)
2680+
.ok_or_else(|| {
2681+
pyo3::exceptions::PyValueError::new_err(format!(
2682+
"evaluation '{evaluation_name}' not found"
2683+
))
2684+
})?
2685+
.clone();
2686+
2687+
// Build function configs table from all functions in the config
2688+
let function_configs: EvaluationFunctionConfigTable = app_state
2689+
.config
2690+
.functions
2691+
.iter()
2692+
.map(|(name, func)| (name.clone(), EvaluationFunctionConfig::from(func.as_ref())))
2693+
.collect();
2694+
let function_configs = Arc::new(function_configs);
2695+
26492696
let core_args = EvaluationCoreArgs {
26502697
tensorzero_client: client.clone(),
26512698
clickhouse_client: app_state.clickhouse_connection_info.clone(),
2652-
config: app_state.config.clone(),
2699+
evaluation_config,
2700+
function_configs,
26532701
evaluation_name,
26542702
evaluation_run_id,
26552703
dataset_name,

clients/python/tensorzero/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
FunctionConfigJson,
9494
FunctionsConfig,
9595
GCPVertexGeminiSFTConfig,
96+
GEPAConfig,
9697
LegacyDatapoint,
9798
MixtureOfNConfig,
9899
OpenAIRFTConfig,
@@ -187,6 +188,7 @@ def __new__(cls, *args: Any, **kwargs: Any):
187188
TogetherSFTConfig,
188189
DICLOptimizationConfig,
189190
OpenAIRFTConfig,
191+
GEPAConfig,
190192
t.Dict[str, Any],
191193
]
192194
ChatInferenceOutput = t.List[ContentBlock]
@@ -240,6 +242,7 @@ def __new__(cls, *args: Any, **kwargs: Any):
240242
"FunctionsConfig",
241243
"FunctionTool",
242244
"GCPVertexGeminiSFTConfig",
245+
"GEPAConfig",
243246
"GetDatapointsResponse",
244247
"GetInferencesRequest",
245248
"GetInferencesResponse",

clients/python/tensorzero/generated_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ class Thought:
12001200
Struct that represents a model's reasoning
12011201
"""
12021202

1203-
_internal_provider_type: str | None = None
1203+
provider_type: str | None = None
12041204
"""
12051205
When set, this `Thought` block will only be used for providers
12061206
matching this type (e.g. `anthropic`). Other providers will emit

clients/python/tensorzero/tensorzero.pyi

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,27 @@ class GCPVertexGeminiSFTConfig:
319319
bucket_path_prefix: Optional[str] = None,
320320
) -> None: ...
321321

322+
@final
323+
class GEPAConfig:
324+
def __init__(
325+
self,
326+
*,
327+
function_name: str,
328+
evaluation_name: str,
329+
analysis_model: str,
330+
mutation_model: str,
331+
initial_variants: Optional[List[str]] = None,
332+
variant_prefix: Optional[str] = None,
333+
batch_size: Optional[int] = None,
334+
max_iterations: Optional[int] = None,
335+
max_concurrency: Optional[int] = None,
336+
seed: Optional[int] = None,
337+
timeout: Optional[int] = None,
338+
include_inference_for_mutation: Optional[bool] = None,
339+
retries: Optional[Dict[str, Any]] = None,
340+
max_tokens: Optional[int] = None,
341+
) -> None: ...
342+
322343
@final
323344
class TogetherSFTConfig:
324345
"""
@@ -1589,6 +1610,7 @@ __all__ = [
15891610
"FunctionConfigJson",
15901611
"FunctionsConfig",
15911612
"GCPVertexGeminiSFTConfig",
1613+
"GEPAConfig",
15921614
"LocalHttpGateway",
15931615
"MixtureOfNConfig",
15941616
"OpenAIRFTConfig",

0 commit comments

Comments
 (0)