using Revise # remove when this package is completed
using YiemAgent, GeneralUtils, JSON3, MQTTClient, Dates, UUIDs
using Base.Threads
# ---------------------------------------------- 100 --------------------------------------------- #
config = copy(JSON3.read("config.json"))
instanceInternalTopic = config[:serviceInternalTopic][:mqtttopic] * "/1"
client, connection = MakeConnection(config[:mqttServerInfo][:value][:broker],
config[:mqttServerInfo][:value][: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
)
agentConfig = Dict(
:mqttServerInfo=> Dict(
:broker=> config[:mqttServerInfo][:value][:broker],
:port=> config[:mqttServerInfo][:value][:port],
),
:receivemsg=> Dict(
:prompt=> config[:servicetopic][:value], # 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],
),
)
# Instantiate an agent
tools=Dict( # update input format
"askbox"=> Dict(
:description => "Useful for when you need to ask the user for more context. Do not ask the user their own question.",
:input => """Input is a text in JSON format.{\"Q1\": \"How are you doing?\", \"Q2\": \"How may I help you?\"}""",
:output => "" ,
:func => nothing,
),
# "winestock"=> Dict(
# :description => "A handy tool for searching wine in your inventory that match the user preferences.",
# :input => """Input is a JSON-formatted string that contains a detailed and precise search query.{\"wine type\": \"rose\", \"price\": \"max 35\", \"sweetness level\": \"sweet\", \"intensity level\": \"light bodied\", \"Tannin level\": \"low\", \"Acidity level\": \"low\"}""",
# :output => """