update
This commit is contained in:
@@ -210,7 +210,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:
|
||||||
- GETDATA[SQL], which you can use to get the data from the database. "SQL" is a single SQL command to be executed against the database.
|
- 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.
|
||||||
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
|
||||||
@@ -282,13 +282,20 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
|||||||
|
|
||||||
header = ["Understanding", "Reasoning", "Plan", "Action_name", "Action_input", "Observation"]
|
header = ["Understanding", "Reasoning", "Plan", "Action_name", "Action_input", "Observation"]
|
||||||
|
|
||||||
# detect if there are more than 1 key per categories
|
#[TESTING] detect if there are more than 1 key per categories
|
||||||
count = GeneralUtils.countGivenWords(response, header)
|
count = GeneralUtils.countGivenWords(response, header)
|
||||||
if sum(count) > length(header)
|
duplicateKeywordFlag = false
|
||||||
errornote = "\nSQL decisionMaker() duplicated keywords"
|
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__)
|
println("Attempt $attempt $errornote ", @__FILE__, " ", @__LINE__)
|
||||||
continue
|
duplicateKeywordFlag = true
|
||||||
|
break
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
duplicateKeywordFlag == true ? continue : nothing
|
||||||
|
|
||||||
# textToDict() search for action_input
|
# textToDict() search for action_input
|
||||||
responsedict = GeneralUtils.textToDict(response, header,
|
responsedict = GeneralUtils.textToDict(response, header,
|
||||||
@@ -317,7 +324,7 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
|||||||
|
|
||||||
for i in toollist
|
for i in toollist
|
||||||
if occursin(i, responsedict[:action_input])
|
if occursin(i, responsedict[:action_input])
|
||||||
errornote = "\nSQL decisionMaker() 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__)
|
println("Attempt $attempt $errornote ", @__FILE__, " ", @__LINE__)
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
@@ -325,7 +332,7 @@ 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]
|
||||||
if length(JSON3.write(responsedict[i])) == 0
|
if length(JSON3.write(responsedict[i])) == 0
|
||||||
errornote = "\nSQL decisionMaker() $i is empty"
|
errornote = "\n $i is empty"
|
||||||
println("Attempt $attempt $errornote ", @__FILE__, " ", @__LINE__)
|
println("Attempt $attempt $errornote ", @__FILE__, " ", @__LINE__)
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
@@ -335,7 +342,7 @@ 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
|
||||||
errornote = "\nSQL decisionMaker() $i has more than one key"
|
errornote = "\n $i has more than one key"
|
||||||
println("Attempt $attempt $errornote ", @__FILE__, " ", @__LINE__)
|
println("Attempt $attempt $errornote ", @__FILE__, " ", @__LINE__)
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user