Maybe some newb questions, but I'm having issues with the accuracy of my responses when querying my generated index, have narrowed it down to what looks like query is only checking the first node of the index.
In my case the first node mentions there are 22 players in a team and the name of the first player, and subsequent nodes contain information related to each player, but the query response is only aware of context from the first node, it can't name all the players (that are in subsequent nodes)
Anything I'm doing incorrectly?
# Define prompt_helper and settings
max_input_size = 4096
num_outputs = 1
max_chunk_overlap = 20
embedding_limit = 10000
chunk_size_limit = 120
prompt_helper = PromptHelper(
max_input_size, num_outputs, max_chunk_overlap, embedding_limit, chunk_size_limit)
# Load data to train the model
directory_path = './data'
documents = SimpleDirectoryReader(directory_path).load_data()
# Create the index from the data
index = GPTSimpleVectorIndex(
documents, llm_predictor=llm_predictor, prompt_helper=prompt_helper)
index.save_to_disk('index.json')
# Predict function to take user query and generate the response from the index
def predict():
query = request.json['query']
index = GPTSimpleVectorIndex.load_from_disk('index.json')
response = index.query(
'For the Bishops Stortford team ' + query + '. Explain how you arrived at that response', mode="default", response_mode="default")
return jsonify({'response': response.response})