This commit is contained in:
2023-11-20 08:30:17 +00:00
parent 101a89cb23
commit 7a042b72fc

View File

@@ -72,7 +72,7 @@ function agentReact(
roles::Dict=Dict(
:assistant =>
"""
You are a helpful assistant. You don't know other people personal info previously.
You are a helpful assistant that answer the user's questions as best you can.
""",
:sommelier =>
"""
@@ -108,8 +108,8 @@ function agentReact(
tools::Dict=Dict(
:wikisearch=>Dict(
:name => "wikisearch",
:description => "Useful for when you need to search the Internet",
:input => "Input should be keywords not a question.",
:description => "Useful for when you need to search an encyclopedia",
:input => "Input is keywords and not a question.",
:output => "",
:func => wikisearch, # put function here
),
@@ -120,13 +120,13 @@ function agentReact(
:output => "" ,
:func => nothing,
),
:wineStock=>Dict(
:name => "wineStock",
:description => "useful for when you need to search for wine by your description, price, name or ID.",
:input => "Input should be a search query with as much details as possible.",
:output => "" ,
:func => nothing,
),
# :wineStock=>Dict(
# :name => "wineStock",
# :description => "useful for when you need to search for wine by your description, price, name or ID.",
# :input => "Input should be a search query with as much details as possible.",
# :output => "" ,
# :func => nothing,
# ),
# :NTHING=>Dict(
# :name => "NTHING",
# :description => "useful for when you don't need to use tools or actions",
@@ -243,6 +243,41 @@ end
# return prompt
# end
# function generatePrompt_mistral_openorca(a::T, usermsg::String,
# thinkingMode::Symbol=:nothinking) where {T<:agent}
# prompt =
# """
# <|im_start|>system
# {systemMsg}
# You have access to the following tools:
# {tools}
# {thinkingMode}
# <|im_end|>
# Here are the context for the question:
# {context}
# """
# prompt = replace(prompt, "{systemMsg}" => a.roles[a.role])
# prompt = replace(prompt, "{thinkingMode}" => a.thinkingMode[thinkingMode])
# toolnames = ""
# toollines = ""
# for (toolname, v) in a.tools
# toolline = "$toolname: $(v[:description]) $(v[:input]) $(v[:output])\n"
# toollines *= toolline
# toolnames *= "$toolname,"
# end
# prompt = replace(prompt, "{toolnames}" => toolnames)
# prompt = replace(prompt, "{tools}" => toollines)
# prompt = replace(prompt, "{context}" => a.context)
# prompt *= "<|im_start|>user\nQuestion: " * usermsg * "\n<|im_end|>\n"
# prompt *= "<|im_start|>assistant\n"
# return prompt
# end
function generatePrompt_mistral_openorca(a::T, usermsg::String,
thinkingMode::Symbol=:nothinking) where {T<:agent}
@@ -250,7 +285,6 @@ function generatePrompt_mistral_openorca(a::T, usermsg::String,
"""
<|im_start|>system
{systemMsg}
You have access to the following tools:
{tools}
{thinkingMode}
<|im_end|>
@@ -267,7 +301,9 @@ function generatePrompt_mistral_openorca(a::T, usermsg::String,
toolnames *= "$toolname,"
end
prompt = replace(prompt, "{toolnames}" => toolnames)
prompt = replace(prompt, "{tools}" => toollines)
if thinkingMode [:react]
prompt = replace(prompt, "{tools}" => "You have access to the following tools:\n$toollines")
end
prompt = replace(prompt, "{context}" => a.context)
@@ -665,7 +701,7 @@ function chooseThinkingMode(a::T, usermsg::String) where {T<:agent}
Your need to determine now whether you will use tools or actions to answer the question.
You have the following choices:
If you don't need tools or actions to answer the question say, "{no}".
If you already know the answer or don't need tools or actions say, "{no}".
If you need tools or actions to answer the question say, "{yes}".
<|im_end|>