Intelligent information query method of electric power digital warehouse management system

The intelligent information query method for electric power digital warehouses addresses the complexity of query demands by segmenting and decomposing natural language inputs into simpler SQL queries using a problem library and function library, ensuring accurate and reliable results.

CN119669370AActive Publication Date: 2025-03-21NANJING YUNSHE INTELLIGENT TECH CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

Current electric power digital warehouse information query methods rely on multiple pages and standardized search conditions, making it difficult for users to convert complex query demands into effective steps and settings, especially for long queries, which can result in complex and erroneous SQL queries.

Method used

An intelligent information query method for electric power digital warehouses that uses a pre-configured problem library and SQL function library to process natural language inputs by segmenting queries, matching them with pre-configured problems, and decomposing them into simpler SQL queries using an intelligent problem-solving entity.

Benefits of technology

This method ensures accurate and reliable query results by breaking down complex queries into manageable segments, reducing the complexity of SQL queries and minimizing errors, thus enhancing the stability and efficiency of information queries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119669370A_ABST
    Figure CN119669370A_ABST
Patent Text Reader

Abstract

The invention relates to an intelligent information query method of an electric power digital warehouse management system. The intelligent information query method comprises the following steps: constructing a preset question library and an SQL (Structured Query Language) function library; then responding to an information query demand input by a user in a natural language to obtain a plurality of question segments, and matching each question segment with the preset question library to generate a preset question list; finding out an SQL function template corresponding to the preset question list from the SQL function library to form an SQL function description list; and inputting an information query demand and the SQL function description list into the problem decomposition agent, obtaining an SQL function template corresponding to each problem and required input parameters thereof, obtaining an SQL query statement, executing an SQL query operation, and performing a merging operation by the result merging agent. According to the method, the problems of tedious query statements, complex grammar and the like can be effectively avoided, and the probability that the query statements cannot be normally executed is reduced.
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, transfer, inventory counting, etc., in order 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 of them rely on entering standardized search content through different query pages according to the page requirements to obtain query results. The acquisition of complex related information relies on step-by-step query through multiple pages to obtain the final query results. However, the information query method that 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, especially for some query requirements, which cannot be achieved through page query.

[0004] The applicant searched and found that a Chinese patent with publication number CN113535931A discloses an information processing method, which 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 sentence with query intent, 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, nor do they need to 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 has a long query request involving complex query needs. When parsing it into an SQL query statement that can be recognized by the database, it may cause the query statement to be cumbersome and the syntax to be complex. There is a certain probability that the query statement cannot 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 which can reliably and stably return query results to query requirements input in natural language.

[0006] In order to solve the above technical problems, the technical solution proposed by the present invention is: an intelligent information query method for a power digital warehouse management system, comprising the following steps: Step 1: construct 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 preset question list matching the preset question by summarizing the matching results; find out 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; Step 4: Input the information query requirement, historical information and SQL function description list into the problem decomposition agent, wherein the initial value of the historical information is null, and the information query requirement is used as a problem to perform problem decomposition. The specific method is as follows: S41, according to the problem and the SQL function description list, analyzing the problem sentence by sentence, splitting it into multiple sub-problems that can be solved by calling the SQL function template in the SQL function description list, and forming a sub-problem list; S42, traversing the sub-question list, if a sub-question in the list can directly obtain query information from historical information, then output the sub-question and the corresponding query information, otherwise output the sub-question and 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 sub-problem that can only be solved by query information from other sub-problems, define the unsolved sub-problem as a secondary sub-problem 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, and the result merging agent merges them to obtain the query result; Step 6: Take the query result obtained in step 5 as historical information, take 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.

[0007] In the prior art, information query of the power digital warehouse relies on inputting standardized search content through different query pages to obtain query results, while the present invention uses natural language input as the only query page and the only query entry, which reduces the difficulty of users querying information.

[0008] The present invention presets a question library and an SQL function library, and uses a problem decomposition agent to decompose the information query demand 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 the 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 the problems of cumbersome query statements and complex syntax, and also reduces the probability of query statements failing to execute normally.

