Find answers from the community

Updated 2 months ago

Hello πŸ™‚ I have a set of questions and

Hello πŸ™‚ I have a set of questions and answers from a chat with human operators, and I am trying to vectorize questions (in order to retreive the closes questions in my DB).
Then, I would like My LLM to synthesize an answer from the associated answers to thoses 3 questions. Does anyone know the simplest way to do this ?
L
1 comment
Index your data into separate documents per question/answer pair, and use a vector index to retrieve the closest matching Q/As

A very rough example

Plain Text
from llama_index import GPTSimpleVectorIndex, Document

documents = []
for qa_text in qa_texts:
  documents.append(Document(qa_text))

index = GPTSimpleVectorIndex.from_documents(documents)
index.save_to_disk("index.json")
...
index = GPTSimpleVectorIndex.load_from_disk(documents)
priont(index.query("my query", similarity_top_k=3))  # optionally add response_mode="compact"
Add a reply
Sign up and join the conversation on Discord