Skip to content

Commit

Permalink
improve json parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed Sep 17, 2024
1 parent cabc88d commit e1a862c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions vision_agent/agent/agent_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def _strip_markdown_code(inp_str: str) -> str:

def extract_json(json_str: str) -> Dict[str, Any]:
json_str = json_str.replace("\n", " ").strip()
json_str = json_str.replace("'", '"')
json_str = json_str.replace(": True", ": true").replace(": False", ": false")

try:
return json.loads(json_str) # type: ignore
Expand Down

0 comments on commit e1a862c

Please sign in to comment.