Immutable context for experiment metadata that will be automatically attached to OpenTelemetry spans.
public class ExperimentContextImmutable context for experiment metadata that will be automatically attached to OpenTelemetry spans. When you set experiment context using this class, the wrapped OpenAI client will automatically attach it to the spans it creates. Follows the OpenTelemetry Context pattern with immutable context objects and explicit scope management. Example (recommended - use scope):
ExperimentContext.withExperiment("example-123", "session-789").use { scope ->
val completion = client.chat().completions().create(params)
}
Thread Safety: This class is thread-safe. Each thread maintains its own context via OpenTelemetry's Context mechanism.