Retrieval enhancement generation method, system, device and medium, and query method and system

By obtaining the semantic vector of the user query statement, based on the knowledge weight and path characteristics, the knowledge file path with the highest total weight and the highest matching degree is selected from the knowledge base, which solves the problem of query accuracy and quality reduction in the existing technology, and realizes the More efficient knowledge file path retrieval and accuracy of query results.

CN118643903BActive Publication Date: 2024-11-15SHENZHEN INST OF ADVANCED TECH CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411030950.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-11-15
Estimated Expiration
2044-07-30

AI Technical Summary

Technical Problem

When the number and volume of documents increase, existing RAG methods lead to reduced query accuracy and quality, and the nearest knowledge slice cannot be found effectively.

Method used

By obtaining the semantic vector of the user query statement, based on the knowledge weight and path characteristics, the knowledge file path with the highest total weight and the highest matching degree is selected from the knowledge base, and the intersection operation is performed to generate the final knowledge file path, improving the accuracy of the query and quality.

Benefits of technology

Combining the knowledge file path and content characteristics, we can enhance the search of knowledge file paths, improve the accuracy and quality of query, and ensure accurate traceability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118643903B_ABST
    Figure CN118643903B_ABST
Patent Text Reader

Abstract

The present invention discloses a retrieval enhancement generation method, system, device and medium and a query method and system, belonging to the field of data processing technology, comprising: obtaining a user's query statement, converting the query statement into a semantic vector; based on knowledge weight, using the semantic vector, selecting from a knowledge base knowledge file paths corresponding to the #imgabs0# knowledge files with the highest total weight; based on path features, using the semantic vector, selecting from the knowledge base knowledge file paths corresponding to the #imgabs1# knowledge files with the highest matching degree; intersecting the knowledge file paths corresponding to the #imgabs2# knowledge files with the highest total weight with the knowledge file paths corresponding to the #imgabs3# knowledge files with the highest matching degree, and using the result of the intersection as the final knowledge file path to complete retrieval enhancement generation. The method, system, device and medium can improve the accuracy and quality of queries.
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 retrieval enhancement generation method, system, device and medium, and a query method and system. Background Art

[0002] The current mainstream RAG method is to directly and violently slice any document, that is, directly slice it according to a fixed number of words or first divide it into sentences based on obvious sentence symbols, and then integrate the sentences into slices according to the maximum degree of repetition. Then, after the slices are vectorized, they are matched with the vectorized vectors of the user query for similarity. After finding the knowledge slices that are most similar to the query, the slice combination is loaded into the prompt words and input into the large language model to answer the user's question. However, this method has obvious defects: that is, when the number of documents increases significantly and the document volume increases significantly, the possibility of finding the closest knowledge slice will decrease, resulting in reduced query accuracy and quality. Summary of the invention

[0003] The purpose of the present invention is to overcome the shortcomings of the above-mentioned prior art and provide a retrieval enhancement generation method, system, device and medium and a query method and system, which can improve the accuracy and quality of the query.

[0004] In order to achieve the above object, the present invention adopts the following technical scheme:

[0005] In one aspect of the present invention, the search enhancement generation method of the present invention comprises:

[0006] Obtaining a user's query statement, and converting the query statement into a semantic vector;

[0007] Based on the knowledge weight, the semantic vector is used to select the knowledge base with the highest total weight. The knowledge file path corresponding to each knowledge file;

[0008] Based on the path features, the semantic vector is used to select the most matching one from the knowledge base. The knowledge file path corresponding to each knowledge file;

[0009] The highest total weight The knowledge file path corresponding to the knowledge file has the highest matching degree The knowledge file paths corresponding to the knowledge files are intersected, and the result of the intersection is used as the final knowledge file path to complete the retrieval enhancement generation.

[0010] The retrieval enhancement generation method of the present invention is further improved in that:

[0011] Furthermore, the process of converting the query statement into a semantic vector is:

[0012] The query sentence is converted into a semantic vector using an encoding model.

[0013] Furthermore, based on the knowledge weight, the semantic vector is used to select the knowledge base with the highest total weight. The process of the knowledge file path corresponding to each knowledge file is as follows:

