update
This commit is contained in:
@@ -123,7 +123,6 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen
|
|||||||
# """
|
# """
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# check vectorDB for similar cached decision. USE combined event T, T-1
|
|
||||||
totalevents = length(a.memory[:events])
|
totalevents = length(a.memory[:events])
|
||||||
ind =
|
ind =
|
||||||
if totalevents > recent
|
if totalevents > recent
|
||||||
@@ -153,7 +152,7 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen
|
|||||||
"""
|
"""
|
||||||
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 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:
|
Your goal includes:
|
||||||
1) Get to know the user preferences about wine
|
1) Establish a connection with the customer by greeting them warmly
|
||||||
2) Help them select the best wines from your inventory that align with their preferences
|
2) Help them select the best wines from your inventory that align with their preferences
|
||||||
|
|
||||||
Your responsibility includes:
|
Your responsibility includes:
|
||||||
@@ -171,14 +170,14 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen
|
|||||||
You must follow the following guidelines:
|
You must follow the following guidelines:
|
||||||
- Generally speaking, your inventory has some wines from France, the United States, Australia, Spain, and Italy, but you won't know exactly until you check your inventory.
|
- Generally speaking, your inventory has some wines from France, the United States, Australia, Spain, and Italy, but you won't know exactly until you check your inventory.
|
||||||
- All wines in your inventory are always in stock.
|
- All wines in your inventory are always in stock.
|
||||||
- If the user interrupts, prioritize the user
|
- Before checking the inventory, engage in conversation to indirectly investigate the customer's intention, budget and preferences, which will significantly improve inventory search results.
|
||||||
- Do not ask the user about wine's flavor e.g. floral, citrusy, nutty or some thing similar as these terms cannot be used to search the database.
|
- Do not ask the user about wine's flavor e.g. floral, citrusy, nutty or some thing similar as these terms cannot be used to search the database.
|
||||||
- The best strategy for searching an inventory is to start broadly and then narrow down.
|
|
||||||
- Once the user has selected their wine, ask the user if they need any further assistance. Do not offer any additional services. If the user doesn't need any further assistance, say goodbye and invite them to come back next time.
|
- Once the user has selected their wine, ask the user if they need any further assistance. Do not offer any additional services. If the user doesn't need any further assistance, say goodbye and invite them to come back next time.
|
||||||
|
- Medium and full-bodied red wines should not be paired with spicy foods.
|
||||||
|
|
||||||
Tips:
|
You should follow the following guidelines:
|
||||||
- Understanding the user's preferences is key in helping them find the best wine.
|
- When searching an inventory, search as broadly as possible based on the information you have gathered so far.
|
||||||
- Identifying at least four preferences before checking inventory significantly improves search results
|
- Encourage the customer to explore different options and try new things.
|
||||||
- Sometimes, the item a user desires might not be available in your inventory. In such cases, inform the user that the item is unavailable and suggest an alternative instead.
|
- Sometimes, the item a user desires might not be available in your inventory. In such cases, inform the user that the item is unavailable and suggest an alternative instead.
|
||||||
|
|
||||||
For your information:
|
For your information:
|
||||||
@@ -193,7 +192,7 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen
|
|||||||
4) Action_name (Must be aligned with your plan): The name of the action. Typically corresponds to the execution of the first step in your plan.
|
4) Action_name (Must be aligned with your plan): The name of the action. Typically corresponds to the execution of the first step in your plan.
|
||||||
Can be one of the following functions:
|
Can be one of the following functions:
|
||||||
- CHATBOX which you can use to talk with the user. The input is your intentions for the dialogue. Be specific.
|
- 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.
|
- CHECKINVENTORY which you can use to check info about wine you want in your inventory. The input is a search term in verbal English.
|
||||||
Good query example: black car, a stereo, 200 mile range, electric motor.
|
Good query example: black car, a stereo, 200 mile range, electric motor.
|
||||||
- ENDCONVERSATION which you can use when you believe the user has concluded their interaction, to properly end the conversation with them. Input is "NA".
|
- ENDCONVERSATION which you can use when you believe the user has concluded their interaction, to properly end the conversation with them. Input is "NA".
|
||||||
5) Action_input: input of the action
|
5) Action_input: input of the action
|
||||||
@@ -221,9 +220,10 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen
|
|||||||
println("\n~~~ Yiem decisionMaker() found wines from DB ", @__FILE__, " ", @__LINE__)
|
println("\n~~~ Yiem decisionMaker() found wines from DB ", @__FILE__, " ", @__LINE__)
|
||||||
return Dict(:action_name=> "PRESENTBOX",
|
return Dict(:action_name=> "PRESENTBOX",
|
||||||
:action_input=> """
|
:action_input=> """
|
||||||
1) Provide detailed introductions of the wines you just found to help the user make an informed choice.
|
1) Provide detailed introductions of the wines you just found to the customer.
|
||||||
2) If there are multiple wines, offer thorough comparison of each option, highlighting their differences.
|
2) Explain how the wine could match the customer's intention and what its effects might mean for the customer's experience.
|
||||||
3) Explain the potential impact each option could bring to the user.
|
3) If multiple wines are available, highlight their differences and provide a comprehensive comparison of how each option aligns with the customer's intention and what the potential effects of each option could mean for the customer's experience.
|
||||||
|
4) Provide your personal recommendation based on your understanding of the customer's preferences.
|
||||||
""")
|
""")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -892,6 +892,7 @@ function generatechat(a::sommelier, thought::T) where {T<:AbstractString}
|
|||||||
You should follow the following guidelines:
|
You should follow the following guidelines:
|
||||||
- Focus on the latest conversation.
|
- Focus on the latest conversation.
|
||||||
- If the user interrupts, prioritize the user
|
- If the user interrupts, prioritize the user
|
||||||
|
- Medium and full-bodied red wines should not be paired with spicy foods.
|
||||||
|
|
||||||
You should then respond to the user with:
|
You should then respond to the user with:
|
||||||
1) Chat: Given the situation, How would you respond to the user to express your thoughts honestly and keep the conversation going smoothly?
|
1) Chat: Given the situation, How would you respond to the user to express your thoughts honestly and keep the conversation going smoothly?
|
||||||
@@ -1133,6 +1134,9 @@ function generatequestion(a, text2textInstructLLM::Function; recent=nothing)::St
|
|||||||
...
|
...
|
||||||
|
|
||||||
Here are some examples:
|
Here are some examples:
|
||||||
|
Q: The user is buying for her husband, should I dig in to get more information?
|
||||||
|
A: Yes, I should. So that I have better idea about the user's preferences.
|
||||||
|
|
||||||
Q: Why the user saying this?
|
Q: Why the user saying this?
|
||||||
A: According to the situation, ...
|
A: According to the situation, ...
|
||||||
|
|
||||||
|
|||||||
@@ -592,16 +592,21 @@ function extractWineAttributes_1(a::T1, input::T2)::String where {T1<:agent, T2<
|
|||||||
|
|
||||||
# check if winery, wine_name, region, country, wine_type, grape_variety are in the query because sometime AI halucinates
|
# check if winery, wine_name, region, country, wine_type, grape_variety are in the query because sometime AI halucinates
|
||||||
for i in [:grape_variety, :winery, :wine_name, :region]
|
for i in [:grape_variety, :winery, :wine_name, :region]
|
||||||
result = check_key_in_input(input, responsedict, attempt, maxattempt, i)
|
content = responsedict[i]
|
||||||
if result === nothing
|
if occursin(",", content)
|
||||||
# nothing wrong
|
content = split(content, ",") # sometime AI generates multiple values e.g. "Chenin Blanc, Riesling"
|
||||||
elseif result == "NA"
|
content = strip.(content)
|
||||||
responsedict[i] = "NA"
|
|
||||||
else
|
else
|
||||||
errornote = result
|
content = [content]
|
||||||
|
end
|
||||||
|
|
||||||
|
for x in content
|
||||||
|
if !occursin("NA", responsedict[i]) && !occursin(x, input)
|
||||||
|
errornote = "$x is not mentioned in the user query, you must only use the info from the query."
|
||||||
error(errornote)
|
error(errornote)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# remove (some text)
|
# remove (some text)
|
||||||
for (k, v) in responsedict
|
for (k, v) in responsedict
|
||||||
@@ -1027,21 +1032,6 @@ function jsoncorrection(config::T1, input::T2, correctJsonExample::T3;
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function check_key_in_input(input::String, responsedict, attempt::Int, maxattempt::Int, key::Symbol)
|
|
||||||
if !occursin("NA", responsedict[key]) && !occursin(responsedict[key], input)
|
|
||||||
if attempt < maxattempt
|
|
||||||
errornote = "$(responsedict[key]) is not mentioned in the user query, you must only use the info from the query."
|
|
||||||
return errornote
|
|
||||||
else
|
|
||||||
return "NA"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return nothing
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# function isrecommend(state::T1, text2textInstructLLM::Function
|
# function isrecommend(state::T1, text2textInstructLLM::Function
|
||||||
# ) where {T1<:AbstractDict}
|
# ) where {T1<:AbstractDict}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user