You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: evaluations/ab-tests.mdx
+45-6Lines changed: 45 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,15 @@ description: "Run weighted A/B tests on models, prompts, or any variants in your
5
5
6
6
## Overview
7
7
8
-
`ze.choose()` enables A/B testing by making weighted random selections between different variants (models, prompts, parameters, etc.)and automatically tracking which variant was chosen for each execution.
8
+
`ze.choose()` enables A/B testing by making weighted random selections between variants (models, prompts, parameters, etc.), timeboxing each experiment, and automatically tracking the chosen variant on the active span/trace/session for downstream analytics.
9
9
10
10
**Key features:**
11
11
- Weighted random selection between variants
12
+
- Experiment timeboxing via `duration_days`
12
13
- Automatic tracking of choices within spans, traces, or sessions
13
14
- Consistency caching — same entity always gets the same variant
14
-
- Built-in validation of weights and variant keys
15
+
- Built-in validation of weights, variant keys, and defaults
16
+
- Automatic fallback to a default variant once an experiment completes
15
17
16
18
## Basic Usage
17
19
@@ -22,11 +24,13 @@ ze.init()
22
24
23
25
# Must be called within a span, trace, or session context
24
26
with ze.span("my_operation"):
25
-
# Choose between two models with 70/30 split
27
+
# Choose between two models with 70/30 split for 14 days
0 commit comments