[0014] Match the semantic vector with all vectors in the knowledge base to obtain the vector with the highest matching degree. Sentences;

[0015] In the knowledge base, determine the The knowledge file to which the sentence belongs, calculates the query sentence and the The relevance of all sentences in the knowledge file to which the sentence belongs;

[0016] Calculating the total weight of each knowledge file, wherein the total weight of the knowledge file is the sum of the positive correlations between each sentence in the knowledge file and the query statement;

[0017] Select the one with the highest total weight The knowledge file path corresponding to the knowledge file.

[0018] Furthermore, the correlation is represented by cosine similarity.

[0019] In a second aspect of the present invention, the search enhancement generation system of the present invention comprises:

[0020] An acquisition module, used to acquire a user's query statement and convert the query statement into a semantic vector;

[0021] The first screening module is used to select the knowledge base with the highest total weight based on the knowledge weight and using the semantic vector. The knowledge file path corresponding to each knowledge file;

[0022] The second screening module is used to select the most matching one from the knowledge base based on the path features and the semantic vector. The knowledge file path corresponding to each knowledge file;

[0023] The enhancement module is used to add the highest total weight The knowledge file path corresponding to the knowledge file has the highest matching degree The knowledge file paths corresponding to the knowledge files are intersected, and the result of the intersection is used as the final knowledge file path to complete the retrieval enhancement generation.

[0024] In a third aspect of the present invention, the computer device described in the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the retrieval enhancement generation method when executing the computer program.

[0025] In a fourth aspect of the present invention, the computer-readable storage medium of the present invention stores a computer program, and when the computer program is executed by a processor, the steps of the retrieval enhancement generation method are implemented.

[0026] In a fifth aspect of the present invention, the query method of the present invention comprises the following steps:

[0027] Based on the retrieval enhancement generation method, a final knowledge file path is obtained;

[0028] Extracting a knowledge file from a knowledge base through the final knowledge file path, reading the knowledge content of the knowledge file, and generating a prompt word according to the knowledge content of the knowledge file;

[0029] The prompt word is input into the large language model to obtain the query result corresponding to the user's query statement.

[0030] The query method of the present invention is further improved in that:

[0031] Furthermore, the final knowledge file path is output.

[0032] In a sixth aspect of the present invention, the query system of the present invention comprises the following steps:

[0033] A retrieval enhancement module, used to obtain a final knowledge file path based on the retrieval enhancement generation method;

[0034] A generation module, used for extracting a knowledge file from a knowledge base through the final knowledge file path, reading the knowledge content of the knowledge file, and generating a prompt word according to the knowledge content of the knowledge file;

[0035] The query module is used to input the prompt word into the large language model to obtain the query result corresponding to the user's query statement.

[0036] The present invention has the following beneficial effects:

[0037] The search enhancement generation method, system, device and medium and the query method and system of the present invention are used to select the search result with the highest total weight. The knowledge file path corresponding to the knowledge file has the highest matching degree The knowledge file paths corresponding to the knowledge files are intersected, and the result of the intersection is used as the final knowledge file path, that is, the two aspects of the local file knowledge base path and the specific knowledge content are combined to realize the retrieval enhancement of the knowledge file path, and then vector retrieval matching is performed based on the final knowledge file path to improve the accuracy and quality of the query.

[0038] Furthermore, the present invention returns the final knowledge file path to achieve accurate traceability. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:

[0040] Figure 1 A flowchart of the retrieval enhancement generation method of the present invention;

[0041] Figure 2 The highest total weight is selected in the present invention A flowchart of the knowledge file path corresponding to each knowledge file;

[0042] Figure 3 A flowchart of the query method of the present invention;

[0043] Figure 4 A structural diagram of the search enhancement generation system of the present invention;

[0044] Figure 5 It is a structural diagram of the query system described in the present invention. DETAILED DESCRIPTION

[0045] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only an embodiment of a part of the present invention, not all embodiments, and is not intended to limit the scope of the present invention. In addition, in the following description, the description of well-known structures and technologies is omitted to avoid unnecessary confusion of the concepts disclosed in the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of the present invention.

