Building operation and maintenance information query method and device based on knowledge enhanced large language model

CN122964249APending Publication Date: 2026-10-23SHANGHAI SHIDONGKOU NO 2 POWER PLANT HUANENG INTERNATIONAL POWER CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610910659.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-23
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

[0004]本申请提供一种基于知识增强大语言模型的建筑运维信息查询方法及装置,以解决相关技术难以理解运维人员的自然语言,依赖少数掌握数据库结构的技术人员,导致查询门槛高等问题

Benefits of technology

[0013]可选地,在本申请的一个实施例中,所述对所述候选结构化查询语句进行规则校验,以得到校验通过的结构化查询语句,包括:检查所述候选结构化查询语句是否符合预设语法规则;检查所述候选结构化查询语句是否包含预设建筑运维数据库中不存在的表名与字段名;检查所述候选结构化查询语句是否包含非查询操作;在所述候选结构化查询语句符合预设语法规则,且所述候选结构化查询语句不包含所述预设建筑运维数据库中不存在的所述表名与所述字段名,且所述候选结构化查询语句不包含所述非查询操作的情况下,将所述候选结构化查询语句确定为所述校验通过的结构化查询语句。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122964249A_ABST
    Figure CN122964249A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of operation and maintenance, in particular to a building operation and maintenance information query method and device based on a knowledge-enhanced large language model, wherein the method comprises the following steps: in response to a natural language query of a user, performing semantic analysis processing on input text to obtain a structured query intention, then searching for related entities and relations in a preset building operation and maintenance knowledge graph database to form a target knowledge subgraph, combining the structured query intention and database table structure information to construct a model input prompt, then calling a large language model to generate a corresponding candidate structured query sentence under the model input prompt, obtaining a structured query sentence that passes the verification, generating an original query result, performing statistics and judgment on the original query result to obtain a judgment result, and generating a natural language explanation. Therefore, the problems that related technologies cannot understand the natural language of operation and maintenance personnel, rely on a few technical personnel who master the database structure, and result in high query threshold are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of operation and maintenance technology, and in particular to a method and device for querying building operation and maintenance information based on a knowledge-enhanced large language model. Background Technology

[0002] The relevant technologies first clean the environmental and energy consumption data of multiple buildings in a unified manner, and use anomaly detection methods to obtain a relatively reliable time series. Then, the operation and maintenance data and spatial attributes are organized into structured tables to build a building operation and maintenance knowledge graph covering floor structure, spatial function and environmental standards. On this basis, a large language model is used to convert operation and maintenance questions into SQL queries. When necessary, knowledge retrieval is used to provide the model with building structure and rule information related to the current query to improve the accuracy and interpretability of the query results.

[0003] However, in related technologies, SQL queries are essentially a wrapper around structured query statements and cannot truly understand the natural language intent of operations and maintenance personnel. For complex issues that span multiple buildings, floors, and equipment types, multiple rounds of communication and repeated modifications to query statements are often required. This is not only inefficient but also highly dependent on a small number of technical personnel who have mastered database structures. Operations and maintenance knowledge is difficult to transfer smoothly within the team, which is particularly prominent in multi-building and multi-project operations and maintenance scenarios and urgently needs to be addressed. Summary of the Invention

[0004] This application provides a method and apparatus for querying building operation and maintenance information based on a knowledge-enhanced large language model, in order to solve the problems that related technologies have difficulty understanding the natural language of operation and maintenance personnel, rely on a small number of technical personnel who have mastered the database structure, and thus have a high query threshold.

[0005] The first aspect of this application provides a method for querying building operation and maintenance information based on a knowledge-enhanced large language model, comprising the following steps: responding to a user's natural language query, performing semantic parsing on the input text of the natural language query to obtain a structured query intent; based on the structured query intent, retrieving relevant entities and relationships in a preset building operation and maintenance knowledge graph to form a target knowledge subgraph, and constructing a model input prompt based on the target knowledge subgraph, combined with the structured query intent and database table structure information; calling a pre-tuned large language model to generate corresponding candidate structured query statements under the model input prompt, and performing rule verification on the candidate structured query statements to obtain a verified structured query statement, and obtaining an original query result based on the structured query statement, and performing statistics and judgment on the original query result to obtain a judgment result, and generating a natural language explanation based on the original query result and the judgment result.

[0006] Based on the above technical means, this application embodiment obtains structured query intent by semantically parsing the input text, which can accurately identify users' operation and maintenance query needs and avoid semantic understanding bias. Then, by forming a target knowledge subgraph based on the structured query intent and constructing model input prompts, it realizes knowledge enhancement and empowers reasoning with operation and maintenance professional knowledge, effectively adapting to various complex building operation and maintenance query scenarios. Then, by calling a pre-fine-tuned large language model to generate candidate structured query statements and performing rule verification, it ensures that the query statements are legal, compliant, and stable to execute, greatly improving the accuracy and robustness of the results in complex operation and maintenance query scenarios. Furthermore, by statistically judging the original query results to generate natural language interpretation, it realizes automatic interpretation and output of query results, greatly reducing the operation and usage threshold for operation and maintenance personnel. Thus, by constructing an end-to-end integrated query process, it connects the entire chain of data, knowledge, model, query, and interpretation, and can be adapted to different building projects for rapid migration and reuse.

[0007] Optionally, in one embodiment of this application, before responding to the user's natural language query, the method further includes: collecting building operation and maintenance data from a preset building operation and maintenance database; performing anomaly detection and data cleaning on the building operation and maintenance data to obtain cleaned time-series data; modeling building spatial hierarchy, equipment relationships, and operation and maintenance rules based on the time-series data to construct a building operation and maintenance knowledge graph; constructing paired samples of written natural language query examples and structured query statements; and using the paired samples to perform supervised fine-tuning of a preset large language model based on the building operation and maintenance knowledge graph to obtain a fine-tuned large language model.

[0008] Based on the above technical means, this application embodiment first collects building operation and maintenance data, obtains cleaned time series data through anomaly detection and data cleaning, completes modeling and constructs a building operation and maintenance knowledge graph based on the time series data, and then builds matching samples of natural language query examples and structured query statements. Combined with the building operation and maintenance knowledge graph, supervised fine-tuning of the preset large language model is carried out to obtain a fine-tuned large language model. Relying on clean and well-organized time series data to ensure the authenticity and accuracy of the building operation and maintenance knowledge graph content, and using dedicated matching samples to complete model fine-tuning, the fine-tuned large language model is adapted to building operation and maintenance business scenarios, can accurately understand operation and maintenance-related natural language queries and output structured query statements that match business needs, and improve the accuracy and adaptability of subsequent online query parsing and statement generation.

