This commit is contained in:
narawat lamaiin
2024-08-21 18:09:12 +07:00
parent 4dabb03d93
commit 97793ada3e

View File

@@ -1186,12 +1186,12 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F
- Focus on the latest conversation.
You should then respond to the user with:
1) Chat: Given the situation, what would you say to convey your thoughts to the user?
2) Mentioning_wine: Are you mentioning specific wine name to the user? Can be "Yes" or "No"
1) Mentioning_wine: Are you going to mentioning specific wine name to the user? Can be "Yes" or "No"
2) Chat: Given the situation, what would you say to convey your thoughts to the user?
You should only respond in format as described below:
Chat: ...
Mentioning_wine: ...
Chat: ...
Let's begin!
"""
@@ -1231,7 +1231,7 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F
try
response = text2textInstructLLM(prompt)
responsedict = GeneralUtils.textToDict(response,["Chat", "Mentioning_wine"],
responsedict = GeneralUtils.textToDict(response,["Mentioning_wine", "Chat"],
rightmarker=":", symbolkey=true)
for i [:Chat]
@@ -1678,8 +1678,10 @@ function generateSituationReport(a, text2textInstructLLM::Function; skiprecent::
return Dict(:recap=> "None")
end
events = deepcopy(a.memory[:events][1:end-skiprecent])
timeline = ""
for (i, event) in enumerate(a.memory[:events][1:end-skiprecent])
for (i, event) in enumerate(events)
if event[:outcome] === nothing
timeline *= "$i) $(event[:subject])> $(event[:action_or_dialogue])\n"
else
@@ -1693,7 +1695,7 @@ function generateSituationReport(a, text2textInstructLLM::Function; skiprecent::
for attempt in 1:10
usermsg =
"""
Total events: $(length(a.memory[:events]))
Total events: $(length(events))
Events timeline: $timeline
$errornote
"""
@@ -1720,9 +1722,9 @@ function generateSituationReport(a, text2textInstructLLM::Function; skiprecent::
eventcount = count("Event_", response)
if eventcount < (length(a.memory[:events]) - skiprecent)
errornote = "Note: You need to summarize every events."
println("the summary covers $eventcount/$(length(a.memory[:events])) ", @__FILE__, " ", @__LINE__)
if eventcount < (length(events))
errornote = "Note: You need to summarize all 3 events."
println("the summary covers $eventcount/$(length(events)) ", @__FILE__, " ", @__LINE__)
else
return Dict(:recap=> response)
end