This commit is contained in:
narawat lamaiin
2024-04-30 10:56:14 +07:00
parent 6c3ef4414b
commit bbdaa2248a
4 changed files with 79 additions and 68 deletions

View File

@@ -114,10 +114,10 @@ function decisionMaker(a::T1, state::T2)::String where {T1<:agent, T2<:AbstractD
You should only respond in JSON format as describe below:
{
"Thought_1": "reasoning",
"Thought_2": "reasoning",
"Thought_1": "reasoning 1",
"Thought_2": "reasoning 2",
...
"Thought_n": "reasoning",
"Thought_n": "reasoning n",
"Action_1": {"name": "action to take", "input": "Action input"},
"Observation_1": "result of the action"
}
@@ -131,10 +131,10 @@ function decisionMaker(a::T1, state::T2)::String where {T1<:agent, T2<:AbstractD
"Action_1": {"name": "chatbox", "input": "What will you use it for?"}
}
{
"Question": "I'm looking for a sedan.",
"Question": "I'm looking for a sedan with an automatic driving feature.",
"Thought_1": "I have many types of sedans in my inventory, each with diverse features.",
"Thought_2": "It would be easier to make a recommendation if I knew what feature the user is looking for. I should ask the user.",
"Action_1": {"name": "chatbox", "input": "Do you have any specific feature in mind?"}
"Thought_2": "But there is only 1 car that has the feature customer wanted.",
"Action_1": {"name": "finish", "input": "I recommend a Tesla model Y. It has your requested feature and much more."}
}
$reflect
@@ -304,18 +304,18 @@ function conversation(a::T, userinput::Dict) where {T<:agent}
else #[PENDING] new thinking
initialState = Dict(
initialState = Dict{Symbol, Any}(
# deepcopy the info to prevent modifying the info unintentionally during MCTS planning
:customerinfo=> deepcopy(a.keywordinfo[:customerinfo]),
:storeinfo=> deepcopy(a.keywordinfo[:storeinfo]),
:thoughtHistory=> Dict{Symbol, Any}( # contain question, thought_1, action_1, observation_1, thought_2, ...
:thoughtHistory=> OrderedDict{Symbol, Any}( # contain question, thought_1, action_1, observation_1, thought_2, ...
:Question=> userinput[:text],
)
)
)
)
bestplan = runMCTS(a, initialState, decisionMaker, stateValueEstimator, reflector,
isterminal, 3, 10, 1000, 1.0)
isterminal, 2, 10, 1000, 1.0)
error("---> bestplan")
# actor loop(bestplan)