Intelligent Information Query Method for Power Digital Warehouse Management System

By building a preset problem library and SQL function library, using problem decomposition and result merging agents, the problem of complex query requirements in power digital warehouses is solved, and flexible response to natural language and accurate query result output is achieved.

CN119669370BActive Publication Date: 2025-08-05NANJING YUNSHE INTELLIGENT TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411675041.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-08-05
Estimated Expiration
2044-11-21

AI Technical Summary

Technical Problem

The existing power digital warehouse information query methods are difficult to effectively deal with complex natural language query requirements, resulting in cumbersome query statements, complex syntax, and may not be executed normally.

Method used

Build a preset problem library and a SQL function library, use the problem decomposition agent to process natural language input in segments, match the preset problem list, and generate a SQL function description list. Use the results to merge the agent to merge the query results to avoid directly generating complex SQL query statements.

Benefits of technology

It realizes accurate response to complex natural language query requirements, reduces the complexity and error probability of query statements, and improves query efficiency and system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119669370B_ABST
    Figure CN119669370B_ABST
Patent Text Reader

Abstract

The present invention relates to an intelligent information query method for a power digital warehouse management system, comprising the following steps: constructing a preset question library and an SQL function library; then responding to information query requirements input by users in natural language to obtain multiple question segments, matching each question segment with the preset question library to generate a preset question list; finding SQL function templates corresponding to the preset question list from the SQL function library to form an SQL function description list; inputting the information query requirements and the SQL function description list into a question decomposition agent, obtaining the SQL function template corresponding to each question and its required input parameters, obtaining an SQL query statement, executing an SQL query operation, and having a result merging agent perform a merging operation. The present invention can effectively avoid problems such as cumbersome query statements and complex syntax, and reduce the probability of query statements failing to execute normally.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to an intelligent information query method applied to an electric power digital warehouse management system, belonging to the technical field of data processing. Background Art

[0002] The power digital warehouse is a system that uses modern information technology, especially the Internet of Things, big data, artificial intelligence and other technical means, to digitally manage and monitor all aspects of the warehouse, including arrival inspection, warehousing, outbound delivery, allocation, inventory counting, etc., to achieve automation, intelligence and efficiency of warehouse management.

[0003] At present, the information query method of power digital warehouse is usually as follows: Figure 1 As shown, most search results rely on entering standardized search terms through different query pages according to the page requirements. For complex information, the final query result is obtained by searching through multiple pages step by step. However, this information query method, which relies on multiple pages and standardized query conditions, makes it difficult for users to convert complex query requirements into effective query steps and set effective query conditions. In particular, some query requirements cannot be achieved through page search.

[0004] The applicant searched and found that the Chinese patent with publication number CN113535931A discloses an information processing method that can recognize in real time the complete short sentence composed of the natural language text currently input by the user. If the complete short sentence is recognized as a statement with query intention, it will be parsed into a standard query language that can be recognized by the database, and the data query results will be intuitively displayed in the form of data visualization charts; in this way, users do not need to master the data query programming language or rely on professional technicians, and the query needs of ordinary people can be largely met. However, the applicant's experience shows that the above method may cause query requests with longer statements and complex query requirements to be parsed into SQL query statements that can be recognized by the database, which may lead to problems such as cumbersome query statements and complex syntax. There is a certain probability that the query statement will not be executed normally, affecting the normal use of the information query system. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide an intelligent information query method for a power digital warehouse management system that can reliably and stably return query results to query requirements input in natural language.

[0006] In order to solve the above technical problems, the present invention proposes a technical solution: an intelligent information query method for a power digital warehouse management system, comprising the following steps:

[0007] Step 1: Build a preset question library and an SQL function library, wherein each preset question in the preset question library corresponds to at least one SQL function template in the SQL function library;

[0008] Step 2: responding to the information query demand input by the user in natural language, segmenting the information query demand to obtain multiple question segments;

[0009] Step 3: Match each question segment with each preset question contained in the preset question library, and generate a matching preset question list by summarizing the matching results; find the SQL function template corresponding to each question in the preset question list from the SQL function library, and together form an SQL function description list;

[0010] Step 4: Input the information query requirement, historical information, and SQL function description list into the problem decomposition agent, where the initial value of the historical information is null. The information query requirement is used as a problem and problem decomposition is performed. The specific method is as follows:

[0011] S41. Analyze the problem sentence by sentence based on the problem and the SQL function description list, and split the problem into multiple sub-problems that can be solved by calling the SQL function templates in the SQL function description list, thereby forming a sub-problem list;

[0012] S42: Traverse the sub-question list. If a sub-question in the list can directly obtain query information from historical information, output the sub-question and the corresponding query information. Otherwise, output the sub-question, the SQL function template to be called, and the required input parameters, obtain the SQL query statement corresponding to the sub-question, execute the SQL query statement, and obtain the corresponding query information.

[0013] If there is a subproblem that can only be solved by query information from other subproblems, define the unsolved subproblem as a secondary subproblem and then execute step 6. Otherwise, execute step 5.

[0014] Step 5: The information query requirement and query information are transmitted to the result merging agent, which merges them to obtain the query result;

[0015] Step 6: Use the query results obtained in step 5 as historical information, use all the secondary sub-questions obtained in step 4 as information query requirements, and return to step 4;

[0016] This cycle repeats until all sub-problems have been solved, and the query result output in step 5 is the query result that meets the user's needs.

[0017] In the prior art, information query in the power digital warehouse relies on entering standardized search content through different query pages to obtain query results. However, the present invention uses natural language input as the only query page and the only query entry, which reduces the difficulty for users to query information.

[0018] The present invention presets a question library and an SQL function library, and uses a problem decomposition agent to decompose the information query requirements input in natural language to obtain multiple question segments, matches the question segments with the questions in the preset question library to obtain a preset question list, and obtains SQL function templates corresponding to the questions in the preset question list from the SQL function library. Compared with the existing natural language information query method, it is no longer necessary to convert natural language into complex SQL query statements. Instead, after decomposing it into multiple question segments, the relevant SQL function description list is preliminarily filtered through text matching, and a relatively simple SQL query statement is generated using the SQL function template and the corresponding input parameters, which effectively reduces the data burden of the large model, avoids problems such as cumbersome query statements and complex syntax, and also reduces the probability of query statements failing to execute normally.

[0019] Clearly, decomposing SQL queries using an agent is relatively difficult, while decomposing questions is much easier. Similarly, merging SQL queries is relatively difficult, but merging the query information obtained by executing SQL queries is much easier. Therefore, this invention fully leverages the agent's ability to process natural language, decomposing questions and merging the query information obtained by executing SQL queries into query results, enabling flexible response to complex natural language query requirements.

[0020] In addition, the present invention achieves decoupling from the code through the design of a preset question library and SQL function library. When the system has new query requirements, it only needs to update the preset question library and SQL function library. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The present invention will be further described below with reference to the accompanying drawings.

[0022] Figure 1 It is a schematic diagram of the existing power digital warehouse information query method.

[0023] Figure 2 It is a schematic diagram of the framework of the information query method in an embodiment of the present invention.

[0024] Figure 3 It is a flowchart of the information query method in an embodiment of the present invention. DETAILED DESCRIPTION

[0025] This embodiment shows an intelligent information query method for a power digital warehouse management system. Figure 2 As shown, a unified query input is designed, a unique input entry is designed, natural language input is supported, natural language is parsed through intelligent information query, the user's query requirements are understood, and query results are returned, such as Figure 3 As shown, the specific steps include:

[0026] Step 1: Build a preset question library and an SQL function library. Each preset question in the preset question library corresponds to at least one SQL function template in the SQL function library. That is, one preset question may correspond to one or more SQL function templates. For example, in the table below, preset question 1 and preset question 3 are associated with one SQL function template, and preset question 2 is associated with two SQL function templates.

