Skip to content

Commit d002854

Browse files
authored
Merge branch 'tensorzero:main' into main
2 parents 80d877f + 831a476 commit d002854

Some content is hidden

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

55 files changed

+1132
-438
lines changed

.github/workflows/ui-tests-e2e.yml

Lines changed: 55 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -15,60 +15,58 @@ on:
1515
required: true
1616

1717
jobs:
18-
1918
ui-tests-no-network:
2019
# We're only using namespace here so that we can download the container artifacts
2120
runs-on: namespace-profile-tensorzero-2x8
2221
steps:
23-
- name: Set DNS
24-
run: echo "127.0.0.1 howdy.tensorzero.com" | sudo tee -a /etc/hosts
25-
- uses: namespacelabs/nscloud-checkout-action@953fed31a6113cc2347ca69c9d823743c65bc84b
26-
- name: Setup Node
27-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
28-
with:
29-
node-version: "22.9.0"
30-
31-
- name: Download container images
32-
uses: namespace-actions/download-artifact@5c070f7d7ebdc47682b04aa736c76e46ff5f6e1e
33-
with:
34-
pattern: build-*-container
35-
merge-multiple: true
36-
37-
- name: Load `gateway` and `ui` containers
38-
run: |
39-
docker load < gateway-container.tar
40-
docker load < ui-container.tar
41-
42-
# This allows us to use 'no-build' on subsequent steps
43-
- name: Build needed docker images
44-
working-directory: ui
45-
run: |
46-
docker compose -f fixtures/docker-compose.e2e.yml -f fixtures/docker-compose.ui.yml build fixtures mock-inference-provider
47-
48-
- name: Start docker containers without external network access
49-
working-directory: ui
50-
run: |
51-
# Environment variables shared by the gateway and ui containers
52-
echo "TENSORZERO_CLICKHOUSE_URL=http://chuser:chpassword@clickhouse:8123/tensorzero_ui_fixtures" >> fixtures/.env
53-
echo "TENSORZERO_GATEWAY_URL=http://gateway:3000" >> fixtures/.env
54-
echo "TENSORZERO_GATEWAY_TAG=sha-${{ github.sha }}" >> fixtures/.env
55-
echo "TENSORZERO_UI_TAG=sha-${{ github.sha }}" >> fixtures/.env
56-
echo "TENSORZERO_GATEWAY_CONFIG=/app/config/empty.toml" >> fixtures/.env
57-
echo "TENSORZERO_UI_CONFIG_PATH=/app/config/empty.toml" >> fixtures/.env
58-
59-
export TENSORZERO_SKIP_LARGE_FIXTURES=1
60-
docker compose -f fixtures/docker-compose.e2e.yml -f fixtures/docker-compose.ui.yml -f ../ci/internal-network.yml up --no-build -d
61-
62-
- name: Print Docker Compose logs
63-
if: always()
64-
working-directory: ui
65-
run: docker compose -f fixtures/docker-compose.e2e.yml -f fixtures/docker-compose.ui.yml logs -t
66-
67-
- name: Print container health checks
68-
if: always()
69-
working-directory: ui
70-
run: docker inspect --format "{{json .State.Health }}" $(docker compose -f fixtures/docker-compose.e2e.yml -f fixtures/docker-compose.ui.yml ps -q ui) | jq
22+
- name: Set DNS
23+
run: echo "127.0.0.1 howdy.tensorzero.com" | sudo tee -a /etc/hosts
24+
- uses: namespacelabs/nscloud-checkout-action@953fed31a6113cc2347ca69c9d823743c65bc84b
25+
- name: Setup Node
26+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
27+
with:
28+
node-version: "22.9.0"
29+
30+
- name: Download container images
31+
uses: namespace-actions/download-artifact@5c070f7d7ebdc47682b04aa736c76e46ff5f6e1e
32+
with:
33+
pattern: build-*-container
34+
merge-multiple: true
35+
36+
- name: Load `gateway` and `ui` containers
37+
run: |
38+
docker load < gateway-container.tar
39+
docker load < ui-container.tar
40+
41+
# This allows us to use 'no-build' on subsequent steps
42+
- name: Build needed docker images
43+
working-directory: ui
44+
run: |
45+
docker compose -f fixtures/docker-compose.e2e.yml -f fixtures/docker-compose.ui.yml build fixtures mock-inference-provider
46+
47+
- name: Start docker containers without external network access
48+
working-directory: ui
49+
run: |
50+
# Environment variables shared by the gateway and ui containers
51+
echo "TENSORZERO_CLICKHOUSE_URL=http://chuser:chpassword@clickhouse:8123/tensorzero_ui_fixtures" >> fixtures/.env
52+
echo "TENSORZERO_GATEWAY_URL=http://gateway:3000" >> fixtures/.env
53+
echo "TENSORZERO_GATEWAY_TAG=sha-${{ github.sha }}" >> fixtures/.env
54+
echo "TENSORZERO_UI_TAG=sha-${{ github.sha }}" >> fixtures/.env
55+
echo "TENSORZERO_GATEWAY_CONFIG=/app/config/empty.toml" >> fixtures/.env
56+
echo "TENSORZERO_UI_CONFIG_PATH=/app/config/empty.toml" >> fixtures/.env
57+
58+
export TENSORZERO_SKIP_LARGE_FIXTURES=1
59+
docker compose -f fixtures/docker-compose.e2e.yml -f fixtures/docker-compose.ui.yml -f ../ci/internal-network.yml up --no-build -d
60+
61+
- name: Print Docker Compose logs
62+
if: always()
63+
working-directory: ui
64+
run: docker compose -f fixtures/docker-compose.e2e.yml -f fixtures/docker-compose.ui.yml logs -t
7165

66+
- name: Print container health checks
67+
if: always()
68+
working-directory: ui
69+
run: docker inspect --format "{{json .State.Health }}" $(docker compose -f fixtures/docker-compose.e2e.yml -f fixtures/docker-compose.ui.yml ps -q ui) | jq
7270

7371
ui-tests-gateway-prefix:
7472
# We're only using namespace here so that we can download the container artifacts
@@ -137,6 +135,13 @@ jobs:
137135
continue-on-error: true
138136
run: pnpm ui:test:e2e-base-path
139137

138+
- name: Run UI E2E tests that require credentials
139+
id: e2e_tests_credentials
140+
env:
141+
TENSORZERO_CI: 1
142+
continue-on-error: true
143+
run: pnpm ui:test:e2e --grep "@credentials"
144+
140145
- name: Print Docker Compose logs
141146
if: always()
142147
working-directory: ui
@@ -253,7 +258,7 @@ jobs:
253258
env:
254259
TENSORZERO_CI: 1
255260
continue-on-error: true
256-
run: pnpm ui:test:e2e
261+
run: pnpm ui:test:e2e --grep-invert "@credentials"
257262

258263
- name: Print Docker Compose logs
259264
if: always()

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ allow_attributes = "deny"
7575
dbg_macro = "deny"
7676
expect_used = "deny"
7777
if_not_else = "deny"
78+
ignored_unit_patterns = "deny"
7879
manual_string_new = "deny"
7980
match_bool = "deny"
8081
needless_raw_string_hashes = "deny"

