update
This commit is contained in:
@@ -366,7 +366,8 @@ function extractWineAttributes_1(a::T1, input::T2)::String where {T1<:agent, T2<
|
||||
|
||||
attributes = ["reasoning", "wine_type", "price", "occasion", "food_to_be_paired_with_wine", "country", "region", "grape_variety", "flavors", "aromas"]
|
||||
errornote = ""
|
||||
for attempt in 1:5
|
||||
maxattempt = 5
|
||||
for attempt in 1:maxattempt
|
||||
|
||||
usermsg =
|
||||
"""
|
||||
@@ -398,25 +399,38 @@ function extractWineAttributes_1(a::T1, input::T2)::String where {T1<:agent, T2<
|
||||
end
|
||||
|
||||
#[PENDING] check if the following attributes has more than 1 name
|
||||
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
|
||||
responsedict[:grape_variety] = split(responsedict[:grape_variety], ',')[1]
|
||||
responsedict[:grape_variety] = split(responsedict[:grape_variety], '/')[1]
|
||||
|
||||
responsedict[:country] = split(responsedict[:country], ',')[1]
|
||||
responsedict[:country] = split(responsedict[:country], '/')[1]
|
||||
|
||||
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)
|
||||
error("$(responsedict[:grape_variety]) is not mentioned in the input")
|
||||
if attempt < maxattempt
|
||||
error("$(responsedict[:grape_variety]) is not mentioned in the input")
|
||||
else
|
||||
responsedict[:grape_variety] = "NA"
|
||||
end
|
||||
end
|
||||
|
||||
responsedict[:flavors] = replace(responsedict[:flavors], "notes"=>"")
|
||||
|
||||
Reference in New Issue
Block a user