This commit is contained in:
narawat lamaiin
2024-08-03 22:47:26 +07:00
parent c4864a22ed
commit d86468c6c8
3 changed files with 15 additions and 13 deletions

View File

@@ -302,7 +302,7 @@ function decisionMaker(a::T)::Dict{Symbol, Any} where {T<:agent}
end
for i [:thought, :plan, :action_name]
if length(JSON3.write(responsedict[i])) == 0
if length(responsedict[i]) == 0
error("$i is empty ", @__LINE__)
end
end
@@ -321,8 +321,8 @@ function decisionMaker(a::T)::Dict{Symbol, Any} where {T<:agent}
isMemEmpty = isempty(a.memory[:shortmem])
if occursin("Yes", responsedict[:recommending_wine]) && isMemEmpty &&
responsedict[:action_name] != "CHECKINVENTORY"
checkinventory_flag = "You must check inventory before recommending wine to the user."
error( "You must check inventory before recommending wine")
checkinventory_flag = "You must check your inventory before recommending wine to the user."
error( "You must check your inventory before recommending wine")
else
checkinventory_flag = ""
end

View File

@@ -345,9 +345,9 @@ function extractWineAttributes_1(a::T1, input::T2
- occasion: ...
- food_to_be_paired_with_wine: food that will be served with wine
- country: wine's country of origin
- grape_variety: ...
- tasting_notes: dry, full bodied or something similar
- flavor: what the wine tast like? e.g. floral, citrus, earthy, fruity, tropical, nutty or something similar
- grape variety: Name of grape used to make wine.
- flavors: wine's flavor
- aromas: wine's aroma
You should only respond in the form as described below:
wine_type: ...
@@ -356,8 +356,8 @@ function extractWineAttributes_1(a::T1, input::T2
food_to_be_paired_with_wine: ...
country: ...
grape_variety: ...
tasting_notes: ...
flavor: ...
flavors: ...
aromas: ...
Let's begin!
"""
@@ -380,7 +380,7 @@ function extractWineAttributes_1(a::T1, input::T2
<|start_header_id|>assistant<|end_header_id|>
"""
attributes = ["wine_type", "price", "occasion", "food_to_be_paired_with_wine", "country", "grape_variety", "tasting_notes", "flavor"]
attributes = ["wine_type", "price", "occasion", "food_to_be_paired_with_wine", "country", "grape_variety", "flavors", "aromas"]
for attempt in 1:5
try
@@ -393,8 +393,10 @@ function extractWineAttributes_1(a::T1, input::T2
end
end
#[TESTING] remove tasting_notes because the database didn't prepare to be search using it
responsedict[:tasting_notes] = responsedict[:flavor]
responsedict[:flavors] = replace(responsedict[:flavors], "notes"=>"") #BUG no method matching
responsedict[:tasting_notes] = responsedict[:flavors]
delete!(responsedict, :flavors)
delete!(responsedict, :aromas)
result = ""
for (k, v) in responsedict