Skip to main content

Overview

The create method allows you to create a new experiment with multiple variants to test. This is the foundation for running A/B tests and comparing different approaches.

Method Signature

Synchronous

Asynchronous

Parameters

Returns

Returns a dictionary containing the created experiment information.

Examples

Basic A/B Test

Experiment with Custom Metrics

Experiment with Custom Traffic Split

Multi-Variant Experiment

Experiment with Metadata

Asynchronous Creation

Model Comparison Experiment

Batch Experiment Creation

Error Handling

Experiment Structure

A created experiment contains:
  • id: Unique experiment identifier
  • name: Experiment name
  • description: Optional description
  • variants: List of variants being tested
  • metrics: Metrics being tracked
  • traffic_split: Traffic distribution
  • status: Current status (draft)
  • metadata: Custom metadata
  • created_at: Creation timestamp
  • created_by: User who created the experiment

Best Practices

  • Use descriptive names that indicate the experiment purpose
  • Define clear hypotheses in the description or metadata
  • Ensure variants are truly different and testable
  • Choose appropriate metrics for your goals
  • Plan traffic split based on risk tolerance
  • Include success criteria in metadata

Common Use Cases

  • A/B testing different prompt variations
  • Comparing model performance
  • Testing new features with limited traffic
  • Optimizing for specific metrics
  • Multi-variant testing for complex scenarios
  • Progressive rollout experiments