This commit is contained in:
narawat lamaiin
2024-04-27 19:22:19 +07:00
parent db42a55e00
commit 56935a6aae
3 changed files with 28 additions and 5 deletions

View File

@@ -121,7 +121,8 @@ function decisionMaker(a::T1, state::T2) where {T1<:agent, T2<:AbstractDict}
"Question": "I would like to buy a sedan",
"Thought_1": "I have many car in my inventory suitable for several usage scenarios",
"Thought_2": "It would be better if I know what the user intend to do with his car",
"Thought_3": "
"Thought_3": "I will ask the user what is the intended usecase",
"Action_1": "Chatbox[What will you use it for?]"
}
$reflect
@@ -131,7 +132,28 @@ function decisionMaker(a::T1, state::T2) where {T1<:agent, T2<:AbstractDict}
prompt = formatLLMtext_llama3instruct("system", _prompt)
thought = iterativeprompting(a, prompt, syntaxcheck_json)
msgMeta = GeneralUtils.generate_msgMeta(
a.config[:externalService][:text2textinstruct],
senderName= "iterativeprompting",
senderId= a.id,
receiverName= "text2textinstruct",
mqttBroker= a.config[:mqttServerInfo][:broker],
mqttBrokerPort= a.config[:mqttServerInfo][:port],
)
outgoingMsg = Dict(
:msgMeta=> msgMeta,
:payload=> Dict(
:text=> prompt,
)
)
@show outgoingMsg
thought = GeneralUtils.sendReceiveMqttMsg(outgoingMsg)
# thought = iterativeprompting(a, prompt, syntaxcheck_json)
@@ -310,7 +332,7 @@ function conversation(a::T, userinput::Dict) where {T<:agent}
)
)
bestplan = runMCTS(a, initialState, decisionMaker, stateValueEstimator, reflector,
3, 10, 1000, 1.0)
isterminal, 3, 10, 1000, 1.0)
error("---> bestplan")
# actor loop(bestplan)

View File

@@ -345,7 +345,8 @@ function runMCTS(
isterminal::Function,
n::Integer,
maxDepth::Integer,
maxIterations::Integer, w::Float64) where {T1<:agent}
maxIterations::Integer,
w::Float64) where {T1<:agent}
statetype = typeof(initialState)
root = MCTSNode(initialState, 0, 0.0, Dict{statetype, MCTSNode}())