From 5fa16dc1fe5093a19314902200e8cdb9395d0010 Mon Sep 17 00:00:00 2001 From: tonaerospace Date: Wed, 6 Dec 2023 05:03:16 +0000 Subject: [PATCH] update --- src/interface.jl | 17 +++++++++-------- src/type.jl | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index 3cf6eb7..5dad97d 100755 --- a/src/interface.jl +++ b/src/interface.jl @@ -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 diff --git a/src/type.jl b/src/type.jl index 0691539..c8d1f11 100644 --- a/src/type.jl +++ b/src/type.jl @@ -109,7 +109,7 @@ function agentReflex( :actor=> """ Use the following format: - Thought: ask yourself do you have all the info you need? And think about what to do according to step {step} of the plan (pay attention to correct numeral calculation and commonsense). + Thought: you should always think about what to do according to step {step} of the plan and the info you have (pay attention to correct numeral calculation and commonsense). Act: the action to take that match your thought, should be one of [{toolnames}] ActInput: the input to the action (pay attention to the tool's input) Obs: the result of the action