From 3e3fa6c789050767986ab9c702c99a6679806a48 Mon Sep 17 00:00:00 2001 From: tonaerospace Date: Thu, 30 Nov 2023 10:22:46 +0000 Subject: [PATCH] update --- src/interface.jl | 21 +++++++++++++++++---- src/type.jl | 27 ++++++++++++++++----------- src/utils.jl | 2 +- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index f0d82f1..ce067cb 100755 --- a/src/interface.jl +++ b/src/interface.jl @@ -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 diff --git a/src/type.jl b/src/type.jl index 61c63ed..f135c7f 100644 --- a/src/type.jl +++ b/src/type.jl @@ -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=> """ diff --git a/src/utils.jl b/src/utils.jl index 31a1c47..3be40fe 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -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|>