update
This commit is contained in:
@@ -125,7 +125,7 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen
|
||||
|
||||
systemmsg =
|
||||
"""
|
||||
Your name is $(a.name). You are a helpful assistant acting as a polite, website-based sommelier for $(a.retailername)'s online store.
|
||||
Your name is $(a.name). You are a helpful English-speaking assistant, acting as a polite, website-based sommelier for $(a.retailername)'s online store.
|
||||
Your goal includes:
|
||||
1) Get to know the user preferences about wine
|
||||
2) Help them select the best wines from your inventory that align with their preferences
|
||||
@@ -167,7 +167,7 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen
|
||||
- CHATBOX which you can use to talk with the user. The input is your intentions for the dialogue. Be specific.
|
||||
- CHECKINVENTORY which you can use to check info about wine in your inventory. The input is a search term in verbal English.
|
||||
Good query example: black car, a stereo, 200 mile range, electric motor.
|
||||
- PRESENTBOX which you can use to introduce / suggest / recommend a wine label from the inventory to the user when it hasn't been introduced before. Not for general conversation nor follow up conversation.
|
||||
- PRESENTBOX which you can use to introduce wine brand (e.g. Domaine du Collier) from your inventory to the user when it hasn't been introduced before.
|
||||
The input is instructions on how you want the presentation to be conducted.
|
||||
Here are some input examples,
|
||||
"First, provide detailed introductions of Zena Crown, Schrader Cabernet Sauvignon.
|
||||
@@ -266,18 +266,51 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen
|
||||
|
||||
# check whether an agent recommend wines before checking inventory or
|
||||
# recommend wines outside its inventory
|
||||
mentioned_brand = strip.(split(responsedict[:mentioned_brand], ","))
|
||||
for i in mentioned_brand
|
||||
if i != "None" && i != "" && (!occursin(i, timeline) || !occursin(i, shortmem)) &&
|
||||
responsedict[:action_name] != "CHECKINVENTORY" # OK if the agent is checking inventory
|
||||
|
||||
mentioned_brand = responsedict[:mentioned_brand]
|
||||
if mentioned_brand != "None"
|
||||
mentioned_brand = strip.(split(responsedict[:mentioned_brand], ","))
|
||||
|
||||
isWineInTimeline = false
|
||||
for i in mentioned_brand
|
||||
isWineInTimeline = occursin(i, timeline)
|
||||
if !isWineInTimeline
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
isWineInShortmem = false
|
||||
for i in mentioned_brand
|
||||
isWineInShortmem = occursin(i, shortmem)
|
||||
if !isWineInShortmem
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if responsedict[:action_name] != "CHATBOX" && !isWineInShortmem
|
||||
errornote = "Note: Before recommending a wine, ensure it's in your inventory. Check your stock first."
|
||||
error("Before recommending a wine, ensure it's in your inventory. Check your stock first.")
|
||||
elseif responsedict[:action_name] != "CHATBOX" && !isWineInTimeline && isWineInShortmem
|
||||
errornote = "Note: You should introduce the wines to the user before taling about them."
|
||||
error("You should introduce the wines to the user before taling about them.")
|
||||
end
|
||||
|
||||
if responsedict[:action_name] == "PRESENTBOX" && !isWineInShortmem
|
||||
errornote = "Note: Before recommending a wine, ensure it's in your inventory. Check your stock first."
|
||||
error("Before recommending a wine, ensure it's in your inventory. Check your stock first.")
|
||||
elseif responsedict[:action_name] == "PRESENTBOX" && !isWineInTimeline
|
||||
errornote = "Note: You already presented these wines."
|
||||
error("You already presented these wines.")
|
||||
end
|
||||
else
|
||||
if responsedict[:action_name] == "PRESENTBOX"
|
||||
errornote = "Note: You don't have wines to present."
|
||||
error("You don't have wines to present.")
|
||||
end
|
||||
end
|
||||
if responsedict[:action_name] == "PRESENTBOX" && mentioned_brand == "None"
|
||||
errornote = "Note: Before recommending a wine, ensure it's in your inventory. Check your stock first."
|
||||
error("Before recommending a wine, ensure it's in your inventory. Check your stock first.")
|
||||
|
||||
if occursin("--|", response)
|
||||
errornote = "Note: tables are not allowed. Do not include them your response."
|
||||
error("your response contain tables which is not allowed.")
|
||||
end
|
||||
|
||||
delete!(responsedict, :mentioned_brand)
|
||||
@@ -499,7 +532,7 @@ function reflector(config::T1, state::T2)::String where {T1<:AbstractDict,T2<:Ab
|
||||
"observation_4": "I found the following wines in our stock: \n{\n 1: El Enemigo Cabernet Franc 2019\n2: Tantara Chardonnay 2017\n\n}\n",
|
||||
|
||||
"thought_5": "Now that I have a list of potential wines, I need to know more about the customer's taste preferences.",
|
||||
"action_5": {"name": "CHATBOX", "input": "What type of wine characteristics are you looking for? (e.g. t.e.g. tannin level, sweetness, intensity, acidity)"},
|
||||
"action_5": {"name": "CHATBOX", "input": "What type of wine characteristics are you looking for? (e.g. tannin level, sweetness, intensity, acidity)"},
|
||||
"observation_5": "I like full-bodied red wine with low tannin.",
|
||||
|
||||
"thought_6": "Now that I have more information about the customer's preferences, it's time to make a recommendation.",
|
||||
@@ -811,7 +844,7 @@ julia>
|
||||
function generatechat(a::sommelier)
|
||||
systemmsg =
|
||||
"""
|
||||
Your name is $(a.name). You are a helpful assistant acting as a polite, website-based sommelier for an online wine store.
|
||||
Your name is $(a.name). You are a helpful English-speaking assistant, acting as a polite, website-based sommelier for an online wine store.
|
||||
You are currently talking with the user.
|
||||
Your goal includes:
|
||||
1) Help the user select the best wines from your inventory that align with the user's preferences.
|
||||
@@ -918,7 +951,7 @@ function generatechat(a::sommelier)
|
||||
# recommend wines outside its inventory
|
||||
mentioned_brand = strip.(split(responsedict[:mentioned_brand], ","))
|
||||
for i in mentioned_brand
|
||||
if i != "None" && i != "" && (!occursin(i, timeline) || !occursin(i, shortmem)) &&
|
||||
if i != "None" && i != "" && (!occursin(i, timeline) || !occursin(i, context)) &&
|
||||
responsedict[:action_name] != "CHECKINVENTORY" # OK if the agent is checking inventory
|
||||
|
||||
errornote = "Note: Before recommending a wine, ensure it's in your inventory. Check your stock first."
|
||||
@@ -1017,7 +1050,7 @@ function generatequestion(a, text2textInstructLLM::Function; recent=nothing)::St
|
||||
|
||||
systemmsg =
|
||||
"""
|
||||
Your name is $(a.name). You are a helpful assistant acting as a polite, website-based sommelier for $(a.retailername)'s online store.
|
||||
Your name is $(a.name). You are a helpful English-speaking assistant, acting as a polite, website-based sommelier for $(a.retailername)'s online store.
|
||||
Your goal includes:
|
||||
1) Help the user select the best wines from your inventory that align with the user's preferences
|
||||
2) Thanks the user when they don't need any further assistance and invite them to comeback next time
|
||||
@@ -1091,8 +1124,8 @@ function generatequestion(a, text2textInstructLLM::Function; recent=nothing)::St
|
||||
Q: Do I have them in stock?
|
||||
A: According to the situation, ...
|
||||
|
||||
Q: Did I introduce the coffee blend varieties to the user yet?
|
||||
A: According to the situation, No, because I haven't checked the inventory yet.
|
||||
Q: Did I introduce them to the user already?
|
||||
A: According to the situation, No.
|
||||
|
||||
Q: Am I certain about the information I'm going to share with the user, or should I verify the information first?
|
||||
A: According to the situation, ...
|
||||
|
||||
Reference in New Issue
Block a user