redjkh commited on
Commit
1932e1e
·
verified ·
1 Parent(s): 9338752

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -19,9 +19,22 @@ recipes = [
19
 
20
  client = InferenceClient("microsoft/phi-4")
21
 
22
- def respond(message, history):
23
  # Start with a system prompt
24
- messages = [{"role": "system", "content": "You are a friendly recipe assistant."}]
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  # Convert Gradio history (list of [user, assistant] pairs) to OpenAI-style message format
27
  for user_msg, bot_msg in history:
 
19
 
20
  client = InferenceClient("microsoft/phi-4")
21
 
22
+ def respond(message, history, budget, have_items, allergies):
23
  # Start with a system prompt
24
+ instruction = "You are a friendly chatbot that is designed to help users find recipes they can cook with ingredients they already have at home. "
25
+ instruction += "The current user has " + have_items + "at home. "
26
+ instruction += "The current user is allergic to: " + allergies + ". These ingredients must under no circumstance feature in the recipes you provide. "
27
+ instruction += "For purchasing any additional items, the current user has a budget of: " + budget + "£. "
28
+ instruction += "After the user says what they want to have, you must respond with a recipe you find online, please lay out your response in the following way: "
29
+ instruction += """
30
+ NAME OF THE RECIPE AS A TITLE WITH A BORDER USING = SIGNS
31
+ the ingredients required for the recipe listed (in brackets the cost of any ingredients the user doesn't already have)
32
+ a short (max 350 words) summary of the method for making the meal detailing any special appliances required
33
+ a link to the source from which you found the recipe
34
+ a message asking the user if they want to make this recipe, want more info on where to buy ingredients, or if they want something else.
35
+ (depending on the user's response you must respond to their request, if it is for another recipe, follow the exact same format)
36
+ """
37
+ messages = [{"role": "system", "content": instruction}]
38
 
39
  # Convert Gradio history (list of [user, assistant] pairs) to OpenAI-style message format
40
  for user_msg, bot_msg in history: