Question query method, system, device, equipment, storage medium and program product
By splitting the target problem and determining the association relationship, and gradually analyzing the sub-problems, the problem of randomness of Chain-of-Thought reasoning ability in the intelligent query system is solved, and the accuracy of the target query results is improved.
Patent Information
- Application Number
- CN202411765331.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-04
AI Technical Summary
In the existing intelligent query system, Chain-of-Thought reasoning ability based on large language model has randomness and divergence in the analysis and processing of target problems, resulting in low accuracy of target query results.
By splitting the target problem, multiple first sub-problems are obtained and the correlation between these sub-problems is determined. According to the association relationship and the topic type of the sub-problem, gradually determine the query results of the sub-problem, and finally determine the target query results of the target problem.
Through step-by-step query processing, the convergence of the analysis and planning of the target problem is ensured, and the accuracy of the target query results is improved.
Smart Images

Figure CN119226491B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent question answering, and in particular to a question query method, system, device, equipment, storage medium and program product. Background Art
[0002] Users can input target questions into the intelligent query system, and the intelligent query system can determine the corresponding target query results based on the target questions.
[0003] In the related art, the intelligent query system is usually generated based on a large language model (LLM). When processing the target problem, the target problem can be analyzed and processed based on the Chain-of-Thought (CoT) reasoning ability of the LLM model itself to determine the target query result of the target problem. However, in the above process, the analysis and processing of the target problem based on the CoT reasoning ability of the LLM has a certain degree of randomness and divergence, that is, for the same target problem, the analysis and processing process will be different each time, resulting in different target query results determined each time.
[0004] From the above, it can be seen that the accuracy of determining the target query result is low. Summary of the invention
[0005] Multiple aspects of the present application provide a question query method, system, device, equipment, storage medium and program product to solve the problem of low accuracy in determining target query results.
[0006] In a first aspect, an embodiment of the present application provides a question query method, comprising:
[0007] Identify the target problem;
[0008] Splitting the target problem to obtain a plurality of first sub-problems, and determining correlations between the plurality of first sub-problems;
[0009] Determining query results of the multiple first sub-questions according to the association relationship and the question topic types of the multiple first sub-questions;
[0010] A target query result of the target question is determined according to the query results of the multiple first sub-questions.
[0011] In a possible implementation, the target problem is split to obtain a plurality of first sub-problems, including:
[0012] Determine, according to the target question, question object information corresponding to the target question, wherein the question object information includes at least one question object corresponding to the target question and / or data table information corresponding to the at least one question object;
[0013] Determine splitting prompt information corresponding to the splitting process, where the splitting prompt information is used to describe the conditions for splitting the target problem;
[0014] The target question is split according to the question object information and the splitting prompt information to obtain the multiple first sub-questions.
[0015] In a possible implementation, the target question is split according to the question object information and the splitting prompt information to obtain the multiple first sub-questions, including:
[0016] If the question object information conforms to the splitting prompt information, the target question is split according to at least one question object corresponding to the target question and / or the data table information corresponding to the at least one question object to obtain the multiple first sub-questions, where the first sub-questions correspond one-to-one to the question objects.
[0017] In a possible implementation manner, the association relationship includes a parallel relationship and a progressive relationship; and determining query results of the multiple first sub-questions according to the association relationship and question topic types of the multiple first sub-questions includes:
[0018] If the association relationship is a parallel relationship, the multiple first sub-questions are processed in parallel according to the question subject types of the multiple first sub-questions to obtain query results of the multiple first sub-questions;
[0019] If the association relationship is a progressive relationship, a processing order of the multiple first sub-questions is determined, and query results of the multiple first sub-questions are determined according to the processing order and the question subject types of the multiple first sub-questions.
[0020] In a possible implementation, the multiple first sub-questions are processed in parallel according to the question topic types of the multiple first sub-questions to obtain query results of the multiple first sub-questions, including:
[0021] For any first sub-problem, determining whether the first sub-problem can be expressed by a structured query language SQL statement;
[0022] If the first sub-question can be expressed by an SQL statement, then according to the question subject type of the first sub-question, determining the subject knowledge information corresponding to the first sub-question in the relevant knowledge information, and determining the query result of the first sub-question in the subject knowledge information;
[0023] If the first sub-question cannot be expressed by one SQL statement, an answer template corresponding to the first sub-question is determined, and a query result of the first sub-question is determined according to the answer template.
[0024] In a possible implementation manner, determining a query result of the first sub-question according to the answer template includes:
[0025] Rewriting the first sub-question according to the answer template to obtain a plurality of second sub-questions corresponding to the first sub-question;
[0026] Determining query results of the plurality of second sub-questions according to question topic types of the plurality of second sub-questions;
[0027] The query result of the first sub-question is determined according to the query results of the multiple second sub-questions.
[0028] In a possible implementation manner, determining query results of the plurality of first sub-questions according to the processing order and the question topic types of the plurality of first sub-questions includes:
[0029] Determining a query result of the previous first sub-question according to the question topic type of the previous first sub-question;
[0030] Determine the query result of the previous first sub-question as the historical information corresponding to the current first sub-question;
[0031] Rewrite the current first sub-problem according to the historical information corresponding to the current first sub-problem to obtain a rewritten current first sub-problem;
[0032] According to the rewritten question topic type of the current first sub-question, a query result corresponding to the current first sub-question is determined.
[0033] In a possible implementation, the method further includes:
[0034] If the subject knowledge information corresponding to the first sub-question includes multiple data tables, the rhetorical question corresponding to the first sub-question is determined according to the data table names of the multiple data tables, and the rhetorical question is returned.
[0035] In a possible implementation, determining a target problem includes:
[0036] Get user questions;
[0037] Determining whether there is historical information corresponding to the user question in the historical conversation;
[0038] If there is historical information corresponding to the user question in the historical conversation, determining the query result of the user question according to the historical information;
[0039] If there is no historical information corresponding to the user question in the historical conversation, the user question is rewritten to obtain the target question, and the rewriting includes reference disambiguation of the user question and / or supplementary explanation of keywords in the user question.
[0040] In a second aspect, an embodiment of the present application provides a question query method, comprising:
[0041] Identify the target problem;
[0042] Splitting the target problem to obtain a plurality of first sub-problems, and determining correlations between the plurality of first sub-problems;
[0043] Determine query results of the plurality of first sub-questions according to the association relationship;
[0044] A target query result of the target question is determined according to the query results of the multiple first sub-questions.
[0045] In a possible implementation, the target problem is split to obtain a plurality of first sub-problems, including:
[0046] Determine, according to the target question, question object information corresponding to the target question, wherein the question object information includes at least one question object corresponding to the target question and / or data table information corresponding to the at least one question object;
[0047] Determine splitting prompt information corresponding to the splitting process, where the splitting prompt information is used to describe the conditions for splitting the target problem;
[0048] The target question is split according to the question object information and the splitting prompt information to obtain the multiple first sub-questions.
[0049] In a possible implementation, the target question is split according to the question object information and the splitting prompt information to obtain the multiple first sub-questions, including:
[0050] If the question object information conforms to the splitting prompt information, the target question is split according to at least one question object corresponding to the target question and / or the data table information corresponding to the at least one question object to obtain the multiple first sub-questions, where the first sub-questions correspond one-to-one to the question objects.
[0051] In a possible implementation manner, the association relationship includes a parallel relationship and a progressive relationship; and determining the query results of the plurality of first sub-questions according to the association relationship includes:
[0052] If the association relationship is a parallel relationship, the multiple first sub-questions are processed in parallel to obtain query results of the multiple first sub-questions;
[0053] If the association relationship is a progressive relationship, a processing order of the multiple first sub-questions is determined, and query results of the multiple first sub-questions are determined according to the processing order.
[0054] In a possible implementation, determining query results of the plurality of first sub-questions according to the processing order includes:
[0055] Determining a query result of the previous first sub-question according to the question topic type of the previous first sub-question;
[0056] Determine the query result of the previous first sub-question as the historical information corresponding to the current first sub-question;
[0057] Rewrite the current first sub-problem according to the historical information corresponding to the current first sub-problem to obtain a rewritten current first sub-problem;
[0058] According to the rewritten question topic type of the current first sub-question, a query result corresponding to the current first sub-question is determined.
[0059] In a possible implementation, determining a target problem includes:
[0060] Get user questions;
[0061] Determining whether there is historical information corresponding to the user question in the historical conversation;
[0062] If there is historical information corresponding to the user question in the historical conversation, determining the query result of the user question according to the historical information;
[0063] If there is no historical information corresponding to the user question in the historical conversation, the user question is rewritten to obtain the target question, and the rewriting includes reference disambiguation of the user question and / or supplementary explanation of keywords in the user question.
[0064] In a third aspect, an embodiment of the present application provides a question query method, comprising:
[0065] Identify the target problem;
[0066] Determine the problem topic type of the target problem;
[0067] According to the question topic type of the target question, a target query result of the target question is determined.
[0068] In a possible implementation, determining a target query result of the target question according to the question topic type of the target question includes:
[0069] Determine whether the target problem can be expressed by a structured query language SQL statement;
[0070] If the first sub-question can be expressed by an SQL statement, then according to the question subject type of the target question, the subject knowledge information corresponding to the target question is determined in the relevant knowledge information, and the query result of the target question is determined in the subject knowledge information;
[0071] If the first sub-question cannot be expressed by one SQL statement, an answer template corresponding to the target question is determined, and a query result of the target question is determined according to the answer template.
[0072] In a possible implementation, determining the query result of the target question according to the answer template includes:
[0073] Rewrite the target question according to the answer template to obtain multiple sub-questions corresponding to the target question;
[0074] Determining query results of the multiple sub-questions according to the question topic types of the multiple sub-questions;
[0075] Determine the query result of the target question according to the query results of the multiple sub-questions.
[0076] In a possible implementation, the method further includes:
[0077] If the subject knowledge information corresponding to the target question includes multiple data tables, the rhetorical question corresponding to the target question is determined according to the data table names of the multiple data tables, and the rhetorical question is returned.
[0078] In a possible implementation, determining a target problem includes:
[0079] Get user questions;
[0080] Determining whether there is historical information corresponding to the user question in the historical conversation;
[0081] If there is historical information corresponding to the user question in the historical conversation, determining the query result of the user question according to the historical information;
[0082] If there is no historical information corresponding to the user question in the historical conversation, the user question is rewritten to obtain the target question, and the rewriting includes reference disambiguation of the user question and / or supplementary explanation of keywords in the user question.
[0083] In a fourth aspect, an embodiment of the present application provides a question query method, including:
[0084] Determine a target question, where the target question is a business query question;
[0085] Splitting the target problem to obtain a plurality of first sub-problems, and determining correlations between the plurality of first sub-problems;
[0086] Determining query results of the multiple first sub-questions according to the association relationship and the question topic types of the multiple first sub-questions;
[0087] A target query result of the target question is determined according to the query results of the multiple first sub-questions.
[0088] In a fifth aspect, an embodiment of the present application provides a question query method, comprising:
[0089] Displaying a question-and-answer interface, wherein the question-and-answer interface is used for a user to input a target question;
[0090] Splitting the target problem to obtain a plurality of first sub-problems, and determining correlations between the plurality of first sub-problems;
[0091] Determining query results of the multiple first sub-questions according to the association relationship and the question topic types of the multiple first sub-questions;
[0092] According to the query results of the multiple first sub-questions, a target query result of the target question is determined, and the target query result is displayed on the question-and-answer interface.
[0093] In a sixth aspect, an embodiment of the present application provides a question query system, the system comprising a preset model and at least one database,
[0094] The preset model is used to execute the method described in any one of the first to fifth aspects;
[0095] The database is used to store relevant knowledge information.
[0096] In a seventh aspect, an embodiment of the present application provides a question query device, comprising: a first determination module, a splitting module, a second determination module and a third determination module, wherein
[0097] The first determination module is used to determine the target problem;
[0098] The splitting module is used to split the target problem to obtain multiple first sub-problems and determine the correlation relationship between the multiple first sub-problems;
[0099] The second determination module is used to determine the query results of the multiple first sub-questions according to the association relationship and the question topic types of the multiple first sub-questions;
[0100] The third determination module is used to determine a target query result of the target question according to the query results of the multiple first sub-questions.
[0101] In a possible implementation manner, the splitting module is specifically used to:
[0102] Determine, according to the target question, question object information corresponding to the target question, wherein the question object information includes at least one question object corresponding to the target question and / or data table information corresponding to the at least one question object;
[0103] Determine splitting prompt information corresponding to the splitting process, where the splitting prompt information is used to describe the conditions for splitting the target problem;
[0104] The target question is split according to the question object information and the splitting prompt information to obtain the multiple first sub-questions.
[0105] In a possible implementation manner, the splitting module is specifically used to:
[0106] If the question object information conforms to the splitting prompt information, the target question is split according to at least one question object corresponding to the target question and / or the data table information corresponding to the at least one question object to obtain the multiple first sub-questions, where the first sub-questions correspond one-to-one to the question objects.
[0107] In a possible implementation manner, the association relationship includes a parallel relationship and a progressive relationship; and the second determination module is specifically configured to:
[0108] If the association relationship is a parallel relationship, the multiple first sub-questions are processed in parallel according to the question subject types of the multiple first sub-questions to obtain query results of the multiple first sub-questions;
[0109] If the association relationship is a progressive relationship, a processing order of the multiple first sub-questions is determined, and query results of the multiple first sub-questions are determined according to the processing order and the question subject types of the multiple first sub-questions.
[0110] In a possible implementation manner, the second determining module is specifically configured to:
[0111] For any first sub-problem, determining whether the first sub-problem can be expressed by a structured query language SQL statement;
[0112] If the first sub-question can be expressed by an SQL statement, then according to the question subject type of the first sub-question, determining the subject knowledge information corresponding to the first sub-question in the relevant knowledge information, and determining the query result of the first sub-question in the subject knowledge information;
[0113] If the first sub-question cannot be expressed by one SQL statement, an answer template corresponding to the first sub-question is determined, and a query result of the first sub-question is determined according to the answer template.
[0114] In a possible implementation manner, the second determining module is specifically configured to:
[0115] Rewriting the first sub-question according to the answer template to obtain a plurality of second sub-questions corresponding to the first sub-question;
[0116] Determining query results of the plurality of second sub-questions according to question topic types of the plurality of second sub-questions;
[0117] The query result of the first sub-question is determined according to the query results of the multiple second sub-questions.
[0118] In a possible implementation manner, the second determining module is specifically configured to:
[0119] Determining a query result of the previous first sub-question according to the question topic type of the previous first sub-question;
[0120] Determine the query result of the previous first sub-question as the historical information corresponding to the current first sub-question;
[0121] Rewrite the current first sub-problem according to the historical information corresponding to the current first sub-problem to obtain a rewritten current first sub-problem;
[0122] According to the rewritten question topic type of the current first sub-question, a query result corresponding to the current first sub-question is determined.
[0123] In a possible implementation manner, the second determining module may also be used to:
[0124] If the subject knowledge information corresponding to the first sub-question includes multiple data tables, the rhetorical question corresponding to the first sub-question is determined according to the data table names of the multiple data tables, and the rhetorical question is returned.
[0125] In a possible implementation manner, the first determining module is specifically configured to:
[0126] Get user questions;
[0127] Determining whether there is historical information corresponding to the user question in the historical conversation;
[0128] If there is historical information corresponding to the user question in the historical conversation, determining the query result of the user question according to the historical information;
[0129] If there is no historical information corresponding to the user question in the historical conversation, the user question is rewritten to obtain the target question, and the rewriting includes reference disambiguation of the user question and / or supplementary explanation of keywords in the user question.
[0130] In an eighth aspect, an embodiment of the present application provides an electronic device, including: a memory and a processor;
[0131] The memory stores computer-executable instructions;
[0132] The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method described in any one of the first to fifth aspects.
[0133] In a ninth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer execution instructions, which, when executed by a processor, are used to implement the method described in any one of the first to fifth aspects.
[0134] In a tenth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the method shown in any one of the first to fifth aspects.
[0135] The embodiments of the present application provide a method, system, device, equipment, storage medium and program product for question query. The electronic device can determine the target problem, and then can split the target problem to obtain multiple first sub-problems, and determine the association relationship between the multiple first sub-problems. The electronic device can determine the query results of the multiple first sub-problems based on the association relationship and the problem topic type of the multiple first sub-problems, and determine the target query result of the target problem based on the query results of the multiple first sub-problems. Since not only can the target problem be split into multiple first sub-problems, so that the expression of the multiple sub-problems is more accurate, but also the query result of each first sub-problem can be determined according to the problem topic type of each first sub-problem, compared with the analysis and processing of the target problem based on the CoT reasoning ability of LLM itself, the step-by-step query processing of the target problem is realized, and the convergence of the analysis and planning of the target problem is ensured, thereby improving the accuracy of determining the target query result. BRIEF DESCRIPTION OF THE DRAWINGS
[0136] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0137] Figure 1 A schematic diagram of an application scenario provided for an exemplary embodiment of the present application;
[0138] Figure 2 A flowchart of a question query method provided for an exemplary embodiment of the present application Figure 1 ;
[0139] Figure 3 A flowchart of a question query method provided for an exemplary embodiment of the present application Figure 2 ;
[0140] Figure 4 A flowchart of a question query process provided for an exemplary embodiment of the present application;
[0141] Figure 5 A flowchart of a question query method provided for an exemplary embodiment of the present application Figure 3 ;
[0142] Figure 6 A flowchart of a question query method provided for an exemplary embodiment of the present application Figure 4 ;
[0143] Figure 7 A flowchart of a question query method provided for an exemplary embodiment of the present application Figure 5 ;
[0144] Figure 8A flowchart of a question query method provided for an exemplary embodiment of the present application Figure 6 ;
[0145] Fig. 9 A schematic diagram of a question-and-answer interface provided for an exemplary embodiment of the present application;
[0146] Fig.10 A schematic diagram of the structure of an intelligent query system provided for an exemplary embodiment of the present application;
[0147] Fig.11 A schematic diagram of the structure of a question query device provided by an exemplary embodiment of the present application;
[0148] Fig.12 A schematic structural diagram of an electronic device provided for an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0149] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0150] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0151] Next, combine Figure 1 , the application scenarios of this application are described.
[0152] Figure 1 A schematic diagram of an application scenario provided for an exemplary embodiment of the present application. Figure 1 , the electronic device may include an intelligent query system.
[0153] The user can input the target question into the intelligent query system, and the intelligent query system can determine the target query result corresponding to the target question according to the target question.
[0154] In the related art, the intelligent query system is usually generated based on LLM. When processing the target problem, the target problem can be analyzed and processed based on the CoT reasoning ability of the LLM model itself to determine the target query result of the target problem. However, in the above process, the analysis and processing of the target problem based on the CoT reasoning ability of LLM has a certain randomness and divergence, that is, for the same target problem, the analysis and processing process will be different each time, resulting in different target query results determined each time.
[0155] In an embodiment of the present application, the electronic device can split the target problem to obtain multiple first sub-problems, and determine the query results of the multiple first sub-problems based on the correlation between the multiple first sub-problems and the problem topic types of the multiple first sub-problems, and then determine the target query result corresponding to the target problem based on the query results corresponding to the multiple first sub-problems. Since not only can the target problem be split into multiple first sub-problems, making the expression of the multiple sub-problems more accurate, but also the query result of each first sub-problem can be determined based on the problem topic type of each first sub-problem, compared with the analysis and processing of the target problem based on the CoT reasoning ability of LLM itself, the step-by-step query processing of the target problem is realized, and the convergence of the analysis and planning of the target problem is ensured, thereby improving the accuracy of determining the target query result.
[0156] The technical solutions shown in the present application are described in detail below through specific embodiments. It should be noted that the following embodiments can exist independently or in combination with each other, and the same or similar contents will not be described repeatedly in different embodiments.
[0157] The execution subject of the embodiment of the present application may be an electronic device, or a question query system or a question query device provided in the electronic device. The question query system or the question query device may be implemented by software, or by a combination of software and hardware. The question query device may be a processor in the electronic device. For ease of understanding, the following description will be made by taking the execution subject as an electronic device as an example.
[0158] Figure 2 A flowchart of a question query method provided for an exemplary embodiment of the present application Figure 1 . See Figure 2 , methods may include:
[0159] S201. Determine the target problem.
[0160] Optionally, the target question may be a user question input by a user, or may be a question obtained by rewriting the user question.
[0161] The rewriting process may include performing reference disambiguation on the user's question and / or providing additional explanations for keywords in the user's question.
[0162] For example, if there is a historical conversation of ["How tall is Xiao Ming?", "Xiao Ming is 170cm; "How tall is Xiao Hong?", "Xiao Ming is 165cm"], and if the user's question is "Who is taller between the two of them?", it can be determined that the "two of them" in the user's question refers to Xiao Ming and Xiao Hong. By rewriting the user's question, the target question can be obtained as "Who is taller between Xiao Ming and Xiao Hong?"
[0163] For example, if the user question is "Who are the authors of the four great classics?", we can determine that the "four great classics" in the user question are "Journey to the West", "Dream of Red Mansions", "Water Margin" and "Romance of the Three Kingdoms". By rewriting the user question, we can get the target question as "Who are the authors of "Journey to the West", "Dream of Red Mansions", "Water Margin" and "Romance of the Three Kingdoms" respectively?".
[0164] The electronic device may determine a target question. For example, the target question may be "Who are the authors of Journey to the West, Dream of the Red Chamber, Water Margin, and Romance of the Three Kingdoms?".
[0165] S202: Split the target problem into multiple first sub-problems, and determine the correlation between the multiple first sub-problems.
[0166] The association relationship may include a parallel relationship and a progressive relationship. If there is no dependency relationship between the multiple first sub-questions, the association relationship between the multiple first sub-questions can be determined as a parallel relationship; if there is a dependency relationship between the multiple first sub-questions, that is, in the multiple first sub-questions, the query result of the previous first sub-question must be determined before the query result of the current first sub-question can be determined, then the association relationship between the multiple first sub-questions can be determined as a progressive relationship.
[0167] For example, if the target question is "Who are the authors of Journey to the West, Dream of the Red Chamber, Water Margin, and Romance of the Three Kingdoms?", the target question can be split into four first sub-questions. Among them, first sub-question 1 can be "Who is the author of Journey to the West?"; first sub-question 2 can be "Who is the author of Dream of the Red Chamber?"; first sub-question 3 can be "Who is the author of Water Margin?"; first sub-question 4 can be "Who is the author of Romance of the Three Kingdoms?". Since there is no interdependence between the four first sub-questions, the correlation relationship between the four first sub-questions is a parallel relationship.
[0168] For example, if the target question is "Who are the directors of the top three domestic films in 2023?", the target question can be split into the first sub-question 5 and the first sub-question 6. Among them, the first sub-question 5 can be "What are the top three domestic films in 2023?", and the first sub-question 6 can be "Who are their directors?". Since the query result of the first sub-question 6 depends on the query result of the first sub-question 5, the query result of the first sub-question 5 must be determined before the query result of the first sub-question 6 can be determined. Therefore, the association relationship between the first sub-question 5 and the first sub-question 6 is a progressive relationship.
[0169] S203: Determine query results of the multiple first sub-questions according to the association relationship and the question topic types of the multiple first sub-questions.
[0170] For any first sub-question, the first sub-question has a corresponding question topic type. For example, for the first sub-question 5 above, the question topic type of the first sub-question 5 is "movie".
[0171] Since the association relationship includes a parallel relationship and a progressive relationship, the query results of the multiple first sub-questions are determined according to the association relationship and the question subject types of the multiple first sub-questions, which may include the following two situations:
[0172] Case 1: The association relationship is a parallel relationship.
[0173] In this case, the multiple first sub-questions are processed in parallel according to the question subject types of the multiple first sub-questions to obtain query results of the multiple first sub-questions.
[0174] For example, if there are four first sub-questions, namely the above-mentioned first sub-question 1, the first sub-question 2, the first sub-question 3 and the first sub-question 4, then for the first sub-question 1, according to the question topic type of the first sub-question 1 "Journey to the West", the query result of the first sub-question 1 can be determined to be "Wu Cheng'en"; in parallel, for the first sub-question 2, according to the question topic type of the first sub-question 2 "A Dream of Red Mansions", the query result of the first sub-question 2 can be determined to be "Cao Xueqin"; for the first sub-question 3, according to the question topic type of the first sub-question 3 "Outlaws of the Marsh", the query result of the first sub-question 3 can be determined to be "Shi Nai'an"; for the first sub-question 4, according to the question topic type of the first sub-question 4 "Romance of the Three Kingdoms", the query result of the first sub-question 4 can be determined to be "Luo Guanzhong".
[0175] Case 2: The association relationship is a progressive relationship.
[0176] In this case, the processing order of the multiple first sub-questions is determined, and the query results of the multiple first sub-questions are determined according to the processing order and the question subject types of the multiple first sub-questions.
[0177] For example, if there are two first sub-questions, namely the first sub-question 5 and the first sub-question 6, since the query result of the first sub-question 6 depends on the query result of the first sub-question 5, the processing order of the two first sub-questions can be determined as: first sub-question 5, first sub-question 6. The electronic device can first determine the query results of the first sub-question 5 as "A", "B", and "C" according to the question subject type "movie" of the first sub-question 5 in the processing order; and then determine the query results of the first sub-question 6 as: the director of "A" is Zhang San, the director of "B" is Li Si, and the director of "C" is Wang Wu according to the question subject type "director" of the first sub-question 6.
[0178] S204: Determine a target query result of the target question according to the query results of the multiple first sub-questions.
[0179] Since the multiple first sub-questions are obtained by splitting the target question, after determining the query results of the multiple first sub-questions, the target query result of the target question can be determined according to the query results of the multiple first sub-questions, that is, the target query result can include the query results of the multiple first sub-questions.
[0180] For example, if the target question is "Who are the authors of "Journey to the West", "Dream of Red Mansions", "Water Margin" and "Romance of the Three Kingdoms" respectively?", the target question is divided into the above-mentioned first sub-question 1, first sub-question 2, first sub-question 3 and first sub-question 4. The query results of the four first sub-questions are shown in the above examples. Based on the query results of the four first sub-questions, the target query results are determined as follows: the author of "Journey to the West" is Wu Cheng'en, the author of "Dream of Red Mansions" is Cao Xueqin, the author of "Water Margin" is Shi Nai'an, and the author of "Romance of the Three Kingdoms" is Luo Guanzhong.
[0181] For example, if the target question is "Who are the directors of the top three domestic films in 2023?", the target question is split into the first sub-question 5 and the first sub-question 6 mentioned above, and the query results of the two first sub-questions are shown in the above examples. Then, based on the query results of the two first sub-questions, the target query results are determined as follows: the top three films in 2023 are "A", "B", and "C", the director of "A" is Zhang San, the director of "B" is Li Si, and the director of "C" is Wang Wu.
[0182] In an embodiment of the present application, the electronic device can determine the target problem, and then can split the target problem to obtain multiple first sub-problems, and determine the association relationship between the multiple first sub-problems. The electronic device can determine the query results of the multiple first sub-problems based on the association relationship and the problem topic types of the multiple first sub-problems, and determine the target query result of the target problem based on the query results of the multiple first sub-problems. Since not only can the target problem be split into multiple first sub-problems, making the expression of the multiple sub-problems more accurate, but also the query result of each first sub-problem can be determined based on the problem topic type of each first sub-problem, compared with the analysis and processing of the target problem based on the CoT reasoning ability of LLM itself, step-by-step query processing of the target problem is achieved, and the convergence of the analysis and planning of the target problem is ensured, thereby improving the accuracy of determining the target query result.
[0183] Below, in Figure 2 Based on the embodiment shown, combined Figure 3 , the query method for the above problem is explained in detail.
[0184] Figure 3 A flowchart of a question query method provided for an exemplary embodiment of the present application Figure 2 . See Figure 3 , methods may include:
[0185] S301, obtaining user questions.
[0186] The user can input a user question in the electronic device, and the electronic device can obtain the user question in response to the user's input operation.
[0187] S302: Determine whether there is a historical dialogue corresponding to the user question.
[0188] If yes, then step S303 may be executed; if no, then step S305 may be executed.
[0189] For example, if there is a historical dialogue 1 of ["How tall is Xiao Ming?", "Xiao Ming is 170cm"; "How tall is Xiao Hong?", "Xiao Hong is 165cm"], if the user question 1 is "Who is taller between the two of them?", then step S303 can be executed; if the user question 2 is "Who are the authors of the four great classics?", and there is no historical dialogue, then step S305 can be executed.
[0190] S303: Determine whether there is historical information corresponding to the user question in the historical conversation.
[0191] If there is a historical conversation, the historical conversation may include at least one historical user question and a historical query result corresponding to each historical user question, so the historical conversation may include historical information corresponding to the user question.
[0192] The electronic device can determine whether there is historical information corresponding to the user question in the historical conversation. If so, step S304 can be executed, that is, determining the query result of the user question based on the historical information. If not, step S305 can be executed, that is, rewriting the user question to obtain the target question.
[0193] For example, if there are the above historical conversation 1 and user question 1, the electronic device can determine, based on user question 1, in the historical conversation 1 that the historical information corresponding to user question 1 includes: Xiao Ming is 170 cm tall, and Xiao Hong is 165 cm tall. The electronic device can execute step S304, i.e., determine the query result of user question 1 based on the historical information.
[0194] For example, if there is a historical conversation 3 of ["How tall is Xiaohong?", "Xiaohong is 165cm"], and if the user question 3 is "How old is she?", the electronic device can determine, based on the user question 3, that there is no historical information (i.e., age information) corresponding to the user question 3 in the historical conversation 3, and then can execute step S305, i.e., rewrite the user question 3 to obtain the target question 3 corresponding to the user question 3.
[0195] S304: Determine the query result of the user question based on the historical information.
[0196] For example, if in historical conversation 1, historical information corresponding to user question 1 includes: Xiao Ming is 170 cm tall, and Xiao Hong is 165 cm tall, the electronic device can determine, based on the historical information, that the query result of user question 1 is: Xiao Ming is taller.
[0197] S305: Rewrite the user question to obtain a target question.
[0198] The rewriting process may include performing reference disambiguation on the user's question and / or providing additional explanations for keywords in the user's question.
[0199] Optionally, the user question may include at least one pronoun. Therefore, the electronic device can perform reference disambiguation on the user question based on the historical conversation, that is, clarify the content referred to by the pronoun and eliminate the ambiguity caused by unclear reference.
[0200] Optionally, the user question may include at least one keyword, which may be an abbreviation or a short form. Optionally, the relevant knowledge information may include complete information corresponding to the abbreviation or a short form, so the electronic device may provide additional explanations for the keywords in the user question based on the relevant knowledge information.
[0201] By rewriting the user's question to obtain the target question, the intelligent query system in the electronic device can correctly understand the target question and improve the accuracy and efficiency of processing the target question.
[0202] Optionally, the format of the target question may be a format that is convenient for conversion into a Structured Query Language (SQL) statement.
[0203] Since the previous step of step S305 can be step S302 or step S303, the rewriting process of the user question can include the following two situations:
[0204] Case 1: There is a historical conversation, but there is no historical information corresponding to the user's question in the historical conversation.
[0205] In this case, the electronic device can rewrite the user question based on the historical conversation to obtain the target question; it can also rewrite the user question based on the historical conversation and related knowledge information to obtain the target question.
[0206] For example, if the above-mentioned historical conversation 3 and user question 3 exist, although the age information corresponding to user question 3 does not exist in historical conversation 3, it can be determined from historical conversation 3 that "she" in user question 3 refers to "Xiaohong", then user question 3 can be rewritten based on historical conversation 3, and target question 3 is obtained as "What is Xiaohong's age?".
[0207] For example, if there is a historical conversation 4 of ["What grade and class is Xiaohong in?", "Class 1, Grade 3"], and the corresponding relevant knowledge information is the basic information table of students in Class 1, Grade 3, and if user question 4 is "How tall is she?", the electronic device can determine that "she" in user question 4 refers to "Xiaohong" based on historical conversation 4. Since the relevant knowledge information is the basic information table of students in Class 1, Grade 3, the electronic device can rewrite user question 4 based on historical conversation 4 and the relevant knowledge information, and obtain the corresponding target question 4 as "In the basic information table of students in Class 1, Grade 3, how tall is Xiaohong?".
[0208] Case 2: There is no historical dialogue.
[0209] In this case, the electronic device can rewrite the user's question according to the relevant knowledge information to obtain the target question.
[0210] For example, if there is no corresponding historical dialogue for the above-mentioned user question 2, and the relevant knowledge information corresponding to user question 2 includes the four great classics, namely "Journey to the West", "Dream of Red Mansions", "Water Margin" and "Romance of the Three Kingdoms", then the electronic device can rewrite user question 2 according to the relevant knowledge information, and obtain target question 2 as "Who are the authors of "Journey to the West", "Dream of Red Mansions", "Water Margin" and "Romance of the Three Kingdoms" respectively?".
[0211] S306: Determine the problem object information corresponding to the target problem according to the target problem.
[0212] The question object information may include at least one question object corresponding to the target question and / or data table information corresponding to at least one question object.
[0213] Optionally, the problem object may have corresponding data table information. The data table information may include information such as the storage structure and table value information of the data table corresponding to the problem object. The storage structure may be row storage, column storage, or key value storage, etc.; the table value information refers to the actual content stored in the data table.
[0214] The database may store relevant knowledge information, which may include multiple data tables. The electronic device may determine the data table corresponding to the problem object in the relevant knowledge information according to the problem object, thereby determining the data table information corresponding to the problem object.
[0215] For example, if the target question 1 is "Who are the directors of the top three domestic movies in 2023?", the electronic device can determine that at least one question object is "movie" and "director" according to the target question. If the relevant knowledge information includes a 2023 movie ranking information table, the movie ranking information table may include two parts: foreign movies and domestic movies, and the movie ranking information table may include movie names, director names, producer names, starring actors, release time, and movie ratings, and the storage structure of the movie ranking information table may be a key-value storage structure, then the electronic device can determine that the question object information 1 corresponding to the target question 1 includes: two question objects are "movie" and "director", and the above information of the movie ranking information table.
[0216] S307: Determine the splitting prompt information corresponding to the splitting process.
[0217] The splitting prompt information may be used to describe the conditions for splitting the target problem. Optionally, the splitting prompt information may be manually preset.
[0218] For example, the splitting prompt information may include: splitting the target problem when the target problem involves multiple problem objects, splitting across table fields / values, and splitting when the target problem cannot be expressed by one SQL statement.
[0219] S308. Split the target question according to the question object information and the splitting prompt information to obtain a plurality of first sub-questions.
[0220] Optionally, the target problem can be split according to the problem object information and the splitting prompt information to obtain multiple first sub-problems in the following manner: if the problem object information meets the splitting prompt information, the target problem is split according to at least one problem object corresponding to the target problem and / or data table information corresponding to at least one problem object to obtain multiple first sub-problems.
[0221] The first sub-problem may correspond one-to-one to the problem object or one-to-one to the data table.
[0222] For example, if the split prompt information includes that the target question involves multiple data tables, the target question is split. If the target question is "Who are the authors of Journey to the West, Dream of Red Mansions, Water Margin, and Romance of the Three Kingdoms?", if the target question involves 4 information tables, namely, Journey to the West information table, Dream of Red Mansions information table, Water Margin information table, and Romance of the Three Kingdoms information table, then the target question can be split to obtain 4 first sub-questions, among which the first sub-question 1 can be "Who is the author of Journey to the West?", corresponding to the Journey to the West information table; the first sub-question 2 can be "Who is the author of Dream of Red Mansions?", corresponding to the Dream of Red Mansions information table; the first sub-question 3 can be "Who is the author of Water Margin?", corresponding to the Water Margin information table; the first sub-question 4 can be "Who is the author of Romance of the Three Kingdoms?", corresponding to the Romance of the Three Kingdoms information table.
[0223] For example, if the splitting prompt information includes: when the target question involves multiple question objects, the target question is split. If the question object information 1 of the target question 1 is as shown above, since the question object information 1 of the target question 1 includes two question objects, "movie" and "director", the question object information 1 meets the splitting prompt information, then the target question 1 can be split and processed to obtain two first sub-questions, namely the first sub-question 5 and the first sub-question 6. Among them, the first sub-question 5 can be "What are the top three domestic movies in 2023?", corresponding to the question object "movie"; the first sub-question 6 can be "Who are their directors?", corresponding to the question object "director".
[0224] Optionally, if the question object information does not conform to the splitting prompt information, there is no need to split the target question, and the target query result of the target question can be determined according to the question subject type of the target question. Determining the target query result of the target question according to the question subject type of the target question can refer to the process of determining the query result of the first sub-question for any first sub-question in step S310, which will not be repeated here.
[0225] S309: Determine the association relationship between the multiple first sub-questions.
[0226] After the electronic device splits the target problem to obtain multiple first sub-problems, the association relationship between the multiple first sub-problems already exists naturally, and the electronic device can determine the association relationship between the multiple first sub-problems. The association relationship can include a parallel relationship and a progressive relationship.
[0227] For example, if the electronic device splits the target problem 2 to obtain the first sub-problem 1, the first sub-problem 2, the first sub-problem 3 and the first sub-problem 4, it can be determined that the association relationship between the four first sub-problems is a parallel relationship.
[0228] For example, if the electronic device splits the target problem 1 to obtain the first sub-problem 5 and the first sub-problem 6, it can be determined that the association relationship between the first sub-problem 5 and the first sub-problem 6 is a progressive relationship.
[0229] S310: If the association relationship is a parallel relationship, multiple first sub-questions are processed in parallel according to the question topic types of the multiple first sub-questions to obtain query results of the multiple first sub-questions.
[0230] Optionally, multiple first sub-problems can be processed in parallel according to the question subject types of multiple first sub-problems to obtain query results for multiple first sub-problems in the following manner: for any first sub-problem, determine whether the first sub-problem can be expressed by one SQL statement; if the first sub-problem can be expressed by one SQL statement, then according to the question subject type of the first sub-problem, determine the subject knowledge information corresponding to the first sub-problem in the relevant knowledge information, and determine the query result of the first sub-problem in the subject knowledge information; if the first sub-problem cannot be expressed by one SQL statement, then determine the answer template corresponding to the first sub-problem, and determine the query result of the first sub-problem according to the answer template.
[0231] Optionally, the complexity of the first sub-problem can be determined based on whether the first sub-problem can be expressed by an SQL statement. If the first sub-problem can be expressed by an SQL statement, the complexity of the first sub-problem can be determined to be simple; if the first sub-problem cannot be expressed by an SQL statement, the complexity of the first sub-problem can be determined to be complex.
[0232] If the complexity of the first sub-question is simple, the subject knowledge information corresponding to the first sub-question can be determined in the relevant knowledge information according to the subject type of the first sub-question, and the query result of the first sub-question can be determined in the subject knowledge information.
[0233] For example, if there are four first sub-questions, namely the first sub-question 1, the first sub-question 2, the first sub-question 3 and the first sub-question 4, then for the first sub-question 1, according to the question subject type "Journey to the West" of the first sub-question 1, in the relevant knowledge information, it can be determined that the subject knowledge information corresponding to the first sub-question 1 is the relevant information of Journey to the West. The electronic device can determine that the query result of the first sub-question 1 is "Wu Chengen" in the relevant information of Journey to the West; in parallel, for the first sub-question 2, according to the question subject type "Dream of Red Mansions" of the first sub-question 2, the subject knowledge information corresponding to the first sub-question 2 is the relevant information of Dream of Red Mansions, and the electronic device can determine that the query result of the first sub-question 2 is "Cao Xueqin" in the relevant information of Dream of Red Mansions; for the first sub-question 3, according to the question subject type "Water Margin" of the first sub-question 3, the query result of the first sub-question 3 is "Shi Naian"; for the first sub-question 4, according to the question subject type "Romance of the Three Kingdoms" of the first sub-question 4, the query result of the first sub-question 4 is "Luo Guanzhong".
[0234] Optionally, if the subject knowledge information corresponding to the first sub-question includes multiple data tables, the rhetorical question corresponding to the first sub-question is determined according to the data table names of the multiple data tables, and the rhetorical question is returned.
[0235] In this case, since the first sub-question corresponds to multiple data tables, the electronic device cannot determine in which data table to determine the query result corresponding to the first sub-question. Therefore, it can generate a rhetorical question corresponding to the first sub-question based on the data table names of the multiple data tables to further clarify to the user the content that the user wants to query.
[0236] For example, if there is a first sub-question 8 of "What is the profit of product W?", if the electronic device can determine two data tables in the relevant knowledge information, namely the internal profit table of product W and the external profit table of product W, then the electronic device can determine the rhetorical question corresponding to the first sub-question 8 as "Please clarify whether it is the internal profit of product W or the external profit of product W?" according to the data table names of the two data tables. The electronic device can return the rhetorical question to the user.
[0237] If the complexity of the first sub-question is complex, an answer template corresponding to the first sub-question may be determined, and a query result of the first sub-question may be determined based on the answer template. Optionally, a plurality of answer templates may be preset in the electronic device. The electronic device may determine an answer template corresponding to the first sub-question from a plurality of answer templates based on a question topic type of the first sub-question, and determine a query result of the first sub-question based on the answer template.
[0238] Optionally, the query result of the first sub-question can be determined according to the answer template in the following manner: rewrite the first sub-question according to the answer template to obtain multiple second sub-questions corresponding to the first sub-question; determine the query results of the multiple second sub-questions according to the question topic types of the multiple second sub-questions; determine the query result of the first sub-question according to the query results of the multiple second sub-questions.
[0239] Optionally, the association relationship between the multiple second sub-questions may be a parallel relationship and / or a progressive relationship.
[0240] For example, if there is a first sub-question 7, "How is the market performance of product W?", since the first sub-question 7 cannot be expressed by a SQL statement, it can be determined that the complexity of the first sub-question 7 is complex. The electronic device can determine that the answer template corresponding to the first sub-question 7 is [internal market share, external market share, change in internal market share, change in external market share] according to the question subject type "market" of the first sub-question 7. The electronic device can rewrite the first sub-question 7 according to the answer template to obtain 4 second sub-questions corresponding to the first sub-question 7. Among them, the second sub-question 1 can be "What is the internal market share of product W?"; the second sub-question 2 can be "What is the external market share of product W?"; the second sub-question 3 can be "What is the change in the internal market share of product W"; the second sub-question 4 can be "What is the change in the external market share of product W?". The association relationship between the four second sub-questions can be a parallel relationship.
[0241] Optionally, for any second sub-question, the electronic device can also adaptively perform steps S302 to S305 on the second sub-question, that is, it can determine whether there is a historical conversation corresponding to the second sub-question, and determine whether there is historical information corresponding to the second sub-question in the historical conversation. If so, the query result of the second sub-question can be determined based on the historical information; if not, the second sub-question can be rewritten to obtain the target question corresponding to the second sub-question. The specific execution process can be referred to steps S302 to S305, which will not be repeated here.
[0242] It should be noted that, by rewriting the first sub-problem according to the answer template, multiple second sub-problems corresponding to the first sub-problem are obtained, wherein the complexity of the multiple second sub-problems is simple, and there is no need to split any of the second sub-problems. This is because when defining the answer template, it is ensured that the second sub-problem generated according to the answer template is a simple problem, preventing the loop process from being too complicated and causing the problem planning path to fail to converge.
[0243] If the association relationship between the multiple second sub-questions is a parallel relationship, the multiple second sub-questions are processed in parallel according to the question subject types of the multiple second sub-questions to obtain query results of the multiple second sub-questions.
[0244] For any second sub-question (or the target question corresponding to the second sub-question), the electronic device can determine the question topic type of the second sub-question, and based on the question topic type of the second sub-question, determine the subject knowledge information corresponding to the second sub-question in the relevant knowledge information, and determine the query result of the second sub-question in the subject knowledge information.
[0245] For example, for the second sub-question 1, the electronic device can determine the subject knowledge information corresponding to the second sub-question 1 in the relevant knowledge information according to the subject type of the second sub-question 1, "internal market of product W", and the subject knowledge information can include an internal market information table of product W. The electronic device can determine in the internal market information table of product W that the internal market share of product W is 31%. In parallel, for the second sub-question 2, the electronic device can determine the product W external market information table corresponding to the second sub-question 2 in the relevant knowledge information according to the question topic type of the second sub-question 2 "external market of product W", and determine that the external market share of product W is 12% in the product W external market information table; for the second sub-question 3, the electronic device can determine the product W internal market information table corresponding to the second sub-question 3 according to the question topic type of the second sub-question 3 "internal market of product W", and determine that the internal market share of product W changes to 7% in the product W internal market information table; for the second sub-question 4, the electronic device can determine the product W external market information table corresponding to the second sub-question 4 according to the question topic type of the second sub-question 4 "external market of product W", and determine that the external market share of product W changes to 5% in the product W external market information table. The electronic device can determine the query results of the first sub-question 7 according to the query results of the four second sub-questions: the internal market share of product W is 31%, the external market share of product W is 12%, the internal market share of product W changes to 7%, and the external market share of product W changes to 5%.
[0246] If the association relationship between the multiple second sub-questions is a progressive relationship, the processing order of the multiple second sub-questions can be determined, and the query results of the multiple second sub-questions are determined according to the processing order and the question subject types of the multiple second sub-questions.
[0247] Optionally, the query results of multiple second sub-questions can be determined according to the processing order and the question subject types of multiple second sub-questions in the following manner: determine the query result of the previous second sub-question according to the question subject type of the previous second sub-question; determine the query result of the previous second sub-question as the historical information corresponding to the current second sub-question; rewrite the current second sub-question according to the historical information corresponding to the current second sub-question to obtain the rewritten current second sub-question; determine the query result corresponding to the current second sub-question according to the rewritten current second sub-question and related knowledge information. The specific execution process can be referred to the relevant content in step S311, which will not be repeated here.
[0248] After executing step S310, step S312 may be executed.
[0249] S311: If the association relationship is a progressive relationship, determine the processing order of the multiple first sub-questions, and determine the query results of the multiple first sub-questions according to the processing order and the question subject types of the multiple first sub-questions.
[0250] Optionally, the query results of multiple first sub-questions can be determined according to the processing order and the question subject types of multiple first sub-questions in the following manner: determine the query result of the previous first sub-question according to the question subject type of the previous first sub-question; determine the query result of the previous first sub-question as the historical information corresponding to the current first sub-question; rewrite the current first sub-question according to the historical information corresponding to the current first sub-question to obtain the rewritten current first sub-question; determine the query result corresponding to the current first sub-question according to the question subject type of the rewritten current first sub-question.
[0251] Optionally, determining the query result of the previous first subquestion based on the question topic type of the previous first subquestion includes: determining whether the previous first subquestion can be expressed by an SQL statement; if the previous first subquestion can be expressed by an SQL statement, then determining the subject knowledge information corresponding to the previous first subquestion in the relevant knowledge information based on the question topic type of the previous first subquestion, and determining the query result of the previous first subquestion in the subject knowledge information; if the previous first subquestion cannot be expressed by an SQL statement, then determining the answer template corresponding to the previous first subquestion, and determining the query result of the previous first subquestion based on the answer template.
[0252] Optionally, the query result of a previous first sub-question can be determined according to the answer template in the following manner: rewrite the previous first sub-question according to the answer template to obtain multiple second sub-questions corresponding to the previous first sub-question; determine the query results of the multiple second sub-questions according to the question topic types of the multiple second sub-questions; determine the query result of the previous first sub-question according to the query results of the multiple second sub-questions corresponding to the previous first sub-question.
[0253] The query result of the previous first sub-question is determined according to the question topic type of the previous first sub-question. The process of determining the query result of the first sub-question for any first sub-question in step S310 can be referred to and will not be described in detail here.
[0254] Optionally, after determining the query result of the previous first sub-problem, since determining the query result of the current first sub-problem depends on the query result of the previous first sub-problem, the query result of the previous first sub-problem can be determined as the historical information corresponding to the current first sub-problem, that is, the query result of the previous first sub-problem can be assembled into the historical conversation corresponding to the current first sub-problem as the historical information corresponding to the current first sub-problem, and then the current first sub-problem can be rewritten according to the historical information corresponding to the current first sub-problem to obtain the rewritten current first sub-problem.
[0255] According to the rewritten question topic type of the current first sub-question, the query result corresponding to the current first sub-question is determined. The process of determining the query result of the first sub-question for any first sub-question in step S310 can be referred to, and will not be repeated here.
[0256] For example, for the first sub-question 5, if the first sub-question 5 can be expressed by one SQL statement, it can be determined that the complexity of the first sub-question 5 is simple. Then, according to the question subject type "movie" of the first sub-question 5, the subject knowledge information corresponding to the first sub-question 5 is determined to be a movie ranking information table in the relevant knowledge information, and the query results of the first sub-question 5 are determined to be "A", "B", and "C" in the movie ranking information table. The electronic device can assemble the query results of the first sub-question 5 into the historical dialogue as the historical information of the first sub-question 6. According to the historical information corresponding to the first sub-question 6 (that is, the query results of the first sub-question 5), the first sub-question 6 can be rewritten to obtain the rewritten first sub-question 6 as "Who are the directors of "A", "B", and "C"?". According to the question subject type "director" of the rewritten first sub-question 6, the electronic device can determine the query results of the first sub-question 6 in the movie ranking information table in the relevant knowledge information as the director of "A" is Zhang San, the director of "B" is Li Si, and the director of "C" is Wang Wu.
[0257] After executing step S311, step S312 may be executed.
[0258] S312: Determine a target query result of the target question according to the query results of the multiple first sub-questions.
[0259] For example, if target question 1 is "Who are the directors of the top three domestic films in 2023?", the target question is split into the above-mentioned first sub-question 5 and the first sub-question 6, and the query results of the two first sub-questions are shown in the above examples. Then, based on the query results of the two first sub-questions, the target query results are determined as follows: the top three films in 2023 are "A", "B", and "C", the director of "A" is Zhang San, the director of "B" is Li Si, and the director of "C" is Wang Wu.
[0260] It should be noted that in Figure 3 The various processing steps (S301-S312) shown in the embodiment do not constitute a specific limitation on the question query process. In other embodiments of the present application, the question query process may include: Figure 3 The embodiments may include more or fewer steps. For example, the query process may include Figure 3 Some steps in the embodiment, or, Figure 3 Some steps in the embodiments may be replaced by steps having the same functions, or Figure 3 Some steps in the embodiments may be split into multiple steps, etc.
[0261] In an embodiment of the present application, the electronic device can obtain a user question and determine whether there is a historical dialogue corresponding to the user question. If so, it can be determined whether there is historical information corresponding to the user question in the historical dialogue. If so, the query result of the user question can be determined based on the historical information; if not, the user question can be rewritten to obtain the target question. The electronic device can determine the problem object information corresponding to the target question based on the target question, and determine the splitting prompt information corresponding to the splitting process, and then split the target question according to the problem object information and the splitting prompt information to obtain multiple first sub-questions. The electronic device can determine the association relationship between the multiple first sub-questions. If the association relationship is a parallel relationship, the electronic device can process the multiple first sub-questions in parallel according to the problem topic types of the multiple first sub-questions to obtain the query results of the multiple first sub-questions; if the association relationship is a progressive relationship, the electronic device can determine the processing order of the multiple first sub-questions, and determine the query results of the multiple first sub-questions according to the processing order and the problem topic types of the multiple first sub-questions. The electronic device determines the target query result of the target question based on the query results of the multiple first sub-questions. Since not only can the target problem be decomposed into multiple first sub-problems, making the expression of multiple sub-problems more accurate, but also the query result of each first sub-problem can be determined according to the problem topic type of each first sub-problem, compared with analyzing and processing the target problem based on LLM's own CoT reasoning ability, step-by-step query processing of the target problem is realized, ensuring the convergence of the analysis and planning of the target problem, thereby improving the accuracy of determining the target query result.
[0262] Next, based on any of the above embodiments, Figure 4 , further explain the query process of the above question.
[0263] Figure 4 A flowchart of a question query process provided by an exemplary embodiment of the present application. Figure 4 , including steps ①②③④⑤⑥⑦⑧⑨⑩ .
[0264] User questions may have corresponding historical conversations. In step ①, the electronic device may rewrite the user question to obtain the target question. Specifically, the electronic device may determine whether there is a historical conversation corresponding to the user question. If so, it may determine whether there is historical information corresponding to the user question in the historical conversation. If there is historical information corresponding to the user question, the query result of the user question may be determined based on the historical information. If there is no historical information corresponding to the user question, the electronic device may rewrite the user question based on the historical conversation and related knowledge information to obtain the target question. If there is no historical conversation corresponding to the user question, the user question may be rewritten based on the related knowledge information to obtain the target question.
[0265] By mining the supplementary information corresponding to the user's question in historical conversations and related knowledge information, the user's question is rewritten to obtain the target question, which makes the target question conform to the expression paradigm required for the optimal performance of downstream SQL queries, thereby improving the efficiency of processing the target question.
[0266] In step ②, the electronic device may determine whether to split the target problem into multiple first sub-problems.
[0267] Specifically, the electronic device can determine the problem object information corresponding to the target problem in the relevant knowledge information according to the target problem, and the problem object information may include at least one problem object corresponding to the target problem, and / or data table information corresponding to at least one problem object. The electronic device can determine the splitting prompt information corresponding to the splitting process. If the problem object information meets the splitting prompt information, the target problem can be split according to at least one problem object corresponding to the target problem to obtain multiple first sub-problems; if the problem object information does not meet the splitting prompt information, there is no need to split the target problem, and step ④ can be executed.
[0268] If the target problem is split and multiple first sub-problems are obtained, then in step ③, the association relationship between the multiple first sub-problems can be determined. The association relationship can be a progressive relationship or a parallel relationship.
[0269] For example, the target problem may be split into sub-problem 1 and sub-problem 2. The association relationship between sub-problem 1 and sub-problem 2 may be a progressive relationship.
[0270] For example, the target problem may be split to obtain sub-problem 3 and sub-problem 4. The association relationship between sub-problem 3 and sub-problem 4 may be a parallel relationship.
[0271] Regardless of whether the relationship between multiple first sub-problems is parallel or progressive, you can execute step ④~ for any first sub-problem. ; For target problems that do not require splitting, you can also execute step ④~ .
[0272] Optionally, for any first sub-problem, you can also adaptively execute steps ①②③ and then execute step ④~ .
[0273] In step ④, the electronic device may determine the complexity of the current problem, wherein the current problem may be any first sub-problem among a plurality of first sub-problems, or may be a target problem that does not need to be split.
[0274] Specifically, the electronic device can determine whether the current problem can be expressed by an SQL statement to judge the complexity of the current problem. If the current problem can be expressed by an SQL statement, the complexity of the current problem can be determined to be simple; if the current problem cannot be expressed by an SQL statement, the complexity of the current problem can be determined to be complex.
[0275] If the complexity of the current question is simple, then in step ⑤, the query result of the current question can be determined according to the question subject type of the current question. Specifically, according to the question subject type of the current question, the subject knowledge information corresponding to the current question can be determined in the relevant knowledge information, and the query result of the current question can be determined in the subject knowledge information. If the subject knowledge information is a data table, the query result of the current question can be determined in the data table.
[0276] If the subject knowledge information corresponding to the current question includes multiple data tables, then in step ⑥, the rhetorical question corresponding to the current question can be determined based on the data table names of the multiple data tables, and in step ⑦, the rhetorical question is returned to the user.
[0277] If the complexity of the current question is complex, then in step ⑧, the answer template corresponding to the current question can be determined, and the current question can be rewritten according to the answer template to obtain multiple second sub-questions.
[0278] For example, the current question may be rewritten according to the answer template to obtain sub-question 5 and sub-question 6, and the association relationship between sub-question 5 and sub-question 6 may be a parallel relationship.
[0279] For any second sub-problem, you can execute step ① and then step ⑨.
[0280] In step ⑨, the electronic device can determine the query result of sub-question 5 in the relevant knowledge information based on the question topic type of sub-question 5; in parallel, in step ⑩, the electronic device can determine the query result of sub-question 6 in the relevant knowledge information based on the question topic type of sub-question 6.
[0281] After the query result is determined in any of steps ⑤, ⑨, and ⑩, in step The query results can be assembled into the historical conversation.
[0282] It should be noted that since the relationship between sub-problems 1 and 2 is a progressive relationship, if the processing order between the two sub-problems is: sub-problem 1, sub-problem 2, then execute steps ④~ for sub-problem 1. After that, perform step ④ for sub-problem 2~ .
[0283] In the embodiment of the present application, since not only the target problem can be decomposed into multiple first sub-problems, but the first sub-problems can also be rewritten to obtain multiple second sub-problems, the expression of the multiple sub-problems is more accurate, and the step-by-step analysis and processing of the target problem is realized; and the query boundary of the current problem can be limited according to the problem subject type of the current problem, that is, the query result of the current problem is determined in the subject knowledge information corresponding to the current problem. Compared with the analysis and processing of the target problem based on the CoT reasoning ability of LLM itself, step-by-step query processing of the target problem is realized, and the convergence of the analysis and planning of the target problem is ensured, thereby improving the accuracy of determining the target query result; compared with the randomness and divergence when analyzing and processing the target problem based on the CoT reasoning ability of LLM itself, the stability of processing the target problem is improved.
[0284] Figure 5 A flowchart of a question query method provided for an exemplary embodiment of the present application Figure 3 . See Figure 5 , the method may include:
[0285] S501. Determine the target problem.
[0286] Optionally, the target question may be a user question input by a user, or may be a question obtained by rewriting the user question.
[0287] For example, if the user question is "Who are the authors of the four great classics?", we can determine that the "four great classics" in the user question are "Journey to the West", "Dream of Red Mansions", "Water Margin" and "Romance of the Three Kingdoms". By rewriting the user question, we can get the target question as "Who are the authors of "Journey to the West", "Dream of Red Mansions", "Water Margin" and "Romance of the Three Kingdoms" respectively?".
[0288] S502: Split the target problem into multiple first sub-problems, and determine the correlation between the multiple first sub-problems.
[0289] The association relationship may include a parallel relationship and a progressive relationship. If there is no dependency relationship between the multiple first sub-questions, the association relationship between the multiple first sub-questions can be determined as a parallel relationship; if there is a dependency relationship between the multiple first sub-questions, that is, in the multiple first sub-questions, the query result of the previous first sub-question must be determined before the query result of the current first sub-question can be determined, then the association relationship between the multiple first sub-questions can be determined as a progressive relationship.
[0290] For example, if the target question is "Who are the authors of Journey to the West, Dream of the Red Chamber, Water Margin, and Romance of the Three Kingdoms?", the target question can be split into four first sub-questions. Among them, first sub-question 1 can be "Who is the author of Journey to the West?"; first sub-question 2 can be "Who is the author of Dream of the Red Chamber?"; first sub-question 3 can be "Who is the author of Water Margin?"; first sub-question 4 can be "Who is the author of Romance of the Three Kingdoms?". Since there is no interdependence between the four first sub-questions, the correlation relationship between the four first sub-questions is a parallel relationship.
[0291] S503: Determine query results of multiple first sub-questions according to the association relationship.
[0292] Optionally, the query results of multiple first sub-questions are determined according to the association relationship, which may include the following two cases:
[0293] Case 1: The association relationship is a parallel relationship.
[0294] In this case, multiple first sub-problems are processed in parallel to obtain query results of multiple first sub-problems.
[0295] For example, if there are four first sub-problems, namely the first sub-problem 1, the first sub-problem 2, the first sub-problem 3 and the first sub-problem 4 mentioned above, then for the first sub-problem 1, the query result of the first sub-problem 1 is determined to be "Wu Cheng'en"; in parallel, for the first sub-problem 2, the query result of the first sub-problem 2 is determined to be "Cao Xueqin"; for the first sub-problem 3, the query result of the first sub-problem 3 is determined to be "Shi Nai'an"; for the first sub-problem 4, the query result of the first sub-problem 4 is determined to be "Luo Guanzhong".
[0296] Case 2: The association relationship is a progressive relationship.
[0297] In this case, the processing order of the multiple first sub-questions is determined, and the query results of the multiple first sub-questions are determined according to the processing order.
[0298] For example, if the target question is "Who are the directors of the top three domestic films in 2023?", the target question is split and processed to obtain the first sub-question 5 and the first sub-question 6. Among them, the first sub-question 5 can be "What are the top three domestic films in 2023?", and the first sub-question 6 can be "Who are their directors?". Since the query result of the first sub-question 6 depends on the query result of the first sub-question 5, the processing order of the two first sub-questions can be determined as: the first sub-question 5, the first sub-question 6. The electronic device can determine the query results of the first sub-question 5 as "A", "B", and "C" according to the processing order; and then determine the query results of the first sub-question 6 as: the director of "A" is Zhang San, the director of "B" is Li Si, and the director of "C" is Wang Wu.
[0299] S504: Determine a target query result of the target question according to the query results of the multiple first sub-questions.
[0300] The execution process of step S504 may refer to step S204 or step S312, which will not be described in detail here.
[0301] In an embodiment of the present application, the electronic device can determine a target problem, and split the target problem to obtain multiple first sub-problems, and determine the correlation relationship between the multiple first sub-problems, and then determine the query results of the multiple first sub-problems based on the correlation relationship. The electronic device can determine the target query result of the target problem based on the query results of the multiple first sub-problems. Since the target problem can be broken down into multiple first sub-problems, the expression of the multiple sub-problems is more accurate. Compared with the analysis and processing of the target problem based on the CoT reasoning ability of LLM itself, the step-by-step query processing of the target problem is realized, and the convergence of the analysis and planning of the target problem is ensured, thereby improving the accuracy of determining the target query result.
[0302] Figure 6 A flowchart of a question query method provided for an exemplary embodiment of the present application Figure 4 . See Figure 6 , the method may include:
[0303] S601. Determine the target problem.
[0304] For example, the target question may be "What is the external profit of product W?".
[0305] S602: Determine the question topic type of the target question.
[0306] For any target question, the electronic device can determine the question topic type of the target question.
[0307] For example, the target question may be “What is the external profit of product W?”, and the electronic device may determine that the question topic type of the target question is “product W”.
[0308] S603: Determine a target query result of the target question according to the question topic type of the target question.
[0309] Optionally, the target query result of the target question can be determined according to the question subject type of the target question in the following manner: determine whether the target question can be expressed by an SQL statement; if so, determine the subject knowledge information corresponding to the target question in the relevant knowledge information according to the question subject type of the target question, and determine the query result of the target question in the subject knowledge information; if not, determine the answer template corresponding to the target question, and determine the query result of the target question according to the answer template.
[0310] Optionally, the query result of the target question is determined according to the answer template: the target question is rewritten according to the answer template to obtain multiple sub-questions corresponding to the target question; query results of the multiple sub-questions are determined according to the question topic types of the multiple sub-questions; and the query result of the target question is determined according to the query results of the multiple sub-questions.
[0311] For example, the target question may be "What is the external profit of product W?" If the electronic device determines that the target question can be expressed by an SQL statement, the electronic device may determine that the problem subject type of the target question is "profit". Then, the electronic device may determine that the subject knowledge information of the target question includes a product W sales detail table, a product W cost detail table, a product W export sales table, and a product W profit information table in the relevant knowledge information according to the problem subject type "product W" of the target question. The electronic device may determine that the external profit of product W is 500,000 in the product W profit information table in the subject knowledge information according to the target question.
[0312] The answer template corresponding to the target question is determined, and the execution process of determining the query result of the target question according to the answer template can refer to the relevant content in step S310, which will not be repeated here.
[0313] In the embodiment of the present application, the electronic device can determine the target question and determine the question subject type of the target question, and then determine the target query result of the target question according to the question subject type of the target question. Since the electronic device can limit the query boundary of the current question according to the question subject type of the current question, that is, determine the query result of the current question in the subject knowledge information corresponding to the current question, the pressure of querying the target question is reduced, thereby improving the efficiency and accuracy of processing the target question.
[0314] In BI (Business Intelligence) scenarios, the target question is usually a business query question. Figure 7 , taking the target problem as a business query problem as an example, a problem query method is provided.
[0315] Figure 7 A flowchart of a question query method provided for an exemplary embodiment of the present application Figure 5 . See Figure 7 , the method may include:
[0316] S701. Determine a target question, where the target question is a business query question.
[0317] Optionally, the target question may be a user question input by a user, or may be a question obtained by rewriting the user question.
[0318] The rewriting process may include performing reference disambiguation on the user's question and / or providing additional explanations for keywords in the user's question.
[0319] For example, the target question could be “What is the profit of the top three products in sales in the first half of 2024?”.
[0320] S702: Split the target problem into multiple first sub-problems, and determine the correlation between the multiple first sub-problems.
[0321] The association relationship may include a parallel relationship and a progressive relationship. If there is no dependency relationship between the multiple first sub-questions, the association relationship between the multiple first sub-questions can be determined as a parallel relationship; if there is a dependency relationship between the multiple first sub-questions, that is, in the multiple first sub-questions, the query result of the previous first sub-question must be determined before the query result of the current first sub-question can be determined, then the association relationship between the multiple first sub-questions can be determined as a progressive relationship.
[0322] For example, if the target question is "What is the profit of the top three products in sales in the first half of 2024?", the target question can be split into the first sub-question 9 and the first sub-question 10. Among them, the first sub-question 9 can be "What are the top three products in sales in the first half of the year?", and the first sub-question 10 can be "Who makes the profits from them?". Since the query result of the first sub-question 10 depends on the query result of the first sub-question 9, the query result of the first sub-question 9 must be determined before the query result of the first sub-question 10 can be determined. Therefore, the association relationship between the first sub-question 9 and the first sub-question 10 is a progressive relationship.
[0323] S703: Determine query results of the multiple first sub-questions according to the association relationship and the question topic types of the multiple first sub-questions.
[0324] For any first sub-question, the first sub-question has a corresponding question topic type. For example, for the first sub-question 9 above, the question topic type of the first sub-question 9 is "product".
[0325] Since the association relationship includes a parallel relationship and a progressive relationship, the query results of the multiple first sub-questions are determined according to the association relationship and the question subject types of the multiple first sub-questions, which may include the following two situations:
[0326] Case 1: The association relationship is a parallel relationship.
[0327] In this case, the multiple first sub-questions are processed in parallel according to the question subject types of the multiple first sub-questions to obtain query results of the multiple first sub-questions.
[0328] According to the question topic types of the multiple first sub-questions, the multiple first sub-questions are processed in parallel to obtain query results of the multiple first sub-questions. For example, see Case 1 in step S203, which will not be described in detail here.
[0329] Case 2: The association relationship is a progressive relationship.
[0330] In this case, the processing order of the multiple first sub-questions is determined, and the query results of the multiple first sub-questions are determined according to the processing order and the question subject types of the multiple first sub-questions.
[0331] For example, if there are two first sub-questions, namely the first sub-question 9 and the first sub-question 10, since the query result of the first sub-question 10 depends on the query result of the first sub-question 9, the processing order of the two first sub-questions can be determined as: first sub-question 9, first sub-question 10. The electronic device can first determine the query result of the first sub-question 9 as product W, product Y, and product Z according to the question subject type "product" of the first sub-question 9 in the processing order; and then determine the query result of the first sub-question 10 as: the profit of product W is 1 million, the profit of product Y is 2 million, and the profit of product Z is 500,000 according to the question subject type "profit" of the first sub-question 10.
[0332] S704: Determine a target query result of the target question according to the query results of the multiple first sub-questions.
[0333] Since the multiple first sub-questions are obtained by splitting the target question, after determining the query results of the multiple first sub-questions, the target query result of the target question can be determined according to the query results of the multiple first sub-questions, that is, the target query result can include the query results of the multiple first sub-questions.
[0334] For example, if the target question is "What is the profit of the top three products in sales in the first half of 2024?", the target question is split into the first sub-question 9 and the first sub-question 10 mentioned above, and the query results of the two first sub-questions are shown in the above example. Then, based on the query results of the two first sub-questions, the target query result is determined as follows: the top three products in sales in 2024 are product W, product Y, and product Z, the profit of product W is 1 million, the profit of product Y is 2 million, and the profit of product Z is 500,000.
[0335] In an embodiment of the present application, an electronic device can determine a target problem, which is a business query problem. The electronic device can split the target problem to obtain multiple first sub-problems, and determine the association relationship between the multiple first sub-problems. The electronic device can determine the query results of the multiple first sub-problems based on the association relationship and the problem topic types of the multiple first sub-problems, and determine the target query result of the target problem based on the query results of the multiple first sub-problems. Since not only can the target problem be broken down into multiple first sub-problems, making the expression of the multiple sub-problems more accurate, but also the query result of each first sub-problem can be determined based on the problem topic type of each first sub-problem, compared to analyzing and processing the target problem based on the CoT reasoning ability of LLM itself, a step-by-step query processing of the target problem is realized, the convergence of the analysis and planning of the target problem is ensured, and the accuracy of determining the target query result is improved.
[0336] Since the user needs to interact with the electronic device, another question query method is provided below based on any of the above embodiments.
[0337] Figure 8 A flowchart of a question query method provided for an exemplary embodiment of the present application Figure 6 . See Figure 8 , the method may include:
[0338] S801. Display a question-and-answer interface.
[0339] The question-answering interface can be used for users to input target questions.
[0340] Next, combine Fig. 9 , explain the question and answer interface.
[0341] Fig. 9A schematic diagram of a question-and-answer interface provided by an exemplary embodiment of the present application. Fig. 9 , including interface 901 and interface 902.
[0342] Interface 901 may include multiple dialogues, namely dialogue 1, dialogue 2 and dialogue 3. In dialogue 1, a historical dialogue may be included as [question 1, query result 1].
[0343] The user can input the target question in the input control in the interface 901 .
[0344] For example, the user may enter the target question "What is the profit of the top three products in sales in the first half of 2024?" in interface 901.
[0345] S802: Split the target problem into multiple first sub-problems, and determine the correlation between the multiple first sub-problems.
[0346] S803: Determine query results of the multiple first sub-questions according to the association relationship and the question topic types of the multiple first sub-questions.
[0347] S804: Determine a target query result of the target question according to the query results of the multiple first sub-questions.
[0348] It should be noted that the execution process of steps S802 to S804 may refer to steps S702 to S704 or steps S202 to S204, which will not be described in detail here.
[0349] S805: Display the target query result on the question-and-answer interface.
[0350] For example, if the target query result is that the top three products in sales in 2024 are product W, product Y, and product Z, and the profit of product W is 1 million, the profit of product Y is 2 million, and the profit of product Z is 500,000, then the electronic device can display the target query result in the question-and-answer interface, i.e., interface 702, such as Figure 7 As shown in the middle interface 702.
[0351] In an embodiment of the present application, the electronic device can display a question-and-answer interface. The user can enter a target question in the question-and-answer interface. The electronic device can split the target question to obtain multiple first sub-questions, determine the correlation relationship between the multiple first sub-questions, and determine the query results of the multiple first sub-questions based on the correlation relationship and the question subject types of the multiple first sub-questions, and then determine the target query result of the target question based on the query results of the multiple first sub-questions, and display the target query result in the question-and-answer interface. Since not only can the target problem be broken down into multiple first sub-questions, making the expression of the multiple sub-questions more accurate, but also the query result of each first sub-question can be determined based on the question subject type of each first sub-question, compared to analyzing and processing the target problem based on the CoT reasoning ability of LLM itself, a step-by-step query processing of the target problem is realized, the convergence of the analysis and planning of the target problem is ensured, and the accuracy of determining the target query result is improved.
[0352] Next, based on any of the above embodiments, Fig.10 , the above-mentioned intelligent query system is explained.
[0353] Fig.10 This is a schematic diagram of the structure of an intelligent query system provided by an exemplary embodiment of the present application. Fig.10 , the intelligent query system may include: a preset model and at least one database.
[0354] Optionally, the preset model may be an LLM model. The preset model may include a rewriting processing component, a splitting processing component, and a topic routing component. Among them, the rewriting processing component may include a multi-round rewriting component and a knowledge rewriting component.
[0355] The rewriting component can be used to rewrite the user's question to obtain the target question. Among them, the multi-round rewriting component can be specifically used to refer to the user's question according to the historical dialogue; the knowledge rewriting component can be used to supplement the keywords in the user's question according to the knowledge-related information.
[0356] The splitting processing component can be used to split the target problem to obtain multiple first sub-problems and determine the association relationship between the multiple first sub-problems.
[0357] The topic routing component can be used to determine the query results of the multiple first sub-questions according to the association relationship and the question topic types of the multiple first sub-questions, and determine the target query result of the target question according to the query results of the multiple first sub-questions.
[0358] The topic routing component may include a complex analysis component, which can be used to determine the complexity of the current question and to plan and decompose the complex question according to the answer template.
[0359] Optionally, for any of the above components, the component may have corresponding prompt information, and the prompt information may be used to prompt the component how to handle the current problem.
[0360] The at least one database may be database 1, database 2, ... At least one database may be used to store relevant knowledge information and may also be used to store multiple examples, wherein the examples refer to examples of dialogue samples.
[0361] For example, the database 1 may store relevant knowledge information, and the relevant knowledge information may include a plurality of subject knowledge information. For example, the plurality of subject knowledge information may be subject knowledge information 1, subject knowledge information 2, ... respectively.
[0362] For any subject knowledge information, subject knowledge information refers to knowledge information corresponding to a subject. Subject knowledge information can exist in the form of a data table or in other forms such as text. For example, subject knowledge information 1 can include data table 1, data table 2, ...; subject knowledge information 2 can include common sense knowledge information, etc.
[0363] A plurality of samples may be stored in the database 2. For example, the plurality of samples may be sample 1, sample 2, ... respectively.
[0364] For any component in the preset model, the component has at least one corresponding example. Examples can be used to guide the component's handling of the current problem. Through examples, you can guide the planning direction of components on similar problems and control the handling effect of each component on the current problem.
[0365] For any component, when the component processes the current problem, it can call the relevant knowledge information and examples in the database.
[0366] In the embodiment of the present application, the intelligent query system can not only decompose the target problem into multiple first sub-problems, making the expression of multiple sub-problems more accurate, but also determine the query result of each first sub-problem according to the problem topic type of each first sub-problem. Compared with analyzing and processing the target problem based on the CoT reasoning ability of LLM itself, it realizes step-by-step query processing of the target problem, ensures the convergence of the analysis and planning of the target problem, and thus improves the accuracy of determining the target query result.
[0367] Fig.11 This is a schematic diagram of a problem query device provided by an exemplary embodiment of the present application. Fig.11 The problem query device 10 may include: a first determination module 11, a splitting module 12, a second determination module 13 and a third determination module 14, wherein
[0368] The first determination module 11 is used to determine the target problem;
[0369] The splitting module 12 is used to split the target problem to obtain multiple first sub-problems and determine the correlation relationship between the multiple first sub-problems;
[0370] The second determination module 13 is used to determine the query results of the multiple first sub-questions according to the association relationship and the question topic types of the multiple first sub-questions;
[0371] The third determination module 14 is used to determine a target query result of the target question according to the query results of the multiple first sub-questions.
[0372] The question query device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0373] In a possible implementation manner, the splitting module 12 is specifically used for:
[0374] Determine, according to the target question, question object information corresponding to the target question, wherein the question object information includes at least one question object corresponding to the target question and / or data table information corresponding to the at least one question object;
[0375] Determine splitting prompt information corresponding to the splitting process, where the splitting prompt information is used to describe the conditions for splitting the target problem;
[0376] The target question is split according to the question object information and the splitting prompt information to obtain the multiple first sub-questions.
[0377] In a possible implementation manner, the splitting module 12 is specifically used for:
[0378] If the question object information conforms to the splitting prompt information, the target question is split according to at least one question object corresponding to the target question and / or the data table information corresponding to the at least one question object to obtain the multiple first sub-questions, where the first sub-questions correspond one-to-one to the question objects.
[0379] In a possible implementation manner, the association relationship includes a parallel relationship and a progressive relationship; the second determination module 13 is specifically configured to:
[0380] If the association relationship is a parallel relationship, the multiple first sub-questions are processed in parallel according to the question subject types of the multiple first sub-questions to obtain query results of the multiple first sub-questions;
[0381] If the association relationship is a progressive relationship, a processing order of the multiple first sub-questions is determined, and query results of the multiple first sub-questions are determined according to the processing order and the question subject types of the multiple first sub-questions.
[0382] In a possible implementation manner, the second determining module 13 is specifically configured to:
[0383] For any first sub-problem, determining whether the first sub-problem can be expressed by a structured query language SQL statement;
[0384] If the first sub-question can be expressed by an SQL statement, then according to the question subject type of the first sub-question, determining the subject knowledge information corresponding to the first sub-question in the relevant knowledge information, and determining the query result of the first sub-question in the subject knowledge information;
[0385] If the first sub-question cannot be expressed by one SQL statement, an answer template corresponding to the first sub-question is determined, and a query result of the first sub-question is determined according to the answer template.
[0386] In a possible implementation manner, the second determining module 13 is specifically configured to:
[0387] Rewriting the first sub-question according to the answer template to obtain a plurality of second sub-questions corresponding to the first sub-question;
[0388] Determining query results of the plurality of second sub-questions according to question topic types of the plurality of second sub-questions;
[0389] The query result of the first sub-question is determined according to the query results of the multiple second sub-questions.
[0390] In a possible implementation manner, the second determining module 13 is specifically configured to:
[0391] Determining a query result of the previous first sub-question according to the question topic type of the previous first sub-question;
[0392] Determine the query result of the previous first sub-question as the historical information corresponding to the current first sub-question;
[0393] Rewrite the current first sub-problem according to the historical information corresponding to the current first sub-problem to obtain a rewritten current first sub-problem;
[0394] According to the rewritten question topic type of the current first sub-question, a query result corresponding to the current first sub-question is determined.
[0395] In a possible implementation manner, the second determining module 13 may also be used to:
[0396] If the subject knowledge information corresponding to the first sub-question includes multiple data tables, the rhetorical question corresponding to the first sub-question is determined according to the data table names of the multiple data tables, and the rhetorical question is returned.
[0397] In a possible implementation manner, the first determining module 11 is specifically configured to:
[0398] Get user questions;
[0399] Determining whether there is historical information corresponding to the user question in the historical conversation;
[0400] If there is historical information corresponding to the user question in the historical conversation, determining the query result of the user question according to the historical information;
[0401] If there is no historical information corresponding to the user question in the historical conversation, the user question is rewritten to obtain the target question, and the rewriting includes reference disambiguation of the user question and / or supplementary explanation of keywords in the user question.
[0402] The question query device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0403] Fig.12 A schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present application. Fig.12 The electronic device 20 may include a processor 21 and a memory 22. Exemplarily, the processor 21 and the memory 22 are interconnected via a bus 23.
[0404] The memory 22 stores computer-executable instructions;
[0405] The processor 21 executes the computer-executable instructions stored in the memory 22, so that the processor 21 executes the method shown in the above method embodiment.
[0406] Accordingly, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the method described in the above method embodiment.
[0407] Accordingly, an embodiment of the present application may also provide a computer program product, including a computer program, which, when executed by a processor, can implement the method shown in the above method embodiment.
[0408] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0409] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0410] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0411] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0412] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0413] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0414] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0415] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0416] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A question query method, characterized in that: include: Identify the target problem; Splitting the target problem to obtain a plurality of first sub-problems, and determining correlations between the plurality of first sub-problems; Determining query results of the multiple first sub-questions according to the association relationship and the question topic types of the multiple first sub-questions; Determine a target query result of the target question according to the query results of the multiple first sub-questions; The target problem is split to obtain a plurality of first sub-problems, including: Determine, according to the target problem, problem object information corresponding to the target problem, wherein the problem object information includes at least one problem object corresponding to the target problem and data table information corresponding to the at least one problem object; Determine splitting prompt information corresponding to the splitting process, wherein the splitting prompt information is used to describe the conditions for splitting the target problem; the splitting prompt information includes that the target problem involves multiple data tables; Splitting the target question according to the question object information and the splitting prompt information to obtain the multiple first sub-questions; Determining query results of the plurality of first sub-questions according to the association relationship and the question topic types of the plurality of first sub-questions includes: If the association relationship between the multiple first sub-questions is a parallel relationship, the multiple first sub-questions are processed in parallel according to the question subject types of the multiple first sub-questions to obtain query results of the multiple first sub-questions; For any first sub-problem, determining whether the first sub-problem can be expressed by a structured query language SQL statement; If the first sub-question can be expressed by an SQL statement, then according to the question subject type of the first sub-question, the subject knowledge information corresponding to the first sub-question is determined in the relevant knowledge information, and the query result of the first sub-question is determined in the subject knowledge information; if the subject knowledge information corresponding to the first sub-question includes multiple data tables, then according to the data table names of the multiple data tables, the rhetorical question corresponding to the first sub-question is determined, and the rhetorical question is returned; If the first sub-question cannot be expressed by an SQL statement, determine the answer template corresponding to the first sub-question, rewrite the first sub-question according to the answer template, and obtain multiple second sub-questions corresponding to the first sub-question; determine query results of the multiple second sub-questions according to question topic types of the multiple second sub-questions; and determine the query result of the first sub-question according to the query results of the multiple second sub-questions.
2. The method according to claim 1, characterized in that According to the problem object information and the splitting prompt information, the target problem is split to obtain the multiple first sub-problems, including: If the question object information conforms to the splitting prompt information, the target question is split according to at least one question object corresponding to the target question and / or the data table information corresponding to the at least one question object to obtain the multiple first sub-questions, where the first sub-questions correspond one-to-one to the question objects.
3. The method according to claim 1, characterized in that The association relationship includes a parallel relationship and a progressive relationship; Determining query results of the plurality of first sub-questions according to the association relationship and the question topic types of the plurality of first sub-questions further includes: If the association relationship is a progressive relationship, a processing order of the multiple first sub-questions is determined, and query results of the multiple first sub-questions are determined according to the processing order and the question subject types of the multiple first sub-questions.
4. The method according to claim 3, characterized in that Determining query results of the plurality of first sub-questions according to the processing order and the question topic types of the plurality of first sub-questions includes: Determining a query result of the previous first sub-question according to the question topic type of the previous first sub-question; Determine the query result of the previous first sub-question as the historical information corresponding to the current first sub-question; Rewrite the current first sub-problem according to the historical information corresponding to the current first sub-problem to obtain a rewritten current first sub-problem; According to the rewritten question topic type of the current first sub-question, a query result corresponding to the current first sub-question is determined.
5. The method according to any one of claims 1 to 4, characterized in that: Identify target issues, including: Get user questions; Determining whether there is historical information corresponding to the user question in the historical conversation; If there is historical information corresponding to the user question in the historical conversation, determining the query result of the user question according to the historical information; If there is no historical information corresponding to the user question in the historical conversation, the user question is rewritten to obtain the target question, and the rewriting includes reference disambiguation of the user question and / or supplementary explanation of keywords in the user question.
6. A question query method, characterized in that: include: Identify the target problem; Splitting the target problem to obtain a plurality of first sub-problems, and determining correlations between the plurality of first sub-problems; Determine query results of the plurality of first sub-questions according to the association relationship; Determine a target query result of the target question according to the query results of the multiple first sub-questions; The target problem is split to obtain a plurality of first sub-problems, including: Determine, according to the target problem, problem object information corresponding to the target problem, wherein the problem object information includes at least one problem object corresponding to the target problem and data table information corresponding to the at least one problem object; Determine splitting prompt information corresponding to the splitting process, wherein the splitting prompt information is used to describe the conditions for splitting the target problem; the splitting prompt information includes that the target problem involves multiple data tables; Splitting the target question according to the question object information and the splitting prompt information to obtain the multiple first sub-questions; Determining the query results of the plurality of first sub-questions according to the association relationship includes: If the association relationship between the multiple first sub-questions is a parallel relationship, the multiple first sub-questions are processed in parallel according to the question subject types of the multiple first sub-questions to obtain query results of the multiple first sub-questions; For any first sub-problem, determining whether the first sub-problem can be expressed by a structured query language SQL statement; If the first sub-question can be expressed by an SQL statement, then according to the question subject type of the first sub-question, the subject knowledge information corresponding to the first sub-question is determined in the relevant knowledge information, and the query result of the first sub-question is determined in the subject knowledge information; if the subject knowledge information corresponding to the first sub-question includes multiple data tables, then according to the data table names of the multiple data tables, the rhetorical question corresponding to the first sub-question is determined, and the rhetorical question is returned; If the first sub-question cannot be expressed by an SQL statement, determine the answer template corresponding to the first sub-question, rewrite the first sub-question according to the answer template, and obtain multiple second sub-questions corresponding to the first sub-question; determine query results of the multiple second sub-questions according to question topic types of the multiple second sub-questions; and determine the query result of the first sub-question according to the query results of the multiple second sub-questions.
7. A question query method, characterized in that: include: Determine a target question, where the target question is a business query question; Splitting the target problem to obtain a plurality of first sub-problems, and determining correlations between the plurality of first sub-problems; Determining query results of the multiple first sub-questions according to the association relationship and the question topic types of the multiple first sub-questions; Determine a target query result of the target question according to the query results of the multiple first sub-questions; The target problem is split to obtain a plurality of first sub-problems, including: Determine, according to the target problem, problem object information corresponding to the target problem, wherein the problem object information includes at least one problem object corresponding to the target problem and data table information corresponding to the at least one problem object; Determine splitting prompt information corresponding to the splitting process, wherein the splitting prompt information is used to describe the conditions for splitting the target problem; the splitting prompt information includes that the target problem involves multiple data tables; Splitting the target question according to the question object information and the splitting prompt information to obtain the multiple first sub-questions; Determining query results of the plurality of first sub-questions according to the association relationship and the question topic types of the plurality of first sub-questions includes: If the association relationship between the multiple first sub-questions is a parallel relationship, the multiple first sub-questions are processed in parallel according to the question subject types of the multiple first sub-questions to obtain query results of the multiple first sub-questions; For any first sub-problem, determining whether the first sub-problem can be expressed by a structured query language SQL statement; If the first sub-question can be expressed by an SQL statement, then according to the question subject type of the first sub-question, the subject knowledge information corresponding to the first sub-question is determined in the relevant knowledge information, and the query result of the first sub-question is determined in the subject knowledge information; if the subject knowledge information corresponding to the first sub-question includes multiple data tables, then according to the data table names of the multiple data tables, the rhetorical question corresponding to the first sub-question is determined, and the rhetorical question is returned; If the first sub-question cannot be expressed by an SQL statement, determine the answer template corresponding to the first sub-question, rewrite the first sub-question according to the answer template, and obtain multiple second sub-questions corresponding to the first sub-question; determine query results of the multiple second sub-questions according to question topic types of the multiple second sub-questions; and determine the query result of the first sub-question according to the query results of the multiple second sub-questions.
8. A question query method, characterized in that: include: Displaying a question-and-answer interface, wherein the question-and-answer interface is used for a user to input a target question; Splitting the target problem to obtain a plurality of first sub-problems, and determining correlations between the plurality of first sub-problems; Determining query results of the multiple first sub-questions according to the association relationship and the question topic types of the multiple first sub-questions; Determine a target query result of the target question according to the query results of the multiple first sub-questions, and display the target query result on the question-and-answer interface; The target problem is split to obtain a plurality of first sub-problems, including: Determine, according to the target problem, problem object information corresponding to the target problem, wherein the problem object information includes at least one problem object corresponding to the target problem and data table information corresponding to the at least one problem object; Determine splitting prompt information corresponding to the splitting process, wherein the splitting prompt information is used to describe the conditions for splitting the target problem; the splitting prompt information includes that the target problem involves multiple data tables; Splitting the target question according to the question object information and the splitting prompt information to obtain the multiple first sub-questions; Determining query results of the plurality of first sub-questions according to the association relationship and the question topic types of the plurality of first sub-questions includes: If the association relationship between the multiple first sub-questions is a parallel relationship, the multiple first sub-questions are processed in parallel according to the question subject types of the multiple first sub-questions to obtain query results of the multiple first sub-questions; For any first sub-problem, determining whether the first sub-problem can be expressed by a structured query language SQL statement; If the first sub-question can be expressed by an SQL statement, then according to the question subject type of the first sub-question, the subject knowledge information corresponding to the first sub-question is determined in the relevant knowledge information, and the query result of the first sub-question is determined in the subject knowledge information; if the subject knowledge information corresponding to the first sub-question includes multiple data tables, then according to the data table names of the multiple data tables, the rhetorical question corresponding to the first sub-question is determined, and the rhetorical question is returned; If the first sub-question cannot be expressed by an SQL statement, determine the answer template corresponding to the first sub-question, rewrite the first sub-question according to the answer template, and obtain multiple second sub-questions corresponding to the first sub-question; determine query results of the multiple second sub-questions according to question topic types of the multiple second sub-questions; and determine the query result of the first sub-question according to the query results of the multiple second sub-questions.
9. A question query system, characterized in that: The system includes a preset model and at least one database, The preset model is used to execute the method according to any one of claims 1 to 8; The database is used to store relevant knowledge information.
10. A question query device, characterized in that: include: A first determining module, a splitting module, a second determining module and a third determining module, wherein The first determination module is used to determine the target problem; The splitting module is used to split the target problem to obtain multiple first sub-problems and determine the correlation relationship between the multiple first sub-problems; The second determination module is used to determine the query results of the multiple first sub-questions according to the association relationship and the question topic types of the multiple first sub-questions; The third determination module is used to determine the target query result of the target question according to the query results of the multiple first sub-questions; The splitting module is specifically used to determine, according to the target problem, problem object information corresponding to the target problem, wherein the problem object information includes at least one problem object corresponding to the target problem and data table information corresponding to the at least one problem object; Determine splitting prompt information corresponding to the splitting process, where the splitting prompt information is used to describe the conditions for splitting the target problem; The splitting prompt information includes that the target problem involves multiple data tables; Splitting the target question according to the question object information and the splitting prompt information to obtain the multiple first sub-questions; The second determination module is specifically used for, if the association relationship among the multiple first sub-problems is a parallel relationship, then according to the problem subject types of the multiple first sub-problems, processing the multiple first sub-problems in parallel to obtain the query results of the multiple first sub-problems; for any first sub-problem, determining whether the first sub-problem can be expressed by a structured query language SQL statement; if the first sub-problem can be expressed by an SQL statement, then according to the problem subject type of the first sub-problem, determining the subject knowledge information corresponding to the first sub-problem in the relevant knowledge information, and determining the query result of the first sub-problem in the subject knowledge information; If the subject knowledge information corresponding to the first sub-question includes multiple data tables, then the rhetorical question corresponding to the first sub-question is determined according to the data table names of the multiple data tables, and the rhetorical question is returned; if the first sub-question cannot be expressed by one SQL statement, then the answer template corresponding to the first sub-question is determined, and the first sub-question is rewritten according to the answer template to obtain multiple second sub-questions corresponding to the first sub-question; Determining query results of the plurality of second sub-questions according to question topic types of the plurality of second sub-questions; The query result of the first sub-question is determined according to the query results of the multiple second sub-questions.
11. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to perform the method described in any one of claims 1 to 8.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 8 is implemented.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Query request processing method, electronic equipment and storage medium
CN118277588A
Information processing method, question answering method and question answering system
CN118410152A
Index acquisition method and device, electronic equipment and computer readable storage medium
CN118673038A
Question answering method and apparatus, and electronic device, computer-readable storage medium and computer program product
WO2024230117A1