CN-119739838-B - Multi-label generation matching RAG intelligent question-answering method, device, equipment and medium
Abstract
The invention discloses a multi-label generation matching RAG intelligent question-answering method, device, equipment and medium, wherein the method comprises the steps of obtaining original text data corresponding to a target service scene, carrying out vectorization processing on the original text data to determine a text data set to be processed, determining a text label set corresponding to the text data set to be processed, establishing a text vector database based on the text label set and the text data set to be processed, determining a question text label and a question text vector corresponding to a question to be processed under the condition that a question to be processed is received, determining a text to be applied from the text vector database based on the question text to be processed, the question text label and the question text vector, and generating a target question answer corresponding to the question to be processed according to the text to be applied and a preset prompt word template. According to the technical scheme, the data source and the data label are customized according to the service scene, and the vector retrieval function is combined, so that the granularity and the accuracy of the retrieval result are obviously improved.
Inventors
- Wang Zhetian
- LIU ZHIWEI
Assignees
- 京北方信息技术股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20250303
Claims (7)
- 1. A multi-label generation matching RAG intelligent question-answering method is characterized by comprising the following steps: Acquiring original text data corresponding to a target service scene, vectorizing the original text data, and determining a text data set to be processed; Determining a text tag set corresponding to the text data set to be processed, and establishing a text vector database based on the text tag set and the text data set to be processed, wherein the text vector database is used for storing text blocks, semantic vectors and tag sets; under the condition that a to-be-processed problem is received, determining a problem text label and a problem text vector corresponding to the to-be-processed problem; determining a to-be-processed text block set from the text vector database based on to-be-processed problem text, the problem text label and the problem text vector, and determining to-be-applied text based on the to-be-processed text block set, wherein the to-be-processed text block set comprises a to-be-processed text block set determined based on text matching, a to-be-processed text block set determined based on label retrieval and a to-be-processed text block set determined based on vector retrieval; Generating a target question answer corresponding to the to-be-processed question according to the to-be-applied text and a preset prompt word template; The determining a text label set corresponding to the text data set to be processed comprises: When a preset text label set corresponding to the original text data exists, inputting the text data set to be processed and the preset text label set into a preset semantic retrieval model to obtain a candidate text label set, wherein the preset semantic retrieval model retrieves labels most relevant to the text data set to be processed from the preset text label set based on semantic similarity among text contents to generate the candidate text label set; inputting the candidate text tag set and the text data set to be processed into a large language model, and determining the text tag set corresponding to the text data set to be processed through constructed tag screening prompt words, wherein the text tag set is of a hierarchical multi-level tag structure; Under the condition that a preset text tag set corresponding to the original text data does not exist, a tag extraction prompt word corresponding to the text data set to be processed is constructed, wherein the tag extraction prompt word is a phrase or a problem which is related to the content of the text data set to be processed and can guide a large language model to generate related tags; inputting the tag extraction prompt words and the text data set to be processed into a large language model, and determining a text tag set corresponding to the text data set to be processed; The determining text to be applied based on the text block set to be processed comprises the following steps: Determining text block identifiers corresponding to the text blocks in the text block set to be processed, and performing de-duplication processing on the text block set to be processed according to the text block identifiers; Determining the comprehensive score of each text block in the to-be-processed text block set after the duplicate removal processing according to a comprehensive scoring algorithm, and determining a target text block from the to-be-processed text block set according to the comprehensive score; Acquiring the text to be applied from the text vector database based on the text block identification of the target text block; the text block set to be processed determined based on label retrieval is determined by the following steps: for each text block in the text vector database, calculating the label matching number of common labels between a label set carried by the text block and the question text labels; And screening out the text blocks with the highest corresponding tag matching number from the text vector database according to the determined screening standard so as to form the text block set to be processed.
- 2. The method of claim 1, wherein determining a set of blocks of text to be processed from the text vector database based on the question text to be processed, the question text label, and the question text vector comprises: Calculating a relevance score corresponding to each text block in the text vector database of the problem text to be processed based on a preset text matching algorithm, and determining a text block set to be processed corresponding to the problem text to be processed from the text vector database according to the relevance score; Screening text blocks to be verified, which are matched with the problem text labels, from the text vector database based on the problem text labels, calculating a relevance score between the problem text to be processed and the text blocks to be verified according to the preset text matching algorithm, and determining a text block set to be processed, which corresponds to the problem text to be processed, from the text blocks to be verified based on the relevance score; And calculating the vector similarity between each text block in the text vector database and the problem text vector based on a vector search engine, and determining a text block set to be processed corresponding to the problem text vector from the text vector database according to the vector similarity.
- 3. The method of claim 1, wherein said vectorizing the raw text data to determine a set of text data to be processed comprises: Determining a text format corresponding to the original text data, and extracting text content from the original text data according to the text format; dividing the text content according to the dividing identifier, determining each text block corresponding to the text content, and distributing text block identifiers for each text block; and determining the text data set to be processed based on the text blocks and text block identification allocated to the text blocks.
- 4. The method of claim 1, wherein the generating a target question answer corresponding to the question to be processed according to the text to be applied and a preset prompt word template comprises: Acquiring a preset prompt word template corresponding to a target service scene, and generating an answer to generate a prompt word according to the preset prompt word template and the text to be applied; And inputting the answer generation prompt word into a large language model to generate a target question answer corresponding to the to-be-processed question.
- 5. The utility model provides a many labels generate RAG intelligent question answering device that matches which characterized in that includes: The text data processing module is used for acquiring original text data corresponding to a target service scene, carrying out vectorization processing on the original text data and determining a text data set to be processed; the vector database establishing module is used for determining a text tag set corresponding to the text data set to be processed, establishing a text vector database based on the text tag set and the text data set to be processed, and storing text blocks, semantic vectors and tag sets; The system comprises a question text processing module, a question text processing module and a processing module, wherein the question text processing module is used for determining a question text label and a question text vector corresponding to a to-be-processed question under the condition that the to-be-processed question is received; A to-be-applied text determining module, configured to determine a to-be-processed text block set from the text vector database based on a to-be-processed problem text, the problem text label, and the problem text vector, and determine the to-be-applied text based on the to-be-processed text block set, where the to-be-processed text block set includes a to-be-processed text block set determined based on text matching, a to-be-processed text block set determined based on label retrieval, and a to-be-processed text block set determined based on vector retrieval; The question answer generation module is used for generating a target question answer corresponding to the to-be-processed question according to the to-be-applied text and a preset prompt word template; The vector database building module is used for inputting the text data set to be processed and the preset text label set into a preset semantic retrieval model to obtain a candidate text label set under the condition that the preset text label set corresponding to the original text data exists, wherein the preset semantic retrieval model is used for retrieving labels most relevant to the text data set to be processed from the preset text label set based on semantic similarity among text contents so as to generate the candidate text label set; inputting the candidate text tag set and the text data set to be processed into a large language model, and determining the text tag set corresponding to the text data set to be processed through constructed tag screening prompt words, wherein the text tag set is of a hierarchical multi-level tag structure; under the condition that a preset text label set corresponding to the original text data does not exist, constructing a label extraction prompt word corresponding to the text data set to be processed, wherein the label extraction prompt word is a phrase or a problem which is related to the content of the text data set to be processed and can guide a large language model to generate related labels; The text to be applied determining module is used for determining text block identifiers corresponding to all text blocks in the text block set to be processed, carrying out de-duplication processing on the text block set to be processed according to the text block identifiers, determining comprehensive scores of all text blocks in the text block set to be processed after de-duplication processing according to a comprehensive scoring algorithm, determining target text blocks from the text block set to be processed according to the comprehensive scores, and acquiring the text to be applied from the text vector database based on the text block identifiers of the target text blocks; the text block set to be processed determined based on label retrieval is determined by the following steps: for each text block in the text vector database, calculating the label matching number of common labels between a label set carried by the text block and the question text labels; And screening out the text blocks with the highest corresponding tag matching number from the text vector database according to the determined screening standard so as to form the text block set to be processed.
- 6. An electronic device, the electronic device comprising: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the multi-tag generation matching RAG intelligent question-answering method of any one of claims 1-4.
- 7. A computer readable storage medium storing computer instructions for causing a processor to implement the multi-tag generation matching RAG intelligent question-answering method of any one of claims 1-4 when executed.
Description
Multi-label generation matching RAG intelligent question-answering method, device, equipment and medium Technical Field The invention relates to the technical field of computers, in particular to a multi-label generation matching RAG intelligent question-answering method, device, equipment and medium. Background The intelligent question and answer is characterized in that the intention of a user in an input text is identified, efficient retrieval is carried out in a vector library constructed by a large-scale data set, comprehensive analysis and summarization are carried out on the user query and the retrieval result by utilizing a large language model, and finally, an answer conforming to natural language habits is generated. The existing question-answer flow comprises source data acquisition, data analysis and blocking, vectorization processing, vector library construction, user query vectorization, vector search, result processing and ranking, and answer generation and output. However, because the accuracy and relevance of vector retrieval are often limited by the quality and quantity of training data, and are difficult to flexibly adjust or customize, the traditional question-answering scheme mainly depends on vector retrieval technology, which results in that the user intention cannot be accurately understood in a specific application scene, and the generated answer is not accurate or relevant enough, so that the application range and effect of the existing intelligent question-answering system are limited. Disclosure of Invention The invention provides a multi-label generation matching RAG intelligent question-answering method, device, equipment and medium, which are used for quickly finding information related to user demands by constructing a vector database of document text label data, analyzing and summarizing by utilizing a large language model, so as to return answers to user questions, and customizing a data source and a data label according to a service scene and combining a vector retrieval function at the same time so as to improve the granularity and accuracy of retrieval results. According to one aspect of the invention, there is provided a multi-tag generation matching RAG intelligent question-answering method, comprising: acquiring original text data corresponding to a target service scene, and carrying out vectorization processing on the original text data to determine a text data set to be processed; determining a text label set corresponding to the text data set to be processed, and establishing a text vector database based on the text label set and the text data set to be processed; under the condition that a to-be-processed problem is received, determining a problem text label and a problem text vector corresponding to the to-be-processed problem; Determining a text to be applied from the text vector database based on the question text to be processed, the question text label and the question text vector; And generating a target question answer corresponding to the to-be-processed question according to the to-be-applied text and a preset prompt word template. According to another aspect of the present invention, there is provided a RAG intelligent question-answering apparatus for generating a match of multiple tags, including: the text data processing module is used for acquiring original text data corresponding to a target service scene, and carrying out vectorization processing on the original text data to determine a text data set to be processed; the vector database establishing module is used for determining a text label set corresponding to the text data set to be processed and establishing a text vector database based on the text label set and the text data set to be processed; The system comprises a question text processing module, a question text processing module and a processing module, wherein the question text processing module is used for determining a question text label and a question text vector corresponding to a to-be-processed question under the condition that the to-be-processed question is received; The text to be applied determining module is used for determining the text to be applied from the text vector database based on the problem text to be processed, the problem text label and the problem text vector; and the question answer generating module is used for generating a target question answer corresponding to the to-be-processed question according to the to-be-applied text and a preset prompt word template. According to another aspect of the present invention, there is provided an electronic apparatus including: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the multi-tag matching RAG intelligent question-answering method according to any one of the embodiments of the present inv