def METHOD_NAME(self, response, gpt_gen_fn):
    """
    response: string containing canidate json
    gpt_gen_fn: gpt_gen_fn(inputs, sys_prompt)
    """
    try:
        result = self.generate_output(response)
    except Exception as e:
        try:
            logging.info(f'Repairing json：{response}')
            repair_prompt = self.generate_repair_prompt(broken_json = response, error=repr(e))
            result = self.generate_output(gpt_gen_fn(repair_prompt, self.format_instructions))
            logging.info('Repaire json success.')
        except Exception as e:
            # 没辙了，放弃治疗
            logging.info('Repaire json fail.')
            raise JsonStringError('Cannot repair json.', str(e))
    return result