Execute an experiment with the configured dataset
# Synchronous client.experiments.run_experiment( experiment_id: str, config: Optional[Dict[str, Any]] = None ) -> Dict[str, Any] # Asynchronous await client.experiments.run_experiment( experiment_id: str, config: Optional[Dict[str, Any]] = None ) -> Dict[str, Any]
from keywordsai import KeywordsAI client = KeywordsAI(api_key="your-api-key") # Run experiment with default configuration result = client.experiments.run_experiment( experiment_id="exp_123" ) print(f"Experiment status: {result['status']}") print(f"Run ID: {result['run_id']}") # Run experiment with custom configuration config = { "model": "gpt-4", "temperature": 0.7, "max_tokens": 150 } result = client.experiments.run_experiment( experiment_id="exp_123", config=config )
try: result = client.experiments.run_experiment( experiment_id="exp_123" ) except Exception as e: print(f"Error running experiment: {e}")
Was this page helpful?