An agent-based lighting operation and maintenance question and answer method and system

By using an agent-based hierarchical decision-making and execution chain, combined with AC automata, MLP and LLM, the latency and controllability issues of existing natural language question answering systems in industrial and operation and maintenance scenarios are solved, achieving low latency, high reliability and security operation and maintenance interaction.

CN121561067BActive Publication Date: 2026-05-05CECEP LATTICELIGHTING
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202610079694.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-21
Publication Date
2026-05-05
Estimated Expiration
2046-01-21

AI Technical Summary

Technical Problem

Existing natural language question answering systems suffer from performance latency, uncertainty in controllability, and high risk of illusion in scenarios such as real-time control, command issuance, structured processing, and operation and maintenance control. They are unable to meet the requirements of industrial and operation and maintenance scenarios for low latency, high reliability, controllability, and security.

Method used

It adopts a hierarchical decision-making and execution link based on intelligent agents, combines rule matching (AC automaton), lightweight model (MLP) and large model (LLM), and couples permission verification and structured log auditing mechanism to achieve low latency and high reliability operation and maintenance interaction.

Benefits of technology

It enables low-latency, high-reliability, controllability, and security natural language interaction in industrial control and operation and maintenance scenarios, meeting the requirements for timeliness, controllability, security, and audit traceability, and improving semantic recognition accuracy and control security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121561067B_ABST
    Figure CN121561067B_ABST
Patent Text Reader

Abstract

This invention discloses a lighting operation and maintenance question-and-answer method and system based on intelligent agents. The method includes: constructing a structured question-and-answer template library; building an AC automaton based on the template library for fast keyword matching; training an MLP classifier based on the enhanced template library for semantic understanding; receiving user questions and obtaining semantic recognition results through a three-level strategy of AC automaton matching, MLP classifier matching, and predefined slot fallback matching; and generating responses or execution instructions based on the results. The system includes modules for question-and-answer template library management, semantic recognition, intent execution and response generation, and auditing and access control. This invention achieves low-latency, highly controllable adaptive operation and maintenance interaction by implementing a hierarchical decision-making and execution chain, ensuring accurate and controllable instructions and full traceability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and computer information processing technology, specifically to a lighting operation and maintenance question-and-answer method and system based on intelligent agents. This invention also relates to electronic devices and storage media for implementing the above method. Background Technology

[0002] Currently, natural language question answering (QA) and dialogue systems are widely used in knowledge retrieval, customer service, system control, and other fields. In recent years, with the rapid development of large-scale language models (LLM), the "retrieval-Augmented Generation (RAG)" approach has become the mainstream technical route for building high-quality QA systems.

[0003] For example, Chinese patent application CN202410611948.4 discloses a dynamic adaptive question-answering system and method based on hierarchical structure and retrieval enhancement. It utilizes organization and knowledge representation + retrieval enhancement (RAG) + hierarchical structure + cross-domain knowledge integration + dynamic learning, along with adaptation + user interaction + optimization modules. By understanding and utilizing the organization's internal knowledge structure, combined with RAG technology and a fine-tuned LLM, it provides a more efficient and accurate solution in the field of document query and answering within the organization. This enables enterprises to provide efficient and accurate knowledge management services, helping employees quickly obtain the information they need, while continuously optimizing and adapting to new query requirements over time.

[0004] However, this solution is mainly used for scenarios such as "document, knowledge base Q&A, and retrieval" and is not suitable for "real-time control, command issuance, structuring, auditing, and operation and maintenance control"; there will be risks of performance latency and uncertainty in controllability.

[0005] For example, Chinese patent application CN117609477A discloses a large model question answering method and apparatus based on domain knowledge. It first uses rules, FAQs, and rule-based experience question answering systems for matching and scoring. If a credible rule or FAQ is matched, it is returned directly. Otherwise, it uses LLM+ retrieval to obtain the target text and adds a prompt to generate it. Finally, the score determines whether to accept it.

[0006] However, its rules, FAQ system + LLMfallbACk are more suitable for free text Q&A and document Q&A, and are not suitable for the "structured slots + control instructions + auditing + distribution + receipts + real-time" scenario; in addition, it may lack the design of lightweight structured modules such as "slots + real-time decision module (MLP)", resulting in a lack of timeliness and low illusion capabilities.

[0007] For example, US patent application US20240428044A1 uses a neural network model for a retrieval-based question-answering system and method. It generates answers for multiple retrieved documents (top-K) using neural networks and LLM technology (placing them into a parallel answer pool), then scores and sorts them, and finally outputs the best answer.

[0008] However, the method of generating multiple candidates, sorting and scoring them, and then outputting the final result is suitable for open-ended questions and unstructured answers, but not for the process of "generating control instructions and structured instructions, issuing them, executing them, and then auditing them"; the reason is that the latency is high and the control is uncertain.

[0009] For example, US patent application US20250103592 describes a system and method for question answering that utilizes multiple knowledge sources. It supports retrieval and generation of multiple knowledge sources (structured KB + unstructured text), and combines non-retrieval LLM output with mixed decision-making based on retrieval results.

[0010] However, although it supports structured + unstructured + LLMfallbACk, as an open QA system, it still focuses on "answering, explaining, document QA, and knowledge querying", and may not have the "capability to issue controllable instructions and then audit them before execution" and "low latency, high security and controllability".

[0011] In summary, the design goals of existing patent / publication solutions are mainly "documentation, knowledge base, FAQ, enterprise knowledge management, and question-and-answer services," emphasizing "accurate answers, knowledge acquisition, knowledge integration, cross-domain compatibility, adaptability, flexibility, and open QA." They rarely address the needs of "structured slots + control, instruction issuance + execution + rapid Q&A + auditing, and logging." Therefore, when directly applying them to a "smart street light operation status query, especially an operation and maintenance control + instruction + receipt + auditing" system, risks exist regarding performance, reliability, security, and controllability. Summary of the Invention

[0012] To overcome the technical problems of high latency, poor controllability, high risk of illusion, and system complexity in existing technologies, this invention proposes a lighting operation and maintenance question-and-answer method and system based on intelligent agents. The core of this invention lies in constructing a hierarchical decision-making and execution chain of "rule matching (AC automaton) → lightweight model (MLP) → large model (LLM)," and coupling it with permission verification and structured log auditing mechanisms. This achieves adaptive operation and maintenance interaction with both millisecond-level response and intelligent generalization capabilities, while ensuring accurate and controllable instructions and full traceability of operations.

[0013] Therefore, the first objective of this invention is to provide a lighting operation and maintenance question-and-answer method based on intelligent agents, which includes the following steps:

[0014] A question-and-answer template library is constructed based on preset questions and corresponding answers for the target business. The templates in the question-and-answer template library include at least intent tags, keyword sets, regular expression patterns, and response templates.

[0015] Construct an AC automaton based on the aforementioned question-and-answer template library;

[0016] Training text is generated based on the enhanced and expanded question-answering template library, and an MLP classifier is trained using the training text and its intent label.

[0017] The system receives natural language questions input by the user, and processes the natural language questions by sequentially executing a multi-level matching strategy using the AC automaton and the MLP classifier to obtain semantic recognition results. The semantic recognition results include at least the identified intent and the extracted slots.

[0018] Based on the intent and slot in the semantic recognition results, the system routes to the corresponding processing logic, generates execution instructions or query data, and generates a final response based on a predefined response template or a large language model.

[0019] The sequential execution of the multi-level matching strategy includes: performing a first-level matching based on a question-answer template library using an AC automaton; if the first-level matching fails, performing a second-level matching using an MLP classifier; if the second-level matching still fails to meet the preset reliability requirements, then enabling predefined slot rules for fallback matching.

[0020] Preferably, the construction of the AC automaton based on a predefined question-answer template library includes:

[0021] Based on the question-and-answer template library, the words in the keyword set of each template are used as pattern strings;

[0022] Based on the pattern string, construct the AC automaton.

[0023] Preferably, the step of generating training text based on the enhanced and expanded question-answering template library, and using the training text and its intent label to train an MLP classifier includes:

[0024] The question-and-answer template library is enhanced and expanded using a large language model, and training text is generated based on the enhanced and expanded question-and-answer template library.

