Semantic routing query question and answer method, system and equipment and medium

By extracting the selected sub-knowledge bases of semantic routing and filtering the most relevant knowledge fragments, the problem of information redundancy and leakage in multi-knowledge bases and multi-permission user scenarios is solved, and an efficient query and answer system is realized.

CN120067162AInactive Publication Date: 2025-05-30SHENZHEN INST OF ADVANCED TECH CHINESE ACAD OF SCI +1

Patent Information

Application Number
CN202510534369.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-05-30
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the multi-knowledge base and multi-permission user scenarios, it is difficult to effectively avoid redundant feedback information and leakage of sensitive information.

Method used

By identifying the portraits of people who may be involved in engineering quality management, extract the selected sub-knowledge bases of semantic routing from the quality and safety knowledge base in the engineering field, filter out the most relevant knowledge fragments, and input them into the large language model for answers.

Benefits of technology

It realizes a query and answer system that avoids feedback information redundancy and sensitive information leakage in multi-knowledge base and multi-authority user scenarios, which is simple to operate and highly practical.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067162A_ABST
    Figure CN120067162A_ABST
Patent Text Reader

Abstract

The invention discloses a semantic routing query question and answer method, system and device and a medium, and the method comprises the steps: determining a person who may participate in project quality management, and obtaining a portrait of the person who may participate in project quality management; extracting a sub-knowledge base selected by semantic routing from a quality safety knowledge base in the engineering field according to the portraits of the personnel possibly participating in the engineering quality management; obtaining a to-be-queried statement, and according to the to-be-queried statement, screening out the most relevant K knowledge fragments from the sub-knowledge bases selected by the semantic routing; and inputting the most relevant K knowledge fragments into the large language model to obtain an answer of the to-be-queried statement, the method, the system, the equipment and the medium can realize question and answer query, and meanwhile, the redundancy of feedback information and the leakage of sensitive information are not easily caused.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data processing, and relates to a semantic routing query and answer method, system, device and medium. Background Art

[0002] Currently, the RAG technology mainly targets a single knowledge base. The establishment of a single knowledge base usually cuts professional long documents into knowledge fragments by fixed word counts or semantic identifiers, and then performs vector quantization encoding on each fragment to generate its semantic vector. When the system receives a user's query statement, the statement is also converted into a vector, and the knowledge fragment in the knowledge base that is most similar to the query statement is found based on the vector similarity and returned to the user.

[0003] Domain knowledge bases generally involve multiple categories, such as structure, architecture, and water supply and drainage. The increase in knowledge will inevitably increase the difficulty of retrieval. For example, in water supply and drainage engineering and structural engineering, the strength of concrete is involved, but the specific specifications are different. On the other hand, project management also involves queries to the knowledge base by people with different permissions and requirements. For example, contractors, owners, and suppliers. It is not possible to provide all knowledge for everyone to consult, which is likely to cause redundancy of feedback information and the risk of leakage of sensitive information. Summary of the Invention

[0004] The purpose of the present invention is to overcome the above-mentioned disadvantages of the prior art, and provides a semantic routing query and answer method, system, device and medium, which can realize query and answer, and at the same time is not likely to cause redundancy of feedback information and leakage of sensitive information.

[0005] To achieve the above purpose, the present invention discloses a semantic routing query and answer method, including: Determine the personnel who may participate in project quality management, and obtain the portraits of the personnel who may participate in project quality management; According to the portraits of the personnel who may participate in project quality management, extract the sub-knowledge bases selected by semantic routing from the quality and safety knowledge base in the engineering field; Obtain the query statement to be queried, and screen out the K most relevant knowledge fragments from the sub-knowledge bases selected by semantic routing according to the query statement; Input the K most relevant knowledge fragments into a large language model to obtain the answer to the query statement to be queried.

