diff --git a/src/interface.jl b/src/interface.jl index b6fdc0d..16b3b33 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -93,7 +93,7 @@ julia> output_thoughtDict = Dict( - [] implement RAG to pull similar experience - [] use customerinfo - [] user storeinfo - - [x] add try block. check result that it is expected before returning + - BUG LLM recommend wine before check inventory # Signature """ @@ -219,6 +219,10 @@ function decisionMaker(a::T)::Dict{Symbol, Any} where {T<:agent} Context: ... Your earlier conversation with the user: ... + You MUST follow the following guidelines: + - Check your inventory before recommending any wine to the user + - Only recommending wine from your inventory. + You should follow the following guidelines as you see fit: - If the user interrupts, prioritize the user. - Get to know how much the user willing to spend @@ -226,13 +230,8 @@ function decisionMaker(a::T)::Dict{Symbol, Any} where {T<:agent} - Get to know what occasion the user is buying wine for - Get to know what characteristics of wine the user is looking for e.g. tannin, sweetness, intensity, acidity - Get to know what food will be served with wine - - With enough user information, search your inventory - - Recommend the wines to the user - - After recommending wine to the user, ask the customer if there is anything else you can help with. If the customer doesn’t need anything else, finish the conversation. - - You MUST follow the following guidelines: - - Do not mentioning any wine until you've check your inventory - - Do not ask what the user already told you + - Based on the user's information, check your inventory and recommend a suitable wine from your stock. + - After recommending wine to the user, ask the customer if there is anything else you can help with. If the customer doesn't need anything else, finish the conversation. You should then respond to the user with interleaving Thought, Plan, Action and Observation: - thought: @@ -256,7 +255,7 @@ function decisionMaker(a::T)::Dict{Symbol, Any} where {T<:agent} Let's begin! """ - context = length(a.memory[:shortmem]) > 0 ? vectorOfDictToText(memory[:shortmem], withkey=false) : "None" + context = length(a.memory[:shortmem]) > 0 ? vectorOfDictToText(a.memory[:shortmem], withkey=false) : "None" usermsg = """ @@ -995,8 +994,6 @@ function conversation(a::T, userinput::Dict) where {T<:agent} return chatresponse end - - end """ @@ -1206,8 +1203,7 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F Your current thoughts in your mind: ... You must follow the following guidelines: - - Do not mentioning any wine until you've check your inventory. - - Check your inventory before recommending any specific wine. + - Check your inventory before mentioning any wine or region to the user - Your thoughts matter. - Do not offer the user to try wine as you are internet-based agent. @@ -1220,11 +1216,11 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F Let's begin! """ - context = length(memory[:shortmem]) > 0 ? vectorOfDictToText(memory[:shortmem], withkey=false) : "None" + context_1 = length(memory[:shortmem]) > 0 ? vectorOfDictToText(memory[:shortmem], withkey=false) : "None" usermsg = """ - Context: $context + Context: $context_1 Your earlier conversation with the user: $(vectorOfDictToText(chathistory)) Your thoughts: $(memory[:chatbox]) """ diff --git a/src/llmfunction.jl b/src/llmfunction.jl index ab3e4de..9ba1a8c 100644 --- a/src/llmfunction.jl +++ b/src/llmfunction.jl @@ -477,7 +477,7 @@ function extractWineAttributes_2(a::T1, input::T2 3) Do not generate other comments. You should then respond to the user with the following points: - - repeat: repeat the user query exactly + - repeat: State the user query - sweetness: S where S are integers represent the range of sweetness levels Example: 1-2 - acidity: D where D are integers represent the range of acidity level diff --git a/test/runtest.jl b/test/runtest.jl index fd25c34..53636fa 100644 --- a/test/runtest.jl +++ b/test/runtest.jl @@ -89,8 +89,8 @@ main() """ I'm having a graduation party this evening. I have no budget limit. I want a bottle of dry white wine. -I have no idea. The party will be casual. I like medium bodied wine from France. -What about sparkling Rose? +I have no idea but I like medium bodied wine from France. The party will be casual. +The latter one seems nice. """