This commit is contained in:
narawat lamaiin
2024-04-23 10:58:34 +07:00
parent 3b87f53af2
commit d833d5d22e
2 changed files with 13 additions and 11 deletions

View File

@@ -141,8 +141,8 @@ function chat_mistral_openorca(a::agentReflex)
$conversation
<|assistant|>
"""
response = sendReceivePrompt(a, prompt, a.config[:text2text][:mqtttopic],
response = sendReceivePrompt(a, prompt, a.config[:text2textchat][:mqtttopic],
timeout=180, stopword=["<|", "</"])
response = split(response, "<|")[1]
response = split(response, "</")[1]
@@ -193,14 +193,14 @@ function planner_mistral_openorca(a::agentReflex)
# skip objective and plan because LLM is going to generate new plan
shorttermMemory = dictToString(a.memory[:shortterm], skiplist=["Objective:", "Plan 1:"])
@show "---> 2"
aboutYourself =
"""
Your name is $(a.name)
$(a.roles[a.role])
$(a.roleSpecificInstruction[a.role])
"""
@show "---> 3"
# assistant_plan_prompt =
# """
# <s>

View File

@@ -53,7 +53,7 @@ function sendReceivePrompt(a::T1, prompt::String, sendtopic::String;
max_tokens::Integer=256, timeout::Integer=120, temperature::AbstractFloat=0.2,
stopword::T2=["nostopwordyet"],
seed=nothing) where {T1<:agent, T2<:Vector{<:AbstractString}}
println("---> 4")
# copy a.msgMeta instead of using GeneralUtils.generate_msgMeta because if I want to custom
# msgMeta for some communication I can do it during that agent instantiation and the custom
# msgMeta will effect all of the communication in that agent without effecting all agent
@@ -68,11 +68,13 @@ function sendReceivePrompt(a::T1, prompt::String, sendtopic::String;
outgoing_msg = Dict(
:msgMeta=> msgMeta,
:text=> prompt,
:max_tokens=> max_tokens,
:temperature=> temperature,
:stopword=> stopword,
:seed=> seed,
:payload=> Dict(
:text=> prompt,
:max_tokens=> max_tokens,
:temperature=> temperature,
:stopword=> stopword,
:seed=> seed,
),
)
# send prompt
@@ -430,7 +432,7 @@ function isUsePlans(a::agentReflex)
isuseplan = true
else
# if LLM mentions any tools, use Plan/Thought/Act loop
response = sendReceivePrompt(a, prompt, a.config[:text2text][:mqtttopic], max_tokens=64,
response = sendReceivePrompt(a, prompt, a.config[:text2textchat][:mqtttopic], max_tokens=64,
timeout=180, stopword=["<|", "</"])
response = split(response, "<|")[1]
if occursin("yes", String(response))