[0009] Optionally, in one embodiment of this application, the step of performing anomaly detection and data cleaning on the building operation and maintenance data to obtain cleaned time series data includes: calculating anomaly scores on the building operation and maintenance data; determining whether the anomaly scores meet preset anomaly conditions; if the anomaly scores meet the preset anomaly conditions, determining that the building operation and maintenance data is an anomaly, and performing data cleaning on the building operation and maintenance data to obtain the time series data.

[0010] Based on the above technical means, the embodiments of this application calculate the abnormal score of building operation and maintenance data, identify abnormal values ​​according to preset abnormal conditions and complete data cleaning to obtain cleaned time series data. It can automatically identify, remove or repair abnormal operation and maintenance data generated during collection, avoid the interference of abnormal data on subsequent building operation and maintenance knowledge graph construction and large language model training, and ensure that the time series data is true, regular and effective.

[0011] Optionally, in one embodiment of this application, the expression of the building operation and maintenance knowledge graph is: , in, This is the building operation and maintenance knowledge graph. For a collection of entities, For a set of relation types, For a set of specific relational triples.

[0012] Based on the above technical means, the embodiments of this application use a triple set to represent the building operation and maintenance knowledge graph, which can standardize and unify the representation of entities, relationship types and triples, clearly solidify the association logic of building space hierarchy, equipment relationship and operation and maintenance rules, facilitate the subsequent retrieval and extraction of target knowledge subgraphs based on the structured building operation and maintenance knowledge graph, provide standardized and complete professional knowledge support for building operation and maintenance for large language models, and improve the accuracy of matching query requirements in the knowledge enhancement process.

[0013] Optionally, in one embodiment of this application, the step of performing rule validation on the candidate structured query statement to obtain a validated structured query statement includes: checking whether the candidate structured query statement conforms to preset syntax rules; checking whether the candidate structured query statement contains table names and field names that do not exist in the preset building operation and maintenance database; checking whether the candidate structured query statement contains non-query operations; and determining the candidate structured query statement as the validated structured query statement when the candidate structured query statement conforms to the preset syntax rules, does not contain the table names and field names that do not exist in the preset building operation and maintenance database, and does not contain the non-query operations.

[0014] Based on the above technical means, this application embodiment checks whether candidate structured query statements conform to preset syntax rules, whether they contain table names and field names that do not exist in the preset building operation and maintenance database, and whether they contain non-query operations. Only statements that simultaneously meet the three check requirements are determined as structured query statements that pass the verification. This can intercept candidate statements with syntax errors, references to invalid library objects, or high-risk operations in advance, avoid execution abnormalities or database data security risks, and ensure that the structured query statements used for querying are legal, compliant, and can be executed normally.

[0015] A second aspect of this application provides a building operation and maintenance information query device based on a knowledge-enhanced large language model, comprising: a parsing module, used to respond to a user's natural language query by performing semantic parsing on the input text of the natural language query to obtain a structured query intent; an enhancement module, used to retrieve relevant entities and relationships in a preset building operation and maintenance knowledge graph database based on the structured query intent to form a target knowledge subgraph, and construct a model input prompt based on the target knowledge subgraph, combined with the structured query intent and database table structure information; and a query module, used to call a pre-tuned large language model, generate corresponding candidate structured query statements under the model input prompt, perform rule verification on the candidate structured query statements to obtain a verified structured query statement, obtain an original query result based on the structured query statement, and perform statistical analysis and judgment on the original query result to obtain a judgment result, and generate a natural language explanation based on the original query result and the judgment result.

[0016] Based on the above technical means, this application embodiment obtains structured query intent by semantically parsing the input text, which can accurately identify users' operation and maintenance query needs and avoid semantic understanding bias. Then, by forming a target knowledge subgraph based on the structured query intent and constructing model input prompts, it realizes knowledge enhancement and empowers reasoning with operation and maintenance professional knowledge, effectively adapting to various complex building operation and maintenance query scenarios. Then, by calling a pre-fine-tuned large language model to generate candidate structured query statements and performing rule verification, it ensures that the query statements are legal, compliant, and stable to execute, greatly improving the accuracy and robustness of the results in complex operation and maintenance query scenarios. Furthermore, by statistically judging the original query results to generate natural language interpretation, it realizes automatic interpretation and output of query results, greatly reducing the operation and usage threshold for operation and maintenance personnel. Thus, by constructing an end-to-end integrated query process, it connects the entire chain of data, knowledge, model, query, and interpretation, and can be adapted to different building projects for rapid migration and reuse.

[0017] Optionally, in one embodiment of this application, it further includes: a collection module for collecting building operation and maintenance data from a preset building operation and maintenance database; a cleaning module for performing anomaly detection and data cleaning on the building operation and maintenance data to obtain cleaned time series data; a first construction module for modeling building spatial hierarchy, equipment relationships, and operation and maintenance rules based on the time series data to construct a building operation and maintenance knowledge graph; a second construction module for constructing paired samples of written natural language query examples and structured query statements; and a training module for supervised fine-tuning of a preset large language model based on the building operation and maintenance knowledge graph and using the paired samples to obtain a fine-tuned large language model.

[0018] Based on the above technical means, this application embodiment first collects building operation and maintenance data, obtains cleaned time series data through anomaly detection and data cleaning, completes modeling and constructs a building operation and maintenance knowledge graph based on the time series data, and then builds matching samples of natural language query examples and structured query statements. Combined with the building operation and maintenance knowledge graph, supervised fine-tuning of the preset large language model is carried out to obtain a fine-tuned large language model. Relying on clean and well-organized time series data to ensure the authenticity and accuracy of the building operation and maintenance knowledge graph content, and using dedicated matching samples to complete model fine-tuning, the fine-tuned large language model is adapted to building operation and maintenance business scenarios, can accurately understand operation and maintenance-related natural language queries and output structured query statements that match business needs, and improve the accuracy and adaptability of subsequent online query parsing and statement generation.

[0019] A third aspect of this application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor executes the program to implement the building operation and maintenance information query method based on a knowledge-enhanced large language model as described in the above embodiments.

[0020] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for querying building operation and maintenance information based on a knowledge-enhanced large language model.

[0021] The fifth aspect of this application provides a computer program product, including a computer program that, when executed, implements the above-described method for querying building operation and maintenance information based on a knowledge-enhanced large language model.

[0022] This application's embodiments obtain structured query intent through semantic parsing of input text, accurately identifying user operation and maintenance query needs and avoiding semantic comprehension biases. Then, by forming a target knowledge subgraph based on the structured query intent and constructing model input prompts, it achieves knowledge enhancement and reasoning empowered by operation and maintenance expertise, effectively adapting to various complex building operation and maintenance query scenarios. Next, by calling a pre-tuned large language model to generate candidate structured query statements and performing rule validation, it ensures the legality, compliance, and stable execution of query statements, significantly improving the accuracy and robustness of results in complex operation and maintenance query scenarios. Finally, by statistically judging the original query results to generate natural language interpretations, it achieves automatic interpretation and output of query results, significantly reducing the operational threshold for operation and maintenance personnel. Thus, by constructing an end-to-end integrated query process, it connects the entire chain of data, knowledge, models, queries, and interpretations, enabling rapid migration and reuse across different building projects. This solves the problems of related technologies struggling to understand the natural language of operation and maintenance personnel and relying on a small number of technical personnel with database structure expertise, leading to high query thresholds.

[0023] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0024] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 This is a schematic diagram of the overall structure of a building operation and maintenance information query system based on a knowledge-enhanced large language model according to an embodiment of this application; Figure 2 This is a flowchart illustrating a method for querying building operation and maintenance information based on a knowledge-enhanced large language model, according to an embodiment of this application. Figure 3 This is a flowchart of a building operation and maintenance information query method based on a knowledge-enhanced large language model according to an embodiment of this application; Figure 4 This is a block diagram of a building operation and maintenance information query device based on a knowledge-enhanced large language model provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of an electronic device provided according to an embodiment of this application.

[0025] Figure label: 40 - Building operation and maintenance information query device based on knowledge-enhanced large language model; 100 - Parsing module, 200 - Enhancement module, 300 - Query module; 501 - Memory, 502 - Processor, 503 - Communication interface. Detailed Implementation

[0026] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0027] With the advancement of urbanization and smart city construction, a large number of office buildings, commercial complexes, and industrial parks have been constructed and put into operation. These buildings typically integrate multiple systems such as HVAC, lighting, elevators, water supply and drainage, and security access control. They also utilize building automation, energy management, and IoT platforms to monitor the environment and collect energy consumption data, forming a typical smart building model of "multi-source data and centralized operation and maintenance." In their daily work, operation and maintenance personnel frequently need to query information such as "the energy consumption level of a building at a certain time," "whether the air quality on a certain floor is consistently exceeding standards," and "the difference in energy consumption between different areas on weekdays and weekends" to identify anomalies, formulate energy-saving measures, and optimize operational strategies. This places higher demands on the accuracy and convenience of querying building operation and maintenance information.

[0028] However, building operation and maintenance data is characterized by its multi-source heterogeneity, complex structure, and inconsistent quality. On the one hand, environmental sensors, electricity meters, water meters, equipment ledgers, and spatial zoning information are often scattered across multiple systems and data tables, with inconsistent field naming, sampling periods, and implicit hierarchical relationships such as building-floor-area-room-equipment-sensor, as well as various environmental and energy consumption evaluation standards. On the other hand, sensor failures and communication anomalies result in a large number of missing values ​​and outliers in the raw data, which must be cleaned and quality controlled before analysis. In current engineering practice, queries are still mainly completed by technical personnel familiar with database structures manually writing SQL statements or calling preset report templates. Ordinary operation and maintenance engineers find it difficult to directly ask complex questions in natural language and obtain structured, computable query results.

[0029] To lower the barrier to entry, some related systems provide graphical query interfaces or fixed statistical reports on top of databases and reporting tools, allowing users to complete partial queries through drop-down options, simple keywords, or drag-and-drop fields. Other solutions introduce unsupervised anomaly detection algorithms in the data preprocessing stage to identify and remove anomalies in monitoring data such as temperature, humidity, and energy consumption, improving data reliability. Still other solutions, based on building semantic models or knowledge graphs, explicitly model the relationships between buildings, floors, rooms, equipment, sensors, and environmental standards, using graph databases or semantic query languages ​​to achieve spatial and equipment-level retrieval. These technologies play an important role in data quality control, structured modeling, and semantic management; however, the input method is still mainly structured query commands, which is not user-friendly for ordinary maintenance personnel and struggles to support complex natural language question answering.

[0030] In recent years, large language models have rapidly improved their capabilities in natural language understanding, code generation, and logical reasoning. Some systems have begun to explore the application of large language models in building operations and maintenance (O&M) scenarios, enabling them to automatically generate SQL queries based on O&M terminology, organize O&M logs, and write analysis reports. A similar implementation scheme employs a framework of "data cleaning, templated and structured organization, text-to-SQL conversion, and building knowledge enhancement": First, environmental and energy consumption data from multiple buildings are uniformly cleaned, and anomaly detection methods are used to obtain reliable time series data. Then, O&M data and spatial attributes are organized into structured tables, constructing a building O&M knowledge graph covering floor structure, spatial function, and environmental standards. Based on this, large language models are used to convert O&M questions into SQL queries. When necessary, knowledge retrieval provides the model with relevant building structure and rule information to improve the accuracy and interpretability of the query results.

[0031] Understandably, most of the related technologies are "local optimizations" focused on database retrieval, visualization reports, anomaly detection, semantic modeling, or general-purpose language models, and are still far from forming a comprehensive, end-to-end integrated solution for frontline operations and maintenance personnel. The shortcomings of these technologies are summarized below.

[0032] First, the relevant technologies have significant shortcomings in terms of interaction methods and ease of use. Currently, many systems still rely primarily on SQL queries, fixed reports, or simple graphical interfaces, essentially encapsulating structured query statements and failing to truly understand the natural language intent of operations and maintenance personnel. For complex issues spanning multiple buildings, floors, and equipment types, multiple rounds of communication and repeated modifications to query statements are often required. This is not only inefficient but also highly dependent on a small number of technical personnel with expertise in database structures, making it difficult to smoothly transfer operational knowledge within the team. This is particularly prominent in multi-building, multi-project operations and maintenance scenarios.

[0033] Second, the integration of related technologies with multi-source operation and maintenance data and building structure knowledge is not high. Although some solutions introduce anomaly detection algorithms for data cleaning, and others use semantic models or knowledge graphs to characterize floor structures and environmental standards, data cleaning, semantic modeling, and query execution are often disconnected: data quality control is passively handled once before analysis, and building hierarchy relationships and operation and maintenance rules remain at the auxiliary explanatory level, rarely directly participating in the construction and optimization of query statements. As a result, the query process neither fully utilizes the hierarchical knowledge of building space-equipment-sensors, nor can it automatically select appropriate data quality strategies according to different scenarios, easily leading to query results that are "findable, but not clearly explained."