[0025] The training text is converted into text vectors using a pre-trained language model;

[0026] The MLP classifier is trained using the text vector as input features and the corresponding intent label as supervision signal.

[0027] Preferably, the sequential execution of the multi-level matching strategy includes:

[0028] The AC automaton is used to scan the natural language question, match the keywords in the question-answer template library, and perform semantic filtering through regular expressions associated with the template to obtain the first candidate result;

[0029] If the first candidate result is empty or the confidence level is lower than the first threshold, the natural language question is converted into a text vector, input into the MLP classifier to obtain the intent probability distribution, and the semantic similarity between the text vector and the template under the corresponding intent in the question-answering template library is calculated to obtain the second candidate result.

[0030] If the second candidate result is empty or the confidence level is lower than the second threshold, the natural language question is directly scanned using predefined slot rules to extract key entity slots, and the intent is inferred based on the extracted slot combinations.

[0031] Preferably, the step of routing to the corresponding processing logic based on the intent and slot in the semantic recognition result, generating execution instructions or query data, and generating a final response based on a predefined response template or large language model includes:

[0032] When the intent in the semantic recognition result is an operation instruction, it is mapped to the backend API according to the matched question and answer template identifier, the extracted slot value is assembled into API parameters, and the API is called after the execution permission verification, and a response is generated based on the API execution result.

[0033] When the intent in the semantic recognition result is a data query type, the extracted slot value is injected into the structured query statement corresponding to the matched question and answer template, the query is executed, and the result data is filled into the response placeholder of the template to generate a reply.

[0034] When the intent in the semantic recognition result is a knowledge question-and-answer type and no question-and-answer template is matched, the natural language question is submitted to the large language model, and a response is generated under the constraints of preset prompt words.

[0035] The second objective of this invention is to provide an agent-based lighting operation and maintenance question-and-answer system for implementing any of the methods described in an agent-based lighting operation and maintenance question-and-answer method, comprising:

[0036] The question-and-answer template library management module is used to store, manage, and provide an access interface to the structured question-and-answer template library. The templates in the question-and-answer template library include at least intent tags, keyword sets, regular expression patterns, and response templates.

[0037] The semantic recognition module, connected to the question-and-answer template library management module, is used to receive natural language questions input by users and output semantic recognition results containing the identified intent and extracted slots.

[0038] The intent execution and response generation module is connected to the semantic recognition module. It is used to route to the corresponding processing logic according to the semantic recognition result, generate execution instructions or query data, and generate the final response based on the response template or large language model.

[0039] Preferably, the semantic recognition module includes:

[0040] The AC automaton matching submodule is used to load the question-and-answer template library and build the AC automaton, perform fast keyword matching based on the AC automaton, and perform semantic fine screening by combining the regular expression pattern of the template.

[0041] The MLP intent matching submodule includes a text embedding model and an MLP classifier, which are used to perform intent classification and semantic template matching on questions that the AC automaton matching submodule failed to process.

[0042] An independent slot matching submodule is used to extract entities and infer intents directly based on predefined slot configuration rules when neither the AC automaton matching submodule nor the MLP intent matching submodule has successfully matched.

[0043] As a preferred embodiment, a lighting operation and maintenance question-and-answer system based on intelligent agents further includes:

[0044] The audit and access control module is embedded in the business process. It is used to perform permission verification before the intent execution and response generation module performs its operations, and to record interaction logs throughout the process to achieve end-to-end auditing.

[0045] A third objective of this invention is to provide an electronic device comprising:

[0046] Memory, used to store computer programs;

[0047] The processor is used to execute the program stored in the memory to implement any of the steps of the above-mentioned agent-based lighting operation and maintenance question-and-answer method.

[0048] The fourth objective of this invention is to provide a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of any of the above-mentioned agent-based lighting operation and maintenance question-and-answer methods.

[0049] The beneficial effects of this invention are as follows:

[0050] Addressing the shortcomings of existing pure RAG+LLM question-answering systems, such as high latency, poor controllability, significant risk of illusion, and system complexity, this invention proposes a solution that balances low latency, high reliability, controllability, and intelligent flexibility. It is more suitable for industrial and maintenance scenarios with stringent requirements for timely responses, control, auditing, structured output, operational security, and command issuance. This solution enables interaction with the system via natural language (voice or text) in industrial control, maintenance, and system management (such as smart street light management), allowing for command issuance, status queries, historical event retrieval, and audit log recording. It satisfies the requirements of these scenarios for timeliness (low latency), controllability (accurate and executable commands), security, and audit traceability (who issued what command and when it was executed).

[0051] Compared with the prior art, the solution of the present invention has the following outstanding advantages:

[0052] 1. Significantly improves semantic recognition accuracy: Combining Chinese word segmentation with AC automaton for high-concurrency keyword / intent pre-screening, and supplemented by hybrid slot extraction based on intent selection, the overall accuracy of intent recognition and slot extraction is significantly improved compared to traditional rule-based or single sequence labeling schemes (see quantization section). AC automaton provides a theoretical guarantee for linear-time multi-keyword matching.

[0053] 2. Achieving low-latency, high-concurrency decision-making paths: A lightweight MLP is used as a fast path (local inference) to handle simple and explicit control requests with millisecond-level responses; semantic completion is only performed on complex / uncertain requests by calling the 14B large model (Qwen-14B), ensuring real-time performance while reducing the frequency and cost of calling the large model. Qwen-14B is one of the engineering-grade large model choices and is suitable as a completion module.

[0054] 3. Reduce accidental touches and improve control security: Add permission verification and numerical validity checks before issuing instructions, along with a traceable audit trail and receipt parsing, to significantly reduce the occurrence of accidental or illegal commands and the difficulty in tracing responsibility (see quantitative results for details).

[0055] 4. Compared to large-scale models, the user experience is not diminished by faster response times: While large-scale models will take at least five times longer than lightweight MLPs and AC automata for intelligent question answering, their advantage lies in their highly human-like responses. Current technology prioritizes processing pre-set questions and then uses large-scale models to provide human-like responses to unpre-set questions. Therefore, the overall user experience combines the comfort of rapid responses to frequently asked questions with the realism of responses to less common questions provided by large-scale models. Attached Figure Description

[0056] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0057] Figure 1 This is a flowchart illustrating a lighting operation and maintenance question-and-answer method based on an intelligent agent, according to an embodiment of the present invention.

[0058] Figure 2 This is a flowchart illustrating a multi-level matching strategy for a lighting operation and maintenance question-and-answer method based on an intelligent agent, according to an embodiment of the present invention.

[0059] The accompanying drawings have illustrated specific embodiments of the invention, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the invention in any way, but rather to illustrate the concept of the invention to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0060] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without inventive effort are within the scope of protection of the present invention. Unless otherwise defined, the technical or scientific terms used herein should have the ordinary meaning understood by those skilled in the art to which this invention pertains.

[0061] AC automaton is a classic multi-pattern string matching algorithm. Its core function is to efficiently find out whether any one (or more) predefined keywords appear in the text by scanning the input text once. It constructs a tree-like state transition diagram for all keywords to be matched, so that the matching process does not require backtracking and the time complexity is close to linear, thus making it extremely fast.

[0062] MLP, or Multilayer Perceptron, is a basic feedforward artificial neural network architecture. It typically consists of an input layer, one or more hidden layers, and an output layer. Each layer contains multiple neurons (nodes), and layers are connected by weights. MLPs can learn complex nonlinear mappings between input features and output labels and are commonly used for classification and regression tasks.

[0063] LLM, or Large Scale Language Model, is a deep learning model trained on massive amounts of text data with a huge number of parameters (typically billions or even hundreds of billions). It has powerful language understanding, generation, reasoning, and knowledge storage capabilities, and can handle open-domain, complex, and even fuzzy natural language tasks, such as writing articles, answering complex questions, and conducting multi-turn dialogues.

[0064] Intent: In the fields of natural language processing and human-computer interaction, intent, also known as user intent or dialogue intent, refers to the underlying purpose, goal, or type of operation that a user wants to perform behind their natural language input (a sentence).

