fix json
Browse files
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 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
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:
|