Fix regex to use non-greedy matching for parentheses extraction

This commit is contained in:
yangdx 2025-09-01 10:10:45 +08:00
parent 692357fbf3
commit 7baeb186c6

View file

@ -835,7 +835,7 @@ async def _parse_extraction_result(
[context_base["record_delimiter"], context_base["completion_delimiter"]],
)
for record in records:
record = re.search(r"\((.*)\)", record)
record = re.search(r"\((.*?)\)", record)
if record is None:
continue
record = record.group(1)
@ -1749,7 +1749,7 @@ async def extract_entities(
)
for record in records:
record = re.search(r"\((.*)\)", record)
record = re.search(r"\((.*?)\)", record)
if record is None:
continue
record = record.group(1)