update
This commit is contained in:
@@ -231,6 +231,9 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen
|
|||||||
|
|
||||||
Let's begin!
|
Let's begin!
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
header = ["Understanding:", "Reasoning:", "Plan:", "Action_name:", "Action_input:"]
|
||||||
|
dictkey = ["understanding", "reasoning", "plan", "action_name", "action_input"]
|
||||||
|
|
||||||
chathistory = chatHistoryToText(a.chathistory)
|
chathistory = chatHistoryToText(a.chathistory)
|
||||||
|
|
||||||
@@ -316,8 +319,16 @@ function decisionMaker(a::T; recent::Integer=5)::Dict{Symbol,Any} where {T<:agen
|
|||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
header = ["Understanding:", "Reasoning:", "Plan:", "Action_name:", "Action_input:"]
|
# check whether response has all header
|
||||||
dictkey = ["understanding", "reasoning", "plan", "action_name", "action_input"]
|
detected_kw = GeneralUtils.detect_keyword(header, response)
|
||||||
|
if sum(values(detected_kw)) < length(header)
|
||||||
|
errornote = "\nSQL evaluator() response does not have all header"
|
||||||
|
continue
|
||||||
|
elseif sum(values(detected_kw)) > length(header)
|
||||||
|
errornote = "\nSQL evaluator() response has duplicated header"
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
|
||||||
responsedict = GeneralUtils.textToDict(response, header;
|
responsedict = GeneralUtils.textToDict(response, header;
|
||||||
dictKey=dictkey, symbolkey=true)
|
dictKey=dictkey, symbolkey=true)
|
||||||
|
|
||||||
@@ -1229,6 +1240,9 @@ function generatequestion(a, text2textInstructLLM::Function; recent=nothing)::St
|
|||||||
|
|
||||||
Let's begin!
|
Let's begin!
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
header = ["Understanding:", "Q1:"]
|
||||||
|
dictkey = ["understanding", "q1"]
|
||||||
|
|
||||||
context =
|
context =
|
||||||
if length(a.memory[:shortmem][:available_wine]) != 0
|
if length(a.memory[:shortmem][:available_wine]) != 0
|
||||||
@@ -1339,8 +1353,16 @@ function generatequestion(a, text2textInstructLLM::Function; recent=nothing)::St
|
|||||||
error("no answer found in the response ", Dates.now(), " ", @__FILE__, " ", @__LINE__)
|
error("no answer found in the response ", Dates.now(), " ", @__FILE__, " ", @__LINE__)
|
||||||
end
|
end
|
||||||
|
|
||||||
header = ["Understanding:", "Q1:"]
|
# check whether response has all header
|
||||||
dictkey = ["understanding", "q1"]
|
detected_kw = GeneralUtils.detect_keyword(header, response)
|
||||||
|
if sum(values(detected_kw)) < length(header)
|
||||||
|
errornote = "\nSQL evaluator() response does not have all header"
|
||||||
|
continue
|
||||||
|
elseif sum(values(detected_kw)) > length(header)
|
||||||
|
errornote = "\nSQL evaluator() response has duplicated header"
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
|
||||||
responsedict = GeneralUtils.textToDict(response, header;
|
responsedict = GeneralUtils.textToDict(response, header;
|
||||||
dictKey=dictkey, symbolkey=true)
|
dictKey=dictkey, symbolkey=true)
|
||||||
response = "Q1: " * responsedict[:q1]
|
response = "Q1: " * responsedict[:q1]
|
||||||
@@ -1424,6 +1446,17 @@ function generateSituationReport(a, text2textInstructLLM::Function; skiprecent::
|
|||||||
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="qwen")
|
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="qwen")
|
||||||
|
|
||||||
response = text2textInstructLLM(prompt)
|
response = text2textInstructLLM(prompt)
|
||||||
|
|
||||||
|
# check whether response has all header
|
||||||
|
detected_kw = GeneralUtils.detect_keyword(header, response)
|
||||||
|
if sum(values(detected_kw)) < length(header)
|
||||||
|
errornote = "\nYiemAgent generateSituationReport() response does not have all header"
|
||||||
|
continue
|
||||||
|
elseif sum(values(detected_kw)) > length(header)
|
||||||
|
errornote = "\nYiemAgent generateSituationReport() response has duplicated header"
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
|
||||||
responsedict = GeneralUtils.textToDict(response, header;
|
responsedict = GeneralUtils.textToDict(response, header;
|
||||||
dictKey=dictkey, symbolkey=true)
|
dictKey=dictkey, symbolkey=true)
|
||||||
|
|
||||||
@@ -1459,6 +1492,9 @@ function detectWineryName(a, text)
|
|||||||
|
|
||||||
Let's begin!
|
Let's begin!
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
header = ["Winery_names:"]
|
||||||
|
dictkey = ["winery_names"]
|
||||||
|
|
||||||
response = nothing # placeholder for show when error msg show up
|
response = nothing # placeholder for show when error msg show up
|
||||||
|
|
||||||
@@ -1481,8 +1517,16 @@ function detectWineryName(a, text)
|
|||||||
println("\n~~~ detectWineryName() ", Dates.now(), " ", @__FILE__, " ", @__LINE__)
|
println("\n~~~ detectWineryName() ", Dates.now(), " ", @__FILE__, " ", @__LINE__)
|
||||||
pprintln(response)
|
pprintln(response)
|
||||||
|
|
||||||
header = ["Winery_names:"]
|
# check whether response has all header
|
||||||
dictkey = ["winery_names"]
|
detected_kw = GeneralUtils.detect_keyword(header, response)
|
||||||
|
if sum(values(detected_kw)) < length(header)
|
||||||
|
errornote = "\nSQL evaluator() response does not have all header"
|
||||||
|
continue
|
||||||
|
elseif sum(values(detected_kw)) > length(header)
|
||||||
|
errornote = "\nSQL evaluator() response has duplicated header"
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
|
||||||
responsedict = GeneralUtils.textToDict(response, header;
|
responsedict = GeneralUtils.textToDict(response, header;
|
||||||
dictKey=dictkey, symbolkey=true)
|
dictKey=dictkey, symbolkey=true)
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
"description": "agent role"
|
"description": "agent role"
|
||||||
},
|
},
|
||||||
"organization": {
|
"organization": {
|
||||||
"value": "yiem_hq",
|
"value": "yiem_branch_1",
|
||||||
"description": "organization name"
|
"description": "organization name"
|
||||||
},
|
},
|
||||||
"externalservice": {
|
"externalservice": {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ function executeSQLVectorDB(sql)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function text2textInstructLLM(prompt::String; maxattempt=3)
|
function text2textInstructLLM(prompt::String; maxattempt=2)
|
||||||
msgMeta = GeneralUtils.generate_msgMeta(
|
msgMeta = GeneralUtils.generate_msgMeta(
|
||||||
config[:externalservice][:loadbalancer][:mqtttopic];
|
config[:externalservice][:loadbalancer][:mqtttopic];
|
||||||
msgPurpose="inference",
|
msgPurpose="inference",
|
||||||
@@ -60,7 +60,7 @@ function text2textInstructLLM(prompt::String; maxattempt=3)
|
|||||||
|
|
||||||
response = nothing
|
response = nothing
|
||||||
for attempts in 1:maxattempt
|
for attempts in 1:maxattempt
|
||||||
_response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=300, maxattempt=maxattempt)
|
_response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=180, maxattempt=maxattempt)
|
||||||
payload = _response[:response]
|
payload = _response[:response]
|
||||||
if _response[:success] && payload[:text] !== nothing
|
if _response[:success] && payload[:text] !== nothing
|
||||||
response = _response[:response][:text]
|
response = _response[:response][:text]
|
||||||
@@ -234,7 +234,7 @@ a = YiemAgent.sommelier(
|
|||||||
)
|
)
|
||||||
|
|
||||||
while true
|
while true
|
||||||
println("your respond: ")
|
print("your respond: ")
|
||||||
user_answer = readline()
|
user_answer = readline()
|
||||||
response = YiemAgent.conversation(a, Dict(:text=> user_answer))
|
response = YiemAgent.conversation(a, Dict(:text=> user_answer))
|
||||||
println("\n$response")
|
println("\n$response")
|
||||||
|
|||||||
Reference in New Issue
Block a user