diff --git a/src/interface.jl b/src/interface.jl
index bcebbb3..a031c3c 100755
--- a/src/interface.jl
+++ b/src/interface.jl
@@ -83,12 +83,11 @@ function clearMessage(a::T) where {T<:agent}
break
end
end
- memory::Dict{Symbol, Any} = Dict(
- :shortterm=> OrderedDict{String, Any}(),
- :longterm=> OrderedDict{String, Any}(),
- :log=> OrderedDict{String, Any}(), # span from user stimulus -> multiples attempts -> final respond
- )
+
+ a.memory = newAgentMemory()
+
@show a.messages
+ @show a.memory
end
function removeLatestMsg(a::T) where {T<:agent}
@@ -350,7 +349,7 @@ function selfAwareness(a::agentReflex)
Use the following format strictly:
- Info extraction: from the latest observed result, breakdown all info into smaller one and repeat every important info thoroughly (PS. check for more details)
+ Info extraction: from the latest observed result, breakdown each info into smaller one and repeat every one of them (PS. check for more details)
Info mapping: based on extracted info, explicitly state what each info could match which keyword memory's key
Info matching: using JSON format, what key in my memory matches which info (Donot use nested JSON)
@@ -386,7 +385,7 @@ function selfAwareness(a::agentReflex)
<|assistant|>
Info extraction:
"""
- response = sendReceivePrompt(a, prompt, max_tokens=1024, temperature=0.2, timeout=180,
+ response = sendReceivePrompt(a, prompt, max_tokens=1024, temperature=0.4, timeout=180,
stopword=["/n/n", "END", "End", "Obs", "<|", ""])
response = split(response, "<|")[1]
response = split(response, "")[1]
diff --git a/src/type.jl b/src/type.jl
index 9922de0..df88f87 100644
--- a/src/type.jl
+++ b/src/type.jl
@@ -1,12 +1,22 @@
module type
-export agent, agentReflex
+export agent, agentReflex, newAgentMemory
using Dates, UUIDs, DataStructures
using CommUtils
#------------------------------------------------------------------------------------------------100
+function newAgentMemory()
+ memory::Dict{Any, Any} = Dict(
+ :shortterm=> OrderedDict{String, Any}(),
+ :longterm=> OrderedDict{String, Any}(),
+ :log=> OrderedDict{String, Any}(), # span from user stimulus -> multiples attempts -> final respond
+ :keyword=> Dict{String, Any}(),
+ )
+ return memory
+end
+
abstract type agent end
@@ -99,12 +109,7 @@ julia> agent = ChatAgent.agentReflex(
env::AbstractString = "N/A"
thinkingFormat::Union{Dict, Nothing} = nothing
roleSpecificInstruction::Union{Dict, Nothing} = nothing
- memory::Dict{Any, Any} = Dict(
- :shortterm=> OrderedDict{String, Any}(),
- :longterm=> OrderedDict{String, Any}(),
- :log=> OrderedDict{String, Any}(), # span from user stimulus -> multiples attempts -> final respond
- :keyword=> Dict{String, Any}(),
- )
+ memory = newAgentMemory()
# LLM function related
winestockResult = ""
@@ -152,13 +157,13 @@ function agentReflex(
"""
You need to gather all of the following info sequentially before you can recommend wine:
- 1. wine budget
- 2. wine type (rose, white, red, sparkling, dessert)
- 3. paring food that will be served with wine
- 4. wine sweetness level (dry to very sweet)
- 5. wine intensity level (light to full bodied)
- 6. wine tannin level (low to high)
- 7. wine acidity level (low to high)
+ 1. "wine budget"
+ 2. "wine type" (rose, white, red, sparkling, dessert)
+ 3. "food pairing" that will be served with wine
+ 4. "wine sweetness level" (dry to very sweet)
+ 5. "wine intensity level" (light to full bodied)
+ 6. "wine tannin level" (low to high)
+ 7. "wine acidity level" (low to high)
8. wine you have in stock that match the user preferences
"""