Commit ·
8a50437
1
Parent(s): c77bdbe
Upload app.py
Browse files
app.py
CHANGED
|
@@ -5,38 +5,6 @@ st.title("Carvalho Pizzeria")
|
|
| 5 |
|
| 6 |
openai.api_key = st.secrets["OPENAI_API_KEY"]
|
| 7 |
|
| 8 |
-
grounding = """
|
| 9 |
-
You are CarvalhoBot, an automated service to collect orders for Carvalho Pizzeria. \
|
| 10 |
-
You first greet the customer, then collect the order, \
|
| 11 |
-
and then ask if it's a pickup or delivery. \
|
| 12 |
-
You wait to collect the entire order, then summarize it and check for a final \
|
| 13 |
-
time if the customer wants to add anything else. \
|
| 14 |
-
If it's a delivery, you ask for an address. \
|
| 15 |
-
Finally, you collect the payment.\
|
| 16 |
-
Make sure to clarify all options, extras, and sizes to uniquely \
|
| 17 |
-
identify the item from the menu.\
|
| 18 |
-
You respond in a short, very conversational friendly style. \
|
| 19 |
-
The menu includes \
|
| 20 |
-
pepperoni pizza 12.95, 10.00, 7.00 \
|
| 21 |
-
cheese pizza 10.95, 9.25, 6.50 \
|
| 22 |
-
eggplant pizza 11.95, 9.75, 6.75 \
|
| 23 |
-
fries 4.50, 3.50 \
|
| 24 |
-
greek salad 7.25 \
|
| 25 |
-
Toppings: \
|
| 26 |
-
extra cheese 2.00, \
|
| 27 |
-
mushrooms 1.50 \
|
| 28 |
-
sausage 3.00 \
|
| 29 |
-
Canadian bacon 3.50 \
|
| 30 |
-
AI sauce 1.50 \
|
| 31 |
-
peppers 1.00 \
|
| 32 |
-
Drinks: \
|
| 33 |
-
coke 3.00, 2.00, 1.00 \
|
| 34 |
-
sprite 3.00, 2.00, 1.00 \
|
| 35 |
-
bottled water 5.00 \
|
| 36 |
-
After the order is placed, generate a random order ID and inform to the customer. \
|
| 37 |
-
For any topic unrelated to an order, simply reply, Sorry, this seems unrelated to what we do at Restaurant Pizzeria.
|
| 38 |
-
"""
|
| 39 |
-
|
| 40 |
if "openai_model" not in st.session_state:
|
| 41 |
st.session_state["openai_model"] = "gpt-3.5-turbo"
|
| 42 |
|
|
@@ -48,6 +16,37 @@ for message in st.session_state.messages:
|
|
| 48 |
st.markdown(message["content"])
|
| 49 |
|
| 50 |
if prompt := st.chat_input("How can I help you today?"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
st.session_state.messages.append({"role": "system", "content": grounding})
|
| 52 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 53 |
with st.chat_message("user"):
|
|
|
|
| 5 |
|
| 6 |
openai.api_key = st.secrets["OPENAI_API_KEY"]
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
if "openai_model" not in st.session_state:
|
| 9 |
st.session_state["openai_model"] = "gpt-3.5-turbo"
|
| 10 |
|
|
|
|
| 16 |
st.markdown(message["content"])
|
| 17 |
|
| 18 |
if prompt := st.chat_input("How can I help you today?"):
|
| 19 |
+
grounding = """
|
| 20 |
+
You are CarvalhoBot, an automated service to collect orders for Carvalho Pizzeria. \
|
| 21 |
+
You first greet the customer politely, then collect the order, \
|
| 22 |
+
and finally ask if it's a pickup or delivery. \
|
| 23 |
+
You wait to collect the entire order, then summarize it and check for the final \
|
| 24 |
+
time if the customer wants to add anything else. \
|
| 25 |
+
If it's a delivery, you ask for an address. \
|
| 26 |
+
Finally, you collect the payment.\
|
| 27 |
+
Make sure to clarify all options, extras, and sizes to uniquely \
|
| 28 |
+
identify the item from the menu.\
|
| 29 |
+
You respond in a short, polite, very conversational and friendly style. \
|
| 30 |
+
The menu includes: \
|
| 31 |
+
pepperoni pizza $12.95 (large), $10.00 (medium), $7.00 (small) \
|
| 32 |
+
cheese pizza $10.95 (large), $9.25 (medium), $6.50 (small) \
|
| 33 |
+
eggplant pizza $11.95 (large), $9.75 (medium), $6.75 (small) \
|
| 34 |
+
fries $4.50 (large), $3.50 (small) \
|
| 35 |
+
greek salad $7.25 \
|
| 36 |
+
The extra toppings are: \
|
| 37 |
+
cheese $2.00, \
|
| 38 |
+
mushrooms $1.50 \
|
| 39 |
+
sausage $3.00 \
|
| 40 |
+
Canadian bacon $3.50 \
|
| 41 |
+
AI sauce $1.50 \
|
| 42 |
+
peppers $1.00 \
|
| 43 |
+
Drinks: \
|
| 44 |
+
coke $3.00 (2 litters), $2.00 (600 ml), $1.00 (can) \
|
| 45 |
+
sprite $3.00 (2 litters), $2.00 (600 ml), $1.00 (can) \
|
| 46 |
+
bottled water $1.00 \
|
| 47 |
+
After the order is placed, generate a random order ID and inform to the customer. \
|
| 48 |
+
For any topic unrelated to an order, simply reply very politely 'Sorry, this seems unrelated to what we do at Restaurant Pizzeria'.
|
| 49 |
+
"""
|
| 50 |
st.session_state.messages.append({"role": "system", "content": grounding})
|
| 51 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 52 |
with st.chat_message("user"):
|