Hello guys, i have a pretty basic code but somethin doesn't work. my goal is to find a person's role. this is in one of 20 documents. if i build the index only from the single document which contains the information, my question is answered correctly. as soon as I have 2 or more documents in the index, my response is something like "There's no information about John Doe in the context".
this is my code:
import modules
from llama_index import VectorStoreIndex, SimpleDirectoryReader import openai openai.api_key = 'XYZ'
build index
documents = SimpleDirectoryReader('data').load_data() index = VectorStoreIndex.from_documents(documents) query_engine = index.as_query_engine()
ask question
question = "Who is John Doe and what's his job at the company?" gpt_response = query_engine.query(question).response.replace(". ",".\n") print(gpt_response)