(item)
| 206 | |
| 207 | # Create tasks |
| 208 | async def process_item(item): |
| 209 | try: |
| 210 | if config.requires_context(): |
| 211 | from experiment.prompter.multihop import contexts |
| 212 | optimized_question = await plugin(item[question_key], contexts(item, dataset)) |
| 213 | else: |
| 214 | optimized_question = await plugin(item[question_key]) |
| 215 | |
| 216 | # Create new entry |
| 217 | new_item = item.copy() |
| 218 | new_item["original_question"] = item[question_key] |
| 219 | new_item[question_key] = optimized_question |
| 220 | return new_item |
| 221 | except Exception as e: |
| 222 | print(f"Error processing item: {e}") |
| 223 | return item # Return original item on error |
| 224 | |
| 225 | # Process all items in parallel |
| 226 | tasks = [process_item(item) for item in testset] |
no test coverage detected