[0009] Obviously, it is relatively difficult to decompose SQL query statements through intelligent agents, but it is relatively easy to decompose problems. Similarly, it is relatively difficult to merge SQL query statements, but it is much easier to merge query information obtained by executing SQL query statements. Therefore, the present invention makes full use of the intelligent agent's ability to process natural language, decomposes problems, and merges query information obtained by SQL query statements into query results, which can flexibly respond to complex natural language query requirements.

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

[0011] The present invention will be further described below in conjunction with the accompanying drawings.

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

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

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

[0015] This embodiment shows an intelligent information query method for a power digital warehouse management system. Figure 2 As shown in the figure, 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: 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 to say, 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.

[0016] Table 1 Examples of preset question banks

[0017] Table 2 SQL function library examples

[0018] Step 2: respond to the information query demand input by the user in natural language, perform segmentation processing on the information query demand, and thereby obtain multiple question segments.

[0019] The user inputs the query requirements through natural language. After receiving the query requirements from the user, the system will segment the information query requirements of multiple questions into multiple question segments. For example: the user inputs in natural language "Please help me check who will use the single-phase electricity meter on X / X / 2024? What is their work number? What department are they from?" Here, the query requirements are segmented according to the identifier "?" and decomposed into three question segments: "Who will use the 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 a prior art and will not be repeated here.

[0020] Step 3: Match each question segment with each preset question contained in the preset question library, and generate a preset question list matching it 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. The SQL function template includes an SQL query statement and required input parameters.

[0021] 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 the existing technology. Common text similarity matching models include the text_similarity model under the PaddleNLP framework.

[0022] For example, the three question segments "Who are the people who received the single-phase electricity meter 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 the people who received the single-phase electricity meter on X / X / 2024?", "What is the work number of idXXX?", and "Which department is employee number XXX from?"; of course, depending on the preset questions, two questions may also be matched, "What are the IDs of the people who received the single-phase electricity meter on X / X / 2024?", and "What is the work number and department of id XXX?", which are not limited here.

[0023] 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?" can correspond to the [SQL0001] function template in Table 2.

[0024] Step 4: Input the information query requirement, historical information and SQL function description list into the problem decomposition agent, wherein the initial value of the historical information is null, and the information query requirement is used as a problem to perform problem decomposition. The specific method is as follows: S41, according to the problem and the SQL function description list, analyzing the problem sentence by sentence, splitting it into multiple sub-problems that can be solved by calling the SQL function template in the SQL function description list, and forming a sub-problem list; S42, traversing the sub-question list, if a sub-question in the list can directly obtain query information from historical information, then output the sub-question and the corresponding query information, otherwise output the sub-question and 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 are sub-problems that can only be solved by query information from other sub-problems, define the unsolved sub-problems as secondary sub-problems and then execute step 6, otherwise execute step 5.

[0025] The problem decomposition agent is an agent built based on the language model through prompt words. The language model can be ERNIE-Speed-128K, ERNIE-3.5-8K, Qwen2.5-32B, etc. The following is an example of using prompt words to build a problem decomposition agent: "You are a senior <problem> analyst, proficient in using the divide-and-conquer thinking to solve <problems>. You need to analyze <problems> and answer them, mine query information from <historical information>, break down unsolved <problems> into <sub-problems> that can be solved by calling SQL function templates one by one, and finally form a <sub-problem> decomposition plan for calling SQL function templates. I will give you <SQL function description list>, <historical information>, and <problems>, and execute according to the following task requirements."

[0026] ## Task requirements: 1. Based on <problems>, <historical information>, and <SQL function description list>, think step by step, analyze the problem sentence by sentence, and break down <sub-problems>.

[0027] 2. The thinking process should be [careful], the logic should be [rigorous], the problem decomposition should be [comprehensive] and [detailed], and the SQL function call should be [accurate].

[0028] 3. For <sub-problems>, if query information can be obtained from <historical information>, there is no need to call SQL functions to obtain it. Set sql_name to known and is_sub to false.

[0029] 4. The answer [must not contain the reasoning process].

[0030] 5. It is prohibited to search for query information outside <historical information> and <SQL function description list>.

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

[0032] 8. The output result is a list of <sub-problems>. Each <sub-problem> contains the keywords subquestion, sql_name, params, is_sub, and source.