[0065] Intent is not the specific words spoken by the user, but rather an abstraction and classification of the behavioral categories behind those words.

[0066] Slot: In the fields of natural language processing and human-computer dialogue, a slot refers to a key information fragment or parameter extracted from user utterance that is necessary to complete a specific task. The entire task is usually defined by an intent and multiple slots, which is called slot filling.

[0067] Example 1

[0068] To better understand the concept of the intelligent agent-based lighting operation and maintenance question-and-answer method of this invention, this embodiment takes the smart street light operation and maintenance scenario in lighting operation and maintenance control as an example to illustrate the entire process of the method of this invention in detail. Those skilled in the art will understand that the method of this invention is also applicable to smart buildings, industrial IoT, data center management, power grid dispatching, and other operation and maintenance control fields that require real-time, controllable, and auditable natural language interaction and operation.

[0069] An embodiment of the present invention provides a lighting operation and maintenance question-and-answer method based on intelligent agents, such as... Figure 1 As shown, it includes the following steps:

[0070] S1. Construct a question-and-answer template library based on preset questions and corresponding answers for the target business. The templates in the question-and-answer template library include at least intent tags, keyword sets, regular expression patterns, and response templates.

[0071] The question-and-answer template library is a structured "knowledge-instruction" driven engine for the entire question-and-answer system. This library is not merely a simple collection of question-and-answer pairs, but rather encodes domain experts' understanding of the business, interaction logic, and control rules into a machine-understandable and executable script. It forms the cornerstone for achieving accurate, high-speed, and controllable semantic matching and execution.

[0072] This invention constructs three categories of instructions for core business scenarios in lighting operation and maintenance control: on-site operation instructions (such as opening a page, calling personnel), backend data query instructions (such as querying lighting rate, work order data), and business knowledge Q&A instructions (such as emergency contact, operation monitoring, performance analysis). The instructions are designed and written into a JSON format template library file (templates.json). A JSON format Q&A template is created for each "question-answer" pair or "instruction-execution" pair. Each Q&A template is a JSON object, which includes at least the following fields:

[0073] id: Intent ID, a unique identifier for the template.

[0074] Category (Intent Tag): Used for core routing, determining subsequent processing logic. In this invention, it is mainly divided into three categories: "site_action" (on-site operation instructions, such as opening a page or calling personnel), "backend_query" (backend data query, such as querying light-up rate or work order data), and "business_qa" (business knowledge Q&A).

[0075] keywords: An array of core keywords that trigger this template.

[0076] regex_patterns: A list of regular expressions used for semantic refinement after keyword matching. It further improves the accuracy of matching and reduces false triggers through complex rules (such as positive / negative lookahead).

[0077] raw_response: The response template text, which may contain placeholders for slots to be filled (such as {project}, {time}) for generating the final response.

[0078] In addition, the template library can be expanded to include fields such as synonyms (synonym mapping, which greatly expands the matching range of keywords), sql_template (parameterized query statement template, used for data query intent), and slots (slot definition, for fine-grained management of parameters required for tasks) to achieve more complex business logic.

[0079] It is important to note that while the three types mentioned above—site_action, backend_query, and business_qa—are the core categories defined in this invention, the question-and-answer template library is an open and extensible structure. When business needs expand and new categories require support (e.g., "data_report" for data report generation, "device_config" for device configuration), technical personnel only need to follow the same template specifications, define the new category, and write the corresponding template fields (such as new keywords, sql_template, or API mapping relationships), adding them as a new JSON object to the templates.json file. The system dynamically loads all question-and-answer templates by reading this file, without needing to modify the core matching and execution engine code.

[0080] To clearly demonstrate the construction process of the question-and-answer template library, the following sections explain the sub-steps of its construction according to three core instructions:

[0081] S11, construct the site operation instruction class (site_action) template.

[0082] The site_action template is used to process user commands that need to trigger specific front-end or back-end actions immediately. Its design goal is to achieve high-precision matching, prevent accidental triggering, and ensure accurate command delivery.

[0083] When constructing site operation instruction templates, technical personnel need to analyze and design based on specific business operation requirements, such as the scenario where "a user needs to urgently contact the on-duty maintenance personnel of a certain project." The construction process typically follows this logic: First, determine the intent label as site_action; second, define core keywords such as ["call", "on-duty personnel"], and establish a synonym network through the synonyms field (e.g., mapping "call" to ["dial", "contact"]) to cover various user expressions such as "call the person in charge" and "contact maintenance"; next, design regex_patterns containing structures such as negative lookahead (?!.*(don't|don't...)) to effectively exclude negative intents and prevent accidental triggering; then, write a response template containing slot placeholders in raw_response, and define the dynamic parameters required for the instruction in slots, thereby completing an instruction template that can be accurately matched and safely triggered.

[0084] In this embodiment, taking the instruction scenario of "calling the duty officer" as an example, the JSON structure of the corresponding on-site operation instruction class (site_action) template is as follows:

[0085] json

[0086] {

[0087] “id”:1,

[0088] "category":"site_action",

[0089] "keywords": ["call", "duty officer", "platform personnel"],

[0090] “synonyms”:{

[0091] "Call": ["Dial", "Contact", "Send", "Find", "Notify"],

[0092] "Duty Officer": ["Duty Personnel", "On Duty", "Responsible Person", "Maintenance Personnel"]

[0093] },

[0094] “regex_patterns”:[

[0095] "^(?!.*(Don't|No|No need|Unnecessary)).*(Call|Contact|Dial|Notify).*(Duty officer|Duty personnel|Responsible person)"

[0096] ],

[0097] "raw_question": "Calling the project platform duty officer"

[0098] "raw_response": "Calling the {project} operations and maintenance personnel for you."

[0099] “slots”:[

[0100] {"slot_name":"project","slot_type":"optional","slot_value":"all"} ]

[0102] }

[0103] When a user enters "Contact the on-duty personnel at the Hefei project immediately!", the site operation instruction template will be matched, the system will extract the slot {project: "Hefei"}, and trigger the background process of calling the Hefei project maintenance personnel, and finally reply "Calling the Hefei maintenance personnel for you."

[0104] S12, construct the backend data query class (backend_query) template.

[0105] The backend data query class (backend_query) template is used to transform users' natural language data query requests into accurate queries and result formatting for the database. Its core design is to achieve accurate mapping from business terms to query logic, as well as the assembly and execution of dynamic parameters.

[0106] When building the backend data query class (backend_query) template, technical personnel need to analyze specific data query requirements, such as "users need to query the work order processing efficiency (closure rate) of a specific project within a certain time period." The construction process follows this logic: First, determine the intent label as backend_query; second, define core keywords (such as ["work order closure rate"]) around business terms and expand synonyms (such as mapping "work order closure rate" to ["work order completion rate", "closure ratio"]) to unify the various expressions of business concepts; then, define the parameter system in slots, clearly distinguishing between optional type parameters (such as project, time period) from user input or default values ​​and generate type parameters (such as work order closure rate, project name) that need to be generated by querying the database; then, write parameterized sql_template, using {parameter name} as placeholders, to lay the foundation for dynamic query assembly; finally, design raw_response templates to format the query results into natural language responses.

[0107] In this embodiment, taking the data query scenario of "querying work order closure rate" as an example, the JSON structure of the corresponding backend data query class (backend_query) template is as follows:

[0108] json

[0109] {

[0110] "id":234,

[0111] "category":"backend_query",

[0112] "keywords":["work order closure rate","closure","work order","data"],

[0113] "synonyms":{

[0114] "Work Order Closure Rate": ["Work Order Completion Rate", "Closing Rate", "Closing Rate", "Work Order Closure Rate"]

[0115] },

[0116] "regex_patterns":["What is the work order closure rate?","View the work order closure rate status"],

[0117] "raw_question":"Please provide data on the project's work order closure rate",

[0118] "raw_response":"{Project Name}: Work order closure rate is {work order closure rate}%.",

[0119] "slots":[

[0120] {"slot_name":"project","slot_type":"optional","slot_value":"all"},

[0121] {"slot_name":"Time Period","slot_type":"optional","slot_value":"Recent Seven Days"},

[0122] {"slot_name":"Project Name","slot_type":"generate","slot_value":""},

[0123] {"slot_name":"Work Order Closure Rate","slot_type":"generate","slot_value":""}

[0124] ],

[0125] "sql_template":"select project as project_name, bihuan_rate as work order closure rate from ai_project_light_info_bytime where project in ({project}) and data_range_type='{time period}'"

[0126] }

