Database statement generation method and device, equipment, medium and program product

By using a pre-trained large language model to perform field correction and statement generation on database query statements, field alignment errors and statement credibility issues are solved, and more accurate and reliable database query is achieved.

CN119739731APending Publication Date: 2025-04-01BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411835304.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

In the process of converting database query statements, field alignment errors often occur in the process of converting database query statements, resulting in the generated database query statements being inaccurate enough and not effectively perform statement logical verification, resulting in unclear credibility of query statements.

Method used

A pre-trained large language model is used to parse the query field set from the target query information, and field correction of the query field based on the database field set of the target database to generate a query correction field set. Then, the corrected field set is input into the large language model to generate database statements and statement credibility verification information.

Benefits of technology

Through field correction and statement credibility verification, the accuracy and credibility of database statement generation are improved, ensuring reliable acquisition of query data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119739731A_ABST
    Figure CN119739731A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a database statement generation method and device, equipment, a medium and a program product. A specific embodiment of the method comprises the following steps: screening a query field set from target query information by utilizing a large language model for text conversion database statements; performing field correction on the query field according to a set database field set to generate a query correction field set; inputting the query correction field set into the large language model to generate database statements and statement credibility verification information; executing the database statement to screen query data from the target database; and displaying the query data and the statement credibility verification information on a target display terminal. The implementation mode is related to artificial intelligence, and on the basis of application of the large language model, the implementation mode not only improves the accuracy of database statement generation, but also ensures reliable acquisition of query data. In addition, due to generation of statement credibility verification information, the credibility of database statements is effectively guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the application fields of databases and large language models, and in particular to a database statement generation method, apparatus, device, medium, and program product. Background Art

[0002] Currently, in today's data-driven business environment, data query and analysis are becoming increasingly critical. How to accurately convert users' natural language questions into executable database query statements is crucial. For the conversion of database query statements, the usual approach is to use supervised learning techniques, such as sequence-to-sequence models, to learn the mapping relationship between natural language and database query statements to achieve database query statement conversion.

[0003] However, the inventors have found that when the above method is adopted, the following technical problems often occur:

[0004] In the process of converting database query statements, the model often encounters field alignment errors, resulting in inaccurate generated database query statements. In addition, the database query statements are not effectively verified for logical reasoning, resulting in unclear credibility of the database query statements.

[0005] The above information disclosed in this Background section is only for enhancement of understanding of the background of the inventive concept and therefore it may contain information that does not form the prior art that is already known in this country to a person of ordinary skill in the art. Summary of the invention

[0006] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.

[0007] Some embodiments of the present disclosure propose a database statement generation method, apparatus, device, medium and program product to solve the technical problems mentioned in the above background technology section.

[0008] In a first aspect, some embodiments of the present disclosure provide a method for generating a database statement, comprising: utilizing a pre-trained large language model for text-converting database statements to parse a query field set from acquired target query information; performing field correction on query fields in the query field set according to a database field set corresponding to a target database to generate a query correction field set; inputting the query correction field set into the large language model to generate a database statement and statement credibility verification information; executing the database statement to filter out query data from the target database; and displaying the query data and the statement credibility verification information on a target display terminal.

[0009] Optionally, the query correction field set includes: a non-time query field set and a time query field set; and the database field set set according to the corresponding setting of the target database, performing field correction on the query fields in the query field set to generate a query correction field set, including: according to the database field set, performing field adjustment on the non-time query fields in the non-time query field set to obtain a non-time query correction field set; determining the non-time query correction field set and the time query field set as the query correction field set.

[0010] Optionally, the above-mentioned field adjustment is performed on the non-time query fields in the non-time query field set according to the above-mentioned database field set to obtain the non-time query correction field set, including: for each non-time query field in the above-mentioned non-time query field set, an adjustment step is performed: using a target keyword matching algorithm, determining whether there is a database field in the above-mentioned database field set that matches the above-mentioned non-time query field; in response to determining that there is no database field, determining whether there is a database field in the above-mentioned database field set whose corresponding field vector similarity with the above-mentioned non-time query field meets a preset similarity condition; in response to determining that there is a database field that meets the preset similarity condition or there is a database field that matches the above-mentioned non-time query field, according to the database field that meets the preset similarity condition or the database field that matches the above-mentioned non-time query field, field adjustment is performed on the above-mentioned non-time query field to obtain the non-time query correction field.

[0011] Optionally, the above-mentioned execution of the above-mentioned database statement to filter out query data from the above-mentioned target database includes: executing the above-mentioned database statement to generate a statement execution result; in response to determining that the above-mentioned statement execution result indicates that the statement execution fails, executing a generation step: extracting query fields for the above-mentioned database statement to generate a statement field set; according to the above-mentioned database field set, adjusting the statement fields in the above-mentioned statement field set to obtain a statement correction field set; generating a database correction statement corresponding to the above-mentioned statement modification field set; executing the above-mentioned database correction statement to generate a correction statement execution result; in response to determining that the above-mentioned correction statement execution result indicates that the statement has not failed to execute, obtaining query data corresponding to the above-mentioned correction statement execution result; in response to determining that the above-mentioned correction statement execution result fails to execute, using the correction statement execution result as the statement execution result and the database correction statement as the database statement, and continuing to execute the above-mentioned generation step.

[0012] Optionally, the query correction field set is input into the large language model to generate database statements and statement credibility verification information, including: using the large language model to generate the database statements for the query correction field set; using the large language model to parse the database statements to generate statement credibility verification information in the form of structured data description.

