This commit is contained in:
narawat lamaiin
2024-08-11 01:59:28 +07:00
parent a5f43a0403
commit 38a2f673e9
3 changed files with 43 additions and 23 deletions

View File

@@ -216,7 +216,7 @@ function decisionMaker(a::T)::Dict{Symbol, Any} where {T<:agent}
You are a helpful assistant acting as a polite, website-based sommelier for an online wine store.
You are currently talking with the user.
Your goal is to recommend the best wines from your inventory that match the user's preferences.
You are not responsible for sales.
You don't need to do any sale process.
At each round of conversation, you will be given the current situation:
Your conversation with the user: ...
@@ -1061,7 +1061,7 @@ function think(a::T)::NamedTuple{(:actionname, :result), Tuple{String, String}}
x = "Present the following wines to the user: $actioninput"
(result=x, errormsg=nothing, success=true)
elseif actionname == "ENDCONVERSATION"
x = "Thanks the user and end the conversation."
x = "Thank the user and conclude the conversation by saying goodbye and inviting them to return next time."
(result=x, errormsg=nothing, success=true)
else
error("undefined LLM function. Requesting $actionname")
@@ -1079,7 +1079,8 @@ function think(a::T)::NamedTuple{(:actionname, :result), Tuple{String, String}}
if actionname == "CHATBOX"
a.memory[:CHATBOX] = result
elseif actionname == "CHECKINVENTORY"
x = "You have searched the inventory, this is what you found: $result"
# x = "You have searched the inventory, this is what you found: $result"
x = result
push!(a.memory[:shortmem], Dict(Symbol(actionname)=> x))
elseif actionname == "PRESENTBOX" # tell the generatechat()
a.memory[:CHATBOX] = result
@@ -1245,7 +1246,7 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F
You are a helpful assistant acting as a polite, website-based sommelier for an online wine store.
You are currently talking with the user.
Your goal is to recommend the best wines from your inventory that match the user's preferences.
You are not responsible for sales.
You don't need to do any sale process.
At each round of conversation, you will be given the current situation:
Your conversation with the user: ...
@@ -1321,6 +1322,11 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F
end
end
# check if Context: is in chat
if occursin("Context:", responsedict[:chat])
error("Context: is in text. This is not allowed")
end
println("")
println("--> generatechat() ", @__FILE__, " ", @__LINE__)
pprintln(responsedict)
@@ -1359,7 +1365,7 @@ function generatequestion(a, text2textInstructLLM::Function)::String
"""
You are a helpful assistant acting as a polite, website-based sommelier for an online wine store.
Your task is to self questioning about the current situation.
You are not responsible for sales.
You don't need to do any sale process.
At each round of conversation, you will be given the current situation:
Your conversation with the user: ...