diff --git a/src/interface.jl b/src/interface.jl index 7ef5533..a547066 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -175,7 +175,8 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen - Do not ask the user about wine's flavor e.g. floral, citrusy, nutty or some thing similar as these terms cannot be used to search the database. - Once the user has selected their wine, ask the user if they need any further assistance. Do not offer any additional services. If the user doesn't need any further assistance, say goodbye and invite them to come back next time. - You should follow the following guidelines: + Tips: + - Understanding the user's preferences is key in helping them find the best wine. - Identifying at least four preferences before checking inventory significantly improves search results - Sometimes, the item a user desires might not be available in your inventory. In such cases, inform the user that the item is unavailable and suggest an alternative instead. @@ -957,7 +958,7 @@ function generatechat(a::sommelier, thought::T) where {T<:AbstractString} println("\n~~~ generatechat() ", @__FILE__, " ", @__LINE__) pprintln(Dict(responsedict)) - #[WORKING] check whether an agent recommend wines before checking inventory or recommend wines + # check whether an agent recommend wines before checking inventory or recommend wines # outside its inventory # ask LLM whether there are any winery mentioned in the response mentioned_winery = detectWineryName(a, responsedict[:chat]) diff --git a/src/llmfunction.jl b/src/llmfunction.jl index 145798b..16e8d04 100644 --- a/src/llmfunction.jl +++ b/src/llmfunction.jl @@ -289,6 +289,9 @@ julia> result = checkinventory(agent, input) """ function checkinventory(a::T1, input::T2 ) where {T1<:agent, T2<:AbstractString} + + # [WORKING] make sure input has no french or german character + println("\n~~~ checkinventory order: $input ", @__FILE__, " ", @__LINE__) wineattributes_1 = extractWineAttributes_1(a, input) wineattributes_2 = extractWineAttributes_2(a, input) @@ -428,6 +431,8 @@ function extractWineAttributes_1(a::T1, input::T2)::String where {T1<:agent, T2< responsedict = GeneralUtils.textToDict(response, attributes, rightmarker=":", symbolkey=true) + #[WORKING] check if winery, wine_name, region, country, wine_type, grape_variety are in the query because sometime AI halucinates + for i ∈ attributes if length(JSON3.write(responsedict[Symbol(i)])) == 0 error("$i is empty ", @__LINE__)