[0013] Optionally, the above-mentioned large language model is generated by the following steps: obtaining a first initial large language model; using a general language sample set, performing model training on the above-mentioned first initial large language model to generate a second initial large language model; using a first text conversion database sentence sample set, performing model training on the above-mentioned second initial large language model to generate a third initial large language model; using a second text conversion database sentence sample set under the target domain, performing model training on the above-mentioned third initial large language model to generate the above-mentioned large language model.

[0014] Optionally, the second initial large language model is an initial large language model that performs key field extraction tasks, database statement completion tasks, and statement parsing tasks; and the method of using the first text-converted database statement sample set to perform model training on the second initial large language model to generate a third initial large language model comprises: performing model training on the second initial large language model according to the key field extraction sample set, database statement completion sample set, and statement parsing sample set included in the first text-converted database statement sample set to generate a third initial large language model.

[0015] Optionally, the key field extraction sample set includes: a pre-set time query field sample set, which is a sample set obtained by data enhancement based on a time expression transformation template, which is a template for transforming various time expressions in the query information, and the time query field in the database statement conforms to the time expression transformation form corresponding to the time template.

[0016] In a second aspect, some embodiments of the present disclosure provide a database statement generation device, comprising: a parsing unit, configured to use a pre-trained large language model for text-converting database statements to parse a query field set from the acquired target query information; a correction unit, configured to perform field correction on the query fields in the above query field set according to the database field set corresponding to the target database, so as to generate a query correction field set; a generation unit, configured to input the above query correction field set into the above large language model, so as to generate a database statement and statement credibility verification information; an execution unit, configured to execute the above database statement, so as to filter out query data from the above target database; and a display unit, configured to display the above query data and the above statement credibility verification information on a target display terminal.

[0017] Optionally, the query correction field set includes: a non-time query field set and a time query field set; and the correction unit can be configured to: perform field adjustments on the non-time query fields in the non-time query field set according to the database field set to obtain a non-time query correction field set; and determine the non-time query correction field set and the time query field set as the query correction field set.

[0018] Optionally, the correction unit can be configured to: for each non-time query field in the above-mentioned non-time query field set, perform an adjustment step: use a target keyword matching algorithm to determine whether there is a database field in the above-mentioned database field set that matches the above-mentioned non-time query field; in response to determining that there is no database field, determine whether there is a database field in the above-mentioned database field set whose corresponding field vector similarity with the above-mentioned non-time query field meets a preset similarity condition; in response to determining that there is a database field that meets the preset similarity condition or there is a database field that matches the above-mentioned non-time query field, perform field adjustment on the above-mentioned non-time query field according to the database field that meets the preset similarity condition or the database field that matches the above-mentioned non-time query field to obtain a non-time query correction field.

[0019] Optionally, the execution unit can be configured to: execute the above-mentioned database statement to generate a statement execution result; in response to determining that the above-mentioned statement execution result indicates that the statement execution failed, execute the generation step: extract the query field of the above-mentioned database statement to generate a statement field set; according to the above-mentioned database field set, adjust the statement fields in the above-mentioned statement field set to obtain a statement correction field set; generate a database correction statement corresponding to the above-mentioned statement modification field set; execute the above-mentioned database correction statement to generate a correction statement execution result; in response to determining that the above-mentioned correction statement execution result indicates that the statement has not failed to execute, obtain the query data corresponding to the above-mentioned correction statement execution result; in response to determining that the above-mentioned correction statement execution result fails to execute, use the correction statement execution result as the statement execution result, and the database correction statement as the database statement, and continue to execute the above-mentioned generation steps.

[0020] Optionally, the generation unit may be configured to: generate the database statement for the query correction field set using the large language model; and perform statement parsing on the database statement using the large language model to generate statement credibility verification information in the form of structured data description.

[0021] In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner in the first aspect.

[0022] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation manner in the first aspect is implemented.

[0023] In a fifth aspect, some embodiments of the present disclosure provide a computer program product, including a computer program, which implements the method described in any implementation manner in the above-mentioned first aspect when executed by a processor.

[0024] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the database statement generation method of some embodiments of the present disclosure. On the basis of applying the large language model, not only the accuracy of database statement generation is improved, but also the reliable acquisition of query data is ensured. In addition, the generation of statement credibility verification information effectively guarantees the credibility of database statements. Specifically, the reason why the relevant database statement generation is not accurate enough and the credibility of the database statement is unclear is that the model often has field alignment errors in the process of converting the database query statement, resulting in the generated database query statement being not accurate enough. In addition, the statement logic verification of the database query statement is not effectively performed, resulting in the unclear credibility of the database query statement. Based on this, the database statement generation method of some embodiments of the present disclosure, first, using the pre-trained large language model for text conversion database statement, parses the query field set from the acquired target query information, so as to facilitate database field alignment processing for the query field set. Then, according to the database field set corresponding to the target database, the query field in the above query field set is corrected to generate a query correction field set. Here, the query field is corrected to achieve field alignment between the query field and the database field, thereby ensuring the accuracy of the database statement. Next, the query correction field set is input into the large language model to generate database statements and statement credibility verification information. Here, based on the query correction field set, accurate database statements that match the database can be realized. By generating statement feasibility verification information, the credibility of the database statement can be effectively verified to ensure that the database statement has a certain degree of credibility. Then, the above database statement is executed to filter out query data from the above target database to achieve accurate query of the data. Finally, the query data and the statement credibility verification information are displayed on the target display terminal. In summary, through the database field set, the query field is corrected to ensure field alignment between the database field and the query field, and to ensure the accuracy of subsequent database statements. In addition, by generating statement credibility verification information, the statement logic and statement credibility of the database statement can be effectively guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.