[0006] A further improvement of the semantic routing query and answer method of the present invention lies in: Further, the process of extracting the sub-knowledge bases selected by semantic routing from the quality and safety knowledge base in the engineering field according to the portraits of the personnel who may participate in project quality management is: Hierarchically cluster the vectors of all knowledge fragments in the quality and safety knowledge base in the engineering field to form several semantic vectors C 1 , C 2 , …, C i … C n ; Label the portraits of the personnel who may participate in engineering quality management as the Json type; Extract key-value pairs from the Json type; Concatenate the key-value pairs into a string, and input the string into the encoding model to obtain a semantic vector; Average and fuse the semantic vectors corresponding to all the personnel who may participate in engineering quality management to obtain a single feature vector v 1 ; Compare the single feature vector v 1 with the semantic vectors C 1 , C 2 , …, C i … C n to screen out the sub-knowledge base selected by the semantic routing.

[0007] Further, the process of comparing the single feature vector v 1 with the semantic vectors C 1 , C 2 , …, C i … C n to screen out the sub-knowledge base selected by the semantic routing is as follows: Perform similarity matching on the single feature vector v 1 with the semantic vectors C 1 , C 2 , …, C i … C n and use the semantic vector with the highest similarity as the sub-knowledge base selected by the semantic routing.

[0008] Further, the process of hierarchically clustering the vectors of all knowledge fragments in the quality and safety knowledge base in the engineering field to form several semantic vectors C 1 , C 2 , …, C i … C n is as follows: Hierarchically cluster the vectors of all knowledge fragments in the quality and safety knowledge base in the engineering field to form several clusters, and use each cluster as a sub-knowledge base; Input the topics of each cluster into the encoding model respectively to obtain the semantic vectors C 1 , C 2 , …, C i … C n .

[0009] Further, the process of hierarchically clustering the vectors of all knowledge fragments in the quality and safety knowledge base for the engineering field is as follows: An unsupervised algorithm is used to hierarchically cluster the vectors of all knowledge fragments in the quality and safety knowledge base for the engineering field.

[0010] Further, the process of screening the most relevant K knowledge fragments from the sub-knowledge base selected by the semantic routing according to the query statement is as follows: According to the query statement, the RAG technology is used to screen the most relevant K knowledge fragments from the sub-knowledge base selected by the semantic routing.

[0011] The present invention discloses a semantic routing query and answer system, including: An acquisition module, configured to determine the personnel who may participate in engineering quality management and acquire the portraits of the personnel who may participate in engineering quality management; An extraction module, configured to extract a sub-knowledge base selected by semantic routing from the quality and safety knowledge base for the engineering field according to the portraits of the personnel who may participate in engineering quality management; A screening module, configured to obtain a query statement and screen the most relevant K knowledge fragments from the sub-knowledge base selected by the semantic routing according to the query statement; A query module, configured to input the most relevant K knowledge fragments into a large language model to obtain an answer to the query statement.

[0012] A further improvement of the semantic routing query and answer system of the present invention lies in: Further, the extraction module includes: A clustering module, configured to hierarchically cluster the vectors of all knowledge fragments in the quality and safety knowledge base for the engineering field to form several semantic vectors C 1 , C 2 , …, C i …C n ; A labeling module, configured to label the portraits of the personnel who may participate in engineering quality management as the Json type; A key-value pair extraction module, configured to extract key-value pairs from the Json type; A splicing module, configured to splice the key-value pairs into a string, input the string into an encoding model to obtain a semantic vector; A fusion module, configured to perform average fusion on the semantic vectors corresponding to all the personnel who may participate in engineering quality management to obtain a single feature vector v 1 ; A comparison module, configured to compare the single feature vector v 1With semantic vector C 1 , C 2 , …, C i …C n Compare to filter out the sub-knowledge base selected by the semantic routing.

[0013] The present invention discloses a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the semantic routing query and answer method are implemented.

[0014] The present invention discloses a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the steps of the semantic routing query and answer method are implemented.

