This commit is contained in:
narawat lamaiin
2024-05-05 22:51:53 +07:00
parent e43caf4919
commit 9e3ab1333b
5 changed files with 310 additions and 287 deletions

View File

@@ -47,7 +47,7 @@ julia> state = Dict(
# Signature
"""
struct MCTSNode{T<:AbstractDict}
mutable struct MCTSNode{T<:AbstractDict}
nodekey::String
state::T
visits::Integer
@@ -272,14 +272,14 @@ julia> thoughtDict = Dict(
```
# TODO
- [PENDING] add other actions
- [x] add other actions
- [] add embedding of newstate and store in newstate[:embedding]
# Signature
"""
function MCTStransition(a::T1, state::T2, thoughtDict::T3, isterminal::Function
)::Tuple{String, Dict{Symbol, <:Any}, Bool, <:Number} where {T1<:agent, T2<:AbstractDict, T3<:AbstractDict}
pprint(thoughtDict)
actionname = thoughtDict[:Action][:name]
actioninput = thoughtDict[:Action][:input]
@@ -288,11 +288,11 @@ function MCTStransition(a::T1, state::T2, thoughtDict::T3, isterminal::Function
if actionname == "chatbox"
virtualWineCustomerChatbox(a, actioninput) # virtual customer
elseif actionname == "winestock"
elseif actionname == "finish"
winestock(a, actioninput)
elseif actionname == "reccommendbox"
virtualWineCustomerReccommendbox(a, actioninput)
else
error("undefined LLM function. Requesting $actionname")
end
latestThoughtKey, latestThoughtIndice = GeneralUtils.findHighestIndexKey(state[:thoughtHistory],