diff --git a/src/interface.jl b/src/interface.jl index a4787c8..9442011 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -3,7 +3,8 @@ module interface export addNewMessage, conversation, decisionMaker, evaluator, reflector, generatechat, generalconversation, detectWineryName -using JSON3, DataStructures, Dates, UUIDs, HTTP, Random, PrettyPrinting, Serialization +using JSON3, DataStructures, Dates, UUIDs, HTTP, Random, PrettyPrinting, Serialization, + DataFrames using GeneralUtils using ..type, ..util, ..llmfunction @@ -940,6 +941,7 @@ function generatechat(a::sommelier, thoughtDict) You should follow the following guidelines: - Focus on the latest conversation. - If the user interrupts, prioritize the user + - Be honest - Medium and full-bodied red wines should not be paired with spicy foods. You should then respond to the user with: @@ -1313,90 +1315,13 @@ function generatequestion(a, text2textInstructLLM::Function; recent=nothing)::St end -# function generateSituationReport(a, text2textInstructLLM::Function; skiprecent::Integer=0 -# )::Dict - -# systemmsg = -# """ -# You are an assistant being in the given events. -# Your task is to writes a summary for each event in an ongoing, interleaving series. - -# At each round of conversation, you will be given the situation: -# Total events: number of events you need to summarize. -# Events timeline: ... -# Context: ... - -# You should then respond to the user with: -# event: a detailed summary for each event without exaggerated details. - -# You must only respond in format as described below: -# Event_1: ... -# Event_2: ... -# ... - -# Here are some examples: -# Event_1: The user ask me about where to buy a toy. -# Event_2: I told the user to go to the store at 2nd floor. - -# Let's begin! -# """ - -# if length(a.memory[:events]) <= skiprecent -# return Dict(:recap => "None") -# end - -# events = deepcopy(a.memory[:events][1:end-skiprecent]) - -# timeline = "" -# for (i, event) in enumerate(events) -# if event[:outcome] === nothing -# timeline *= "$i) $(event[:subject])> $(event[:actioninput])\n" -# else -# timeline *= "$i) $(event[:subject])> $(event[:actioninput]) $(event[:outcome])\n" -# end -# end - -# errornote = "" -# response = nothing # store for show when error msg show up - -# for attempt in 1:10 -# usermsg = """ -# Total events: $(length(events)) -# Events timeline: $timeline -# $errornote -# """ - -# _prompt = -# [ -# Dict(:name => "system", :text => systemmsg), -# Dict(:name => "user", :text => usermsg) -# ] - -# # put in model format -# prompt = GeneralUtils.formatLLMtext(_prompt; formatname="llama3instruct") -# prompt *= """ -# <|start_header_id|>assistant<|end_header_id|> -# """ - -# response = text2textInstructLLM(prompt) -# # responsedict = GeneralUtils.textToDict(response, -# # ["summary", "presented", "selected"], -# # rightmarker=":", symbolkey=true) -# println("\n~~~ generateSituationReport() ", Dates.now(), " ", @__FILE__, " ", @__LINE__) -# pprintln(response) - -# return Dict(:recap => response) -# end -# error("generateSituationReport failed to generate a response ", response) -# end - function generateSituationReport(a, text2textInstructLLM::Function; skiprecent::Integer=0 )::OrderedDict systemmsg = """ You are an assistant being in the given events. - Your task is to writes a summary for each event in an ongoing, interleaving series. + Your task is to writes a summary for each event seperately into an ongoing, interleaving series. At each round of conversation, you will be given the situation: Total events: number of events you need to summarize.