[0026] Figure 1 is a schematic diagram of an application scenario of a database statement generation method according to some embodiments of the present disclosure;

[0027] Figure 2 is a flowchart of some embodiments of the database statement generation method according to the present disclosure;

[0028] Figure 3 is a flowchart of other embodiments of the method for generating a database statement according to the present disclosure;

[0029] Figure 4 It is a schematic diagram of the structure of some embodiments of the database statement generating device according to the present disclosure;

[0030] Figure 5 It is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION

[0031] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0032] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.

[0033] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0034] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0035] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0036] With regard to the collection, storage, and use of user personal information (such as target query information) involved in this disclosure, before performing the corresponding operations, the relevant organizations or individuals shall fulfill their obligations, including conducting personal information security impact assessments, fulfilling the obligation to inform the personal information subject, and obtaining the authorization and consent of the personal information subject in advance.

[0037] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0038] Figure 1 It is a schematic diagram of an application scenario of a database statement generation method according to some embodiments of the present disclosure.

[0039] exist Figure 1 In the application scenario, first, the electronic device 101 can use the pre-trained large language model 102 for text conversion database statements to parse the query field set 104 from the acquired target query information 103. In this application scenario, the target query information 103 can be "query the sales situation in Nanjing in yesterday's sales table". The query field set 104 may include: "Nanjing", "sales situation" and "yesterday". Then, the electronic device 101 can perform field correction on the query fields in the above query field set 104 according to the database field set 105 corresponding to the target database to generate a query correction field set 106. In this application scenario, the query correction field set 106 may include: "Nanjing City", "sales situation" and "yesterday". Furthermore, the electronic device 101 can input the above query correction field set 106 into the above large language model 102 to generate a database statement 107 and statement credibility verification information 108. In this application scenario, the database statement 107 can be: "SELECT * FROM sales WHER Ecity = "Nanjing" AND DATE (sale_date) = DATE_SUB (CURDATE (), INTERVAL 1DAY)". The statement credibility verification information 108 can be "{"location":"Nanjing", "time":"Yesterday", "task":"sales situation"}". Then, the electronic device 101 can execute the above database statement 107 to filter out the query data 109 from the above target database. In this application scenario, the query data 109 can be "Nanjing's sales data". Finally, the electronic device 101 can display the above query data 109 and the above statement credibility verification information 108 on the target display terminal 110.

[0040] It should be noted that the electronic device 101 can be hardware or software. When the electronic device is hardware, it can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or it can be implemented as a single server or a single terminal device. When the electronic device is embodied as software, it can be installed in the hardware devices listed above. It can be implemented as multiple software or software modules for providing distributed services, for example, or it can be implemented as a single software or software module. No specific limitation is made here.

[0041] It should be understood that Figure 1 The number of electronic devices in the embodiment is only for illustration. Any number of electronic devices may be provided according to implementation requirements.

[0042] Continue to refer Figure 2 , shows a process 200 of some embodiments of the database statement generation method according to the present disclosure. The database statement generation method comprises the following steps:

[0043] Step 201 , using a pre-trained large language model for text conversion database statements, parse a query field set from the acquired target query information.

