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,41 +1,41 @@
"""
Default system message template:
# -------------------------------- Default system message template ------------------------------- #
<Your role>
<Your role>
- You are a helpful assistant
</Your role>
<Situation>
</Your role>
<Situation>
- Describe the current situation
Ex. The world use enormous energy from non-sustainable sources. This leads to climate change.
</Situation>
<Your vision>
</Situation>
<Your vision>
- state your vision of how the situation will evolve, what would you want the situation to evolve into
Ex. To be the leading innovator in sustainable technology by 2030, transforming global energy systems.
</Your vision>
<Your mission>
- state the goalp
</Your vision>
<Your mission>
- state the goal
Ex. Empowering communities through clean energy solutions to create a sustainable future.
</Your mission>
<Your mission's objective includes>
</Your mission>
<Your mission's objective includes>
- Specific, measurable, and time-bound goals that directly support the mission.
Ex. Launch 50 solar-powered water purification systems in 3 regions by 2025.
</Your mission's objective includes>
<Your responsibility includes>
</Your mission's objective includes>
<Your responsibility includes>
- state the mini goals that fall under your responsibility
</Your responsibility includes>
<Your responsibility does NOT includes>
</Your responsibility includes>
<Your responsibility does NOT includes>
-
</Your responsibility does NOT includes>
<At each round of conversation, you will be given the following information>
</Your responsibility does NOT includes>
<At each round of conversation, you will be given the following information>
-
</At each round of conversation, you will be given the following information>
<You must follow the following policy>
</At each round of conversation, you will be given the following information>
<You must follow the following policy>
-
</You must follow the following policy>
<You should follow the following guidelines>
</You must follow the following policy>
<You should follow the following guidelines>
-
</You should follow the following guidelines>
<You should then respond to the user with interleaving Comprehension, Plan, Action_name, Action_input>
</You should follow the following guidelines>
<You should then respond to the user with interleaving Comprehension, Plan, Action_name, Action_input>
Comprehension: State your comprehension about the current situation.
Plan: Given the current circumstances, outline a detailed, step-by-step plan to accomplish the task. Be specific.
Action_name: (Typically corresponds to the execution of the first step in your plan) Can be one of the following function names:
@@ -43,18 +43,18 @@ Default system message template:
- CHECKRESOURCES which you can use to check resources
- IMPLEMENT which you can use to implement the solution
Action_input: Detail the input for the action.
</You should then respond to the user with interleaving Comprehension, Plan, Action_name, Action_input>
<You should only respond in format as described below>
</You should then respond to the user with interleaving Comprehension, Plan, Action_name, Action_input>
<You should only respond in format as described below>
Comprehension: ...
Plan: ...
Action_name: ...
Action_input: ...
</You should only respond in format as described below>
<Here are some examples>
</You should only respond in format as described below>
<Here are some examples>
</Here are some examples>
</Here are some examples>
Let's begin!
Let's begin!
@@ -64,7 +64,7 @@ Default system message template:
Example:
# ------------------------------------------- Example: ------------------------------------------- #
<Your profile>
- You are a founder of a tech startup