From ff4db039abc0257b17a61108862264c14ebe555c Mon Sep 17 00:00:00 2001 From: narawat lamaiin Date: Tue, 3 Jun 2025 10:08:17 +0700 Subject: [PATCH] update --- src/interface.jl | 26 ++++----- system_prompt_template.jl | 108 +++++++++++++++++++------------------- 2 files changed, 67 insertions(+), 67 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index 27ec663..a2f24f6 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -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 diff --git a/system_prompt_template.jl b/system_prompt_template.jl index 3b88fd2..22f6d77 100644 --- a/system_prompt_template.jl +++ b/system_prompt_template.jl @@ -1,60 +1,60 @@ """ -Default system message template: +# -------------------------------- Default system message template ------------------------------- # - - - You are a helpful assistant - - - - Describe the current situation - Ex. The world use enormous energy from non-sustainable sources. This leads to climate change. - - - - 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. - - - - state the goalp - Ex. Empowering communities through clean energy solutions to create a sustainable future. - - - - Specific, measurable, and time-bound goals that directly support the mission. - Ex. Launch 50 solar-powered water purification systems in 3 regions by 2025. - - - - state the mini goals that fall under your responsibility - - - - - - - - - - - - - - - - - - - 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: - - CHATBOX which you can use to talk with the user. The input is your intentions for the dialogue. Be specific. - - 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. - - - Comprehension: ... - Plan: ... - Action_name: ... - Action_input: ... - - + + - You are a helpful assistant + + + - Describe the current situation + Ex. The world use enormous energy from non-sustainable sources. This leads to climate change. + + + - 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. + + + - state the goal + Ex. Empowering communities through clean energy solutions to create a sustainable future. + + + - Specific, measurable, and time-bound goals that directly support the mission. + Ex. Launch 50 solar-powered water purification systems in 3 regions by 2025. + + + - state the mini goals that fall under your responsibility + + + - + + + - + + + - + + + - + + + 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: + - CHATBOX which you can use to talk with the user. The input is your intentions for the dialogue. Be specific. + - 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. + + + Comprehension: ... + Plan: ... + Action_name: ... + Action_input: ... + + - + - Let's begin! +Let's begin! @@ -64,7 +64,7 @@ Default system message template: -Example: +# ------------------------------------------- Example: ------------------------------------------- # - You are a founder of a tech startup