This commit is contained in:
youremail@yourdomain.com
2023-12-25 06:40:24 +00:00
parent 95ec41a9e9
commit 802d080205
2 changed files with 43 additions and 23 deletions

View File

@@ -295,6 +295,7 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="")
"
"""
#BUG BIG output from winestock cause recap() to fail.
#BUG2 LLM repeat winestock search without recommending wine
toolnames = ""
toollines = ""
for (toolname, v) in a.tools
@@ -318,8 +319,8 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="")
start = "Thought"
aware = ""
if taskrecap != ""
start = "Aware"
aware = "Aware: check recap against the plan about current situation"
start = "Self-awareness"
aware = "Self-awareness: based on the recap, check your progress against the plan and assess the current situation to identify tasks that you need to address."
end
winestockResult = ""
@@ -349,7 +350,7 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="")
<Your job>
Use the following format:
$aware
Thought: based on the plan and the recap of the plan, what to do? (pay attention to correct numeral calculation, commonsense. ask the user one by one question.)
Thought: based on the plan and self-awareness, What to do? (P.S. ask the user one by one question, 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
@@ -379,10 +380,10 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="")
if start == "Thought"
response = "Thought $latestTask: " * response
else
response = "Aware $latestTask: " * response
response = "Self-awareness $latestTask: " * response
end
headerToDetect = ["Question:", "Plan:", "Aware:", "Thought:",
headerToDetect = ["Question:", "Plan:", "Self-awareness:", "Thought:",
"Act:", "Actinput:", "Obs:", "...",
"Answer:", "Conclusion:", "Summary:"]
@@ -397,7 +398,7 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="")
headerToDetect = ["Plan $(a.attempt):",
"Aware $latestTask:",
"Self-awareness $latestTask:",
"Thought $latestTask:",
"Act $latestTask:",
"Actinput $latestTask:",
@@ -422,7 +423,7 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="")
toolinput = chunkedtext["Actinput $latestTask:"]
# change trailing number to continue a.memory[:shortterm]
headerToDetect = ["Question:", "Plan:", "Aware:", "Thought:",
headerToDetect = ["Question:", "Plan:", "Self-awareness:", "Thought:",
"Act:", "Actinput:", "Obs:", "...",
"Answer:", "Conclusion:", "Summary:"]
response = replaceHeaders(response, headerToDetect, latestTask)
@@ -435,7 +436,7 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="")
"Check $latestTask:",]
headers = detectCharacters(response, headerToDetect)
chunkedtext = chunktext(response, headers)
chunkedtext = delete!(chunkedtext, "Aware $latestTask")
chunkedtext = delete!(chunkedtext, "Self-awareness $latestTask")
return toolname, toolinput, chunkedtext
end
@@ -673,14 +674,14 @@ function actor(a::agentReflex)
f = a.tools[toolname][:func]
toolresult = f(a, toolinput)
@show toolresult
# if toolname == "winestock"
# a.winestockResult = toolresult
# a.memory[:shortterm]["Obs $latestTask:"] = "winestock search done"
# a.memory[:log]["Obs $latestTask:"] = "winestock search done"
# else
# a.memory[:shortterm]["Obs $latestTask:"] = toolresult
# a.memory[:log]["Obs $latestTask:"] = toolresult
# end
if toolname == "winestock"
a.winestockResult = toolresult
a.memory[:shortterm]["Obs $latestTask:"] = "winestock search done, refers to <winestock search result>"
a.memory[:log]["Obs $latestTask:"] = "winestock search done"
else
a.memory[:shortterm]["Obs $latestTask:"] = toolresult
a.memory[:log]["Obs $latestTask:"] = toolresult
end
end