Knowledge recall method and device
By classifying data sources and layer-by-layer search, combined with the analysis of large language models, the problems of accurate and low efficiency of knowledge recall in the existing technology are solved, and more efficient and accurate knowledge recall is achieved.
Patent Information
- Application Number
- CN202411056164.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2024-11-15
AI Technical Summary
The existing knowledge recall method has low accuracy and complex processing process, making it difficult to effectively extract accurate information from massive data.
The data in the data source is classified into question-and-answer pairs, documents with fixed formats and documents without fixed formats, and stored in different databases respectively. The knowledge recall process is optimized through layer-by-layer search and large language model (LLM) analysis.
It improves the accuracy and efficiency of knowledge recall, ensures the accuracy and efficiency of search results, reduces the burden of LLM analysis and induction processing, and saves computing resources.
Smart Images

Figure CN118964692A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present invention relate to network communication technology, and more particularly, to a knowledge recall method and device. Background Art
[0002] With the continuous development of human society, the generation of data is growing exponentially. In such an era of big data, people hope to extract more useful information from massive data through AI big model technology to solve various complex problems. The core of AI big model knowledge retrieval technology is to use artificial intelligence technology to search the knowledge base, and by allowing the machine to understand and analyze a large amount of text information, it can quickly and accurately find the knowledge required by users.
[0003] At present, various data in the data source are usually stored as knowledge in a database. Later, when the user needs to retrieve a piece of data or a piece of knowledge, he can search from the various types of knowledge pre-stored in the database to find the target knowledge the user needs and provide it to the user, thereby realizing knowledge recall.
[0004] However, the current knowledge recall methods have low accuracy and complex processing procedures. Summary of the invention
[0005] One or more embodiments of the present invention describe a knowledge recall method and apparatus, which can improve the accuracy and efficiency of knowledge recall.
[0006] According to a first aspect, a knowledge recall method is provided, which classifies data in a data source into three forms of knowledge according to the form in which the data appears in the data source: question-answer pairs, documents with a fixed format, and documents without a fixed format;
[0007] storing each question-answer pair in the data source in a first database;
[0008] storing each document having a fixed format in the data source in a second database;
[0009] storing each document without a fixed format in the data source in a third database;
[0010] The method further includes:
[0011] Receive search questions input by users;
[0012] Matching the search question with the questions of each question-answer pair stored in the first database, and if a match is found, outputting the answer corresponding to the matched question in the first database to the user;
[0013] Then, the search question is matched in the second database. If a match is found, the knowledge in the second database related to the matched question is sent to the LLM, and the LLM analyzes and summarizes the knowledge to obtain an answer, and outputs the answer to the user.
[0014] Afterwards, the search question is matched in the third database. If a match is found, the knowledge in the third database related to the matched question is sent to LLM, which analyzes and summarizes the knowledge to obtain an answer and outputs the answer to the user.
[0015] The first database is an ES database; the second database is a first vector database; and the third database is a second vector database.
[0016] The storing each fixed-format document in the data source in the second database includes: for each fixed-format document in the data source, performing word segmentation and vectorization processing on the document according to the chapters / sections in the document, and then storing the obtained vectorized data in the first vector database;
[0017] The storing of each non-fixed-format document in the data source in the third database includes: for each non-fixed-format document in the data source, performing word segmentation and vectorization processing on the document according to a preset paragraph division method or word count division method, and then storing the obtained vectorized data in the second vector database.
[0018] The method further includes: for each question-answer pair in the data source, treating each question-answer pair as a group, performing word segmentation and vectorization processing, and then storing the obtained vectorized data in a first vector database;
[0019] The matching of the search question in the second database includes: matching the question in the vectorized question-answer pairs and the vectorized documents with a fixed format stored in the first vector database;
[0020] After matching the search question in the second database, it further includes: determining whether the search question can be matched in the questions of each question-answer pair vectorized in the first vector database; if so, sending the answer corresponding to the matched target question to LLM, which formats the answer and outputs it to the user.
[0021] When the search question is matched in any one of the first database, the second database and the third database in sequence and the answer is output, the current knowledge recall method is terminated, so that only one answer obtained according to one database is output to the user.
[0022] The search question is matched in the first database, the second database and the third database in sequence, and all answers are output according to all matched search questions, so that all answers obtained according to all databases are output to the user in sequence.
[0023] The knowledge in the second database related to the matched question includes: knowledge in the same document and in the same chapter / section as the matched question;
[0024] and / or,
[0025] The knowledge in the third database related to the matched question includes: knowledge that is in the same document and belongs to the same paragraph or the same word range as the matched question.
[0026] According to a second aspect, a knowledge recall device is provided, wherein data in a data source is pre-classified into three forms of knowledge: question-answer pairs, documents with a fixed format, and documents without a fixed format; the device comprises:
[0027] A first database, used to store each question-answer pair in the data source;
[0028] The second database is used to store each document with a fixed format in the data source;
[0029] The third database is used to store various documents without fixed formats in the data source;
[0030] A receiving module configured to receive a search question input by a user;
[0031] The database retrieval module is configured to match the retrieval question in the questions of each question-answer pair stored in the first database. If a match is found, the answer corresponding to the matched question in the first database is output to the user; thereafter, the retrieval question is matched in the second database. If a match is found, the knowledge in the second database related to the matched question is sent to the LLM, which analyzes and summarizes the knowledge to obtain an answer, and outputs the answer to the user; thereafter, the retrieval question is matched in the third database. If a match is found, the knowledge in the third database related to the matched question is sent to the LLM, which analyzes and summarizes the knowledge to obtain an answer, and outputs the answer to the user.
[0032] The database retrieval module is configured to execute:
[0033] When the search question is matched in any one of the first database, the second database and the third database in sequence, and the LLM outputs an answer according to the search question matched this time, the current knowledge recall method is terminated, so that only one answer obtained according to one database is output to the user;
[0034] or,
[0035] The search questions are matched in the first database, the second database and the third database in sequence, and the LLM outputs answers according to all the matched search questions, thereby outputting all the answers obtained according to all the databases to the user in sequence.
[0036] According to a third aspect, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method described in any embodiment of the present invention is implemented.
[0037] The knowledge recall method and device provided by each embodiment of the present invention have at least the following beneficial effects:
[0038] 1. The storage and recall of knowledge is carried out based on the form in which data / knowledge appears. In the embodiment of the present invention, the retrieval results for question-answer pairs are relatively the most accurate, the retrieval results for documents with fixed formats are the second most accurate, and the retrieval results for documents without fixed formats are the lowest in terms of accuracy. Therefore, in the embodiment of the present invention, based on the form in which knowledge appears, knowledge in different forms is stored in a database corresponding to the form, and based on the form in which knowledge appears, a layer-by-layer retrieval method is adopted, firstly searching the knowledge database for question-answer pairs, then searching the knowledge database for documents with fixed formats, and finally searching the knowledge database for documents without fixed formats. It can be seen that the method of the embodiment of the present invention searches in sequence according to the order of answer accuracy, so it can ensure that the most accurate answer is retrieved. At the same time, when the retrieval question is matched in the first database, the answer corresponding to the matched question in the first database can be directly output to the user, avoiding the LLM from performing complex analysis and induction processing. Therefore, the present invention ensures both the efficiency and accuracy of retrieval.
[0039] 2. In the knowledge recall stage, the embodiment of the present invention first attempts to retrieve similar questions from the ES database with the highest data quality. If no similarity is found or the similarity is low, it searches in vector database 1 and vector database 2 in turn, and combines the large language model (LLM) for understanding and analysis, and finally outputs a standard format or conclusion. If all databases cannot provide a match with sufficient similarity, the system will prompt the user that the current knowledge base cannot answer the question.
[0040] 3. In the embodiment of the present invention, the same question-and-answer entry can simultaneously return user-specified answers, standard formats, and other formats of data, effectively improving the search quality and reply accuracy. Compared with the data training method, it can effectively save computing resources and reduce costs, quickly learn the latest knowledge, enrich the knowledge base, and provide question-and-answer capabilities based on real-time data. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 It is a flow chart of a knowledge recall method in one embodiment of the present invention.
[0043] Figure 2 It is a schematic diagram of knowledge storage in one embodiment of the present invention.
[0044] Figure 3 It is a flow chart of a knowledge recall method in another embodiment of the present invention.
[0045] Figure 4 It is a schematic diagram of the structure of a knowledge recall device in one embodiment of the present invention.
[0046] Figure 5 It is a structural diagram of a knowledge recall device in another embodiment of the present invention. DETAILED DESCRIPTION
[0047] The solution provided by the present invention is described below in conjunction with the accompanying drawings.
[0048] First of all, it should be noted that the terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "the" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates otherwise.
[0049] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0050] In actual business implementation, the content that users may retrieve in the future, such as the explanation of a technology or the regulation of a business process flow, may appear in various forms. In the present invention, the data source in the knowledge base is analyzed, and it can be found that: in the knowledge base, various types of data / knowledge usually appear in three forms, including: question-answer pairs (usually expressed as Q&A), documents with fixed formats, and documents without fixed formats. Among them, each question-answer pair includes a question and an answer to the question. Documents with fixed formats usually have clear chapter divisions, such as regulations and rules documents with chapter divisions, academic papers with chapter divisions, etc. Documents without fixed formats usually do not have clear chapter divisions, such as an article, a speech, etc.
[0051] According to the above characteristics analyzed by the present invention, the embodiment of the present invention provides a new method for knowledge recall. Figure 1 , the method comprising:
[0052] Preprocessing process:
[0053] Step S1: According to the form in which the data appears in the data source, the data in the data source is pre-classified into three forms of knowledge: question-answer pairs, documents with a fixed format, and documents without a fixed format.
[0054] Step S3: Store each question-answer pair in the data source in the first database in advance.
[0055] Step S5: Pre-store each document with a fixed format in the data source in the second database.
[0056] Step S7: Pre-store all documents without fixed formats in the data source in the third database.
[0057] The above steps S1, S3, S5 and S7 are all preprocessing processes. For example, after performing preprocessing once, only the preprocessing process needs to be performed in each subsequent knowledge recall process according to the search question input by the user. Figure 1 The following steps 101 to 107 are shown.
[0058] Step 101: receiving a search question input by a user.
[0059] Step 103: matching the search question with the questions of each question-answer pair stored in the first database, and if a match is found, outputting the answer corresponding to the matched question in the first database to the user;
[0060] Step 105: Afterwards, the search question is matched in the second database. If a match is found, the knowledge in the second database related to the matched question is sent to the LLM, and the LLM analyzes and summarizes the knowledge to obtain an answer, and outputs the obtained answer to the user;
[0061] Step 107: Afterwards, the search question is matched in the third database. If a match is found, the knowledge in the third database related to the matched question is sent to LLM, which analyzes and summarizes the knowledge to obtain an answer, and outputs the answer to the user.
[0062] If the existing technology method is adopted, all knowledge is placed in a unified database for indiscriminate processing regardless of the form in which the knowledge appears in the data source, and all search and answer outputs are analyzed and summarized by LLM, which will greatly increase the complexity of processing and reduce the efficiency of retrieval. At the same time, if the existing technology method is adopted, all knowledge is placed in a unified database for indiscriminate processing regardless of the form in which the knowledge appears in the data source, and when performing retrieval, all knowledge is not retrieved layer by layer, but massive knowledge is retrieved together, it is very likely that due to the processing ability of LLM, the more accurate answers existing in the knowledge base will not be retrieved, but relatively inaccurate answers existing in the knowledge base will be retrieved.
[0063] On the contrary, Figure 1 In the embodiment of the present invention shown, the form of data / knowledge appearance is used as a guide to store and recall knowledge. In the embodiment of the present invention, the retrieval results for question-answer pairs are relatively the most accurate, the accuracy of the retrieval results for documents with fixed formats is second, and the accuracy of the retrieval results for documents without fixed formats is the lowest. Therefore, in the embodiment of the present invention, based on the form of knowledge appearance, knowledge of different forms is stored in the database corresponding to the form, and based on the form of knowledge appearance, a layer-by-layer retrieval method is used, first searching the knowledge database for question-answer pairs, then searching the knowledge database for documents with fixed formats, and finally searching the knowledge database for documents without fixed formats. It can be seen that the method of the embodiment of the present invention searches in sequence according to the order of answer accuracy, so it can ensure that the most accurate answer is retrieved. At the same time, when the retrieval question is matched in the first database, the answer corresponding to the matched question in the first database can be directly output to the user, avoiding the LLM from performing complex analysis and induction processing. Therefore, the present invention ensures both the efficiency and accuracy of retrieval.
[0064] The following is a specific example. Figure 1 Each of the steps shown is described separately.
[0065] First, for step S1: according to the form in which the data appears in the data source, the data in the data source is pre-classified into three forms of knowledge: question-answer pairs, documents with a fixed format, and documents without a fixed format.
[0066] By analyzing various types of data / knowledge in the knowledge base of the data source, it can be seen that various types of data / knowledge usually appear in the following three forms:
[0067] 1. Question-answer pairs. This type of knowledge actually already has clear questions and answers. When a user asks a question and triggers a search, the questions in the knowledge base can be directly searched, and the corresponding answers in the knowledge base can be directly provided to the user. In other words, this type of knowledge does not actually require a large language model (LLM) to perform relatively complex speech analysis and induction processes. The answers are ready-made and can be directly provided to the user. Because there is no need for LLM to perform analysis and induction processes, the search efficiency is greatly improved. Because the answers can be directly provided to the user, the problem of inaccurate answers after LLM analysis and induction is avoided, thereby greatly improving the efficiency and accuracy of the search;
[0068] 2. Documents with fixed formats, because this kind of knowledge has clear chapter divisions, and each section and / or chapter is usually an explanation / description of the same question. In this way, the answer obtained after word segmentation and vectorization processing according to chapters / sections is more accurate than the answer obtained without word segmentation and vectorization processing according to chapters / sections;
[0069] 3. Documents without a fixed format. Because this kind of knowledge has no clear chapter division, it can only be segmented and vectorized based on experience, and the accuracy of the answers obtained is relatively low.
[0070] Next, step S3: store each question-answer pair in the data source in the first database in advance; step S5: store each document with a fixed format in the data source in the second database in advance; step S7: store each document without a fixed format in the data source in the third database in advance.
[0071] In the embodiment of the present invention, in order to improve the subsequent retrieval efficiency, different forms of knowledge in the data source are classified and stored in their respective corresponding databases, rather than being put into the same database as in the prior art.
[0072] In one embodiment of the present invention, because the question and answer pairs already have clear questions and answers, LLM is usually not required to perform complex analysis and induction, and rapid retrieval capabilities are more needed. Therefore, the first database can be an ElasticSearch database, denoted as an ES database, and storing the question and answer pairs in the ES database can improve subsequent retrieval efficiency.
[0073] The second database may be a vector database, which is recorded as the first vector database. The third database may also be a vector database, which is recorded as the second vector database.
[0074] When the second database is a vector database, in step S5, the process of storing each fixed-format document in the data source in the second database includes: for each fixed-format document in the data source, performing word segmentation and vectorization processing on the document according to the chapters / sections in the document, and then storing the obtained vectorized data in the first vector database. Because the document is segmented and vectorized according to the chapters / sections in the document, it can be ensured that highly related data / knowledge can be stored as a whole in the first vector database, ensuring that the questions and answers retrieved subsequently are as accurate as possible.
[0075] When the third database is a vector database, in step S7, each document without a fixed format in the data source is stored in the third database, including: for each document without a fixed format in the data source, the document is segmented and vectorized according to a preset paragraph division method or word count division method, and then the obtained vectorized data is stored in the second vector database.
[0076] See also Figure 2 In one embodiment of the present invention, in order to further ensure the accuracy of the retrieved questions and answers, after storing each question-answer pair in the ES database, each question-answer pair can be further stored in the first vector database, that is, the knowledge of the document with a fixed format is stored in the same vector database. At this time, step S3 can further include: for each question-answer pair in the data source, each question-answer pair is treated as a group for word segmentation and vectorization processing, and then the obtained vectorized data is stored in the first vector database.
[0077] Next, step 101 is to receive a search question input by a user.
[0078] When a user needs to know a piece of knowledge, such as a description of a technology or detailed provisions of a regulation, he or she can enter the search question in the corresponding search box.
[0079] Next, for step 103: matching the search question with the questions of each question-answer pair stored in the first database, if a match can be found, outputting the answer corresponding to the matched question in the first database to the user.
[0080] In this step 103, the following two implementation methods may be included:
[0081] Method 1: The answer corresponding to the matched question is directly output to the user without going through LLM, thereby eliminating the processing process of LLM, improving efficiency and increasing the accuracy of the output answer.
[0082] Method 2: The answer corresponding to the matched question in the first database is first output to the LLM, and then the LLM makes simple adjustments to the answer, such as format adjustment or standard language adjustment, and then outputs the adjusted answer to the user.
[0083] It should be noted that, in the embodiment of the present invention, knowledge recall may include the following two final answer expressions:
[0084] Method A: Only provide the most accurate answer to the user.
[0085] In method A, when the search question is matched in any one of the first database, the second database and the third database in sequence and the answer is output, the search is stopped and the current knowledge recall method is ended, so that only one answer obtained based on one database is output to the user.
[0086] According to the method A, in step 103, if no match is found, step 105 is executed. If a match is found, the answer corresponding to the matched question in the first database is output to the user, and then the process ends. Figure 1 The process shown.
[0087] Method B: Multi-way recall scheme, that is, providing all answers that meet the matching requirements to the user.
[0088] In this method B, the search question is matched in the first database, the second database and the third database in order, and all answers are output according to all matched search questions, so that all answers obtained according to all databases are output to the user in order.
[0089] According to the method B, in step 103, no matter whether a match is found or not, the subsequent step 105 will be executed. Therefore, in the embodiment of the present invention, one answer, two answers or three answers can be output to the user at the same time.
[0090] Next, for step 105: matching the search question in the second database, if a match is found, the knowledge in the second database related to the matched question is sent to the LLM, which analyzes and summarizes the knowledge to obtain an answer, and outputs the answer to the user.
[0091] In this step 105, matching the search question in the second database includes: matching the question in vectorized documents with a fixed format stored in the first vector database.
[0092] Of course, if you use Figure 2 In the storage method shown, the question-answer pairs are also stored in the first vector library. Then, in this step 105, the search question is matched in the second database, including: matching the question in the vectorized question-answer pairs and the vectorized documents with a fixed format stored in the first vector database.
[0093] After matching the search question in the second database, the method further comprises:
[0094] Determine whether the search question can be matched in the questions of each question-answer pair vectorized in the first vector database. If so, send the answer corresponding to the matched target question to the LLM, which formats the answer and outputs it to the user;
[0095] It is determined whether the question can be matched in the document with a fixed format vectorized in the first vector database. If so, the knowledge in the second database related to the matched question is sent to the LLM.
[0096] The knowledge in the second database related to the matched question includes: knowledge that is in the same document and belongs to the same chapter / section as the matched question.
[0097] Step 107: Match the search question in the third database. If a match is found, the knowledge in the third database related to the matched question is sent to the LLM. The LLM analyzes and summarizes the knowledge to obtain an answer, and outputs the answer to the user.
[0098] In step 107, the knowledge in the third database related to the matched question includes: knowledge that is in the same document and belongs to the same paragraph or the same word range as the matched question.
[0099] See also Figure 2 and Figure 3 In a method of an embodiment of the present invention, a multi-way recall scheme is adopted, and the method of knowledge recall includes:
[0100] Step 301: According to the form in which the data appears in the data source, the data in the data source is pre-classified into three forms of knowledge: question-answer pairs, documents with a fixed format, and documents without a fixed format.
[0101] Step 303: Store each question-answer pair in the data source in the ES database in advance, and perform word segmentation and vectorization processing on each question-answer pair as a group, and then store them in the vector database 1.
[0102] Step 305: For each document with a fixed format in the data source, perform word segmentation and vectorization processing on the document in advance, and then store the obtained vectorized data in the vector database 1.
[0103] Step 307: For each document without a fixed format in the data source, perform word segmentation and vectorization processing on the document in advance, and then store the obtained vectorized data in the vector database 2.
[0104] Step 309: Receive a search question input by the user.
[0105] Step 311: Match the search question in the questions of each question-answer pair stored in the ES database. If a match is found, execute step 313; if not, execute step 315.
[0106] Step 313: Output the answer corresponding to the matched question in the ES database to the user.
[0107] Step 315: Match the search question in vector database 1. If a match is found, execute step 317. If a match is not found, execute step 319.
[0108] Step 317: The knowledge in the vector database 1 related to the matched question is sent to the LLM, which analyzes and summarizes the knowledge to obtain an answer, and outputs the obtained answer to the user.
[0109] Step 319: Match the search question in the vector database 2. If a match is found, execute step 321; otherwise, execute step 323.
[0110] Step 321: Send the knowledge in the vector database 2 related to the matched question to the LLM, which analyzes and summarizes the knowledge to obtain an answer, and outputs the obtained answer to the user.
[0111] Step 323: Prompt the user that the current knowledge base cannot answer the question.
[0112] An embodiment of the present invention provides a knowledge recall device, wherein the data in the data source is pre-classified into three forms of knowledge: question-answer pairs, documents with a fixed format, and documents without a fixed format; see Figure 4 , the device comprises:
[0113] The first database 401 is used to store each question-answer pair in the data source;
[0114] The second database 402 is used to store various documents with fixed formats in the data source;
[0115] The third database 403 is used to store various documents without fixed formats in the data source;
[0116] The receiving module 404 is configured to receive a search question input by a user;
[0117] The database retrieval module 405 is configured to match the retrieval question in the questions of each question-answer pair stored in the first database. If a match is found, the answer corresponding to the matched question in the first database is output to the user; thereafter, the retrieval question is matched in the second database. If a match is found, the knowledge in the second database related to the matched question is sent to the LLM, which analyzes and summarizes the knowledge to obtain the answer, and outputs the answer to the user; thereafter, the retrieval question is matched in the third database. If a match is found, the knowledge in the third database related to the matched question is sent to the LLM, which analyzes and summarizes the knowledge to obtain the answer, and outputs the answer to the user.
[0118] In one embodiment of the device of the present invention, the first database is an ES database; the second database is a first vector database; and the third database is a second vector database.
[0119] In one embodiment of the device of the present invention, see Figure 5 The device further comprises: a vector processing module 501, configured to execute:
[0120] When storing each document with a fixed format in the data source in the second database, specifically performing: for each document with a fixed format in the data source, performing word segmentation and vectorization processing on the document according to the chapters / sections in the document, and then storing the obtained vectorized data in the first vector database;
[0121] When storing each non-fixed-format document in the data source in the third database, the specific execution is: for each non-fixed-format document in the data source, the document is segmented and vectorized according to a preset paragraph division method or word count division method, and then the obtained vectorized data is stored in the second vector database.
[0122] In one embodiment of the apparatus of the present invention, the vectorization processing module 501 is further configured to execute: for each question-answer pair in the data source, perform word segmentation and vectorization processing on each question-answer pair as a group, and then store the obtained vectorized data in the first vector database;
[0123] The database retrieval module 405 is configured to execute: matching the question in the vectorized question-answer pairs and vectorized documents with a fixed format stored in the first vector database; after matching the search question in the second database, further determining whether the search question can be matched in the questions of each question-answer pair vectorized in the first vector database, and if so, sending the answer corresponding to the matched target question to the LLM, which formats the answer and outputs it to the user.
[0124] In one embodiment of the apparatus of the present invention, the database retrieval module 405 is configured to execute:
[0125] When the search question is matched in any one of the first database, the second database and the third database in sequence, and the LLM outputs an answer according to the search question matched this time, the current knowledge recall method is terminated, so that only one answer obtained according to one database is output to the user;
[0126] or,
[0127] The search questions are matched in the first database, the second database and the third database in sequence, and the LLM outputs answers according to all the matched search questions, thereby outputting all the answers obtained according to all the databases to the user in sequence.
[0128] It should be noted that the above-mentioned devices are usually implemented on the server side, and can be set on independent servers respectively, or some or all of the devices can be combined and set on the same server. The server can be a single server or a server cluster composed of multiple servers. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system. The above-mentioned devices can also be implemented on a computer terminal with strong computing power.
[0129] An embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute a method in any one of the embodiments in the specification.
[0130] An embodiment of the present invention provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method in any embodiment of the specification is implemented.
[0131] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the device of the embodiment of the present invention. In other embodiments of the specification, the above-mentioned device may include more or fewer components than those shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0132] The various embodiments of the present invention are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0133] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, widgets, or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0134] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.
Claims
1. A knowledge recall method, characterized in that: According to the form in which the data appears in the data source, the data in the data source is classified into three forms of knowledge: question-answer pairs, documents with fixed formats, and documents without fixed formats; storing each question-answer pair in the data source in a first database; storing each document having a fixed format in the data source in a second database; storing each document without a fixed format in the data source in a third database; The method further includes: Receive search questions input by users; Matching the search question with the questions of each question-answer pair stored in the first database, and if a match is found, outputting the answer corresponding to the matched question in the first database to the user; Then, the search question is matched in the second database. If a match is found, the knowledge in the second database related to the matched question is sent to the LLM, and the LLM analyzes and summarizes the knowledge to obtain an answer, and outputs the answer to the user. Afterwards, the search question is matched in the third database. If a match is found, the knowledge in the third database related to the matched question is sent to LLM, which analyzes and summarizes the knowledge to obtain an answer and outputs the answer to the user.
2. The method according to claim 1, characterized in that The first database is an ES database; the second database is a first vector database; and the third database is a second vector database.
3. The method according to claim 2, characterized in that The storing each fixed-format document in the data source in the second database includes: for each fixed-format document in the data source, performing word segmentation and vectorization processing on the document according to the chapters / sections in the document, and then storing the obtained vectorized data in the first vector database; The storing of each non-fixed-format document in the data source in the third database includes: for each non-fixed-format document in the data source, performing word segmentation and vectorization processing on the document according to a preset paragraph division method or word count division method, and then storing the obtained vectorized data in the second vector database.
4. The method according to claim 3, characterized in that The method further includes: for each question-answer pair in the data source, treating each question-answer pair as a group, performing word segmentation and vectorization processing, and then storing the obtained vectorized data in a first vector database; The matching of the search question in the second database includes: matching the question in the vectorized question-answer pairs and the vectorized documents with a fixed format stored in the first vector database; After matching the search question in the second database, it further includes: determining whether the search question can be matched in the questions of each question-answer pair vectorized in the first vector database; if so, sending the answer corresponding to the matched target question to LLM, which formats the answer and outputs it to the user.
5. The method according to any one of claims 1 to 4, characterized in that: When the search question is matched in any one of the first database, the second database and the third database in sequence and the answer is output, the current knowledge recall method is terminated, so that only one answer obtained according to one database is output to the user.
6. The method according to any one of claims 1 to 4, characterized in that: The search question is matched in the first database, the second database and the third database in sequence, and all answers are output according to all matched search questions, so that all answers obtained according to all databases are output to the user in sequence.
7. The method according to claim 1, characterized in that The knowledge in the second database related to the matched question includes: knowledge in the same document and in the same chapter / section as the matched question; and / or, The knowledge in the third database related to the matched question includes: knowledge that is in the same document and belongs to the same paragraph or the same word range as the matched question.
8. The knowledge recall device is characterized by: The data in the data source is pre-classified into three forms of knowledge: question-answer pairs, documents with a fixed format, and documents without a fixed format; the device includes: A first database, used to store each question-answer pair in the data source; The second database is used to store each document with a fixed format in the data source; The third database is used to store various documents without fixed formats in the data source; A receiving module configured to receive a search question input by a user; The database retrieval module is configured to match the retrieval question in the questions of each question-answer pair stored in the first database. If a match is found, the answer corresponding to the matched question in the first database is output to the user; thereafter, the retrieval question is matched in the second database. If a match is found, the knowledge in the second database related to the matched question is sent to the LLM, which analyzes and summarizes the knowledge to obtain an answer, and outputs the answer to the user; thereafter, the retrieval question is matched in the third database. If a match is found, the knowledge in the third database related to the matched question is sent to the LLM, which analyzes and summarizes the knowledge to obtain an answer, and outputs the answer to the user.
9. The device according to claim 8, characterized in that The database retrieval module is configured to execute: When the search question is matched in any one of the first database, the second database and the third database in sequence, and the LLM outputs an answer according to the search question matched this time, the current knowledge recall method is terminated, so that only one answer obtained according to one database is output to the user; or, The search questions are matched in the first database, the second database and the third database in sequence, and the LLM outputs answers according to all the matched search questions, thereby outputting all the answers obtained according to all the databases to the user in sequence.
10. A computing device comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 6 is implemented.
