This commit is contained in:
narawat lamaiin
2024-05-12 13:30:04 +07:00
parent 898fa46af0
commit 8431258f1c
2 changed files with 19 additions and 43 deletions

View File

@@ -1,6 +1,6 @@
module interface
export addNewMessage, conversation, decisionMaker, progressValueEstimator, reflector
export addNewMessage, conversation, decisionMaker, evaluator, reflector
# isterminal,
using JSON3, DataStructures, Dates, UUIDs, HTTP, Random, MQTTClient, PrettyPrinting
@@ -264,7 +264,7 @@ julia>
# Signature
"""
function progressValueEstimator(a::T1, state::T2)::Tuple{String, Integer} where {T1<:agent, T2<:AbstractDict}
function evaluator(a::T1, state::T2)::Tuple{String, Integer} where {T1<:agent, T2<:AbstractDict}
_prompt =
"""
@@ -279,7 +279,7 @@ function progressValueEstimator(a::T1, state::T2)::Tuple{String, Integer} where
analysis in detail. Focus on the latest thought, action, and observation. Incomplete trajectories
can be correct if the thoughts and actions so far are correct, even if the answer is not found
yet. Do not generate additional thoughts or actions. Then ending with the correctness score s
where s is an integer from 1 to 10.
where s is an integer from 0 to 10.
You should only respond in JSON format as describe below:
{"evaluation": "your evaluation", "score": "your evaluation score"}
@@ -295,7 +295,7 @@ function progressValueEstimator(a::T1, state::T2)::Tuple{String, Integer} where
}
{"evaluation": "This trajectory is correct as it is reasonable to check an inventory for info provided in the question.
It is also better to have simple searches corresponding to a single entity, making this the best action.",
"score": 10
"score": 7
}
{
@@ -309,7 +309,7 @@ function progressValueEstimator(a::T1, state::T2)::Tuple{String, Integer} where
}
{"evaluation": "This trajectory is incorrect as my search term should be related to a 4-colors pen with a pencil in it,
not a pen and a pencil seperately. A better search term should have been a 4-colors pen with a pencil, all-in-one.",
"score": 2
"score": 3
}
Let's begin!:
@@ -329,7 +329,7 @@ function progressValueEstimator(a::T1, state::T2)::Tuple{String, Integer} where
msgMeta = GeneralUtils.generate_msgMeta(
a.config[:externalservice][:text2textinstruct][:mqtttopic],
senderName= "progressValueEstimator",
senderName= "evaluator",
senderId= a.id,
receiverName= "text2textinstruct",
mqttBroker= a.config[:mqttServerInfo][:broker],
@@ -374,7 +374,7 @@ function progressValueEstimator(a::T1, state::T2)::Tuple{String, Integer} where
println("")
end
end
error("progressValueEstimator failed to generate an evaluation")
error("evaluator failed to generate an evaluation")
end
@@ -640,7 +640,7 @@ function conversation(a::T, userinput::Dict) where {T<:agent}
:question=> userinput[:text],
)
)
bestplan = runMCTS(a, initialState, decisionMaker, progressValueEstimator, reflector,
bestplan = runMCTS(a, initialState, decisionMaker, evaluator, reflector,
2, 3, 4, 1.0)
error("---> bestplan")