[0034] Third, most existing solutions for introducing large language models into building operation and maintenance scenarios remain at the stage of "calling a general model to generate text" or "simply mapping natural language into query statements." Firstly, the models are not systematically customized for building operation and maintenance scenarios, lacking enhancement mechanisms that incorporate knowledge of building structure, environmental standards, and energy consumption rules, leading to errors in complex queries, cross-table joins, and boundary condition judgments. Secondly, existing implementations are often customized for single projects or specific databases, requiring significant modifications when migrating to new buildings or systems, resulting in insufficient engineering reusability.

[0035] Therefore, to achieve unified utilization of multi-source operation and maintenance data and building structure knowledge, reduce the query threshold, improve query accuracy and generalization ability, this application proposes a building operation and maintenance information query method and apparatus based on a knowledge-enhanced large language model. The following description, with reference to the accompanying drawings, details the building operation and maintenance information query method and apparatus based on a knowledge-enhanced large language model according to embodiments of this application.

[0036] Before introducing the building operation and maintenance information query method based on knowledge-enhanced large language model proposed in the embodiments of this application, let's first briefly introduce the application system of this method.

[0037] like Figure 1 As shown, the system includes, but is not limited to, user terminal 10, operation and maintenance large model server 20, building operation and maintenance database 31, building operation and maintenance knowledge graph library 32, and model training and management module 40.

[0038] The user terminal 10 is used to receive natural language query commands input by maintenance personnel and to provide query results to the user. Specifically, it can be a desktop computer, mobile terminal, tablet or other device with network interaction capabilities.

[0039] The large model server 20 is used to deploy large language models and provide inference services.

[0040] Building operation and maintenance database 31 is used to store building operation and maintenance data.

[0041] The Building Operations and Maintenance Knowledge Graph Repository 32 is used to store the constructed building operations and maintenance knowledge graph.

[0042] The Model Training and Management module 40 is used for offline training and updating of large language models.

[0043] It should be noted that the user terminal 10 establishes communication with the operation and maintenance large model server 20 through the network; the operation and maintenance large model server 20 accesses the building operation and maintenance database 31 and the building operation and maintenance knowledge graph database 32 through database connection or interface call; the model training and management module 40 can be deployed independently or integrated, and interact with data through the internal network.

[0044] The following describes the building operation and maintenance information query method based on a knowledge-enhanced large language model proposed in this application.

[0045] Figure 2 This is a flowchart illustrating a method for querying building operation and maintenance information based on a knowledge-enhanced large language model, according to an embodiment of this application.

[0046] like Figure 2 As shown, the building operation and maintenance information query method based on the knowledge-enhanced large language model includes the following steps: In step S201, in response to the user's natural language query, the input text of the natural language query is semantically parsed to obtain a structured query intent.

[0047] Before introducing natural language query parsing, this application's embodiments first introduce how to collect and preprocess building operation and maintenance data, construct a building operation and maintenance knowledge graph, construct query examples, and train a large language model.

[0048] In one embodiment of this application, before responding to a user's natural language query, the method further includes: collecting building operation and maintenance data from a preset building operation and maintenance database; performing anomaly detection and data cleaning on the building operation and maintenance data to obtain cleaned time-series data; modeling building spatial hierarchy, equipment relationships, and operation and maintenance rules based on the time-series data to construct a building operation and maintenance knowledge graph; constructing paired samples of written natural language query examples and structured query statements; and using the paired samples to perform supervised fine-tuning of a preset large language model based on the building operation and maintenance knowledge graph to obtain a fine-tuned large language model.

[0049] Specifically, in this embodiment, building operation and maintenance data is periodically or on demand read from the building operation and maintenance database 31, and anomaly detection and data cleaning are performed on the building operation and maintenance data to obtain cleaned time series data. The building operation and maintenance data includes, but is not limited to, environmental sensor data (such as temperature, humidity, carbon dioxide concentration, and volatile organic compound concentration), water meter readings, electricity meter readings, and equipment operating status data (such as start-up and shutdown data and operating speed data of equipment such as air conditioners, elevators, lighting, and water supply and drainage).

[0050] In one embodiment of this application, anomaly detection and data cleaning are performed on building operation and maintenance data to obtain cleaned time series data, including: calculating anomaly scores of building operation and maintenance data; determining whether the anomaly scores meet preset anomaly conditions; if the anomaly scores meet the preset anomaly conditions, the building operation and maintenance data is determined to be an anomaly, and the building operation and maintenance data is cleaned to obtain time series data.

[0051] Using building operation and maintenance data as monitoring points At any moment raw measurement value For example, in this embodiment of the application, the mean value is first calculated within a sliding time window. with standard deviation Then calculate the monitoring points At any moment Anomaly scoring. The formula for calculating anomaly scoring can be, but is not limited to, as follows: , in, For monitoring points At any moment Abnormal scores, For monitoring point index, For time index, For monitoring points At any moment The original measurement value, For monitoring points within the sliding time window The mean, For monitoring points within the sliding time window standard deviation To prevent tiny positive numbers with a denominator of zero.

[0052] Furthermore, in this embodiment of the application, the abnormal score is determined to meet a preset abnormal condition. At that time, among them, For the preset threshold ( Determine the original measurement value Outliers are identified and removed, or interpolation is performed to repair them, in order to generate cleaned time series data. .

[0053] This application embodiment calculates the anomaly score of building operation and maintenance data, identifies outliers based on preset anomaly conditions, and completes data cleaning to obtain cleaned time series data. It can automatically identify, remove, or repair the abnormal operation and maintenance data generated during collection, avoid the data deviation interference caused by abnormal data to the subsequent construction of building operation and maintenance knowledge graph and training of large language model, and ensure that the time series data is true, regular, and effective.

[0054] It should be noted that, in addition to the above-mentioned anomaly detection and data cleaning methods based on anomaly scoring, the embodiments of this application may also employ algorithms such as isolated forest, local outlier factor, and time series decomposition, and may also employ physical thresholds and standardized threshold rules to complete anomaly removal, and may combine linear interpolation, spline interpolation, and spatial interpolation of rooms on the same floor / with the same function to supplement missing data.

[0055] Furthermore, in the embodiments of this application, the time-series data after cleaning... Based on this, a unified model is constructed for the building space hierarchy, equipment relationships and operation and maintenance rules, and a building operation and maintenance knowledge graph is built. The building operation and maintenance knowledge graph is stored in the building operation and maintenance knowledge graph library 32, which can be a graph database as the storage medium.

[0056] In one embodiment of this application, the triplet set form of the building operation and maintenance knowledge graph can be, but is not limited to, the following: , in, For building operation and maintenance knowledge graph; This is a collection of entities, including but not limited to "building", "floor", "room", "area", "equipment", "sensor", "water meter", "electricity meter", and "environmental assessment standard". This is a set of relation types, including but not limited to "belonging to", "installed in", "monitoring indicator is", and "reference standard is". For a set of specific relation triples, satisfying .

[0057] For example, the specific relational triplet is (Building 3, third floor, includes, conference room 301), (Conference room 301, equipped with temperature sensor, temperature sensor T301), (Temperature sensor T301, monitoring index is, temperature), (Temperature, reference standard is, summer 22-28℃).

[0058] This application's embodiments represent the building operation and maintenance knowledge graph using a triple set format, which can standardize and unify the representation of entities, relationship types, and triples. It clearly solidifies the association logic of building spatial hierarchy, equipment relationships, and operation and maintenance rules, facilitating subsequent retrieval and extraction of target knowledge subgraphs based on the structured building operation and maintenance knowledge graph. This provides standardized and complete professional knowledge support for building operation and maintenance for large language models, and improves the accuracy of matching query requirements in the knowledge enhancement process.

[0059] It should be noted that, in addition to using a building operation and maintenance knowledge graph to represent and store knowledge in a building operation and maintenance knowledge graph library, this application embodiment can also use a relational database (relying on foreign keys and related tables to describe hierarchical relationships), an ontology / rule engine (relying on conditional action rules to manage constraints), or a vector database (which vectorizes entities and rules to complete similarity retrieval). The above methods can be used individually or in combination, and this application does not impose specific restrictions.

[0060] Furthermore, in order to enable the large language model to have the ability to "convert text to structured query", this application embodiment constructs a pairing sample of natural language query examples and structured query statements, and uses the pairing samples to supervise and fine-tune the preset large language model based on the building operation and maintenance knowledge graph, so as to obtain the fine-tuned large language model.

[0061] Specifically, in the context of building operation and maintenance scenarios, various natural language query examples were manually written. (e.g., "Query the average temperature of each floor in Building 3 this week and whether it meets the standards", "Statistics on the top five floors with the highest water consumption over the past month"), and for each natural language query example, write a structured query statement that matches the building operation and maintenance database 31. (e.g., SQL statements) to form paired samples .

[0062] Furthermore, this application embodiment includes database table structure information (database schema information). Knowledge Subgraph As an auxiliary input to the model.

[0063] Furthermore, this application embodiment employs a large language model in the form of an autoregressive generative model, and denotes the model parameters as follows: And the conditional probability of the model outputting a structured query statement that conforms to the business logic is denoted as... ,in, For structured query statements, Here is an example of a natural language query. This refers to database table structure information. Examples of natural language queries From the knowledge graph of building operation and maintenance The knowledge subgraph extracted from it.

[0064] Furthermore, this embodiment uses cross-entropy loss as the target loss function for model supervised fine-tuning. The expression for the target loss function may be, but is not limited to, as follows: , in, This is the total loss value. The total number of training samples, For sample index, For structured query statements, Here is an example of a natural language query. This refers to database table structure information. Examples of natural language queries From the knowledge graph of building operation and maintenance The knowledge subgraph extracted from the data. Through iterative optimization, the model learns to generate syntactically correct and semantically matching structured query statements given a natural language query and relevant knowledge.

[0065] It should be noted that the training samples used for supervised model fine-tuning are not limited to paired samples consisting of natural language query examples and structured query statements. Paired samples consisting of a unified result object formed by integrating the original query results and the judgment results, and natural language interpretations, can also be added. The large language model trained in this way can simultaneously possess the dual capabilities of generating structured query statements and generating query result interpretation text adapted to building operation and maintenance business. The implementation methods for supervised model fine-tuning corresponding to the two types of paired samples are similar, and will not be elaborated upon again in this application.

[0066] This application first collects building operation and maintenance data, and after anomaly detection and data cleaning, obtains cleaned time-series data. Based on this time-series data, a building operation and maintenance knowledge graph is constructed. Then, a pairing sample of natural language query examples and structured query statements is built. Combined with the building operation and maintenance knowledge graph, a pre-set large language model is supervised and fine-tuned to obtain a fine-tuned large language model. The clean and well-organized time-series data ensures the authenticity and accuracy of the building operation and maintenance knowledge graph content. With dedicated pairing samples, the model is fine-tuned so that the fine-tuned large language model can adapt to building operation and maintenance business scenarios, accurately understand operation and maintenance-related natural language queries, and output structured query statements that match business needs, thereby improving the accuracy and adaptability of subsequent online query parsing and statement generation.

[0067] Based on the descriptions of other embodiments, when maintenance personnel input a natural language query through user terminal 10, this embodiment of the application processes the input text on the maintenance big data model server 20. Semantic parsing is performed to obtain the structured query intent.

[0068] Semantic parsing processing includes: determining the task type of the current query, which includes "environmental quality analysis", "energy consumption statistics", "anomaly tracing", and "comprehensive diagnosis"; extracting target entities and conditions from the input text, which include building name, floor range, time interval, indicator type (such as temperature, humidity, carbon dioxide) and limiting conditions (such as "weekday", "afternoon", "exceeding standard value"); and for multi-turn dialogue scenarios, inferring omitted information in the input text by combining historical queries and historical responses.

[0069] The expression for a structured query intent can be, but is not limited to, as follows: , in, For structured query intent, This is a semantic parsing processing operation. Input text. Structured query intents include, but are not limited to, task type, target entity, and conditions.

[0070] In step S202, based on the structured query intent, relevant entities and relationships are retrieved from the preset building operation and maintenance knowledge graph database to form a target knowledge subgraph. Based on the target knowledge subgraph, and combined with the structured query intent and database table structure information, a model input prompt is constructed.

[0071] Based on the descriptions of other embodiments, the embodiments of this application are based on structured query intent. Relevant entities and relationships are retrieved from the building operation and maintenance knowledge graph database 32 to form a target knowledge subgraph. .

[0072] The expression for the target knowledge subgraph can be, but is not limited to, as follows: , in, For the target knowledge subgraph, For knowledge retrieval operations, For structured query intent, For building operation and maintenance knowledge graph.

[0073] Retrieval can be implemented through: entity matching; vector similarity retrieval, i.e., structured query intent. Building Operation and Maintenance Knowledge Graph Mapping to a unified vector space, the semantic association is measured by calculating the cosine similarity between vectors, and highly associated entities and relationships are selected.

[0074] After the retrieval is completed, this embodiment of the application will structure the query intent. Database table structure information and target knowledge subgraph The model input prompts are organized into a unified format. For example, in this embodiment, the model input prompts are organized in the order of "query description, relevant table structure, relevant floor structure, and environmental standard rules," enabling the large language model to explicitly utilize building structure knowledge and operation and maintenance rules during the reasoning process.

[0075] In step S203, a pre-tuned large language model is invoked, and corresponding candidate structured query statements are generated under the input prompts of the model. The candidate structured query statements are then validated according to rules to obtain validated structured query statements. The original query results are obtained based on the structured query statements, and the original query results are statistically analyzed and judged to obtain the judgment results. Natural language interpretation is then generated based on the original query results and the judgment results.

[0076] Based on the descriptions of other embodiments, the embodiments of this application invoke a pre-tuned large language model to generate candidate structured query statements with model input prompts. (e.g., SQL statements). Furthermore, to improve reliability, embodiments of this application include candidate structured query statements. Perform rule validation to obtain a structured query statement that passes the validation.

[0077] In one embodiment of this application, candidate structured query statements are validated according to rules to obtain validated structured query statements. This includes: checking whether the candidate structured query statements conform to preset syntax rules; checking whether the candidate structured query statements contain table names and field names that do not exist in the preset building operation and maintenance database; checking whether the candidate structured query statements contain non-query operations; and determining the candidate structured query statement as a validated structured query statement if the candidate structured query statement conforms to the preset syntax rules, does not contain table names and field names that do not exist in the preset building operation and maintenance database, and does not contain non-query operations.

[0078] Specifically, embodiments of this application utilize a pre-built parser to examine candidate structured query statements. Check whether the query conforms to the preset syntax rules and compare it with the structural information of the building operation and maintenance database 31 to ensure that the candidate structured query statements are valid. It only references table names and field names existing in the building operation and maintenance database 31, and identifies candidate structured query statements. The types of operations included include blocking non-query operations such as deletion and modification.

[0079] If any item in the candidate structured query statement fails validation, the current statement is discarded and a new candidate structured query statement is generated by re-invoking the large model. Validated structured query statements are sent to the building operations database 31 via the database interface for execution. After database processing, the original query result dataset is output. .

[0080] This application embodiment checks whether candidate structured query statements conform to preset syntax rules, whether they contain table names and field names that do not exist in the preset building operation and maintenance database, and whether they contain non-query operations. Only statements that simultaneously meet all three check requirements are determined as valid structured query statements. This can intercept candidate statements with syntax errors, references to invalid library objects, or high-risk operations in advance, avoid execution anomalies or database data security risks, and ensure that the structured query statements used for querying are legal, compliant, and can be executed normally.

[0081] It should be noted that the embodiments of this application convert the natural language queries of operation and maintenance personnel into structured query statements. This is not limited to generating them through a single large language model, but can also use other semantic parsing models and sequence conversion models.

[0082] Furthermore, this application embodiment performs statistical analysis and judgment on the original query results to obtain a judgment result. Specifically, for environmental indicator data, this application embodiment judges "qualified / unqualified" and "slightly exceeding the standard / severely exceeding the standard" according to the standard interval in the building operation and maintenance knowledge graph; for energy consumption data, it calculates the cumulative value, average value or ranking of each floor and each area.

[0083] Taking temperature from environmental index data as an example, in this embodiment of the application, the average temperature of a certain floor within a given time range is set as follows: The standard range is The expression for a qualified indicator function can be, but is not limited to, the following: , in, For a valid indicator function, This is the lower bound of the standard interval. This is the upper bound of the standard interval. This represents the average temperature of a specific floor over a given time period. It is understandable that... This indicates that the temperature on that floor meets the standard. This indicates that the temperature on that floor is not up to standard.

[0084] After completing the statistics and judgment, this embodiment of the application organizes the original query results and judgment results into a unified result object, which is then used by a large language model to generate a natural language explanation for operation and maintenance personnel. This natural language explanation includes, but is not limited to, a summary of the query results, whether the criteria are met, the location of the anomaly, the degree of the anomaly, possible causes, and subsequent handling suggestions, which are returned to the user terminal 10 for display.

[0085] Based on the descriptions of other embodiments, it is understood that the large language model in this application embodiment, after being fine-tuned by multi-task supervision, has a two-stage business capability: the first stage is used to convert natural language queries into structured query statements, solving the problem of "how to query" operation and maintenance data; the second stage is used to generate explanatory text based on a unified result object and operation and maintenance professional knowledge, solving the problem of "how to interpret" query results, thereby realizing a complete closed-loop query process from user natural language questioning, intelligent query retrieval to professional result explanation output.

[0086] Based on the descriptions of other embodiments, in some cases, to improve query accuracy and robustness, embodiments of this application may introduce a confidence estimation mechanism. This is when a large language model generates candidate structured query statements. When this happens, the model will output the corresponding log-conditional probability. The embodiments of this application set a reliability threshold. When the judgment condition is met When determining candidate structured query statements For statements with low confidence, a "low confidence processing strategy" is triggered: New candidate structured query statements are generated, and both statements are sent to the building operations and maintenance database 31 for execution. The results of the two original queries are compared; if they match, the query is output normally. The user is prompted to provide additional conditions, such as "Do you only count weekdays?" or "Do you only consider office areas?", to reduce ambiguity. The current query is marked as "requiring manual review" for review by senior operations and maintenance personnel. This embodiment of the application, through a confidence estimation mechanism, ensures the degree of automation in queries while also considering security and reliability in engineering applications.

[0087] like Figure 3 As shown below, the principle of the building operation and maintenance information query method based on a knowledge-enhanced large language model will be illustrated with a specific embodiment.

[0088] S301, Building Operation and Maintenance Data Acquisition and Preprocessing.

[0089] In this embodiment, building operation and maintenance data is read from the building operation and maintenance database 31 periodically or on demand, and anomaly detection and data cleaning are performed on the building operation and maintenance data to generate cleaned time series data.

[0090] S302, Building Operation and Maintenance Knowledge Graph Construction.

[0091] In this embodiment, based on the cleaned time-series data, a unified model is constructed for the building space hierarchy, equipment relationships, and operation and maintenance rules to build a building operation and maintenance knowledge graph.

[0092] S303, Query Example Construction and Large Language Model Training.

[0093] In this embodiment, combined with a building operation and maintenance scenario, multiple natural language query examples are manually written. For each natural language query example, a structured query statement matching the building operation and maintenance database 31 is written to form paired samples. In addition, database table structure information and relevant building knowledge graph fragments are organized as auxiliary inputs to the model. Furthermore, a large language model in the form of an autoregressive generative model is adopted, and cross-entropy loss is used for supervised fine-tuning of the model, enabling the model to learn to generate grammatically correct and semantically matched structured query statements given natural language queries and related knowledge. Similarly, this embodiment can add paired samples composed of a unified result object formed by integrating the original query results and judgment results, and natural language interpretations, and fine-tune the model to enable the model to interpret text based on query results.

[0094] S304, Natural Language Query Parsing and Task Recognition.

[0095] In this embodiment, after maintenance personnel input a natural language query through user terminal 10, the maintenance big data model server 20 performs semantic parsing processing on the input text to obtain a structured query intent. The structured query intent includes, but is not limited to, task type, target entity, and conditions.

[0096] S305, Knowledge Enhancement and Hint Construction.

[0097] In this embodiment, based on the structured query intent, relevant entities and relationships are retrieved from the building operation and maintenance knowledge graph database 32 to form a target knowledge subgraph. Then, the structured query intent, database table structure information, and target knowledge subgraph are organized into a unified model input prompt.

[0098] S306, Generation and execution of structured query statements.

[0099] In this embodiment, a pre-tuned large language model is invoked to generate candidate structured query statements based on model input prompts, and rule validation is performed on the candidate structured query statements. The validated structured query statements are sent to the building operation and maintenance database 31 via the database interface for execution, and the database outputs the original query result dataset after processing.

[0100] S307, Result Analysis and Explanation Text Generation.

[0101] In this embodiment, the original query results are statistically analyzed and judged to obtain the judgment result. Then, the original query results and the judgment result are organized into a unified result object and handed over to the large language model to generate a natural language interpretation.

[0102] The building operation and maintenance information query method based on a knowledge-enhanced large language model proposed in this application obtains structured query intent through semantic parsing of the input text, which can accurately identify users' operation and maintenance query needs and avoid semantic understanding bias. Then, it forms a target knowledge subgraph based on the structured query intent and constructs model input prompts to realize knowledge-enhanced reasoning empowered by operation and maintenance professional knowledge, effectively adapting to various complex building operation and maintenance query scenarios. Subsequently, it generates candidate structured query statements by calling a pre-fine-tuned large language model and performs rule verification to ensure that the query statements are legal, compliant, and stable to execute, significantly improving the accuracy and robustness of results in complex operation and maintenance query scenarios. Finally, it generates natural language interpretation by statistically judging the original query results, realizing automatic interpretation and output of query results, greatly reducing the operation and usage threshold for operation and maintenance personnel. Thus, by constructing an end-to-end integrated query process, it connects the entire chain of data, knowledge, model, query, and interpretation, and can be quickly migrated and reused for different building projects. Therefore, it solves the problems of related technologies being unable to understand the natural language of operation and maintenance personnel and relying on a few technical personnel who have mastered the database structure, resulting in a high query threshold.

[0103] Next, referring to the accompanying drawings, a building operation and maintenance information query device based on a knowledge-enhanced large language model, according to an embodiment of this application, is described.

[0104] Figure 4 This is a block diagram of a building operation and maintenance information query device based on a knowledge-enhanced large language model provided in an embodiment of this application.

[0105] like Figure 4 As shown, the building operation and maintenance information query device 40 based on the knowledge-enhanced big language model includes: a parsing module 100, an enhancement module 200, and a query module 300.

[0106] The parsing module 100 is used to respond to the user's natural language query by performing semantic parsing on the input text of the natural language query to obtain the structured query intent. The enhancement module 200 is used to retrieve relevant entities and relationships in the preset building operation and maintenance knowledge graph library based on the structured query intent, so as to form a target knowledge subgraph, and construct model input prompts based on the target knowledge subgraph, combined with the structured query intent and database table structure information. The query module 300 is used to call a pre-tuned large language model, generate corresponding candidate structured query statements under the model input prompts, perform rule validation on the candidate structured query statements to obtain validated structured query statements, obtain the original query results based on the structured query statements, perform statistics and judgment on the original query results to obtain the judgment results, and generate natural language interpretation based on the original query results and the judgment results.

[0107] Optionally, in one embodiment of this application, it further includes: a data acquisition module, a cleaning module, a first construction module, a second construction module, and a training module.

[0108] The acquisition module is used to collect building operation and maintenance data from a pre-set building operation and maintenance database. The cleaning module is used to perform anomaly detection and data cleaning on building operation and maintenance data to obtain cleaned time series data. The first construction module is used to model the building spatial hierarchy, equipment relationships and operation and maintenance rules based on time series data, and to build a building operation and maintenance knowledge graph. The second building module is used to build paired samples of written natural language query examples and structured query statements; The training module is used to perform supervised fine-tuning of a pre-set large language model based on the building operation and maintenance knowledge graph and using paired samples to obtain a fine-tuned large language model.

[0109] Optionally, in one embodiment of this application, the cleaning module includes: a calculation unit, a judgment unit, and a cleaning unit.

[0110] The calculation unit is used to calculate the anomaly score of building operation and maintenance data. The judgment unit is used to determine whether the abnormal score meets the preset abnormal conditions. The cleaning unit is used to determine that the building operation and maintenance data is an outlier when the anomaly score meets the preset anomaly conditions, and to clean the building operation and maintenance data to obtain time series data.

[0111] Optionally, in one embodiment of this application, the expression of the building operation and maintenance knowledge graph may be, but is not limited to, as: , in, For building operation and maintenance knowledge graph, For a collection of entities, For a set of relation types, For a set of specific relational triples.

[0112] Optionally, in one embodiment of this application, the query module 300 includes: a first checking unit, a second checking unit, a third checking unit, and a determining unit.

[0113] The first checking unit is used to check whether the candidate structured query statement conforms to the preset syntax rules. The second checking unit is used to check whether the candidate structured query statement contains table names and field names that do not exist in the preset building operation and maintenance database; The third checking unit is used to check whether the candidate structured query statement contains non-query operations; The determination unit is used to determine the candidate structured query statement as a valid structured query statement if the candidate structured query statement conforms to the preset syntax rules, does not contain table names and field names that do not exist in the preset building operation and maintenance database, and does not contain non-query operations.

[0114] It should be noted that the foregoing explanation of the embodiment of the building operation and maintenance information query method based on knowledge-enhanced large language model also applies to the building operation and maintenance information query device based on knowledge-enhanced large language model in this embodiment, and will not be repeated here.

[0115] The building operation and maintenance information query device based on a knowledge-enhanced large language model proposed in this application obtains structured query intent through semantic parsing of input text, accurately identifying user operation and maintenance query needs and avoiding semantic comprehension bias. Then, it forms a target knowledge subgraph based on the structured query intent and constructs model input prompts, enabling knowledge-enhanced reasoning based on operation and maintenance expertise. This effectively adapts to various complex building operation and maintenance query scenarios. Furthermore, it generates candidate structured query statements by calling a pre-tuned large language model and performs rule verification to ensure the query statements are legal, compliant, and stably executed, significantly improving the accuracy and robustness of results in complex operation and maintenance query scenarios. Finally, it generates natural language interpretations by statistically judging the original query results, achieving automatic interpretation and output of query results, significantly reducing the operational threshold for operation and maintenance personnel. By constructing an end-to-end integrated query process, it connects the entire chain of data, knowledge, model, query, and interpretation, and can be quickly migrated and reused across different building projects. This solves the problems of related technologies struggling to understand the natural language of operation and maintenance personnel and relying on a small number of technical personnel with database structure expertise, leading to high query thresholds.

[0116] Figure 5 This is a schematic diagram of the structure of an electronic device provided according to an embodiment of this application. The electronic device may include: The memory 501, the processor 502, and the computer program stored on the memory 501 and capable of running on the processor 502.

[0117] When the processor 502 executes the program, it implements the building operation and maintenance information query method based on the knowledge-enhanced large language model provided in the above embodiments.

[0118] Furthermore, electronic devices also include: Communication interface 503 is used for communication between memory 501 and processor 502.

[0119] The memory 501 is used to store computer programs that can run on the processor 502.

[0120] Memory 501 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0121] If the memory 501, processor 502, and communication interface 503 are implemented independently, then the communication interface 503, memory 501, and processor 502 can be interconnected via a bus to complete communication between them. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0122] Optionally, in a specific implementation, if the memory 501, processor 502, and communication interface 503 are integrated on a single chip, then the memory 501, processor 502, and communication interface 503 can communicate with each other through an internal interface.

