This commit is contained in:
2023-12-13 16:09:02 +00:00
parent 4b5b189779
commit b1c5ecfc2e

View File

@@ -366,6 +366,9 @@ end
#WORKING
function isUseTools(a::agentReflex)
# response = chat_mistral_openorca(a)
toollines = ""
for (toolname, v) in a.tools
if toolname ["chatbox"]
@@ -386,7 +389,7 @@ function isUseTools(a::agentReflex)
Your conversation with the user:
$conversation
From the user's message, ask yourself what do you need to do?
From the user's message, ask yourself what do you intend to do now?
<|im_end|>
"""
@@ -400,44 +403,17 @@ function isUseTools(a::agentReflex)
break
end
end
@show result
plan = "N/A"
if isusetool
toollines = ""
for (toolname, v) in a.tools
if toolname [""]
toolline = "$toolname: $(v[:description]) $(v[:input]) $(v[:output])\n"
toollines *= toolline
end
end
assistant_objective_prompt =
"""
<|im_start|>system
$(a.roles[a.role])
The 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
- ambient temperature at the serving location
- wines we have in stock
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:
$toollines
Your conversation with the user:
$conversation
Use the following format:
Objective: From your conversation with the user, ask yourself what do you need to do now?
<|im_end|>
"""
result_objective = sendReceivePrompt(a, assistant_objective_prompt, temperature=0.2)
@show result_objective
# assistant_plan_prompt =
# toollines = ""
# for (toolname, v) in a.tools
# if toolname ∉ [""]
# toolline = "$toolname: $(v[:description]) $(v[:input]) $(v[:output])\n"
# toollines *= toolline
# end
# end
# assistant_objective_prompt =
# """
# <|im_start|>system
# $(a.roles[a.role])
@@ -453,25 +429,45 @@ function isUseTools(a::agentReflex)
# You have access to the following tools:
# $toollines
# Your conversation with the user:
# $conversation
# Use the following format:
# Stimulus: the input user gives to you and you must respond
# Plan: first you should always think about the stimulus, the info you need and the info you have thoroughly then extract and devise a step by step plan (pay attention to correct numeral calculation and commonsense).
# p.s.1 each step should be a single action.
# p.s.2 don't respond to the stimulus yet.
# Objective: From your conversation with the user, ask yourself what do you need to do now?
# <|im_end|>
# <|im_start|>user
# $result_objective
# <|im_end|>
# <|im_start|>assistant
# Plan:
# """
# result_plan = sendReceivePrompt(a, assistant_plan_prompt, temperature=0.2)
# @show result_plan
# result_objective = sendReceivePrompt(a, assistant_objective_prompt, temperature=0.2)
# @show result_objective
assistant_plan_prompt =
"""
<|im_start|>system
$(a.roles[a.role])
The 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
- ambient temperature at the serving location
- wines we have in stock
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:
$toollines
Use the following format:
Objective: the objective you intend to do
Plan: first you should always think about the objective, the info you need and the info you have thoroughly then extract and devise a step by step plan (pay attention to correct numeral calculation and commonsense).
p.s.1 each step should be a single action.
p.s.2 don't respond to the stimulus yet.
<|im_end|>
<|im_start|>assistant
Objective: $result
Plan:
"""
plan = sendReceivePrompt(a, assistant_plan_prompt, temperature=0.2)
@show plan
end
return isusetool, plan