diff --git a/README.md b/README.md index 5e1c309..86267bd 100644 --- a/README.md +++ b/README.md @@ -1 +1,6 @@ -Hello World \ No newline at end of file +version 0.1.0 + Todo: + [WORKING] use MCTS for planning + + Change from version: 0.0.9 + - \ No newline at end of file diff --git a/src/interface.jl b/src/interface.jl index 2645385..f945f8e 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -47,18 +47,39 @@ using ..type, ..util, ..llmfunction Return\n ----- - inferenced text + messageleft Example\n ----- ```jldoctest - julia> using YiemAgent + julia> using YiemAgent, MQTTClient, GeneralUtils + julia> client, connection = MakeConnection("test.mosquitto.org", 1883) + julia> connect(client, connection) + julia> msgMeta = GeneralUtils.generate_msgMeta("testtopic") + julia> agentConfig = Dict( + :receiveprompt=>Dict( + :mqtttopic=> "testtopic/receive", + ), + :receiveinternal=>Dict( + :mqtttopic=> "testtopic/internal", + ), + :text2text=>Dict( + :mqtttopic=> "testtopic/text2text", + ), + ) + julia> a = YiemAgent.sommelier( + client, + msgMeta, + agentConfig, + ) + julia> addNewMessage(a, "user", "hello") ``` Signature\n ----- """ #WORKING -function addNewMessage(a::T1, role::String, text::T2) where {T1<:agent, T2<:AbstractString} +function addNewMessage(a::T1, role::String, text::T2; + maximumMsg::Integer=20)::Integer where {T1<:agent, T2<:AbstractString} if role ∉ a.availableRole # guard against typo error("role is not in agent.availableRole $(@__LINE__)") end @@ -72,14 +93,14 @@ function addNewMessage(a::T1, role::String, text::T2) where {T1<:agent, T2<:Abst end messageleft = 0 - if userMsg > a.maxUserMsg # delete all conversation + if userMsg > maximumMsg # delete all conversation clearMessage(a) - messageleft = a.maxUserMsg + messageleft = maximumMsg else userMsg += 1 d = Dict(:role=> role, :text=> text, :timestamp=> Dates.now()) push!(a.messages, d) - messageleft = a.maxUserMsg - userMsg + messageleft = maximumMsg - userMsg end return messageleft