The invention relates to an
electric power field Text2
SQL (Structured
Query Language) generation method based on
structure control and feedback enhancement, which focuses on the problems of weak structure adaptability, low
semantic matching degree, poor execution stability and the like in an
electric power field Text2
SQL task. The method comprises the following steps: firstly, constructing a multi-view driven Prompt construction module, and fusing
electric power query semantic coding, an electric power
database Schema structure and historical execution feedback to generate a Prompt example set with
semantic consistency and structure
controllability; secondly, designing a structure-driven multi-
SQL generation module, generating a plurality of SQL candidates with consistent
semantics and various structures in combination with a temperature regulation and structure template guide mechanism, and meanwhile, ensuring the effectiveness of a candidate set in cooperation with structure legality detection and a conflict suppression strategy; and finally, providing a structure-semantic fusion driven SQL reordering method, performing
feature extraction and
score fusion from three dimensions of structure similarity,
semantic consistency and execution feasibility, and selecting an optimal SQL as a final query instruction. An execution result feedback chain mechanism is constructed, an example
pool and a Prompt construction strategy are continuously optimized, and a self-adaptive closed-loop generation
system is formed.