minyma/minyma/api/v1.py
Evan Reichard ca8c306534
All checks were successful
continuous-integration/drone/push Build is passing
[add] better error handling
2023-11-08 20:52:29 -05:00

36 lines
690 B
Python

import minyma
from flask import Blueprint, request
bp = Blueprint("v1", __name__, url_prefix="/api/v1")
"""
Return OpenAI LLM final response with vector db embedding
context
"""
@bp.route("/query", methods=["POST"])
def get_response():
data = request.get_json()
if not data:
return {"error": "Missing Message"}
message = str(data.get("message"))
if message == "":
return {"error": "Empty Message"}
resp = minyma.oai.query(message)
# Return Data
return resp
"""
TODO - Embeds and loads data into the local ChromaDB.
{
"input": "string",
"normalizer": "string",
}
"""
bp.route("/embed", methods=["POST"])
def post_embeddings():
pass