update
This commit is contained in:
@@ -327,7 +327,7 @@ function planner_mistral_openorca(a::agentReflex, usermsg::String)
|
||||
end
|
||||
|
||||
#WORKING try use Thought/Act/ActInput/Obs loop because some time step 2 depend on step 1
|
||||
function actor_mistral_openorca(a::agentReflex)
|
||||
function actor_mistral_openorca(a::agentReflex, plan)
|
||||
"""
|
||||
general prompt format:
|
||||
|
||||
@@ -384,10 +384,12 @@ function actor_mistral_openorca(a::agentReflex)
|
||||
"""
|
||||
{env state}
|
||||
{longterm memory}
|
||||
{plan}
|
||||
"""
|
||||
# context = replace(context, "{earlierConversation}" => "My earlier talk with the user:\n$(a.earlierConversation)")
|
||||
context = replace(context, "{env state}" => "")
|
||||
context = replace(context, "{longterm memory}" => "")
|
||||
context = replace(context, "{plan}" => "My plan:\n$plan")
|
||||
prompt = replace(prompt, "{context}" => context)
|
||||
|
||||
return prompt
|
||||
@@ -636,7 +638,7 @@ function work(a::agentReflex, usermsg::String)
|
||||
plan = split(respond, "<|im_end|>")[1]
|
||||
plan = split(plan, "Response:")[1]
|
||||
plan = replace(plan, "Plan:"=>"Plan $(a.attempt):")
|
||||
a.memory[:shortterm] *= plan
|
||||
# a.memory[:shortterm] *= plan
|
||||
actorstate, msgToUser = actor(a, plan)
|
||||
error("333")
|
||||
if actorstate == "chatbox"
|
||||
@@ -731,10 +733,9 @@ function actor(a::agentReflex, plan)
|
||||
@show a.step
|
||||
if a.step <= totalsteps
|
||||
# WORKING in step 2, I need to use a.memory[:shortterm] as input to actor()
|
||||
prompt = actor_mistral_openorca(a)
|
||||
prompt = actor_mistral_openorca(a, plan)
|
||||
@show prompt
|
||||
respond = sendReceivePrompt(a, prompt)
|
||||
@show respond
|
||||
|
||||
# some time LLM not generate a number after headers but I want it
|
||||
if occursin("Act:", respond)
|
||||
@@ -745,11 +746,13 @@ function actor(a::agentReflex, plan)
|
||||
respond = addStepNumber(respond, headers, a.step)
|
||||
end
|
||||
|
||||
respond = split(respond, "Obs $(a.step):")[1]
|
||||
respond = split(respond, "Obs")[1]
|
||||
respond = split(respond, "<|im_end|>")[1]
|
||||
@show respond
|
||||
|
||||
# add to memory
|
||||
a.memory[:shortterm] *= respond
|
||||
error("111")
|
||||
|
||||
headerToDetect = ["Question $(a.step):", "Plan $(a.step):", "Thought $(a.step):",
|
||||
"Act $(a.step):", "ActInput $(a.step):", "Obs $(a.step):", "...",
|
||||
"Answer $(a.step):", "Conclusion $(a.step):", "Summary $(a.step):"]
|
||||
@@ -760,7 +763,7 @@ function actor(a::agentReflex, plan)
|
||||
toolinput = chunkedtext["ActInput $(a.step):"]
|
||||
@show toolname
|
||||
@show toolinput
|
||||
error(">>>>>>>>>")
|
||||
|
||||
if toolname == "chatbox" # chat with user
|
||||
#TODO donot use chatbox to respond to user
|
||||
respond = toolinput
|
||||
|
||||
Reference in New Issue
Block a user