# What teams typically write (and why it's the wrong activity) import optuna def objective(trial): chunk_size = trial.suggest_int("chunk_size", 100, 2000) chunk_overlap = trial.suggest_int("chunk_overlap", 0, 200) top_k = trial.suggest_int("top_k", 1, 20) threshold = trial.suggest_float("threshold", 0.5, 0.95) accuracy = run_rag_pipeline_and_score( chunk_size, chunk_overlap, top_k, threshold ) return accuracy study = optuna.create_study(direction="maximize") study.optimize(objective, n_trials=200) # two weeks of compute later...