kavyatayal commited on
Commit
6af4bf2
·
verified ·
1 Parent(s): 8d8cbda

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -86,7 +86,7 @@ def get_top_chunks(query, chunk_embeddings, text_chunks):
86
  print(similarities)
87
 
88
  # Find the indices of the 3 chunks with highest similarity scores
89
- top_indices = torch.topk(similarities, k=3).indices
90
 
91
  # Print the top indices
92
  print(top_indices)
@@ -115,16 +115,13 @@ def respond(message, history):
115
  {
116
  "role": "system",
117
  "content": (
118
- "You are a helpful recipe assistant. You are only allowed to use the recipes listed below. "
 
119
  "You must NOT invent or guess any new recipes or ingredients. "
120
  "If the user’s question doesn’t match any of the recipes exactly or semantically, politely say: "
121
  "‘Sorry, I couldn’t find a match. Can you rephrase or ask about another dish?’"
122
  )
123
  },
124
- {
125
- "role": "assistant",
126
- "content": f"Available Recipes:\n\n{str_recipes_chunk}\n\n(Use ONLY these to answer)"
127
- },
128
  {
129
  "role": "user",
130
  "content": message
 
86
  print(similarities)
87
 
88
  # Find the indices of the 3 chunks with highest similarity scores
89
+ top_indices = torch.topk(similarities, k=1).indices
90
 
91
  # Print the top indices
92
  print(top_indices)
 
115
  {
116
  "role": "system",
117
  "content": (
118
+ "You are a helpful recipe assistant. You are only allowed to use the recipes listed below.
119
+ f"Available Recipes:\n\n{str_recipes_chunk}\n\n(Use ONLY these to answer)"
120
  "You must NOT invent or guess any new recipes or ingredients. "
121
  "If the user’s question doesn’t match any of the recipes exactly or semantically, politely say: "
122
  "‘Sorry, I couldn’t find a match. Can you rephrase or ask about another dish?’"
123
  )
124
  },
 
 
 
 
125
  {
126
  "role": "user",
127
  "content": message