The invention relates to a power field Text2
SQL (Structured
Query Language)
data analysis method based on LLM (Logical
Language Model) and RAG (
Random Access Gateway), and solves the defects that a
retrieval result contains
noise and redundancy and a
large model still has a large number of illusion phenomena due to the absence of a vectorization model in a specific field and the singleness of
knowledge base types and dimensions in the RAG technology compared with the prior art. The method comprises the following steps: constructing a
data set of a Text2
SQL data analysis method in the power field; constructing a multi-dimensional text
knowledge base of the Text2
SQL data analysis method in the power field; fine adjustment of an LLM base of a Text2SQL data
analysis method in the
electric power field; constructing an RAG retrieval module of the Text2SQL data
analysis method in the power field; and constructing an Agent data analysis module of the Text2SQL data
analysis method in the power field, and performing data analysis
processing. According to the method, related information required by Text2SQL data analysis in the
electric power field can be obtained by a large
language model through retrieval on the basis of an RAG technology, meanwhile, the privacy and timely updating of the data are ensured by
field data stored in a
knowledge base form, and the model training cost is also greatly reduced by the LLM-based Text2SQL data analysis method taking a prompt project as a main part; and by setting the mixed retrieval parameters, the
retrieval result has relatively high accuracy, and the effect of Text2SQL data analysis is ensured.