update
This commit is contained in:
@@ -43,7 +43,7 @@ julia> formattedtext = YiemAgent.formatLLMtext_llama3instruct(d[:name], d[:text]
|
||||
Signature
|
||||
"""
|
||||
function formatLLMtext_llama3instruct(name::T, text::T;
|
||||
assistantStarter::Bool=true) where {T<:AbstractString}
|
||||
assistantStarter::Bool=false) where {T<:AbstractString}
|
||||
formattedtext =
|
||||
if name == "system"
|
||||
"""
|
||||
@@ -71,7 +71,7 @@ end
|
||||
|
||||
|
||||
function formatLLMtext_qwen(name::T, text::T;
|
||||
assistantStarter::Bool=true) where {T<:AbstractString}
|
||||
assistantStarter::Bool=false) where {T<:AbstractString}
|
||||
formattedtext =
|
||||
if name == "system"
|
||||
"""
|
||||
@@ -99,7 +99,7 @@ end
|
||||
|
||||
|
||||
function formatLLMtext_phi4(name::T, text::T;
|
||||
assistantStarter::Bool=true) where {T<:AbstractString}
|
||||
assistantStarter::Bool=false) where {T<:AbstractString}
|
||||
formattedtext =
|
||||
if name == "system"
|
||||
"""
|
||||
@@ -155,7 +155,7 @@ julia> formattedtext = YiemAgent.formatLLMtext(chatmessage, "llama3instruct")
|
||||
# Signature
|
||||
"""
|
||||
function formatLLMtext(messages::Vector{Dict{Symbol, T}}; formatname::String="llama3instruct"
|
||||
)::String where {T<:Any}
|
||||
)::String where {T<:AbstractString}
|
||||
f = if formatname == "llama3instruct"
|
||||
formatLLMtext_llama3instruct
|
||||
elseif formatname == "mistral"
|
||||
@@ -171,8 +171,12 @@ function formatLLMtext(messages::Vector{Dict{Symbol, T}}; formatname::String="ll
|
||||
end
|
||||
|
||||
str = ""
|
||||
for t in messages
|
||||
str *= f(t[:name], t[:text])
|
||||
for (i, t) in enumerate(messages)
|
||||
if i < length(messages)
|
||||
str *= f(t[:name], t[:text])
|
||||
else
|
||||
str *= f(t[:name], t[:text]; assistantStarter=true)
|
||||
end
|
||||
end
|
||||
|
||||
return str
|
||||
|
||||
Reference in New Issue
Block a user