From fb49b824bf7a90ecadf021c01c65880e78e74298 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Fri, 22 Dec 2023 23:50:25 +0300 Subject: Feature/gn llms (#140) * add entry route for gn_llms * add gn_llms reference doc ids * init authorization module for gn-llm * Add class for parsing unprocessable response * add init config file * add clienmodule:gn-llm fahamu interface * Add module descriptor for client file * reponse data handler * add response file handler * add processing file * remove unnecessary files * init code refactoring * Restructure code to module * refactor code:disble pylint for testing on cd--- gn3/api/llm.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 gn3/api/llm.py (limited to 'gn3/api') 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 + }) -- cgit v1.2.3