update
This commit is contained in:
@@ -952,7 +952,7 @@ function think(a::T)::NamedTuple{(:actionname, :result), Tuple{String, String}}
|
||||
elseif actionname == "PRESENTBOX"
|
||||
x = """
|
||||
1) Provide detailed introductions of $actioninput to help the user make an informed choice.
|
||||
2) Offer a thorough comparison of each option, highlighting their differences.
|
||||
2) If there are multiple wines, offer a thorough comparison of each option, highlighting their differences.
|
||||
3) Explain the potential impact each option could bring to the user.
|
||||
"""
|
||||
# x = """
|
||||
@@ -1086,14 +1086,14 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F
|
||||
responsedict = GeneralUtils.textToDict(response,["Mentioning_wine", "Chat"],
|
||||
rightmarker=":", symbolkey=true, lowercasekey=true)
|
||||
|
||||
for i ∈ [:Chat]
|
||||
for i ∈ [:chat]
|
||||
if length(JSON3.write(responsedict[i])) == 0
|
||||
error("$i is empty ", @__LINE__)
|
||||
end
|
||||
end
|
||||
|
||||
# check if there are more than 1 key per categories
|
||||
for i ∈ [:Chat]
|
||||
for i ∈ [:chat]
|
||||
matchkeys = GeneralUtils.findMatchingDictKey(responsedict, i)
|
||||
if length(matchkeys) > 1
|
||||
error("generatechat has more than one key per categories")
|
||||
@@ -1101,7 +1101,7 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F
|
||||
end
|
||||
|
||||
# check if Context: is in chat
|
||||
if occursin("Context:", responsedict[:Chat])
|
||||
if occursin("Context:", responsedict[:chat])
|
||||
error("Context: is in text. This is not allowed")
|
||||
end
|
||||
|
||||
@@ -1114,8 +1114,8 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F
|
||||
if occursin("Yes", responsedict[:mentioning_wine]) && isMemEmpty
|
||||
errornote = "Note: You can't recommend wines yet. You must check your inventory before recommending wine to the user."
|
||||
error( "You must check your inventory before recommending wine")
|
||||
elseif occursin("(check", chatresponse) || occursin("*check", chatresponse) ||
|
||||
occursin("inventory)", chatresponse) || occursin("inventory*", chatresponse)
|
||||
elseif occursin("(check", responsedict[:chat]) || occursin("*check", responsedict[:chat]) ||
|
||||
occursin("inventory)", responsedict[:chat]) || occursin("inventory*", responsedict[:chat])
|
||||
|
||||
errornote = "Note: You can't recommend wines yet. You must check your inventory before recommending wine to the user."
|
||||
error( "You must check your inventory before recommending wine")
|
||||
@@ -1125,7 +1125,7 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F
|
||||
|
||||
memory[:CHATBOX] = "" # delete content because it no longer used.
|
||||
delete!(responsedict, :mentioning_wine)
|
||||
result = responsedict[:Chat]
|
||||
result = responsedict[:chat]
|
||||
|
||||
return result
|
||||
catch e
|
||||
@@ -1298,14 +1298,14 @@ function generatequestion(a, text2textInstructLLM::Function; recent=nothing)::St
|
||||
try
|
||||
response = text2textInstructLLM(prompt)
|
||||
q_number = count("Q", response)
|
||||
if q_number < 5
|
||||
if q_number < 3
|
||||
error("too few questions only $q_number questions are generated ", @__FILE__, " ", @__LINE__)
|
||||
end
|
||||
# response = string(split(response, "Please")[1]) # LLM usually add comments which is no need.
|
||||
responsedict = GeneralUtils.textToDict(response,
|
||||
["Understanding", "Q1", "Note"],
|
||||
rightmarker=":", symbolkey=true, lowercasekey=true)
|
||||
response = "Q1: " * responsedict[:Q1]
|
||||
response = "Q1: " * responsedict[:q1]
|
||||
println("--> generatequestion ", @__FILE__, " ", @__LINE__)
|
||||
pprintln(response)
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user