WrenAI
WrenAI copied to clipboard
Feature(wren-ai-service): SQL Correction Refinement
Description
Currently, the invalid generation results are all processed in 1 prompt. Now we proposed a refinement plan to separate the correction into 2 detailed steps:
- Error Classification
First, we pass the sql, the summary and the error message to LLM, let it analyzes the error message, and define the following additional attributes:
error_type: the error type of the invalid sql, currently we want it to identify 3 types of errortable not found,column not foundandotherserror_point: identify which part of the sql is incorrect, currently, it will be the wrong table name or wrong column name.- Then we compare the error_point to the mdl, to see if the table/column is truly not existed. Record it as the
mdl_check_result
- SQL Correction based on the Error Type After we attach 3 additional attributes to the original invalid results, the correction prompts will be generated according to the error_type of each invalid sql, then pass to LLM 1 by 1
Results
[TODO]