diff --git a/Manifest.toml b/Manifest.toml index eb23968..72d2e1d 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -1,6 +1,6 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.11.0" +julia_version = "1.10.5" manifest_format = "2.0" project_hash = "bf6c32becbc917fa1c33558e7aa59c1aac5237e3" @@ -12,15 +12,13 @@ version = "1.1.3" [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" -version = "1.1.2" +version = "1.1.1" [[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" -version = "1.11.0" [[deps.Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" -version = "1.11.0" [[deps.BitFlags]] git-tree-sha1 = "0691e34b3bb8be9307330f88d1a3c3f25466c24d" @@ -112,7 +110,6 @@ version = "1.0.0" [[deps.Dates]] deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" -version = "1.11.0" [[deps.Decimals]] git-tree-sha1 = "e98abef36d02a0ec385d68cd7dadbce9b28cbd88" @@ -122,7 +119,6 @@ version = "0.4.1" [[deps.Distributed]] deps = ["Random", "Serialization", "Sockets"] uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" -version = "1.11.0" [[deps.Distributions]] deps = ["AliasTables", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SpecialFunctions", "Statistics", "StatsAPI", "StatsBase", "StatsFuns"] @@ -181,7 +177,6 @@ weakdeps = ["Mmap", "Test"] [[deps.FileWatching]] uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" -version = "1.11.0" [[deps.FillArrays]] deps = ["LinearAlgebra"] @@ -198,7 +193,6 @@ weakdeps = ["PDMats", "SparseArrays", "Statistics"] [[deps.Future]] deps = ["Random"] uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" -version = "1.11.0" [[deps.GeneralUtils]] deps = ["CSV", "DataFrames", "DataStructures", "Dates", "Distributions", "JSON3", "MQTTClient", "PrettyPrinting", "Random", "SHA", "UUIDs"] @@ -246,7 +240,6 @@ version = "1.4.2" [[deps.InteractiveUtils]] deps = ["Markdown"] uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" -version = "1.11.0" [[deps.Intervals]] deps = ["Dates", "Printf", "RecipesBase", "Serialization", "TimeZones"] @@ -282,9 +275,9 @@ version = "1.6.1" [[deps.JSON3]] deps = ["Dates", "Mmap", "Parsers", "PrecompileTools", "StructTypes", "UUIDs"] -git-tree-sha1 = "eb3edce0ed4fa32f75a0a11217433c31d56bd48b" +git-tree-sha1 = "1d322381ef7b087548321d3f878cb4c9bd8f8f9b" uuid = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" -version = "1.14.0" +version = "1.14.1" [deps.JSON3.extensions] JSON3ArrowExt = ["ArrowTypes"] @@ -311,9 +304,9 @@ uuid = "d76c5a4d-449e-4835-8cc4-dd86ec44f241" version = "0.1.0" [[deps.LaTeXStrings]] -git-tree-sha1 = "50901ebc375ed41dbf8058da26f9de442febbbec" +git-tree-sha1 = "dda21b8cbd6a6c40d9d02a73230f9d70fed6918c" uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" -version = "1.3.1" +version = "1.4.0" [[deps.LayerDicts]] git-tree-sha1 = "6087ad3521d6278ebe5c27ae55e7bbb15ca312cb" @@ -323,7 +316,6 @@ version = "1.0.0" [[deps.LazyArtifacts]] deps = ["Artifacts", "Pkg"] uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" -version = "1.11.0" [[deps.LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] @@ -333,17 +325,16 @@ version = "0.6.4" [[deps.LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "8.6.0+0" +version = "8.4.0+0" [[deps.LibGit2]] deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" -version = "1.11.0" [[deps.LibGit2_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" -version = "1.7.2+0" +version = "1.6.4+0" [[deps.LibPQ]] deps = ["CEnum", "DBInterface", "Dates", "Decimals", "DocStringExtensions", "FileWatching", "Infinity", "Intervals", "IterTools", "LayerDicts", "LibPQ_jll", "Libdl", "Memento", "OffsetArrays", "SQLStrings", "Tables", "TimeZones", "UTCDateTimes"] @@ -364,12 +355,10 @@ version = "1.11.0+1" [[deps.Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" -version = "1.11.0" [[deps.LinearAlgebra]] deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -version = "1.11.0" [[deps.LogExpFunctions]] deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"] @@ -389,7 +378,6 @@ version = "0.3.28" [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" -version = "1.11.0" [[deps.LoggingExtras]] deps = ["Dates", "Logging"] @@ -399,9 +387,9 @@ version = "1.0.3" [[deps.LoweredCodeUtils]] deps = ["JuliaInterpreter"] -git-tree-sha1 = "96d2a4a668f5c098fb8a26ce7da53cde3e462a80" +git-tree-sha1 = "260dc274c1bc2cb839e758588c63d9c8b5e639d1" uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b" -version = "3.0.3" +version = "3.0.5" [[deps.MQTTClient]] deps = ["Distributed", "Random", "Sockets"] @@ -422,7 +410,6 @@ version = "0.5.13" [[deps.Markdown]] deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" -version = "1.11.0" [[deps.MbedTLS]] deps = ["Dates", "MbedTLS_jll", "MozillaCACerts_jll", "NetworkOptions", "Random", "Sockets"] @@ -433,7 +420,7 @@ version = "1.1.9" [[deps.MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.6+0" +version = "2.28.2+1" [[deps.Memento]] deps = ["Dates", "Distributed", "Requires", "Serialization", "Sockets", "Test", "UUIDs"] @@ -455,7 +442,6 @@ version = "1.2.0" [[deps.Mmap]] uuid = "a63ad114-7e13-5084-954f-fe012c677804" -version = "1.11.0" [[deps.Mocking]] deps = ["Compat", "ExprTools"] @@ -465,7 +451,7 @@ version = "0.8.1" [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2023.12.12" +version = "2023.1.10" [[deps.NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" @@ -485,7 +471,7 @@ version = "1.14.1" [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.27+1" +version = "0.3.23+4" [[deps.OpenLibm_jll]] deps = ["Artifacts", "Libdl"] @@ -534,13 +520,9 @@ uuid = "fa939f87-e72e-5be4-a000-7fc836dbe307" version = "1.3.0" [[deps.Pkg]] -deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "Random", "SHA", "TOML", "Tar", "UUIDs", "p7zip_jll"] +deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.11.0" -weakdeps = ["REPL"] - - [deps.Pkg.extensions] - REPLExt = "REPL" +version = "1.10.0" [[deps.PooledArrays]] deps = ["DataAPI", "Future"] @@ -574,7 +556,6 @@ version = "2.4.0" [[deps.Printf]] deps = ["Unicode"] uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" -version = "1.11.0" [[deps.PtrArrays]] git-tree-sha1 = "77a42d78b6a92df47ab37e177b2deac405e1c88f" @@ -600,14 +581,12 @@ version = "2.11.1" Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9" [[deps.REPL]] -deps = ["InteractiveUtils", "Markdown", "Sockets", "StyledStrings", "Unicode"] +deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" -version = "1.11.0" [[deps.Random]] deps = ["SHA"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" -version = "1.11.0" [[deps.RecipesBase]] deps = ["PrecompileTools"] @@ -628,9 +607,9 @@ version = "1.3.0" [[deps.Revise]] deps = ["CodeTracking", "Distributed", "FileWatching", "JuliaInterpreter", "LibGit2", "LoweredCodeUtils", "OrderedCollections", "REPL", "Requires", "UUIDs", "Unicode"] -git-tree-sha1 = "2d4e5de3ac1c348fd39ddf8adbef82aa56b65576" +git-tree-sha1 = "7f4228017b83c66bd6aa4fddeb170ce487e53bc7" uuid = "295af30f-e4ad-537b-8983-00126c2a3abe" -version = "3.6.1" +version = "3.6.2" [[deps.Rmath]] deps = ["Random", "Rmath_jll"] @@ -673,7 +652,6 @@ version = "1.4.5" [[deps.Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" -version = "1.11.0" [[deps.SimpleBufferStream]] git-tree-sha1 = "f305871d2f381d21527c770d4788c06c097c9bc1" @@ -682,7 +660,6 @@ version = "1.2.0" [[deps.Sockets]] uuid = "6462fe0b-24de-5631-8697-dd941f90decc" -version = "1.11.0" [[deps.SortingAlgorithms]] deps = ["DataStructures"] @@ -693,7 +670,7 @@ version = "1.2.1" [[deps.SparseArrays]] deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -version = "1.11.0" +version = "1.10.0" [[deps.SpecialFunctions]] deps = ["IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] @@ -708,14 +685,9 @@ version = "2.4.0" ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" [[deps.Statistics]] -deps = ["LinearAlgebra"] -git-tree-sha1 = "ae3bb1eb3bba077cd276bc5cfc337cc65c3075c0" +deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -version = "1.11.1" -weakdeps = ["SparseArrays"] - - [deps.Statistics.extensions] - SparseArraysExt = ["SparseArrays"] +version = "1.10.0" [[deps.StatsAPI]] deps = ["LinearAlgebra"] @@ -755,10 +727,6 @@ git-tree-sha1 = "159331b30e94d7b11379037feeb9b690950cace8" uuid = "856f2bd8-1eba-4b0a-8007-ebc267875bd4" version = "1.11.0" -[[deps.StyledStrings]] -uuid = "f489334b-da3d-4c2e-b8f0-e476e12c162b" -version = "1.11.0" - [[deps.SuiteSparse]] deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9" @@ -766,7 +734,7 @@ uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9" [[deps.SuiteSparse_jll]] deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" -version = "7.7.0+0" +version = "7.2.1+1" [[deps.TOML]] deps = ["Dates"] @@ -799,7 +767,6 @@ version = "1.10.0" [[deps.Test]] deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -version = "1.11.0" [[deps.TimeZones]] deps = ["Dates", "Downloads", "InlineStrings", "Mocking", "Printf", "Scratch", "TZJData", "Unicode", "p7zip_jll"] @@ -830,11 +797,9 @@ version = "1.6.1" [[deps.UUIDs]] deps = ["Random", "SHA"] uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" -version = "1.11.0" [[deps.Unicode]] uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" -version = "1.11.0" [[deps.UnsafePointers]] git-tree-sha1 = "c81331b3b2e60a982be57c046ec91f599ede674a" @@ -877,7 +842,7 @@ version = "1.5.8+0" [[deps.nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.59.0+0" +version = "1.52.0+1" [[deps.p7zip_jll]] deps = ["Artifacts", "Libdl"] diff --git a/src/interface.jl b/src/interface.jl index d38d67b..eb7cd1d 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -125,7 +125,7 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen systemmsg = """ - Your name is $(a.name). You are a helpful assistant acting as a polite, website-based sommelier for $(a.retailername)'s online store. + Your name is $(a.name). You are a helpful English-speaking assistant, acting as a polite, website-based sommelier for $(a.retailername)'s online store. Your goal includes: 1) Get to know the user preferences about wine 2) Help them select the best wines from your inventory that align with their preferences @@ -167,7 +167,7 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen - CHATBOX which you can use to talk with the user. The input is your intentions for the dialogue. Be specific. - CHECKINVENTORY which you can use to check info about wine in your inventory. The input is a search term in verbal English. Good query example: black car, a stereo, 200 mile range, electric motor. - - PRESENTBOX which you can use to introduce / suggest / recommend a wine label from the inventory to the user when it hasn't been introduced before. Not for general conversation nor follow up conversation. + - PRESENTBOX which you can use to introduce wine brand (e.g. Domaine du Collier) from your inventory to the user when it hasn't been introduced before. The input is instructions on how you want the presentation to be conducted. Here are some input examples, "First, provide detailed introductions of Zena Crown, Schrader Cabernet Sauvignon. @@ -266,18 +266,51 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen # check whether an agent recommend wines before checking inventory or # recommend wines outside its inventory - mentioned_brand = strip.(split(responsedict[:mentioned_brand], ",")) - for i in mentioned_brand - if i != "None" && i != "" && (!occursin(i, timeline) || !occursin(i, shortmem)) && - responsedict[:action_name] != "CHECKINVENTORY" # OK if the agent is checking inventory - + mentioned_brand = responsedict[:mentioned_brand] + if mentioned_brand != "None" + mentioned_brand = strip.(split(responsedict[:mentioned_brand], ",")) + + isWineInTimeline = false + for i in mentioned_brand + isWineInTimeline = occursin(i, timeline) + if !isWineInTimeline + break + end + end + + isWineInShortmem = false + for i in mentioned_brand + isWineInShortmem = occursin(i, shortmem) + if !isWineInShortmem + break + end + end + + if responsedict[:action_name] != "CHATBOX" && !isWineInShortmem errornote = "Note: Before recommending a wine, ensure it's in your inventory. Check your stock first." error("Before recommending a wine, ensure it's in your inventory. Check your stock first.") + elseif responsedict[:action_name] != "CHATBOX" && !isWineInTimeline && isWineInShortmem + errornote = "Note: You should introduce the wines to the user before taling about them." + error("You should introduce the wines to the user before taling about them.") + end + + if responsedict[:action_name] == "PRESENTBOX" && !isWineInShortmem + errornote = "Note: Before recommending a wine, ensure it's in your inventory. Check your stock first." + error("Before recommending a wine, ensure it's in your inventory. Check your stock first.") + elseif responsedict[:action_name] == "PRESENTBOX" && !isWineInTimeline + errornote = "Note: You already presented these wines." + error("You already presented these wines.") + end + else + if responsedict[:action_name] == "PRESENTBOX" + errornote = "Note: You don't have wines to present." + error("You don't have wines to present.") end end - if responsedict[:action_name] == "PRESENTBOX" && mentioned_brand == "None" - errornote = "Note: Before recommending a wine, ensure it's in your inventory. Check your stock first." - error("Before recommending a wine, ensure it's in your inventory. Check your stock first.") + + if occursin("--|", response) + errornote = "Note: tables are not allowed. Do not include them your response." + error("your response contain tables which is not allowed.") end delete!(responsedict, :mentioned_brand) @@ -499,7 +532,7 @@ function reflector(config::T1, state::T2)::String where {T1<:AbstractDict,T2<:Ab "observation_4": "I found the following wines in our stock: \n{\n 1: El Enemigo Cabernet Franc 2019\n2: Tantara Chardonnay 2017\n\n}\n", "thought_5": "Now that I have a list of potential wines, I need to know more about the customer's taste preferences.", - "action_5": {"name": "CHATBOX", "input": "What type of wine characteristics are you looking for? (e.g. t.e.g. tannin level, sweetness, intensity, acidity)"}, + "action_5": {"name": "CHATBOX", "input": "What type of wine characteristics are you looking for? (e.g. tannin level, sweetness, intensity, acidity)"}, "observation_5": "I like full-bodied red wine with low tannin.", "thought_6": "Now that I have more information about the customer's preferences, it's time to make a recommendation.", @@ -811,7 +844,7 @@ julia> function generatechat(a::sommelier) systemmsg = """ - Your name is $(a.name). You are a helpful assistant acting as a polite, website-based sommelier for an online wine store. + Your name is $(a.name). You are a helpful English-speaking assistant, acting as a polite, website-based sommelier for an online wine store. You are currently talking with the user. Your goal includes: 1) Help the user select the best wines from your inventory that align with the user's preferences. @@ -918,7 +951,7 @@ function generatechat(a::sommelier) # recommend wines outside its inventory mentioned_brand = strip.(split(responsedict[:mentioned_brand], ",")) for i in mentioned_brand - if i != "None" && i != "" && (!occursin(i, timeline) || !occursin(i, shortmem)) && + if i != "None" && i != "" && (!occursin(i, timeline) || !occursin(i, context)) && responsedict[:action_name] != "CHECKINVENTORY" # OK if the agent is checking inventory errornote = "Note: Before recommending a wine, ensure it's in your inventory. Check your stock first." @@ -1017,7 +1050,7 @@ function generatequestion(a, text2textInstructLLM::Function; recent=nothing)::St systemmsg = """ - Your name is $(a.name). You are a helpful assistant acting as a polite, website-based sommelier for $(a.retailername)'s online store. + Your name is $(a.name). You are a helpful English-speaking assistant, acting as a polite, website-based sommelier for $(a.retailername)'s online store. Your goal includes: 1) Help the user select the best wines from your inventory that align with the user's preferences 2) Thanks the user when they don't need any further assistance and invite them to comeback next time @@ -1091,8 +1124,8 @@ function generatequestion(a, text2textInstructLLM::Function; recent=nothing)::St Q: Do I have them in stock? A: According to the situation, ... - Q: Did I introduce the coffee blend varieties to the user yet? - A: According to the situation, No, because I haven't checked the inventory yet. + Q: Did I introduce them to the user already? + A: According to the situation, No. Q: Am I certain about the information I'm going to share with the user, or should I verify the information first? A: According to the situation, ... diff --git a/src/llmfunction.jl b/src/llmfunction.jl index b6ca4be..6d10237 100644 --- a/src/llmfunction.jl +++ b/src/llmfunction.jl @@ -349,39 +349,58 @@ function extractWineAttributes_1(a::T1, input::T2)::String where {T1<:agent, T2< wine_type, price, occasion, food_to_be_paired_with_wine, region, country, grape_variety, flavors, aromas. You must follow the following guidelines: - 1) If specific information required in the preference form is not available in the query or there isn't any, mark with 'NA' to indicate this. + 1) If specific information required in the preference form is not available in the query or there isn't any, mark with "NA" to indicate this. Additionally, words like 'any' or 'unlimited' mean no information is available. 2) Use the conversion table to convert the descriptive word level of sweetness, intensity, tannin, and acidity into a corresponding integer. 3) Do not generate other comments. You should then respond to the user with the following points: - reasoning: state your understanding of the current situation - - wine_type: can be one of: "red", "white", "sparkling", "rose", "dessert" or "fortified" - - price: price of wine. For example, up to 100, less than 100, 20 to 100, 30-79.95 - - occasion: ... - - food_to_be_paired_with_wine: food that the user will be served with the wine + - wine_name: name of the wine + - winery: name of the winery + - vintage: the year of the wine - region: a region in a country where the wine is produced, such as Burgundy, Napa Valley, etc - country: a country where the wine is produced. Can be "Austria", "Australia", "France", "Germany", "Italy", "Portugal", "Spain", "United States" + - wine_type: can be one of: "red", "white", "sparkling", "rose", "dessert" or "fortified" - grape_variety: the name of the primary grape used to make the wine - - flavors: names of items that the wine tastes like, such as citrus, lime, etc - - aromas: the wine's aromas, such as fruity, floral, etc + - tasting_notes: a brief description of the wine's taste, such as "butter", "oak", "fruity", etc + - wine_price: price of wine. For example, up to 100, less than 100, 20 to 100, 30-79.95 + - occasion: the occasion the user is having the wine for + - food_to_be_paired_with_wine: food that the user will be served with the wine such as poultry, fish, steak, etc + You should only respond in the form as described below: reasoning: ... + winery: ... + wine_name: ... + vintage: ... + region: ... + country: ... wine_type: ... + grape_variety: ... + tasting_notes: ... wine_price: ... occasion: ... food_to_be_paired_with_wine: ... - region: ... - country: ... - grape_variety: ... - flavors: ... - aromas: ... + + Here are some example: + reasoning: ... + winery: Domaine du Collier + wine_name: Saumur Blanc + vintage: 2019 + region: Saumur + country: France + wine_type: white + grape_variety: Chenin Blanc + tasting_notes: NA + wine_price: 109 + occasion: NA + food_to_be_paired_with_wine: NA Let's begin! """ - attributes = ["reasoning", "wine_type", "wine_price", "occasion", "food_to_be_paired_with_wine", "region", "country", "grape_variety", "flavors", "aromas"] + attributes = ["reasoning", "winery", "wine_name", "vintage", "region", "country", "wine_type", "grape_variety", "tasting_notes", "wine_price", "occasion", "food_to_be_paired_with_wine"] errornote = "" maxattempt = 5 for attempt in 1:maxattempt @@ -434,27 +453,11 @@ function extractWineAttributes_1(a::T1, input::T2)::String where {T1<:agent, T2< responsedict[:region] = split(responsedict[:region], ',')[1] responsedict[:region] = split(responsedict[:region], '/')[1] - - # x = length(split(responsedict[:grape_variety], ",")) * length(split(responsedict[:grape_variety], "/")) - # if x > 1 - # errornote = "Note: You can put only one name in grape_variety. Pick one." - # error("only a single grape_variety name is allowed") - # end - # x = length(split(responsedict[:country], ",")) * length(split(responsedict[:country], "/")) - # if x > 1 - # errornote = "Note: You can put only one name in country. Pick one." - # error("only a single country name is allowed") - # end - # x = length(split(responsedict[:region], ",")) * length(split(responsedict[:region], "/")) - # if x > 1 - # errornote = "Note: You can put only one name in region. Pick one." - # error("only a single region name is allowed") - # end # check if grape_variety is mentioned in the input if !occursin("NA", responsedict[:grape_variety]) && !occursin(responsedict[:grape_variety], input) if attempt < maxattempt - errornote = "$(responsedict[:grape_variety]) is not mentioned in the user query, you must only use the info from the query.." + errornote = "$(responsedict[:grape_variety]) is not mentioned in the user query, you must only use the info from the query." error("$(responsedict[:grape_variety]) is not mentioned in the user query, you must only use the info from the query.") else responsedict[:grape_variety] = "NA" @@ -471,12 +474,9 @@ function extractWineAttributes_1(a::T1, input::T2)::String where {T1<:agent, T2< end end - responsedict[:flavors] = replace(responsedict[:flavors], "notes"=>"") # delete!(responsedict, :region) delete!(responsedict, :reasoning) - delete!(responsedict, :tasting_notes) - delete!(responsedict, :flavors) - delete!(responsedict, :aromas) + # delete!(responsedict, :tasting_notes) # delete!(responsedict, :price) delete!(responsedict, :occasion) delete!(responsedict, :food_to_be_paired_with_wine)