(self,output_file='search_result.json')
| 199 | return example |
| 200 | |
| 201 | def search_multi_session(self,output_file='search_result.json'): |
| 202 | os.makedirs(self.output_dir, exist_ok=True) |
| 203 | with open(self.rag_dataset_path, 'r') as f: |
| 204 | dataset = json.load(f) |
| 205 | data = dataset['examples'] |
| 206 | results = [] |
| 207 | if self.workers == 1: |
| 208 | for example in tqdm(data): |
| 209 | results.append(self.search_example(example)) |
| 210 | else: |
| 211 | with ThreadPoolExecutor(max_workers=self.workers) as executor: |
| 212 | future_to_file = {executor.submit(self.search_example, example): example for example in data} |
| 213 | for future in tqdm(as_completed(future_to_file), total=len(data), desc='Processing files'): |
| 214 | results.append(future.result()) |
| 215 | with open(os.path.join(self.output_dir, output_file), 'w') as json_file: |
| 216 | json.dump(results, json_file, indent=2, ensure_ascii=False) |
| 217 | |
| 218 | class HybridSearchEngine: |
| 219 |
nothing calls this directly
no test coverage detected