|
|
|
@@ -133,25 +133,26 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
|
|
|
|
|
|
|
|
|
|
|
systemmsg =
|
|
|
|
systemmsg =
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
You are a helpful assistant that get the data from a database to satisfy the user's query.
|
|
|
|
You are a helpful assistant that find the data from a database to satisfy the user's query.
|
|
|
|
You are also eager to improve your helpfulness.
|
|
|
|
You are also eager to improve your helpfulness.
|
|
|
|
|
|
|
|
|
|
|
|
At each round of conversation, the user will give you the current situation:
|
|
|
|
At each round of conversation, the user will give you the current situation:
|
|
|
|
User Query: ...
|
|
|
|
User Query: ...
|
|
|
|
Hints: ...
|
|
|
|
Example: ...
|
|
|
|
Your Q&A: ...
|
|
|
|
Your Q&A: ...
|
|
|
|
Your work progress: ...
|
|
|
|
Your work progress: ...
|
|
|
|
Evaluation: Evaluation of the latest action and observation
|
|
|
|
Evaluation: Evaluation of the latest action and observation
|
|
|
|
Suggestion: ...
|
|
|
|
Suggestion: ...
|
|
|
|
|
|
|
|
|
|
|
|
You should consider the following guidelines:
|
|
|
|
You must follow the following guidelines:
|
|
|
|
|
|
|
|
- Keep SQL queries focused only on the provided information.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You should follow the following guidelines:
|
|
|
|
- Do not create any table in the database
|
|
|
|
- Do not create any table in the database
|
|
|
|
- Column name can be the same in different tables. Refer to column comments to get more details by using TABLEINFO function
|
|
|
|
|
|
|
|
- A junction table can be used to link tables together. Another use case is for filtering data.
|
|
|
|
- A junction table can be used to link tables together. Another use case is for filtering data.
|
|
|
|
- If you can't find a single table that can be used to answer the user's query, try joining multiple tables to see if you can obtain the answer.
|
|
|
|
- If you can't find a single table that can be used to answer the user's query, try joining multiple tables to see if you can obtain the answer.
|
|
|
|
- If you are unable to find the requested information, kindly inform the user, "The current data in our database does not provide the specific answer to your query".
|
|
|
|
- If you are unable to find the requested information, kindly inform the user, "The current data in our database does not provide the specific answer to your query".
|
|
|
|
- Text information in the database usually stored in lower case. If your search returns empty, try using lower case to search.
|
|
|
|
- Text information in the database usually stored in lower case. If your search returns empty, try using lower case to search.
|
|
|
|
- Do not use backticks (`). Use double quotes instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You should then respond to the user with interleaving Understanding, Reasoning, Plan, Action:
|
|
|
|
You should then respond to the user with interleaving Understanding, Reasoning, Plan, Action:
|
|
|
|
1) Understanding:
|
|
|
|
1) Understanding:
|
|
|
|
@@ -160,8 +161,7 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
|
|
|
- State your step by step reasoning about the current situation.
|
|
|
|
- State your step by step reasoning about the current situation.
|
|
|
|
3) Plan: Given the current circumstances, outline a detailed, step-by-step plan to accomplish the task. Be specific.
|
|
|
|
3) Plan: Given the current circumstances, outline a detailed, step-by-step plan to accomplish the task. Be specific.
|
|
|
|
4) Action_name (Must be aligned with your plan): Can be one of the following functions:
|
|
|
|
4) Action_name (Must be aligned with your plan): Can be one of the following functions:
|
|
|
|
- TABLEINFO[list_of_table_name], which you can use to get the data type of a table column. "list_of_table_name" is a list of table name you want to get info. e.g. TABLEINFO["table name 1", "table name 2"]
|
|
|
|
- GETDATA, which you can use to get the data from the database. Action_input for this function must be a single SQL query to be executed against the database.
|
|
|
|
- GETDATA[SQL], which you can use to get the data from the database. "SQL" is the single SQL command to be executed against the database.
|
|
|
|
|
|
|
|
For more effective text search, it's necessary to use case-insensitivity and the ILIKE operator.
|
|
|
|
For more effective text search, it's necessary to use case-insensitivity and the ILIKE operator.
|
|
|
|
Do not wrap the SQL as it will be executed against the database directly and SQL must be ended with ';'.
|
|
|
|
Do not wrap the SQL as it will be executed against the database directly and SQL must be ended with ';'.
|
|
|
|
5) Action_input: Input to the action
|
|
|
|
5) Action_input: Input to the action
|
|
|
|
@@ -173,7 +173,6 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
|
|
|
Plan: ...
|
|
|
|
Plan: ...
|
|
|
|
Action_name: ...
|
|
|
|
Action_name: ...
|
|
|
|
Action_input: ...
|
|
|
|
Action_input: ...
|
|
|
|
Observation: ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Let's begin!
|
|
|
|
Let's begin!
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
@@ -203,7 +202,7 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
$(context[:tablelist])
|
|
|
|
$(context[:tablelist])
|
|
|
|
User query: $(state[:thoughtHistory][:question])
|
|
|
|
User query: $(state[:thoughtHistory][:question])
|
|
|
|
Hints: $similarSQL_
|
|
|
|
Example: $similarSQL_
|
|
|
|
Your Q&A: $QandA
|
|
|
|
Your Q&A: $QandA
|
|
|
|
Your work progress: $workprogress
|
|
|
|
Your work progress: $workprogress
|
|
|
|
Evaluation: $(state[:evaluation])
|
|
|
|
Evaluation: $(state[:evaluation])
|
|
|
|
@@ -223,37 +222,70 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
<|start_header_id|>assistant<|end_header_id|>
|
|
|
|
<|start_header_id|>assistant<|end_header_id|>
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
response = text2textInstructLLM(prompt)
|
|
|
|
response = text2textInstructLLM(prompt)
|
|
|
|
|
|
|
|
println("\nSQL decisionMaker() rawresponse: \n", response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if occursin("NULL", response)
|
|
|
|
|
|
|
|
errornote = "\nSQL decisionMaker() NULL response is not allowed"
|
|
|
|
|
|
|
|
println("Attempt $attempt $errornote ", @__FILE__, " ", @__LINE__)
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
header = ["Understanding", "Reasoning", "Plan", "Action_name", "Action_input", "Observation"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# detect if there are more than 1 key per categories
|
|
|
|
|
|
|
|
count = GeneralUtils.countGivenWords(response, header)
|
|
|
|
|
|
|
|
duplicateKeywordFlag = false
|
|
|
|
|
|
|
|
for (i, v) in enumerate(count)
|
|
|
|
|
|
|
|
keyword = header[i]
|
|
|
|
|
|
|
|
keywordNumber = v
|
|
|
|
|
|
|
|
if keywordNumber > 1
|
|
|
|
|
|
|
|
errornote = "\nSQL query has duplicated keyword, $keyword"
|
|
|
|
|
|
|
|
println("Attempt $attempt $errornote ", @__FILE__, " ", @__LINE__)
|
|
|
|
|
|
|
|
duplicateKeywordFlag = true
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
duplicateKeywordFlag == true ? continue : nothing
|
|
|
|
|
|
|
|
|
|
|
|
# textToDict() search for action_input
|
|
|
|
# textToDict() search for action_input
|
|
|
|
responsedict = GeneralUtils.textToDict(response,
|
|
|
|
responsedict = GeneralUtils.textToDict(response, header,
|
|
|
|
["Understanding", "Reasoning", "Plan", "Action_name", "Action_input", "Observation"],
|
|
|
|
|
|
|
|
rightmarker=":", symbolkey=true, lowercasekey=true)
|
|
|
|
rightmarker=":", symbolkey=true, lowercasekey=true)
|
|
|
|
|
|
|
|
|
|
|
|
delete!(responsedict, :observation)
|
|
|
|
delete!(responsedict, :observation)
|
|
|
|
|
|
|
|
|
|
|
|
# remove backticks
|
|
|
|
# remove backticks Error occurred: MethodError: no method matching occursin(::String, ::Vector{String})
|
|
|
|
if occursin("```", responsedict[:action_input])
|
|
|
|
if occursin("```", responsedict[:action_input])
|
|
|
|
responsedict[:action_input] =
|
|
|
|
sql = GeneralUtils.extract_triple_backtick_text(responsedict[:action_input])[1]
|
|
|
|
GeneralUtils.extract_triple_backtick_text(responsedict[:action_input])
|
|
|
|
if sql[1:4] == "sql\n"
|
|
|
|
|
|
|
|
sql = sql[5:end]
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
sql = split(sql, ';') # some time there are comments in the sql
|
|
|
|
|
|
|
|
sql = sql[1] * ';'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
responsedict[:action_input] = sql
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
toollist = ["TABLEINFO", "GETDATA"]
|
|
|
|
toollist = ["TABLEINFO", "GETDATA"]
|
|
|
|
if responsedict[:action_name] ∉ toollist
|
|
|
|
if responsedict[:action_name] ∉ toollist
|
|
|
|
error("SQL decisionMaker() didn't use the given functions ", @__FILE__, " ", @__LINE__)
|
|
|
|
errornote = "\nYou must only use the given functions"
|
|
|
|
|
|
|
|
println("Attempt $attempt $errornote ", @__FILE__, " ", @__LINE__)
|
|
|
|
|
|
|
|
continue
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
for i in toollist
|
|
|
|
for i in toollist
|
|
|
|
if occursin(i, responsedict[:action_input])
|
|
|
|
if occursin(i, responsedict[:action_input])
|
|
|
|
error("Action_name is in action_input which is not allowed.")
|
|
|
|
errornote = "\n action_name is in action_input which is not allowed."
|
|
|
|
|
|
|
|
println("Attempt $attempt $errornote ", @__FILE__, " ", @__LINE__)
|
|
|
|
|
|
|
|
continue
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
for i ∈ [:understanding, :reasoning, :plan, :action_name, :action_input]
|
|
|
|
for i ∈ [:understanding, :reasoning, :plan, :action_name, :action_input]
|
|
|
|
if length(JSON3.write(responsedict[i])) == 0
|
|
|
|
if length(JSON3.write(responsedict[i])) == 0
|
|
|
|
error("$i is empty ", @__FILE__, " ", @__LINE__)
|
|
|
|
errornote = "\n $i is empty"
|
|
|
|
|
|
|
|
println("Attempt $attempt $errornote ", @__FILE__, " ", @__LINE__)
|
|
|
|
|
|
|
|
continue
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
@@ -261,22 +293,16 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
|
|
|
for i ∈ [:understanding, :reasoning, :plan, :action_name, :action_input]
|
|
|
|
for i ∈ [:understanding, :reasoning, :plan, :action_name, :action_input]
|
|
|
|
matchkeys = GeneralUtils.findMatchingDictKey(responsedict, i)
|
|
|
|
matchkeys = GeneralUtils.findMatchingDictKey(responsedict, i)
|
|
|
|
if length(matchkeys) > 1
|
|
|
|
if length(matchkeys) > 1
|
|
|
|
error("DecisionMaker has more than one key per categories")
|
|
|
|
errornote = "\n $i has more than one key"
|
|
|
|
|
|
|
|
println("Attempt $attempt $errornote ", @__FILE__, " ", @__LINE__)
|
|
|
|
|
|
|
|
continue
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
state[:decisionMaker] = responsedict
|
|
|
|
state[:decisionMaker] = responsedict
|
|
|
|
|
|
|
|
|
|
|
|
return responsedict
|
|
|
|
return responsedict
|
|
|
|
catch e
|
|
|
|
|
|
|
|
io = IOBuffer()
|
|
|
|
|
|
|
|
showerror(io, e)
|
|
|
|
|
|
|
|
errorMsg = String(take!(io))
|
|
|
|
|
|
|
|
st = sprint((io, v) -> show(io, "text/plain", v), stacktrace(catch_backtrace()))
|
|
|
|
|
|
|
|
println("")
|
|
|
|
|
|
|
|
println("\n~~~ SQLLLM decisionMaker() Attempt $attempt. Error occurred: $errorMsg\n$st ", @__FILE__, " ", @__LINE__)
|
|
|
|
|
|
|
|
println("")
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
error("DecisionMaker failed to generate a thought ", response)
|
|
|
|
error("DecisionMaker failed to generate a thought ", response)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@@ -302,7 +328,7 @@ julia>
|
|
|
|
# Signature
|
|
|
|
# Signature
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
function evaluator(state::T1, text2textInstructLLM::Function;
|
|
|
|
function evaluator(state::T1, text2textInstructLLM::Function;
|
|
|
|
addSQLVectorDB::Union{Function, Nothing}=nothing
|
|
|
|
insertSQLVectorDB::Union{Function, Nothing}=nothing
|
|
|
|
) where {T1<:AbstractDict}
|
|
|
|
) where {T1<:AbstractDict}
|
|
|
|
|
|
|
|
|
|
|
|
# systemmsg =
|
|
|
|
# systemmsg =
|
|
|
|
@@ -446,8 +472,9 @@ function evaluator(state::T1, text2textInstructLLM::Function;
|
|
|
|
"reasoning" is agent's step-by-step reasoning about the current situation
|
|
|
|
"reasoning" is agent's step-by-step reasoning about the current situation
|
|
|
|
"plan" is agent's plan to complete the task from the current situation
|
|
|
|
"plan" is agent's plan to complete the task from the current situation
|
|
|
|
"action_name" is the name of the action taken, which can be one of the following functions:
|
|
|
|
"action_name" is the name of the action taken, which can be one of the following functions:
|
|
|
|
- TABLEINFO[list_of_table_name], which you can use to get the data type of a table column. "list_of_table_name" is a list of table name you want to get info. e.g. TABLEINFO["table name 1", "table name 2"]
|
|
|
|
- GETDATA, which you can use to get the data from the database. Action_input for this function must be a single SQL query to be executed against the database.
|
|
|
|
- GETDATA[SQL], which you can use to get the data from the database. "SQL" is the single SQL command to be executed against the database.
|
|
|
|
For more effective text search, it's necessary to use case-insensitivity and the ILIKE operator.
|
|
|
|
|
|
|
|
Do not wrap the SQL as it will be executed against the database directly and SQL must be ended with ';'.
|
|
|
|
"action_input" is the input to the action
|
|
|
|
"action_input" is the input to the action
|
|
|
|
"observation" is result of the preceding immediate action
|
|
|
|
"observation" is result of the preceding immediate action
|
|
|
|
|
|
|
|
|
|
|
|
@@ -768,7 +795,7 @@ function transition(state::T, args::NamedTuple
|
|
|
|
context = args[:context]
|
|
|
|
context = args[:context]
|
|
|
|
executeSQL::Function = args[:executeSQL]
|
|
|
|
executeSQL::Function = args[:executeSQL]
|
|
|
|
text2textInstructLLM::Function = args[:text2textInstructLLM]
|
|
|
|
text2textInstructLLM::Function = args[:text2textInstructLLM]
|
|
|
|
addSQLVectorDBF::Function = args[:addSQLVectorDB]
|
|
|
|
insertSQLVectorDB::Function = args[:insertSQLVectorDB]
|
|
|
|
querySQLVectorDBF::Function = args[:querySQLVectorDB]
|
|
|
|
querySQLVectorDBF::Function = args[:querySQLVectorDB]
|
|
|
|
|
|
|
|
|
|
|
|
# getting SQL from vectorDB
|
|
|
|
# getting SQL from vectorDB
|
|
|
|
@@ -781,7 +808,7 @@ function transition(state::T, args::NamedTuple
|
|
|
|
# so that other simulation start from this same node is not contaminated with actioninput
|
|
|
|
# so that other simulation start from this same node is not contaminated with actioninput
|
|
|
|
listAllTable_json(executeSQL)
|
|
|
|
listAllTable_json(executeSQL)
|
|
|
|
elseif thoughtDict[:action_name] == "TABLEINFO"
|
|
|
|
elseif thoughtDict[:action_name] == "TABLEINFO"
|
|
|
|
input = copy(JSON3.read(thoughtDict[:action_input]))
|
|
|
|
input = thoughtDict[:action_input] # BUG thoughtDict[:action_input] = "\"wine\""
|
|
|
|
tableinfo(executeSQL, input)
|
|
|
|
tableinfo(executeSQL, input)
|
|
|
|
elseif thoughtDict[:action_name] == "GETDATA"
|
|
|
|
elseif thoughtDict[:action_name] == "GETDATA"
|
|
|
|
response = SQLexecution(executeSQL, thoughtDict[:action_input])
|
|
|
|
response = SQLexecution(executeSQL, thoughtDict[:action_input])
|
|
|
|
@@ -804,7 +831,7 @@ function transition(state::T, args::NamedTuple
|
|
|
|
isterminal::Bool = haskey(response, :isterminal) ? response[:isterminal] : false
|
|
|
|
isterminal::Bool = haskey(response, :isterminal) ? response[:isterminal] : false
|
|
|
|
newNodeKey, newstate = makeNewState(state, thoughtDict, rawresponse, JSON3.write(result), select, reward, isterminal)
|
|
|
|
newNodeKey, newstate = makeNewState(state, thoughtDict, rawresponse, JSON3.write(result), select, reward, isterminal)
|
|
|
|
progressvalue::Integer = evaluatorF(newstate, text2textInstructLLM;
|
|
|
|
progressvalue::Integer = evaluatorF(newstate, text2textInstructLLM;
|
|
|
|
addSQLVectorDB=addSQLVectorDBF)
|
|
|
|
insertSQLVectorDB=insertSQLVectorDB)
|
|
|
|
|
|
|
|
|
|
|
|
return (newNodeKey=newNodeKey, newstate=newstate, progressvalue=progressvalue)
|
|
|
|
return (newNodeKey=newNodeKey, newstate=newstate, progressvalue=progressvalue)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@@ -887,7 +914,7 @@ julia> println(result)
|
|
|
|
# Signature
|
|
|
|
# Signature
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
function query(query::T, executeSQL::Function, text2textInstructLLM::Function;
|
|
|
|
function query(query::T, executeSQL::Function, text2textInstructLLM::Function;
|
|
|
|
addSQLVectorDB::Union{Function, Nothing}=nothing,
|
|
|
|
insertSQLVectorDB::Union{Function, Nothing}=nothing,
|
|
|
|
similarSQLVectorDB::Union{Function, Nothing}=nothing,
|
|
|
|
similarSQLVectorDB::Union{Function, Nothing}=nothing,
|
|
|
|
) where {T<:AbstractString}
|
|
|
|
) where {T<:AbstractString}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -931,7 +958,7 @@ function query(query::T, executeSQL::Function, text2textInstructLLM::Function;
|
|
|
|
executeSQL=executeSQL,
|
|
|
|
executeSQL=executeSQL,
|
|
|
|
text2textInstructLLM=text2textInstructLLM,
|
|
|
|
text2textInstructLLM=text2textInstructLLM,
|
|
|
|
querySQLVectorDB=similarSQLVectorDB,
|
|
|
|
querySQLVectorDB=similarSQLVectorDB,
|
|
|
|
addSQLVectorDB=addSQLVectorDB,
|
|
|
|
insertSQLVectorDB=insertSQLVectorDB,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
earlystop(state) = state[:reward] >= 8 ? true : false
|
|
|
|
earlystop(state) = state[:reward] >= 8 ? true : false
|
|
|
|
@@ -945,8 +972,14 @@ function query(query::T, executeSQL::Function, text2textInstructLLM::Function;
|
|
|
|
extracted = resultState[:thoughtHistory][latestKey]
|
|
|
|
extracted = resultState[:thoughtHistory][latestKey]
|
|
|
|
|
|
|
|
|
|
|
|
# add to vectorDB only if the answer is achieved and the state is terminal
|
|
|
|
# add to vectorDB only if the answer is achieved and the state is terminal
|
|
|
|
if addSQLVectorDB !== nothing && resultState[:isterminal] == true
|
|
|
|
if insertSQLVectorDB !== nothing && resultState[:isterminal] == true &&
|
|
|
|
addSQLVectorDB(resultState[:thoughtHistory][:question], sql)
|
|
|
|
resultState[:rawresponse] !== nothing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
insertSQLVectorDB(resultState[:thoughtHistory][:question], sql)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if extracted === nothing #BUG
|
|
|
|
|
|
|
|
println("query() return nothing")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
return (text=extracted, rawresponse=resultState[:rawresponse])
|
|
|
|
return (text=extracted, rawresponse=resultState[:rawresponse])
|
|
|
|
@@ -1017,11 +1050,11 @@ function generatequestion(state::T1, context, text2textInstructLLM::Function;
|
|
|
|
|
|
|
|
|
|
|
|
systemmsg =
|
|
|
|
systemmsg =
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
You are a helpful assistant that generate multiple questions about the current situation.
|
|
|
|
You are a SQL expert that generate multiple questions about the current situation.
|
|
|
|
|
|
|
|
|
|
|
|
At each round of conversation, the user will give you the current situation:
|
|
|
|
At each round of conversation, the user will give you the current situation:
|
|
|
|
User query: ...
|
|
|
|
User query: ...
|
|
|
|
Hints: ...
|
|
|
|
Example: ...
|
|
|
|
Your work progress: ...
|
|
|
|
Your work progress: ...
|
|
|
|
|
|
|
|
|
|
|
|
About the tables in the database:
|
|
|
|
About the tables in the database:
|
|
|
|
@@ -1035,6 +1068,9 @@ function generatequestion(state::T1, context, text2textInstructLLM::Function;
|
|
|
|
3) Some information can be accessed by joining multiple tables.
|
|
|
|
3) Some information can be accessed by joining multiple tables.
|
|
|
|
4) Do not generate any question or comments at the end.
|
|
|
|
4) Do not generate any question or comments at the end.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You should follow the following guidelines:
|
|
|
|
|
|
|
|
- When querying data in the database, start with broad search terms and refine your query later for more precise results.
|
|
|
|
|
|
|
|
|
|
|
|
You should then respond to the user with:
|
|
|
|
You should then respond to the user with:
|
|
|
|
1) Understanding:
|
|
|
|
1) Understanding:
|
|
|
|
- State your understanding about the current situation.
|
|
|
|
- State your understanding about the current situation.
|
|
|
|
@@ -1052,6 +1088,13 @@ function generatequestion(state::T1, context, text2textInstructLLM::Function;
|
|
|
|
A3: ...
|
|
|
|
A3: ...
|
|
|
|
...
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Here are some examples:
|
|
|
|
|
|
|
|
Q: What information in the hints is not necessary based on the query?
|
|
|
|
|
|
|
|
A: Country is not specified in the query thus it should not be included in an SQL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Q: How can I modify a SQL example to fit my specific query needs?
|
|
|
|
|
|
|
|
A: ...
|
|
|
|
|
|
|
|
|
|
|
|
Let's begin!
|
|
|
|
Let's begin!
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1071,7 +1114,7 @@ function generatequestion(state::T1, context, text2textInstructLLM::Function;
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
$(context[:tablelist])
|
|
|
|
$(context[:tablelist])
|
|
|
|
User query: $(state[:thoughtHistory][:question])
|
|
|
|
User query: $(state[:thoughtHistory][:question])
|
|
|
|
Hints: $similarSQL
|
|
|
|
Example: $similarSQL
|
|
|
|
Your work progress: $workprogress
|
|
|
|
Your work progress: $workprogress
|
|
|
|
$errornote
|
|
|
|
$errornote
|
|
|
|
$noise
|
|
|
|
$noise
|
|
|
|
|