[0015] The present invention has the following beneficial effects: When the semantic routing query and answer method, system, device, and medium of the present invention are specifically operated, according to the portraits of the personnel who may participate in engineering quality management, the sub-knowledge base selected by the semantic routing is extracted from the quality and safety knowledge base in the engineering field, avoiding redundancy of feedback information and leakage of sensitive information. In addition, according to the query statement, the most relevant K knowledge fragments are filtered out from the sub-knowledge base selected by the semantic routing, and the most relevant K knowledge fragments are input into the large language model to obtain the answer to the query statement, so as to realize query and answer. The operation is simple, convenient, and highly practical. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The specification drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The schematic embodiments and descriptions thereof of the present invention are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings: Figure 1 is the method flow chart of the present invention; Figure 2 is the system structure diagram of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0017] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art without creative efforts based on the embodiments of the present invention belong to the protection scope of the present invention.

[0018] In the description of the present invention, it should be understood that the terms "include" and "comprise" indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their combinations.

[0019] It should also be understood that the terms used in the specification of the present invention are merely for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly dictates otherwise, the singular forms "a", "an" and "the" are intended to include the plural forms.

[0020] It should be further understood that the term " / and" used in the specification of the present invention and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations. For example, A and / or B may represent: the case where A exists alone, the case where A and B exist simultaneously, and the case where B exists alone. In addition, in the present invention, the character " / " generally represents an "or" relationship between the contextually related objects.

[0021] It should be understood that although the terms first, second, third, etc. may be used in the embodiments of the present invention to describe preset ranges, etc., these preset ranges should not be limited to these terms. These terms are only used to distinguish the preset ranges from each other. For example, without departing from the scope of the embodiments of the present invention, the first preset range may also be referred to as the second preset range, and similarly, the second preset range may also be referred to as the first preset range.

[0022] Depending on the context, the word "if" as used herein can be interpreted as "when" or "while" or "in response to determining" or "in response to detecting". Similarly, depending on the context, the phrase "if determined" or "if detected (stated condition or event)" can be interpreted as "when determined" or "in response to determining" or "when detected (stated condition or event)" or "in response to detecting (stated condition or event)".

[0023] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Usually, the components in the accompanying drawings described and shown in the embodiments of the present invention can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0024] Various structural schematic diagrams according to the disclosed embodiments of the present invention are shown in the accompanying drawings. These figures are not drawn to scale, where for the purpose of clear expression, some details are enlarged and some details may be omitted. The shapes of various regions and layers shown in the figures and their relative sizes and positional relationships are merely exemplary, and may actually deviate due to manufacturing tolerances or technical limitations, and those skilled in the art can additionally design regions / layers with different shapes, sizes and relative positions according to actual needs.

[0025] Embodiment 1 Reference Figure 1 , the semantic routing query and answer method of the present invention includes the following steps: 1) Hierarchically cluster the vectors of all knowledge fragments in the quality and safety knowledge base in the engineering field to form several semantic vectors C 1 , C 2 , …, C i …C n ; Among them, hierarchical clustering is a bottom-up data aggregation method, and its core concept is to start from a cluster composed of a single data point, and by continuously merging the closest cluster pairs, finally form a single cluster containing all data points. A cluster in the present invention is a semantic vector generated by a knowledge fragment. The hierarchical clustering process can be represented by a dendrogram. Among them, a dendrogram is a graphical tool for displaying the results of hierarchical clustering. Each leaf node represents a single data point, while internal nodes and edges represent the merging process. The specific process is as follows: 11) Initialization: Treat each data point as a separate cluster; 12) Calculate the distance: Calculate the distance between all clusters, where the cosine similarity is used for calculation; 13) Select the closest cluster pair: Select the two closest clusters among all cluster pairs for merging; 14) Update the distance matrix: After merging the selected cluster pairs, update the distance matrix to reflect the new cluster structure. Among them, this step is the key to agglomerative hierarchical clustering. The update strategy adopted in this embodiment is the group average strategy (GroupAverage), that is, the distance between the new cluster and other clusters is the average of the distances between all its points and the points of other clusters; 15) Repeat steps 12) to 14) until the specified number of clusters is reached or all data points are merged into one cluster.

[0026] It should be noted that in this embodiment, an empirical threshold T is set. During the clustering process, it is judged whether the cluster formed by each clustering exceeds the empirical threshold T. When any cluster exceeds the empirical threshold T, it means that the content of the cluster is rich enough. Then, use the large language model to summarize the content of the cluster to generate the cluster theme D. Suppose the cluster theme D' generated after the next round of clustering, then the cluster theme D' generated after the next round of clustering is used as the parent title of the cluster theme D generated by the current clustering. The relationship between the two is a hierarchical relationship, that is, D'-has-child-D. Finally, the tree-level structure of the entire knowledge base can be formed.

[0027] For the several clusters generated by the above unsupervised algorithm, artificial screening and annotation are performed on each cluster. Among them, when screening, any number and any level of clusters can be selected. When annotating, additional label descriptions are added to the clusters. The added labels include knowledge category labels and access permission labels. For example, the cluster with the theme of "earthwork safety" can be uniformly annotated as "earthwork safety", and the cluster with the theme of "scaffold quality control" can be annotated as "scaffold quality management". Then, each cluster is used as a sub-knowledge base, and the theme of each cluster is used to generate a semantic vector C 1 ,C 2 ,…,C i …C n ; 2) Model the user profile; Specifically, classify and model the personnel who may participate in project quality management. Specifically, first investigate and determine the categories of personnel who may participate in project quality management. For example, safety officers, quality inspectors, and project managers, etc., and add feature descriptions to each category of personnel. The feature descriptions include knowledge requirement descriptions and permission descriptions. Among them, the knowledge description is used to define the knowledge background of the personnel, and the actual question list in the daily work of the personnel can be added; the personnel profile is marked as the Json type, and its internal is in the form of key-value pairs, such as {personnel type: xxx knowledge requirement: xxx}.

[0028] 3) Based on the profile, perform semantic routing; Specifically, the portrait of the visiting personnel is labeled as Json-type data to obtain key-value pairs. The key-value pairs are concatenated into a string, and the string is input into an encoding model to generate semantic vectors. Then, the semantic vectors formed by all key-value pairs are averaged and fused into a single feature vector v 1 , and the single feature vector v 1 is matched with the semantic vectors C 1 , C 2 , C n … for similarity matching, and the semantic vector with the highest similarity is obtained as the sub-knowledge base selected by the semantic routing; 4) Based on the query statement, using the RAG technology, in the sub-knowledge base selected by the semantic routing, the most relevant K knowledge fragments are filtered out, and the most relevant K knowledge fragments are input into a large language model to obtain the answer to the query statement.

[0029] Embodiment 2 Reference Figure 2 , the semantic routing query and answer system described in the present invention includes: An acquisition module, configured to determine the personnel who may participate in engineering quality management and acquire the portraits of the personnel who may participate in engineering quality management; An extraction module, configured to extract the sub-knowledge base selected by the semantic routing from the quality and safety knowledge base in the engineering field according to the portraits of the personnel who may participate in engineering quality management; A screening module, configured to obtain the query statement to be queried, and filter out the most relevant K knowledge fragments from the sub-knowledge base selected by the semantic routing according to the query statement; A query module, configured to input the most relevant K knowledge fragments into a large language model to obtain the answer to the query statement to be queried.

[0030] In this embodiment, the extraction module includes: A clustering module, configured to perform hierarchical clustering on the vectors of all knowledge fragments in the quality and safety knowledge base in the engineering field to form a number of semantic vectors C 1 , C 2 , …, C i …C n ; A labeling module, configured to label the portraits of the personnel who may participate in engineering quality management as Json type; A key-value pair extraction module, configured to extract key-value pairs from the Json type; A concatenation module, configured to concatenate the key-value pairs into a string, and input the string into an encoding model to obtain a semantic vector; A fusion module for averaging and fusing the semantic vectors corresponding to all personnel who may participate in engineering quality management to obtain a single feature vector v 1 ; A comparison module for comparing the single feature vector v 1 with the semantic vectors C 1 , C 2 , …, C i … C n to screen out the sub-knowledge bases selected by the semantic routing.

[0031] In the embodiments of the present application, the division of the modules is illustrative, merely a logical function division. In actual implementation, there may be other division methods. In addition, in each embodiment of the present application, the functional modules can be integrated in a processor, can also exist physically alone, or two or more modules can be integrated in one module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules.

[0032] Embodiment 3 A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the semantic routing query and answer method are implemented. For example, it includes: determining the personnel who may participate in engineering quality management, and obtaining the portraits of the personnel who may participate in engineering quality management; according to the portraits of the personnel who may participate in engineering quality management, extracting the sub-knowledge bases selected by the semantic routing from the quality and safety knowledge base in the engineering field; obtaining the query statement, and screening out the most relevant K knowledge fragments from the sub-knowledge bases selected by the semantic routing according to the query statement; inputting the most relevant K knowledge fragments into a large language model to obtain an answer to the query statement. Among them, the memory may include internal memory, such as high-speed random access memory, and may also include non-volatile memory, such as at least one disk memory, etc.; the processor, network interface, and memory are interconnected through an internal bus, and this internal bus can be an Industry Standard Architecture bus, a Peripheral Component Interconnect Standard bus, an Extended Industry Standard Architecture bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. The memory is used to store programs. Specifically, the program can include program code, and the program code includes computer operation instructions. The memory can include internal memory and non-volatile memory, and provide instructions and data to the processor.

[0033] Embodiment 4 A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps of the semantic routing query and answer method. For example, it includes: determining the personnel who may participate in engineering quality management, and obtaining the portraits of the personnel who may participate in engineering quality management; according to the portraits of the personnel who may participate in engineering quality management, extracting the sub-knowledge base selected by semantic routing from the quality and safety knowledge base in the engineering field; obtaining the query statement, and screening out the most relevant K knowledge fragments from the sub-knowledge base selected by semantic routing according to the query statement; inputting the most relevant K knowledge fragments into a large language model to obtain the answer to the query statement. Specifically, the computer-readable storage medium includes but is not limited to, for example, volatile memory and / or non-volatile memory. The volatile memory may include random access memory and / or cache memory, etc. The non-volatile memory may include read-only memory, hard disk, flash memory, optical disc, magnetic disk, etc.

[0034] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.

[0035] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of processes and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0036] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0037] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions for implementing the functions specified in one process or a plurality of processes and / or boxes Figure 1 in one process or a plurality of processes and / or boxes Figure 1 and steps for the functions specified in one box or a plurality of boxes.

[0038] After considering the specification and the disclosure of the invention, those skilled in the art will readily conceive of other embodiments of the invention. This application is intended to cover any variations, uses, or adaptations of the invention, which follow the general principles of the invention and include known common knowledge or conventional technical means in the technical field not disclosed by the invention. The specification and the embodiments are only to be regarded as exemplary, and the true scope and spirit of the invention are pointed out by the following claims.

[0039] It should be understood that the invention is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is only limited by the appended claims.

[0040] The above are only the preferred embodiments of the invention, and do not limit the invention in any way. Any simple modifications, changes, and equivalent structural changes made to the above embodiments according to the technical essence of the invention still fall within the scope of the technical solution of the invention.

Claims

1. A semantic routing query and answer method, characterized in that: include: Determine the personnel who may be involved in the project quality management, and obtain the portraits of the personnel who may be involved in the project quality management; According to the portraits of the personnel who may be involved in engineering quality management, extracting the sub-knowledge base selected by semantic routing from the quality and safety knowledge base in the engineering field; Obtaining a query statement, and selecting the most relevant K knowledge fragments from the sub-knowledge base selected by the semantic routing according to the query statement; The K most relevant knowledge fragments are input into the large language model to obtain the answer to the query statement.

2. The semantic routing query and answer method according to claim 1, characterized in that: The process of extracting the sub-knowledge base selected by semantic routing from the quality and safety knowledge base in the engineering field according to the portrait of the personnel who may be involved in the engineering quality management is as follows: Hierarchical clustering is performed on the vectors of all knowledge fragments in the quality and safety knowledge base in the engineering field to form several semantic vectors C1, C2, ..., C i …C n ; Mark the portraits of people who may be involved in engineering quality management as Json type; Extract key-value pairs from the Json type; Concatenate the key-value pairs into a string, and input the string into an encoding model to obtain a semantic vector; The semantic vectors corresponding to all personnel who may be involved in engineering quality management are averaged and fused to obtain a single feature vector v1; The single specific vector v1 is combined with the semantic vectors C1, C2, ..., C i …C n The comparison is performed to filter out the sub-knowledge base selected by semantic routing.

