This commit is contained in:
narawat lamaiin
2024-05-04 18:05:46 +07:00
parent ae9d80df5e
commit dea3f0260e
3 changed files with 27 additions and 10 deletions

View File

@@ -154,10 +154,18 @@ function decisionMaker(a::T1, state::T2)::Dict{Symbol, Any} where {T1<:agent, T2
{Thought
"""
prompt = formatLLMtext_llama3instruct("system", _prompt)
# apply LLM specific instruct format
externalService = a.config[:externalservice][:text2textinstruct]
llminfo = externalService[:llminfo]
prompt =
if llminfo[:name] == "llama3instruct"
formatLLMtext_llama3instruct("system", _prompt)
else
error("llm model name is not defied yet $(@__LINE__)")
end
msgMeta = GeneralUtils.generate_msgMeta(
a.config[:externalservice][:text2textinstruct][:mqtttopic],
externalService[:mqtttopic],
senderName= "decisionMaker",
senderId= a.id,
receiverName= "text2textinstruct",
@@ -172,9 +180,9 @@ function decisionMaker(a::T1, state::T2)::Dict{Symbol, Any} where {T1<:agent, T2
:kwargs=> Dict(
:max_tokens=> 512,
:stop=> ["<|eot_id|>"],
)
)
)
)
_response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg)
_thoughtJsonStr = _response[:response][:text]
@@ -252,7 +260,15 @@ function progressValueEstimator(a::T1, state::T2)::Tuple{String, Integer} where
$(JSON3.write(state[:thoughtHistory]))
"""
prompt = formatLLMtext_llama3instruct("system", _prompt)
# apply LLM specific instruct format
externalService = a.config[:externalservice][:text2textinstruct]
llminfo = externalService[:llminfo]
prompt =
if llminfo[:name] == "llama3instruct"
formatLLMtext_llama3instruct("system", _prompt)
else
error("llm model name is not defied yet $(@__LINE__)")
end
msgMeta = GeneralUtils.generate_msgMeta(
a.config[:externalservice][:text2textinstruct][:mqtttopic],
@@ -267,8 +283,12 @@ function progressValueEstimator(a::T1, state::T2)::Tuple{String, Integer} where
:msgMeta=> msgMeta,
:payload=> Dict(
:text=> prompt,
:kwargs=> Dict(
:max_tokens=> 512,
:stop=> ["<|eot_id|>"],
)
)
)
)
_response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg)
_thoughtJsonStr = _response[:response][:text]