update
This commit is contained in:
@@ -621,7 +621,7 @@ function work(a::agentReflex, usermsg::String)
|
||||
end
|
||||
@show a.attempt
|
||||
@show usermsg
|
||||
logmsg = "<|im_start|>user:\nStimulus: $usermsg\n<|im_end|>\n"
|
||||
logmsg = "user: $usermsg\n"
|
||||
a.memory[:shortterm] *= logmsg
|
||||
|
||||
toolname = nothing
|
||||
@@ -632,12 +632,16 @@ function work(a::agentReflex, usermsg::String)
|
||||
plan = split(respond, "<|im_end|>")[1]
|
||||
plan = split(plan, "Response:")[1]
|
||||
_plan = replace(plan, "Plan:"=>"Plan $(a.attempt):")
|
||||
logmsg = "<|im_start|>assistant:\n$_plan\n"
|
||||
logmsg = "assistant: $_plan\n"
|
||||
a.memory[:shortterm] *= logmsg
|
||||
actorstate, result = actor(a, plan)
|
||||
actorstate, msgToUser = actor(a, plan)
|
||||
#WORKING if actorstate == "chatbox" break work loop and get back to user
|
||||
if actorstate == "chatbox"
|
||||
return msgToUser
|
||||
end
|
||||
|
||||
# evaluate
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -646,13 +650,14 @@ end
|
||||
|
||||
"""
|
||||
Actor function.
|
||||
|
||||
"""
|
||||
function actor(a::agentReflex, plan::T) where {T<:AbstractString}
|
||||
actorState = nothing
|
||||
@show plan
|
||||
totalsteps = checkTotalStepInPlan(a, plan)
|
||||
|
||||
result = nothing
|
||||
msgToUser = nothing
|
||||
a.step = 0
|
||||
while true # Actor loop
|
||||
a.step += 1
|
||||
@@ -680,10 +685,9 @@ function actor(a::agentReflex, plan::T) where {T<:AbstractString}
|
||||
|
||||
#WORKING
|
||||
if toolname == "chatbox" # chat with user
|
||||
# a.memory[:shortterm] *= toolinput
|
||||
respond = toolinput
|
||||
_ = addNewMessage(a, "assistant", respond)
|
||||
result = respond
|
||||
msgToUser = respond
|
||||
actorState = toolname
|
||||
error("actor done 0")
|
||||
break
|
||||
@@ -694,22 +698,19 @@ function actor(a::agentReflex, plan::T) where {T<:AbstractString}
|
||||
a.memory[:shortterm] *= result
|
||||
end
|
||||
else #TODO finish all steps
|
||||
|
||||
|
||||
|
||||
actorState = "all steps done"
|
||||
result = "all steps done"
|
||||
error("actor done 2")
|
||||
break
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
error("actor done 3")
|
||||
return actorState, result
|
||||
return actorState, msgToUser
|
||||
end
|
||||
|
||||
"""
|
||||
Evaluator
|
||||
"""
|
||||
# function evaluator(a::agentReflex, plan::T)
|
||||
|
||||
|
||||
|
||||
@@ -718,6 +719,14 @@ end
|
||||
|
||||
|
||||
|
||||
|
||||
# end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user