[0027] Table 1 Example of preset question bank

[0028]

[0029] Table 2 SQL function library examples

[0030]

[0031] Step 2: responding to the information query demand input by the user in natural language, performing segmentation processing on the information query demand, and thereby obtaining multiple question segments.

[0032] The user inputs the query requirements through natural language. After receiving the user's query requirements, the system will segment them into multiple question segments based on the information query requirements of multiple questions. For example: the user inputs "Please help me check who has received a single-phase electricity meter on X / X / 2024? What is their work number? What department are they from?" in natural language. Here, the query requirements are segmented according to the identifier "?" and decomposed into three question segments: "Who has received a single-phase electricity meter on X / X / 2024?", "What is their work number?", and "What department are they from?" In addition to "?", common identifiers can also be ";" or ".", etc. This is existing technology and will not be repeated here.

[0033] Step 3: Match each question segment with each preset question in the preset question library, and generate a matching preset question list by summarizing the matching results; then find SQL function templates corresponding to each question in the preset question list from the SQL function library, and together form an SQL function description list. The SQL function template includes the SQL query statement and required input parameters.

[0034] The segmented question segments can be matched with the questions in the preset question library through the text similarity matching model. The text similarity matching model can compare the similarity between text pairs. This is an existing technology. Common text similarity matching models include the text_similarity model under the PaddleNLP framework.

[0035] For example, the three question segments "Who received single-phase electricity meters on X / X / 2024?", "What is their work number?", and "What department are they from?" may match the three preset questions "What are the IDs of people who received single-phase electricity meters on X / X / 2024?", "What is the work number of idXXX?", and "Which department is idXXX from?"; of course, depending on the preset questions, two questions may also be matched, "What are the IDs of people who received single-phase electricity meters on X / X / 2024?" and "What is the work number and department of idXXX?", which are not limited here.

[0036] After obtaining the preset question list, you can find the corresponding SQL function template. For example, as shown in Table 1, the preset question "Which department does employee number XXX belong to?" corresponds to the [SQL0001] function template in Table 2.

[0037] Step 4: Input the information query requirement, historical information, and SQL function description list into the problem decomposition agent, where the initial value of the historical information is null. The information query requirement is used as a problem and problem decomposition is performed. The specific method is as follows:

[0038] S41. Analyze the problem sentence by sentence based on the problem and the SQL function description list, and split the problem into multiple sub-problems that can be solved by calling the SQL function templates in the SQL function description list, thereby forming a sub-problem list;

[0039] S42: Traverse the sub-question list. If a sub-question in the list can directly obtain query information from historical information, output the sub-question and the corresponding query information. Otherwise, output the sub-question, the SQL function template to be called, and the required input parameters, obtain the SQL query statement corresponding to the sub-question, execute the SQL query statement, and obtain the corresponding query information.

[0040] If there is a subproblem that can only be solved by query information from other subproblems, define the unsolved subproblem as a secondary subproblem and then execute step 6, otherwise execute step 5.

[0041] The problem decomposition agent is an agent constructed based on a large language model through prompts. The large language model can be ERNIE-Speed-128K, ERNIE-3.5-8K, Qwen2.5-32B, etc. The following is an example of constructing a problem decomposition agent using prompts:

[0042] "#You are a senior <problem> analyst, proficient in using the divide-and-conquer thought to solve <problems>. You need to analyze <problems> and answer. Mine query information from <historical information>, split the unsolved <problems> into <subproblems> that can be solved by calling the SQL function template one by one, and finally form a <subproblem> decomposition plan for calling the SQL function template. I will provide you with <SQL function description list>, <historical information>, and <problem>. Execute according to the following task requirements.

[0043] ##Task requirements:

[0044] 1. Based on <problem>, <historical information>, and <SQL function description list>, think step by step, analyze the problem sentence by sentence, and split <subproblems>.

