diff --git a/lightrag/operate.py b/lightrag/operate.py index c2ad079b..745b042c 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -881,15 +881,21 @@ async def _process_extraction_result( if record.startswith("(") or record.startswith("("): record = record[1:] else: - logger.warning( - f"{chunk_key}: Record starting bracket can not be found in extraction result" - ) + if record.startswith("`(") or record.startswith("`("): + record = record[2:] + else: + logger.warning( + f"{chunk_key}: Record starting bracket can not be found in extraction result" + ) if record.endswith(")") or record.endswith(")"): record = record[:-1] else: - logger.warning( - f"{chunk_key}: Record ending bracket can not be found in extraction result" - ) + if record.endswith(")`") or record.endswith(")`"): + record = record[:-2] + else: + logger.warning( + f"{chunk_key}: Record ending bracket can not be found in extraction result" + ) record = record.strip() if record is None: