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