This commit is contained in:
2023-12-05 07:28:27 +00:00
parent 9216f87ef8
commit ec8cc6bbf9

View File

@@ -1156,12 +1156,7 @@ julia> decision = goNogo(agent)
"""
function goNogo(a)
stimulus = a.memory[:shortterm]["user:"]
work = ""
for (k, v) in a.memory[:shortterm]
if k ["user:"]
work *= "$k $v"
end
end
work = shortMemoryToString(a.memory[:shortterm], ["user:"])
# prompt =
# """
@@ -1204,10 +1199,9 @@ function goNogo(a)
Your work:
$work
From the latest step in your work, you job is to choose one of the following choices:
Consider the plan and Obs $(a.step), your job is to choose one of the following choices:
If you need to repeat the latest step say, "{No}". And what is the rationale behind the decision?
If you are ready to do the next step of the plan say, "{Yes}". And what is the rationale behind the decision?
If you are ready to formulate a final respond to user original stimulus say, {formulateUserRespond}. And what is the rationale behind the decision?
<|im_end|>
"""
@@ -1221,19 +1215,22 @@ function goNogo(a)
reason = nothing
if occursin("Yes", respond)
decision = "Yes"
startInd = startInd = findfirst("Yes", respond)[end] +2
reason = respond[startInd:end]
elseif occursin("No", respond)
decision = "No"
startInd = startInd = findfirst("No", respond)[end] +2
reason = respond[startInd:end]
elseif occursin("formulateUserRespond", respond)
decision = "formulateUserRespond"
startInd = startInd = findfirst("formulateUserRespond", respond)[end] +2
reason = respond[startInd:end]
else
error("undefied condition, decision $decision $(@__LINE__)")
end
startInd = findfirst(decision, respond)[end] +2
if occursin(":", respond[startInd:end]) # check for ":" after decision cha
startInd2 = findnext(":", respond, startInd)[end]+1
reason = respond[startInd2:end]
else
reason = respond[startInd:end]
end
return decision, reason
end