update
This commit is contained in:
@@ -131,54 +131,6 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
||||
# """
|
||||
# end
|
||||
|
||||
# systemmsg =
|
||||
# """
|
||||
# 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.
|
||||
|
||||
# At each round of conversation, the user will give you the current situation:
|
||||
# User Query: ...
|
||||
# Example: ...
|
||||
# Your Q&A: ...
|
||||
# Your work progress: ...
|
||||
# Evaluation: Evaluation of the latest action and observation
|
||||
# Suggestion: ...
|
||||
|
||||
# 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
|
||||
# - 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.
|
||||
# - 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".
|
||||
# - Text information in the database usually stored in lower case. If your search returns empty, try using lower case to search.
|
||||
|
||||
# You should then respond to the user with interleaving Understanding, Reasoning, Plan, Action:
|
||||
# 1) Understanding:
|
||||
# - State your understanding about the current situation.
|
||||
# 2) Reasoning:
|
||||
# - 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.
|
||||
# 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[SQL], which you can use to get the data from the database. "SQL" is a 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 ';'.
|
||||
# 5) Action_input: Input to the action
|
||||
# 6) Observation: Result of the immediately preceding action
|
||||
|
||||
# You should only respond in format as described below:
|
||||
# Understanding: ...
|
||||
# Reasoning: ...
|
||||
# Plan: ...
|
||||
# Action_name: ...
|
||||
# Action_input: ...
|
||||
|
||||
# Let's begin!
|
||||
# """
|
||||
|
||||
systemmsg =
|
||||
"""
|
||||
You are a helpful assistant that find the data from a database to satisfy the user's query.
|
||||
@@ -272,7 +224,7 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
||||
<|start_header_id|>assistant<|end_header_id|>
|
||||
"""
|
||||
response = text2textInstructLLM(prompt)
|
||||
println("\nSQL decisionMaker() rawresponse: ", response)
|
||||
println("\nSQL decisionMaker() rawresponse: \n", response)
|
||||
|
||||
if occursin("NULL", response)
|
||||
errornote = "\nSQL decisionMaker() NULL response is not allowed"
|
||||
@@ -282,7 +234,7 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
||||
|
||||
header = ["Understanding", "Reasoning", "Plan", "Action_name", "Action_input", "Observation"]
|
||||
|
||||
#[TESTING] detect if there are more than 1 key per categories
|
||||
# detect if there are more than 1 key per categories
|
||||
count = GeneralUtils.countGivenWords(response, header)
|
||||
duplicateKeywordFlag = false
|
||||
for (i, v) in enumerate(count)
|
||||
@@ -856,7 +808,7 @@ function transition(state::T, args::NamedTuple
|
||||
# so that other simulation start from this same node is not contaminated with actioninput
|
||||
listAllTable_json(executeSQL)
|
||||
elseif thoughtDict[:action_name] == "TABLEINFO"
|
||||
input = copy(JSON3.read(thoughtDict[:action_input])) # BUG thoughtDict[:action_input] = "\"wine\""
|
||||
input = thoughtDict[:action_input] # BUG thoughtDict[:action_input] = "\"wine\""
|
||||
tableinfo(executeSQL, input)
|
||||
elseif thoughtDict[:action_name] == "GETDATA"
|
||||
response = SQLexecution(executeSQL, thoughtDict[:action_input])
|
||||
|
||||
Reference in New Issue
Block a user