update
This commit is contained in:
@@ -272,10 +272,10 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
||||
# check whether response has all header
|
||||
detected_kw = GeneralUtils.detect_keyword(header, response)
|
||||
if sum(values(detected_kw)) < length(header)
|
||||
errornote = "\nSQL decisionMaker() response does not have all header"
|
||||
errornote = "\nSQLLLM decisionMaker() response does not have all header"
|
||||
continue
|
||||
elseif sum(values(detected_kw)) > length(header)
|
||||
errornote = "\nSQL decisionMaker() response has duplicated header"
|
||||
errornote = "\nSQLLLM decisionMaker() response has duplicated header"
|
||||
continue
|
||||
end
|
||||
|
||||
@@ -457,16 +457,14 @@ function evaluator(state::T1, text2textInstructLLM::Function
|
||||
response = replace(response, "**"=>"")
|
||||
response = replace(response, "***"=>"")
|
||||
|
||||
# make sure every header is in the response
|
||||
for i in header
|
||||
detected = GeneralUtils.detect_keyword(i, response)
|
||||
if detected === nothing
|
||||
errornote = "Your previous response didn't provide $i"
|
||||
errorFlag = true
|
||||
end
|
||||
end
|
||||
if errorFlag
|
||||
continue # skip to the next iteration
|
||||
# check whether response has all header
|
||||
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;
|
||||
@@ -1143,6 +1141,9 @@ function generatequestion(state::T1, context, text2textInstructLLM::Function;
|
||||
|
||||
Let's begin!
|
||||
"""
|
||||
|
||||
header = ["Understanding:", "Q1:"]
|
||||
dictkey = ["understanding", "q1"]
|
||||
|
||||
workprogress = ""
|
||||
for (k, v) in state[:thoughtHistory]
|
||||
@@ -1186,8 +1187,6 @@ function generatequestion(state::T1, context, text2textInstructLLM::Function;
|
||||
response = replace(response, '`'=>"")
|
||||
end
|
||||
|
||||
header = ["Understanding:", "Q1:"]
|
||||
dictkey = ["understanding", "q1"]
|
||||
responsedict = GeneralUtils.textToDict(response, header;
|
||||
dictKey=dictkey, symbolkey=true)
|
||||
response = "Q1: " * responsedict[:q1]
|
||||
|
||||
@@ -64,18 +64,6 @@ function text2textInstructLLM(prompt::String; maxattempt=3)
|
||||
println("</text2textInstructLLM()> attempt $attempts/$maxattempt failed ", @__FILE__, ":", @__LINE__, " $(Dates.now())\n")
|
||||
sleep(3)
|
||||
end
|
||||
|
||||
|
||||
|
||||
# response = _response[:response][:text]
|
||||
# if response !== nothing
|
||||
# break
|
||||
# else
|
||||
# println("\n<text2textInstructLLM()> attempt $attempts/$maxattempt failed ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||
# pprintln(outgoingMsg)
|
||||
# println("</text2textInstructLLM()> attempt $attempts/$maxattempt failed ", @__FILE__, ":", @__LINE__, " $(Dates.now())\n")
|
||||
# sleep(3)
|
||||
# end
|
||||
end
|
||||
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user