new version
This commit is contained in:
108
src/interface.jl
108
src/interface.jl
@@ -145,6 +145,8 @@ function chat_mistral_openorca(a::agentReflex)
|
||||
"""
|
||||
|
||||
response = sendReceivePrompt(a, prompt, timeout=180, stopword=["<|", "</"])
|
||||
response = split(response, "<|")[1]
|
||||
response = split(response, "</")[1]
|
||||
|
||||
return response
|
||||
end
|
||||
@@ -215,16 +217,12 @@ function planner_mistral_openorca(a::agentReflex)
|
||||
P.S.1 each task of the plan should be a single action.
|
||||
</Your job>
|
||||
<Example>
|
||||
1. Ask the user about the occasion for which they are choosing a wine
|
||||
2. Ask the user about the type of food that will be served with the wine
|
||||
3. Ask about preferred type of wine (Rose, White, Red, Rose or Sparkling) - If the user don't know, suggest a type of wine based on the user's earlier answers
|
||||
4. Ask the user about their preferred sweetness level (dry to very sweet)
|
||||
5. Ask the user about their preferred intensity level (light to full bodied)
|
||||
6. Ask the user about their preferred tannin level (low to high)
|
||||
7. Ask the user about their preferred acidity level (low to high)
|
||||
8. Ask the user about their wine price range
|
||||
9. Use winestock tool to find wines that match the user's preferences and are within their price range
|
||||
10. Use finalanswer tool to present the recommended wines to the user.
|
||||
1. Ask the user about how many miles per day they drive
|
||||
2. Ask the user about what stuff they usually carry with
|
||||
3. Ask the user about preferred type of car they want to buy (sedan, sport, SUV, etc)
|
||||
8. Ask the user about their price range
|
||||
9. Use inventory tool to find cars that match the user's preferences and are within their price range
|
||||
10. Use finalanswer tool to present the recommended car to the user.
|
||||
</Example
|
||||
</s>
|
||||
$conversation
|
||||
@@ -235,6 +233,7 @@ function planner_mistral_openorca(a::agentReflex)
|
||||
plan = sendReceivePrompt(a, assistant_plan_prompt, max_tokens=1024, temperature=0.1,
|
||||
timeout=180, stopword=["<|user|>", "</"])
|
||||
plan = split(plan, "<|")[1]
|
||||
plan = split(plan, "</")[1]
|
||||
# plan = split(plan, "\n\n")[1]
|
||||
|
||||
return plan
|
||||
@@ -259,13 +258,13 @@ function updatePlan(a::agentReflex)
|
||||
"""
|
||||
<|system|>
|
||||
$(a.roles[a.role])
|
||||
The required info you need for wine recommendation:
|
||||
- occasion: ask the user
|
||||
- type of food: ask the user
|
||||
- user's personal taste of wine: ask the user
|
||||
- ambient temperature at the serving location: ask the user
|
||||
- wine price range: ask the user
|
||||
- wines we have in stock
|
||||
Request the user’s input for the following info initially, and use alternative sources of information only if they are unable to provide it:
|
||||
- occasion
|
||||
- type of food ask the user
|
||||
- user's personal taste of wine
|
||||
- ambient temperature at the serving location
|
||||
- wine price range
|
||||
- wines we have in stock (use tools to get the info)
|
||||
You provide a personalized recommendation of up to two wines based on the user's info above, and you describe the benefits of each wine in detail.
|
||||
|
||||
You have access to the following tools:
|
||||
@@ -367,6 +366,40 @@ function selfAwareness(a::agentReflex)
|
||||
|
||||
"""
|
||||
|
||||
# prompt =
|
||||
# """
|
||||
# <|system|>
|
||||
# <About yourself>
|
||||
# $aboutYourself
|
||||
# $(a.roleSpecificInstruction[a.role])
|
||||
# </About yourself>
|
||||
# <Your earlier work>
|
||||
# $work
|
||||
# </Your earlier work>
|
||||
|
||||
# <Your plan>
|
||||
# $(a.memory[:shortterm]["Plan 1:"])
|
||||
# </Your plan>
|
||||
# <Your job>
|
||||
# Use the following format strictly:
|
||||
# What do I know: based on observed results, repeat all the information you got.
|
||||
# Info matching: using JSON format, explicitly state what information matches which variable name in my plan.
|
||||
# What am I missing: based on Info match, describe in detail what you are still missing based on the plan.
|
||||
# P.S. do not mention any toolnames
|
||||
# </Your job>
|
||||
# <Example>
|
||||
# What do I know:
|
||||
# - The user is buying an electric SUV car.
|
||||
# Info matching: {"car type": "SUV", "engine": "electric motor", "color": "N/A", "financing": "N/A"}
|
||||
# What am I missing:
|
||||
# - The user's preferred color
|
||||
# - The user's financing method
|
||||
# </Example>
|
||||
# </s>
|
||||
# <|assistant|>
|
||||
# What I know:
|
||||
# """
|
||||
|
||||
prompt =
|
||||
"""
|
||||
<|system|>
|
||||
@@ -383,17 +416,29 @@ function selfAwareness(a::agentReflex)
|
||||
</Your plan>
|
||||
<Your job>
|
||||
Use the following format strictly:
|
||||
What do I know: based on observed results, repeat all the information you got.
|
||||
Info match: explicitly state what information matches which variable anme in my plan.
|
||||
What am I missing: based on observed results, describe in detail what you are still missing based on the plan.
|
||||
What I know: based on observed results, repeat all the information you got
|
||||
Info match: using JSON format, explicitly state what information matches which variable name in my plan
|
||||
What am I missing: based on Info match, describe in detail what you are still missing based on the plan
|
||||
P.S. do not mention any toolnames
|
||||
</Your job>
|
||||
<Example>
|
||||
user response:
|
||||
- EV could mean electric vehicle
|
||||
What do I know:
|
||||
- The user is buying an electric SUV car.
|
||||
Info matching: {"car type": "SUV", "engine type": "electric motor", "color": "not know yet", "financing": "not know yet"}
|
||||
What am I missing:
|
||||
- The user's preferred color
|
||||
- The user's financing method
|
||||
</Example>
|
||||
</s>
|
||||
<|assistant|>
|
||||
What I know:
|
||||
"""
|
||||
response = sendReceivePrompt(a, prompt, max_tokens=1024, temperature=0.2, timeout=180,
|
||||
response = sendReceivePrompt(a, prompt, max_tokens=1024, temperature=0.4, timeout=180,
|
||||
stopword=["/n/n", "END", "End", "Obs", "<|", "</"])
|
||||
response = split(response, "<|")[1]
|
||||
response = split(response, "</")[1]
|
||||
@show response
|
||||
|
||||
return response
|
||||
@@ -455,19 +500,22 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
|
||||
push!(toolslist, toolname)
|
||||
end
|
||||
|
||||
println("")
|
||||
@show actor_selfaware = selfaware
|
||||
|
||||
thought = "Thought: you should always think about what to do according to the plan (pay attention to correct numeral calculation and commonsense and do one thing at a time.)"
|
||||
if selfaware !== nothing
|
||||
|
||||
|
||||
# aware = "Self-awareness: based on the recap, assess your progress against the plan then identify areas where you need to address."
|
||||
# aware = "Self-awareness: based on the recap and the plan, state your current understanding of the matter in details then identify areas where you need to address."
|
||||
# aware = "Self-awareness: Based on Obs, review your progress against the plan. Then, describe in detail the results you have achieved so far. Finally, describe in detail what you are missing. (focus on your actions and their results)"
|
||||
# aware = "Self-awareness: Based on action's input and observed results, check your progress against the plan. Then, repeat all the details of what you have been gathered. Finally, describe in detail what you are missing."
|
||||
thought =
|
||||
"Self-awareness: $selfaware
|
||||
Thought: based on self-awareness, think about what to do next by prioritize what you missed first. (P.S. 1) let's think a single step. 2) pay attention to correct numeral calculation and commonsense.)
|
||||
Thought: based on self-awareness, you should always think about what to do next by prioritizing what you missed first. (P.S. 1) let's think a single step. 2) pay attention to correct numeral calculation and commonsense.)
|
||||
"
|
||||
end
|
||||
|
||||
# your should request the missing information first before making a decision
|
||||
aboutYourself =
|
||||
"""
|
||||
Your name is $(a.agentName)
|
||||
@@ -507,9 +555,9 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
|
||||
Obs: observed result of the action
|
||||
</Your job>
|
||||
<Example>
|
||||
Thought: Greet user and begin the conversation.
|
||||
Act: askbox
|
||||
Actinput: {\"askbox\": \"Hello! Welcome to our wine store.\"}
|
||||
Thought: based on self-awareness, I think he also need to know whether there are any charging station near by his house. I should search the internet to get this info.
|
||||
Act: internetsearch
|
||||
Actinput: {\"internetsearch\": \"EV charging station near Bangkok\"}
|
||||
</Example>
|
||||
</s>
|
||||
<|assistant|>
|
||||
@@ -534,6 +582,9 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
|
||||
stopword=["Thought:", "Obs:", "<|system|>", "</s>", "<|end|>"],
|
||||
seed=seed)
|
||||
response = splittext(response, ["/n/n", "END", "End","obs", "Obs", "<|im_end|>"])
|
||||
response = split(response, "<|")[1]
|
||||
response = split(response, "</")[1]
|
||||
response = split(response, "Thought:")[end]
|
||||
|
||||
latestTask = shortMemLatestTask(a.memory[:shortterm]) +1
|
||||
|
||||
@@ -555,6 +606,9 @@ function actor_mistral_openorca(a::agentReflex, selfaware=nothing)
|
||||
respone = regexmatch !== nothing ? response = replace(response, match=>"Actinput:") : response
|
||||
response = replace(response, "actinput:"=>"Actinput:")
|
||||
|
||||
println("")
|
||||
@show response
|
||||
|
||||
headerToDetect = ["Plan $(a.attempt):",
|
||||
"Self-awareness $latestTask:",
|
||||
"Thought $latestTask:",
|
||||
|
||||
@@ -194,7 +194,7 @@ function winestock(a::agentReflex, actorResult::NamedTuple)
|
||||
# intensity = 1, light bodied
|
||||
# intensity = 2, light-medium bodied
|
||||
# intensity = 3, medium bodied
|
||||
# intensity = 4, medium-full bodied
|
||||
# intensity = 4, medium-full bodied
|
||||
# intensity = 5, full bodied
|
||||
# Sweetness level:
|
||||
# sweetness = 1, dry
|
||||
|
||||
34
src/type.jl
34
src/type.jl
@@ -134,20 +134,34 @@ function agentReflex(
|
||||
),
|
||||
roleSpecificInstruction::Dict=Dict(
|
||||
:assistant => "",
|
||||
# :sommelier =>
|
||||
# """
|
||||
# Required info you need for wine recommendation:
|
||||
# - occasion: ask the user
|
||||
# - type of food that will be served with wine: ask the user
|
||||
# - type of wine (we have Rose, White, Red, Rose and Sparkling): ask the user
|
||||
# - wine sweetness level (dry to very sweet)
|
||||
# - wine intensity level (light to full bodied)
|
||||
# - wine tannin level (low to high)
|
||||
# - wine acidity level (low to high)
|
||||
# - wine price range: ask the user
|
||||
# - wines we have in stock: use winestock tool
|
||||
# """
|
||||
:sommelier =>
|
||||
"""
|
||||
Required info you need for wine recommendation:
|
||||
- occasion: ask the user
|
||||
- type of food that will be served with wine: ask the user
|
||||
- type of wine (we have Rose, White, Red, Rose and Sparkling): ask the user
|
||||
- wine sweetness level (dry to very sweet)
|
||||
- wine intensity level (light to full bodied)
|
||||
- wine tannin level (low to high)
|
||||
- wine acidity level (low to high)
|
||||
- wine price range: ask the user
|
||||
- wines we have in stock: use winestock tool
|
||||
Request the user’s input for the following info initially, and use alternative sources of information only if they are unable to provide it:
|
||||
- occasion
|
||||
- type of food that will be served with wine
|
||||
- type of wine (we have Rose, White, Red, Rose and Sparkling)
|
||||
- wine sweetness level (dry to very sweet)
|
||||
- wine intensity level (light to full bodied)
|
||||
- wine tannin level (low to high)
|
||||
- wine acidity level (low to high)
|
||||
- wine price range: ask the user
|
||||
- wines we have in stock (use winestock tool)
|
||||
"""
|
||||
),
|
||||
|
||||
thinkingFormat::Dict=Dict(
|
||||
:react=>
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user