[0044] In some embodiments, the execution subject of the above database statement generation method (for example Figure 1 The electronic device 101 shown can use a pre-trained large language model for text conversion database statements to parse the query field set from the acquired target query information. Among them, the large language model can be a large language model that generates corresponding database statements based on text information. For example, the large language model can be a large language model (LLM). The target query information can be query information in text form. For example, the target query information can be "query the sales situation in Nanjing in the sales table". The query field can be the field corresponding to the key query object in the target query information. The key query object can represent the key information to be queried in the target query information. For example, the key query object can be a "location query object", or a "table query object", or a "time query object". The query field can be the field content corresponding to the key query object. In practice, the query field set can include: location query field, table query field, business query field. For example, for the target query information is "query the sales situation in Nanjing in the sales table", the corresponding query field set can include: sales table, Nanjing, sales situation.

[0045] As an example, first, the execution subject may generate parsing prompt information for the query field, and then input the parsing prompt information and the target query information into the large language model to generate a query field set.

[0046] Step 202: According to the database field set corresponding to the target database, the query fields in the query field set are corrected to generate a query correction field set.

[0047] In some embodiments, the execution entity may perform field correction on the query fields in the query field set according to the database field set corresponding to the target database to generate a query correction field set. The database field may be a field described for the target database. For example, the database field may be a table field of each table in the database, or it may be a data feature field of a key data set stored in the database. For example, the database field set may include: user feature field, user sales data field, user address field, user profit value field. The database fields in the database field set may be fields pre-set for the target database. For example, the database field set may be determined based on the frequency of fields retrieved by the query statement.

[0048] Here, by performing field correction on the query fields in the above query field set, it is possible to ensure that the database fields corresponding to the query fields in the query field set are accurate, so that the subsequently generated database statements can accurately query the fields and achieve accurate query of the corresponding content of the database fields, thereby greatly improving the accuracy and efficiency of data queries.

[0049] As an example, first, the execution subject may determine that each query field in the query field set is to be converted into a field vector to generate a query field vector and obtain a query field vector set. Then, each database field in the database field set is to be determined to be converted into a field vector to generate a database field vector and obtain a database field vector set. Next, the query field vector set and the database field vector set are input into a multi-layer series of convolution layers to generate a first vector convolution similarity set. At least one first vector convolution similarity whose corresponding value is greater than the target value is selected from the first vector convolution similarity set. Next, for each first vector convolution similarity in at least one first vector convolution similarity, the query field and database field corresponding to the first vector convolution similarity are determined as the target query field and the target database field, respectively. The target query field is replaced with the target database field. Finally, the obtained field set after the database field replacement is determined as the query correction field set.

[0050] In some optional implementations of some embodiments, the query correction field set includes: a non-time query field set and a time query field set. Among them, the non-time query field is a query field that is not related to the time feature. For example, the non-time query field may be but is not limited to one of the following: a location query field, a task query field, a table query field, a store query field, and a user query field. The time query field may be a query field related to the time feature. For example, the time query field may be but is not limited to one of the following: an absolute time query field, a relative time query field, and a holiday query field. For example, the absolute time query field may be a query field for a date specifically indicated. For example, "July 18" is an absolute time. The relative time query field may be a query field for a date calculated and inferred based on the current time point. For example, the relative time may be "8:30 p.m. yesterday." The holiday query field may be a query field corresponding to a specific holiday or a special event date. For example, a specific holiday may be "Double Eleven."

[0051] Optionally, the execution subject corrects the query fields in the query field set according to the database field set corresponding to the target database to generate a query correction field set, which may include the following steps:

[0052] In the first step, according to the database field set, the non-time query field in the non-time query field set is adjusted to obtain a non-time query correction field set, wherein the non-time query correction field can be a field that is corrected from the non-time query field and matches the database field.

[0053] As an example, first, the above-mentioned execution entity can determine the non-time query field vector set and the database field vector set. Then, the non-time query field vector set and the above-mentioned database field vector set are input into multiple layers of convolutional layers connected in series to generate a second vector convolution similarity set. At least one second vector convolution similarity whose corresponding value is greater than the target value is screened out from the above-mentioned second vector convolution similarity set. Then, for each second vector convolution similarity in at least one second vector convolution similarity, the non-time query field and database field corresponding to the second vector convolution similarity are determined as the target non-time query field and the target database field, respectively. The target non-time query field is replaced with the target database field. Finally, the obtained field set after the execution database field is replaced is determined as the non-time query correction field set.

[0054] In the second step, the non-time query correction field set and the time query field set are determined as the query correction field set.

[0055] In some optional implementations of some embodiments, the execution subject adjusts the non-time query fields in the non-time query field set according to the database field set to obtain the non-time query correction field set, which may include the following steps:

[0056] In the first step, for each non-time query field in the above non-time query field set, perform the adjustment steps:

[0057] Sub-step 1, using a target keyword matching algorithm, determines whether there is a database field in the database field set that matches the non-time query field. The target keyword matching algorithm may be a pre-set algorithm for field matching based on keywords. For example, the target keyword matching algorithm may be an AC (Aho-Corasickautomaton) automaton.

[0058] Sub-step 2, in response to determining that it does not exist, determine whether there is a database field in the above database field set whose corresponding field vector similarity with the above non-time query field satisfies a preset similarity condition. The field vector similarity can represent the field semantic similarity between the non-time query field and the database field. The greater the field vector similarity, the higher the semantic similarity of the corresponding field. The preset similarity condition can be that the field vector similarity is the highest and the field vector similarity is greater than a predetermined similarity threshold.

[0059] As an example, first, the above-mentioned execution entity can generate a database field vector corresponding to each database field in the database field set to obtain a database field vector set. Among them, the database field vector can represent the content semantic characteristics of the field content corresponding to the database field. Then, a non-time query field vector corresponding to the non-time query field is generated. The non-time query field vector can represent the content semantic characteristics of the field content corresponding to the time query field. Determine the cosine similarity between each database field vector and the non-time query field vector as the field vector similarity to obtain a field vector similarity set. Finally, determine whether there is a database field in the above-mentioned database field set whose corresponding field vector similarity with the above-mentioned non-time query field meets the preset similarity condition.

[0060] Sub-step 3, in response to determining that there is a database field that meets the preset similarity condition or there is a database field that matches the above-mentioned non-time query field, the above-mentioned non-time query field is adjusted according to the database field that meets the preset similarity condition or the database field that matches the above-mentioned non-time query field to obtain a non-time query correction field.

[0061] As an example, the execution entity may replace the non-time query field with a database field that meets a preset similarity condition or a database field that matches the non-time query field to obtain a non-time query correction field.

[0062] Step 203: input the query correction field set into the large language model to generate database statements and statement credibility verification information.

[0063] In some embodiments, the above-mentioned execution entity may input the above-mentioned query correction field set into the above-mentioned large language model to generate a database statement and statement credibility verification information. Among them, the database statement may be a database query statement, that is, a database statement that queries the query content corresponding to the above-mentioned target query information. The statement credibility verification information may be information after credibility verification of the statement query logic and query content corresponding to the database statement. In practice, the statement credibility verification information may be information after verification in various forms. For example, the statement credibility verification information may be information in the form of a score, and the higher the score, the more correct the statement query logic corresponding to the corresponding database statement and the more accurate the query content. In addition, the statement credibility verification information may also be verification information in the form of text that represents whether the statement query logic and query content are accurate.

[0064] As an example, first, generation prompt information representing the generation of database statements and statement credibility verification information is generated. Then, the generation prompt information and the query correction field set are input into the large language model to generate database statements and statement credibility verification information.

[0065] In some optional implementations of some embodiments, the execution subject inputs the query correction field set into the large language model to generate database statements and statement credibility verification information, which may include the following steps:

[0066] The first step is to use the large language model to generate the database statement for the query correction field set.

[0067] As an example, first, the execution subject may generate statement generation prompt information representing the generation of a database statement, and then input the statement generation prompt information and the query correction field set into the large language model to generate a database statement.

[0068] In the second step, the database statements are parsed using the large language model to generate statement credibility verification information in the form of structured data description. The structured data description form may be a structured type of data description form. For example, the structured type of data description form may be in the form of a key-value pair.

[0069] Here, the generated database statements are reverse parsed. This process converts the database statements into user-friendly structured data descriptions, and the conversion process depends only on the semantic understanding of the database statements by the large language model, and has nothing to do with the information in the user's question. Therefore, the parsing results of this module are independent, and ordinary users can compare the results of the semantic understanding of the database statements to determine whether the database statements generated by the previous process meet the query goals of the previously input questions. This method is different from simply showing the original database statement code to the user, because the latter requires the user to have professional database statement interpretation capabilities.

[0070] For example, a user asks a question: I want to see a comparison of passenger flow data between Hefei and Nanjing today.

[0071] Database statement: SELECT city_name, SUM(total_customer_num)AS total_customer_flow, SUM(new_customer_num)AS new_customer_flow, SUM(old_customer_num)AS old_customer_flow FROM flag_shop_flow WHERE DATE(date_time)=DATE(NOW())AND YEAR(date_time)=YEAR(CURDATE())AND city_name IN('Hefei City', 'Nanjing City')GROUP BYcity_name.

[0072] The sentence credibility verification information can be: {"intent":"Today's customer flow in Hefei and Nanjing", "time":"Today", "shop_name":"", "region":"Hefei, Nanjing"}.

[0073] As an example, first, the execution subject may generate statement parsing prompt information corresponding to the database statement, and then input the statement parsing prompt information and the database statement into the large language model to generate feasibility verification information.

[0074] In some optional implementations of some embodiments, the large language model is generated by the following steps:

[0075] The first step is to obtain a first initial large language model. The first initial large language model may be a large language model that has not been trained yet. The first initial large language model may be a base large language model that has not been fine-tuned by instructions.

[0076] In the second step, the first initial large language model is trained using a general language sample set to generate a second initial large language model. The general language sample can be a general language understanding sample. For example, the general language sample set can be a large-scale general data set of more than 300,000.

[0077] Here, the first initial large language model is trained through the general language sample set to establish the model's basic cognition and general language comprehension capabilities. Here, the model training of the first initial large language model focuses on: enhancing the basic capabilities of the large language model and cultivating domain-independent reasoning capabilities.

[0078] In the third step, the second initial large language model is trained using the first text conversion database statement sample set to generate a third initial large language model. The first text conversion database statement sample may be a training sample of a text conversion database statement. For example, the first text conversion database statement sample set may be 3000+ high-quality business-related SQL data.

[0079] Here, the second initial large language model is trained through the first text-to-database statement sample set, focusing the model knowledge on a specific text-to-SQL business domain, so that the third initial large language model can learn the relevant functions of text-to-database statement conversion. Here, the model training focus of the second initial large language model includes: learning of domain-specific vocabulary and concepts, in-depth understanding of SQL grammar structure, and mapping capabilities between business logic and database queries.

[0080] In the fourth step, the third initial large language model is trained using the second text conversion database sentence sample set in the target domain to generate the large language model. The second text conversion database sentence sample may be a training sample of a text conversion database sentence in a specific scenario. The specific scenario may be a scenario set based on user needs. For example, the specific scenario may be a literary scenario.

[0081] Here, the third initial large language model is trained through the second text conversion database statement sample set, focusing the model knowledge on the text-to-SQL business field in a specific scenario. Here, the model training focus of the second initial large language model includes: enhanced understanding of time expressions, fuzzy semantic matching optimization, and knowledge granularity adjustment. Enhanced understanding of time expressions can improve the model's ability to recognize and process various time formats and expressions. Fuzzy semantic matching optimization can enhance the model's ability to handle imprecise queries and synonyms. Knowledge granularity adjustment can refine the model's understanding of business concepts and achieve more accurate query generation.

[0082] In some optional implementations of some embodiments, the second initial large language model is an initial large language model that performs key field extraction tasks, database statement completion tasks, and statement parsing tasks. Among them, the key field extraction task can be a task of extracting key fields. The database statement completion task can be a task of automatically completing database statements. The statement parsing task can be a task of parsing database statements.

[0083] Optionally, according to the key field extraction sample set, database sentence completion sample set and sentence parsing sample set included in the first text conversion database sentence sample set, the second initial large language model is trained to generate a third initial large language model. The key field extraction sample can be a sample related to keyword extraction. The database sentence completion sample can be a sample related to database sentence completion. The sentence parsing sample can be a sample related to database sentence parsing.

[0084] In some optional implementations of some embodiments, the above-mentioned key field extraction sample set includes: a preset time query field sample set. The above-mentioned time query field sample set is a sample set obtained by data enhancement based on the time expression transformation template. The above-mentioned time expression transformation template is a template for expression transformation of various time expressions in the query information. The time query field in the above-mentioned database statement conforms to the time expression transformation form corresponding to the above-mentioned time template. For example, the time expression transformation template can be:

[0085] "Last year (YEAR (time) = YEAR (CURDATE ()) - 1), YYYY year (YEAR (time) = YYYY), Qth quarter (QUARTER (time) = Q), Last quarter (QUARTER (time) = QUARTER (DATE_SUB (CURDATE (), INTERVAL1QUARTER))), Last month (MONTH (time) = MONTH (DATE_SUB (CURDATE (), INTERVAL1MONTH))), MM month (MONTH (time) = MM), Last week (YEARWEEK (time, 1) = YEARWEEK (CURDATE () - INTERVAL 1WEEK, 1)), This week (YEARWEEK (time, 1) = YEARWEEK (CURDATE (, 1)), Yesterday (DATE (time) = DATE_SUB (CURDATE (, INTERVAL1 1DAY)), 618 Shopping Festival (DATE(time)='YYYY-06-18'), YYYY year MM month DD day (DATE(time)='YYYY-MM-DD'), morning (HOUR(time) BETWEEN 0AND11), HH o'clock (HOUR(time)=HH), afternoon HH:30 (HOUR(time)=HH+12AND MINUTE(time)=30), MM minutes (MINUTE(time)=MM)".

[0086] Step 204: execute the above database statement to filter out query data from the above target database.

[0087] In some embodiments, the execution subject may execute the database statement to filter out query data from the target database, wherein the query data may be data content corresponding to the target query information.

[0088] Step 205: Display the query data and the statement credibility verification information on the target display terminal.

[0089] In some embodiments, the execution subject may display the query data and the statement credibility verification information on a target display terminal. In practice, the target display terminal may be an object user terminal for viewing the query logic and query content corresponding to the database statement.

[0090] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the database statement generation method of some embodiments of the present disclosure. On the basis of applying the large language model, not only the accuracy of database statement generation is improved, but also the reliable acquisition of query data is ensured. In addition, the generation of statement credibility verification information effectively guarantees the credibility of database statements. Specifically, the reason why the relevant database statement generation is not accurate enough and the credibility of the database statement is unclear is that the model often has field alignment errors in the process of converting the database query statement, resulting in the generated database query statement being not accurate enough. In addition, the statement logic verification of the database query statement is not effectively performed, resulting in the unclear credibility of the database query statement. Based on this, the database statement generation method of some embodiments of the present disclosure, first, using the pre-trained large language model for text conversion database statement, parses the query field set from the acquired target query information, so as to facilitate database field alignment processing for the query field set. Then, according to the database field set corresponding to the target database, the query field in the above query field set is corrected to generate a query correction field set. Here, the query field is corrected to achieve field alignment between the query field and the database field, thereby ensuring the accuracy of the database statement. Next, the query correction field set is input into the large language model to generate database statements and statement credibility verification information. Here, based on the query correction field set, accurate database statements that match the database can be realized. By generating statement feasibility verification information, the credibility of the database statement can be effectively verified to ensure that the database statement has a certain degree of credibility. Then, the above database statement is executed to filter out query data from the above target database to achieve accurate query of the data. Finally, the query data and the statement credibility verification information are displayed on the target display terminal. In summary, through the database field set, the query field is corrected to ensure field alignment between the database field and the query field, and to ensure the accuracy of subsequent database statements. In addition, by generating statement credibility verification information, the statement logic and statement credibility of the database statement can be effectively guaranteed.

[0091] Further references Figure 3 , shows a process 300 of another embodiment of the method for generating a database statement according to the present disclosure. The method for generating a database statement comprises the following steps:

[0092] Step 301 , using a pre-trained large language model for text conversion database statements, parse a query field set from the acquired target query information.

[0093] Step 302: According to the database field set corresponding to the target database, the query fields in the query field set are corrected to generate a query correction field set.

[0094] Step 303: input the query correction field set into the large language model to generate database statements and statement credibility verification information.

[0095] In some embodiments, the specific implementation of steps 301-303 and the technical effects thereof can be referred to in Figure 2 The steps 201-203 in the corresponding embodiment are not described in detail here.

[0096] Step 304: execute the above database statement to generate a statement execution result.

[0097] In some embodiments, an execution entity (e.g. Figure 1 The electronic device 101 shown can execute the above database statement to generate a statement execution result. The statement execution result can indicate whether the statement execution is successful or failed. The success or failure of the statement execution indicates whether there is a logical problem in the statement or the corresponding query data is not found.

[0098] Step 305, in response to determining that the statement execution result indicates that the statement execution failed, executing the generation step:

[0099] Step 3051, extract query fields from the above database statements to generate a statement field set.

[0100] In some embodiments, an execution entity (e.g. Figure 1 The electronic device 101 shown can extract query fields from the above database statement to generate a statement field set, wherein the statement fields can be various query conditions in the database statement.

[0101] As an example, the execution entity may utilize a preset rule engine to extract query fields from the database statement to generate a statement field set.

[0102] Step 3052: According to the database field set, the statement fields in the statement field set are adjusted to obtain a statement correction field set.

[0103] In some embodiments, the execution subject may adjust the statement fields in the statement field set according to the database field set to obtain a statement correction field set. The statement correction field may be a field that is corrected for the statement field and matches the database field. The specific implementation method will not be described in detail, and reference may be made to the generation of non-time query correction fields.

[0104] Step 3053, generating a database correction statement corresponding to the above statement modification field set.

[0105] In some embodiments, the execution subject may generate a database correction statement corresponding to the statement modification field set, wherein the database correction statement may be a database statement after the statement field is corrected.

[0106] As an example, the execution subject may perform statement combination on each statement correction field in the statement correction field set to generate a database correction statement.

[0107] Step 3054, execute the above database correction statement to generate a correction statement execution result.

[0108] In some embodiments, the execution subject may execute the database correction statement to generate a correction statement execution result, wherein the correction statement execution result may indicate whether the statement execution fails.

[0109] Step 3055: in response to determining that the execution result of the modified statement indicates that the statement has not failed to execute, query data corresponding to the execution result of the modified statement is obtained.

[0110] In some embodiments, in response to determining that the execution result of the modified statement indicates that the statement has not failed to execute, the execution subject may obtain query data corresponding to the execution result of the modified statement.

[0111] Step 306, in response to determining that the execution result of the above correction statement fails, the execution result of the correction statement is used as the statement execution result, and the database correction statement is used as the database statement, and the above generation step is continued.

[0112] In some embodiments, in response to determining that the execution result of the correction statement fails, the execution subject may use the correction statement execution result as the statement execution result and the database correction statement as the database statement to continue executing the generation step.

[0113] Step 307: Display the query data and the statement credibility verification information on the target display terminal.

[0114] from Figure 3 It can be seen that Figure 2 Compared with the description of some corresponding embodiments, Figure 3 In the process 300 of the database statement generation method in some corresponding embodiments, when it is determined that the statement execution result represents a statement execution failure, field adjustments are made to the query fields of the database statement according to the database field set to further adjust the database statement, further generate a more accurate database statement, and further execute the acquisition of query data.

[0115] Further references Figure 4 As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a database statement generation device. These device embodiments are similar to Figure 2 Corresponding to the method embodiments shown, the database statement generating device can be specifically applied to various electronic devices.

[0116] like Figure 4 As shown, a database statement generating device 400 includes: a parsing unit 401, a correction unit 402, a generating unit 403, an executing unit 404 and a display unit 405. The parsing unit 401 is configured to parse a query field set from the acquired target query information using a pre-trained large language model for text-to-database statement conversion; the correction unit 402 is configured to perform field correction on the query fields in the query field set according to the database field set corresponding to the target database to generate a query correction field set; the generating unit 403 is configured to input the query correction field set into the large language model to generate a database statement and statement credibility verification information; the executing unit 404 is configured to execute the database statement to filter out query data from the target database; and the display unit 405 is configured to display the query data and the statement credibility verification information on the target display terminal.

[0117] In some optional implementations of some embodiments, the above-mentioned query correction field set includes: a non-time query field set and a time query field set; and the correction unit 402 can be further configured to: according to the above-mentioned database field set, perform field adjustments on the non-time query fields in the above-mentioned non-time query field set to obtain a non-time query correction field set; and determine the above-mentioned non-time query correction field set and the above-mentioned time query field set as the above-mentioned query correction field set.

[0118] In some optional implementations of some embodiments, the correction unit 402 can be further configured to: for each non-time query field in the above-mentioned non-time query field set, perform an adjustment step: use the target keyword matching algorithm to determine whether there is a database field in the above-mentioned database field set that matches the above-mentioned non-time query field; in response to determining that there is no database field, determine whether there is a database field in the above-mentioned database field set whose corresponding field vector similarity with the above-mentioned non-time query field meets a preset similarity condition; in response to determining that there is a database field that meets the preset similarity condition or there is a database field that matches the above-mentioned non-time query field, perform field adjustment on the above-mentioned non-time query field according to the database field that meets the preset similarity condition or the database field that matches the above-mentioned non-time query field to obtain a non-time query correction field.

[0119] In some optional implementations of some embodiments, the execution unit 404 can be further configured to: execute the above-mentioned database statement to generate a statement execution result; in response to determining that the above-mentioned statement execution result indicates that the statement execution failed, execute the generation step: extract the query field of the above-mentioned database statement to generate a statement field set; according to the above-mentioned database field set, adjust the statement fields in the above-mentioned statement field set to obtain a statement correction field set; generate a database correction statement corresponding to the above-mentioned statement modification field set; execute the above-mentioned database correction statement to generate a correction statement execution result; in response to determining that the above-mentioned correction statement execution result indicates that the statement has not failed to execute, obtain the query data corresponding to the above-mentioned correction statement execution result; in response to determining that the above-mentioned correction statement execution result fails to execute, use the correction statement execution result as the statement execution result, and the database correction statement as the database statement, and continue to execute the above-mentioned generation steps.

[0120] In some optional implementations of some embodiments, the generation unit 403 may be further configured to: utilize the large language model to generate the database statement for the query correction field set; utilize the large language model to perform statement parsing on the database statement to generate statement credibility verification information in the form of structured data description.

[0121] It can be understood that the units recorded in the database statement generating device 400 and the reference Figure 2 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the database statement generating device 400 and the units included therein, and will not be described in detail here.

[0122] Reference below Figure 5 , which shows an electronic device (eg, Figure 1 Schematic diagram of the structure of the electronic device 101)500. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0123] like Figure 5As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory 502 or a program loaded from a storage device 508 to a random access memory 503. Various programs and data required for the operation of the electronic device 500 are also stored in the random access memory 503. The processing device 501, the read-only memory 502, and the random access memory 503 are connected to each other via a bus 504. An input / output interface 505 is also connected to the bus 504.

[0124] Typically, the following devices may be connected to the input / output interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 5 Each block shown in the figure may represent one device, or may represent multiple devices as required.

[0125] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the read-only memory 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.

[0126] It should be noted that the computer-readable medium in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present disclosure, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0127] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0128] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: uses a pre-trained large language model for text-to-database statements to parse a query field set from the acquired target query information; performs field correction on the query fields in the query field set according to the database field set corresponding to the target database to generate a query correction field set; inputs the query correction field set into the large language model to generate a database statement and statement credibility verification information; executes the database statement to filter out query data from the target database; and displays the query data and the statement credibility verification information on the target display terminal.

