update
This commit is contained in:
@@ -193,22 +193,6 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10
|
|||||||
1) Requesting the user to place an order, make a purchase, or confirm the order. These are the job of our sales team at the store.
|
1) Requesting the user to place an order, make a purchase, or confirm the order. These are the job of our sales team at the store.
|
||||||
2) Processing sales orders or engaging in any other sales-related activities. These are the job of our sales team at the store.
|
2) Processing sales orders or engaging in any other sales-related activities. These are the job of our sales team at the store.
|
||||||
3) Answering questions or offering additional services beyond those related to your store's wine recommendations such as discounts, quantity, rewards programs, promotions, delivery options, shipping, boxes, gift wrapping, packaging, personalized messages or something similar. These are the job of our sales team at the store.
|
3) Answering questions or offering additional services beyond those related to your store's wine recommendations such as discounts, quantity, rewards programs, promotions, delivery options, shipping, boxes, gift wrapping, packaging, personalized messages or something similar. These are the job of our sales team at the store.
|
||||||
|
|
||||||
<Store policy>
|
|
||||||
- Generally speaking, the store inventory has some wines from France, the United States, Australia, Spain, and Italy, but you won't know exactly until you check your inventory.
|
|
||||||
- If you found wines in the store's database, they are in stock
|
|
||||||
- Approach each customer with open-ended questions to understand their preferences, budget, and occasion. Once you have these information, you can check your inventory.
|
|
||||||
- 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. Other wine characteristics useful for CHECKINVENTORY tools are allowed.
|
|
||||||
- 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.
|
|
||||||
- Spicy foods should not be paired with medium and full-bodied red wines.
|
|
||||||
- We do not sell organic, sustainability and sulfite wine.
|
|
||||||
</Store policy>
|
|
||||||
<Store guidelines>
|
|
||||||
- Encourage the customer to explore different options and try new things.
|
|
||||||
- If you are unable to locate the desired item in the database after multiple attempts, it may not be available in your inventory. In such cases, inform the user that the item is unavailable and suggest an alternative instead.
|
|
||||||
- Your store carries only wine.
|
|
||||||
- Vintage 0 means non-vintage.
|
|
||||||
</Store guidelines>
|
|
||||||
At each round of conversation, you will be given the following information:
|
At each round of conversation, you will be given the following information:
|
||||||
context: additional information about the current situation
|
context: additional information about the current situation
|
||||||
|
|
||||||
@@ -247,6 +231,21 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10
|
|||||||
context =
|
context =
|
||||||
"""
|
"""
|
||||||
<context>
|
<context>
|
||||||
|
<Store_policy>
|
||||||
|
- Generally speaking, the store inventory has some wines from France, the United States, Australia, Spain, and Italy, but you won't know exactly until you check your inventory.
|
||||||
|
- If you found wines in the store's database, they are in stock
|
||||||
|
- Approach each customer with open-ended questions to understand their preferences, budget, and occasion. Once you have these information, you can check your inventory.
|
||||||
|
- 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. Other wine characteristics useful for CHECKINVENTORY tools are allowed.
|
||||||
|
- Once the user has selected their wine, if you haven't already, 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.
|
||||||
|
- Spicy foods should not be paired with medium and full-bodied red wines.
|
||||||
|
- We do not sell organic, sustainability and sulfite wine.
|
||||||
|
</Store_policy>
|
||||||
|
<Store_guidelines>
|
||||||
|
- Encourage the customer to explore different options and try new things.
|
||||||
|
- If you are unable to locate the desired item in the database after multiple attempts, it may not be available in your inventory. In such cases, inform the user that the item is unavailable and suggest an alternative instead.
|
||||||
|
- Your store carries only wine.
|
||||||
|
- Vintage 0 means non-vintage.
|
||||||
|
</Store_guidelines>
|
||||||
<Available tools>
|
<Available tools>
|
||||||
- CHATBOX which you can use to talk with the user. Be specific.
|
- CHATBOX which you can use to talk with the user. Be specific.
|
||||||
- CHECKWINE allows you to check information about wines you want in your inventory's database. The input must be supported search criteria includeing: wine price, winery, name, vintage, region, country, type, grape varietal, tasting notes, occasion, food pairing, intensity, tannin, sweetness, and acidity.
|
- CHECKWINE allows you to check information about wines you want in your inventory's database. The input must be supported search criteria includeing: wine price, winery, name, vintage, region, country, type, grape varietal, tasting notes, occasion, food pairing, intensity, tannin, sweetness, and acidity.
|
||||||
@@ -292,13 +291,13 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10
|
|||||||
|
|
||||||
if length(is_requiredKeys_in_responsedictKey) > length(requiredKeys)
|
if length(is_requiredKeys_in_responsedictKey) > length(requiredKeys)
|
||||||
errornote = "Your previous attempt has more key points than answer's required key points."
|
errornote = "Your previous attempt has more key points than answer's required key points."
|
||||||
println("\nERROR YiemAgent decisionMaker() $errornote --> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
println("\nERROR YiemAgent decisionMaker() $errornote ----not qualify response--> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
continue
|
continue
|
||||||
elseif !all(is_requiredKeys_in_responsedictKey)
|
elseif !all(is_requiredKeys_in_responsedictKey)
|
||||||
zeroind = findall(x -> x == 0, is_requiredKeys_in_responsedictKey)
|
zeroind = findall(x -> x == 0, is_requiredKeys_in_responsedictKey)
|
||||||
missingkeys = [requiredKeys[i] for i in zeroind]
|
missingkeys = [requiredKeys[i] for i in zeroind]
|
||||||
errornote = "$missingkeys are missing from your previous response"
|
errornote = "$missingkeys are missing from your previous response"
|
||||||
println("\nERROR YiemAgent decisionMaker() $errornote --> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
println("\nERROR YiemAgent decisionMaker() $errornote --not qualify response--> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -335,7 +334,7 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10
|
|||||||
|
|
||||||
if responsedict[:action_name] ∉ ["CHATBOX", "CHECKWINE", "PRESENTBOX", "ENDCONVERSATION"]
|
if responsedict[:action_name] ∉ ["CHATBOX", "CHECKWINE", "PRESENTBOX", "ENDCONVERSATION"]
|
||||||
errornote = "Your previous attempt didn't use the given functions"
|
errornote = "Your previous attempt didn't use the given functions"
|
||||||
println("\nERROR YiemAgent decisionMaker() $errornote --> $(responsedict[:action_name])", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
println("\nERROR YiemAgent decisionMaker() $errornote --not qualify response--> $(responsedict[:action_name])", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -402,9 +401,6 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10
|
|||||||
end
|
end
|
||||||
|
|
||||||
delete!(responsedict, :mentioned_winery)
|
delete!(responsedict, :mentioned_winery)
|
||||||
responsedict[:systemmsg] = systemmsg
|
|
||||||
responsedict[:unformatPrompt] = unformatPrompt
|
|
||||||
# responsedict[:QandA] = QandA
|
|
||||||
|
|
||||||
# check whether responsedict[:action_input] is the same as previous dialogue
|
# check whether responsedict[:action_input] is the same as previous dialogue
|
||||||
if responsedict[:action_input] == a.chathistory[end][:text]
|
if responsedict[:action_input] == a.chathistory[end][:text]
|
||||||
@@ -421,17 +417,26 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10
|
|||||||
if evaluationdict[:approved] == "no"
|
if evaluationdict[:approved] == "no"
|
||||||
mentor_comment = evaluationdict[:suggestion]
|
mentor_comment = evaluationdict[:suggestion]
|
||||||
errornote = "Your previous attempt was not good enough. Please try again. Here is the mentor's suggestion: $mentor_comment"
|
errornote = "Your previous attempt was not good enough. Please try again. Here is the mentor's suggestion: $mentor_comment"
|
||||||
println("\nERROR YiemAgent decisionMaker() $errornote --> \n$response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
println("\nERROR YiemAgent decisionMaker() $errornote --not qualify response--> \n$response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
# store for later training
|
# store for later training
|
||||||
responsedict[:system] = systemmsg
|
responsedict[:system] = systemmsg
|
||||||
|
responsedict[:unformatPrompt] = unformatPrompt
|
||||||
responsedict[:recentchat] = recentchat
|
responsedict[:recentchat] = recentchat
|
||||||
responsedict[:prompt] = prompt
|
responsedict[:prompt] = prompt
|
||||||
responsedict[:context] = context
|
responsedict[:context] = context
|
||||||
responsedict[:think] = think
|
responsedict[:think] = think
|
||||||
|
responsedict[:response] = response
|
||||||
# responsedict[:QandA] = QandA
|
# responsedict[:QandA] = QandA
|
||||||
|
|
||||||
|
# check whether there is a file path exists before writing to it
|
||||||
|
if !haskey(a.memory[:shortmem], :decisionlog)
|
||||||
|
a.memory[:shortmem][:decisionlog] = [responsedict]
|
||||||
|
else
|
||||||
|
push!(a.memory[:shortmem][:decisionlog], responsedict)
|
||||||
|
end
|
||||||
|
|
||||||
# # save to filename ./log/decisionlog.txt
|
# # save to filename ./log/decisionlog.txt
|
||||||
# println("\nsaving YiemAgent decisionMaker() to disk ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
# println("\nsaving YiemAgent decisionMaker() to disk ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
@@ -454,6 +459,7 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10
|
|||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
# println("\nYiemAgent decisionMaker() saved to disk is done. agent $(a.id)")
|
# println("\nYiemAgent decisionMaker() saved to disk is done. agent $(a.id)")
|
||||||
|
|
||||||
|
|
||||||
responsedict[:prompt] = prompt
|
responsedict[:prompt] = prompt
|
||||||
return responsedict
|
return responsedict
|
||||||
@@ -825,21 +831,21 @@ function evaluator(a::T1, timeline, decisiondict, evaluateecontext
|
|||||||
"action_name" is the name of the action taken, which can be one of the available tool name.
|
"action_name" is the name of the action taken, which can be one of the available tool name.
|
||||||
"action_input" is the input to the action.
|
"action_input" is the input to the action.
|
||||||
</At each round of conversation, you will be given the following information>
|
</At each round of conversation, you will be given the following information>
|
||||||
<Store policy>
|
<Store_policy>
|
||||||
- Generally speaking, the store 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, the store inventory has some wines from France, the United States, Australia, Spain, and Italy, but you won't know exactly until you check your inventory.
|
||||||
- If you found wines in the store's database, they are in stock
|
- If you found wines in the store's database, they are in stock
|
||||||
- Approach each customer with open-ended questions to understand their preferences, budget, and occasion. Once you have these information, you can check your inventory.
|
- Approach each customer with open-ended questions to understand their preferences, budget, and occasion. Once you have these information, you can check your inventory.
|
||||||
- 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. Other wine characteristics useful for CHECKINVENTORY tools are allowed.
|
- 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. Other wine characteristics useful for CHECKINVENTORY tools are allowed.
|
||||||
- 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, if you haven't already, 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.
|
||||||
- Spicy foods should not be paired with medium and full-bodied red wines.
|
- Spicy foods should not be paired with medium and full-bodied red wines.
|
||||||
- We do not sell organic, sustainability and sulfite wine.
|
- We do not sell organic, sustainability and sulfite wine.
|
||||||
</Store policy>
|
</Store_policy>
|
||||||
<Store guidelines>
|
<Store_guidelines>
|
||||||
- Encourage the customer to explore different options and try new things.
|
- Encourage the customer to explore different options and try new things.
|
||||||
- If you are unable to locate the desired item in the database after multiple attempts, it may not be available in your inventory. In such cases, inform the user that the item is unavailable and suggest an alternative instead.
|
- If you are unable to locate the desired item in the database after multiple attempts, it may not be available in your inventory. In such cases, inform the user that the item is unavailable and suggest an alternative instead.
|
||||||
- Your store carries only wine.
|
- Your store carries only wine.
|
||||||
- Vintage 0 means non-vintage.
|
- Vintage 0 means non-vintage.
|
||||||
</Store guidelines>
|
</Store_guidelines>
|
||||||
<You must follow the following policy>
|
<You must follow the following policy>
|
||||||
- Use only infomation provided by the store policy and guidelines as a bedrocks for your response.
|
- Use only infomation provided by the store policy and guidelines as a bedrocks for your response.
|
||||||
</You must follow the following policy>
|
</You must follow the following policy>
|
||||||
@@ -925,13 +931,13 @@ function evaluator(a::T1, timeline, decisiondict, evaluateecontext
|
|||||||
|
|
||||||
if length(is_requiredKeys_in_responsedictKey) > length(requiredKeys)
|
if length(is_requiredKeys_in_responsedictKey) > length(requiredKeys)
|
||||||
errornote = "Your previous attempt has more key points than answer's required key points."
|
errornote = "Your previous attempt has more key points than answer's required key points."
|
||||||
println("\nERROR YiemAgent generatechat() $errornote --> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
println("\nERROR YiemAgent generatechat() $errornote --not qualify response--> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
continue
|
continue
|
||||||
elseif !all(is_requiredKeys_in_responsedictKey)
|
elseif !all(is_requiredKeys_in_responsedictKey)
|
||||||
zeroind = findall(x -> x == 0, is_requiredKeys_in_responsedictKey)
|
zeroind = findall(x -> x == 0, is_requiredKeys_in_responsedictKey)
|
||||||
missingkeys = [requiredKeys[i] for i in zeroind]
|
missingkeys = [requiredKeys[i] for i in zeroind]
|
||||||
errornote = "$missingkeys are missing from your previous response"
|
errornote = "$missingkeys are missing from your previous response"
|
||||||
println("\nERROR YiemAgent generatechat() $errornote --> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
println("\nERROR YiemAgent generatechat() $errornote --not qualify response--> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1349,13 +1355,13 @@ function presentbox(a::sommelier, thoughtDict; maxtattempt::Integer=10, recentev
|
|||||||
|
|
||||||
if length(is_requiredKeys_in_responsedictKey) > length(requiredKeys)
|
if length(is_requiredKeys_in_responsedictKey) > length(requiredKeys)
|
||||||
errornote = "Your previous attempt has more key points than answer's required key points."
|
errornote = "Your previous attempt has more key points than answer's required key points."
|
||||||
println("\nERROR YiemAgent presentbox() $errornote --> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
println("\nERROR YiemAgent presentbox() $errornote --not qualify response--> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
continue
|
continue
|
||||||
elseif !all(is_requiredKeys_in_responsedictKey)
|
elseif !all(is_requiredKeys_in_responsedictKey)
|
||||||
zeroind = findall(x -> x == 0, is_requiredKeys_in_responsedictKey)
|
zeroind = findall(x -> x == 0, is_requiredKeys_in_responsedictKey)
|
||||||
missingkeys = [requiredKeys[i] for i in zeroind]
|
missingkeys = [requiredKeys[i] for i in zeroind]
|
||||||
errornote = "$missingkeys are missing from your previous response"
|
errornote = "$missingkeys are missing from your previous response"
|
||||||
println("\nERROR YiemAgent presentbox() $errornote --> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
println("\nERROR YiemAgent presentbox() $errornote --not qualify response--> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1530,13 +1536,13 @@ end
|
|||||||
|
|
||||||
# if length(is_requiredKeys_in_responsedictKey) > length(requiredKeys)
|
# if length(is_requiredKeys_in_responsedictKey) > length(requiredKeys)
|
||||||
# errornote = "Your previous attempt has more key points than answer's required key points."
|
# errornote = "Your previous attempt has more key points than answer's required key points."
|
||||||
# println("\nERROR YiemAgent presentbox() $errornote --> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
# println("\nERROR YiemAgent presentbox() $errornote --not qualify response--> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
# continue
|
# continue
|
||||||
# elseif !all(is_requiredKeys_in_responsedictKey)
|
# elseif !all(is_requiredKeys_in_responsedictKey)
|
||||||
# zeroind = findall(x -> x == 0, is_requiredKeys_in_responsedictKey)
|
# zeroind = findall(x -> x == 0, is_requiredKeys_in_responsedictKey)
|
||||||
# missingkeys = [requiredKeys[i] for i in zeroind]
|
# missingkeys = [requiredKeys[i] for i in zeroind]
|
||||||
# errornote = "$missingkeys are missing from your previous response"
|
# errornote = "$missingkeys are missing from your previous response"
|
||||||
# println("\nERROR YiemAgent presentbox() $errornote --> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
# println("\nERROR YiemAgent presentbox() $errornote --not qualify response--> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
# continue
|
# continue
|
||||||
# end
|
# end
|
||||||
|
|
||||||
@@ -1730,13 +1736,13 @@ function generatechat(a::sommelier, thoughtDict; maxattempt::Integer=10)
|
|||||||
|
|
||||||
if length(is_requiredKeys_in_responsedictKey) > length(requiredKeys)
|
if length(is_requiredKeys_in_responsedictKey) > length(requiredKeys)
|
||||||
errornote = "Your previous attempt has more key points than answer's required key points."
|
errornote = "Your previous attempt has more key points than answer's required key points."
|
||||||
println("\nERROR YiemAgent generatechat() $errornote --> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
println("\nERROR YiemAgent generatechat() $errornote --not qualify response--> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
continue
|
continue
|
||||||
elseif !all(is_requiredKeys_in_responsedictKey)
|
elseif !all(is_requiredKeys_in_responsedictKey)
|
||||||
zeroind = findall(x -> x == 0, is_requiredKeys_in_responsedictKey)
|
zeroind = findall(x -> x == 0, is_requiredKeys_in_responsedictKey)
|
||||||
missingkeys = [requiredKeys[i] for i in zeroind]
|
missingkeys = [requiredKeys[i] for i in zeroind]
|
||||||
errornote = "$missingkeys are missing from your previous response"
|
errornote = "$missingkeys are missing from your previous response"
|
||||||
println("\nERROR YiemAgent generatechat() $errornote --> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
println("\nERROR YiemAgent generatechat() $errornote --not qualify response--> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2003,6 +2009,13 @@ function generatechat(a::virtualcustomer;
|
|||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# check if the dialogue is the same as the previous one
|
||||||
|
if responsedict[:dialogue] == a.chathistory[end][:text]
|
||||||
|
errornote = "In your previous attempt you said $(responsedict[:dialogue]) which was the same as the previous one."
|
||||||
|
println("\nYiemAgent generatechat() $errornote:\n$response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# println("\n$prompt", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
# println("\n$prompt", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ function sommelier(
|
|||||||
:state=> Dict{Symbol, Any}(
|
:state=> Dict{Symbol, Any}(
|
||||||
),
|
),
|
||||||
:recap=> OrderedDict{Symbol, Any}(),
|
:recap=> OrderedDict{Symbol, Any}(),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
newAgent = sommelier(
|
newAgent = sommelier(
|
||||||
|
|||||||
Reference in New Issue
Block a user