robinroy03's picture
db index changed
3c9b7fa
raw
history blame
584 Bytes
from flask import Flask
from flask import request
from pinecone import Pinecone, ServerlessSpec
import os
PINECONE_DB_API = os.environ.get('PINECONE_DB_API')
pc = Pinecone(api_key=PINECONE_DB_API)
index = pc.Index('fury') # NOTE: FOR NOW
app = Flask(__name__)
@app.route("/query", methods=['POST'])
def query():
"""
{
embeddings: <embeddings_list>
}
"""
embeddings = request.get_json()['embeddings']
matches = index.query(
vector = embeddings,
top_k = 3,
include_metadata = True
)
return matches.to_dict()