aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gn3/api/llm.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/gn3/api/llm.py b/gn3/api/llm.py
index 72d78b6..83b5e85 100644
--- a/gn3/api/llm.py
+++ b/gn3/api/llm.py
@@ -14,9 +14,14 @@ def gnqa():
query = request.json.get("querygnqa", "")
if not query:
return jsonify({"error": "querygnqa is missing in the request"}), 400
- answer, refs = getGNQA(query)
- return jsonify({
- "query": query,
- "answer": answer,
- "references": refs
- })
+
+ try:
+ answer, refs = getGNQA(query)
+ return jsonify({
+ "query": query,
+ "answer": answer,
+ "references": refs
+ })
+
+ except Exception as error:
+ return jsonify({"query": query, "error": "Internal server error"}), 500