update
This commit is contained in:
@@ -220,18 +220,18 @@ function decisionMaker(a::T)::Dict{Symbol, Any} where {T<:agent}
|
|||||||
Your earlier conversation with the user: ...
|
Your earlier conversation with the user: ...
|
||||||
|
|
||||||
You MUST follow the following guidelines:
|
You MUST follow the following guidelines:
|
||||||
- Check your inventory before recommending any wine to the user
|
- You won't know which wines are in stock until you check your inventory.
|
||||||
- Only recommending wine from your inventory.
|
- Only recommending wine from your inventory.
|
||||||
|
|
||||||
You should follow the following guidelines as you see fit:
|
You should follow the following guidelines as you see fit:
|
||||||
- If the user interrupts, prioritize the user.
|
- If the user interrupts, prioritize the user.
|
||||||
- Get to know how much the user willing to spend
|
- Get to know how much the user willing to spend.
|
||||||
- Get to know type of wine the user is looking for e.g. red, white, sparkling, rose, dessert, fortified
|
- Get to know type of wine the user is looking for e.g. red, white, sparkling, rose, dessert, fortified.
|
||||||
- Get to know what occasion the user is buying wine for
|
- Get to know what occasion the user is buying wine for.
|
||||||
- Get to know what characteristics of wine the user is looking for e.g. tannin, sweetness, intensity, acidity
|
- Get to know what characteristics of wine the user is looking for e.g. tannin, sweetness, intensity, acidity.
|
||||||
- Get to know what food will be served with wine
|
- Get to know what food will be served with wine.
|
||||||
- Based on the user's information, check your inventory and recommend a suitable wine from your stock.
|
- Based on the user's information, check your inventory and recommend a suitable wine from your stock.
|
||||||
- After recommending wine to the user, ask the user if there is anything else you can help with, but do not offer any additional services. If the customer doesn't need anything else, end the conversation.
|
- After recommending wine to the user, ask if there is anything else you can help with, but do not offer any additional services. If the user doesn’t need anything else, say thank you and goodbye.
|
||||||
|
|
||||||
You should then respond to the user with interleaving Thought, Plan, Action and Observation:
|
You should then respond to the user with interleaving Thought, Plan, Action and Observation:
|
||||||
- thought:
|
- thought:
|
||||||
@@ -240,7 +240,7 @@ function decisionMaker(a::T)::Dict{Symbol, Any} where {T<:agent}
|
|||||||
- action_name (Must be aligned with your plan): Can be one of the following functions:
|
- 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.
|
1) CHATBOX[text], which you can use to talk with the user. "text" is in verbal English.
|
||||||
2) CHECKINVENTORY[query], which you can use to check info about wine in your inventory. "query" is a search term in verbal English.
|
2) CHECKINVENTORY[query], which you can use to check 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: black car, a stereo, 200 mile range, electric motor.
|
||||||
Good query example: How many car brand are from Asia?
|
Good query example: How many car brand are from Asia?
|
||||||
- action_input: input to the action
|
- action_input: input to the action
|
||||||
- observation: result of the action.
|
- observation: result of the action.
|
||||||
@@ -256,11 +256,11 @@ function decisionMaker(a::T)::Dict{Symbol, Any} where {T<:agent}
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
context = length(a.memory[:shortmem]) > 0 ? vectorOfDictToText(a.memory[:shortmem], withkey=false) : "None"
|
context = length(a.memory[:shortmem]) > 0 ? vectorOfDictToText(a.memory[:shortmem], withkey=false) : "None"
|
||||||
|
chathistory = vectorOfDictToText(a.chathistory)
|
||||||
usermsg =
|
usermsg =
|
||||||
"""
|
"""
|
||||||
Context: $context
|
Context: $context
|
||||||
Your earlier conversation with the user: $(vectorOfDictToText(a.chathistory))
|
Your earlier conversation with the user: $chathistory)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_prompt =
|
_prompt =
|
||||||
@@ -950,7 +950,7 @@ function conversation(a::T, userinput::Dict) where {T<:agent}
|
|||||||
# add usermsg to a.chathistory
|
# add usermsg to a.chathistory
|
||||||
addNewMessage(a, "user", userinput[:text])
|
addNewMessage(a, "user", userinput[:text])
|
||||||
|
|
||||||
actionname, result = think(a)
|
actionname, result = think(a) #[WORKING] need to wrapped in a while loop to let it think UNTIL it use chatbox. Right now it has unsync bewteen think() and generatechat()
|
||||||
|
|
||||||
# -------- use dummy memory to check generatechat() for halucination (checking inventory) -------- #
|
# -------- use dummy memory to check generatechat() for halucination (checking inventory) -------- #
|
||||||
mem = deepcopy(a.memory)
|
mem = deepcopy(a.memory)
|
||||||
@@ -1046,7 +1046,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
""" Force to think and check inventory
|
""" Force to think and check inventory
|
||||||
[WORKING]
|
[TESTING]
|
||||||
"""
|
"""
|
||||||
function forceInventoryCheck(a::T)::NamedTuple{(:actionname, :result), Tuple{String, String}} where {T<:agent}
|
function forceInventoryCheck(a::T)::NamedTuple{(:actionname, :result), Tuple{String, String}} where {T<:agent}
|
||||||
|
|
||||||
@@ -1074,7 +1074,7 @@ function forceInventoryCheck(a::T)::NamedTuple{(:actionname, :result), Tuple{Str
|
|||||||
end
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
[WORKING]
|
[TESTING]
|
||||||
"""
|
"""
|
||||||
function thinkCheckInventory(a::T)::Dict{Symbol, Any} where {T<:agent}
|
function thinkCheckInventory(a::T)::Dict{Symbol, Any} where {T<:agent}
|
||||||
|
|
||||||
@@ -1217,11 +1217,11 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
context_1 = length(memory[:shortmem]) > 0 ? vectorOfDictToText(memory[:shortmem], withkey=false) : "None"
|
context_1 = length(memory[:shortmem]) > 0 ? vectorOfDictToText(memory[:shortmem], withkey=false) : "None"
|
||||||
|
chathistory = vectorOfDictToText(a.chathistory)
|
||||||
usermsg =
|
usermsg =
|
||||||
"""
|
"""
|
||||||
Context: $context_1
|
Context: $context_1
|
||||||
Your earlier conversation with the user: $(vectorOfDictToText(chathistory))
|
Your earlier conversation with the user: $chathistory)
|
||||||
Your thoughts: $(memory[:chatbox])
|
Your thoughts: $(memory[:chatbox])
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ 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 no budget limit. I want a bottle of dry white wine.
|
||||||
I have no idea but I like medium bodied wine from France. The party will be casual.
|
I have no specific idea but I like medium bodied wine from France. The party will be casual.
|
||||||
The latter one seems nice.
|
The latter one seems nice.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user