Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -116,6 +116,28 @@ print(top_results)""
|
|
116 |
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
117 |
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
SPOONACULAR_API_KEY = "71259036cfb3405aa5d49c1220a988c5" #our api key
|
120 |
recipe_id_map = {} #creating dictionary to keep track of which recipe title for which recipe id
|
121 |
|
|
|
116 |
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
117 |
|
118 |
|
119 |
+
def response(message, history):
|
120 |
+
bitebot_chunks = get_top_chunks(message, chunk_embeddings, cleaned_chunks)
|
121 |
+
print(bitebot)
|
122 |
+
str_bitebot_chunks = "\n".join(bitebot_chunks)
|
123 |
+
messages = [{"role" : "system", "content" : "You are a helpful chef who provides recipes according the the user's dietary choices and cusine preferences."}]
|
124 |
+
# update response person on provided context; use f-strings
|
125 |
+
|
126 |
+
if history:
|
127 |
+
messages.extend(history)
|
128 |
+
|
129 |
+
messages.append({"role" : "user", "content" : message})
|
130 |
+
|
131 |
+
response = client.chat_completion(
|
132 |
+
messages,
|
133 |
+
max_tokens = 100
|
134 |
+
# temperature == 0.2
|
135 |
+
)
|
136 |
+
return response['choices'][0]['message']['content'].strip()
|
137 |
+
|
138 |
+
|
139 |
+
|
140 |
+
|
141 |
SPOONACULAR_API_KEY = "71259036cfb3405aa5d49c1220a988c5" #our api key
|
142 |
recipe_id_map = {} #creating dictionary to keep track of which recipe title for which recipe id
|
143 |
|