Does anyone know why response is none?
import os
from flask import Flask, request
from langchain.chat_models import ChatOpenAI
from llama_index import GPTKeywordTableIndex, LLMPredictor, ServiceContext, SimpleDirectoryReader
os.environ["OPENAI_API_KEY"] = "MY KEY HERE"
app = Flask(__name__)
documents = SimpleDirectoryReader("C:\\temp\\Test").load_data()
llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0, model_name='gpt-3.5-turbo'))
service_context = ServiceContext.from_defaults(llm_predictor=llm_predictor)
index = GPTKeywordTableIndex.from_documents(documents, service_context=service_context)
@app.route("/query", methods=["GET"])
def query():
query_text = request.args.get("text", None)
response = index.query(query_text)
return str(response), 200