CN-122019739-A - Data query method, device, equipment, storage medium and product
Abstract
The present disclosure provides a data query method, apparatus, device, storage medium and product, and relates to the technical field of artificial intelligence. The method comprises the steps of determining an initial query result of a target data query problem by using a preset large language model, wherein the target data query problem is a data query problem expressed in natural language aiming at a target knowledge domain, acquiring target preset domain knowledge matched with target query parameters from a preset domain knowledge base according to target query parameters of the target data query problem, constructing target prompt information according to the target preset domain knowledge and the initial query result, and determining a target query result of the target data query problem by using the preset large language model according to the target prompt information and the target data query problem. By adopting the technical scheme, the accuracy of data query and question answering can be improved, and the timeliness of large language model application can be improved.
Inventors
- QU KECHENG
Assignees
- 北京字跳网络技术有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20241112
Claims (10)
- 1. A method of querying data, comprising: Determining an initial query result of a target data query problem by using a preset large language model, wherein the target data query problem is a data query problem expressed in natural language aiming at the target knowledge field; acquiring target preset domain knowledge matched with the target query parameters from a preset domain knowledge base according to the target query parameters of the target data query problem, wherein the preset domain knowledge base comprises preset domain knowledge of the target domain; constructing target prompt information according to the target preset domain knowledge and the initial query result; and determining a target query result of the target data query problem according to the target prompt information and the target data query problem by using the preset large language model.
- 2. The method of claim 1, wherein the constructing the target hint information based on the target preset domain knowledge and the initial query result comprises: obtaining a preset prompt template, wherein the preset prompt template comprises a preset prompt Wen Benzi template, a knowledge sub-template and a data sub-template which have a preset splicing relationship; And filling the target preset domain knowledge into preset gaps in the knowledge sub-templates, and filling the initial query result into the preset gaps in the data sub-templates to obtain target prompt information.
- 3. The method of claim 1, wherein the pre-set domain knowledge base is a vector database and the pre-set domain knowledge is a pre-set text segment vector; the obtaining, according to the target query parameters of the target data query problem, target preset domain knowledge matched with the target query parameters from a preset domain knowledge base includes: Converting the target query parameters of the target data query problem into target query parameter vectors; Calculating the similarity between the target query parameter vector and preset domain knowledge in the preset domain knowledge base; and determining target preset domain knowledge matched with the target query parameters according to the preset domain knowledge of which the similarity meets the preset similarity requirement.
- 4. A method according to claim 3, wherein the target query parameter is a query object, and the preset domain knowledge associated with the same preset object in the preset domain knowledge base carries the same preset tag; Wherein determining target preset domain knowledge matched with the target query parameter according to the preset domain knowledge that the similarity meets a preset similarity requirement comprises: Determining the preset domain knowledge of which the similarity meets the preset similarity requirement as initial preset domain knowledge; acquiring a target preset label carried by the initial preset domain knowledge; and determining preset domain knowledge carrying the target preset label as target preset domain knowledge matched with the target query parameter.
- 5. The method of claim 1, wherein determining initial query results for the target data query question using the pre-set large language model comprises: converting a target data query problem into target domain specific language DSL data corresponding to the target knowledge domain by using a preset large language model, and determining function parameter data according to the target DSL data; Determining a target query function according to the target data query problem, a preset query function set and description information of preset query functions in the preset query function set by using the preset large language model, wherein the target query function is a preset query function in the preset query function set; And carrying out data query by calling the target query function based on the function parameter data to obtain an initial query result of the target data query problem.
- 6. The method of claim 5, wherein converting the target data query problem to target DSL data corresponding to the target knowledge domain using the pre-determined large language model, and determining function parameter data from the target DSL data, comprises: Inputting preset input data and the target data query problem into the preset large language model to obtain target DSL data corresponding to the target knowledge field output by the preset large language model, wherein the preset input data is preset input data aiming at the target knowledge field, the preset input data comprises preset prompt texts, preset data structures and example DSL data meeting the preset data structures, and the preset data structures are structures corresponding to key names and key values; And determining a function parameter name according to the key name in the target DSL data, and determining a function parameter value of the function parameter name according to a key value corresponding to the key name in the target DSL data to obtain function parameter data.
- 7. A data query device, comprising: The initial query result determining module is used for determining an initial query result of a target data query problem by utilizing a preset large language model, wherein the target data query problem is a data query problem expressed in natural language aiming at the target knowledge field; The domain knowledge acquisition module is used for acquiring target preset domain knowledge matched with the target query parameters from a preset domain knowledge base according to the target query parameters of the target data query problem, wherein the preset domain knowledge base comprises preset domain knowledge of the target domain; The prompt information construction module is used for constructing target prompt information according to the target preset domain knowledge and the initial query result; And the target query result determining module is used for determining a target query result of the target data query problem according to the target prompt information and the target data query problem by utilizing the preset large language model.
- 8. An electronic device, the electronic device comprising: one or more processors; storage means for storing one or more programs, The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the data query method of any of claims 1-6.
- 9. A storage medium containing computer executable instructions which, when executed by a computer processor, are for performing the data query method of any of claims 1-6.
- 10. A computer program product comprising a computer program which, when executed by a processor, implements the data query method of any of claims 1-6.
Description
Data query method, device, equipment, storage medium and product Technical Field The embodiment of the disclosure relates to the technical field of artificial intelligence, in particular to a data query method, a device, equipment, a storage medium and a product. Background With the rapid development of artificial intelligence technology, artificial intelligence models are widely used in various application fields. Large language models (Large Language Model, LLM) are a class of deep learning models with a large number of parameters that can be used to process and generate natural language text, and by training on a large data set, large language models can perform a variety of natural language processing (Natural Language Processing, NLP) tasks such as text understanding, generation, translation, question-answering, and the like. In some application scenarios, the user's natural language may be understood based on a large language model, converted to a data query language, and presented with the data query results. However, the large language model itself has versatility, and it is difficult to obtain a high-quality query result conforming to a specific field. In order to solve the problem, training sample sets in the required application fields are commonly adopted in the prior art to retrain a large language model, however, the construction of the training sample sets and the retrain process all need to consume a great deal of time, labor and other costs, and the efficiency is low. Disclosure of Invention The embodiment of the disclosure provides a data query method, a device, equipment, a storage medium and a product, which can optimize the existing data query scheme for data query based on a large language model. In a first aspect, an embodiment of the present disclosure provides a data query method, including: Determining an initial query result of a target data query problem by using a preset large language model, wherein the target data query problem is a data query problem expressed in natural language aiming at the target knowledge field; acquiring target preset domain knowledge matched with the target query parameters from a preset domain knowledge base according to the target query parameters of the target data query problem, wherein the preset domain knowledge base comprises preset domain knowledge of the target domain; constructing target prompt information according to the target preset domain knowledge and the initial query result; and determining a target query result of the target data query problem according to the target prompt information and the target data query problem by using the preset large language model. In a second aspect, embodiments of the present disclosure further provide a data query apparatus, including: The initial query result determining module is used for determining an initial query result of a target data query problem by utilizing a preset large language model, wherein the target data query problem is a data query problem expressed in natural language aiming at the target knowledge field; The domain knowledge acquisition module is used for acquiring target preset domain knowledge matched with the target query parameters from a preset domain knowledge base according to the target query parameters of the target data query problem, wherein the preset domain knowledge base comprises preset domain knowledge of the target domain; The prompt information construction module is used for constructing target prompt information according to the target preset domain knowledge and the initial query result; And the target query result determining module is used for determining a target query result of the target data query problem according to the target prompt information and the target data query problem by utilizing the preset large language model. In a third aspect, embodiments of the present disclosure further provide an electronic device, including: one or more processors; storage means for storing one or more programs, The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the data query method provided by the embodiments of the present disclosure. In a fourth aspect, the presently disclosed embodiments also provide a storage medium containing computer-executable instructions that, when executed by a computer processor, are for performing the data query method provided by the presently disclosed embodiments. In a fifth aspect, the disclosed embodiments also provide a computer program product, including a computer program, which when executed by a processor implements the data query method provided by the disclosed embodiments. According to the data query scheme provided by the embodiment of the disclosure, an initial query result of a target data query problem is determined by using a preset large language model, wherein the target data query problem is a data query problem expressed in natural language aiming