irmakakin commited on
Commit
5233d81
·
verified ·
1 Parent(s): e7280ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -14,7 +14,7 @@ def respond(message, history):
14
  top_results = get_top_chunks( message , chunk_embeddings, cleaned_chunks) # Complete this line
15
  # Print the top results
16
  print(top_results)
17
- messages = [{"role": "system", "content": "You are a chatbot that encourage people to live more sustainably. Base your response on the following action {top_results}"}]
18
 
19
  if history:
20
  messages.extend(history)
@@ -71,7 +71,7 @@ def create_embeddings(text_chunks):
71
 
72
  # Return the chunk_embeddings
73
  return chunk_embeddings
74
- create_embeddings(cleaned_chunks)
75
  # Define a function to find the most relevant text chunks for a given query, chunk_embeddings, and text_chunks
76
  def get_top_chunks(query, chunk_embeddings, text_chunks):
77
  # Convert the query text into a vector embedding
@@ -100,7 +100,7 @@ def get_top_chunks(query, chunk_embeddings, text_chunks):
100
 
101
  # Loop through the top indices and retrieve the corresponding text chunks
102
  for indices in top_indices:
103
- relevant_info = cleaned_chunks
104
  top_chunks.append(relevant_info)
105
 
106
 
 
14
  top_results = get_top_chunks( message , chunk_embeddings, cleaned_chunks) # Complete this line
15
  # Print the top results
16
  print(top_results)
17
+ messages = [{"role": "system", "content": "You are a chatbot that encourage people to live more sustainably. Base your response on the following action", {top_results}}]
18
 
19
  if history:
20
  messages.extend(history)
 
71
 
72
  # Return the chunk_embeddings
73
  return chunk_embeddings
74
+ chunk_embeddings = create_embeddings(cleaned_chunks)
75
  # Define a function to find the most relevant text chunks for a given query, chunk_embeddings, and text_chunks
76
  def get_top_chunks(query, chunk_embeddings, text_chunks):
77
  # Convert the query text into a vector embedding
 
100
 
101
  # Loop through the top indices and retrieve the corresponding text chunks
102
  for indices in top_indices:
103
+ relevant_info = cleaned_chunks[indices]
104
  top_chunks.append(relevant_info)
105
 
106