update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
module interface
|
||||
|
||||
export addNewMessage, conversation, decisionMaker
|
||||
export addNewMessage, conversation, decisionMaker, isterminal
|
||||
|
||||
using JSON3, DataStructures, Dates, UUIDs, HTTP, Random, MQTTClient
|
||||
using GeneralUtils
|
||||
@@ -63,25 +63,70 @@ using ..type, ..util, ..llmfunction, ..mcts
|
||||
function decisionMaker(a::T1, state::T2) where {T1<:agent, T2<:AbstractDict}
|
||||
customerinfo =
|
||||
"""
|
||||
I will give you the following information about customer:
|
||||
$(JSON3.write(state[:customerinfo]))
|
||||
I will give you the following information about customer:
|
||||
$(JSON3.write(state[:customerinfo]))
|
||||
"""
|
||||
|
||||
storeinfo =
|
||||
"""
|
||||
I will give you the following information about your store:
|
||||
$(JSON3.write(state[:storeinfo]))
|
||||
I will give you the following information about your store:
|
||||
$(JSON3.write(state[:storeinfo]))
|
||||
"""
|
||||
|
||||
reflect = ""
|
||||
# """
|
||||
# You have attempted to answer the following question before and failed. The following
|
||||
# reflection(s) give a plan to avoid failing to answer the question in the same way you did
|
||||
# previously. Use them to improve your strategy of correctly answering the given question.
|
||||
# (trajectories)
|
||||
# """
|
||||
|
||||
|
||||
#[WORKING]
|
||||
_prompt =
|
||||
"""
|
||||
You are a helpful sommelier working for a wine store.
|
||||
You helps users by searching wine that match the user preferences from your inventory.
|
||||
You are a helpful sommelier working for a wine store.
|
||||
Your goal is to reccommend the best wine from your inventory that match the user preferences.
|
||||
|
||||
$customerinfo
|
||||
$customerinfo
|
||||
|
||||
You must follow the
|
||||
You must follow the following criteria:
|
||||
1) Get to know what occasion the user is buying wine for
|
||||
2) Get to know what food the user will have with wine
|
||||
3) Get to know how much the user willing to spend
|
||||
4) Get to know type of wine the user is looking for
|
||||
e.g. Red, White, Sparkling, Rose, Dessert, Fortified
|
||||
5) Get to know what wine characteristics the user is looking for
|
||||
e.g. tannin, sweetness, intensity, acidity
|
||||
6) Check your inventory for the best wine that match the user preference
|
||||
|
||||
You should only respond with interleaving step-by-step Thought, Action, Observation steps.
|
||||
Thought can reason about the current situation, and Action can be three types:
|
||||
1) Chatbox[text], which you can use to interact with the user.
|
||||
2) Winestock[query], which you can use to find wine in your inventory.
|
||||
3) Finish[answer], which returns your wine reccommendation to the user.
|
||||
|
||||
You should only respond in JSON format as describe below:
|
||||
{
|
||||
"Thought_1": "reasoning",
|
||||
"Thought_2": "reasoning",
|
||||
...
|
||||
"Thought_n": "reasoning",
|
||||
"Action_1": "action to take",
|
||||
"Observation_1": "result of the action"
|
||||
}
|
||||
|
||||
Here are some examples:
|
||||
{
|
||||
"Question": "I would like to buy a sedan",
|
||||
"Thought_1": "I have many car in my inventory suitable for several usage scenarios",
|
||||
"Thought_2": "It would be better if I know what the user intend to do with his car",
|
||||
"Thought_3": "
|
||||
}
|
||||
|
||||
$reflect
|
||||
|
||||
$(JSON3.write(state[:thoughtHistory]))
|
||||
"""
|
||||
|
||||
prompt = formatLLMtext_llama3instruct("system", _prompt)
|
||||
@@ -89,6 +134,7 @@ function decisionMaker(a::T1, state::T2) where {T1<:agent, T2<:AbstractDict}
|
||||
thought = iterativeprompting(a, prompt, syntaxcheck_json)
|
||||
|
||||
|
||||
|
||||
error("--> decisionMaker")
|
||||
return thought
|
||||
end
|
||||
@@ -148,6 +194,35 @@ function reflector()
|
||||
end
|
||||
|
||||
|
||||
"""
|
||||
|
||||
Arguments\n
|
||||
-----
|
||||
|
||||
Return\n
|
||||
-----
|
||||
|
||||
Example\n
|
||||
-----
|
||||
```jldoctest
|
||||
julia>
|
||||
```
|
||||
|
||||
TODO\n
|
||||
-----
|
||||
[] update docstring
|
||||
[] implement the function
|
||||
[] implement RAG to pull similar experience
|
||||
|
||||
Signature\n
|
||||
-----
|
||||
"""
|
||||
function isterminal()
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
""" Chat with llm.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user