[0033] 9. subquestion is the description of the <sub-problem>. The description of the <sub-problem> should contain detailed and specific information.

[0034] 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.

[0035] 11. params are the parameters of the <sub-problem>, in json format, which are the parameters that need 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, and [it is prohibited to pass parameters that are not required].

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

[0037] 13. source is the query information source of the <sub-question>. If it is from the information in <historical information>, output lowercase known; if it is from an SQL function call, output lowercase sql.

[0038] # The following are <historical information>, <SQL function description list>, and <question>. Please start decomposing the <sub-question>: *** <Historical information>: *** <SQL function description list>: *** <Question>: ***”

[0039] 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.

[0040] In this embodiment, for the query requirement "Help me check who are the people who received single-phase energy meters on XX day of XX month in 2024? What are their employee numbers? What departments are they from?", it is decomposed into two sub-questions, namely "What are the IDs of the people who received single-phase energy meters on XX day of XX month in 2024?" and "What are the employee numbers and departments corresponding to ID XXX?". For the second sub-question, 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. The input parameter of the SQL function template numbered SQL0001 can be obtained through the processing of the first sub-question, that is, the first sub-question depends on the second sub-question.

[0041] 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.

[0042] The result merging intelligent agent is an intelligent agent constructed based on a large language model through functions and prompt words, that is, the result merging intelligent agent is constructed based on prompt words and the function of the large model. The function passes the call and result of the SQL function template, and the prompt words guide the result merging intelligent agent to answer. An example of constructing a result merging intelligent agent based on a large language model through functions and prompt words is as follows: "# You are a senior user assistant, proficient in understanding questions in combination with the context and finding query information from the materials to reply to users. I will give you <question>, and execute according to the following task requirements.

[0043] ##Task Requirements: 1. <Answer> must be [accurate] and [complete].

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

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

[0046] #The following is <question>, please find the query information from the query results of the included SQL function template and answer it: <Question>: *** <Answer>: ***. " Constructing result merging agents through prompt words is an existing technology, and its construction method is not unique, as long as it can meet the needs.

[0047] Step 6: Take the query result obtained in step 5 as historical information, take 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.

[0048] 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 then output it.

[0049] For the query request input by the user in natural language in this embodiment, "Please help me check who have used the single-phase electricity meter 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 used the single-phase electricity meter on X / X / 2024 are A, B and C, whose work numbers are A1, B1, C1, and who are from departments A2, B2, C2, respectively."

[0050] 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, thereby ensuring that the query request input by the user can get a relatively accurate response and obtain the required query results, avoiding the defect that the query results may not be obtained in the prior art.

Claims

1. An intelligent information query method for a power digital warehouse management system, comprising the following steps: Step 1: construct 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 matching the preset questions by summarizing the matching results; Find out the 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; Step 4: Input the information query requirement, historical information and SQL function description list into the problem decomposition agent, wherein the initial value of the historical information is null, and the information query requirement is used as a problem to perform problem decomposition. The specific method is as follows: S41, according to the problem and the SQL function description list, analyzing the problem sentence by sentence, splitting it into multiple sub-problems that can be solved by calling the SQL function template in the SQL function description list, and forming a sub-problem list; S42, traversing the sub-question list, if a sub-question in the list can directly obtain query information from historical information, then output the sub-question and the corresponding query information, otherwise output the sub-question and 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 sub-problem that can only be solved by query information from other sub-problems, define the unsolved sub-problem as a secondary sub-problem 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, and the result merging agent merges them to obtain the query result; Step 6: Take the query result obtained in step 5 as historical information, take 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 of the power digital warehouse management system according to claim 1 is characterized by: In step three, each question segment is matched with the questions in the preset question library through a text similarity matching model.

3. The intelligent information query method of 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 of the 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 through prompt words based on a large language model, and the result merging agent is an agent constructed through functions and prompt words based on a large language model.

5. The intelligent information query method of the power digital warehouse management system according to claim 4 is characterized by: 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

  • Processing function construction method, function construction device and readable storage medium

    CN115687298A

  • Library query system, method and equipment based on information retrieval and large model and medium

    CN118733611A

Cited By

  • Structured query language generation method and device based on large model, equipment and medium

    CN120561139A