diff options
Diffstat (limited to 'gn3/api')
-rw-r--r-- | gn3/api/llm.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gn3/api/llm.py b/gn3/api/llm.py new file mode 100644 index 0000000..72d78b6 --- /dev/null +++ b/gn3/api/llm.py @@ -0,0 +1,22 @@ +"""API for data used to generate menus""" + +# pylint: skip-file + +from flask import jsonify, request, Blueprint + +from gn3.llms.process import getGNQA + +GnQNA = Blueprint("GnQNA", __name__) + + +@GnQNA.route("/gnqna", methods=["POST"]) +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 + }) |