This application provides a
data query method, apparatus, device, and medium based on
natural language recognition, belonging to the field of
data query technology. The method includes: obtaining extended keywords based on user
natural language queries; obtaining pattern information and
business knowledge based on the extended keywords, user
natural language queries, and a vector
database; generating target prompt words based on the pattern information,
business knowledge, user natural language queries, and
system prompt word templates; generating multiple candidate query statements through a target large
language model based on the target prompt words and model generation parameters, and determining the optimal
query statement; executing the optimal
query statement in a
database test environment, obtaining an execution
result set and capturing abnormal information; validating the execution
result set and obtaining a
verification result; if the abnormal information is empty and the
verification result is qualified, then generating a
visualization chart based on the extended keywords, the optimal
query statement, and the qualified
result set. This application can improve the accuracy of power data queries.