This commit is contained in:
2025-01-04 16:10:23 +07:00
parent 82167fe006
commit cff0d31ae6
4 changed files with 349 additions and 443 deletions
+17 -18
View File
@@ -11,8 +11,8 @@ abstract type agent end
mutable struct companion <: agent
name::String # agent name
id::String # agent id
systemmsg::Union{String, Nothing}
maxHistoryMsg::Integer # e.g. 21th and earlier messages will get summarized
""" Memory
@@ -34,8 +34,8 @@ end
function companion(
text2textInstructLLM::Function
;
name::String= "Assistant",
id::String= string(uuid4()),
systemmsg::Union{String, Nothing}= nothing,
maxHistoryMsg::Integer= 20,
chathistory::Vector{Dict{Symbol, String}} = Vector{Dict{Symbol, String}}(),
)
@@ -48,13 +48,13 @@ function companion(
)
newAgent = companion(
name,
id,
maxHistoryMsg,
chathistory,
memory,
text2textInstructLLM
)
id,
systemmsg,
maxHistoryMsg,
chathistory,
memory,
text2textInstructLLM
)
return newAgent
end
@@ -146,7 +146,6 @@ mutable struct sommelier <: agent
"""
chathistory::Vector{Dict{Symbol, Any}}
memory::Dict{Symbol, Any}
func # NamedTuple of functions
end
@@ -179,14 +178,14 @@ function sommelier(
# ),
)
memory = Dict{Symbol, Any}(
:chatbox=> "",
:shortmem=> OrderedDict{Symbol, Any}(),
:events=> Vector{Dict{Symbol, Any}}(),
:state=> Dict{Symbol, Any}(
:wine_presented_to_user=> "None",
),
)
memory = Dict{Symbol, Any}(
:chatbox=> "",
:shortmem=> OrderedDict{Symbol, Any}(),
:events=> Vector{Dict{Symbol, Any}}(),
:state=> Dict{Symbol, Any}(
:wine_presented_to_user=> "None",
),
)
newAgent = sommelier(
name,