update
This commit is contained in:
@@ -215,7 +215,6 @@ function chat_mistral_openorca(a::agentReflex, usermsg::String)
|
||||
"""
|
||||
<|im_start|>system
|
||||
{role}
|
||||
{tools}
|
||||
{thinkingFormat}
|
||||
<|im_end|>
|
||||
{context}
|
||||
@@ -297,6 +296,7 @@ function planner_mistral_openorca(a::agentReflex, usermsg::String)
|
||||
toollines *= toolline
|
||||
toolnames *= "$toolname,"
|
||||
end
|
||||
|
||||
prompt = replace(prompt, "{toolnames}" => toolnames)
|
||||
prompt = replace(prompt, "{tools}" => "You have access to the following tools:\n$toollines")
|
||||
|
||||
@@ -607,18 +607,21 @@ function work(a::agentReflex, usermsg::String)
|
||||
a.earlierConversation = conversationSummary(a)
|
||||
_ = addNewMessage(a, "user", usermsg)
|
||||
elseif a.thinkingmode == :continue_thinking
|
||||
error("continue_thinking")
|
||||
_ = addNewMessage(a, "user", usermsg)
|
||||
a.thought *= "Obs $(a.attempt): $usermsg\n"
|
||||
else
|
||||
error("undefined condition thinkingmode = $thinkingmode")
|
||||
end
|
||||
|
||||
|
||||
while true
|
||||
# plan
|
||||
a.attempt += 1
|
||||
@show a.attempt
|
||||
@show usermsg
|
||||
a.thoughtlog *= "$usermsg\n"
|
||||
logmsg = "<|im_start|>user:\nStimulus: $usermsg\n<|im_end|>\n"
|
||||
a.memory[:shortterm] *= logmsg
|
||||
|
||||
toolname = nothing
|
||||
toolinput = nothing
|
||||
prompt = planner_mistral_openorca(a, usermsg)
|
||||
@@ -626,7 +629,9 @@ function work(a::agentReflex, usermsg::String)
|
||||
respond = sendReceivePrompt(a, prompt)
|
||||
plan = split(respond, "<|im_end|>")[1]
|
||||
@show plan
|
||||
a.thoughtlog *= plan
|
||||
logmsg = "<|im_start|>assistant:\n$plan\n"
|
||||
a.memory[:shortterm] *= logmsg
|
||||
|
||||
a.step = 0
|
||||
while true # execute step by step
|
||||
a.step += 1
|
||||
@@ -806,13 +811,14 @@ end
|
||||
|
||||
function chooseThinkingMode(a::agentReflex, usermsg::String)
|
||||
thinkingmode = nothing
|
||||
if a.thoughtlog != "nothing"
|
||||
if length(a.thoughtlog) != 0
|
||||
thinkingmode = :continue_thinking
|
||||
else
|
||||
prompt =
|
||||
"""
|
||||
<|im_start|>system
|
||||
{systemMsg}
|
||||
You always use tools if there is a chance to impove your respond.
|
||||
You have access to the following tools:
|
||||
{tools}
|
||||
Your job is to determine whether you will use tools or actions to respond.
|
||||
|
||||
Reference in New Issue
Block a user