This commit is contained in:
narawat lamaiin
2024-07-29 09:56:07 +07:00
parent dda2134b01
commit 7e0f8fa6f0
3 changed files with 77 additions and 23 deletions

View File

@@ -238,7 +238,9 @@ function decisionMaker(a::T)::Dict{Symbol, Any} where {T<:agent}
- plan: Based on the current situation, state a complete plan to complete the task. Be specific.
- action_name (Must be aligned with your plan): Can be one of the following functions:
1) CHATBOX[text], which you can use to talk with the user. "text" is in verbal English.
2) WINESTOCK[query], which you can use to find info about wine in your inventory. "query" is a search term in verbal English. The best query must includes "budget", "type of wine", "characteristics of wine" and "food pairing".
2) WINESTOCK[query], which you can use to find info about wine in your inventory. "query" is a search term in verbal English.
Good query example: black car with a stereo, 200 mile range and an electric motor.
Good query example: How many car brand are from Asia?
- action_input: input to the action
- observation: result of the action.

View File

@@ -426,38 +426,90 @@ function extractWineAttributes(a::T1, input::T2
Level 5: May correspond to "high acidity" or a similar description.
"""
# systemmsg =
# """
# As an attentive sommelier, your task is to determine the user's wine preferred levels of sweetness, intensity, tannin, acidity and other criteria based on the user query.
# At each round of conversation, the user will give you the current situation:
# Conversion Table: ...
# Query: ...
# You must follow the following guidelines:
# 1) If specific information is not available in the query, use "NA" to indicate this. Also words like "any" or "unlimited" means no information available.
# 2) Use converstion table to convert sweetness, acidity, tannin, intensity describing word into an integer.
# 3) Do not generate other comments.
# You should then respond to the user with the following points:
# - wine_type: Can be one of: red, white, sparkling, rose, dessert or fortified
# - price: ...
# - occasion: ...
# - food_pairing: food that will be served with wine
# - country: wine's country of origin
# - grape_variety: ...
# - tasting_notes: wine's flavors
# - sweetness: S where S is an integer indicating sweetness level
# - acidity: A where A is an integer indicating acidity level
# - tannin: T where T is an integer indicating tannin level
# - intensity: I where I is an integer indicating intensity level
# You should only respond in format as described below:
# repeat: repeat the user's query
# wine_type: ...
# price: ...
# occasion: ...
# food_pairing: ...
# country: ...
# grape_variety: ...
# tasting_notes: ...
# sweetness:
# acidity: ...
# tannin: ...
# intensity: ...
# Here are some examples:
# user: "price < 25, for wedding party, full-bodied white wine with sweetness level 2, apple and honey notes, low tannin level and medium acidity level, Pizza, France, Riesling"
# assistant: repeat: ... \n wine_type: white\n price: less than 25\n occasion: wedding party\n food_pairing: Pizza\n country: France\n grape_variety: Riesling\n tasting_notes: apple, honey\n sweetness: 2\n acidity: 3\n tannin: 1\n intensity: 5
# user: body=full-bodied, dry, acidity=medium and low tannin
# assistant: repeat: ... \n wine_type: NA\n price: NA\n occasion: NA\n food_pairing: NA\n country: NA\n grape_variety: NA\n tasting_notes: NA\n sweetness: 1\n acidity: 3\n tannin: 1\n intensity: 5
# Let's begin!
# """
systemmsg =
"""
As an attentive sommelier, your task is to determine the user's wine preferred levels of sweetness, intensity, tannin, acidity and other criteria based on the user query.
As an attentive sommelier, your task is to fillout the form based on the user query. The form is about the user's wine preference.
At each round of conversation, the user will give you the current situation:
Conversion Table: ...
Query: ...
You must follow the following guidelines:
1) If specific information is not available in the query, use "NA" to indicate this. Also words like "any" or "unlimited" means no information available.
2) Use converstion table to convert sweetness, acidity, tannin, intensity describing word into an integer.
1) Use the conversion table to convert the descriptive word level of sweetness, intensity, tannin, and acidity into a corresponding integer.
2) If specific information required in the form is not available in the query, use 'NA' to indicate this. Additionally, words like 'any' or 'unlimited' mean no information is available.
3) Do not generate other comments.
You should then respond to the user with the following points:
- wine_type: Can be one of: red, white, sparkling, rose, dessert or fortified
- price: ...
- occasion: ...
- food_pairing: food that will be served with wine
- country: wine's country of origin
- grape_variety: ...
- tasting_notes: wine's flavors
- sweetness: S where S is an integer indicating sweetness level
- acidity: A where A is an integer indicating acidity level
- tannin: T where T is an integer indicating tannin level
- intensity: I where I is an integer indicating intensity level
1) reasoning: State your reasoning about the current situation.
2) wine_type: Can be one of: red, white, sparkling, rose, dessert or fortified
3) price: ...
4) occasion: ...
5) food_to_be_paired_with_wine: food that will be served with wine
6) country: wine's country of origin
7) grape_variety: ...
8) tasting_notes: wine's flavors
9) sweetness: S where S is an integer indicating sweetness level
10) acidity: A where A is an integer indicating acidity level
11) tannin: T where T is an integer indicating tannin level
12) intensity: I where I is an integer indicating intensity level
You should only respond in format as described below:
repeat: repeat the user's query
reasoning: ...
wine_type: ...
price: ...
occasion: ...
food_pairing: ...
food_to_be_paired_with_wine: ...
country: ...
grape_variety: ...
tasting_notes: ...
@@ -468,11 +520,11 @@ function extractWineAttributes(a::T1, input::T2
Here are some examples:
user: "price < 25, for wedding party, full-bodied white wine with sweetness level 2, apple and honey notes, low tannin level and medium acidity level, Pizza, France, Riesling"
assistant: repeat: ... \n wine_type: white\n price: less than 25\n occasion: wedding party\n food_pairing: Pizza\n country: France\n grape_variety: Riesling\n tasting_notes: apple, honey\n sweetness: 2\n acidity: 3\n tannin: 1\n intensity: 5
user: price < 25, for wedding party, full-bodied white wine with sweetness level 2, apple and honey notes, low tannin level and medium acidity level, Pizza, France, Riesling
assistant: reasoning: ... \n wine_type: white\n price: less than 25\n occasion: wedding party\n food_to_be_paired_with_wine: Pizza\n country: France\n grape_variety: Riesling\n tasting_notes: apple, honey\n sweetness: 2\n acidity: 3\n tannin: 1\n intensity: 5
user: body=full-bodied, dry, acidity=medium and low tannin
assistant: repeat: ... \n wine_type: NA\n price: NA\n occasion: NA\n food_pairing: NA\n country: NA\n grape_variety: NA\n tasting_notes: NA\n sweetness: 1\n acidity: 3\n tannin: 1\n intensity: 5
assistant: reasoning: ... \n wine_type: NA\n price: NA\n occasion: NA\n food_to_be_paired_with_wine: NA\n country: NA\n grape_variety: NA\n tasting_notes: NA\n sweetness: 1\n acidity: 3\n tannin: 1\n intensity: 5
Let's begin!
"""
@@ -496,7 +548,7 @@ function extractWineAttributes(a::T1, input::T2
<|start_header_id|>assistant<|end_header_id|>
"""
attributes = ["repeat", "wine_type", "price", "occasion", "food_pairing", "country", "grape_variety", "sweetness", "acidity", "tannin", "intensity"]
attributes = ["reasoning", "wine_type", "price", "occasion", "food_to_be_paired_with_wine", "country", "grape_variety", "sweetness", "acidity", "tannin", "intensity"]
for attempt in 1:5
try
@@ -519,7 +571,7 @@ function extractWineAttributes(a::T1, input::T2
result = ""
for (k, v) in responsedict
if k != :repeat && !occursin("NA", v)
if k != :reasoning && !occursin("NA", v)
result *= "$k: $v, "
end
end

View File

@@ -85,7 +85,7 @@ end
main()
# """
# I'm having a graduation party this evening. So I think a bootle of wine would be nice.
# I'm having a graduation party this evening. So I think a bottle of wine would be nice.
# I have no idea. The party will be formal. What type of wine people usually get for this occasion?
# What about sparkling Rose?