update conversationSummary()

This commit is contained in:
2023-11-17 02:00:51 +00:00
parent 188079e30f
commit 1d106582be

View File

@@ -362,7 +362,7 @@ end
#WORKING
function conversation(a::T, usermsg::String) where {T<:agent}
userintend = identifyUserIntention(a, usermsg)
@show userintend #BUG nothing sometime why? may be llm need more time to respond
@show userintend
respond = nothing
# AI thinking mode
@@ -375,12 +375,14 @@ function conversation(a::T, usermsg::String) where {T<:agent}
respond = split(respond, "<|im_end|>")[1]
respond = replace(respond, "\n" => "")
_ = addNewMessage(a, "assistant", respond)
@show respond
elseif userintend == "wine" #WORKING
if a.thought == "nothing" # new thought
a.context = conversationSummary(a)
_ = addNewMessage(a, "user", usermsg)
prompt = generatePrompt_react_mistral_openorca(a, usermsg)
@show prompt
# respond = sendReceivePrompt(a, prompt)
else # continue thought
@@ -459,7 +461,7 @@ function conversationSummary(a::T) where {T<:agent}
Please make a detailed bullet summary of the following earlier conversation between you and the user.
{conversation}
<|im_end|>
<|im_start|>assistant
<|im_start|>I
"""
conversation = ""
@@ -598,7 +600,7 @@ function identifyUserIntention(a::T, usermsg::String) where {T<:agent}
prompt = replace(prompt, "{input}" => usermsg)
result = sendReceivePrompt(a, prompt) #BUG answer is not in the choice {}
result = sendReceivePrompt(a, prompt)
answer = result === nothing ? nothing : GeneralUtils.getStringBetweenCharacters(result, "{", "}")
return answer