This commit is contained in:
narawat lamaiin
2024-04-27 08:35:35 +07:00
parent aacae344c2
commit 4a41b0feb4
5 changed files with 121 additions and 123 deletions

View File

@@ -1,6 +1,6 @@
module interface
export addNewMessage, conversation
export addNewMessage, conversation, decisionMaker
using JSON3, DataStructures, Dates, UUIDs, HTTP, Random, MQTTClient
using GeneralUtils
@@ -60,7 +60,7 @@ using ..type, ..util, ..llmfunction, ..mcts
Signature\n
-----
"""
function decisionMaker(state::T) where {T<:AbstractDict}
function decisionMaker(a::T1, state::T2) where {T1<:agent, T2<:AbstractDict}
customerinfo =
"""
I will give you the following information about customer:
@@ -73,8 +73,8 @@ function decisionMaker(state::T) where {T<:AbstractDict}
$(JSON3.write(state[:storeinfo]))
"""
#[x]
prompt =
#[WORKING]
_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.
@@ -84,9 +84,9 @@ function decisionMaker(state::T) where {T<:AbstractDict}
You must follow the
"""
prompt = formatLLMtext_llama3instruct("system", _prompt)
thought = iterativeprompting(prompt, syntaxcheck_json)
thought = iterativeprompting(a, prompt, syntaxcheck_json)
error("--> decisionMaker")
@@ -227,7 +227,8 @@ function conversation(a::T, userinput::Dict) where {T<:agent}
initialState = Dict(
# deepcopy the info to prevent modifying the info unintentionally during MCTS planning
:info=> deepcopy(a.keywordinfo),
:customerinfo=> deepcopy(a.keywordinfo[:customerinfo]),
:storeinfo=> deepcopy(a.keywordinfo[:storeinfo]),
:thoughtHistory=> Dict{Symbol, Any}( # contain question, thought_1, action_1, observation_1, thought_2, ...
:question=> userinput[:text],