File size: 1,302 Bytes
3cb2e43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""Benchmark Advanced mode with different max_rounds settings."""

import asyncio
import time

from src.orchestrators.advanced import AdvancedOrchestrator


async def benchmark(max_rounds: int) -> float:
    """Run benchmark with specified rounds, return elapsed time."""
    # Pass max_rounds explicitly instead of mutating os.environ
    orch = AdvancedOrchestrator(max_rounds=max_rounds)
    start = time.time()

    print(f"\nStarting benchmark with max_rounds={max_rounds}...")

    try:
        async for event in orch.run("sildenafil erectile dysfunction mechanism"):
            if event.type == "progress":
                print(f"  Progress: {event.message}")
            elif event.type == "complete":
                print("  Complete!")
                break
            elif event.type == "error":
                print(f"  Error: {event.message}")
                break
    except Exception as e:
        print(f"  Exception: {e}")

    return time.time() - start


async def main() -> None:
    """Run benchmarks for different configurations."""
    # Only run a quick test for 3 rounds to verify it works
    rounds = 3
    elapsed = await benchmark(rounds)
    print(f"max_rounds={rounds}: {elapsed:.1f}s ({elapsed / 60:.1f}min)")


if __name__ == "__main__":
    asyncio.run(main())