Information retrieval method, device and equipment, readable storage medium and program product
By extracting metadata from information query statements from the chat software for dialogue record database search, generating information query prompt words and using a large language model, the problem of historical dialogue search function relying on keyword retrieval in traditional chat software is solved, and more accurate and efficient information retrieval is achieved.
Patent Information
- Application Number
- CN202411757566.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-04
AI Technical Summary
The historical dialogue search function of traditional chat software relies on keyword search, which causes users to spend a lot of energy to recall keywords, and when they cannot recall accurate vocabulary, the search results are inaccurate.
By extracting multiple metadata from the information query statement input by the user, searching in the dialogue record database as filter conditions, multiple target topic fragments are obtained, and information query prompt words are determined based on these fragments, and information retrieval results are finally generated using the large language model.
It improves the accuracy of information retrieval results, reduces the difficulty of users recalling keywords, and improves the search efficiency, allowing users to find the required information more quickly.
Smart Images

Figure CN119557462A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an information retrieval method, apparatus, device, readable storage medium and program product. Background Art
[0002] Traditional chat software usually has a historical conversation search function, which is mainly achieved through keyword search. Users need to enter keywords, and then the system will return chat records related to the keywords. However, this method requires users to spend a lot of energy to recall and search for keywords, especially when they cannot recall the exact words, there is a problem of inaccurate search results. Summary of the invention
[0003] Based on this, it is necessary to provide an information retrieval method, apparatus, computer device, computer-readable storage medium and computer program product to address the above technical problems, which can improve the accuracy of retrieval results.
[0004] In a first aspect, the present application provides an information retrieval method, comprising:
[0005] Upon receiving an information query statement input by a user, extracting a plurality of metadata from the information query statement;
[0006] Using multiple metadata as filtering conditions, searching in the conversation record database to obtain multiple target topic segments; each target topic segment includes multiple conversation records and corresponding topics;
[0007] Based on multiple target topic segments, determine information query prompt words;
[0008] Based on the information query prompt words and the large language model, an information retrieval result generated by the large language model is obtained.
[0009] In one embodiment, multiple metadata are extracted from the information query statement, including:
[0010] Obtain preset prompt words; the preset prompt words include extraction requirement template, text to be extracted, and information type to be extracted;
[0011] The information query sentence is used as the text to be extracted from the preset prompt words to obtain the combined prompt words;
[0012] Based on the combined prompt words, multiple metadata are generated through a large language model.
[0013] In one embodiment, the plurality of metadata includes topic data, key query information, conversation objects, and start and end time points; the plurality of metadata is used as filtering conditions to retrieve a plurality of target topic segments in a conversation record database, including:
[0014] A plurality of topic segments in a conversation record database are searched to obtain a plurality of target topic segments whose relevance to the plurality of metadata meets a preset relevance condition.
[0015] In one embodiment, based on multiple target topic segments, determining information query prompt words includes:
[0016] Obtain a prompt word template; the prompt word template includes a generation requirement template, reference information and requirement information;
[0017] The multiple target topic fragments are used as reference information of the prompt word template, and the key query information in the multiple metadata is used as the requirement information of the prompt word template to obtain the information query prompt word.
[0018] In one embodiment, the steps of constructing a conversation record database include:
[0019] Get multiple continuous historical conversation records;
[0020] Separate multiple continuous historical conversation records into topics to obtain multiple topic segments; each topic segment contains multiple conversation records and corresponding topics;
[0021] Construct a conversation record database based on multiple topic segments.
[0022] In one embodiment, multiple continuous historical conversation records are separated into topics to obtain multiple topic segments, including:
[0023] Semantic analysis is performed on multiple continuous historical conversation records to obtain topics corresponding to the multiple continuous historical conversation records;
[0024] Multiple continuous conversation records belonging to the same topic in multiple continuous historical conversation records are taken as a topic segment to obtain multiple topic segments.
[0025] In a second aspect, the present application also provides an information retrieval device, comprising:
[0026] The extraction module is used to extract multiple metadata from the information query statement when receiving the information query statement input by the user;
[0027] A retrieval module, used to use multiple metadata as filtering conditions to search the conversation record database to obtain multiple target topic segments; each target topic segment includes multiple conversation records and corresponding topics;
[0028] A determination module, used for determining information query prompt words based on multiple target topic segments;
[0029] The generation module is used to obtain information retrieval results generated by the large language model based on the information query prompt words and the large language model.
[0030] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0031] Upon receiving an information query statement input by a user, extracting a plurality of metadata from the information query statement;
[0032] Using multiple metadata as filtering conditions, searching in the conversation record database to obtain multiple target topic segments; each target topic segment includes multiple conversation records and corresponding topics;
[0033] Based on multiple target topic segments, determine information query prompt words;
[0034] Based on the information query prompt words and the large language model, an information retrieval result generated by the large language model is obtained.
[0035] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:
[0036] Upon receiving an information query statement input by a user, extracting a plurality of metadata from the information query statement;
[0037] Using multiple metadata as filtering conditions, searching in the conversation record database to obtain multiple target topic segments; each target topic segment includes multiple conversation records and corresponding topics;
[0038] Based on multiple target topic segments, determine information query prompt words;
[0039] Based on the information query prompt words and the large language model, an information retrieval result generated by the large language model is obtained.
[0040] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0041] Upon receiving an information query statement input by a user, extracting a plurality of metadata from the information query statement;
[0042] Using multiple metadata as filtering conditions, searching in the conversation record database to obtain multiple target topic segments; each target topic segment includes multiple conversation records and corresponding topics;
[0043] Based on multiple target topic segments, determine information query prompt words;
[0044] Based on the information query prompt words and the large language model, an information retrieval result generated by the large language model is obtained.
[0045] The above-mentioned information retrieval method, apparatus, computer equipment, computer-readable storage medium and computer program product, by extracting multiple metadata from the information query statement when receiving the information query statement input by the user, is conducive to accurately understanding the user's query needs; using multiple metadata as filtering conditions is conducive to quickly retrieving multiple target topic fragments related to the user's needs from the conversation record database, thereby improving the retrieval efficiency; in addition, based on the multiple target topic fragments, the information query prompt words are determined, the information query prompt words contain conversation records and corresponding topics, and the information query prompt words are used as input prompts of the large language model. The language understanding and generation capabilities of the large language model are used to accurately understand the user's search intention, thereby generating more accurate information retrieval results that are more in line with user needs, thereby improving the accuracy of the information retrieval results. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0047] FIG1 is a diagram of an application environment of an information retrieval method in one embodiment;
[0048] FIG2 is a schematic diagram of a flow chart of an information retrieval method in one embodiment;
[0049] FIG3 is a schematic diagram of the overall flow of an information retrieval method in one embodiment;
[0050] FIG4 is a block diagram of an information retrieval device in one embodiment;
[0051] FIG. 5 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0053] The information retrieval method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. This embodiment is illustrated by the application of this method to the terminal 102. It can be understood that the method can also be applied to the server 104, and can also be applied to the system including the terminal 102 and the server 104, and is implemented through the interaction between the terminal 102 and the server 104. When the terminal 102 receives the information query statement input by the user, it extracts multiple metadata from the information query statement; uses the multiple metadata as filtering conditions, retrieves multiple target topic segments in the conversation record database; each target topic segment includes multiple conversation records and corresponding topics; based on multiple target topic segments, determines the information query prompt words; based on the information query prompt words and the large language model, obtains the information retrieval results generated by the large language model. The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0054] In an exemplary embodiment, as shown in FIG2 , an information retrieval method is provided, which is described by taking the method applied to the terminal 102 in FIG1 as an example, and includes the following steps 202 to 208. Among them:
[0055] Step 202: upon receiving an information query statement input by a user, extract multiple metadata from the information query statement.
[0056] The information query statement refers to a statement input by a user for information query. The information query statement can be in various forms, such as voice form, text form, etc. Exemplarily, the terminal has a human-computer interaction interface, and the user inputs the information query statement through the human-computer interaction interface. According to the scenario in which the information retrieval method is applied, the information query statement can be mainly used for information query in various scenarios. The application scenarios include but are not limited to instant messaging software, social network platforms, online customer service systems, and other scenarios.
[0057] For example, in an instant messaging scenario, an information query statement can be used to search historical conversation content in an instant messaging software to obtain specific information or reminders.
[0058] Metadata refers to data that can describe the data attributes and features in an information query statement, such as key attribute words and key feature words in an information query statement. For example, the information query statement is: Last week, Li Ming and I talked about traveling to Thailand during the winter vacation. He reminded me what documents I need to bring. Metadata can include last week, Li Ming and I, traveling to Thailand during the winter vacation, what documents to bring, etc.
[0059] Step 204, using the multiple metadata as filtering conditions, searching in the conversation record database to obtain multiple target topic segments; each target topic segment includes multiple conversation records and corresponding topics.
[0060] The conversation record database refers to a pre-built database for storing historical conversation records and topics of the conversation records.
[0061] The terminal uses the multiple metadata as filtering conditions and can retrieve the conversation records and topics of the conversation records that match the multiple metadata from the conversation record database.
[0062] A topic refers to the subject of a conversation record. One conversation record may correspond to one topic, or multiple conversation records may correspond to one topic. Therefore, the conversation record in the target topic segment may include the conversation record context corresponding to the topic.
[0063] For example, each target topic segment includes a topic, which includes multiple conversation records. The target topic segment can be expressed as: topicA: [userA: content1, userB: content2...], where topicA represents the topic, userA and userB represent the conversation objects, content1 represents the conversation record of userA, and content2 represents the conversation record of userB.
[0064] Step 206: Determine information query prompt words based on the multiple target topic segments.
[0065] Among them, the information query prompt words can be used as input prompts for the large language model. The multiple target topic segments contain conversation records related to metadata and corresponding topics. The multiple target topic segments can be used as references for information query, and the information query prompt words are constructed based on the target topic segments. For example, multiple target topic segments and prompt word templates for information query are assembled into information query prompt words.
[0066] Step 208: Based on the information query prompt word and the large language model, an information retrieval result generated by the large language model is obtained.
[0067] Among them, the Large Language Model (LLM) is an artificial intelligence model that can understand and generate natural language and has high language understanding and generation capabilities. Information query prompts are used as prompts for the large language model, which can guide the large language model to generate information retrieval results related to the user's information query statement.
[0068] In the above information retrieval method, when receiving an information query statement input by a user, multiple metadata are extracted from the information query statement, which is helpful for accurately understanding the user's query needs; using multiple metadata as filtering conditions is helpful for quickly retrieving multiple target topic fragments related to the user's needs from the conversation record database, thereby improving the retrieval efficiency; in addition, based on the multiple target topic fragments, the information query prompt words are determined, the information query prompt words contain conversation records and corresponding topics, and the information query prompt words are used as input prompts of the large language model. The language understanding and generation capabilities of the large language model are utilized, which is helpful for accurately understanding the user's search intentions, thereby generating more accurate information retrieval results that are more in line with user needs, thereby improving the accuracy of the information retrieval results.
[0069] In an exemplary embodiment, multiple metadata are extracted from an information query statement, including: obtaining preset prompt words; the preset prompt words include an extraction requirement template, text to be extracted, and the type of information to be extracted; using the information query statement as the text to be extracted in the preset prompt words to obtain combined prompt words; and generating multiple metadata based on the combined prompt words through a large language model.
[0070] Among them, for the extraction of metadata, a large language model method can be used. In order to ensure that the extracted metadata better meets the user's query needs, appropriate prompt words can be constructed based on the information query sentence.
[0071] The preset prompt word refers to the prompt word template used for information extraction. The preset prompt word may include an extraction requirement template, the text to be extracted, and the type of information to be extracted. Among them, the extraction requirement template refers to a template that instructs the large language model to complete the extraction requirement. For example, the extraction requirement template can be: You are good at extracting key information from texts, please extract this sentence as [type of information to be extracted], and the text you want to extract is: [text to be extracted].
[0072] The text to be extracted is the text to be filled in the preset prompt words for extraction. For example, the information query sentence can be used as the text to be extracted.
[0073] The type of information to be extracted refers to the type of information to be extracted from the text, which can be specified in the preset prompt words according to the requirements. For example, the types of information to be extracted include the start time, end time, dialogue characters, topics, and key information points.
[0074] The terminal uses the information query sentence as the text to be extracted in the preset prompt words, and assembles it into a combined prompt word together with the extraction requirement template and the information type to be extracted. For example, the combined prompt word can be: You are good at extracting key information from texts. Please extract the start time, end time, dialogue characters, topic and key information points from this sentence. The text you want to extract is: About last week, Li Ming and I talked about traveling to Thailand during the winter vacation. He reminded me what documents I need to bring?
[0075] The terminal uses the combined prompt words as the prompt of the large language model, and the generation result of the large language model is multiple metadata. For example, the multiple metadata can be:
[0076] "Start time start_time": "2024-01-01", "End time end_time": "2024-01-07","People": "Li Ming", "Topic": "Discussion about traveling to Thailand during the winter vacation", "Key information points key_point": "Li Ming reminded me what documents I need to bring?".
[0077] In this embodiment, the information query sentence is used as the text to be extracted in the preset prompt word, and the extraction requirement template and the information type to be extracted are pre-designed in the preset prompt word, and finally assembled into a combined prompt word, and the combined prompt word is used for the prompt of the large language model.
[0078] Get preset prompt words; preset prompt words include extraction requirement template, text to be extracted and information type to be extracted; use information query sentence as text to be extracted in preset prompt words to get combined prompt words; based on the combined prompt words, generate multiple metadata through large language model. This metadata parsing method can more accurately understand the user's query needs. Through large language model and prompt design, key information such as time range, dialogue characters, topic and query content can be extracted, which helps to more accurately understand the user's query intention. This helps to improve user experience and enable users to find the required information more quickly.
[0079] In one of the embodiments, the multiple metadata include topic data, key query information, conversation objects, and start and end time points; the multiple metadata are used as filtering conditions to retrieve multiple target topic segments in the conversation record database, including: retrieving multiple topic segments in the conversation record database to obtain multiple target topic segments whose relevance to the multiple metadata meets preset relevance conditions.
[0080] Among them, taking the extracted multiple metadata including topic data, key query information, conversation object and start and end time points as an example, the topic data, key query information, conversation object and start and end time points are used as filtering conditions to search the conversation record database. The retrieval method can adopt keyword-based retrieval and semantic vector-based retrieval methods, such as the RRF (Reciprocal Rank Fusion) retrieval method in elasticsearch (an open source distributed search and analysis engine), to retrieve the TopN target topic fragments most relevant to the query from the database.
[0081] The preset relevance condition may include at least one of a semantic relevance condition and a keyword similarity condition. The conversation record database includes multiple topic segments. For example, semantic matching is used to compare the semantic similarity of the topic of each topic segment with the topic data of the metadata, and to compare the semantic similarity of the conversation record in each topic segment with the key query information, the conversation object, and the start and end time points, and the most relevant TopN target topic segments are determined from multiple topic segments through each similarity. For example, through the similarity of the start and end time points, the P most relevant topic segments at the time points are screened, and then the Q most relevant topic segments are screened from the P topic segments, and then the M most relevant topic segments are screened from the Q topic segments, and finally the N target topic segments with the most relevant key query information are screened from the M topic segments. Alternatively, the target topic segments can be screened by dividing the weights, etc.
[0082] Exemplarily, the retrieved TopN target topic segments may be:
[0083] [{topicA: [userA: content1, userB: content2...], topicB: [userA:content3...]...}].
[0084] In this embodiment, through online query, combining topic data, key query information, conversation objects and start and end time points as filtering conditions, using keyword-based retrieval and semantic vector-based retrieval methods, it is possible to quickly retrieve the TopN target topic fragments most relevant to the query from a large number of conversation records, which helps to improve retrieval efficiency and reduce the time and effort required for users to find information.
[0085] In one of the embodiments, based on multiple target topic fragments, determining information query prompt words includes: obtaining a prompt word template; the prompt word template includes generating a requirement template, reference information and requirement information; using the multiple target topic fragments as reference information of the prompt word template, using key query information in multiple metadata as requirement information of the prompt word template, and obtaining the information query prompt words.
[0086] Among them, multiple target topic fragments can be used to construct information query prompt words, thereby guiding the large language model to generate information query results that meet the user's query needs.
[0087] The prompt word template is a template for prompt words used to generate query results. The prompt word template includes a generation requirement template, reference information, and requirement information. Among them, the generation requirement template refers to a template that instructs the large language model to complete the generation of retrieval results. For example, the generation requirement template can be: You are an assistant who is happy to answer questions. Please answer the following questions based on the reference information: [Requirement information], and the reference information is as follows: [Reference information].
[0088] The terminal uses multiple target topic segments as reference information for the prompt word template, and uses the key query information in multiple metadata as the requirement information for the prompt word template, and assembles them together with the generated requirement template into an information query prompt word. For example, the key query information can be: What documents does Li Ming remind me to bring? The information query prompt word can be: You are an assistant who is happy to answer questions. Please answer the following question based on the reference information: What documents does Li Ming remind me to bring? The reference information is as follows:
[0089] [{topicA: [userA: content1, userB: content2...], topicB: [userA:content3...]...}].
[0090] After the information query prompt words are input into the large language model, the result generated by the large language model may be: Li Ming reminds you to bring your ID card, passport...
[0091] In this embodiment, multiple target topic fragments are retrieved online, and the metadata of the multiple target topic fragments and the information query statement are spliced through Prompt to obtain information query prompt words, which are used to guide the large language model to generate the final information query results, which is conducive to generating more accurate and relevant answers, which helps to improve the accuracy of the answers and reduce user confusion and misunderstanding.
[0092] In one embodiment, the steps of constructing a conversation record database include: obtaining multiple continuous historical conversation records; separating the multiple continuous historical conversation records by topic to obtain multiple topic segments; each topic segment contains multiple conversation records and corresponding topics; and constructing a conversation record database based on the multiple topic segments.
[0093] Among them, historical conversation records refer to the conversation information of users at historical moments. The conversation records of users often revolve around topics. Therefore, multiple continuous historical conversation records can be separated according to the corresponding topics to obtain multiple topic segments. Each topic segment has multiple conversation records. Multiple conversation records are continuous conversations revolving around one topic.
[0094] Adding multiple topic segments to the database obtains a conversation record database. In some embodiments, the content stored in the conversation record database can increase as the conversation record increases.
[0095] In this embodiment, the user's historical conversation records are segmented according to topics to obtain multiple topic segments. In this way, the multiple conversation records in each topic segment are developed around the topic and have semantic relevance. The method of segmenting according to topics is conducive to quickly retrieving conversation records that meet user needs and improving the accuracy of retrieval results.
[0096] In one of the embodiments, multiple continuous historical conversation records are topic-separated to obtain multiple topic segments, including: performing semantic analysis on the multiple continuous historical conversation records to obtain topics corresponding to the multiple continuous historical conversation records; and treating multiple continuous conversation records belonging to the same topic in the multiple continuous historical conversation records as a topic segment to obtain multiple topic segments.
[0097] Among them, since the conversation records of the same topic have semantic relevance, semantic analysis can be performed on multiple continuous historical conversation records to identify the topics corresponding to the multiple continuous historical conversation records, and the multiple continuous conversation records belonging to the same topic are taken as a topic segment to obtain multiple topic segments. Exemplarily, the Bert model based on supervised learning can be used to perform semantic analysis on historical conversation records.
[0098] For example, the historical conversation record before the topic separation can be:
[0099] [userA: cotent1, userB: content2, userA: content3...];
[0100] The historical conversation records before topic separation can be:
[0101] [{topicA: [userA: content1, userB: content2...], topicB: [userA:content3...]...}].
[0102] In this embodiment, by performing semantic analysis on historical conversation records, multiple historical conversation records are segmented into multiple topic segments. Each topic segment contains a series of continuous chat messages, which are semantically related. This topic separation method is conducive to storing historical conversation records according to topics, and is conducive to quickly retrieving content that meets user needs.
[0103] To explain the information retrieval method and effect in this solution in detail, a most detailed embodiment is described below:
[0104] The information retrieval method can be applied to a variety of application scenarios, such as instant messaging software, social networking platforms, online customer service systems, etc. Taking the application to instant messaging software as an example, FIG3 is a flow chart of the information retrieval method in one embodiment.
[0105] The information query statement input by the user received by the terminal may be: About last week, Li Ming and I talked about traveling to Thailand during the winter vacation. He reminded me which documents I need to bring?
[0106] Step 1: Topic segmentation. The terminal automatically preprocesses the user's historical conversation records. The Bert model based on supervised learning is used to perform semantic analysis on the historical conversation records, and multiple continuous historical conversation records are segmented into multiple topic segments. Each topic segment contains a series of continuous conversation records, which are semantically related. An example is as follows:
[0107] - Before separation: [userA: cotent1, userB: content2, userA: content3...]
[0108] - After separation: [{topicA: [userA: content1, userB: content2...], topicB:[userA: content3...]...}]
[0109] Step 2: Metadata parsing. When the user enters the information query sentence Query, the terminal first uses the large language model to parse the Query and extract metadata, including topic data, key query information, conversation object, and start and end time points. This step is achieved by designing a suitable prompt to ensure that the large language model can accurately understand the user's query intention. An example is as follows:
[0110] - Original query statement: "Last week, Li Ming and I talked about traveling to Thailand during the winter vacation. He reminded me what documents I needed to bring?"
[0111] - Prompt gives an example as follows: "You are good at extracting key information from text. Please extract the start time, end time, dialogue characters, topic and key information points from this sentence. The text you want to extract is: Last week, Li Ming and I talked about traveling to Thailand during the winter vacation. He reminded me what documents I need to bring?......".
[0112] - The parsed information can be:
[0113] {"start_time": "2024-01-01", "end_time": "2024-01-07", "people": "Li Ming", "topic": "Discussion about traveling to Thailand during the winter vacation", "key_point": "Li Ming reminded me what documents I need to bring?"}.
[0114] Step 3: Retrieval. The terminal searches the chat record database based on the extracted metadata, combined with topic data, key query information, conversation object, and start and end time points as filtering conditions. At the same time, keyword-based retrieval and semantic vector-based retrieval methods, such as the RRF retrieval method in elasticsearch, are used to retrieve the TopN topic fragments most relevant to the query from the database. An example is as follows:
[0115] [{topicA: [userA: content1, userB: content2...], topicB: [userA:content3...]...}].
[0116] Step 4: The large model generates results. Combine the TopN topic fragments retrieved in step 3 with the key query information extracted in step 2 to form a new input. By designing a suitable prompt, the large language model is guided to generate a response to the user's query. Based on this information, the large language model generates an accurate and relevant answer and displays it to the user. An example prompt is as follows:
[0117] "You are an assistant who is happy to answer questions. Please answer the following questions based on the reference information: What documents does Li Ming remind me to bring? The reference information is as follows:
[0118] [{topicA: [userA: content1, userB: content2...], topicB: [userA:content3...]...}]".
[0119] Finally, the big model will generate the answer, for example: "Li Ming reminds you to bring your ID card, passport..."
[0120] The above information retrieval method extracts multiple metadata from the information query statement when receiving the information query statement input by the user, uses the multiple metadata as filtering conditions, and retrieves multiple target topic segments in the conversation record database. Since each target topic segment includes multiple conversation records and corresponding topics, the information query prompt word is determined based on the multiple target topic segments. Therefore, the information query prompt word contains the conversation record and the corresponding topic. The information query prompt word is used as the input prompt of the large language model. The language understanding and generation capabilities of the large language model are used to accurately understand the user's search needs, thereby generating information retrieval results that meet the user's needs, and improving the accuracy of the information retrieval results. In addition, through offline topic separation, the conversation record is divided into multiple semantically related topic segments, which helps to more accurately understand the chat content and provide a more accurate basis for subsequent retrieval. This helps to improve the accuracy of retrieval and reduce the interference of irrelevant content. Online Query metadata parsing can more accurately understand the user's query needs. Through the large language model and prompt design, key information such as topic data, key query information, conversation objects, and start and end time points are extracted, which helps to more accurately understand the user's query intention, which helps to improve the user experience and enable users to find the required information more quickly. Through online query, combined with topic data, key query information, conversation objects, and start and end time points as filtering conditions, using keyword-based retrieval and semantic vector-based retrieval methods, the TopN topic fragments most relevant to the query can be quickly retrieved from a large number of conversation records, which helps improve retrieval efficiency and reduce the time and effort required for users to find information. By generating results online, splicing the query results and query content through Prompt, and calling the large language model to generate the final reply results, more accurate and relevant answers can be generated, which helps improve the accuracy of the answers and reduce user confusion and misunderstandings.
[0121] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0122] Based on the same inventive concept, the embodiment of the present application also provides an information retrieval device for implementing the above-mentioned information retrieval method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more information retrieval device embodiments provided below can refer to the limitations on the information retrieval method above, and will not be repeated here.
[0123] In an exemplary embodiment, as shown in FIG. 4 , an information retrieval device 400 is provided, comprising: an extraction module 420, a retrieval module 440, a determination module 460 and a generation module 480, wherein:
[0124] The extraction module 420 is used to extract multiple metadata from the information query statement when receiving the information query statement input by the user;
[0125] A search module 440 is used to use the multiple metadata as filtering conditions to search the conversation record database to obtain multiple target topic segments; each target topic segment includes multiple conversation records and corresponding topics;
[0126] A determination module 460, for determining information query prompt words based on the multiple target topic segments;
[0127] The generating module 480 is used to obtain the information retrieval result generated by the large language model based on the information query prompt word and the large language model.
[0128] The above-mentioned information retrieval device, when receiving an information query statement input by a user, extracts multiple metadata from the information query statement, uses the multiple metadata as filtering conditions, searches the conversation record database to obtain multiple target topic fragments, and since each target topic fragment includes multiple conversation records and corresponding topics, the information query prompt words are determined based on the multiple target topic fragments. Therefore, the information query prompt words contain the conversation records and the corresponding topics, and the information query prompt words are used as input prompts of the large language model. The language understanding and generation capabilities of the large language model are used to accurately understand the user's search needs, thereby generating information retrieval results that meet the user's needs, thereby improving the accuracy of the information retrieval results.
[0129] In one embodiment, multiple metadata are extracted from the information query statement, and the extraction module 420 is also used to: obtain preset prompt words; the preset prompt words include an extraction requirement template, text to be extracted, and the type of information to be extracted; use the information query statement as the text to be extracted in the preset prompt words to obtain the combined prompt words; based on the combined prompt words, generate multiple metadata through a large language model.
[0130] In one embodiment, the multiple metadata include topic data, key query information, conversation objects, and start and end time points; the multiple metadata are used as filtering conditions to retrieve multiple target topic segments in the conversation record database, and the retrieval module 440 is also used to: retrieve multiple topic segments in the conversation record database to obtain multiple target topic segments whose relevance to the multiple metadata meets preset relevance conditions.
[0131] In one embodiment, based on multiple target topic fragments, information query prompt words are determined, and the determination module 460 is also used to: obtain a prompt word template; the prompt word template includes generating a requirement template, reference information and requirement information; use multiple target topic fragments as reference information for the prompt word template, use key query information in multiple metadata as requirement information for the prompt word template, and obtain the information query prompt word.
[0132] In one embodiment, in terms of constructing a conversation record database, the retrieval module 440 is also used to: obtain multiple continuous historical conversation records; separate the multiple continuous historical conversation records into topics to obtain multiple topic segments; each topic segment contains multiple conversation records and corresponding topics; and construct a conversation record database based on the multiple topic segments.
[0133] In one embodiment, multiple continuous historical conversation records are topic-separated to obtain multiple topic segments, and the retrieval module 440 is further used to: perform semantic analysis on the multiple continuous historical conversation records to obtain topics corresponding to the multiple continuous historical conversation records; and treat multiple continuous conversation records belonging to the same topic in the multiple continuous historical conversation records as a topic segment to obtain multiple topic segments.
[0134] Each module in the above information retrieval device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.
[0135] In an exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG5. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, an information retrieval method is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0136] Those skilled in the art will understand that the structure shown in FIG. 5 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0137] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0138] When receiving an information query statement input by a user, multiple metadata are extracted from the information query statement; the multiple metadata are used as filtering conditions to search in a conversation record database to obtain multiple target topic segments; each target topic segment includes multiple conversation records and corresponding topics; based on the multiple target topic segments, information query prompt words are determined; based on the information query prompt words and the large language model, an information retrieval result generated by the large language model is obtained.
[0139] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0140] Obtain preset prompt words; the preset prompt words include an extraction requirement template, text to be extracted, and information type to be extracted; use the information query sentence as the text to be extracted in the preset prompt words to obtain the combined prompt words; based on the combined prompt words, generate multiple metadata through a large language model.
[0141] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0142] The multiple metadata include topic data, key query information, conversation objects, and start and end time points; multiple topic segments in the conversation record database are searched to obtain multiple target topic segments whose relevance to the multiple metadata meets preset relevance conditions.
[0143] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0144] Acquire a prompt word template; the prompt word template includes a generation requirement template, reference information and requirement information; use multiple target topic fragments as reference information of the prompt word template, use key query information in multiple metadata as requirement information of the prompt word template, and obtain information query prompt words.
[0145] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0146] Acquire multiple continuous historical conversation records; separate the multiple continuous historical conversation records into topics to obtain multiple topic segments; each topic segment contains multiple conversation records and corresponding topics; and construct a conversation record database based on the multiple topic segments.
[0147] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0148] Semantic analysis is performed on multiple continuous historical conversation records respectively to obtain topics corresponding to the multiple continuous historical conversation records; multiple continuous conversation records belonging to the same topic in the multiple continuous historical conversation records are taken as a topic segment to obtain multiple topic segments.
[0149] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0150] When receiving an information query statement input by a user, multiple metadata are extracted from the information query statement; the multiple metadata are used as filtering conditions to search in a conversation record database to obtain multiple target topic segments; each target topic segment includes multiple conversation records and corresponding topics; based on the multiple target topic segments, information query prompt words are determined; based on the information query prompt words and the large language model, an information retrieval result generated by the large language model is obtained.
[0151] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0152] Obtain preset prompt words; the preset prompt words include an extraction requirement template, text to be extracted, and information type to be extracted; use the information query sentence as the text to be extracted in the preset prompt words to obtain the combined prompt words; based on the combined prompt words, generate multiple metadata through a large language model.
[0153] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0154] The multiple metadata include topic data, key query information, conversation objects, and start and end time points; multiple topic segments in the conversation record database are searched to obtain multiple target topic segments whose relevance to the multiple metadata meets preset relevance conditions.
[0155] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0156] Acquire a prompt word template; the prompt word template includes a generation requirement template, reference information and requirement information; use multiple target topic fragments as reference information of the prompt word template, use key query information in multiple metadata as requirement information of the prompt word template, and obtain information query prompt words.
[0157] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0158] Acquire multiple continuous historical conversation records; separate the multiple continuous historical conversation records into topics to obtain multiple topic segments; each topic segment contains multiple conversation records and corresponding topics; and construct a conversation record database based on the multiple topic segments.
[0159] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0160] Semantic analysis is performed on multiple continuous historical conversation records respectively to obtain topics corresponding to the multiple continuous historical conversation records; multiple continuous conversation records belonging to the same topic in the multiple continuous historical conversation records are taken as a topic segment to obtain multiple topic segments.
[0161] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0162] When receiving an information query statement input by a user, multiple metadata are extracted from the information query statement; the multiple metadata are used as filtering conditions to search in a conversation record database to obtain multiple target topic segments; each target topic segment includes multiple conversation records and corresponding topics; based on the multiple target topic segments, information query prompt words are determined; based on the information query prompt words and the large language model, an information retrieval result generated by the large language model is obtained.
[0163] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0164] Obtain preset prompt words; the preset prompt words include an extraction requirement template, text to be extracted, and information type to be extracted; use the information query sentence as the text to be extracted in the preset prompt words to obtain the combined prompt words; based on the combined prompt words, generate multiple metadata through a large language model.
[0165] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0166] The multiple metadata include topic data, key query information, conversation objects, and start and end time points; multiple topic segments in the conversation record database are searched to obtain multiple target topic segments whose relevance to the multiple metadata meets preset relevance conditions.
[0167] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0168] Acquire a prompt word template; the prompt word template includes a generation requirement template, reference information and requirement information; use multiple target topic fragments as reference information of the prompt word template, use key query information in multiple metadata as requirement information of the prompt word template, and obtain information query prompt words.
[0169] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0170] Acquire multiple continuous historical conversation records; separate the multiple continuous historical conversation records into topics to obtain multiple topic segments; each topic segment contains multiple conversation records and corresponding topics; and construct a conversation record database based on the multiple topic segments.
[0171] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0172] Semantic analysis is performed on multiple continuous historical conversation records respectively to obtain topics corresponding to the multiple continuous historical conversation records; multiple continuous conversation records belonging to the same topic in the multiple continuous historical conversation records are taken as a topic segment to obtain multiple topic segments.
[0173] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0174] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0175] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0176] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An information retrieval method, characterized in that: The method comprises: In case of receiving an information query statement input by a user, extracting a plurality of metadata from the information query statement; Using multiple metadata as filtering conditions, searching in the conversation record database to obtain multiple target topic segments; each target topic segment includes multiple conversation records and corresponding topics; Based on multiple target topic segments, determine information query prompt words; Based on the information query prompt word and the large language model, an information retrieval result generated by the large language model is obtained.
2. The method according to claim 1, characterized in that The extracting of multiple metadata from the information query statement includes: Obtaining preset prompt words; the preset prompt words include an extraction requirement template, text to be extracted, and the type of information to be extracted; Using the information query sentence as the text to be extracted from the preset prompt words to obtain the combined prompt words; Based on the combined prompt words, a plurality of metadata are generated through a large language model.
3. The method according to claim 1, characterized in that The multiple metadata include topic data, key query information, conversation objects, and start and end time points; the multiple metadata are used as filtering conditions to retrieve multiple target topic segments in the conversation record database, including: A plurality of topic segments in a conversation record database are searched to obtain a plurality of target topic segments whose relevance to the plurality of metadata meets a preset relevance condition.
4. The method according to claim 1, characterized in that: The step of determining the information query prompt words based on the multiple target topic segments includes: Acquire a prompt word template; the prompt word template includes a generation requirement template, reference information and requirement information; The multiple target topic segments are used as reference information of the prompt word template, and the key query information in the multiple metadata is used as the requirement information of the prompt word template to obtain the information query prompt word.
5. The method according to claim 1, characterized in that The steps of constructing the conversation record database include: Get multiple continuous historical conversation records; Separate multiple continuous historical conversation records into topics to obtain multiple topic segments; each topic segment contains multiple conversation records and corresponding topics; Construct a conversation record database based on multiple topic segments.
6. The method according to claim 5, characterized in that The topic separation of the multiple continuous historical conversation records is performed to obtain multiple topic segments, including: Semantic analysis is performed on multiple continuous historical conversation records to obtain topics corresponding to the multiple continuous historical conversation records; Multiple continuous conversation records belonging to the same topic in multiple continuous historical conversation records are taken as a topic segment to obtain multiple topic segments.
7. An information retrieval device, characterized in that: The device comprises: An extraction module, configured to extract a plurality of metadata from an information query statement when receiving the information query statement input by a user; A retrieval module, used to use multiple metadata as filtering conditions to search the conversation record database to obtain multiple target topic segments; each target topic segment includes multiple conversation records and corresponding topics; A determination module, used for determining information query prompt words based on multiple target topic segments; A generation module is used to obtain information retrieval results generated by the large language model based on the information query prompt words and the large language model.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Dialogue data generation method, electronic device, storage medium and program product
CN120144723A
Intelligent agent dialogue generation method and storage medium
CN120448511A
Information feedback method and device, electronic equipment and storage medium
CN120821788A
Intelligent retrieval method, electronic equipment and storage medium
CN121210724A