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

View File

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

View File

@@ -88,7 +88,7 @@ end
main() main()
""" """
I'm having a graduation party this evening. I have no budget limit. I want a bottle of dry white wine. I'm having a graduation party this evening. I have unlimited budget. I want a bottle of dry white wine.
The party will be casual with no food serving. The party will be casual with no food serving.
I'm open to suggestion since I have no specific idea about wine other than I like full bodied wine from France. I'm open to suggestion since I have no specific idea about wine other than I like full bodied wine from France.
The latter one seems nice. The latter one seems nice.