Jaume commited on
Commit
93a4a65
·
1 Parent(s): 09a54e6
Files changed (1) hide show
  1. review.py +7 -4
review.py CHANGED
@@ -56,10 +56,13 @@ def get_file(relative_path: str) -> str:
56
 
57
 
58
  def fix_json(json_str: str) -> str:
59
- template = get_file("templates/prompt_json_fix.txt")
60
- prompt = template.format(json=json_str)
61
- response = gemini_1_0.generate_content(prompt).text
62
- return response.split("```json")[1].split("```")[0]
 
 
 
63
 
64
 
65
  def get_json_content(response: str) -> dict:
 
56
 
57
 
58
  def fix_json(json_str: str) -> str:
59
+ try:
60
+ template = get_file("templates/prompt_json_fix.txt")
61
+ prompt = template.format(json=json_str)
62
+ response = gemini_1_5.generate_content(prompt).text
63
+ return response.split("```json")[1].split("```")[0]
64
+ except:
65
+ return []
66
 
67
 
68
  def get_json_content(response: str) -> dict: