From 60e8719c402c90b18a4cbdf4fa71306d835f68a2 Mon Sep 17 00:00:00 2001 From: narawat Date: Fri, 17 Nov 2023 06:16:57 +0000 Subject: [PATCH] update --- src/interface.jl | 61 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index 5eda3bf..30865b5 100755 --- a/src/interface.jl +++ b/src/interface.jl @@ -480,20 +480,15 @@ end ``` """ function conversationSummary(a::T) where {T<:agent} - prompt = """ <|im_start|>system - You are a helpful assistant. - <|im_end|> - Here are the context for the question: + You talked with a user earlier. Now you make a detailed bullet summary of the conversation. + Here are the context: {context} - - <|im_start|>user - Please make a detailed bullet summary of the following earlier conversation between you and a user. + Here are the conversation: {conversation} <|im_end|> - <|im_start|>I """ conversation = "" @@ -528,6 +523,56 @@ function conversationSummary(a::T) where {T<:agent} return summary end +# function conversationSummary(a::T) where {T<:agent} +# prompt = +# """ +# <|im_start|>system +# You are a helpful assistant. +# <|im_end|> +# Here are the context for the question: +# {context} + +# <|im_start|>user +# Make a detailed bullet summary of the following earlier conversation between you and a user. + +# {conversation} +# <|im_end|> +# <|im_start|>assistant + +# """ +# conversation = "" +# summary = "nothing" +# if length(a.messages)!= 0 +# for msg in a.messages +# role = msg[:role] +# content = msg[:content] + +# if role == "user" +# conversation *= "$role: $content\n" +# elseif role == "assistant" +# conversation *= "I: $content\n" +# else +# error("undefied condition role = $role") +# end +# end +# prompt = replace(prompt, "{conversation}" => conversation) +# prompt = replace(prompt, "{context}" => a.context) +# println("<<<<<") +# @show prompt +# result = sendReceivePrompt(a, prompt) +# summary = result === nothing ? "nothing" : result +# summary = replace(summary, "<|im_end|>" => "") +# if summary[1:1] == "\n" +# summary = summary[2:end] +# end +# @show summary +# println(">>>>>") +# error("-----") +# end + +# return summary +# end + # function work2(a::agentReact, usermsg::String) # addNewMessage(a, "user", usermsg) # userIntent = identifyUserIntention(a, usermsg)