clients/python/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ impl BaseTensorZeroGateway {
498498
include_original_response,
499499
extra_body,
500500
extra_headers,
501+
internal_dynamic_variant_config: None,
501502
})
502503
}
503504
}
@@ -1572,7 +1573,7 @@ impl AsyncTensorZeroGateway {
15721573
pyo3_async_runtimes::tokio::future_into_py(this.py(), async move {
15731574
let res = client.delete_datapoint(dataset_name, datapoint_id).await;
15741575
Python::with_gil(|py| match res {
1575-
Ok(_) => Ok(()),
1576+
Ok(()) => Ok(()),
15761577
Err(e) => Err(convert_error(py, e)),
15771578
})
15781579
})

clients/rust/src/client_inference_params.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ use serde::{Deserialize, Serialize};
55
use serde_json::Value;
66
use tensorzero_core::{
77
cache::CacheParamsOptions,
8+
config_parser::UninitializedVariantInfo,
89
endpoints::inference::{InferenceParams, Params},
910
error::Error,
10-
inference::types::extra_body::UnfilteredInferenceExtraBody,
11-
inference::types::extra_headers::UnfilteredInferenceExtraHeaders,
12-
inference::types::{Input, InputMessage, InputMessageContent},
11+
inference::types::{
12+
extra_body::UnfilteredInferenceExtraBody, extra_headers::UnfilteredInferenceExtraHeaders,
13+
Input, InputMessage, InputMessageContent,
14+
},
1315
tool::DynamicToolParams,
1416
};
1517
use uuid::Uuid;
@@ -70,6 +72,7 @@ pub struct ClientInferenceParams {
7072
pub extra_body: UnfilteredInferenceExtraBody,
7173
#[serde(default)]
7274
pub extra_headers: UnfilteredInferenceExtraHeaders,
75+
pub internal_dynamic_variant_config: Option<UninitializedVariantInfo>,
7376
}
7477

7578
impl TryFrom<ClientInferenceParams> for Params {
@@ -112,6 +115,7 @@ impl TryFrom<ClientInferenceParams> for Params {
112115
include_original_response: this.include_original_response,
113116
extra_body: this.extra_body,
114117
extra_headers: this.extra_headers,
118+
internal_dynamic_variant_config: this.internal_dynamic_variant_config,
115119
})
116120
}
117121
}
@@ -139,6 +143,7 @@ fn assert_params_match(client_params: ClientInferenceParams) {
139143
include_original_response,
140144
extra_body,
141145
extra_headers,
146+
internal_dynamic_variant_config,
142147
} = client_params;
143148
let _ = Params {
144149
function_name,
@@ -158,6 +163,7 @@ fn assert_params_match(client_params: ClientInferenceParams) {
158163
include_original_response,
159164
extra_body,
160165
extra_headers,
166+
internal_dynamic_variant_config,
161167
};
162168
}
163169

evaluations/src/evaluators/llm_judge/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ pub async fn run_llm_judge_evaluator(
123123
cache_options: get_cache_options(inference_cache),
124124
extra_body: Default::default(),
125125
extra_headers: Default::default(),
126+
internal_dynamic_variant_config: None,
126127
};
127128
let result = clients.tensorzero_client.inference(params).await?;
128129
let response = match result {

evaluations/src/evaluators/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ pub(crate) async fn evaluate_inference(
135135
})
136136
.await
137137
{
138+
#[expect(clippy::ignored_unit_patterns)]
138139
Ok(_) => {
139140
debug!(evaluator_name = %evaluator_name, "Feedback sent successfully");
140141
},

evaluations/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ async fn infer_datapoint(params: InferDatapointParams<'_>) -> Result<InferenceRe
416416
internal: true,
417417
extra_body: Default::default(),
418418
extra_headers: Default::default(),
419+
internal_dynamic_variant_config: None,
419420
};
420421
debug!("Making inference request");
421422
let inference_result = clients.tensorzero_client.inference(params).await?;

evaluations/src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ async fn main() -> Result<()> {
2525
let result = run_evaluation(args, evaluation_run_id, &mut writer).await;
2626

2727
match &result {
28-
Ok(_) => info!(evaluation_run_id = %evaluation_run_id, "Evaluation completed successfully"),
28+
Ok(()) => {
29+
info!(evaluation_run_id = %evaluation_run_id, "Evaluation completed successfully");
30+
}
2931
Err(e) => {
3032
tracing::error!(evaluation_run_id = %evaluation_run_id, error = %e, "Evaluation failed");
3133
}

gateway/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,13 @@ pub async fn shutdown_signal() {
393393
let hangup = std::future::pending::<()>();
394394

395395
tokio::select! {
396-
_ = ctrl_c => {
396+
() = ctrl_c => {
397397
tracing::info!("Received Ctrl+C signal");
398398
}
399-
_ = terminate => {
399+
() = terminate => {
400400
tracing::info!("Received SIGTERM signal");
401401
}
402-
_ = hangup => {
402+
() = hangup => {
403403
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
404404
tracing::info!("Received SIGHUP signal");
405405
}

internal/tensorzero-node/lib/bindings/TomlRelativePath.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@
66
* all paths (e.g. `system_schema`) as `TomlRelativePath`s, which will
77
* track the original `.toml` file in order to perform correct relative path resolution.
88
*/
9-
export type TomlRelativePath = { __tensorzero_remapped_path: string };
9+
export type TomlRelativePath = {
10+
__tensorzero_remapped_path: string;
11+
/**
12+
* This should be set for dynamic variants to indicate what the file contents would have been at this remapped path.
13+
*/
14+
__data: string | null;
15+
};

0 commit comments

Comments
 (0)