Skip to content

Commit

Permalink
Fix issue 1173 - Nested json parsing (#1218)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlonsoGuevara authored Sep 25, 2024
1 parent 14750f4 commit 0952014
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .semversioner/next-release/patch-20240925225104981872.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "patch",
"description": "Fix nested json parsing"
}
2 changes: 1 addition & 1 deletion graphrag/llm/openai/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def try_parse_json_object(input: str) -> tuple[str, dict]:
return input, result

_pattern = r"\{(.*)\}"
_match = re.search(_pattern, input)
_match = re.search(_pattern, input, re.DOTALL)
input = "{" + _match.group(1) + "}" if _match else input

# Clean up json string.
Expand Down

0 comments on commit 0952014

Please sign in to comment.