llm_outparser.py 191 B

12345678
  1. import re
  2. def extract_json(text):
  3. pattern = r'\{[^{}]*(?:\{[^{}]*\}[^{}]*)*\}'
  4. match = re.search(pattern, text, re.DOTALL)
  5. if match:
  6. return match.group(0)
  7. return None