[0127] When a user enters "Check the work order completion rate for Hefei and Nanjing last month", the data query template (backend_query) will be matched. The system determines the parameters {Project: "Hefei, Nanjing"} and {Time Period: "Last Month"} through slot extraction or default assignment. Then, these parameter values ​​are injected into the corresponding placeholders in the sql_template, generating an executable SQL statement and querying the database to obtain a structured result set [{"Project Name": "Hefei", "Work Order Closure Rate": "96.5"}, {"Project Name": "Nanjing", "Work Order Closure Rate": "94.1"}]. Finally, the system fills each row of data in the result set into the raw_response template, synthesizing the final response: "Hefei: Work order closure rate is 96.5%. Nanjing: Work order closure rate is 94.1%."

[0128] S13, construct a business knowledge Q&A template (business_qa).

[0129] The business knowledge Q&A template (business_qa) is used to respond to user queries about specific business knowledge. Its core design is to achieve accurate matching of questions and direct return of standard answers, ensuring the accuracy and consistency of knowledge transfer.

[0130] When building a business knowledge Q&A template (business_qa), technical personnel need to analyze specific business knowledge points, such as "users need to know the standard lamp models used in smart streetlights." The construction process follows this logic: First, determine the intent tag as business_qa; second, extract core keywords (such as ["streetlight model", "what model"]) and expand synonyms (such as mapping "streetlight model" to ["lamp pole model", "equipment model"]) to cover possible user questions; next, design regex_patterns to match common question formats; finally, write accurate and complete answer text directly in the raw_response. This type of template typically does not involve dynamic parameters, so the slots list is usually empty, reflecting its static "question and answer" characteristic.

[0131] In this embodiment, taking the knowledge query scenario of "inquiring about the model of a smart street light" as an example, the JSON structure of the corresponding business_qa class template is as follows:

[0132] json

