diff --git a/src/interface.jl b/src/interface.jl index ad62de9..b61ae25 100755 --- a/src/interface.jl +++ b/src/interface.jl @@ -184,7 +184,7 @@ function generatePrompt_mistral_openorca(a::T, usermsg::String, return prompt end -function genPrompt_mistral_openorca(a::agentReflex, usermsg::String) #WORKING +function genPrompt_mistral_openorca(a::agentReflex, usermsg::String) """ general prompt format: @@ -506,6 +506,7 @@ function conversation(a::agentReflex, usermsg::String; thinkingroundlimit::Int=3 # determine thinking mode a.thinkingmode = chooseThinkingMode(a, usermsg) + @show a.thinkingmode if a.thinkingmode == :no_thinking a.earlierConversation = conversationSummary(a) #TODO should be long conversation before use summary because it leaves out details @@ -526,7 +527,7 @@ end #WORKING function work(a::agentReflex, usermsg::String) - error("work done") + if a.thinkingmode == :new_thinking a.earlierConversation = conversationSummary(a) _ = addNewMessage(a, "user", usermsg) @@ -536,7 +537,7 @@ function work(a::agentReflex, usermsg::String) else error("undefined condition thinkingmode = $thinkingmode") end - + error("work done") while true # plan a.thinkinground += 1 @@ -587,8 +588,6 @@ function conversationSummary(a::T) where {T<:agent} You talked with a user earlier. Now you make a detailed bullet summary of the conversation from your perspective. - Here are the context: - {context} Here are the conversation: {conversation} <|im_end|> @@ -610,7 +609,6 @@ function conversationSummary(a::T) where {T<:agent} end end prompt = replace(prompt, "{conversation}" => conversation) - prompt = replace(prompt, "{context}" => a.context) result = sendReceivePrompt(a, prompt) summary = result === nothing ? "nothing" : result summary = replace(summary, "<|im_end|>" => "") diff --git a/src/type.jl b/src/type.jl index 321e819..fae974e 100644 --- a/src/type.jl +++ b/src/type.jl @@ -33,7 +33,6 @@ abstract type agent end # Ref: Chat prompt format https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML/discussions/3 # messages= [Dict(:role=>"system", :content=> "", :timestamp=> Dates.now()),] messages = Vector{Dict{Symbol, Any}}() - context::String = "nothing" # internal thinking area tools::Union{Dict, Nothing} = nothing thought::String = "nothing" # logs unfinished thoughts thinkinground::Int = 0 # no. of thinking round