[0045] 2. The thinking process should be

careful

rigorous

comprehensive

detailed

accurate

[0046] 3. For <subproblems>, if query information can be obtained from <historical information>, there is no need to call the SQL function to obtain it, set sql_name to known, and is_sub to false.

[0047] 4. The reasoning process is

prohibited

[0048] 5. It is prohibited to find query information outside <historical information> and <SQL function description list>.

[0049] 7. Output the result in json format.

[0050] 8. The output result is a list of <subproblems>, and each <subproblem> contains the keywords subquestion, sql_name, params, is_sub, and source.

[0051] 9. subquestion is the description of <subproblem>, and the description of <subproblem> should contain detailed and specific information.

[0052] 10. sql_name is the name of the SQL function that needs to be called in the <SQL function description list>. If there is no need to call the SQL function, output an empty string.

[0053] 11. params are the parameters for , in JSON format, which are the parameters to be passed to the SQL function specified by sql_name. Please pass them according to the requirements of the corresponding SQL function. Mandatory parameters must be passed.

Do not pass parameters that are not required

[0054] 12. is_sub indicates whether it is a <secondary sub - problem>. A secondary sub - problem can be clearly proposed only relying on the query information of other . If it is a <secondary sub - problem>, output lowercase true; otherwise, output lowercase false.

[0055] 13. source is the source of the query information for the . If it is from the information in <historical information>, output lowercase known; if it is from SQL function calls, output lowercase sql.

[0056] # The following are <historical information>, <SQL function description list> and <question>. Please start decomposing : ***

[0057] <Historical information>: ***

[0058] <SQL function description list>: ***

[0059] <Question>: ***

[0060] Building a question - decomposition intelligent agent through prompt words is the prior art. The above is only a simple example, and its construction method is not unique, as long as it can meet the requirements.

[0061] In this embodiment, for the query requirement "Help me find out who are the people who received single - phase energy meters on a certain day in a certain month of 2024? What are their employee numbers? Which departments are they from?", it is decomposed into two sub - problems, namely "What are the IDs of the people who received single - phase energy meters on a certain day in a certain month of 2024?" and "What are the employee numbers and departments corresponding to ID XXX?". For the second sub - problem, it can be corresponded to the SQL function template numbered SQL0001 mentioned above. After obtaining the content of the input parameter "employee number", the corresponding SQL query statement can be generated to return employee information, including id, employee number, department, gender, etc. And the input parameters of the SQL function template numbered SQL0001 can be obtained through the processing of the first sub - problem, that is, the first sub - problem depends on the second sub - problem.

[0062] Step Five: Pass the information query requirement and all query information to the result - merging intelligent agent, and the result - merging intelligent agent merges them to obtain the query result.

[0063] The result merging agent is an agent built based on the language model through functions and prompts. That is, the result merging agent is built based on prompts and the function of the large model. The function passes the call and result of the SQL function template, and the prompt guides the result merging agent to answer. An example of building a result merging agent based on the language model through functions and prompts is as follows:

[0064] "#You are an experienced user assistant, proficient in understanding questions in context, finding query information from the data and responding to users. I will give you <question> and perform the following tasks.

[0065] ##Task Requirements:

[0066] 1. <Answer> must be [accurate] and [complete].

[0067] 2. The answer must not include any reasoning process.

[0068] 3. Answer in one sentence, and the language should be coherent.

[0069] #The following is <question>. Please find the query information from the query results of the included SQL function template and answer it:

[0070] <Question>: ***

[0071] <Answer>: ***."

[0072] The existing technology is to construct an intelligent agent by combining prompt words, and the construction method is not unique, as long as it can meet the needs.

[0073] Step 6: Use the query results obtained in step 5 as historical information, use all the secondary sub-questions obtained in step 4 as information query requirements, and return to step 4;

[0074] This cycle repeats until all sub-problems have been solved, and the query result output in step 5 is the query result that meets the user's needs.