[0046] The accompanying drawings show schematic diagrams of structures according to embodiments disclosed in the present invention. These figures are not drawn to scale, and some details are magnified and some details may be omitted for the purpose of clear expression. The shapes of various regions and layers shown in the figures and the relative sizes and positional relationships therebetween are only exemplary, and may deviate in practice due to manufacturing tolerances or technical limitations, and those skilled in the art may additionally design regions / layers with different shapes, sizes, and relative positions according to actual needs.

[0047] Embodiment 1

[0048] refer to Figure 1 , the search enhancement generation method of the present invention comprises:

[0049] 1) Obtaining a user's query statement and converting the query statement into a semantic vector;

[0050] The specific operations of step 1) are:

[0051] The user's query statement is obtained, the user's query statement is input into the encoding model, and the user's query statement is converted into a semantic vector of 1x1024 dimension.

[0052] Preferably, the present invention adopts the BGE model to convert the user's query statement into a semantic vector of 1x1024 dimension.

[0053] 2) Based on the knowledge weight, using the semantic vector, select the knowledge base with the highest total weight The knowledge file path corresponding to each knowledge file;

[0054] refer to Figure 2 , the specific operation of step 2) is:

[0055] 21) Match the semantic vector with all vectors in the knowledge base to obtain the vector with the highest matching degree. The sentence corresponding to the vector is A sentence.

[0056] As an implementation mode of the present invention, in this embodiment, cosine similarity is used to represent the correlation, that is, the cosine similarity between the semantic vector and all vectors in the knowledge base is calculated, and the vector with the highest cosine similarity is selected. The sentence corresponding to the vector is the sentence with the highest matching degree. The sentence corresponding to the vector is A sentence.

[0057] In addition, it should be noted that the hierarchical structure of the local file system in the present invention includes folders, subfolders under the folders, knowledge files under the subfolders, and the knowledge file path is parent title, child title, child title, knowledge file, wherein the knowledge file is a .json file, a .csv file or a .png image file.

[0058] The text data in the knowledge file is converted into a .json format to form a .json file, and the sentences in the .json file are the highest granularity units of the knowledge base.

[0059] The sentences in the .json file are encoded using the BGE encoding model of BAAI to form a semantic vector of 1x1024 dimension, and the semantic vector of 1x1024 dimension is stored in the knowledge base in elastic search (ES, search server), where the total number of sentences in all .json files is , then the dimension of the vector matrix in the knowledge base is At the same time, the knowledge file paths of all knowledge files are converted into path semantic vectors and stored in the knowledge base. The path vector matrix in the knowledge base is ,in, is the number of knowledge file paths.

[0060] In addition, in order to ensure the compatibility of the present invention, the You can choose a larger value, such as 200.

[0061] 22) In the knowledge base, determine the The knowledge file to which the sentence belongs, calculates the query sentence and the The relevance of all sentences in the knowledge file to which the sentence belongs;

[0062] It should be noted that for each sentence s, the knowledge file where the sentence is located can be found in the knowledge base, that is, the .json file. Combine a sentence with the knowledge document to which it belongs, and set Sentences corresponding to knowledge files, then the corresponding sentence combination in each knowledge file is .

[0063] As an implementation mode of the present invention, this embodiment uses cosine similarity to represent the correlation, that is, to calculate the similarity between the query statement and the The cosine similarity of all sentences in the knowledge file to which the sentence belongs.

[0064] 23) Calculating the total weight of each knowledge file, wherein the total weight of the knowledge file is the sum of the positive correlations between each sentence in the knowledge file and the query statement;

[0065] For any knowledge file, the specific operations are as follows:

[0066] 231) Calculate the average relevance between the query sentence and all sentences in the knowledge file ;

[0067] 232) Calculate the correlation between the query sentence and each sentence in the knowledge file and the average correlation differences;

[0068] 233) Sum all correlations with positive differences, and use the sum result as the total weight of the knowledge document.

[0069] 24) Select the one with the highest total weight The knowledge file path corresponding to the knowledge file is The path to the knowledge file.

[0070] It should be noted that the The value can be set to a smaller value, such as 3-5.

[0071] 3) Based on the path features, using the semantic vector, select the one with the highest matching degree from the knowledge base The knowledge file path corresponding to each knowledge file;

