diff --git a/src/interface.jl b/src/interface.jl index d9cce19..e2b648a 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -145,7 +145,7 @@ function decisionMaker(a::T1, state::T2)::String where {T1<:agent, T2<:AbstractD prompt = formatLLMtext_llama3instruct("system", _prompt) msgMeta = GeneralUtils.generate_msgMeta( - a.config[:externalService][:text2textinstruct], + a.config[:externalService][:text2textinstruct][:mqtttopic], senderName= "decisionMaker", senderId= a.id, receiverName= "text2textinstruct", diff --git a/src/llmfunction.jl b/src/llmfunction.jl index ee30e5c..03baaa6 100644 --- a/src/llmfunction.jl +++ b/src/llmfunction.jl @@ -21,12 +21,15 @@ julia> # TODO - [] update docstring - - [] implement the function + - [WORKING] implement the function # Signature """ -function chatbox(input::T) where {T<:AbstractString} +function chatbox(a::T1, input::T2) where {T1<:agent, T2<:AbstractString} + error("--> chatbox") # put in model format + if a.config[:externalService][] + GeneralUtils.formatLLMtext_llama3instruct end """ Search wine in stock. diff --git a/src/mcts.jl b/src/mcts.jl index b4e568f..013de73 100644 --- a/src/mcts.jl +++ b/src/mcts.jl @@ -232,18 +232,20 @@ julia> """ function transition(a::T1, state::T2, action::T3, actioninput::T3) where {T1<:agent, T2<:AbstractDict, T3<:AbstractString} -error("--> transition") + # map action and input() to llm function - # result = - # if action == "chatbox" - # chatbox(input) - # elseif + result = + if action == "chatbox" + chatbox(a, input) + elseif action == "winestock" - # else + elseif action == "finish" - # end + else + end + error("--> transition") end diff --git a/test/runtest.jl b/test/runtest.jl index d425e83..9928e9e 100644 --- a/test/runtest.jl +++ b/test/runtest.jl @@ -8,30 +8,24 @@ config = copy(JSON3.read("config.json")) instanceInternalTopic = config[:serviceInternalTopic][:mqtttopic] * "/1" -client, connection = MakeConnection(config[:mqttServerInfo][:value][:broker], - config[:mqttServerInfo][:value][:port]) +client, connection = MakeConnection(config[:mqttServerInfo][:broker], + config[:mqttServerInfo][:port]) receiveUserMsgChannel = Channel{Dict}(4) receiveInternalMsgChannel = Channel{Dict}(4) msgMeta = GeneralUtils.generate_msgMeta( "N/A", - replyTopic = config[:servicetopic][:value] # ask frontend reply to this instance_chat_topic + replyTopic = config[:servicetopic][:mqtttopic] # ask frontend reply to this instance_chat_topic ) agentConfig = Dict( - :mqttServerInfo=> Dict( - :broker=> config[:mqttServerInfo][:value][:broker], - :port=> config[:mqttServerInfo][:value][:port], - ), + :mqttServerInfo=> config[:mqttServerInfo], :receivemsg=> Dict( - :prompt=> config[:servicetopic][:value], # topic to receive prompt i.e. frontend send msg to this topic + :prompt=> config[:servicetopic][:mqtttopic], # topic to receive prompt i.e. frontend send msg to this topic :internal=> instanceInternalTopic, ), - :externalService=> Dict( - :text2textinstruct=> config[:externalService][:text2textinstruct][:value], - :text2textchat=> config[:externalService][:text2textchat][:value], - ), + :externalService=> config[:externalService], ) # Instantiate an agent