diff --git a/src/interface.jl b/src/interface.jl index 8a542d0..a16f05d 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -135,18 +135,19 @@ function decisionMaker(state::T1, additionalinfo, text2textInstructLLM::Function systemmsg = """ - You are a helpful assistant that find 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 question. You are also eager to improve your helpfulness. For your information: - Observation: Result of the immediately preceding action At each round of conversation, you will be given the following information: - User Query: ... - Closest SQL: The closest known SQL for this query - Your work progress: your progress so far - Evaluation: Evaluation of the immediately preceding action and observation - Suggestion: Suggestion for the immediately preceding action and observation + table_schema: schema of tables in the database + most_relevant_SQL: The closest known SQL for this question + query_result_of_most_relevant_SQL: the query result when executing the most_relevant_SQL against a database. + progress: your progress so far + evaluation: Evaluation of the immediately preceding action and observation + suggestion: Suggestion for the immediately preceding action and observation You must follow the following guidelines: - Keep SQL queries focused only on the provided information. @@ -207,12 +208,25 @@ function decisionMaker(state::T1, additionalinfo, text2textInstructLLM::Function context = """ - $(additionalinfo[:tablelist]) - Closest SQL: $similarSQL_ - Your work progress: $workprogress - Evaluation: $(state[:evaluation]) - Suggestion: $(state[:suggestion]) - P.S. $errornote + + $(additionalinfo[:tablelist]) + + + $similarSQL_ + + + winery: Chateau Montelena, wine_name: The Montelena Estate Cabernet Sauvignon, wine_id: 97264f71-007c-4cce-a3fe-2cc88fba4d05, vintage: 2017, region: Napa Valley, country: United States, wine_type: red, grape: Cabernet Sauvignon, serving_temperature: 15 to 18 Celsius, sweetness: 1, intensity: 5, tannin: 4, acidity: 4, tasting_notes: oak, vanilla, tobacco, blackberry, plum, black cherry, leather, earthy, smoke, price: 19.95, currency: USD + + + $workprogress + + + $(state[:evaluation]) + + + $(state[:suggestion]) + + P.S. $errornote """ @@ -230,7 +244,7 @@ function decisionMaker(state::T1, additionalinfo, text2textInstructLLM::Function response = GeneralUtils.deFormatLLMtext(response, llmFormatName) think, response = GeneralUtils.extractthink(response) - #[WORKING] check for tasting_notes occurs AFTER where in the sql + # LLM tends to generate observation given that it is in the input response = @@ -640,6 +654,7 @@ function evaluator(state::T1, additionalinfo, text2textInstructLLM::Function, ll At each round of conversation, you will be given the following information: Trajectory: A history of how you worked on the question chronologically. + table_schema: schema of tables in the database You must follow the following guidelines: - When the search returns no result, validate whether the SQL query makes sense before accepting it as a valid answer. @@ -696,8 +711,10 @@ function evaluator(state::T1, additionalinfo, text2textInstructLLM::Function, ll context = """ - $(additionalinfo[:tablelist]) - P.S. $errornote + + $(additionalinfo[:tablelist]) + + P.S. $errornote """ @@ -1171,7 +1188,6 @@ function query(query::T, executeSQL::Function, text2textInstructLLM::Function; context = Dict( :tablelist => """ - Here are SQL that used to create tables in the database: create table customer ( customer_id uuid primary key default gen_random_uuid (), customer_firstname varchar(128),