| 107 | } |
| 108 | |
| 109 | def run_test_case(test_case: Dict, approaches: List[str], client, model: str) -> Dict: |
| 110 | system_prompt = test_case['system_prompt'] |
| 111 | query = test_case['query'] |
| 112 | results = [] |
| 113 | |
| 114 | with ThreadPoolExecutor() as executor: |
| 115 | future_to_approach = {executor.submit(run_approach, approach, system_prompt, query, client, model): approach for approach in approaches} |
| 116 | for future in as_completed(future_to_approach): |
| 117 | results.append(future.result()) |
| 118 | |
| 119 | return { |
| 120 | 'test_case': test_case, |
| 121 | 'results': results |
| 122 | } |
| 123 | |
| 124 | def run_tests(test_cases: List[Dict], approaches: List[str], client, model: str, single_test_name: str = None) -> List[Dict]: |
| 125 | results = [] |