update
This commit is contained in:
@@ -4,7 +4,7 @@ export virtualWineUserChatbox, jsoncorrection, checkwine, # recommendbox,
|
||||
virtualWineUserRecommendbox, userChatbox, userRecommendbox, extractWineAttributes_1,
|
||||
extractWineAttributes_2, paraphrase
|
||||
|
||||
using HTTP, JSON3, URIs, Random, PrettyPrinting, UUIDs, Dates
|
||||
using HTTP, JSON3, URIs, Random, PrettyPrinting, UUIDs, Dates, DataFrames
|
||||
using GeneralUtils, SQLLLM
|
||||
using ..type, ..util
|
||||
|
||||
@@ -316,7 +316,11 @@ function checkwine(a::T1, input::T2; maxattempt::Int=3
|
||||
llmFormatName="qwen3")
|
||||
# check if all of retrieve_attributes appears in textresult
|
||||
isin = [occursin(x, textresult) for x in retrieve_attributes]
|
||||
if !all(isin) && !occursin("The resulting table has 0 row", textresult)
|
||||
# check if rawresponse type is DataFrame so that I can check for column
|
||||
if typeof(rawresponse) == DataFrame &&
|
||||
!occursin("The resulting table has 0 row", textresult) &&
|
||||
!all(isin)
|
||||
|
||||
errornote = "Not all of $retrieve_attributes appear in search result"
|
||||
println("\nERROR YiemAgent checkwine() $errornote ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||
continue
|
||||
@@ -402,10 +406,10 @@ function extractWineAttributes_1(a::T1, input::T2; maxattempt=10
|
||||
"wine_name": "N/A",
|
||||
"winery": "N/A",
|
||||
"vintage": "N/A",
|
||||
"region": "Tuscany, Napa Valley",
|
||||
"country": "Italy, United States",
|
||||
"wine_type": "red, white",
|
||||
"grape_varietal": "Chenin Blanc, Riesling",
|
||||
"region": "Tuscany or Napa Valley",
|
||||
"country": "Italy or United States",
|
||||
"wine_type": "red or white",
|
||||
"grape_varietal": "Chenin Blanc or Riesling",
|
||||
"tasting_notes": "citrus",
|
||||
"wine_price_min": "0",
|
||||
"wine_price_max": "20",
|
||||
@@ -804,6 +808,13 @@ function extractWineAttributes_2(a::T1, input::T2)::String where {T1<:agent, T2<
|
||||
end
|
||||
end
|
||||
|
||||
# delete some key words from responsedict
|
||||
for (k, v) in responsedict
|
||||
if k ∈ [:sweetness_keyword, :acidity_keyword, :tannin_keyword, :intensity_keyword]
|
||||
delete!(responsedict, k)
|
||||
end
|
||||
end
|
||||
|
||||
result = ""
|
||||
for (k, v) in responsedict
|
||||
# some time LLM generate text with "(some comment)". this line removes it
|
||||
|
||||
Reference in New Issue
Block a user