From 56935a6aae6166bd155f15ab196117be943a5440 Mon Sep 17 00:00:00 2001 From: narawat lamaiin Date: Sat, 27 Apr 2024 19:22:19 +0700 Subject: [PATCH] update --- src/interface.jl | 28 +++++++++++++++++++++++++--- src/mcts.jl | 3 ++- test/runtest.jl | 2 +- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index ed19a5c..731ba5c 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -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) diff --git a/src/mcts.jl b/src/mcts.jl index 7a57a6c..004459d 100644 --- a/src/mcts.jl +++ b/src/mcts.jl @@ -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}()) diff --git a/test/runtest.jl b/test/runtest.jl index 415f0b9..f33ae22 100644 --- a/test/runtest.jl +++ b/test/runtest.jl @@ -65,7 +65,7 @@ tools=Dict( # update input format tools=tools, ) -response = YiemAgent.conversation(a, Dict(:text=> "hello", ) ) +response = YiemAgent.conversation(a, Dict(:text=> "Hello, I would like a get a bottle of wine",) )