[0072] The specific operations of step 3) are:

[0073] Convert the user's query statement into a semantic vector of 1x1024 dimension , the hierarchical path of the knowledge base, such as the parent title, the child title, the child title, the knowledge file, is also regarded as a sentence and converted into a vector; the semantic vector Match with the knowledge file path vector in the knowledge base and select the one with the highest matching degree knowledge file path, The path to the knowledge file.

[0074] It should be noted that the BGE model is used to convert the user's query statement into a semantic vector of 1x1024 dimension.

[0075] 4) The highest total weight The knowledge file path corresponding to the knowledge file has the highest matching degree The knowledge file paths corresponding to the knowledge files are intersected, and the result of the intersection is used as the final knowledge file path to complete the retrieval enhancement generation.

[0076] It should be noted that the present invention combines the path and the knowledge content. Therefore, when the path has no obvious identification, that is, the file path does not have content related to the query statement, similar knowledge files can also be searched based on the knowledge content of the knowledge file, thereby improving the accuracy. That is, the two aspects of the local file knowledge base path and the specific knowledge content are combined to perform vector retrieval matching to improve the accuracy and quality of the query.

[0077] Embodiment 2

[0078] Accordingly, reference Figure 4 The search enhancement generation system of the present invention comprises:

[0079] An acquisition module, used to acquire a user's query statement and convert the query statement into a semantic vector;

[0080] The first screening module is used to select the knowledge base with the highest total weight based on the knowledge weight and using the semantic vector. The knowledge file path corresponding to each knowledge file;

[0081] The second screening module is used to select the most matching one from the knowledge base based on the path features and the semantic vector. The knowledge file path corresponding to each knowledge file;

[0082] The enhancement module is used to add the highest total weight The knowledge file path corresponding to the knowledge file has the highest matching degree The knowledge file paths corresponding to the knowledge files are intersected, and the result of the intersection is used as the final knowledge file path to complete the retrieval enhancement generation.

[0083] As an implementation mode of the present invention, the process of converting the query statement into a semantic vector is:

[0084] The query sentence is converted into a semantic vector using an encoding model.

[0085] As an implementation mode of the present invention, based on the knowledge weight, the semantic vector is used to select the knowledge base with the highest total weight. The process of the knowledge file path corresponding to each knowledge file is as follows:

[0086] Match the semantic vector with all vectors in the knowledge base to obtain the vector with the highest matching degree. Sentences;

[0087] In the knowledge base, determine the The knowledge file to which the sentence belongs, calculates the query sentence and the The relevance of all sentences in the knowledge file to which the sentence belongs;

[0088] Calculating the total weight of each knowledge file, wherein the total weight of the knowledge file is the sum of the positive correlations between each sentence in the knowledge file and the query statement;

[0089] Select the one with the highest total weight The knowledge file path corresponding to the knowledge file.

[0090] As an implementation manner of the present invention, the correlation is represented by cosine similarity.

[0091] The division of modules in the embodiments of the present invention is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional module in each embodiment of the present invention may be integrated into one processor, or may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.

[0092] Embodiment 3

[0093] 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 retrieval enhancement generation method are implemented, for example, including: obtaining a user's query statement, converting the query statement into a semantic vector; based on the knowledge weight, using the semantic vector, selecting a query statement with the highest total weight from a knowledge base. knowledge file path corresponding to the knowledge file; based on the path feature, using the semantic vector, select the knowledge file with the highest matching degree from the knowledge base The knowledge file path corresponding to the knowledge file; the one with the highest total weight The knowledge file path corresponding to the knowledge file has the highest matching degree The knowledge file paths corresponding to the knowledge files are intersected, and the result of the intersection is used as the final knowledge file path to complete the retrieval enhancement generation. Among them, the memory may include a memory, such as a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk memory, etc. The processor, the network interface, and the memory are interconnected through an internal bus, and the internal bus can be an industrial standard architecture bus, a peripheral component interconnection standard bus, an extended industrial standard structure 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 may include a program code, and the program code includes computer operating instructions. The memory may include a memory and a non-volatile memory, and provide instructions and data to the processor.

[0094] Embodiment 4