[0123] Processor 502 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.

[0124] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described method for querying building operation and maintenance information based on a knowledge-enhanced large language model.

[0125] This application also provides a computer program product, including a computer program that, when executed, implements the above-described method for querying building operation and maintenance information based on a knowledge-enhanced large language model.

[0126] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0127] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0128] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or N executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.

[0129] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.

[0130] It should be understood that the various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, the N steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, it can be implemented using any one or more of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0131] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0132] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0133] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.

Claims

1. A method for querying building operation and maintenance information based on a knowledge-enhanced large language model, characterized in that, Includes the following steps: In response to a user's natural language query, semantic parsing is performed on the input text of the natural language query to obtain a structured query intent; Based on the structured query intent, relevant entities and relationships are retrieved from the preset building operation and maintenance knowledge graph database to form a target knowledge subgraph. Based on the target knowledge subgraph, combined with the structured query intent and database table structure information, a model input prompt is constructed. A pre-tuned large language model is invoked, and corresponding candidate structured query statements are generated under the input prompts of the model. The candidate structured query statements are then validated according to rules to obtain validated structured query statements. The original query results are obtained based on the structured query statements, and the original query results are statistically analyzed and judged to obtain a judgment result. Natural language interpretation is then generated based on the original query results and the judgment result.

