This commit is contained in:
2023-11-26 06:51:45 +00:00
parent c33bf6923a
commit ff4be86439
2 changed files with 18 additions and 18 deletions

View File

@@ -47,7 +47,7 @@ julia> addNewMessage(agent1, "user", "Where should I go to buy snacks")
"""
function addNewMessage(a::T1, role::String, content::T2) where {T1<:agent, T2<:AbstractString}
if role a.availableRole # guard against typo
error("role is not in agent.availableRole")
error("role is not in agent.availableRole $(@__LINE__)")
end
# check whether user messages exceed limit
@@ -453,7 +453,7 @@ function conversation(a::T, usermsg::String) where {T<:agent}
prompt = generatePrompt_mistral_openorca(a, usermsg, thinkingmode)
respond = work(a, prompt)
else
error("undefined condition thinkingmode = $thinkingmode")
error("undefined condition thinkingmode = $thinkingmode $(@__LINE__)")
end
end
@@ -604,22 +604,17 @@ end
function work(a::agentReflex, usermsg::String)
evaluationGuideline = nothing
if a.thinkingmode == :new_thinking
a.earlierConversation = conversationSummary(a)
_ = addNewMessage(a, "user", usermsg)
evaluationGuideline = writeEvaluationGuidlines(a, usermsg)
elseif a.thinkingmode == :continue_thinking
error("continue_thinking")
error("continue_thinking $(@__LINE__)")
_ = addNewMessage(a, "user", usermsg)
a.thought *= "Obs $(a.attempt): $usermsg\n"
else
error("undefined condition thinkingmode = $thinkingmode")
error("undefined condition thinkingmode = $thinkingmode $(@__LINE__)")
end
while true # Work loop
# plan
a.attempt += 1
@@ -644,13 +639,18 @@ function work(a::agentReflex, usermsg::String)
logmsg = "assistant: $_plan\n"
a.memory[:shortterm] *= logmsg
actorstate, msgToUser = actor(a, plan)
#WORKING if actorstate == "chatbox" break work loop and get back to user
#WORKING
if actorstate == "chatbox"
return msgToUser
elseif actorstate == "all steps done"
error(">>>>>>>>>> ", a.memory[:shortterm])
# evaluationGuideline = writeEvaluationGuideline(a, )
break
else
error("undefied condition, actorstate $actorstate $(@__LINE__)")
break
end
# if
@@ -808,7 +808,7 @@ julia> score = grading(agent, guideline, shorttermMemory)
2
```
"""
function grading(a, guidelines::T, shorttermMemory::T) where {T<:AbstractString}
function grading(a, guideline::T, shorttermMemory::T) where {T<:AbstractString}
prompt =
"""
<|im_start|>system
@@ -816,14 +816,14 @@ function grading(a, guidelines::T, shorttermMemory::T) where {T<:AbstractString
chatbox: Useful for when you need to ask a customer for more context. Input should be a conversation to customer.
wikisearch: Useful for when you need to search an encyclopedia Input is keywords and not a question.
Evaluation guidelines:
$guidelines
Evaluation guideline:
$guideline
Your work:
$shorttermMemory
You job are:
1. Evaluate your work using the evaluation guidelines.
1. Evaluate your work using the evaluation guideline.
2. Give yourself a score out of 10 for your work.
Use the following format to answer: Score {}/10.
<|im_end|>