Update app/llm_chain.py
Browse files- app/llm_chain.py +7 -7
app/llm_chain.py
CHANGED
|
@@ -30,15 +30,15 @@ def _parse_judge_output(raw: str) -> tuple[str, str]:
|
|
| 30 |
error_analysis = ""
|
| 31 |
corrected_code = ""
|
| 32 |
|
| 33 |
-
if "##
|
| 34 |
-
parts = raw.split("##
|
| 35 |
corrected_code = parts[1].strip()
|
| 36 |
-
if "##
|
| 37 |
-
error_analysis = parts[0].split("##
|
| 38 |
else:
|
| 39 |
error_analysis = parts[0].strip()
|
| 40 |
-
elif "##
|
| 41 |
-
error_analysis = raw.split("##
|
| 42 |
corrected_code = raw # fallback: treat whole thing as corrected code
|
| 43 |
|
| 44 |
# Strip leading/trailing whitespace from each
|
|
@@ -146,7 +146,7 @@ async def _run_judge(question: str, panel_results: list[dict]) -> dict:
|
|
| 146 |
}
|
| 147 |
|
| 148 |
|
| 149 |
-
|
| 150 |
|
| 151 |
async def debug_query(question: str, temperature: float = 0.3) -> dict[str, Any]:
|
| 152 |
"""
|
|
|
|
| 30 |
error_analysis = ""
|
| 31 |
corrected_code = ""
|
| 32 |
|
| 33 |
+
if "## Corrected Code" in raw:
|
| 34 |
+
parts = raw.split("##Corrected Code", 1)
|
| 35 |
corrected_code = parts[1].strip()
|
| 36 |
+
if "## Error Analysis" in parts[0]:
|
| 37 |
+
error_analysis = parts[0].split("## Error Analysis", 1)[1].strip()
|
| 38 |
else:
|
| 39 |
error_analysis = parts[0].strip()
|
| 40 |
+
elif "## Error Analysis" in raw:
|
| 41 |
+
error_analysis = raw.split("## Error Analysis", 1)[1].strip()
|
| 42 |
corrected_code = raw # fallback: treat whole thing as corrected code
|
| 43 |
|
| 44 |
# Strip leading/trailing whitespace from each
|
|
|
|
| 146 |
}
|
| 147 |
|
| 148 |
|
| 149 |
+
|
| 150 |
|
| 151 |
async def debug_query(question: str, temperature: float = 0.3) -> dict[str, Any]:
|
| 152 |
"""
|