[0129] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0130] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0131] The units described in some embodiments of the present disclosure may be implemented by software or by hardware. The described units may also be provided in a processor, for example, may be described as: a processor including a parsing unit, a correction unit, a generation unit, an execution unit and a display unit. The names of these units do not constitute limitations on the units themselves in certain circumstances, for example, the execution unit may also be described as "a unit that executes the above database statement to filter out query data from the above target database".

[0132] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0133] Some embodiments of the present disclosure further provide a computer program product, including a computer program, which implements any of the above-mentioned database statement generation methods when executed by a processor.

[0134] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) and the technical solutions formed.

Claims

1. A method for generating a database statement, comprising: Utilize a pre-trained large language model for text conversion database statements to parse the query field set from the acquired target query information; According to the database field set corresponding to the target database, field correction is performed on the query field in the query field set to generate a query correction field set; Inputting the query correction field set into the large language model to generate database statements and statement credibility verification information; Executing the database statement to filter out query data from the target database; The query data and the statement credibility verification information are displayed on a target display terminal.

2. The method according to claim 1, wherein: The query modification field set includes: a non-time query field set and a time query field set; and The step of performing field correction on the query fields in the query field set according to the database field set corresponding to the target database to generate a query correction field set includes: According to the database field set, adjusting the non-time query fields in the non-time query field set to obtain a non-time query correction field set; The non-time query correction field set and the time query field set are determined as the query correction field set.