2. The method according to claim 1, characterized in that, Prior to responding to the user's natural language query, the method also includes: Collect building operation and maintenance data from a pre-set building operation and maintenance database; Anomaly detection and data cleaning are performed on the building operation and maintenance data to obtain cleaned time series data; Based on the time series data, the building spatial hierarchy, equipment relationships and operation and maintenance rules are modeled to construct a building operation and maintenance knowledge graph; Construct pairs of written natural language query examples with structured query statements; Based on the building operation and maintenance knowledge graph, the paired samples are used to perform supervised fine-tuning of the preset large language model to obtain the fine-tuned large language model.

3. The method according to claim 2, characterized in that, The process of anomaly detection and data cleaning of the building operation and maintenance data to obtain cleaned time-series data includes: Calculate the anomaly score for the building operation and maintenance data; Determine whether the abnormal score meets the preset abnormal conditions; If the anomaly score meets the preset anomaly conditions, the building operation and maintenance data is determined to be an anomaly, and the building operation and maintenance data is cleaned to obtain the time series data.

4. The method according to claim 2, characterized in that, The expression for the building operation and maintenance knowledge graph is: , in, This is the building operation and maintenance knowledge graph. For a collection of entities, For a set of relation types, For a set of specific relational triples.

5. The method according to claim 1, characterized in that, The step of performing rule validation on the candidate structured query statements to obtain validated structured query statements includes: Check whether the candidate structured query statements conform to preset syntax rules; Check whether the candidate structured query statement contains table names and field names that do not exist in the preset building operation and maintenance database; Check whether the candidate structured query statements contain non-query operations; If the candidate structured query statement conforms to the preset syntax rules, does not contain the table name and field name that do not exist in the preset building operation and maintenance database, and does not contain the non-query operation, then the candidate structured query statement is determined as the validated structured query statement.