[0133] {

[0134] "id":350,

[0135] "category":"business_qa",

[0136] "keywords":["streetlight model","light fixture model","what model"],

[0137] "synonyms":{

[0138] "Streetlight Model": ["Light Pole Model", "Equipment Model"]

[0139] },

[0140] "regex_patterns":[".*What is the model number of the street light?",".*Light fixture model number".*"],

[0141] "raw_question":"What model of light fixtures are used in the smart streetlights?"

[0142] "raw_response":"The standard configuration of the smart streetlights in this project is model LED-XZ200, which has intelligent dimming function."

[0143] "slots":[]

[0144] }

[0145] When a user enters "What model of equipment do you use for your streetlights?", the business knowledge Q&A template is successfully triggered through keyword and regular expression matching. The system, without needing complex parameter extraction or backend queries, directly returns a predefined raw response, generating the final reply: "The standard configuration of the smart streetlights in this project is the LED-XZ200, which has intelligent dimming functionality."

[0146] S2, Construct an AC automaton based on the question-and-answer template library.

[0147] The question-answering template library, containing massive amounts of structured knowledge, constructed in step S1, is transformed into a high-speed matching engine capable of scanning any user input in constant time. By weaving discrete keywords and synonyms into an efficient AC automaton, this automaton can instantly perceive any predefined business terms and expression variations contained in the user's question, providing millisecond-level initial screening capabilities for subsequent precise filtering. This is the core guarantee for achieving low-latency interaction in the system.

[0148] After loading the complete templates.json file, the program performs a depth-first traversal and compilation. Its core logic includes two key processing stages:

[0149] S21, based on the question-and-answer template library, use the words in the keyword set of each template as pattern strings.

[0150] The process involves full extraction of pattern strings, not only capturing the core words explicitly listed in the keywords array of each template, but also deeply analyzing its synonym mapping structure, treating all synonym entries as independent and equivalent pattern strings.

[0151] This step aims to build a complete set of expressions to ensure that any possible user statements (whether standard terminology or colloquial variations) can be initially perceived.

[0152] S22, Construct the AC automaton based on the pattern string.

[0153] The execution automaton is compiled and indexed. The Aho-Corasick algorithm is used to compile all the pattern strings extracted in the previous step into a state transition machine with a failure link mechanism, namely the AC automaton.

[0154] During compilation, an inverted index mapping table is simultaneously built, mapping each pattern string to its source template ID. This index table is the key bridge connecting initial perception and precise recall, enabling the system to immediately know which templates might be related when a word is hit.

[0155] In this embodiment, based on the templates.json file containing three types of templates constructed in step S1, the construction and operation process of the AC automaton is as follows:

[0156] Pattern string extraction and compilation: The program extracts the following representative pattern strings from three templates (the actual number is much larger):

[0157] Extract the following from the site operation instruction template: “Call”, “Dial”, “Contact”, “Summon”, “Find”, “Notify”, “Duty Officer”, “Duty Personnel”, “On-Duty Personnel”, “Responsible Person”, “Maintenance Personnel”, etc.

[0158] Extract the following from the backend data query template: "work order closure rate", "work order completion rate", "closure ratio", "work order closure rate", "closure", "case closure", "work order", and "data".

[0159] Extract the following from the business knowledge Q&A template: “streetlight model”, “lamp pole model”, “equipment model”, “what model”, etc.

[0160] All these words are compiled into a unified AC automaton memory structure at once.

[0161] When a user enters "Please contact the person in charge of the Hefei project and ask about the work order completion rate," the question is sent to the AC automaton for scanning. The automaton instantly matches multiple pattern strings in parallel: "contact" (mapped to template 1), "person in charge" (mapped to the site operation instruction template), "work order completion rate" (as a synonym for "work order closure rate," mapped to the backend data query template), and "data" (mapped to the backend data query template). By querying the inverted index, the system immediately obtains two candidate template sets: the site operation instruction template (site_action) pointed to by "contact" and "person in charge," and the backend data query template (backend_query) pointed to by "work order completion rate" and "data." This initial screening, completed in milliseconds, provides high-quality candidate input for the subsequent S4 steps of precise matching and intent disambiguation.

[0162] S3, generate training text based on the enhanced and expanded question-answer template library, and use the training text and its intent label to train an MLP classifier.

[0163] A lightweight yet semantically powerful neural network classifier is constructed as the second-level intelligent processing unit of the system. This MLP classifier can understand the deep semantics of user questions, perform intent recognition on diverse and colloquial expressions that the AC automaton failed to accurately match, and complement the AC automaton in both rule-based rapid matching and semantic intelligent understanding, together forming a reliable multi-level semantic recognition system. This includes:

[0164] S31: The question-answer template library is enhanced and expanded using a large language model, and training texts are generated based on the enhanced and expanded question-answer template library. All the training texts form a training text set.

[0165] Based on the question-answering template library, the semantic enhancement capabilities of the Large Language Model (LLM) are used to generate rich and diverse training corpora, which solves the problem that users have diverse expressions in real-world scenarios but the template library has limited examples, thereby improving the generalization ability of the MLP model.

[0166] Using the `raw_question` field of each template in the question-answering template library as a seed question, a large language model is used to generate multiple synonymous sentences with the same semantics but different expressions. Furthermore, based on the template's keywords and synonyms, question variants can be constructed. All generated sentences retain the same intent label (category) as the original template, thus constructing a large-scale, richly expressive training text set.

[0167] In this embodiment, based on the question-and-answer template library constructed in step S1, the data augmentation process is as follows:

[0168] The seed statement for the backend data query template (backend_query) is: "Please provide data on the project work order closure rate".

[0169] Examples of synonyms generated by LLM semantic enhancement: "Help me check the work order completion rate", "Summarize the closed-loop data for each project", "Do you have data on the work order closure rate?", "Check the closed-loop rate situation".

[0170] Example of a keyword-based variant: "What is the work order completion rate?" (using the synonym "work order completion rate")

[0171] The intent tag for all generated sentences is: backend_query.

[0172] Input the raw_question, keywords, synonyms fields and their corresponding categories (intent labels) of all templates in the templates.json library into the Large Language Model (LLM) to obtain a semantically enhanced and scaled training text set, where each sample contains a question text and a corresponding intent label.

[0173] S32, using a pre-trained language model to transform the training texts in the training text set into text semantic vectors, and all the text semantic vectors form a text semantic feature matrix.

[0174] The natural language text is transformed into numerical features that can be processed by machines, that is, the enhanced training text is transformed into high-dimensional text semantic vectors, which are used as input to the MLP model.

[0175] A pre-trained text embedding model (such as BERT, Sentence-BERT, or a domain-specific embedding model) is used. Each question in the training text set is input into the model to obtain its corresponding fixed-dimensional (e.g., 768-dimensional or 1024-dimensional) text semantic vector representation. To improve the stability and performance of subsequent training, these text semantic vectors are usually normalized (e.g., L2 normalization) and may be combined with other features (e.g., word frequency features) for feature engineering.

[0176] In this embodiment, vectorization processing begins with the training text set generated in S31. This training text set contains diverse questions such as "Help me check the work order completion rate" and "Statistically analyze the closed-loop data of each project," all with the corresponding intent tag "backend_query." The processing first involves embedding computation: each question text is independently input into the pre-trained BERT model. After forward propagation and feature extraction within the model, its corresponding 768-dimensional semantic vector (e.g., vectors V1 and V2) is obtained. Subsequently, V1, V2, and all other question vectors undergo L2 normalization, transforming each vector into a unit vector with a modulus of 1 to ensure all features are on a uniform mathematical scale. Simultaneously, the textual intent tags (e.g., "site_action," "backend_query," "business_qa") are mapped to integer indices (e.g., 0, 1, 2) through a tag encoder. Finally, the system outputs a structured result: all normalized semantic vectors are stacked row-wise to form a text semantic feature matrix X with dimensions [number of samples, 768]; all transformed integer tags constitute the corresponding tag vector y. The semantic feature matrix X and the label vector y of the corresponding text will be directly used as the input data for training the MLP classifier in the next sub-step.

[0177] S33. Based on the text semantic feature matrix, train a multilayer perceptron (MLP) model that can accurately predict the intent category according to the text semantic vector.

[0178] The system utilizes the text semantic feature matrix X and its corresponding intent label vector y output in step S32 to train a lightweight Multilayer Perceptron (MLP) classification model. This MLP model learns a complex nonlinear mapping from high-dimensional semantic vectors to discrete intent categories, thus enabling deep semantic intent discrimination of user queries. The trained MLP classifier serves as the core intelligent component of the system, handling user queries that the AC automaton fails to directly and precisely match, achieving second-level intent recognition based on semantic understanding.

[0179] This step follows the standard supervised learning process and consists of four stages: data partitioning, model building, training optimization, and evaluation and saving.

[0180] First, the dataset is divided.

[0181] The text semantic feature matrix X and label vector y are randomly divided into training and validation sets (typically in a ratio of 8:2) to ensure the objectivity of the evaluation of the multilayer perceptron (MLP) classification model.

[0182] Secondly, the multilayer perceptron (MLP) classification model is constructed.

[0183] Design a multilayer perceptron (MLP) classification model. The architecture of the MLP classification model includes: an input layer (the number of neurons equals the dimension of the text semantic vector, such as 768); followed by one or more hidden layers (e.g., the first hidden layer has 512 neurons, the second hidden layer has 256 neurons, both using the ReLU activation function to introduce non-linear decision-making ability); and finally, an output layer (the number of neurons equals the total number of intent categories, using the Softmax activation function to output the predicted probability of each category).

[0184] Next, training and optimization.

[0185] Using the training set data, the difference between the predicted probability distribution and the true label is measured by the cross-entropy loss function. The Adam optimizer is used with an initial learning rate, and all network weight parameters are iteratively updated through the backpropagation algorithm. During training, performance metrics such as accuracy and F1 score are continuously monitored on the validation set, and an early stopping strategy is adopted (training is stopped when the validation set loss no longer decreases over several consecutive training epochs) to prevent the model from overfitting the training data.

[0186] Finally, the model is saved.

[0187] Select the model weights and structure that perform best on the validation set and persist them.

[0188] In this embodiment, the specific training example of the MLP classifier for the three types of intents in the smart street light operation and maintenance scenario is as follows:

[0189] Input data: Text semantic feature matrix X (dimensionality assumed to be [1000, 768], representing 1000 augmented training samples) and label vector y (intent integer labels corresponding to 1000 samples: 0, 1, 2 represent site_action, backend_query, and business_qa, respectively).

[0190] Model construction example: Construct a three-layer MLP with the architecture Input(768)->Hidden1(512,ReLU)->Dropout(0.3)->Hidden2(256,ReLU)->Output(3,Softmax). The Dropout layer randomly discards neurons with a probability of 0.3 during training to enhance the model's generalization ability.

[0191] Training process example: Set the batch size to 32 and the maximum training period to 50. The Multilayer Perceptron (MLP) classification model learns during training that, for example, vectors semantically close to functions such as "find someone" or "open" should activate the site_action output node; vectors semantically close to "query", "statistics", or "data" should activate the backend_query output node.

[0192] Evaluation and Results: During training, the validation set accuracy stabilized above 95% in the later stages of training. The model successfully learned strong generalization ability. For example, for the question "Report the completion rate of each project's work order" which did not appear in the AC automaton keywords, although its keyword "work order completion rate" did not directly match the template library, its semantic vector, after forward computation by MLP, had an output probability of 0.92 in the backend_query category, thus being accurately classified.

[0193] Input: The text semantic feature matrix X from step S32 and the corresponding integer form intent label vector y.

[0194] Output: A trained MLP classifier model file (including model architecture definition and optimal weight parameters) that meets the preset performance threshold, along with a detailed training evaluation report. This model file will be loaded into the online system and used as the core decision unit for second-level matching in step S4.

[0195] S4, receive a natural language question input by the user, and process the natural language question by sequentially executing a multi-level matching strategy using the AC automaton and the MLP classifier to obtain a semantic recognition result. The semantic recognition result includes at least the identified intent and the extracted slot.

[0196] It integrates the AC automaton built in step S2 with the MLP classifier trained in step S3, performing a rigorous and orderly multi-level analysis process on user-input natural language questions: "fast rule matching → deep semantic understanding → rule-based fallback." This process aims to ensure high-accuracy intent understanding and parameter extraction for various expressions (whether standard terminology, colloquial variations, or vague descriptions) through a progressively deeper strategy, ultimately outputting semantic recognition results containing clear intent and structured slots, providing reliable input for the accurate execution and response in step S5. Figure 2 As shown, it includes:

[0197] S41 uses the AC automaton to perform the first-level matching based on the question-answer template library.

[0198] By leveraging the high-speed keyword matching capabilities of the AC automaton for millisecond-level initial screening, and then combining it with template-preset regular expressions for semantic fine screening, the aim is to efficiently and accurately handle highly deterministic queries that are well-expressed and can directly hit known patterns.

[0199] First, the user-input question undergoes basic preprocessing (such as removing irrelevant characters and standardizing symbol formatting) to obtain standard text. Then, this text is input into the AC automaton constructed in step S2 for scanning. The automaton outputs all matched keywords and, through a pre-defined inverted index mapping, recalls all associated candidate templates.

[0200] Next, for each candidate template, the system matches the regular expressions in its `regex_patterns` list against the user's question one by one. This fine-tuning process verifies whether the context and phrasing of the question strictly conform to the expectations of the template.

[0201] Finally, to calculate the overall confidence score of the templates that have passed the screening (e.g., combining keyword hit rate and template static weight), if the highest confidence score exceeds the preset first threshold (e.g., 0.85), the first-level match is determined to be successful, and the corresponding slot value is immediately extracted from the question according to the slots definition of the template.

[0202] S42: If the first-level matching fails, the second-level matching is performed using the MLP classifier.

[0203] When the first-level matching fails to produce high-confidence results, the MLP classifier is activated to analyze the deep semantics of the question. Through intent classification and semantic similarity calculation, the most suitable template is intelligently matched to deal with complex queries that are diverse in expression, colloquial, or do not directly hit the keywords.

[0204] First, the user's question is converted into a semantic text vector using the same pre-trained language model as in step S32. Then, the semantic text vector is input into the MLP classifier trained in step S3 to obtain its probability distribution across various intents (site_action, backend_query, business_qa). The intent with the highest probability is selected, and the cosine similarity between this question vector and all template example question vectors (raw_question) under this intent category is calculated. The combined intent probability and the maximum template similarity are used to calculate the overall confidence score for the second-level matching. If the overall confidence score exceeds a second preset threshold (e.g., 0.8), the template with the highest similarity is adopted as the matching result, and corresponding slot extraction is performed.

[0205] S43: If the second-level matching still fails to meet the preset reliability requirements, then the predefined slot rules will be used for fallback matching.

[0206] When both template-based matching strategies at the current level fail, an independent, lightweight fallback mechanism based on predefined rules is activated. This mechanism directly scans the question to extract key entities and infers intent based on entity combinations. This ensures that the system can still provide basic understanding and response when faced with unrecognizable new or ambiguous expressions, thus guaranteeing the system's robustness.

[0207] This is triggered when the overall confidence level of the second-level match also fails to meet the standard. The system bypasses the template library and directly calls a predefined slot extraction rule library. The slot extraction rule library contains a series of regular expression or dictionary matching rules for common entities such as "project name" and "time period". The system uses these rules to scan user queries and extract all recognizable entities. Subsequently, a set of simple heuristic rules is applied (e.g., if both "project" and "lighting rate" entities are extracted, it is inferred to be the backend_query intent) to generate a fallback semantic recognition result that does not depend on a specific template.

[0208] In this embodiment, based on the components constructed in the aforementioned steps, a complete multi-level matching process is illustrated as follows:

[0209] The user typed: "Could you please check the work order completion rate for the Hefei and Nanjing projects last month? Thank you."

[0210] First, step S41 is executed to perform the first level of matching: the AC automaton scans the preprocessed user question and hits the keywords "work order" and "completion rate"; among them, "completion rate" is identified as "closed loop rate" through the preset synonym mapping relationship in the template library, thus successfully associating and recalling the work order closed loop rate query template (backend_query) with the intent category of backend_query.

[0211] Fine-tuning was performed using the `regex_patterns` property of the backend data query class (`backend_query`). While the user query "work order processing completion rate" matched the core semantics, it failed to strictly match preset phrases such as "work order closure rate.* is what," resulting in a failed regular expression match and low confidence (e.g., 0.65 < threshold 0.85). The first-level match was unsuccessful.

[0212] Next, step S42 is performed for the second level of matching: the user's question is converted into a 768-dimensional text vector and input into the MLP classifier.

[0213] MLP output intent probabilities: backend_query: 0.92, site_action: 0.07, business_qa: 0.01.

[0214] The cosine similarity between the question vector and all template vectors under the backend_query intent is calculated. The highest similarity is found with the example question vector of the backend data query class (backend_query), which is 0.89.

[0215] The overall confidence level is 0.92 * 0.89 = 0.8188, which is higher than the second threshold of 0.8. The second-level match is successful.

[0216] The system adopts the backend data query class (backend_query) and extracts slots from the query based on its slots definition: {Project: "Hefei, Nanjing"}, {Time Period: "Last Month"}.

[0217] Since the second level has already succeeded in this example, step S43 is not triggered.

[0218] Final semantic recognition result: The system outputs the structured result: {Intent: "backend_query", Template id: 234, Slot: {Project: "Hefei, Nanjing", Time period: "Last month"}}.

[0219] After steps S41 to S43, the user-input natural language question text is processed. A structured semantic recognition result is obtained. This semantic recognition result can be an object or a list, explicitly containing the identified intent (category) and extracted slot key-value pairs (slots). If a specific template is matched, the template ID is also included. This result is the culmination of the entire semantic understanding process and will directly drive the decision-making and execution in step S5.

[0220] S5. Based on the intent and slot in the semantic recognition result, route to the corresponding processing logic, generate execution instructions or query data, and generate the final response based on the predefined response template or large language model.

[0221] The structured semantic recognition results output in step S4 are transformed into specific, executable backend business operations or data queries. The operation execution results or query data are then used to generate the final natural language response by filling in a predefined response template or calling a large language model, thus completing the entire closed loop from user natural language input to intelligent system response and execution.

[0222] Based on the intent category and template ID (if present) in the semantic recognition result output in step S4, the system routes the request to one of three mutually exclusive core processing paths. Each path follows a standardized "execution-generation" logic. The core routing rules and processing logic are as follows:

[0223] S51, Execution and response generation of on-site operation instructions.

[0224] Used to process site-action intents, its function is to transform user operation instructions into deterministic calls to backend business systems or frontend interfaces, and generate explicit action confirmation responses after execution.

[0225] Based on the template ID in the semantic recognition result, the system queries the pre-defined instruction mapping configuration to determine the corresponding backend API interface address or frontend routing instruction. Then, the slot values ​​extracted from the semantic recognition result are assembled according to the parameter specifications of the interface. Before initiating the actual call, the system calls the permission verification module to verify whether the current user has the right to perform this operation. After successful verification, the system calls the target API or triggers the frontend routing and waits for the execution result. Finally, based on the execution result (success / failure and additional information) and the matching template's raw_response, a final response is dynamically generated.

[0226] S52, Structured Data Query and Response Synthesis.

[0227] Used to process backend query intents, its function is to transform the user's natural language data query into an accurate query for the database, and to format the query results into a user-readable natural language report.

[0228] Based on the template ID in the semantic recognition result, the corresponding sql_template (parameterized SQL query template) is located. The slot values ​​from the semantic recognition result are used to replace the corresponding placeholders (e.g., {item}) in sql_template, generating an executable SQL statement. The system executes this SQL query and retrieves a structured result set from the database. Subsequently, each row of data in the result set is populated into the corresponding placeholder in the raw_response response template according to the mapping relationship of the generate type parameter in the slots template. If the query returns multiple rows of data, multiple responses are generated, and a lightweight large language model can be selectively used for summarization and polishing, ultimately synthesizing a coherent response text.

[0229] S53, Knowledge Question and Answer Generation.

[0230] This is used to handle business knowledge Q&A (business_qa) intents, responding to users' business knowledge inquiries. Depending on whether a predefined template is matched, two strategies are employed: direct answer or intelligent generation. Specifically, there are two scenarios:

[0231] Template matched: When the semantic recognition result contains a valid template ID, the system directly returns the predefined raw_response content of that template as the final response.

[0232] Template not matched: When the template ID is empty in the semantic recognition result, it indicates that the user's question exceeds the scope of the preset knowledge base. The system submits the original user question, along with preset system roles, security rules, and style constraint prompts, to the Large Language Model (LLM). The LLM generates a response under strict prompt constraints, and the system uses this response as the final reply.

[0233] In this embodiment, continuing the example of step S4 (the user queries "Please check the completion rate of work orders for the Hefei and Nanjing projects last month"), the execution process of step S5 is as follows:

[0234] Route determination: The semantic recognition result output in step S4 is {intent: "backend_query", template id: 234, slot: {project: "Hefei, Nanjing", time period: "last month"}}. Therefore, the system enters path S52.

[0235] S52 (Data Query and Response Synthesis):

[0236] Query Assembly: The system retrieves the SQL template for the backend data query class (backend_query) using the template ID: 234: "select project as project name, bihuan_rate as work order closure rate...where project in ({project}) and data_range_type='{time period}'". The slot values ​​{project: "Hefei, Nanjing"} and {time period: "last month"} are injected to generate executable SQL.

[0237] Query execution: Execute SQL, assuming the query result set is: [{"Project Name":"Hefei Project", "Work Order Closure Rate":"96.5", "Work Order Closure Growth Rate":"1.2"},{"Project Name":"Nanjing Project", "Work Order Closure Rate":"94.1", "Work Order Closure Growth Rate":"0.5"}].

[0238] Response synthesis: Fill each line of result into the raw_response "{Project Name}: Work order closure rate is {work order closure rate}%, month-on-month growth is {work order closure rate}%." in template 234, resulting in two text segments: "Hefei Project: Work order closure rate is 96.5%, month-on-month growth is 1.2%." and "Nanjing Project: Work order closure rate is 94.1%, month-on-month growth is 0.5%."

[0239] The entire process uses the semantic recognition result object (containing intent, template ID, and slot) output in step S4 to obtain the final natural language text response to the user.

[0240] In one alternative implementation, after step S5, the method further includes step S6, which involves end-to-end auditing and authorization verification.

[0241] Before or after generating the final response and executing the corresponding operation in step S5, a security check and operation traceability are performed on the entire interaction process. This includes two core functions: first, ensuring the legality of operations and the security of data through permission verification; and second, achieving full transparency and traceability through log auditing to meet the stringent security and compliance requirements of industrial operations and maintenance scenarios.

[0242] This step includes two key parallel actions: permission verification and log auditing. Their logic is integrated throughout or immediately following the execution of S5.

[0243] S61, Operation and data permission verification.

[0244] Verifying whether the current user has the right to execute the operation planned in step S5 or access the data to be queried, based on predefined permission rules, is the core mechanism for ensuring system security and controllability.

[0245] Before executing specific business logic (such as calling an API or querying a database) in step S5, a double verification is performed by querying the permission configuration library based on the user's identity and the semantic recognition results output in step S4 (especially the "intent", "template ID", and "slot" values).

[0246] 1. Command operation permission verification: For the intent of the site operation command class (site_action), query the "command-user" authorization mapping table to check whether the current user is authorized to execute the specific operation command corresponding to the "template id" of the site operation command class (site_action).

[0247] 2. Data Query Permission Verification: For backend data query template intents (backend_query), the system queries the "Data-User" authorization mapping table. This authorization mapping table uses the format "<user, slot name, list of authorized values>" (e.g., user "user01" has query permissions for "Hefei Project; Ma'anshan Project" under the "slot" project name). When the S5 plan executes the query, the system compares the values ​​of the corresponding fields in the query result set row by row to see if they are within the user's authorized value list. If any data row exceeds the authorized range, the verification fails.

[0248] If the permission verification fails, the system will suspend subsequent execution and generate a clear permission prompt as the final response to the user; if the verification passes, the S5 step will be allowed to continue.

[0249] S62, end-to-end logging.

[0250] Record the complete context of every human-computer interaction to form an unalterable audit trail, which can be used for problem backtracking, performance analysis, system optimization, and compliance auditing.

[0251] After completing permission verification and executing and generating the response in step S5, key information for this session is asynchronously written to the audit log database. The recorded fields include at least: timestamp, session ID, user identifier, original natural language question, semantic recognition results from step S4 (intent, template ID, slot), permission verification conclusion, specific actions performed in step S5 (such as API calls and parameters, executed SQL), execution result status, generated final response content, and time consumed at each stage. These structured logs provide a data foundation for operational analysis and ensure the traceability of all operations.

[0252] In this embodiment, continuing the examples of steps S4 and S5, and assuming the executing user is "user01", the permission verification and auditing process in step S6 is as follows:

[0253] Step S61 performs permission verification: The system identifies the intent as a backend data query (backend_query) and requires data query permission verification.

[0254] Querying the permission configuration of "user01" reveals that its authorized value for the slot "Project Name" is "Hefei Project; Hangzhou Project".

[0255] Compare the result set obtained in step S5, "[{"Project Name":"Hefei Project"...},{"Project Name":"Nanjing Project"...}]", with the authorization list.

[0256] The following results were returned: "Hefei Project" is in the authorized list, and the permission verification passed; "Nanjing Project" is not in the authorized list, and the permission verification failed. This means that user "user01" does not have permission to access the data in the "Nanjing Project".

[0257] Based on the returned results: the system does not perform response synthesis for the "Nanjing Project" data and generates the final response: "You do not have permission to view the relevant data for the Nanjing Project. Hefei Project: The work order closure rate is 96.5%, with a month-on-month increase of 1.2%."

[0258] Step S62 is executed to record log entries:

[0259] Regardless of whether the permission verification passes or fails, the system will record the entire interaction. An example of a log entry is shown below:

[0260] {"timestamp":"2023-10-27 14:30:00","user":"user01","raw_question":"Please check the completion rate of work orders for the Hefei and Nanjing projects last month","intent":"backend_query","template_id":234","slots":{"project":"Hefei, Nanjing","time period":"last month"}","auth_check":{"result":"partial_deny","denied_item":"Nanjing project"}","action":"executedSQL:select...whereprojectin('Hefei','Nanjing')","final_reply":"You do not have permission to view the Nanjing project...Hefei project...96.5%..."}.

[0261] Example 2

[0262] This embodiment provides a lighting operation and maintenance question-and-answer system based on intelligent agents, including:

[0263] 1. A question-and-answer template library management module, used to store, manage, and provide an access interface to a structured question-and-answer template library, wherein the templates in the question-and-answer template library include at least intent tags, keyword sets, regular expression patterns, and response templates.

[0264] When the system starts, the question-and-answer template library management module loads all templates into memory and provides real-time query services for the semantic recognition module. When business expands, operations and maintenance personnel can seamlessly upgrade system capabilities by adding or modifying templates through the module's configuration interface.

[0265] 2. A semantic recognition module, connected to the question-and-answer template library management module, is used to receive natural language questions input by users and output semantic recognition results containing the identified intent and extracted slots.

[0266] The semantic recognition module is the core of the system's intelligent understanding. It receives natural language questions input by the user and outputs structured semantic recognition results. It innovatively employs a multi-level progressive matching strategy, specifically comprising three sub-modules:

[0267] 1) The AC automaton matching submodule is used to load the question-and-answer template library and build the AC automaton. Based on the AC automaton, it performs fast keyword matching and combines the regular expression pattern of the template for semantic fine screening.

[0268] During system initialization, the AC automaton matching submodule retrieves all template data from the question-and-answer template library management module. Following the method described in step S2 of Example 1, this submodule extracts the keyword set and synonyms of all templates as pattern strings, constructing an AC automaton and the corresponding inverted index. When a user inputs a question, this submodule first performs a millisecond-level keyword scan to recall all relevant candidate templates. Subsequently, it uses a preset regular expression for each candidate template to fine-tune the user question. If the fine-tuning matching confidence of a template exceeds a preset threshold, it is determined to be a successful first-level match, and parameter extraction is immediately performed according to the slot definition of that template.

[0269] 2) MLP Intent Matching Submodule, which includes a text embedding model and an MLP classifier, is used to perform intent classification and semantic template matching for questions that the AC automaton matching submodule failed to process.

