Spaces:
Sleeping
Sleeping
Meet Patel
commited on
Commit
·
445cb35
1
Parent(s):
1f73b58
Refactor JSON response handling in interaction_tools.py by replacing direct JSON loading with a utility function for extracting JSON from text. This change enhances error management and maintains consistency in data handling across the application.
Browse files
mcp_server/tools/interaction_tools.py
CHANGED
@@ -57,7 +57,7 @@ async def check_submission_originality(submission: str, reference_sources: list)
|
|
57 |
)
|
58 |
llm_response = await MODEL.generate_text(prompt)
|
59 |
try:
|
60 |
-
data =
|
61 |
except Exception:
|
62 |
data = {"llm_raw": llm_response, "error": "Failed to parse LLM output as JSON"}
|
63 |
return data
|
|
|
57 |
)
|
58 |
llm_response = await MODEL.generate_text(prompt)
|
59 |
try:
|
60 |
+
data = extract_json_from_text(llm_response)
|
61 |
except Exception:
|
62 |
data = {"llm_raw": llm_response, "error": "Failed to parse LLM output as JSON"}
|
63 |
return data
|