Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,10 +32,14 @@ def generate_response(prompt):
|
|
| 32 |
instruction = "Please generate a cocktail recipe based on the user's mood description.\n\n"
|
| 33 |
prompt = instruction + prompt
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
try:
|
| 36 |
response = client.chat.completions.create(
|
| 37 |
model="gpt-4-0125-preview",
|
| 38 |
-
messages=
|
| 39 |
max_tokens=150)
|
| 40 |
return response.choices[0].message.content
|
| 41 |
except Exception as e:
|
|
|
|
| 32 |
instruction = "Please generate a cocktail recipe based on the user's mood description.\n\n"
|
| 33 |
prompt = instruction + prompt
|
| 34 |
|
| 35 |
+
messages=[
|
| 36 |
+
{"role": "system", "content": "You are a helpful bartender assistant."},
|
| 37 |
+
{"role": "user", "content": prompt}
|
| 38 |
+
]
|
| 39 |
try:
|
| 40 |
response = client.chat.completions.create(
|
| 41 |
model="gpt-4-0125-preview",
|
| 42 |
+
messages=messages,
|
| 43 |
max_tokens=150)
|
| 44 |
return response.choices[0].message.content
|
| 45 |
except Exception as e:
|