update
This commit is contained in:
@@ -266,7 +266,7 @@ function updatePlan(a::agentReflex)
|
||||
|
||||
end
|
||||
|
||||
function actor_mistral_openorca(a::agentReflex, taskevaluate="")
|
||||
function actor_mistral_openorca(a::agentReflex, taskrecap="")
|
||||
"""
|
||||
general prompt format:
|
||||
|
||||
@@ -316,13 +316,24 @@ function actor_mistral_openorca(a::agentReflex, taskevaluate="")
|
||||
"""
|
||||
<|system|>
|
||||
$(a.roles[a.role])
|
||||
You have access to the following tools:
|
||||
$toollines
|
||||
Your earlier work:
|
||||
$shorttermMemory
|
||||
Your progress evaluation of the plan:
|
||||
$taskevaluate
|
||||
$(a.thinkingFormat[:actor])
|
||||
<You have access to the following tools>
|
||||
$toollines
|
||||
</You have access to the following tools>
|
||||
<Your plan>
|
||||
$(a.memory[:shortterm]["Plan 1:"])
|
||||
</Your plan>
|
||||
<Your earlier work's recap>
|
||||
$taskrecap
|
||||
</Your earlier work's recap>
|
||||
<Your job>
|
||||
Use the following format:
|
||||
Thought: based on the plan and the recap of the plan, what to do? (pay attention to correct numeral calculation and commonsense).
|
||||
Act: an action to take based on your thought, must be one of [{toolnames}]
|
||||
Actinput: your input to the action based on your thought (pay attention to the tool's input)
|
||||
Obs: observed result of the action
|
||||
|
||||
P.S.1 ask user one by one question.
|
||||
</Your job>
|
||||
<|/s|>
|
||||
<|assistant|>
|
||||
Thought:
|
||||
@@ -336,11 +347,11 @@ function actor_mistral_openorca(a::agentReflex, taskevaluate="")
|
||||
chunkedtext = nothing
|
||||
latestTask = nothing
|
||||
|
||||
tempcounter = 0.0
|
||||
tempcounter = 0.1
|
||||
while true # while Thought or Act is empty, run actor again
|
||||
tempcounter += 0.1
|
||||
@show tempcounter
|
||||
response = sendReceivePrompt(a, prompt, temperature=tempcounter)
|
||||
response = sendReceivePrompt(a, prompt, max_tokens=1024, temperature=tempcounter)
|
||||
response = splittext(response, ["Obs", "<|im_end|>"])
|
||||
#WORKING
|
||||
latestTask = shortMemLatestTask(a.memory[:shortterm]) +1
|
||||
@@ -608,16 +619,16 @@ function actor(a::agentReflex)
|
||||
|
||||
while true # Actor loop
|
||||
# check whether the current task is completed, skip evaluation if memory has only "Plan 1:"
|
||||
taskevaluation = ""
|
||||
taskrecap = ""
|
||||
if length(keys(a.memory[:shortterm])) != 1
|
||||
istaskcomplete, taskevaluation = checkTaskCompletion(a)
|
||||
taskrecap = recap(a)
|
||||
end
|
||||
println("")
|
||||
@show taskevaluation
|
||||
@show taskrecap
|
||||
latestTask = shortMemLatestTask(a.memory[:shortterm]) +1
|
||||
println(">>> working")
|
||||
# work
|
||||
toolname, toolinput, chunkedtext = actor_mistral_openorca(a, taskevaluation)
|
||||
toolname, toolinput, chunkedtext = actor_mistral_openorca(a, taskrecap)
|
||||
println("")
|
||||
@show toolname
|
||||
@show toolinput
|
||||
@@ -1098,6 +1109,39 @@ function checkTaskCompletion(a)
|
||||
return decision, response
|
||||
end
|
||||
|
||||
function recap(a)
|
||||
@show a.memory[:shortterm]["Plan 1:"]
|
||||
# stimulus = a.memory[:shortterm]["user:"]
|
||||
work = dictToString(a.memory[:shortterm])
|
||||
|
||||
prompt =
|
||||
"""
|
||||
<|system|>
|
||||
<Symbol meaning>
|
||||
Plan: a plan
|
||||
Thought: your thought
|
||||
Act: the action you took
|
||||
Actinput: the input to the action
|
||||
Obs: the result of the action
|
||||
</Symbol meaning>
|
||||
|
||||
<Your earlier work>
|
||||
$work
|
||||
</Your earlier work>
|
||||
<Your job>
|
||||
Recap: list all your observed results in detail
|
||||
</Your job>
|
||||
|
||||
Let's think step by step.
|
||||
</s|>
|
||||
<|assistant|>
|
||||
Recap:
|
||||
"""
|
||||
response = sendReceivePrompt(a, prompt, max_tokens=512, temperature=0.0)
|
||||
response = split(response, "</s|>")[1]
|
||||
|
||||
return response
|
||||
end
|
||||
|
||||
""" Direct conversation is not an agent, messages does not pass through logic loop
|
||||
but goes directly to LLM.
|
||||
|
||||
Reference in New Issue
Block a user