This commit is contained in:
narawat lamaiin
2024-04-26 21:25:46 +07:00
parent 54fc9c67bc
commit 8f68d177e7
3 changed files with 173 additions and 140 deletions

View File

@@ -33,6 +33,122 @@ using ..type, ..util, ..llmfunction, ..mcts
# ---------------------------------------------- 100 --------------------------------------------- #
""" Think and choose action
Arguments\n
-----
state::T
a game state
Return\n
-----
thought::Dict
Example\n
-----
```jldoctest
julia>
```
TODO\n
-----
[] update docstring
[x] implement the function
[] implement RAG to pull similar experience
[] use iterative prompting to ensure JSON format
Signature\n
-----
"""
function decisionMaker(state::T) where {T<:AbstractDict}
customerinfo =
"""
I will give you the following information about customer:
$(JSON3.write(state[:customerinfo]))
"""
storeinfo =
"""
I will give you the following information about your store:
$(JSON3.write(state[:storeinfo]))
"""
#[x]
prompt =
"""
You are a helpful sommelier working for a wine store.
You helps users by searching wine that match the user preferences from your inventory.
$customerinfo
You must follow the
"""
thought = iterativeprompting(prompt, syntaxcheck_json)
error("--> decisionMaker")
return thought
end
"""
Arguments\n
-----
Return\n
-----
Example\n
-----
```jldoctest
julia>
```
TODO\n
-----
[] update docstring
[] implement the function
Signature\n
-----
"""
function stateValueEstimator()
end
"""
Arguments\n
-----
Return\n
-----
Example\n
-----
```jldoctest
julia>
```
TODO\n
-----
[] update docstring
[] implement the function
Signature\n
-----
"""
function reflector()
end
""" Chat with llm.
Arguments\n
@@ -117,8 +233,8 @@ function conversation(a::T, userinput::Dict) where {T<:agent}
:question=> userinput[:text],
)
)
bestplan = runMCTS(initialState, decisionMaker, stateValueEstimator, reflector,
3, 10, 1000, 1.0)
bestplan = runMCTS(a, initialState, decisionMaker, stateValueEstimator, reflector,
3, 10, 1000, 1.0)
error("---> bestplan")
# actor loop(bestplan)
@@ -178,6 +294,7 @@ end
end # module interface