This commit is contained in:
2023-12-06 05:03:16 +00:00
parent 04100d2508
commit 5fa16dc1fe
2 changed files with 10 additions and 9 deletions

View File

@@ -659,7 +659,7 @@ function work(a::agentReflex, usermsg::String)
plan_raw = respond
@show plan_raw
# sometimes LLM add not-need word I don't want
plan = splittext(respond, ["<|im_end|>", "Response", "Execution",
plan = splittext(respond, ["Step 1", "<|im_end|>", "Response", "Execution",
"Result", "Recommendation", "My response"])
# plan = replace(plan, "Plan:"=>"")
println("")
@@ -684,8 +684,8 @@ function work(a::agentReflex, usermsg::String)
respond = formulateUserRespond(a)
println("")
formulatedRedpond = respond
@show formulateUserRespond
formulatedRespond = respond
@show formulatedRespond
a.memory[:shortterm]["Respond $(a.attempt):"] = respond
a.memory[:log]["Respond $mark:"] = respond
@@ -711,10 +711,8 @@ function work(a::agentReflex, usermsg::String)
headers = detectCharacters(lessonwithcontext, headerToDetect)
chunkedtext = chunktext(lessonwithcontext, headers)
@show chunkedtext
a.memory[:longterm][chunkedtext["Context:"] => chunkedtext["Lesson:"]]
a.memory[:longterm][chunkedtext["Context:"]] = chunkedtext["Lesson:"]
a.newplan = true
error("22222222")
end
else
error("undefied condition, actorstate $actorstate $(@__LINE__)")
@@ -776,7 +774,6 @@ function actor(a::agentReflex)
a.step += 1
elseif decision == "No"
# repeat the latest step
# WORKING delete Thought/Act/ActInput from the latest input
a.memory[:shortterm] = removeHeaders(a.memory[:shortterm], a.step, ["Plan"])
println("repeating step $(a.step)")
elseif decision == "formulateUserRespond"
@@ -839,6 +836,10 @@ function actor(a::agentReflex)
msgToUser = toolinput
actorState = toolname
break
elseif toolname == "formulateUserRespond"
msgToUser = toolinput
actorState = toolname
break
else # function call
f = a.tools[Symbol(toolname)][:func]
toolresult = f(a, toolinput)
@@ -1020,7 +1021,7 @@ function analyze(a)
println("")
analyze_respond = respond
@show analyze_respond
error(11)
return respond
end