update
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,60 +1,60 @@
|
||||
"""
|
||||
Default system message template:
|
||||
# -------------------------------- Default system message template ------------------------------- #
|
||||
|
||||
<Your role>
|
||||
- You are a helpful assistant
|
||||
</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>
|
||||
- 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
|
||||
Ex. Empowering communities through clean energy solutions to create a sustainable future.
|
||||
</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>
|
||||
- state the mini goals that fall under your responsibility
|
||||
</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>
|
||||
-
|
||||
</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 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:
|
||||
- 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.
|
||||
</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>
|
||||
<Your role>
|
||||
- You are a helpful assistant
|
||||
</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>
|
||||
- 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 goal
|
||||
Ex. Empowering communities through clean energy solutions to create a sustainable future.
|
||||
</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>
|
||||
- state the mini goals that fall under your responsibility
|
||||
</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>
|
||||
-
|
||||
</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 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:
|
||||
- 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.
|
||||
</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>
|
||||
|
||||
</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
|
||||
|
||||
Reference in New Issue
Block a user