[0270] The MLP intent matching submodule, as the second-level matching unit, consists of a pre-trained MLP classifier and a pre-trained text embedding model (such as Sentence-BERT). The MLP classifier is trained using the method described in step S3 of Example 1: First, based on a question-answering template library, semantic enhancement is performed using a large language model to generate a diverse set of training texts; second, the text embedding model is used to transform this set of training texts into a text semantic feature matrix; finally, the MLP classifier is trained using the text semantic feature matrix and its corresponding intent labels.

[0271] During runtime, this submodule is activated when the AC automaton matching submodule fails to produce a high-confidence match result. It first uses a text embedding model to convert the user's question into a semantic vector, then inputs this vector into a pre-trained MLP classifier to obtain the intent probability distribution. Simultaneously, it calculates the semantic similarity between this question vector and the semantic similarity between this vector and the template example question vectors of all templates within the target intent category. If the combined confidence score exceeds a second threshold, the template with the highest similarity is adopted as the matching result, and slot extraction is performed.

[0272] 3) Independent slot matching submodule, used to extract entities and infer intents directly based on predefined slot configuration rules when neither the AC automaton matching submodule nor the MLP intent matching submodule has successfully matched.

[0273] The independent slot matching submodule serves as a fallback matching mechanism, operating independently of the question-answering template library. It is triggered when both the first two levels of matching fail. It directly calls predefined general entity extraction rules to scan user questions, extracting all identifiable entities (such as device number, time period, etc.), and then applies a set of concise heuristic rules to infer user intent, generating a basic semantic recognition result. This ensures the system's basic understanding and robustness when dealing with unknown or highly ambiguous expressions.

