This commit is contained in:
2025-01-29 12:16:01 +07:00
parent a7f3e29e9c
commit c56c3d02b0
3 changed files with 77 additions and 34 deletions

View File

@@ -441,10 +441,19 @@ function extractWineAttributes_1(a::T1, input::T2)::String where {T1<:agent, T2<
end
# check whether max wine_price is in the input
maxprice = split(responsedict[:wine_price], '-')[end]
pricerange = split(responsedict[:wine_price], '-')
minprice = pricerange[1]
maxprice = pricerange[end]
if !occursin(maxprice, input)
responsedict[:wine_price] = "NA"
end
# price range like 100-100 is not good
if minprice == maxprice
errornote = "wine_price with minimum equals to maximum is not valid"
println("Attempt $attempt $errornote ", Dates.now(), " ", @__FILE__, " ", @__LINE__)
checkFlag = true
break
end
end
else
content = responsedict[j]
@@ -457,7 +466,7 @@ function extractWineAttributes_1(a::T1, input::T2)::String where {T1<:agent, T2<
content = [content]
end
for x in content #BUG why x is "0-1500"
for x in content #check whether price are mentioned in the input
if !occursin("NA", responsedict[j]) && !occursin(x, input)
errornote = "$x is not mentioned in the user query, you must only use the info from the query."
println("Attempt $attempt $errornote ", Dates.now(), " ", @__FILE__, " ", @__LINE__)
@@ -468,7 +477,7 @@ function extractWineAttributes_1(a::T1, input::T2)::String where {T1<:agent, T2<
end
end
end
checkFlag == true ? continue : nothing
checkFlag == true ? continue : nothing # skip the rest code if true
# remove (some text)
for (k, v) in responsedict