3. The semantic routing query and answer method according to claim 2, characterized in that: The single specific vector v1 is combined with the semantic vectors C1, C2, ..., C i …C n The process of comparing and selecting the sub-knowledge base selected by semantic routing is as follows: The single feature vector v1 is combined with the semantic vectors C1, C2, ..., C i …C n Perform similarity matching and use the semantic vector with the highest similarity as the sub-knowledge base selected by semantic routing.

4. The semantic routing query and answer method according to claim 2, characterized in that: The vectors of all knowledge fragments in the quality and safety knowledge base in the engineering field are hierarchically clustered to form several semantic vectors C1, C2, ..., C i …C n The process is: The vectors of all knowledge fragments in the quality and safety knowledge base in the engineering field are hierarchically clustered to form several clusters, and each cluster is used as a sub-knowledge base; Input the topics of each cluster into the encoding model respectively to obtain the semantic vectors C1, C2, ..., C i …C n .

5. The semantic routing query and answer method according to claim 2, characterized in that: The process of hierarchical clustering of vectors of all knowledge fragments in the quality and safety knowledge base in the engineering field is as follows: An unsupervised algorithm is used to perform hierarchical clustering on the vectors of all knowledge fragments in the quality and safety knowledge base in the engineering field.

6. The semantic routing query and answer method according to claim 1, characterized in that: The process of selecting the most relevant K knowledge fragments from the sub-knowledge base selected by the semantic routing according to the query statement is as follows: According to the query statement, the RAG technology is used to screen out the most relevant K knowledge fragments in the sub-knowledge base selected by the semantic routing.

7. A semantic routing query and answer system, characterized in that: include: An acquisition module, used to determine personnel who may participate in project quality management and obtain portraits of the personnel who may participate in project quality management; An extraction module, used to extract a sub-knowledge base selected by semantic routing from a quality and safety knowledge base in the engineering field according to the portraits of the personnel who may be involved in engineering quality management; A screening module, used for obtaining a query statement, and screening out the most relevant K knowledge fragments from the sub-knowledge base selected by the semantic routing according to the query statement; The query module is used to input the most relevant K knowledge fragments into the large language model to obtain an answer to the query statement.

8. The semantic routing query and answer system according to claim 7, characterized in that: The extraction module comprises: The clustering module is used to hierarchically cluster the vectors of all knowledge fragments in the quality and safety knowledge base in the engineering field to form several semantic vectors C1, C2, ..., C i …C n ; The annotation module is used to annotate the portraits of personnel who may be involved in engineering quality management as Json type; A key-value pair extraction module, used to extract key-value pairs from the Json type; A concatenation module, used for concatenating the key-value pairs into a character string, and inputting the character string into an encoding model to obtain a semantic vector; The fusion module is used to average and fuse the semantic vectors corresponding to all personnel who may be involved in engineering quality management to obtain a single feature vector v1; A comparison module is used to compare the single specific vector v1 with the semantic vectors C1, C2, ..., C i …C n The comparison is performed to filter out the sub-knowledge base selected by semantic routing.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the semantic routing query and answer method according to any one of claims 1 to 6 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the semantic routing query and answering method as claimed in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Service recommendation method and device, computer equipment and storage medium

    CN114238767A

  • Knowledge base question and answer method and device based on large language model under mass information

    CN117312509A

  • Question and answer consulting method and system based on user portraits

    CN117539996A

  • Method and device for selecting knowledge base and storage medium

    CN119358657A

Cited By

  • Online programming community learning support method and system based on generative artificial intelligence

    CN120450652A

  • Online programming community learning support method and system based on generative artificial intelligence

    CN120450652B