aashnaj commited on
Commit
c6774b7
·
verified ·
1 Parent(s): 111f23a
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -16,7 +16,7 @@ def get_top_chunks(query):
16
  similarities = torch.matmul(chunk_embeddings, query_embedding_normalized)
17
  top_indices = torch.topk(similarities, k=5).indices.tolist()
18
  return [cleaned_chunks[i] for i in top_indices]
19
- client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.2")
20
  def respond(message, history, cuisine, dietary_restrictions, allergies):
21
  response = ""
22
  top_chunks = get_top_chunks(message)
@@ -24,7 +24,7 @@ def respond(message, history, cuisine, dietary_restrictions, allergies):
24
  messages = [
25
  {
26
  "role": "system",
27
- "content": f"You are a friendly recipe chatbot named BiteBot that responds to the user with any recipe from this: {context}. Find a recipe that is {cuisine} cuisine. They have the dietary restrictions,{dietary_restrictions} and are allergic to {allergies}. Return the title to the user and ask if this is the recipe they want. If they say yes return the recipe to the user, and if they say no provide another recipe."
28
  }
29
  ]
30
  if history:
 
16
  similarities = torch.matmul(chunk_embeddings, query_embedding_normalized)
17
  top_indices = torch.topk(similarities, k=5).indices.tolist()
18
  return [cleaned_chunks[i] for i in top_indices]
19
+ client = InferenceClient("Qwen/Qwen2.5-72B-Instruct")
20
  def respond(message, history, cuisine, dietary_restrictions, allergies):
21
  response = ""
22
  top_chunks = get_top_chunks(message)
 
24
  messages = [
25
  {
26
  "role": "system",
27
+ "content": f"You are a friendly recipe chatbot named BiteBot that responds to the user with any recipe from this: {context}. Find a recipe that is {cuisine} cuisine. They have the dietary restrictions,{dietary_restrictions} and are allergic to {allergies}. For example, you can say Based on your preference for something sweet and given the recipes you provided, let me suggest a recipe that might be of interest to you. Do you want to try Elizabeth's Sweet Potato Casserole? Return the title to the user and ask if this is the recipe they want. If they say yes return the recipe to the user, and if they say no ask if they want another recipe."
28
  }
29
  ]
30
  if history: