diff --git a/src/interface.jl b/src/interface.jl index 88e343d..845d217 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -395,7 +395,6 @@ function evaluator(state::T1, text2textInstructLLM::Function - Do not generate additional thoughts or actions. 2) Answer_evaluation: - Focus only on the matter mentioned in the question and comprehensively analyze how the latest observation's details addresses the question - - State your rationale 3) Accepted_as_answer: Decide whether the latest observation's content answers the question. Can be "Yes" or "No" Bad example (The observation didn't answers the question): question: Find cars with 4 wheels. @@ -471,16 +470,15 @@ function evaluator(state::T1, text2textInstructLLM::Function responsedict = GeneralUtils.textToDict(response, header; dictKey=dictkey, symbolkey=true) - - # check if dict has all required value - trajectoryevaluation_text::AbstractString = responsedict[:trajectory_evaluation] - answerevaluation_text::AbstractString = responsedict[:answer_evaluation] - # responsedict[:score] = replace(responsedict[:score], r"\(.*?\)" => "") # remove (...) if there is any. + responsedict[:score] = responsedict[:score][1] # some time "6\nThe trajectories are incomplete" is generated but I only need the number. - responsedict[:score] = parse(Int, responsedict[:score]) # convert string "5" into integer 5 - score::Integer = responsedict[:score] + try + responsedict[:score] = parse(Int, responsedict[:score]) # convert string "5" into integer 5 + catch + continue + end + accepted_as_answer::AbstractString = responsedict[:accepted_as_answer] - suggestion::AbstractString = responsedict[:suggestion] if accepted_as_answer ∉ ["Yes", "No"] # [PENDING] add errornote into the prompt error("generated accepted_as_answer has wrong format") @@ -872,9 +870,9 @@ function query(query::T, executeSQL::Function, text2textInstructLLM::Function; earlystop(state) = state[:reward] >= 8 ? true : false _, _, resultState = LLMMCTS.runMCTS(initialstate, transition, transitionargs; - horizontalSampleExpansionPhase=3, + horizontalSampleExpansionPhase=5, horizontalSampleSimulationPhase=2, - maxSimulationDepth=10, + maxSimulationDepth=5, maxiterations=1, explorationweight=1.0, earlystop=earlystop, diff --git a/test/runtest.jl b/test/runtest.jl index 59dc514..31b0b20 100644 --- a/test/runtest.jl +++ b/test/runtest.jl @@ -51,9 +51,9 @@ function text2textInstructLLM(prompt::String; maxattempt=3) ) ) - response = nothing #[WORKING] receive nothing when LLM container reset + response = nothing for attempts in 1:maxattempt - _response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120, maxattempt=2) + _response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=180, maxattempt=2) response = _response[:response][:text] if response !== nothing break @@ -157,7 +157,7 @@ sessionId = "555" # query = Dict(:text=> "How many wines from France do you have that can be paired with lamb?") -query = "How many wines are from France?" +query = "How many French wines do you have?" # query = "retailer: Yiem, wine_type: red, sweetness: 1-2, intensity: 4-5, wine price: 20-40" # query = "wine_type: white, country: United States, sweetness: 1-2, tannin: 3, food to be served with wine: pizza" # query = "wine_type: white, country: Austria, food to be served with wine: pork"