RAG-based information retrieval method and device, storage medium and equipment
By using the decision model in RAG information retrieval to reasonably allocate the database token ratio and results, the problem of single information type is solved and the accuracy of information retrieval is improved.
Patent Information
- Application Number
- CN202510611459.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-13
- Publication Date
- 2025-10-03
AI Technical Summary
In the existing RAG information retrieval method, the question-answering model can only select one database for information retrieval at a time, resulting in a relatively single type of information retrieved, which affects the accuracy of information retrieval.
The token ratio of each database is determined through a pre-trained decision model, and the token results of the database are generated based on the search statement and the total number of tokens that can be input into the question-answering model. These results are spliced into prompt words for the question-answering model, and processed using the question-answering model to obtain the search results.
Reasonably distribute the token results provided by different databases to avoid introducing irrelevant tokens and improve the accuracy of information retrieval.
Smart Images

Figure CN120743944A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of deep learning technology, and in particular to a RAG-based information retrieval method, apparatus, storage medium, and device. Background Art
[0002] Retrieval-Augmented Generation (RAG) is a cutting-edge technology that combines language models and information retrieval techniques.
[0003] When performing information retrieval based on RAG, the user enters a query statement into the question-answering model. Based on the user's needs or the characteristics of the query statement, the model selects a relevant database from multiple databases, retrieves relevant information from the selected database, and then uses this retrieved information to guide the generation of text answers. This approach can significantly improve the quality and accuracy of predictions and reduce the problem of hallucinations that occur when the question-answering model generates text. For example, if you need to process large amounts of unstructured data and perform fast similarity searches, a vector database is recommended; if you need to process complex relational networks and perform relationship analysis, a graph database is recommended.
[0004] However, the question-answering model can only select one database for information retrieval at a time, resulting in a relatively single type of information retrieved and an inability to accurately express the semantics of the search statement, thus affecting the accuracy of information retrieval. Summary of the Invention
[0005] This application provides a RAG-based information retrieval method, apparatus, storage medium, and device to address the problem that the retrieved information type is relatively single, affecting the accuracy of information retrieval. The technical solution is as follows:
[0006] According to a first aspect of the present application, a RAG-based information retrieval method is provided, the method comprising:
[0007] Get the search statement entered by the user;
[0008] Process the search statement using a pre-trained decision model to obtain the word segmentation token ratio of each database in the database set, where the database set is the set of all databases connected to the question-answering model when performing information retrieval based on RAG;
[0009] For each database, generate a token result for the database based on the search statement, the token ratio corresponding to the database, and the total number of tokens that can be input into the question-answering model;
[0010] Concatenate the token results of all databases into prompt words for the question-answering model;
[0011] The prompt word is processed using the question-answer model to obtain a retrieval result for the retrieval statement.
[0012] In one possible implementation, for each database, generating a token result for the database based on the search statement, the token ratio corresponding to the database, and the total number of tokens that can be input into the question-answering model includes:
[0013] For each database, multiply the total number of tokens that the question-answering model can input by the token ratio corresponding to the database to obtain the number of tokens corresponding to the database;
[0014] Processing the search statement using the database to obtain a processing result, wherein the processing result includes a plurality of tokens sorted in descending order of relevance to the search statement;
[0015] The token that is ranked first in the processing result and corresponds to the number of tokens is determined as the token result of the database.
[0016] In a possible implementation, the processing the search statement using the database to obtain a processing result includes:
[0017] When the database is an ES database, the ES database is used to perform text matching on the search statement to obtain a processing result;
[0018] When the database is a vector database, performing semantic matching on the search statement using the vector database to obtain a processing result;
[0019] When the database is a graph database, the graph database is used to extract entity relationships from the search statement, a knowledge graph is established based on the entity relationships, and the knowledge graph is matched to obtain a processing result.
[0020] In a possible implementation, the token results of all databases are spliced into context prompt words of the question-answering model, including:
[0021] Get the splicing order of each database;
[0022] The token results corresponding to each database are spliced in the splicing order to obtain the context prompt words of the question-answering model.
[0023] In a possible implementation, the method further includes:
[0024] Obtaining a training set, where each set of training samples in the training set includes a search statement and annotation information, and the annotation information includes an actual token ratio of each database in the database set;
[0025] Create decision-making models;
[0026] For each training sample, the search statement is processed using the decision model to obtain a predicted token ratio for each database in the database set;
[0027] Use the preset loss function to calculate the loss value of the predicted token ratio and the actual token ratio of each database;
[0028] The model parameters of the decision model are updated according to the loss value until the model parameters meet the training requirements to obtain a trained decision model.
[0029] According to a second aspect of the present application, a RAG-based information retrieval device is provided, the device comprising:
[0030] The statement acquisition module is used to obtain the search statement input by the user;
[0031] A ratio determination module is used to process the search statement using a pre-trained decision model to obtain the word segmentation token ratio of each database in the database set, where the database set is the set of all databases connected to the question-answering model when performing information retrieval based on RAG;
[0032] A token generation module is used to generate a token result for each database based on the search statement, the token ratio corresponding to the database, and the total number of tokens that can be input into the question-answering model;
[0033] A prompt word generation module is used to combine the token results of all databases into prompt words for the question-answering model;
[0034] The result generation module is used to process the prompt word using the question-answering model to obtain a search result for the search statement.
[0035] In one possible implementation, the token generation module is further configured to:
[0036] For each database, multiply the total number of tokens that the question-answering model can input by the token ratio corresponding to the database to obtain the number of tokens corresponding to the database;
[0037] Processing the search statement using the database to obtain a processing result, wherein the processing result includes a plurality of tokens sorted in descending order of relevance to the search statement;
[0038] The token that is ranked first in the processing result and corresponds to the number of tokens is determined as the token result of the database.
[0039] In one possible implementation, the token generation module is further configured to:
[0040] When the database is an ES database, the ES database is used to perform text matching on the search statement to obtain a processing result;
[0041] When the database is a vector database, performing semantic matching on the search statement using the vector database to obtain a processing result;
[0042] When the database is a graph database, the graph database is used to extract entity relationships from the search statement, a knowledge graph is established based on the entity relationships, and the knowledge graph is matched to obtain a processing result.
[0043] According to a third aspect of the present application, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the RAG-based information retrieval method as described above.
[0044] According to a fourth aspect of the present application, a computer device is provided, comprising the above-mentioned RAG-based information retrieval apparatus.
[0045] The beneficial effects of the technical solution provided by this application include at least:
[0046] By using a pre-trained decision model to process the search statement, the token ratio of each database in the database collection is obtained; then, for each database, the database token results are generated based on the search statement, the corresponding token ratio of the database, and the total number of tokens that can be input into the question-answering model; the token results of all databases are spliced into the prompt words of the question-answering model; the prompt words are processed using the question-answering model to obtain the retrieval results for the search statement. In this way, the token results provided by different databases can be reasonably distributed, avoiding the introduction of irrelevant tokens, and enabling RAG to obtain more accurate answers. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0048] Figure 1 is a flowchart of a RAG-based information retrieval method provided by an embodiment of the present application;
[0049] Figure 2 is a flowchart of a RAG-based information retrieval method provided by an embodiment of the present application;
[0050] Figure 3 This is a training flow chart of a decision model provided by one embodiment of the present application;
[0051] Figure 4 This is a structural block diagram of a RAG-based information retrieval device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0052] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0053] like Figure 1 As shown, it shows a method flow chart of a RAG-based information retrieval method provided by an embodiment of the present application, which can be applied to a computer device. The RAG-based information retrieval method may include:
[0054] Step 101: Obtain the search statement input by the user.
[0055] A search query is a question that a user asks in a question-answering model. For example, a search query might be "Xiaoming is a middle school student. How does this product help him learn physics?"
[0056] Step 102: Use the pre-trained decision model to process the search statement to obtain the token ratio of each database in the database set. The database set is the set of all databases connected to the question-answering model when performing information retrieval based on RAG.
[0057] In this embodiment, when performing information retrieval based on RAG, the question-answering model needs to establish a connection with all databases in the database set. Then, each database will obtain multiple tokens (word segmentations) after performing certain processing on the search statement. Finally, the question-answering model infers based on these tokens to obtain the answer to the search statement, that is, the search result.
[0058] However, the total number of tokens that can be input into a question-answering model is fixed. Some databases introduce a large number of irrelevant tokens after processing search statements, wasting the available tokens. For example, when using a graph database's knowledge graph for token processing, the complexity of the connections between knowledge means that tokens can contain a large number of irrelevant entities and relationships, increasing the length of the context. Therefore, it is necessary to optimize the tokens after database processing to conserve tokens. It is also necessary to reasonably allocate the token ratio for each database based on the search statement to enable the question-answering model to obtain more accurate search results.
[0059] The decision model is used to determine the token ratio of each database based on the search statement. Specifically, the input of the decision model is the search statement, and the output is the token ratio of each database. The decision model can be trained by the computer device itself or obtained from other devices. This embodiment does not limit the source of the decision model.
[0060] Step 103: For each database, generate a token result for the database based on the search statement, the token ratio corresponding to the database, and the total number of tokens that can be input into the question-answering model.
[0061] The token results for each database are selected based on the token ratio. For example, if the total token count is 100,000, and the database collection contains 20% ES database tokens, 50% vector database tokens, and 30% graph database tokens, then the final number of token results selected from the ES database is 20,000, the final number of token results selected from the vector database is 50,000, and the final number of token results selected from the graph database is 30,000.
[0062] Step 104: Concatenate the token results of all databases into prompt words for the question-answering model.
[0063] The number of prompt words formed by concatenating the token results of all databases is equal to the total number of tokens.
[0064] In this embodiment, the computer device may randomly splice all token results into a prompt word, or may splice all token results into a prompt word in a fixed order.
[0065] Step 105: Process the prompt word using the question-answer model to obtain a search result for the search statement.
[0066] The question-answering model can infer the prompt words and use the inference results as the final retrieval results.
[0067] To summarize, the RAG-based information retrieval method provided in the embodiment of the present application processes the search statement using a pre-trained decision model to obtain the token ratio of each database in the database set; then, for each database, the database token result is generated based on the search statement, the token ratio corresponding to the database, and the total number of tokens that can be input into the question-answering model; the token results of all databases are spliced into the prompt words of the question-answering model; the prompt words are processed using the question-answering model to obtain the retrieval results for the search statement. In this way, the token results provided by different databases can be reasonably allocated to avoid introducing irrelevant tokens, so that RAG can obtain more accurate answers.
[0068] like Figure 2 As shown, it shows a flowchart of a RAG-based information retrieval method provided by an embodiment of the present application, which can be applied to a computer device. The RAG-based information retrieval method may include:
[0069] Step 201: Obtain the search statement input by the user.
[0070] A search query is a question that a user asks in a question-answering model. For example, a search query might be "Xiaoming is a middle school student. How does this product help him learn physics?"
[0071] In step 202, the search statement is processed using a pre-trained decision model to obtain the token ratio of each database in the database set. The database set is the set of all databases connected to the question-answering model when performing information retrieval based on RAG.
[0072] In this embodiment, when performing information retrieval based on RAG, the question-answering model needs to establish a connection with all databases in the database set. Then, each database will obtain multiple tokens (word segmentations) after performing certain processing on the search statement. Finally, the question-answering model infers based on these tokens to obtain the answer to the search statement, that is, the search result.
[0073] However, the total number of tokens that can be input into a question-answering model is fixed. Some databases introduce a large number of irrelevant tokens after processing search statements, wasting the available tokens. For example, when using a graph database's knowledge graph for token processing, the complexity of the connections between knowledge means that tokens can contain a large number of irrelevant entities and relationships, increasing the length of the context. Therefore, it is necessary to optimize the tokens after database processing to conserve tokens. It is also necessary to reasonably allocate the token ratio for each database based on the search statement to enable the question-answering model to obtain more accurate search results.
[0074] The decision model is used to determine the token ratio of each database based on the search statement. Specifically, the input of the decision model is the search statement, and the output is the token ratio of each database. The decision model can be trained by the computer device itself or obtained from other devices. This embodiment does not limit the source of the decision model.
[0075] Step 203: For each database, multiply the total number of tokens that can be input into the question-answering model by the token ratio corresponding to the database to obtain the number of tokens corresponding to the database.
[0076] For example, if the total number of tokens is 100k, the proportion of ES database tokens in the database collection is 20%, the proportion of vector database tokens is 50%, and the proportion of graph database tokens is 30%. Then the number of token results finally selected by the ES database is 20k, the number of token results finally selected by the vector database is 50k, and the number of token results finally selected by the graph database is 30k.
[0077] Step 204: Process the search statement using the database to obtain a processing result, which includes multiple tokens sorted in descending order of relevance to the search statement.
[0078] Different databases use different processing methods to process search statements. The following uses ES database, vector database, and graph database as examples to illustrate.
[0079] Specifically, using the database to process the search statement to obtain the processing results may include:
[0080] (1) When the database is an ES database, the ES database is used to perform text matching on the search statement to obtain the processing result.
[0081] After the ES database tokenizes the search statement, it matches multiple tokens in the corpus according to their literal meaning and sorts the matched tokens in descending order of relevance to the search statement.
[0082] (2) When the database is a vector database, the vector database is used to perform semantic matching on the search statement to obtain the processing result.
[0083] The vector database performs semantic extraction on the search statement, matches multiple tokens in the corpus based on the extraction results, and sorts the matched tokens in descending order of relevance to the search statement.
[0084] (3) When the database is a graph database, the graph database is used to extract entity relationships from the search statement, a knowledge graph is established based on the entity relationships, and the knowledge graph is matched to obtain the processing results.
[0085] The graph database extracts the entity relationships between each entity in the search statement, then builds a knowledge graph based on the entity relationships, matches multiple tokens from the knowledge graph, and sorts the matched tokens in descending order according to their relevance to the search statement.
[0086] Step 205: Determine the token that is ranked first in the processing result and corresponds to the token quantity as the token result of the database.
[0087] Step 206: Concatenate the token results of all databases into prompt words for the question-answering model.
[0088] The number of prompt words formed by concatenating the token results of all databases is equal to the total number of tokens.
[0089] In this embodiment, the computer device may randomly splice all token results into a prompt word, or may splice all token results into a prompt word in a fixed order.
[0090] Specifically, splicing the token results of all databases into context prompt words of the question-answering model can include: obtaining the splicing order of each database; splicing the token results corresponding to each database according to the splicing order to obtain the context prompt words of the question-answering model.
[0091] Step 207: Process the prompt word using the question-answer model to obtain a search result for the search statement.
[0092] The question-answering model can infer the prompt words and use the inference results as the final retrieval results.
[0093] To summarize, the RAG-based information retrieval method provided in the embodiment of the present application processes the search statement using a pre-trained decision model to obtain the token ratio of each database in the database set; then, for each database, the database token result is generated based on the search statement, the token ratio corresponding to the database, and the total number of tokens that can be input into the question-answering model; the token results of all databases are spliced into the prompt words of the question-answering model; the prompt words are processed using the question-answering model to obtain the retrieval results for the search statement. In this way, the token results provided by different databases can be reasonably allocated to avoid introducing irrelevant tokens, so that RAG can obtain more accurate answers.
[0094] The decision model in this application can be trained by the computer device itself or obtained from other devices. If the computer device needs to train the decision model, it can be trained by Figure 3 The training method shown is used to train the decision model, and the training method includes:
[0095] Step 301: Obtain a training set. Each set of training samples in the training set includes a search statement and annotation information. The annotation information includes the actual token ratio of each database in the database set.
[0096] For example, the search statement in a training sample is "Xiao Ming is a middle school student. How does this product help him learn physics?" The token ratio of the ES database is 20%, the token ratio of the vector database is 50%, and the token ratio of the graph database is 30%.
[0097] Step 302: Create a decision model.
[0098] The decision model can be arbitrarily large.
[0099] Step 303: For each training sample, the search statement in the training sample is processed using the decision model to obtain the predicted token ratio of each database in the database set.
[0100] In step 304, a loss value between the predicted token ratio and the actual token ratio of each database is calculated using a preset loss function.
[0101] Step 305: Update the model parameters of the decision model according to the loss value until the model parameters meet the training requirements to obtain a trained decision model.
[0102] The model parameters that meet the training requirements are brought into the decision model to obtain a trained decision model.
[0103] like Figure 4 As shown, it shows a structural block diagram of a RAG-based information retrieval device provided by an embodiment of the present application. The RAG-based information retrieval device can be applied to a computer device. The SOC includes:
[0104] The statement acquisition module 410 is used to acquire the search statement input by the user;
[0105] Ratio determination module 420, for processing the search statement using a pre-trained decision model to obtain a token ratio for each database in a database set, where the database set is the set of all databases connected to the question-answering model when performing information retrieval based on RAG;
[0106] The token generation module 430 is used to generate a database token result for each database based on the search statement, the token ratio corresponding to the database, and the total number of tokens that can be input into the question-answering model;
[0107] The prompt word generation module 440 is used to combine the token results of all databases into prompt words for the question-answering model;
[0108] The result generation module 450 is used to process the prompt words using the question-answering model to obtain the search results for the search statement.
[0109] In an optional embodiment, the token generation module 430 is further configured to:
[0110] For each database, multiply the total number of tokens that the question-answering model can input by the token ratio corresponding to the database to obtain the number of tokens corresponding to the database;
[0111] Using the database to process the search statement to obtain a processing result, the processing result includes multiple tokens sorted in descending order of relevance to the search statement;
[0112] The token that is sorted first in the processing result and corresponds to the token quantity is determined as the token result of the database.
[0113] In an optional embodiment, the token generation module 430 is further configured to:
[0114] When the database is an ES database, the ES database is used to perform text matching on the search statement to obtain the processing result;
[0115] When the database is a vector database, the vector database is used to perform semantic matching on the search statement to obtain the processing result;
[0116] When the database is a graph database, the graph database is used to extract entity relationships from the search statement, a knowledge graph is established based on the entity relationships, and the knowledge graph is matched to obtain the processing results.
[0117] In an optional embodiment, the prompt word generating module 440 is further configured to:
[0118] Get the splicing order of each database;
[0119] The token results corresponding to each database are spliced in the splicing order to obtain the context prompt words of the question-answering model.
[0120] In an optional embodiment, the device further includes a training module for:
[0121] Obtain a training set. Each set of training samples in the training set includes a search statement and annotation information. The annotation information includes the actual token ratio of each database in the database set.
[0122] Create decision-making models;
[0123] For each training sample, the decision model is used to process the search statement to obtain the predicted token ratio of each database in the database set;
[0124] Use the preset loss function to calculate the loss value of the predicted token ratio and the actual token ratio of each database;
[0125] The model parameters of the decision model are updated according to the loss value until the model parameters meet the training requirements to obtain a trained decision model.
[0126] To sum up, the RAG-based information retrieval device provided in the embodiment of the present application processes the search statement by using a pre-trained decision model to obtain the token ratio of each database in the database set; then, for each database, the database token result is generated according to the search statement, the token ratio corresponding to the database and the total number of tokens that can be input into the question-answering model; the token results of all databases are spliced into the prompt words of the question-answering model; the prompt words are processed using the question-answering model to obtain the retrieval result of the search statement. In this way, the token results provided by different databases can be reasonably allocated to avoid the introduction of irrelevant tokens, so that RAG can obtain more accurate answers.
[0127] One embodiment of the present application provides a computer-readable storage medium, wherein the storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the RAG-based information retrieval method described above.
[0128] An embodiment of the present application provides a computer device, which includes any of the above-mentioned RAG-based information retrieval devices.
[0129] It should be noted that the RAG-based information retrieval device provided in the above embodiment only uses the division of the above functional modules as an example when performing RAG-based information retrieval. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the RAG-based information retrieval device can be divided into different functional modules to complete all or part of the functions described above. In addition, the RAG-based information retrieval device provided in the above embodiment and the RAG-based information retrieval method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0130] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0131] The above description is not intended to limit the embodiments of the present application. Any adjustments, equivalent replacements, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the embodiments of the present application.
Claims
1. A RAG-based information retrieval method, characterized in that: The method comprises: Get the search statement entered by the user; Process the search statement using a pre-trained decision model to obtain the word segmentation token ratio of each database in the database set, where the database set is the set of all databases connected to the question-answering model when performing information retrieval based on RAG; For each database, generate a token result for the database based on the search statement, the token ratio corresponding to the database, and the total number of tokens that can be input into the question-answering model; Concatenate the token results of all databases into prompt words for the question-answering model; The prompt word is processed using the question-answer model to obtain a retrieval result for the retrieval statement.
2. The RAG-based information retrieval method according to claim 1, characterized in that: For each database, generating a token result for the database based on the search statement, the token ratio corresponding to the database, and the total number of tokens that can be input into the question-answering model includes: For each database, multiply the total number of tokens that the question-answering model can input by the token ratio corresponding to the database to obtain the number of tokens corresponding to the database; Processing the search statement using the database to obtain a processing result, wherein the processing result includes a plurality of tokens sorted in descending order of relevance to the search statement; The token that is ranked first in the processing result and corresponds to the number of tokens is determined as the token result of the database.
3. The RAG-based information retrieval method according to claim 2, characterized in that: The process of processing the search statement using the database to obtain a processing result includes: When the database is an ES database, the ES database is used to perform text matching on the search statement to obtain a processing result; When the database is a vector database, performing semantic matching on the search statement using the vector database to obtain a processing result; When the database is a graph database, the graph database is used to extract entity relationships from the search statement, a knowledge graph is established based on the entity relationships, and the knowledge graph is matched to obtain a processing result.
4. The RAG-based information retrieval method according to claim 1, characterized in that: The token results of all databases are spliced into the context prompt words of the question-answering model, including: Get the splicing order of each database; The token results corresponding to each database are spliced in the splicing order to obtain the context prompt words of the question-answering model.
5. The RAG-based information retrieval method according to any one of claims 1 to 4, characterized in that: The method further comprises: Obtaining a training set, where each set of training samples in the training set includes a search statement and annotation information, and the annotation information includes an actual token ratio of each database in the database set; Create decision-making models; For each training sample, the search statement is processed using the decision model to obtain a predicted token ratio for each database in the database set; Use the preset loss function to calculate the loss value of the predicted token ratio and the actual token ratio of each database; The model parameters of the decision model are updated according to the loss value until the model parameters meet the training requirements to obtain a trained decision model.
6. An information retrieval device based on RAG, characterized in that: The device comprises: The statement acquisition module is used to obtain the search statement input by the user; A ratio determination module is used to process the search statement using a pre-trained decision model to obtain the word segmentation token ratio of each database in the database set, where the database set is the set of all databases connected to the question-answering model when performing information retrieval based on RAG; A token generation module is used to generate a token result for each database based on the search statement, the token ratio corresponding to the database, and the total number of tokens that can be input into the question-answering model; A prompt word generation module is used to combine the token results of all databases into prompt words for the question-answering model; The result generation module is used to process the prompt word using the question-answering model to obtain a search result for the search statement.
7. The RAG-based information retrieval device according to claim 6, characterized in that: The token generation module is also used to: For each database, multiply the total number of tokens that the question-answering model can input by the token ratio corresponding to the database to obtain the number of tokens corresponding to the database; Processing the search statement using the database to obtain a processing result, wherein the processing result includes a plurality of tokens sorted in descending order of relevance to the search statement; The token that is ranked first in the processing result and corresponds to the number of tokens is determined as the token result of the database.
8. The RAG-based information retrieval device according to claim 7, characterized in that: The token generation module is also used to: When the database is an ES database, the ES database is used to perform text matching on the search statement to obtain a processing result; When the database is a vector database, performing semantic matching on the search statement using the vector database to obtain a processing result; When the database is a graph database, the graph database is used to extract entity relationships from the search statement, a knowledge graph is established based on the entity relationships, and the knowledge graph is matched to obtain a processing result.
9. A computer-readable storage medium, characterized in that The storage medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the RAG-based information retrieval method according to any one of claims 1 to 5.
10. A computer device, characterized in that: The computer device includes the RAG-based information retrieval device according to any one of claims 6 to 8.