Source code for autorag.data.qa.generation_gt.base
fromtypingimportDict
[docs]defadd_gen_gt(row:Dict,new_gen_gt:str)->Dict:if"generation_gt"inlist(row.keys()):ifisinstance(row["generation_gt"],list):row["generation_gt"].append(new_gen_gt)elifisinstance(row["generation_gt"],str):row["generation_gt"]=[row["generation_gt"],new_gen_gt]else:raiseValueError("generation_gt should be either a string or a list of strings.")returnrowrow["generation_gt"]=[new_gen_gt]returnrow