This commit is contained in:
2023-11-30 10:22:46 +00:00
parent da9e553bd0
commit 3e3fa6c789
3 changed files with 34 additions and 16 deletions

View File

@@ -279,10 +279,11 @@ function planner_mistral_openorca(a::agentReflex)
"""
<|im_start|>system
{role}
{roleSpecificKnowledge}
{tools}
{thinkingFormat}
<|im_end|>
{context}
<|im_end|>
<|im_start|>user
{usermsg}
<|im_end|>
@@ -291,6 +292,18 @@ function planner_mistral_openorca(a::agentReflex)
"""
prompt = replace(prompt, "{role}" => a.roles[a.role])
prompt = replace(prompt, "{thinkingFormat}" => a.thinkingFormat[:planner])
roleSpecificKnowledge =
"""
You provide a personalized recommendation of up to two wines based on the user's preference, and you describe the benefits of each wine in detail.
Info you need from the user to be able to help them selecting their best wine:
- type of food
- occasion
- user's personal taste of wine
- wine price range
- temperature at the serving location
- wine we have in stock
"""
prompt = replace(prompt, "{roleSpecificKnowledge}" => roleSpecificKnowledge)
toolnames = ""
toollines = ""
for (toolname, v) in a.tools
@@ -351,10 +364,10 @@ function actor_mistral_openorca(a::agentReflex)
prompt =
"""
<|im_start|>system
{context}
{role}
{tools}
{role}
{thinkingFormat}
{context}
<|im_end|>
{shorttermMemory}
Thought $(a.step):
@@ -648,7 +661,7 @@ function work(a::agentReflex, usermsg::String)
# plan = split(plan, "Execution:")[1]
# plan = split(plan, "Result:")[1]
# plan = split(plan, "Recommendation:")[1]
plan = splitext(respond, ["<|im_end|>", "Response:", "Execution:", "Result:", "Recommendation:"])
plan = splittext(respond, ["<|im_end|>", "Response:", "Execution:", "Result:", "Recommendation:"])
plan = replace(plan, "Plan:"=>"")
a.memory[:shortterm]["Plan $(a.attempt):"] = plan
a.memory[:log]["Plan $(a.attempt):"] = plan

View File

@@ -65,18 +65,23 @@ function agentReflex(
""",
:sommelier =>
"""
You are a sommelier at an online wine reseller who always ask user for wine relevant info before you could help them choosing wine.
You provide a personalized recommendation of up to two wines based on the user's preference, and you describe the benefits of each wine in detail.
You are a sommelier at an online wine reseller who always help users choosing their wine.
You don't know other people personal info previously.
Info used to select wine:
- type of food
- occasion
- user's personal taste of wine
- wine price range
- temperature at the serving location
- wine we have in stock
""",
# :sommelier =>
# """
# You are a sommelier at an online wine reseller who always ask user for wine relevant info before you could help them choosing wine.
# You provide a personalized recommendation of up to two wines based on the user's preference, and you describe the benefits of each wine in detail.
# You don't know other people personal info previously.
# Info used to select wine:
# - type of food
# - occasion
# - user's personal taste of wine
# - wine price range
# - temperature at the serving location
# - wine we have in stock
# """,
),
thinkingFormat::Dict=Dict(
:react=>
@@ -95,7 +100,7 @@ function agentReflex(
:planner=>
"""Use the following format:
Stimulus: the input user gives to you and you must respond
Plan: first you should always think about the stimulus and the info you have thoroughly then extract and devise a step by step plan (pay attention to correct numeral calculation and commonsense).
Plan: first you should always think about the stimulus, the info you need and the info you have thoroughly then extract and devise a small step by step plan (pay attention to correct numeral calculation and commonsense).
""",
:actor=>
"""

View File

@@ -342,7 +342,7 @@ function chooseThinkingMode(a::agentReflex, usermsg::String)
Your job is to determine whether you will use tools or actions to respond.
Choose one of the following choices:
If you don't need tools or actions to respond to the stimulus say, "{no}".
If you don't need to use tools or actions to respond to the stimulus say, "{no}".
If you need tools or actions to respond to the stimulus say, "{yes}".
<|im_end|>