[0075] Because the number of SQL function templates in the SQL function library is too large, in this embodiment, the purpose of steps 1 to 3 is to obtain the required SQL function description list to reduce the number of SQL function templates and improve the query speed; the purpose of steps 4 to 6 is to decompose the problem, query the decomposed sub-problems through the SQL function templates in the SQL function description list, and merge the query information with the corresponding problem into the final query result through the result merging agent and output it.

[0076] For the query request input by the user in natural language in this embodiment, "Please help me check who has received single-phase electricity meters on X / X / 2024? What is their work number? What department are they from?", the result merging intelligent agent returns the query result as "The people who received single-phase electricity meters on X / X / 2024 are A, B and C, whose work numbers are A1, B1, C1, and they are from departments A2, B2, C2 respectively."

[0077] This embodiment makes full use of the intelligent agent's ability to process natural language, decomposes the question into multiple question segments, and matches them with preset questions. It can flexibly respond to complex natural language query requirements and merge query information, ensuring that the query request input by the user can receive a relatively accurate response and obtain the required query results, avoiding the defect that the query results may not be obtained in the existing technology.

Claims

1. An intelligent information query method for a power digital warehouse management system, comprising the following steps: Step 1: Build a preset question library and an SQL function library, wherein each preset question in the preset question library corresponds to at least one SQL function template in the SQL function library; Step 2: responding to the information query demand input by the user in natural language, segmenting the information query demand to obtain multiple question segments; Step 3: Match each question segment with each preset question contained in the preset question library, and generate a list of preset questions that match it by summarizing the matching results; Finding SQL function templates corresponding to each question in the preset question list from the SQL function library, and forming an SQL function description list together; Step 4: Input the information query requirement, historical information, and SQL function description list into the problem decomposition agent, where the initial value of the historical information is null. The information query requirement is used as a problem and problem decomposition is performed. The specific method is as follows: S41. Analyze the problem sentence by sentence based on the problem and the SQL function description list, and split the problem into multiple sub-problems that can be solved by calling the SQL function templates in the SQL function description list, thereby forming a sub-problem list; S42: Traverse the sub-question list. If a sub-question in the list can directly obtain query information from historical information, output the sub-question and the corresponding query information. Otherwise, output the sub-question, the SQL function template to be called, and the required input parameters, obtain the SQL query statement corresponding to the sub-question, execute the SQL query statement, and obtain the corresponding query information. If there is a subproblem that can only be solved by query information from other subproblems, define the unsolved subproblem as a secondary subproblem and then execute step 6. Otherwise, execute step 5. Step 5: The information query requirement and query information are transmitted to the result merging agent, which merges them to obtain the query result; Step 6: Use the query results obtained in step 5 as historical information, use all the secondary sub-questions obtained in step 4 as information query requirements, and return to step 4; This cycle repeats until all sub-problems have been solved, and the query result output in step 5 is the query result that meets the user's needs.

2. The intelligent information query method for the electric power digital warehouse management system according to claim 1 is characterized by: In step three, each question segment is matched with questions in the preset question library through a text similarity matching model.

3. The intelligent information query method for the power digital warehouse management system according to claim 2 is characterized by: The text similarity matching model is the Text_Similarity model under the PaddleNLP framework.

4. The intelligent information query method for a power digital warehouse management system according to any one of claims 1 to 3, characterized in that: The problem decomposition agent is an agent constructed based on a large language model through prompt words, and the result merging agent is an agent constructed based on a large language model through functions and prompt words.

5. The intelligent information query method for the electric power digital warehouse management system according to claim 4 is characterized in that: The large language model is ERNIE-Speed-128K, ERNIE-3.5-8K or Qwen2.5-32B.

Citation Information

Patent Citations

  • Information processing method and device, electronic equipment and storage medium

    CN113535931A

  • Method and device for constructing general SQL report data set

    CN110442595A

  • Multi-engine intelligent question answering system for multi-type knowledge base

    CN115238101A