[0274] 3. An intent execution and response generation module, connected to the semantic recognition module, is used to route to the corresponding processing logic based on the semantic recognition result, generate execution instructions or query data, and generate a final response based on a response template or a large language model.

[0275] The intent execution and response generation module routes the structured results output by the semantic recognition module to the corresponding business logic execution unit and generates the final natural language response. It mainly comprises three executors: an instruction executor for handling on-site operational commands, a data query and synthesizer for handling backend data queries, and a knowledge question answering and generator for handling business knowledge questions. Each executor, based on the matched template and extracted slot parameters, calls the corresponding backend interface, performs a database query, or organizes the response content.

[0276] In one alternative implementation, a lighting operation and maintenance question-and-answer system based on intelligent agents further includes:

[0277] 4. Audit and Access Control Module.

[0278] The auditing and access control module is embedded in the business process to ensure the security and traceability of all operations. It includes an access verification unit and a full-link auditing unit. The access verification unit performs real-time access verification based on user identity and semantic recognition results before the intent is executed. The full-link auditing unit records the complete context information of each interaction throughout the process, forming an immutable audit log.

[0279] The system described in this embodiment, through its modular design and rigorous multi-level processing flow, achieves accurate understanding, secure execution, and reliable auditing of mixed, conversational natural language commands in the complex scenario of data center operation and maintenance, fully verifying the practicality, security, and scalability of the system of this invention.

