This commit is contained in:
2023-11-22 13:46:07 +00:00
parent cb7af75ba0
commit dc17f6d2a3
2 changed files with 31 additions and 23 deletions

View File

@@ -240,12 +240,13 @@ function genPrompt_mistral_openorca(a::agentReflex, usermsg::String)
prompt = replace(prompt, "{context}" => context)
prompt = replace(prompt, "{usermsg}" => "Question: $usermsg")
prompt = replace(prompt, "{usermsg}" => "Request: $usermsg")
return prompt
end
function genPrompt_planning_mistral_openorca(a::agentReflex, usermsg::String) #WORKING
#WORKING
function genPrompt_planning_mistral_openorca(a::agentReflex, usermsg::String)
"""
general prompt format:
@@ -298,16 +299,21 @@ function genPrompt_planning_mistral_openorca(a::agentReflex, usermsg::String) #W
end
prompt = replace(prompt, "{toolnames}" => toolnames)
prompt = replace(prompt, "{tools}" => "You have access to the following tools:\n$toollines")
context =
prompt = replace(prompt, "{context}" => a.context)
prompt *= "<|im_start|>user\nQuestion: " * usermsg * "\n<|im_end|>\n"
prompt *= "<|im_start|>assistant\n"
context =
"""
{earlierConversation}
{current status}
{longterm memory}
"""
context = replace(context, "{earlierConversation}" => "My earlier talk with the user:\n$(a.earlierConversation)")
context = replace(context, "{current status}" => "")
context = replace(context, "{longterm memory}" => "")
prompt = replace(prompt, "{context}" => context)
prompt = replace(prompt, "{usermsg}" => "Request: $usermsg")
return prompt
end
@@ -536,22 +542,25 @@ function work(a::agentReflex, usermsg::String)
else
error("undefined condition thinkingmode = $thinkingmode")
end
error("work done")
while true
# plan
a.thinkinground += 1
@show a.thinkinground
toolname = nothing
toolinput = nothing
plan = genPrompt_planning_mistral_openorca(a, prompt)
@show plan
# for
# # execute
# end
prompt = genPrompt_planning_mistral_openorca(a, usermsg)
@show prompt
respond = sendReceivePrompt(a, prompt)
respond = split(respond, "<|im_end|>")[1]
@show respond
for
# execute
end
# evaluate
#
error("work done")
end
end

View File

@@ -85,10 +85,9 @@ function agentReflex(
Begin!""",
:plan=>
"""Use the following format:
Question: the input question your user is asking and you must answer
Plan: first you should always think about the question and the info you have thoroughly then extract and devise a complete plan to find the answer (pay attention to variables and their corresponding numerals).
Begin!""",
Request: the input request your user is asking and you must respond
Plan: first you should always think about the request and the info you have thoroughly then extract and devise a step by step plan to respond (pay attention to correct numeral calculation and commonsense).
""",
:qta=>
"""Use the following format:
Question: the input question your user is asking and you must answer