update
This commit is contained in:
@@ -579,7 +579,7 @@ julia>
|
|||||||
# Signature
|
# Signature
|
||||||
"""
|
"""
|
||||||
function wineattributes_wordToNumber(a::T1, input::T2
|
function wineattributes_wordToNumber(a::T1, input::T2
|
||||||
)::Dict where {T1<:agent, T2<:AbstractString}
|
)::String where {T1<:agent, T2<:AbstractString}
|
||||||
|
|
||||||
converstiontable =
|
converstiontable =
|
||||||
"""
|
"""
|
||||||
@@ -617,26 +617,26 @@ function wineattributes_wordToNumber(a::T1, input::T2
|
|||||||
At each round of conversation, the user will give you the current situation:
|
At each round of conversation, the user will give you the current situation:
|
||||||
Conversion Table: ...
|
Conversion Table: ...
|
||||||
Query: ...
|
Query: ...
|
||||||
Last round missing info: some info are missing
|
|
||||||
|
|
||||||
You should follow the following guidelines:
|
You should follow the following guidelines:
|
||||||
- If specific information is unavailable, please use "NA" to indicate this.
|
- If specific information is unavailable, please use "NA" to indicate this.
|
||||||
- Use converstion table to convert sweetness, acidity, tannin, intensity describing word into an integer.
|
- Use converstion table to convert sweetness, acidity, tannin, intensity describing word into an integer.
|
||||||
- Do not generate other comments.
|
- Do not generate other comments.
|
||||||
|
|
||||||
You should then respond to the user with:
|
You should then respond to the user with the following points:
|
||||||
- wine_type: Can be one of: red, white, sparkling, rose, dessert or fortified
|
- wine_type: Can be one of: red, white, sparkling, rose, dessert or fortified
|
||||||
- budget: ...
|
- budget: ...
|
||||||
- occasion: ...
|
- occasion: ...
|
||||||
- food_pairing: food that will be served with wine
|
- food_pairing: food that will be served with wine
|
||||||
- country: wine's country of origin
|
- country: wine's country of origin
|
||||||
- grape_variety: ...
|
- grape_variety: ...
|
||||||
- sweetness: S where S is an integer of sweetness level
|
- sweetness: S where S is an integer indicating sweetness level
|
||||||
- acidity: A where A is an integer of acidity level
|
- acidity: A where A is an integer indicating acidity level
|
||||||
- tannin: T where T is an integer of tannin level
|
- tannin: T where T is an integer indicating tannin level
|
||||||
- intensity: I where I is an integer of intensity level
|
- intensity: I where I is an integer indicating intensity level
|
||||||
|
|
||||||
You should only respond in format as described below:
|
You should only respond in format as described below:
|
||||||
|
repeat: repeat the user's query
|
||||||
wine_type: ...
|
wine_type: ...
|
||||||
budget: ...
|
budget: ...
|
||||||
occasion: ...
|
occasion: ...
|
||||||
@@ -650,24 +650,19 @@ function wineattributes_wordToNumber(a::T1, input::T2
|
|||||||
|
|
||||||
Here are some examples:
|
Here are some examples:
|
||||||
|
|
||||||
user: "price < 25, full-bodied white wine with sweetness level 2, low tannin level and medium acidity level, Pizza, France, Riesling"
|
user: "price < 25, for wedding party, full-bodied white wine with sweetness level 2, low tannin level and medium acidity level, Pizza, France, Riesling"
|
||||||
assistant:
|
assistant: repeat: ... \n wine_type: white\n budget: less than 25\n occasion: wedding party\n food_pairing: Pizza\n country: France\n grape_variety: Riesling\n sweetness: 2\n acidity: 3\n tannin: 1\n intensity: 5
|
||||||
wine_type: white, budget: less than 25, food_pairing: Pizza, country: France, grape_variety: Riesling, sweetness: 2, acidity: 3, tannin: 1, intensity: 5
|
|
||||||
|
|
||||||
user: body=full-bodied, dry, acidity=medium and low tannin
|
user: body=full-bodied, dry, acidity=medium and low tannin
|
||||||
assistant:
|
assistant: repeat: ... \n wine_type: NA\n budget: NA\n occasion: NA\n food_pairing: NA\n country: NA\n grape_variety: NA\n sweetness: 1\n acidity: 3\n tannin: 1\n intensity: 5
|
||||||
wine_type: NA, budget: NA, food_pairing: NA, country: NA, grape_variety: NA, sweetness: 1, acidity: 3, tannin: 1, intensity: 5
|
|
||||||
|
|
||||||
Let's begin!
|
Let's begin!
|
||||||
"""
|
"""
|
||||||
|
|
||||||
missinginfo = "None"
|
|
||||||
|
|
||||||
usermsg =
|
usermsg =
|
||||||
"""
|
"""
|
||||||
Conversion Table: $converstiontable
|
Conversion Table: $converstiontable
|
||||||
Query: $input
|
Query: $input
|
||||||
Last round missing info: $missinginfo
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_prompt =
|
_prompt =
|
||||||
@@ -683,7 +678,7 @@ function wineattributes_wordToNumber(a::T1, input::T2
|
|||||||
<|start_header_id|>assistant<|end_header_id|>
|
<|start_header_id|>assistant<|end_header_id|>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
attributes = ["wine_type", "budget", "occasion", "food_pairing", "country", "grape_variety", "sweetness", "acidity", "tannin", "intensity"]
|
attributes = ["repeat", "wine_type", "budget", "occasion", "food_pairing", "country", "grape_variety", "sweetness", "acidity", "tannin", "intensity"]
|
||||||
|
|
||||||
for attempt in 1:5
|
for attempt in 1:5
|
||||||
try
|
try
|
||||||
@@ -691,7 +686,7 @@ function wineattributes_wordToNumber(a::T1, input::T2
|
|||||||
responsedict = GeneralUtils.textToDict(response, attributes, rightmarker=":", symbolkey=true)
|
responsedict = GeneralUtils.textToDict(response, attributes, rightmarker=":", symbolkey=true)
|
||||||
|
|
||||||
for i ∈ attributes
|
for i ∈ attributes
|
||||||
if length(JSON3.write(responsedict[i])) == 0
|
if length(JSON3.write(responsedict[Symbol(i)])) == 0
|
||||||
error("$i is empty ", @__LINE__)
|
error("$i is empty ", @__LINE__)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -704,7 +699,14 @@ function wineattributes_wordToNumber(a::T1, input::T2
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
result = responsedict[:chat]
|
result = ""
|
||||||
|
for (k, v) in responsedict
|
||||||
|
if k != :repeat && v != "NA"
|
||||||
|
result *= "$k: $v, "
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
result = result[1:end-2] # remove the ending ", "
|
||||||
|
|
||||||
return result
|
return result
|
||||||
catch e
|
catch e
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ end
|
|||||||
# main()
|
# main()
|
||||||
|
|
||||||
|
|
||||||
input = "query=\"off dry, medium tannin French Rosé and spicy Thai food pairing under 30 dollars\""
|
input = "query=\"off dry, medium tannin, French Rosé and spicy Thai food pairing under 30 dollars\""
|
||||||
YiemAgent.winestock(a, input)
|
YiemAgent.winestock(a, input)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user