[0280] Example 3

[0281] This embodiment proposes an electronic device, including:

[0282] Memory, used to store computer programs;

[0283] The processor is used to execute the program stored in the memory to implement the steps of the above embodiment of the intelligent agent-based lighting operation and maintenance question-and-answer method.

[0284] For details on the specific implementation of each step and related explanations, please refer to the aforementioned embodiment of a lighting operation and maintenance question-and-answer method based on intelligent agents, which will not be repeated here.

[0285] The memory of the electronic device mentioned in this embodiment may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device.

[0286] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0287] Example 4

[0288] This invention also proposes a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the steps of the above-described embodiment of an agent-based lighting operation and maintenance question-and-answer method. For details on the specific implementation and explanation of each step of this method, please refer to the aforementioned embodiment of an agent-based lighting operation and maintenance question-and-answer method, which will not be repeated here.

[0289] The above description is merely an embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of the claims of the present invention.

Claims

1. A lighting operation and maintenance question-and-answer method based on intelligent agents, characterized in that, include: A question-and-answer template library is constructed based on preset questions and corresponding answers for the target business. The templates in the question-and-answer template library include at least intent tags, keyword sets, regular expression patterns, and response templates. The question-and-answer template library includes at least three categories of instructions: on-site operation instructions, backend data query instructions, and business knowledge question-and-answer instructions. Construct an AC automaton based on the aforementioned question-and-answer template library; Training text is generated based on the enhanced and expanded question-answering template library, and an MLP classifier is trained using the training text and its intent label. The system receives a natural language question input by a user, processes it using the AC automaton and the MLP classifier through a sequential execution of a multi-level matching strategy, and obtains a semantic recognition result. This semantic recognition result includes at least the identified intent and extracted slots. Based on the intent and slots in the semantic recognition result, the system routes the data to the corresponding processing logic, generates execution instructions or query data, and generates a final response based on a predefined response template or a large language model. This includes: If the intent in the semantic recognition result is a field operation instruction, its function is to transform the user's operation instruction into a deterministic call to the backend business system or the frontend interface, and generate a clear action confirmation response after execution; If the intent in the semantic recognition result is a backend data query, its function is to transform the user's natural language data query into a precise query for the database, and format the query result into a user-readable natural language report. If the intent in the semantic recognition result is a business knowledge question-and-answer type, its function is to respond to the user's business knowledge inquiry; The sequential execution of the multi-level matching strategy includes: The AC automaton is used to scan the natural language question, match the keywords in the question-answer template library, and perform semantic filtering through regular expressions associated with the template to obtain the first candidate result; If the first candidate result is empty or the confidence level is lower than the first threshold, the natural language question is converted into a text vector, input into the MLP classifier to obtain the intent probability distribution, and the semantic similarity between the text vector and the template under the corresponding intent in the question-answering template library is calculated to obtain the second candidate result. If the second candidate result is empty or the confidence level is lower than the second threshold, the natural language question is directly scanned using predefined slot rules to extract key entity slots, and the intent is inferred based on the extracted slot combinations.

2. The method according to claim 1, characterized in that, The construction of the AC automaton based on the question-answering template library includes: Based on the question-and-answer template library, the words in the keyword set of each template are used as pattern strings; Based on the pattern string, construct the AC automaton.

3. The method according to claim 1, characterized in that, The step of generating training text based on the enhanced and expanded question-answer template library, and using the training text and its intent label to train the MLP classifier includes: The question-and-answer template library is enhanced and expanded using a large language model, and training text is generated based on the enhanced and expanded question-and-answer template library. The training text is converted into text vectors using a pre-trained language model; The MLP classifier is trained using the text vector as input features and the corresponding intent label as supervision signal.

4. The method according to claim 1, characterized in that, The step of routing to the corresponding processing logic based on the intent and slot in the semantic recognition result, generating execution instructions or query data, and generating a final response based on a predefined response template or large language model includes: When the intent in the semantic recognition result is an operation instruction, it is mapped to the backend API according to the matched question and answer template identifier, the extracted slot value is assembled into API parameters, and the API is called after the execution permission verification, and a response is generated based on the API execution result. When the intent in the semantic recognition result is a data query type, the extracted slot value is injected into the structured query statement corresponding to the matched question and answer template, the query is executed, and the result data is filled into the response placeholder of the template to generate a reply. When the intent in the semantic recognition result is a knowledge question-and-answer type and no question-and-answer template is matched, the natural language question is submitted to the large language model, and a response is generated under the constraints of preset prompt words.

5. A lighting operation and maintenance question-and-answer system based on intelligent agents, used to implement the method as described in any one of claims 1-4, characterized in that, include: The question-and-answer template library management module is used to store, manage, and provide an access interface to the structured question-and-answer template library. The templates in the question-and-answer template library include at least intent tags, keyword sets, regular expression patterns, and response templates. The semantic recognition module, connected to the question-and-answer template library management module, is used to receive natural language questions input by users and output semantic recognition results containing the identified intent and extracted slots. The intent execution and response generation module is connected to the semantic recognition module. It is used to route to the corresponding processing logic according to the semantic recognition result, generate execution instructions or query data, and generate the final response based on the response template or large language model.

6. The system according to claim 5, characterized in that, The semantic recognition module includes: The AC automaton matching submodule is used to load the question-and-answer template library and build the AC automaton, perform fast keyword matching based on the AC automaton, and perform semantic fine screening by combining the regular expression pattern of the template. The MLP intent matching submodule includes a text embedding model and an MLP classifier, which are used to perform intent classification and semantic template matching on questions that the AC automaton matching submodule failed to process. An independent slot matching submodule is used to extract entities and infer intents directly based on predefined slot configuration rules when neither the AC automaton matching submodule nor the MLP intent matching submodule has successfully matched.

7. The system according to claim 5, characterized in that, Also includes: The audit and access control module is embedded in the business process. It is used to perform permission verification before the intent execution and response generation module performs its operations, and to record interaction logs throughout the process to achieve end-to-end auditing.

8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing a computer program stored in the memory to implement the method as described in any one of claims 1 to 4.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Large model question and answer method and device based on domain knowledge

    CN117609477A

  • Dynamic adaptation question answering system and method based on hierarchical structure and retrieval enhancement

    CN118193714A

  • Systems and methods for retrieval based question answering using neura network models

    US20240428044A1

  • Systems and methods for question answering with diverse knowledge sources

    US20250103592A1

  • Statement question and answer method and device, equipment, storage medium and computer program product

    CN114297351A