This commit is contained in:
narawat lamaiin
2024-04-29 17:55:13 +07:00
parent 85240c5fb8
commit 8f95f08695
4 changed files with 21 additions and 22 deletions

View File

@@ -145,7 +145,7 @@ function decisionMaker(a::T1, state::T2)::String where {T1<:agent, T2<:AbstractD
prompt = formatLLMtext_llama3instruct("system", _prompt) prompt = formatLLMtext_llama3instruct("system", _prompt)
msgMeta = GeneralUtils.generate_msgMeta( msgMeta = GeneralUtils.generate_msgMeta(
a.config[:externalService][:text2textinstruct], a.config[:externalService][:text2textinstruct][:mqtttopic],
senderName= "decisionMaker", senderName= "decisionMaker",
senderId= a.id, senderId= a.id,
receiverName= "text2textinstruct", receiverName= "text2textinstruct",

View File

@@ -21,12 +21,15 @@ julia>
# TODO # TODO
- [] update docstring - [] update docstring
- [] implement the function - [WORKING] implement the function
# Signature # 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 # put in model format
if a.config[:externalService][]
GeneralUtils.formatLLMtext_llama3instruct
end end
""" Search wine in stock. """ Search wine in stock.

View File

@@ -232,18 +232,20 @@ julia>
""" """
function transition(a::T1, state::T2, action::T3, function transition(a::T1, state::T2, action::T3,
actioninput::T3) where {T1<:agent, T2<:AbstractDict, T3<:AbstractString} actioninput::T3) where {T1<:agent, T2<:AbstractDict, T3<:AbstractString}
error("--> transition")
# map action and input() to llm function # map action and input() to llm function
# result = result =
# if action == "chatbox" if action == "chatbox"
# chatbox(input) chatbox(a, input)
# elseif elseif action == "winestock"
# else elseif action == "finish"
# end else
end
error("--> transition")
end end

View File

@@ -8,30 +8,24 @@ config = copy(JSON3.read("config.json"))
instanceInternalTopic = config[:serviceInternalTopic][:mqtttopic] * "/1" instanceInternalTopic = config[:serviceInternalTopic][:mqtttopic] * "/1"
client, connection = MakeConnection(config[:mqttServerInfo][:value][:broker], client, connection = MakeConnection(config[:mqttServerInfo][:broker],
config[:mqttServerInfo][:value][:port]) config[:mqttServerInfo][:port])
receiveUserMsgChannel = Channel{Dict}(4) receiveUserMsgChannel = Channel{Dict}(4)
receiveInternalMsgChannel = Channel{Dict}(4) receiveInternalMsgChannel = Channel{Dict}(4)
msgMeta = GeneralUtils.generate_msgMeta( msgMeta = GeneralUtils.generate_msgMeta(
"N/A", "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( agentConfig = Dict(
:mqttServerInfo=> Dict( :mqttServerInfo=> config[:mqttServerInfo],
:broker=> config[:mqttServerInfo][:value][:broker],
:port=> config[:mqttServerInfo][:value][:port],
),
:receivemsg=> Dict( :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, :internal=> instanceInternalTopic,
), ),
:externalService=> Dict( :externalService=> config[:externalService],
:text2textinstruct=> config[:externalService][:text2textinstruct][:value],
:text2textchat=> config[:externalService][:text2textchat][:value],
),
) )
# Instantiate an agent # Instantiate an agent