This commit is contained in:
narawat lamaiin
2024-08-01 13:09:42 +07:00
parent 03d7032651
commit ca81e4496b
3 changed files with 39 additions and 16 deletions

View File

@@ -399,7 +399,7 @@ function extractWineAttributes_1(a::T1, input::T2
result = ""
for (k, v) in responsedict
if !occursin("NA", v)
if !occursin("NA", v) && v != ""
result *= "$k: $v, "
end
end
@@ -423,7 +423,10 @@ function extractWineAttributes_1(a::T1, input::T2
error("wineattributes_wordToNumber() failed to get a response")
end
"""
# TODO
- [PENDING] "French dry white wines with medium bod" the LLM does not recognize sweetness. use LLM self questioning to solve.
"""
function extractWineAttributes_2(a::T1, input::T2
)::String where {T1<:agent, T2<:AbstractString}
@@ -475,10 +478,14 @@ function extractWineAttributes_2(a::T1, input::T2
You should then respond to the user with the following points:
- repeat: repeat the user query exactly
- sweetness: S where S are integers represent the range of sweetness levels e.g. 1-2
- acidity: D where D are integers represent the range of acidity level e.g. 3-4
- tannin: T where T are integers represent the range of tannin level e.g. 4-5
- intensity: I where I are integers represent the range of intensity level e.g. 3-4
- 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
Example: 3-5
- tannin: T where T are integers represent the range of tannin level
Example: 1-3
- intensity: I where I are integers represent the range of intensity level
Example: 2-4
You should only respond in the form as described below:
repeat: ...
@@ -529,6 +536,15 @@ function extractWineAttributes_2(a::T1, input::T2
end
end
# some time LLM says NA-2. Need to convert NA to 1
for (k, v) in responsedict
if occursin("NA", v) && occursin("-", v)
new_v = replace(v, "NA"=>"1")
responsedict[k] = new_v
end
end
result = ""
for (k, v) in responsedict
if !occursin("NA", v)