[0095] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the retrieval enhancement generation method are implemented, for example, including: obtaining a user's query statement, converting the query statement into a semantic vector; based on the knowledge weight, using the semantic vector, selecting the query statement with the highest total weight from the knowledge base. knowledge file path corresponding to the knowledge file; based on the path feature, using the semantic vector, select the knowledge file with the highest matching degree from the knowledge base The knowledge file path corresponding to the knowledge file; the one with the highest total weight The knowledge file path corresponding to the knowledge file has the highest matching degree The knowledge file paths corresponding to the knowledge files are intersected, and the result of the intersection is used as the final knowledge file path to complete the retrieval enhancement generation. 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 (RAM) and / or cache memory (cache), etc. The non-volatile memory may include read-only memory (ROM), hard disk, flash memory, optical disk, magnetic disk, etc.

[0096] Embodiment 5

[0097] refer to Figure 3 , the retrieval enhancement generation method of the present invention is applied to the query field. This embodiment discloses a query method, comprising the following steps:

[0098] Obtaining a user's query statement, and converting the query statement into a semantic vector;

[0099] Based on the knowledge weight, the semantic vector is used to select the knowledge base with the highest total weight. The knowledge file path corresponding to each knowledge file;

[0100] Based on the path features, the semantic vector is used to select the most matching one from the knowledge base. The knowledge file path corresponding to each knowledge file;

[0101] The highest total weight The knowledge file path corresponding to the knowledge file has the highest matching degree Intersect the knowledge file paths corresponding to the knowledge files, and use the result of the intersection as the final knowledge file path;

[0102] Extracting a knowledge file from a knowledge base through the final knowledge file path, reading the knowledge content of the knowledge file, and generating a prompt word according to the knowledge content of the knowledge file;

[0103] The prompt word is input into the large language model to obtain the query result corresponding to the user's query statement.

[0104] As an implementation manner of the present invention, the large language model API is a Qwen 72B model.

[0105] As an implementation mode of the present invention, the process of reading the knowledge content of the knowledge file and generating prompt words according to the knowledge content of the knowledge file is as follows:

[0106] The knowledge contents of the knowledge files are read and assembled into knowledge materials. The knowledge contents in different knowledge files are separated by line breaks and then loaded into prompt words. The prompt words include the user's query statements and knowledge materials.

[0107] As an embodiment of the present invention, it also includes:

[0108] Returns the final knowledge file path to achieve accurate traceability.

[0109] Embodiment 6

[0110] Accordingly, reference Figure 5 , this embodiment discloses a query system, comprising the following steps:

[0111] Retrieval enhancement module, used to obtain the final knowledge file path;

[0112] A generation module, used for extracting a knowledge file from a knowledge base through the final knowledge file path, reading the knowledge content of the knowledge file, and generating a prompt word according to the knowledge content of the knowledge file;

[0113] The query module is used to input the prompt word into the large language model to obtain the query result corresponding to the user's query statement.

[0114] As an implementation mode of the present invention, the search enhancement module includes:

[0115] An acquisition module, used to acquire a user's query statement and convert the query statement into a semantic vector;

[0116] The first screening module is used to select the knowledge base with the highest total weight based on the knowledge weight and using the semantic vector. The knowledge file path corresponding to each knowledge file;

[0117] The second screening module is used to select the most matching one from the knowledge base based on the path features and the semantic vector. The knowledge file path corresponding to each knowledge file;

[0118] The enhancement module is used to add the highest total weight The knowledge file path corresponding to the knowledge file has the highest matching degree The knowledge file paths corresponding to the knowledge files are intersected, and the result of the intersection is used as the final knowledge file path to complete the retrieval enhancement generation.

[0119] As an implementation manner of the present invention, the large language model API is a Qwen 72B model.

[0120] As an implementation mode of the present invention, the process of reading the knowledge content of the knowledge file and generating prompt words according to the knowledge content of the knowledge file is as follows:

[0121] The knowledge contents of the knowledge files are read and assembled into knowledge materials. The knowledge contents in different knowledge files are separated by line breaks and then loaded into prompt words. The prompt words include the user's query statements and knowledge materials.

[0122] As an embodiment of the present invention, it also includes:

