This commit is contained in:
Your Name
2024-02-11 17:13:25 +07:00
parent 1ee362f1e5
commit 5ac191153b
2 changed files with 24 additions and 7 deletions

View File

@@ -349,8 +349,8 @@ function selfAwareness(a::agentReflex)
</About yourself>
<Your job>
Use the following format strictly:
Info extraction: from the latest observed result, breakdown each info into smaller one and repeat every one of them (PS. check <Required wine info> for more details)
Info mapping: based on extracted info, explicitly state what each info could match which keyword memory's key
Info extraction: from the latest observed result, repeat every word relates to wine
Info mapping: based on extracted info, explicitly state what each info could possibly match which keyword memory's key
Info matching: using JSON format, what key in my memory matches which info (Donot use nested JSON)
</Your job>
</|system|>
@@ -936,7 +936,7 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
</You have access to the following tools>
<Your job>
Use the following format:
Thought: check the user info thoroughly, if there is something you don't know (as indicates by null) you must address it first. Otherwise, you must think about what is the immediate next step to do according to the plan (PS. 1. pay attention to correct numeral calculation and commonsense 2. you must assume nothing)
Thought: check the user info thoroughly to see if there is something you don't know (as indicates by null), you must address it the immediate next step. Otherwise, you must think about what is the immediate next step to do according to the plan (PS. 1. pay attention to correct numeral calculation and commonsense 2. you must assume nothing 3. do not ask for confirmation)
Act: based on your thought what action to choose?, must be one of [{toolnames}].
Actinput: your input to the action using JSON format (pay attention to the tool's input)
Obs: observed result of the action

View File

@@ -974,13 +974,21 @@ end
"""
function keywordMemoryUpdate!(keywordmemory::AbstractDict, newinfo::AbstractDict)
for (k, v) in newinfo
k = String(k)
if v === nothing && haskey(keywordmemory, k) && keywordmemory[k] !== nothing
# skip
# some time input keyword is different than dict's key thus it skip update
# e.x. input key "tannin level" => "low to medium"
# dict key "wine tannin level" => "low to medium"
similar_k = checkSimilarKey(keywordmemory, k)
k = similar_k === nothing ? k : similar_k
if v === nothing && haskey(keywordmemory, similar_k) && keywordmemory[similar_k] !== nothing
# do not write value nothing if the key already has value
else
if haskey(keywordmemory, k)
println("before k $k v $(keywordmemory[k])") #BUG this function write null to a non-empty key
println("before k $k v $(keywordmemory[k])")
end
println("write k $k v $v")
keywordmemory[k] = v
@@ -991,7 +999,16 @@ function keywordMemoryUpdate!(keywordmemory::AbstractDict, newinfo::AbstractDict
end
function checkSimilarKey(dict::AbstractDict, key::AbstractString)
similar_k = nothing
for (k, v) in dict
if occursin(key, String(k))
similar_k = k
break
end
end
return similar_k
end