WrenAI icon indicating copy to clipboard operation
WrenAI copied to clipboard

Feature(wren-ai-service): SQL Correction Refinement

Open imAsterSun opened this issue 1 year ago • 0 comments

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:

  1. 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 error table not found, column not found and others
    • error_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
  2. 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]

imAsterSun avatar Jun 14 '24 06:06 imAsterSun