From ff4be86439e2ae930e5c0d804ee3d082cc68d03f Mon Sep 17 00:00:00 2001 From: tonaerospace Date: Sun, 26 Nov 2023 06:51:45 +0000 Subject: [PATCH] update --- src/interface.jl | 32 ++++++++++++++++---------------- src/utils.jl | 4 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index b0449f0..3e1f804 100755 --- a/src/interface.jl +++ b/src/interface.jl @@ -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|> diff --git a/src/utils.jl b/src/utils.jl index 6c2cdaf..6a30386 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -281,7 +281,7 @@ function extract_number(text::T) where {T<:AbstractString} number = parse(Int, match.match) return number else - error("No number found in the text") + error("No number found in the text $(@__LINE__)") end end @@ -420,7 +420,7 @@ function conversationSummary(a::T) where {T<:agent} elseif role == "assistant" conversation *= "I: $content\n" else - error("undefied condition role = $role") + error("undefied condition role = $role $(@__LINE__)") end end