This commit is contained in:
2025-03-14 12:32:09 +07:00
parent a22f9c52d2
commit 200a1d3e23
3 changed files with 71 additions and 500 deletions
+36 -71
View File
@@ -352,76 +352,39 @@ function getdata_decisionMaker(state::Dict, context::Dict, text2textInstructLLM:
Hints = "None"
# """
# Here are some useful SQL programs:
# $usefulSQL
# """
systemmsg =
"""
You are an assistant helping the user to execute SQL code from the user's query.
# systemmsg =
# """
# You are an assistant helping the user to execute SQL code from the user's query.
At each round of conversation, the user will give you:
Context: ...
User intention: ...
Code executed from the last round: ...
Execution error: execution error of the last round code.
# At each round of conversation, the user will give you:
# Context: ...
# User intention: ...
# Code executed from the last round: ...
# Execution error: execution error of the last round code.
You should consider the following guidelines:
- Text information in the database is sometimes stored in lower case. If your search returns empty, try using lower case to search.
# You should consider the following guidelines:
# - Text information in the database is sometimes stored in lower case. If your search returns empty, try using lower case to search.
You should then respond to the user with:
1) Comprehension:
- State your comprehension about the current situation.
3) Plan: Step-by-step instructions of how to complete the task.
- Focus on improving the code from the last round.
- Do not create any table in the database.
4) Code:
- Write new improved code.
- Do not wrap the code and no comment as it will be executed directly without any modification against the database.
# You should then respond to the user with:
# - thought: Why the code does not complete the task. What does the execution error imply exactly?
# - plan: Step-by-step instructions of how to complete the task.
# 1) Focus on improving the code from the last round.
# 2) Do not create any table in the database.
# - code:
# 1) Write new improved code.
# 2) Do not wrap the code and no comment as it will be executed directly without any modification against the database.
You should only respond in format as described below and nothing more:
Comprehension: ...
Plan:
1) ...
2) ...
...
Code: ...
# You should only respond in format as described below and nothing more:
# thought: ...
# plan:
# 1) ...
# 2) ...
# ...
# code: ...
# Let's begin!
# """
systemmsg = """
You are an assistant helping the user to execute SQL code from the user's query.
At each round of conversation, the user will give you:
Context: ...
User intention: ...
Code executed from the last round: ...
Execution error: execution error of the last round code.
You should consider the following guidelines:
- Text information in the database is sometimes stored in lower case. If your search returns empty, try using lower case to search.
You should then respond to the user with:
1) Comprehension:
- State your comprehension about the current situation.
3) Plan: Step-by-step instructions of how to complete the task.
- Focus on improving the code from the last round.
- Do not create any table in the database.
4) Code:
- Write new improved code.
- Do not wrap the code and no comment as it will be executed directly without any modification against the database.
You should only respond in format as described below and nothing more:
Comprehension: ...
Plan:
1) ...
2) ...
...
Code: ...
Let's begin!
"""
Let's begin!
"""
noise = ""
note_flag = ""
@@ -597,7 +560,7 @@ end
# Signature
"""
function extractContent_dataframe(df::DataFrame, text2textInstructLLM::Function
function extractContent_dataframe(df::DataFrame, text2textInstructLLM::Function, action::String
)::String
tablesize = size(df)
row = tablesize[1]
@@ -633,8 +596,7 @@ function extractContent_dataframe(df::DataFrame, text2textInstructLLM::Function
You are an assistant that readouts the resulting table after the user executing SQL command.
At each round of conversation, the user will give you:
- User intention: ...
- Resulting table dimension: ...
- User SQL: the SQL query user executed.
- Resulting table: The resulting table after executing the user's intention.
You should then respond to the user with:
@@ -652,9 +614,12 @@ function extractContent_dataframe(df::DataFrame, text2textInstructLLM::Function
Let's begin!
"""
usermsg = """
Resulting table: $dfstr
"""
usermsg =
"""
User SQL: $action
Resulting table: $dfstr
"""
_prompt =
[
Dict(:name => "system", :text => systemmsg),