3. The method according to claim 2, wherein: The step of adjusting the non-time query fields in the non-time query field set according to the database field set to obtain a non-time query correction field set includes: For each non-time query field in the non-time query field set, perform an adjustment step: Using a target keyword matching algorithm, determining whether there is a database field in the database field set that matches the non-time query field; In response to determining that it does not exist, determining whether there is a database field in the database field set whose corresponding field vector similarity with the non-time query field satisfies a preset similarity condition; In response to determining that there is a database field that meets the preset similarity condition or there is a database field that matches the non-time query field, the non-time query field is adjusted according to the database field that meets the preset similarity condition or the database field that matches the non-time query field to obtain a non-time query correction field.

4. The method according to claim 1, wherein: The executing the database statement to filter out query data from the target database includes: Execute the database statement to generate a statement execution result; In response to determining that the statement execution result indicates that the statement execution failed, executing the generating step: Extracting query fields from the database statement to generate a statement field set; According to the database field set, adjusting the statement fields in the statement field set to obtain a statement correction field set; Generate a database correction statement corresponding to the statement modification field set; Executing the database correction statement to generate a correction statement execution result; In response to determining that the execution result of the modified statement indicates that the statement has not failed to execute, obtaining query data corresponding to the execution result of the modified statement; In response to determining that the execution result of the correction statement fails, the execution result of the correction statement is used as the statement execution result, the database correction statement is used as the database statement, and the generation step is continued.