[0123] The traceability module is used to return the final knowledge file path to achieve accurate traceability.

[0124] The division of modules in the embodiments of the present invention is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional module in each embodiment of the present invention may be integrated into one processor, or may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.

[0125] Embodiment 7

[0126] 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 query method are implemented, for example, including: obtaining a user's query statement, converting the query statement into a semantic vector; based on knowledge weights, using the semantic vector, selecting a query statement with the highest total weight from a knowledge base. knowledge file path corresponding to the knowledge file; based on the path feature, using the semantic vector, select the knowledge file with the highest matching degree from the knowledge base The knowledge file path corresponding to the knowledge file; the one with the highest total weight The knowledge file path corresponding to the knowledge file has the highest matching degree The knowledge file paths corresponding to the knowledge files are intersected, and the result of the intersection is used as the final knowledge file path; the knowledge file is extracted from the knowledge base through the final knowledge file path, the knowledge content of the knowledge file is read, and a prompt word is generated according to the knowledge content of the knowledge file; the prompt word is input into the large language model to obtain the query result corresponding to the query statement of the user. Among them, the memory may include a memory, such as a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk memory, etc.; the processor, the network interface, and the memory are interconnected through an internal bus, and the internal bus can be an industrial standard architecture bus, a peripheral component interconnection standard bus, an extended industrial 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 a program code, and the program code includes computer operation instructions. The memory can include a memory and a non-volatile memory, and provides instructions and data to the processor.

[0127] Embodiment 8

[0128] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the query method are implemented, for example, including: obtaining a user's query statement, converting the query statement into a semantic vector; based on the knowledge weight, using the semantic vector, selecting the highest total weight from the knowledge base knowledge file path corresponding to the knowledge file; based on the path feature, using the semantic vector, select the knowledge file with the highest matching degree from the knowledge base The knowledge file path corresponding to the knowledge file; the one with the highest total weight The knowledge file path corresponding to the knowledge file has the highest matching degree The knowledge file paths corresponding to the knowledge files are intersected, and the result of the intersection is used as the final knowledge file path; the knowledge file is extracted from the knowledge base through the final knowledge file path, the knowledge content of the knowledge file is read, and a prompt word is generated according to the knowledge content of the knowledge file; the prompt word is input into the large language model to obtain the query result corresponding to the user's 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 (RAM) and / or cache memory (cache), etc. The non-volatile memory may include read-only memory (ROM), hard disk, flash memory, optical disk, magnetic disk, etc.

[0129] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

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

[0131] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0132] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0133] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and disclosure of the invention. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed by the present invention. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention is indicated by the following claims.

[0134] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

[0135] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any way. Any simple modification, change and equivalent structural change made to the above embodiment based on the technical essence of the present invention still falls within the protection scope of the technical solution of the present invention.

Claims

1. A search enhancement generation method, characterized in that: include: Obtaining a user's query statement, and converting the query statement into a semantic vector; Based on the knowledge weight, the semantic vector is used to select the knowledge base with the highest total weight. The knowledge file path corresponding to each knowledge file; Based on the path features, the semantic vector is used to select the most matching one from the knowledge base. The knowledge file path corresponding to each knowledge file; The highest total weight The knowledge file path corresponding to the knowledge file has the highest matching degree The knowledge file paths corresponding to the knowledge files are intersected, and the result of the intersection is used as the final knowledge file path to complete the retrieval enhancement generation; Based on the knowledge weight, the semantic vector is used to select the knowledge base with the highest total weight. The specific operations of the knowledge file path corresponding to each knowledge file are as follows: Match the semantic vector with all vectors in the knowledge base to obtain the vector with the highest matching degree. The sentence corresponding to the vector is Sentences; In the knowledge base, determine the The knowledge file to which the sentence belongs, calculates the query sentence and the The relevance of all sentences in the knowledge file to which the sentence belongs; Calculating the total weight of each knowledge file, wherein the total weight of the knowledge file is the sum of the positive correlations between each sentence in the knowledge file and the query statement; For any knowledge file, the specific operations are as follows: Calculate the average relevance between the query and all sentences in the knowledge file ; Calculate the correlation between the query statement and each sentence in the knowledge file and the average correlation differences; Summing all correlations with positive differences, and using the summed result as the total weight of the knowledge document; Select the one with the highest total weight The knowledge file path corresponding to the knowledge file is Knowledge file paths; Based on the path feature, the semantic vector is used to select the highest matching degree from the knowledge base. The specific operations of the knowledge file path corresponding to each knowledge file are as follows: Convert the user's query statement into a semantic vector of 1x1024 dimension , the hierarchical path of the knowledge base is regarded as a sentence and converted into a vector, and the semantic vector Match with the knowledge file path vector in the knowledge base and select the one with the highest matching degree knowledge file path, The path to the knowledge file.

