This commit is contained in:
2023-11-22 11:16:59 +00:00
parent d374ed245e
commit 7c869df5fa
2 changed files with 4 additions and 7 deletions

View File

@@ -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|>" => "")

View File

@@ -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