6. A building operation and maintenance information query device based on a knowledge-enhanced large language model, characterized in that, include: The parsing module is used to respond to a user's natural language query by performing semantic parsing on the input text of the natural language query to obtain a structured query intent; The enhancement module is used to retrieve relevant entities and relationships in a preset building operation and maintenance knowledge graph database based on the structured query intent, so as to form a target knowledge subgraph, and construct model input prompts based on the target knowledge subgraph, combined with the structured query intent and database table structure information; The query module is used to call a pre-tuned large language model, generate corresponding candidate structured query statements under the input prompts of the model, perform rule validation on the candidate structured query statements to obtain validated structured query statements, obtain original query results based on the structured query statements, perform statistics and judgment on the original query results to obtain judgment results, and generate natural language interpretation based on the original query results and the judgment results.

7. The apparatus according to claim 6, characterized in that, Also includes: The data acquisition module is used to collect building operation and maintenance data from a pre-set building operation and maintenance database. The cleaning module is used to perform anomaly detection and data cleaning on the building operation and maintenance data to obtain cleaned time series data. The first construction module is used to model the building spatial hierarchy, equipment relationships and operation and maintenance rules based on the time series data, and to construct a building operation and maintenance knowledge graph. The second building module is used to build paired samples of written natural language query examples and structured query statements; The training module is used to perform supervised fine-tuning of the preset large language model based on the building operation and maintenance knowledge graph and using the paired samples to obtain the fine-tuned large language model.

8. An electronic device, characterized in that, include: The method includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor executes the program to implement the building operation and maintenance information query method based on a knowledge-enhanced large language model as described in any one of claims 1-5.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program is executed by the processor to implement the building operation and maintenance information query method based on the knowledge-enhanced large language model as described in any one of claims 1-5.

10. A computer program product, comprising a computer program, characterized in that, The computer program is executed to implement the building operation and maintenance information query method based on a knowledge-enhanced large language model as described in any one of claims 1-5.