2. The search enhancement generation method according to claim 1, characterized in that: The process of converting the query statement into a semantic vector is as follows: The query sentence is converted into a semantic vector using an encoding model.

3. The search enhancement generation method according to claim 1, characterized in that: The correlation is represented by cosine similarity.

4. A search enhancement generation system, characterized in that: include: An acquisition module, used to acquire a user's query statement and convert the query statement into a semantic vector; The first screening module is used to select the knowledge base with the highest total weight based on the knowledge weight and using the semantic vector. The knowledge file path corresponding to each knowledge file; The second screening module is used to select the most matching one from the knowledge base based on the path features and the semantic vector. The knowledge file path corresponding to each knowledge file; The enhancement module is used to add the highest total weight The knowledge file path corresponding to the knowledge file has the highest matching degree The knowledge file paths corresponding to the knowledge files are intersected, and the result of the intersection is used as the final knowledge file path to complete the retrieval enhancement generation; Based on the knowledge weight, the semantic vector is used to select the knowledge base with the highest total weight. The specific operations of the knowledge file path corresponding to each knowledge file are as follows: Match the semantic vector with all vectors in the knowledge base to obtain the vector with the highest matching degree. The sentence corresponding to the vector is Sentences; In the knowledge base, determine the The knowledge file to which the sentence belongs, calculates the query sentence and the The relevance of all sentences in the knowledge file to which the sentence belongs; Calculating the total weight of each knowledge file, wherein the total weight of the knowledge file is the sum of the positive correlations between each sentence in the knowledge file and the query statement; For any knowledge file, the specific operations are as follows: Calculate the average relevance between the query and all sentences in the knowledge file ; Calculate the correlation between the query statement and each sentence in the knowledge file and the average correlation differences; Summing all correlations with positive differences, and using the summed result as the total weight of the knowledge document; Select the one with the highest total weight The knowledge file path corresponding to the knowledge file is Knowledge file paths; Based on the path feature, the semantic vector is used to select the highest matching degree from the knowledge base. The specific operations of the knowledge file path corresponding to each knowledge file are as follows: Convert the user's query statement into a semantic vector of 1x1024 dimension , the hierarchical path of the knowledge base is regarded as a sentence and converted into a vector, and the semantic vector Match with the knowledge file path vector in the knowledge base and select the one with the highest matching degree knowledge file path, The path to the knowledge file.

5. 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 retrieval enhancement generation method according to any one of claims 1 to 3 are implemented.

6. 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 retrieval enhancement generation method according to any one of claims 1 to 3 are implemented.

7. A query method, characterized in that: The following steps are involved: Based on the search enhancement generation method described in any one of claims 1 to 3, a final knowledge file path is obtained; Extracting a knowledge file from a knowledge base through the final knowledge file path, reading the knowledge content of the knowledge file, and generating a prompt word according to the knowledge content of the knowledge file; The prompt word is input into the large language model to obtain the query result corresponding to the user's query statement.

8. The query method according to claim 7, characterized in that: Also includes: Output the final knowledge file path.

9. A query system, characterized in that: The following steps are involved: A retrieval enhancement module, used to obtain a final knowledge file path based on the retrieval enhancement generation method according to any one of claims 1 to 3; A generation module, used for extracting a knowledge file from a knowledge base through the final knowledge file path, reading the knowledge content of the knowledge file, and generating a prompt word according to the knowledge content of the knowledge file; The query module is used to input the prompt word into the large language model to obtain the query result corresponding to the user's query statement.