pratikshahp commited on
Commit
81b46ed
·
verified ·
1 Parent(s): a8447d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -44,7 +44,7 @@ def retrieve_relevant_chunks(query, chunks, chunk_embeddings):
44
  query_embedding = get_embeddings(query)
45
  similarities = cosine_similarity([query_embedding], chunk_embeddings)[0]
46
  top_indices = np.argsort(similarities)[::-1][:3] # Get top 3 relevant chunks
47
- return [chunks[i] for i in top_indices]
48
 
49
  # Function to generate a response
50
  def generate_response(context, query):
 
44
  query_embedding = get_embeddings(query)
45
  similarities = cosine_similarity([query_embedding], chunk_embeddings)[0]
46
  top_indices = np.argsort(similarities)[::-1][:3] # Get top 3 relevant chunks
47
+ return [chunks[i] for i in top_indices] #we use the chunks list to retrieve the actual text of those relevant chunks. These text chunks will form the context.
48
 
49
  # Function to generate a response
50
  def generate_response(context, query):