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