The invention relates to a question number method and device based on a double-layer thinking chain and a CTE operator
library,
computer equipment and a medium. The method comprises the steps of obtaining question number information and a related dynamic
domain knowledge set, loading the question number information and the dynamic
domain knowledge set into a prompt word template, generating a first prompt context and inputting the first prompt context into a
large model, and obtaining query demand information; installing question number information, query demand information, an entity view file, a relation view file and a table selection example into a prompt word template, generating a second prompt context, inputting the second prompt context into the
large model, and obtaining
query plan information; and splicing the
query plan information and a preset CTE operator
library to a second layer of thinking chain cue word template to generate a third prompt context, inputting the third prompt context into the
large model, obtaining an
SQL output by the large model, and executing the
SQL to obtain a question number result. According to the method, the accuracy of the
SQL generated by the large model can be improved, the complex index calculation step can be traced back, and the
repeatability of the generated result is high.