File size: 1,254 Bytes
2c50826
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from typing import Type

from benchmark.draw_bench import DrawBenchPrompts
from benchmark.genai_bench import GenAIBenchPrompts
from benchmark.geneval import GenEvalPrompts
from benchmark.hps import HPSPrompts
from benchmark.parti import PartiPrompts


def create_benchmark(benchmark_type: str) -> Type[DrawBenchPrompts | GenAIBenchPrompts | GenEvalPrompts | HPSPrompts | PartiPrompts]:
    """
    Factory function to create benchmark instances.
    
    Args:
        benchmark_type (str): The type of benchmark to create. Must be one of:
            - "draw_bench"
            - "genai_bench"
            - "geneval"
            - "hps"
            - "parti"
            
    Returns:
        An instance of the requested benchmark implementation
        
    Raises:
        ValueError: If an invalid benchmark type is provided
    """
    benchmark_map = {
        "draw_bench": DrawBenchPrompts,
        "genai_bench": GenAIBenchPrompts,
        "geneval": GenEvalPrompts,
        "hps": HPSPrompts,
        "parti": PartiPrompts,
    }
    
    if benchmark_type not in benchmark_map:
        raise ValueError(f"Invalid benchmark type: {benchmark_type}. Must be one of {list(benchmark_map.keys())}")
    
    return benchmark_map[benchmark_type]()