5. The method according to claim 1, wherein: The step of inputting the query correction field set into the large language model to generate database statements and statement credibility verification information includes: Using the large language model, generating the database statement for the query correction field set; The database statements are parsed using the large language model to generate statement credibility verification information in the form of structured data description.

6. The method according to claim 1, wherein: The large language model is generated by the following steps: Obtaining a first initial large language model; Using a general language sample set, performing model training on the first initial large language model to generate a second initial large language model; Using the first text conversion database sentence sample set, performing model training on the second initial large language model to generate a third initial large language model; The third initial large language model is trained by using a second text conversion database sentence sample set in the target domain to generate the large language model.

7. The method according to claim 6, wherein: The second initial large language model is an initial large language model that performs key field extraction tasks, database statement completion tasks, and statement parsing tasks; and The method of using the first text conversion database sentence sample set to perform model training on the second initial large language model to generate a third initial large language model includes: According to the key field extraction sample set, the database sentence completion sample set and the sentence parsing sample set included in the first text conversion database sentence sample set, the second initial large language model is trained to generate a third initial large language model.

8. The method according to claim 7, wherein: The key field extraction sample set includes: a pre-set time query field sample set, the time query field sample set is a sample set obtained by data enhancement based on a time expression transformation template, the time expression transformation template is a template for expression transformation of various time expressions in the query information, and the time query field in the database statement conforms to the time expression transformation form corresponding to the time template.

9. A database statement generating device, comprising: A parsing unit, configured to parse a query field set from the acquired target query information using a pre-trained large language model for text conversion database sentences; A correction unit is configured to perform field correction on the query field in the query field set according to the database field set corresponding to the target database, so as to generate a query correction field set; a generating unit configured to input the query correction field set into the large language model to generate database statements and statement credibility verification information; an execution unit, configured to execute the database statement to filter out query data from the target database; The display unit is configured to display the query data and the statement credibility verification information on a target display terminal.

10. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.

11. A computer readable medium having a computer program stored thereon, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

12. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 8.