This commit is contained in:
narawat lamaiin
2025-06-03 10:08:17 +07:00
parent b3537a83e0
commit ff4db039ab
2 changed files with 67 additions and 67 deletions

View File

@@ -231,11 +231,11 @@ function decisionMaker(state::T1, additionalinfo, text2textInstructLLM::Function
response = GeneralUtils.deFormatLLMtext(response, llmFormatName)
think, response = GeneralUtils.extractthink(response)
if occursin("NULL", response)
errornote = "\nYour previous attempt was NULL. This is not allowed"
println("\nERROR SQLLLM decisionMaker(). Attempt $attempt/$maxattempt. $errornote ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
continue
end
# if occursin("NULL", response)
# errornote = "\nYour previous attempt contain NULL. It is not allowed in your response"
# println("\nERROR SQLLLM decisionMaker(). Attempt $attempt/$maxattempt. $errornote --(not qualify response)--> \n$response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
# continue
# end
responsedict = nothing
try
@@ -252,13 +252,13 @@ function decisionMaker(state::T1, additionalinfo, text2textInstructLLM::Function
if length(is_requiredKeys_in_responsedictKey) > length(requiredKeys)
errornote = "Your previous attempt has more key points than answer's required key points."
println("\nERROR YiemAgent generatechat() $errornote --> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
println("\nERROR YiemAgent generatechat() $errornote --(not qualify response)--> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
continue
elseif !all(is_requiredKeys_in_responsedictKey)
zeroind = findall(x -> x == 0, is_requiredKeys_in_responsedictKey)
missingkeys = [requiredKeys[i] for i in zeroind]
errornote = "$missingkeys are missing from your previous response"
println("\nERROR YiemAgent generatechat() $errornote --> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
println("\nERROR YiemAgent generatechat() $errornote --(not qualify response)--> $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
continue
end
@@ -279,14 +279,14 @@ function decisionMaker(state::T1, additionalinfo, text2textInstructLLM::Function
toollist = ["TABLEINFO", "RUNSQL"]
if responsedict[:action_name] toollist
errornote = "Your previous attempt has action_name that is not in the tool list"
println("\nERROR SQLLLM decisionMaker(). Attempt $attempt/$maxattempt. $errornote --> $(responsedict[:action_name]) ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
println("\nERROR SQLLLM decisionMaker(). Attempt $attempt/$maxattempt. $errornote --(not qualify response)--> $(responsedict[:action_name]) ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
continue
end
for i in toollist
if occursin(i, responsedict[:action_input])
errornote = "Your previous attempt has action_name in action_input which is not allowed"
println("\nERROR SQLLLM decisionMaker(). Attempt $attempt/$maxattempt. $errornote --> $(responsedict[:action_input]) ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
println("\nERROR SQLLLM decisionMaker(). Attempt $attempt/$maxattempt. $errornote --(not qualify response)--> $(responsedict[:action_input]) ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
continue
end
end
@@ -721,7 +721,7 @@ function evaluator(state::T1, thoughtDict, text2textInstructLLM::Function, llmFo
if accepted_as_answer ["yes", "no"]
errornote = "Your previous attempt's accepted_as_answer has wrong format"
println("\nERROR SQLLLM evaluator() Attempt $attempt/$maxattempt. $errornote --> $(responsedict[:accepted_as_answer]) ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
println("\nERROR SQLLLM evaluator() Attempt $attempt/$maxattempt. $errornote --(not qualify response)--> $(responsedict[:accepted_as_answer]) ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
continue
end
@@ -1207,7 +1207,7 @@ function query(query::T, executeSQL::Function, text2textInstructLLM::Function;
wine_name varchar(128) not null,
winery varchar(128) not null,
vintage integer not null,
region varchar(128) not null,
region varchar(128) not null, -- A field used to store the name of a wine-producing region, such as Napa Valley (California), Bordeaux, Champagne, Tuscany, etc.
country varchar(128) not null,
wine_type varchar(128) not null,
grape varchar(128) not null,
@@ -1217,7 +1217,7 @@ function query(query::T, executeSQL::Function, text2textInstructLLM::Function;
tannin integer,
acidity integer,
fizziness integer,
tasting_notes text,
tasting_notes text, -- A field used to record the distinctive flavors of wine such as floral, citrus, apple, earthy, daisy, etc.
note text,
other_attributes jsonb,
@@ -1285,7 +1285,7 @@ function query(query::T, executeSQL::Function, text2textInstructLLM::Function;
multithread=false)
# compare all high value state answer then select the best one
if length(highValueState) > 0
if length(highValueState) > 1
# open("/appfolder/app/highValueState.json", "w") do io
# JSON3.pretty(io, highValueState)
# end

View File

@@ -1,5 +1,5 @@
"""
Default system message template:
# -------------------------------- Default system message template ------------------------------- #
<Your role>
- You are a helpful assistant
@@ -13,7 +13,7 @@ Default system message template:
Ex. To be the leading innovator in sustainable technology by 2030, transforming global energy systems.
</Your vision>
<Your mission>
- state the goalp
- state the goal
Ex. Empowering communities through clean energy solutions to create a sustainable future.
</Your mission>
<Your mission's objective includes>
@@ -64,7 +64,7 @@ Default system message template:
Example:
# ------------------------------------------- Example: ------------------------------------------- #
<Your profile>
- You are a founder of a tech startup