add new method

This commit is contained in:
2023-10-09 12:50:07 +00:00
parent ca3aeec88a
commit 354b8a33b8

View File

@@ -13,11 +13,28 @@ using JSON3, DataStructures
sessionId::Int= 1
maxConversation::Int= 10
""" Dict(Role=> Content) ; Role can be system, user, assistant
Example:
messages=[
Dict(:role=>"system", :content=> "You are a helpful assistant."),
Dict(:role=>"assistant", :content=> "How may I help you"),
Dict(:role=>"user", :content=> "Hello, how are you"),
]
"""
# Ref: https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML/discussions/3
# {Role=> Content} ; Role can be system, user, assistant
messages::OrderedDict= OrderedDict(
:system=> "You are a helpful assistant.",
)
#
messages=[Dict(:role=>"system", :content=> "You are a helpful assistant."),]
end
function addNewMessage(a::agent, role::String, content::String)
d = Dict(:role=> role, :content=> content)
push!(a.messages, d)
end
function clearMessage(a::agent)
for i in eachindex(a.messages)
pop!(a.messages)
end
end
@@ -72,21 +89,6 @@ end