update companion
This commit is contained in:
+5
-7
@@ -1509,10 +1509,6 @@ end
|
||||
|
||||
# modify it to work with customer object
|
||||
function generatechat(a::companion; converPartnerName::Union{String, Nothing}=nothing, maxattempt=10)
|
||||
|
||||
# header = ["Dialogue:"]
|
||||
# dictkey = ["dialogue"]
|
||||
|
||||
response = nothing # placeholder for show when error msg show up
|
||||
errornote = "N/A"
|
||||
llmkwargs=Dict(
|
||||
@@ -1540,13 +1536,15 @@ function generatechat(a::companion; converPartnerName::Union{String, Nothing}=no
|
||||
end
|
||||
|
||||
# put in model format
|
||||
_prompt = GeneralUtils.formatLLMtext(_prompt, "granite3")
|
||||
_prompt = GeneralUtils.formatLLMtext(_prompt, a.llmFormatName)
|
||||
|
||||
# replace user and assistant with partner name
|
||||
prompt = replace(_prompt, "|>user"=>"|>$(converPartnerName)")
|
||||
prompt = replace(prompt, "|>assistant"=>"|>$(a.name)")
|
||||
|
||||
response = a.func[:text2textInstructLLM](prompt; llmkwargs=llmkwargs)
|
||||
response = a.func[:text2textInstructLLM](prompt; llmkwargs=llmkwargs, senderId=a.id)
|
||||
response = replace(response, "<|im_start|>"=> "")
|
||||
response = GeneralUtils.deFormatLLMtext(response, "granite3")
|
||||
response = GeneralUtils.deFormatLLMtext(response, a.llmFormatName)
|
||||
|
||||
# check whether LLM just repeat the previous dialogue
|
||||
for msg in a.chathistory
|
||||
|
||||
Reference in New Issue
Block a user