From 7a3b574272121dc217952b06ccaa7b537d5c66d2 Mon Sep 17 00:00:00 2001 From: narawat lamaiin Date: Sun, 28 Apr 2024 11:17:06 +0700 Subject: [PATCH] update --- src/interface.jl | 41 ++++++++++++++++++----------------------- src/mcts.jl | 9 ++++++--- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index 67d638d..f236193 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -35,32 +35,27 @@ using ..type, ..util, ..llmfunction, ..mcts """ Think and choose action - Arguments\n - ----- - a::T1 - one of Yiem's agent - state::T2 - a game state - - Return\n - ----- - thought::Dict +# Arguments + `a::T1` + one of Yiem's agent + `state::T2` + a game state + +# Return + `thought::Dict` - Example\n - ----- - ```jldoctest - julia> - ``` +# Example +```jldoctest +julia> +``` - TODO\n - ----- - [] update docstring - [x] implement the function - [] implement RAG to pull similar experience - [] use iterative prompting to ensure JSON format +# TODO + [] update docstring + [x] implement the function + [] implement RAG to pull similar experience + [] use iterative prompting to ensure JSON format - Signature\n - ----- +# Signature """ function decisionMaker(a::T1, state::T2) where {T1<:agent, T2<:AbstractDict} customerinfo = diff --git a/src/mcts.jl b/src/mcts.jl index e4b4d04..a9b6705 100644 --- a/src/mcts.jl +++ b/src/mcts.jl @@ -134,14 +134,17 @@ function expand(a::T1, node::MCTSNode, state::T2, decisionMaker::Function, state # sampling action from decisionMaker for sample in 1:n - thought = decisionMaker(a, state) - + thoughtJstr = decisionMaker(a, state) + thoughtDict = copy(JSON3.read(thoughtJstr)) + latestActionKey = GeneralUtils.findHighestIndexKey(thoughtDict, "Action") + + error("--> expand") newState = transition(node.state, action) #[] Implement your transition function if newState ∉ keys(node.children) node.children[newState] = MCTSNode(newState, 0, 0.0, Dict{T, MCTSNode}()) end end - error("--> expand") + end """