Expand description
Traffic mirroring: fire-and-forget shadow requests to a secondary model.
When enabled, every successful primary call also spawns a background
tokio::task that repeats the same request against a configured
“mirror” model. The mirror response is not returned to the caller;
it is simply logged so operators can compare primary vs. mirror results
(e.g. when evaluating a model switch).
§Usage
ⓘ
let mirror = MirrorConfig {
model: "claude-3-5-sonnet-20241022".to_string(),
sample_rate: 0.5, // mirror 50 % of requests
};
client.set_mirror(Some(mirror));Thread-safety: the config is stored behind an Arc<RwLock<…>> so it can
be hot-swapped at runtime without restarting the client.
Structs§
- Mirror
Config - Configuration for the traffic mirror.
Functions§
- maybe_
mirror - Spawn a fire-and-forget background task that sends
requestto the mirror model. Errors are logged but never propagated.
Type Aliases§
- Mirror
Handle - Shared, hot-swappable mirror configuration.