Large language model-based data query method and apparatus, device, and storage medium
Through the large-model-based data query method, the target data table and attributes are automatically determined, and the LLM is used to generate query instructions, which solves the problem of low data query efficiency and accuracy in the existing technology, and achieves more efficient and accurate data query.
Patent Information
- Application Number
- PCT/CN2024/099855
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-10-10
- Filing Date
- 2024-06-18
- Publication Date
- 2025-04-17
AI Technical Summary
In the prior art, data statistics of enterprise intelligence information need to be sorted out manually, resulting in low data query efficiency and accuracy.
The big model-based data query method is adopted to determine the target data table and target attributes by querying problems, and generate LLM's query instruction prompt information, and use LLM to generate query instructions to automatically conduct data queries.
It improves the efficiency and accuracy of data query and reduces the dependence of manual statistics and collation.
Smart Images

Figure CN2024099855_17042025_PF_FP_ABST
Abstract
Description
Data query method, device, equipment and storage medium based on large model
[0001] This application claims priority to a Chinese patent application filed on October 10, 2023, with application number 202311305398.5 and invention name “Data query method, device, equipment and storage medium based on large models”. Technical Field
[0002] The present disclosure relates to the field of artificial intelligence technology, specifically to technical fields such as smart office, cloud computing, generative dialogue systems, and large models, and in particular to a data query method, device, equipment, and storage medium based on a large model. Background Art
[0003] At present, enterprise intelligence information needs to be generated by users based on the daily data statistics of the enterprise, and the enterprise's operating data, enterprise cost data, enterprise customer data, etc. are organized by manually sorting relevant data and conducting statistics on the relevant data.
[0004] Summary of the Invention
[0005] The present disclosure provides a data query method, apparatus, device and medium based on a large model.
[0006] According to one aspect of the present disclosure, a data query method based on a large model is provided, comprising: determining a target data table in a candidate data table based on a query question, wherein the target data table contains candidate attributes; determining a target attribute in the candidate attributes based on the query question; generating query instruction prompt information of an LLM based on the query question, table information of the target data table, and attribute information of the target attribute, and using the LLM to generate a query instruction based on the query instruction prompt information; and performing a query in the target data table based on the query instruction to obtain a query answer corresponding to the query question.
[0007] According to another aspect of the present disclosure, a data query device based on a large model is provided, including: a first determination module, used to determine a target data table in a candidate data table according to a query question, wherein the target data table contains candidate attributes; a second determination module, used to determine a target attribute in the candidate attributes according to the query question; a generation module, used to generate query instruction prompt information of an LLM according to the query question, table information of the target data table, and attribute information of the target attribute, and use the LLM to generate a query instruction based on the query instruction prompt information; an acquisition module, used to query in the target data table according to the query instruction to obtain a query answer corresponding to the query question.
[0008] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute any one of the methods described in any one of the above aspects.
[0009] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any one of the methods according to any one of the above aspects.
[0010] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method according to any one of the above aspects.
[0011] According to the technical solution disclosed in the present invention, the efficiency and accuracy of data query can be improved.
[0012] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.
[0014] FIG1 is a schematic diagram of a first embodiment of the present disclosure;
[0015] FIG2 is a schematic diagram of an application scenario for implementing an embodiment of the present disclosure;
[0016] FIG3 is a schematic diagram according to a second embodiment of the present disclosure;
[0017] FIG4 is a schematic diagram of a processing flow of a table building module provided according to an embodiment of the present disclosure;
[0018] FIG5 is a schematic diagram of an interactive interface of a table creation module according to an embodiment of the present disclosure;
[0019] 6 is a schematic diagram of the processing flow of the table selection module and the clarification module according to an embodiment of the present disclosure;
[0020] 7 is a schematic diagram of the processing flow of the questionnaire module and the clarification module according to an embodiment of the present disclosure;
[0021] FIG8 is a schematic diagram of a display interface provided according to an embodiment of the present disclosure;
[0022] FIG9 is a schematic diagram according to a third embodiment of the present disclosure;
[0023] FIG10 is a schematic diagram of an electronic device for implementing the large model-based data query method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0024] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0025] In related technologies, since the relevant data of enterprises are manually counted, there are problems in terms of accuracy and efficiency.
[0026] In order to improve data query efficiency and accuracy, the present disclosure provides the following embodiments.
[0027] FIG1 is a schematic diagram of a first embodiment of the present disclosure. This embodiment provides a data query method based on a large model, the method comprising:
[0028] 101. Determine a target data table from the candidate data tables based on a query question, wherein the target data table contains candidate attributes.
[0029] 102. Determine a target attribute from the candidate attributes based on the query question.
[0030] 103. Generate query instruction prompt information of the LLM based on the query question, the table information of the target data table, and the attribute information of the target attribute, and use the LLM to generate a query instruction based on the query instruction prompt information.
[0031] 104. Based on the query instruction, query the target data table to obtain a query answer corresponding to the query question.
[0032] The query question (query) may be input by a user. Specifically, the user may input the query question in a natural language.
[0033] The candidate data table is a pre-generated data table, which can be one or more, usually multiple. The user can select from the existing data tables in the database to determine the candidate data table, or can also create a candidate data table through the table tool.
[0034] The target data table is a data table in the candidate data table that corresponds to the query question. It can be one or more, usually one.
[0035] A data table contains one or more attributes, typically multiple. Different attributes have different attribute information, which can specifically be attribute names. In a data table, each column typically corresponds to an attribute, and correspondingly, different columns have different column names, such as "traffic noise" and "renovation noise." All attributes included in the target data table are referred to as candidate attributes.
[0036] The target attribute is an attribute corresponding to the query question among the candidate attributes in the target data table. It can be one or more, usually one.
[0037] Each data table has corresponding table information. The table information may specifically be a table name. The table name may be schema information indicating the content of the data table. When creating a table, a table name may be configured for each data table.
[0038] A query instruction is an instruction used to query a data table. Specifically, for querying a table in a database, the query instruction can be a Structured Query Language (SQL) instruction. SQL is a database query and programming language used to access data and query, update, and manage relational database systems.
[0039] The query instruction can be generated based on the query question, the table information of the target data table and the attribute information of the target attribute. After the query instruction is generated, the target data table can be queried based on the query instruction to obtain the query answer corresponding to the query question.
[0040] The query instruction is generated based on a Large Language Model (LLM). The input of the LLM includes prompt information, and the LLM generates corresponding output information based on the prompt information.
[0041] The query prompt information, referred to as query prompt information, is used by the LLM to generate the query based on the prompt information. The query prompt information is generated based on the query question, the target data table's table information, and the target attribute's attribute information. Furthermore, the query prompt information may also include instruction information that instructs the LLM to generate the query based on the query prompt information.
[0042] In this embodiment, the target data table and target attribute are determined based on the query question, and query instructions are generated based on the query question, the table information of the target data table, and the attribute information of the target attribute. The query answer is obtained based on the query instruction, thereby achieving automated data querying, which improves efficiency and accuracy compared to manual statistical data collection. In addition, by generating query instruction prompt information for the LLM, query instructions can be generated using the LLM, eliminating the need for manual query instruction construction, further improving efficiency and accuracy.
[0043] In order to better understand the embodiments of the present disclosure, the application scenarios of the embodiments of the present disclosure are described below.
[0044] As shown in Figure 2, users can interact with the data query system, which includes: table creation module 201, table selection module 202, table query module 203, and clarification module 204. In the embodiment of the present disclosure, the data query system can be called a Generative Business Insights (GBI) assistant.
[0045] The table creation module 201 generates a candidate data table mainly based on the user's operation instructions.
[0046] The candidate data table may be an existing data table selected by the user in the database (selected table), or may be a data table created by the user using a spreadsheet tool (such as Excel) (self-created table).
[0047] The table selection module 202 mainly determines the target data table from the candidate data tables based on the user's query question.
[0048] After receiving a query, the table selection module can segment the query and semantically match the segmented words with the table names (schemas) of the candidate data tables to obtain matching results (table recall). The matching results can include 0, 1, or multiple table names. For example, if the target data table is 1, if the matching result is 1 table name, the candidate data table corresponding to the 1 table name is used as the target data table (target table); if there are more than 1, the table clarification process is entered; if there are 0, a preset content can be played or displayed, which instructs the user to re-enter the query.
[0049] The query module 203 mainly determines the target attribute from the candidate attributes in the target data table based on the user's query question, and generates prompt information (prompt) according to the query question, the table information of the target data table and the target attribute information, and generates a query instruction according to the prompt information, and obtains the query answer corresponding to the query question in the target data table according to the query instruction.
[0050] After receiving a query, the query module performs word segmentation on the query. For example, if the attribute information is a column name, the resulting word segmentation is semantically matched with the column name of the candidate attribute to obtain a matching result (column recall). The matching result can include 0, 1, or multiple column names. For example, if the target attribute is a single column name, the candidate attribute corresponding to the single column name is used as the target attribute (target column). If not, the column clarification process begins.
[0051] The query instruction can be an SQL instruction. After executing the SQL, the query answer is obtained. The query answer can be presented through text description and / or visualization. The visualization method is, for example, in the form of a chart, such as a table, line chart, bar chart, etc.
[0052] The clarification module 204 mainly performs clarification processing, which includes table clarification processing and / or column clarification processing.
[0053] The clarification module can perform clarification processing by calling the Large Language Model (LLM).
[0054] LLM has been a hot topic in the field of artificial intelligence in recent years. LLM is a pre-trained language model that learns rich language knowledge and world knowledge through pre-training on massive text data, enabling it to achieve amazing results in various natural language processing (NLP) and image generation tasks. Wenxin Yiyan, ChatGPT, etc. are applications developed based on LLM. They can generate fluent, logical, and creative text content, and can even have natural conversations with humans. Specifically, large models can be general pre-trained transformer (GPT) models based on Transformer, enhanced representation through knowledge integration (ERNIE) models, etc.
[0055] In combination with the above application scenarios, the present disclosure also provides a data query method based on a large model.
[0056] FIG3 is a schematic diagram of a second embodiment of the present disclosure. This embodiment provides a data query method based on a large model. In conjunction with the architecture diagram shown in FIG2 , the method includes:
[0057] 301. Create a candidate data table.
[0058] As shown in FIG2 , a table building module may be used to build a candidate data table.
[0059] The candidate data table can be an existing data table selected by the user, or a data table created by the user through a table tool. In addition, when selecting an existing data table, one or more can be selected.
[0060] Specifically, referring to FIG4 , the database may provide multiple data tables, from which the user may select one or more data tables as candidate data tables. Furthermore, the user may create candidate data tables using a spreadsheet tool, such as Excel. When selecting a data table, an independent data table (e.g., the first data table) may be selected as the candidate data table, or multiple data tables (e.g., the second data table + the third data table) may be combined into one candidate data table.
[0061] For selecting a data table in a database, as shown in FIG5 , the interactive interface 500 provided by the table creation module may include a "Data Source Access" button. Clicking this button displays an input interface that includes a database address. The user can enter the specific database address to access the corresponding database. Alternatively, the user can search for the database to be accessed using the search box to complete the data source access.
[0062] After connecting to a database, the database's data tables, such as the first data table and the second data table, are displayed. Users can select one or more candidate data tables by selecting them or dragging them into the table creation pool. Furthermore, for a particular data table, all or part of the content can be selected in the data selection area as the final candidate data table.
[0063] 302. Perform semantic matching on the query question and table information of the candidate data table to obtain a first matching result.
[0064] 303. If the number of the first matching results is greater than a first preset number, perform a dialogue interaction with the user to determine the target data table.
[0065] 2 , a table selection module (or a table selection module and a clarification module) may be used to determine a target data table from among candidate data tables.
[0066] Specifically, as shown in Figure 6, after receiving a query, the table selection module performs word segmentation on the query and then recalls the table based on the word segmentation results. During table recall, the table name (schema) of the candidate data table can be retrieved based on the word segmentation results, and semantic matching between the word segmentation and the table name can be performed to obtain the first matching result.
[0067] The first matching result includes 0 tables (no matching target data table), multiple tables, or 1 table. Assume that the preset number of target data tables (the first preset number) is 1, that is, it is necessary to finally determine one target data table. At this time, if the first matching result is 1 table, then the table is used as the target data table. If the first matching result is 0 tables, the preset table mismatch template dialogue can be played or displayed, and the user is asked to re-enter the query question.
[0068] If the first matching result is multiple tables, a table clarification process is executed, in which a dialogue interaction is conducted with the user to determine a final target data table.
[0069] In this embodiment, in the case where the number of first matching results is greater than the first preset number, the target data table is determined by interactive dialogue with the user. The target data table can be determined in a natural language processing manner to improve the processing effect.
[0070] As shown in Figure 6, LLM can specifically interact with the user through dialogue. LLM plays or displays LLM clarification words to the user, receives the user's clarification information, and uses LLM to clarify. The table clarification process may include multiple rounds of dialogue until a final target data table is determined.
[0071] Specifically, when the table selection module determines that the number of first matching results is greater than a first preset number, such as the number of matching candidate data tables is greater than one, the table selection module may generate a prompt to trigger the LLM to execute a table clarification process. This prompt may be referred to as table clarification prompt information. The table selection module then sends the table clarification prompt information to the LLM, which then interacts with the user based on the table clarification prompt information to obtain the target data table. The table clarification prompt information may specifically include: table information of the first matching result (e.g., the schema of multiple candidate data tables that match the query), and may also include instruction information for instructing the LLM to perform the table clarification process. The specific content of this instruction information is configurable, so that the LLM can execute the table clarification process based on the table clarification prompt information.
[0072] In this embodiment, LLM is used for dialog interaction, and the excellent performance of LLM can be utilized to improve the accuracy of the target data table.
[0073] 304. Perform semantic matching on the query question and the attribute information of the candidate attribute to obtain a second matching result.
[0074] 305. If the number of the second matching results is greater than a second preset number, conduct a dialogue interaction with the user to determine the target attribute.
[0075] 2 , a questionnaire module (or a questionnaire module and a clarification module) may be used to determine a target attribute from candidate attributes.
[0076] Specifically, taking the example of a table column as an attribute, as shown in Figure 7, after receiving a query, the query module performs word segmentation on the query and performs column recall based on the word segmentation results. During column recall, the column names of candidate attributes can be retrieved based on the word segmentation results, and semantic matching between the word segmentation and the column name can be performed to obtain a second matching result.
[0077] The second matching result may specifically include the recalled column name, which is the column name in the target data table, and may be the same as or different from the word in the query question. For example, cloud service (in the query) -> cloud service product (in the database); noise pollution (in the query) -> noise pollution (in the database). For column recall, the recall result is a clear column or an ambiguous column. Specifically, if the number of recalled columns is the preset number of target columns (the second preset number), the recall result is a clear column, otherwise it is an ambiguous column. Assuming that the second preset number is 1, if the recall result is 1 column name, the column corresponding to the column name is used as the target column. If the recall result is not 1 column name, the column clarification process is performed.
[0078] Similar to table clarification, for column clarification, if the number of the second matching results is greater than a second preset number, a dialogue interaction is performed with the user to determine the target attribute.
[0079] Specifically, when the query module determines that the number of second matching results is greater than a second preset number, if the number of matching candidate attributes is greater than one, the query module can generate a prompt message (prompt) to trigger the LLM to execute the attribute clarification process. The prompt message can be called attribute clarification prompt information. Afterwards, the query module sends the attribute clarification prompt information to the LLM. The LLM interacts with the user based on the attribute clarification prompt information to obtain the target attribute. The attribute clarification prompt information can specifically include: table information of the second matching result (such as the column names of multiple candidate columns that match the query), and can also include instruction information for instructing the LLM to perform the attribute clarification process. The specific content of the instruction information is configurable, so that the LLM can execute the attribute clarification process based on the attribute clarification prompt information.
[0080] In this embodiment, in the case where the number of second matching results is greater than the second preset number, the target data table is determined by dialogue interaction with the user, and the target attributes can be determined in a natural language processing manner to improve the processing effect.
[0081] Specifically, as shown in FIG7 , LLM may be used to conduct dialogue interaction.
[0082] In this embodiment, LLM is used for dialogue interaction, and the excellent performance of LLM can be used to improve the accuracy of target attributes.
[0083] 306. Generate prompt information based on the query question, the table information of the target data table, and the attribute information of the target attribute.
[0084] 307. Use LLM to process the input prompt information to generate a query instruction.
[0085] Among them, the table information can be specifically the table name, and the attribute information can be specifically the column name. Based on the query question (query), the table name of the target data table, and the column name of the target column, prompt information (prompt) can be generated to trigger LLM to generate query instructions. The prompt information can be called query instruction prompt information, and the query instruction prompt information is input into LLM. LLM generates query instructions, such as SQL instructions, based on the query instruction prompt information.
[0086] In this embodiment, LLM is used to generate query instructions based on prompt information, which can efficiently generate accurate query instructions, thereby improving the accuracy and efficiency of data query.
[0087] Furthermore, when generating a query prompt, the system can also obtain pre-set private domain knowledge corresponding to the target data table, such as how a certain parameter is calculated. Furthermore, it can also obtain historical conversations between the data query system and the user. The query, the table name of the target data table, the column name of the target column, the private domain knowledge, and the historical conversations can then be combined to generate the query prompt. Furthermore, the query prompt can also include configurable instructions for instructing the LLM to generate SQL instructions. This instruction can then be used to generate SQL instructions based on the query prompt.
[0088] In this embodiment, by splicing the above information to obtain prompt information, the prompt information can contain information of more dimensions, thereby improving the accuracy of the query instruction and the accuracy of the data query.
[0089] 308. Based on the query instruction, query the target data table to obtain a query answer corresponding to the query question.
[0090] For example, as shown in Figure 7, after obtaining the SQL instruction, the SQL instruction can be executed to obtain the execution result. The LLM processes the execution result to obtain the query answer. For example, the execution result is data, and the LLM performs text-based graph processing to generate the query answer in the form of a chart based on the execution result data.
[0091] 309. Display the query answer.
[0092] As shown in FIG8 , the query answer may include a text portion 801 and a chart portion 802 .
[0093] The display forms of the chart part may include: table, line chart, bar chart, etc. The specific display form may be input by the user, or may be determined by LLM after analyzing the query answer.
[0094] In this embodiment, by displaying the query answer, the intuitiveness and display effect can be improved.
[0095] In this embodiment, the display format is determined based on user input or LLM. The user may specify the display format, or the LLM may determine a suitable display format, thereby improving flexibility.
[0096] In addition, after the query answer is displayed, the user can also have further dialogue interaction with the data query system.
[0097] FIG9 is a schematic diagram of a third embodiment of the present disclosure. This embodiment provides a data query device based on a large model. The device 900 includes: a first determination module 901 , a second determination module 902 , a generation module 903 and an acquisition module 904 .
[0098] The first determination module 901 is used to determine the target data table in the candidate data table according to the query question, and the target data table contains candidate attributes; the second determination module 902 is used to determine the target attribute among the candidate attributes according to the query question; the generation module 903 is used to generate the query instruction prompt information of the LLM according to the query question, the table information of the target data table, and the attribute information of the target attribute, and use the LLM to generate a query instruction based on the query instruction prompt information; the acquisition module 904 is used to query in the target data table according to the query instruction to obtain the query answer corresponding to the query question.
[0099] In this embodiment, the target data table and target attribute are determined based on the query question, and a query instruction is generated according to the query question, the table information of the target data table and the attribute information of the target attribute. The query answer is obtained based on the query instruction, which can realize automated query of data. Compared with the manual statistical data method, it can improve efficiency and accuracy.
[0100] In some embodiments, the first determination module 901 is further used to: perform semantic matching on the query question and the table information of the candidate data table to obtain a first matching result; if the number of the first matching results is greater than a first preset number, conduct a dialogue interaction with the user to determine the target data table.
[0101] In this embodiment, in the case where the number of first matching results is greater than the first preset number, the target data table is determined by conducting a dialogue interaction with the user. The target data table can be determined in a natural language processing manner to improve the processing effect.
[0102] In some embodiments, the first determination module 901 is further used to: if the number of the first matching results is greater than a first preset number, generate table clarification prompt information of the LLM based on the first matching results, and use the LLM to interact with the user based on the table clarification prompt information to determine the target data table.
[0103] In this embodiment, LLM is used for dialog interaction, and the excellent performance of LLM can be utilized to improve the accuracy of the target data table.
[0104] In some embodiments, the second determination module 902 is further used to: perform semantic matching on the query question and the attribute information of the candidate attribute to obtain a second matching result; if the number of the second matching results is greater than a second preset number, conduct a dialogue interaction with the user to determine the target attribute.
[0105] In this embodiment, in the case where the number of second matching results is greater than the second preset number, the target data table is determined by dialogue interaction with the user, and the target attributes can be determined in a natural language processing manner to improve the processing effect.
[0106] In some embodiments, the second determination module 902 is further used to: if the number of the second matching results is greater than a second preset number, generate attribute clarification prompt information of the LLM based on the second matching results, and use the LLM to interact with the user based on the attribute clarification prompt information to determine the target attribute.
[0107] In this embodiment, LLM is used for dialogue interaction, and the excellent performance of LLM can be used to improve the accuracy of target attributes.
[0108] In some embodiments, the generating module 903 is further configured to: generate prompt information based on the query question, the table information of the target data table, and the attribute information of the target attribute;
[0109] The input prompt information is processed using LLM to generate the query instruction.
[0110] In this embodiment, LLM is used to generate query instructions based on prompt information, which can efficiently generate accurate query instructions, thereby improving the accuracy and efficiency of data query.
[0111] In some embodiments, the generation module 903 is further used to: obtain private domain knowledge and historical conversation information; and splice the query question, the table information, the attribute information, the private domain knowledge and the historical conversation information to generate the prompt information.
[0112] In this embodiment, by splicing the above information to obtain prompt information, the prompt information can contain information of more dimensions, thereby improving the accuracy of the query instruction and the accuracy of the data query.
[0113] In some embodiments, the apparatus 900 further includes: a display module configured to determine a display format; and display the query answer based on the display format.
[0114] In this embodiment, by displaying the query answer, the intuitiveness and display effect can be improved.
[0115] In some embodiments, the presentation module is further configured to: receive a presentation format input by a user; or, employ LLM to analyze the query answer to determine the presentation format.
[0116] In this embodiment, the display format is determined based on user input or LLM. The user may specify the display format, or the LLM may determine a suitable display format, thereby improving flexibility.
[0117] It can be understood that in the embodiments of the present disclosure, the same or similar contents in different embodiments can be referenced to each other.
[0118] It can be understood that the terms “first”, “second”, etc. in the embodiments of the present disclosure are only used for distinction and do not indicate the degree of importance, time sequence, etc.
[0119] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0120] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0121] FIG10 shows a schematic block diagram of an example electronic device 1000 that can be used to implement an embodiment of the present disclosure. The electronic device 1000 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device 1000 can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0122] As shown in Figure 10, electronic device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. In RAM 1003, various programs and data required for the operation of electronic device 1000 can also be stored. Computing unit 1001, ROM 1002, and RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to bus 1004.
[0123] Multiple components in the electronic device 1000 are connected to the I / O interface 1005, including an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a magnetic disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the electronic device 1000 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0124] The computing unit 1001 can be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1001 performs the various methods and processes described above, such as a data query method based on a large model. For example, in some embodiments, the data query method based on a large model can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as a storage unit 1008. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded into the RAM 1003 and executed by the computing unit 1001, one or more steps of the data query method based on the large model described above can be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to execute the large model-based data query method in any other appropriate manner (for example, by means of firmware).
[0125] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0126] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. Such program code can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable load balancing device, so that when the program code is executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0127] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, 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 foregoing.
[0128] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0129] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by 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), and the Internet.
[0130] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact via a communication network. This client-server relationship is established by computer programs running on the respective computers, establishing a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host, a host product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosts and VPS services ("Virtual Private Servers" or simply "VPS"). The server may also be a server in a distributed system or a server integrated with blockchain.
[0131] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.
[0132] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.
Claims
1. A data query method based on a large model, comprising: Determine a target data table from the candidate data table based on the query question, wherein the target data table contains candidate attributes; Determine a target attribute among the candidate attributes based on the query question; Generate query instruction prompt information of LLM based on the query question, table information of the target data table, and attribute information of the target attribute, and use the LLM to generate a query instruction based on the query instruction prompt information; Based on the query instruction, a query is performed in the target data table to obtain a query answer corresponding to the query question.
2. The method according to claim 1, wherein: The step of determining a target data table from candidate data tables based on the query question includes: Performing semantic matching on the query question and table information of the candidate data table to obtain a first matching result; If the number of the first matching results is greater than a first preset number, a dialog interaction is performed with the user to determine the target data table.
3. The method according to claim 2, wherein: If the number of the first matching results is greater than a first preset number, performing a dialog interaction with the user to obtain the target data table includes: If the number of the first matching results is greater than a first preset number, table clarification prompt information of the LLM is generated based on the first matching results, and the LLM is used to interact with the user in a dialogue based on the table clarification prompt information to determine the target data table.
4. The method according to claim 1, wherein: Determining the target attribute from the candidate attributes based on the query question includes: Performing semantic matching on the query question and the attribute information of the candidate attribute to obtain a second matching result; If the number of the second matching results is greater than a second preset number, a dialog interaction is performed with the user to determine the target attribute.
5. The method according to claim 4, wherein: If the number of the second matching results is greater than a second preset number, performing a dialog interaction with the user to determine the target attribute includes: If the number of the second matching results is greater than a second preset number, attribute clarification prompt information of the LLM is generated based on the second matching results, and the LLM is used to interact with the user in a dialogue based on the attribute clarification prompt information to determine the target attribute.
6. The method according to claim 1, wherein: Also includes: Acquire private domain knowledge and historical conversation information; Accordingly, the query instruction prompt information of LLM is generated based on the query question, the table information of the target data table, and the attribute information of the target attribute, including: The query question, the table information, the attribute information, the private domain knowledge and the historical conversation information are concatenated to generate the query instruction prompt information.
7. The method according to claim 1, further comprising: Determine the display format; Based on the presentation format, the query answer is presented.
8. The method according to claim 7, wherein: The determined display form includes: A display format that receives user input; or, The query answer is analyzed using LLM to determine the display format.
9. A data query device based on a large model, comprising: A first determination module is used to determine a target data table from the candidate data table according to the query question, wherein the target data table contains candidate attributes; A second determination module, configured to determine a target attribute from among the candidate attributes according to the query question; A generation module, used to generate query instruction prompt information of LLM according to the query question, table information of the target data table, and attribute information of the target attribute, and use the LLM to generate a query instruction based on the query instruction prompt information; The acquisition module is used to query the target data table according to the query instruction to obtain the query answer corresponding to the query question.
10. The device according to claim 9, wherein: The first determining module is further configured to: Performing semantic matching on the query question and table information of the candidate data table to obtain a first matching result; If the number of the first matching results is greater than the first preset number, a dialogue is conducted with the user. interact with each other to determine the target data table.
11. The device according to claim 10, wherein: The first determining module is further configured to: If the number of the first matching results is greater than a first preset number, table clarification prompt information of the LLM is generated based on the first matching results, and the LLM is used to interact with the user in a dialogue based on the table clarification prompt information to determine the target data table.
12. The device according to claim 9, wherein: The second determining module is further used for: Performing semantic matching on the query question and the attribute information of the candidate attribute to obtain a second matching result; If the number of the second matching results is greater than a second preset number, a dialog interaction is performed with the user to determine the target attribute.
13. The device according to claim 12, wherein: The second determining module is further used for: If the number of the second matching results is greater than a second preset number, attribute clarification prompt information of the LLM is generated based on the second matching results, and the LLM is used to interact with the user in a dialogue based on the attribute clarification prompt information to determine the target attribute.
14. The device according to claim 9, wherein: The generating module is further used for: Acquire private domain knowledge and historical conversation information; and, The query question, the table information, the attribute information, the private domain knowledge and the historical conversation information are concatenated to generate the prompt information.
15. The apparatus according to claim 9, further comprising: A display module is used to determine the display format; And, based on the presentation format, presenting the query answer.
16. The device according to claim 15, wherein: The display module is further used for: A display format that receives user input; or, The query answer is analyzed using LLM to determine the display format.
17. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, the instructions is executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1 to 8.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.
19. 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.
Citation Information
Patent Citations
Man-machine interaction method and device based on semantic net and intention recognition and medium
CN112069298A
Task-based dialogue processing method and device, equipment and storage medium
CN116541497A
Data query method, device and equipment based on large model and storage medium
CN117555897A
Reranking QA answers using language modeling
US20080040114A1
Cited By
Data analysis system and method based on artificial intelligence
CN120407658A
Retrieval question and answer method and device for table, medium, equipment and program product
CN120448407A