Answer generation method and device, electronic equipment, storage medium and program product
By filtering out the data groups related to the question text as the search scope, the search incomplete problem caused by random selection of the data range in the database is solved, and the accuracy and comprehensiveness of answer generation are achieved.
Patent Information
- Application Number
- CN202411548950.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-01-10
AI Technical Summary
Randomly selecting part of the data range in the database for RAG search results in incomplete searches, which leads to inaccurate answer generation.
By acquiring multiple data groups, the relevant data groups are filtered out based on the feature information corresponding to the input question text and the target identifier in the feature identifier, forming a first data set, and RAG search is performed using this as the search range to generate an answer.
While narrowing the search scope, ensure that the search is more comprehensive, so that the answer generation is more accurate.
Smart Images

Figure CN119293189A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of intelligent question-answering technology, and in particular, to an answer generation method, device, electronic device, storage medium, and program product. Background Art
[0002] Intelligent question and answer is a technology that uses artificial intelligence to achieve automatic question and answer. Intelligent question and answer is widely used in pre-sales and after-sales services, smart assistants and other fields to provide users with convenient and efficient services.
[0003] At present, intelligent question answering can generally be completed through RAG (Retrieval-Augmented Generation) retrieval and large language model (LLM). In the process of intelligent question answering, RAG retrieval will first be performed within the scope of data included in the database based on the question input by the user to determine part of the data related to the question in the database, and then the question and the part of the data will be input into the LLM so that the LLM outputs the answer to the question, thereby generating an answer based on the question. Taking into account the limited length of input data that the LLM can process, in order to meet the data processing capacity of the LLM, when the amount of data in the database is large, RAG retrieval will generally be performed within the scope of part of the data randomly selected from the database, so as to reduce the amount of data related to the question input into the LLM by narrowing the search scope.
[0004] However, performing RAG searches on a randomly selected portion of data in the database results in an incomplete search, which in turn results in incomplete data related to the question being input into the LLM, thus causing the answers generated based on the question to be relatively inaccurate. Summary of the invention
[0005] In view of this, embodiments of the present application provide an answer generation method, device, electronic device, storage medium and program product to at least partially solve the above problems.
[0006] According to a first aspect of an embodiment of the present application, there is provided an answer generation method, comprising: obtaining a plurality of data groups, wherein the data groups include feature information corresponding to a plurality of feature identifiers, the feature information being information of an event corresponding to the data group in which the feature information is located, and different data groups correspond to different events; based on an input question text, and feature information in the plurality of data groups corresponding to a target identifier in the plurality of feature identifiers, screening out at least some of the data groups from the plurality of data groups to form a first data set, wherein the feature information corresponding to the target identifier is the feature identifier of any preset information corresponding to the target identifier; based on the question text, performing a search with at least some of the data in the first data set as the search range, and determining an answer text corresponding to the question text based on the search result.
[0007] According to a second aspect of an embodiment of the present application, an answer generation device is provided, comprising: an acquisition unit, for acquiring multiple data groups, wherein the data groups include feature information corresponding to multiple feature identifiers, the feature information being information about an event corresponding to the data group where the feature information is located, and different data groups correspond to different events; a screening unit, for screening out at least part of the data groups from the multiple data groups according to an input question text and feature information corresponding to a target identifier in the multiple feature identifiers in the multiple data groups to form a first data set, wherein the feature information corresponding to the target identifier is the feature identifier of any preset information corresponding to the target identifier; a determination unit, for searching according to the question text with at least part of the data in the first data set as the search range, and determining an answer text corresponding to the question text according to the search result.
[0008] According to the third aspect of an embodiment of the present application, there is provided an electronic device comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the method of the first aspect described above.
[0009] According to a fourth aspect of an embodiment of the present application, a computer storage medium is provided, on which a computer program is stored, and the program is executed by a processor to perform the method of the first aspect.
[0010] According to a fifth aspect of an embodiment of the present application, a computer program product is provided, comprising computer instructions, wherein the computer instructions instruct a computing device to execute the method of the first aspect described above.
[0011] According to the answer generation scheme provided in the embodiment of the present application, multiple data groups can be obtained, and based on the input question text and the feature information in the multiple data groups corresponding to the target identifier in the multiple feature identifiers, at least part of the data groups can be screened out from the multiple data groups to form a first data set, and then based on the question text, a search is performed with at least part of the data in the first data set as the search range, and the answer text corresponding to the question text is determined based on the search results. Therefore, before determining the answer text corresponding to the question text, multiple data groups can be screened according to the question text and the feature information corresponding to the target identifier in the multiple data groups to obtain a first data set composed of data groups that are relatively relevant to the question text. Since the feature information corresponding to the target identifier is the feature identifier of any preset information corresponding to the target identifier, the feature information corresponding to the target identifier has a more fixed format and / or content than the feature information corresponding to the feature identifier that is not the target identifier. Compared with randomly screening multiple data groups, the possibility of screening out data related to the question text based on feature information with relatively fixed format and / or content is small, that is, the possibility of data related to the question text in multiple data groups not being in the first data set is small. Furthermore, subsequently, at least part of the data in the first data set is used as the search range for retrieval, and the answer text is determined according to the search results. This can narrow the search range while making the search more comprehensive, so that the data referenced when determining the answer text is more comprehensive, and therefore, the answer text determined according to the question text can be more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the embodiments of the present application 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 only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0013] Figure 1 is a flow chart of an answer generation method according to an embodiment of the present application;
[0014] Figure 2 is a schematic diagram of an answer generating device according to an embodiment of the present application;
[0015] Figure 3 It is a schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0016] Application environment of this application
[0017] The embodiment of the present application proposes an answer generation scheme. The entire answer generation scheme is relatively general and can be used to provide automatic replies to users in the pre-sales and after-sales process, such as providing automatic replies to customer service personnel or car owners during vehicle after-sales. The answer generation scheme can be executed by a data center, a server, a personal computer, an Internet of Things (IoT) device, an embedded device, etc. The answer generation scheme is independent of the hardware deployed by the computing device that executes the scheme.
[0018] Answer generation method
[0019] Based on the above application environment, an embodiment of the present application provides an answer generation method, and the answer generation method is described in detail through multiple embodiments below.
[0020] Figure 1 FIG. 1 is a flow chart of a method for generating an answer according to an embodiment of the present invention. Figure 1 As shown, the answer generation method includes the following steps:
[0021] Step 101: Acquire multiple data groups.
[0022] The data group includes characteristic information corresponding to a plurality of characteristic identifiers, and the characteristic information is information about an event corresponding to the data group where the characteristic information is located, and different data groups correspond to different events.
[0023] In a specific implementation, multiple data groups may be obtained from a database, that is, multiple data groups are stored in the same database, and the database may store data in rows and columns. Specifically, data of the same data group is stored in the same row of the database, and feature information corresponding to the same feature identifier is stored in the same column of the database. Based on this, the feature identifier may be a column name.
[0024] For example, the event is a vehicle after-sales event, and the multiple feature identifiers are respectively an identifier corresponding to the case number (for example, "case number"), an identifier corresponding to the vehicle identification code (for example, "VIN code"), an identifier corresponding to whether it has been resolved (for example, "whether it has been resolved"), an identifier corresponding to the brand (for example, "brand"), an identifier corresponding to the model (for example, "model"), an identifier corresponding to the date (for example, "date"), an identifier corresponding to the problem description (for example, "problem description"), an identifier corresponding to the cause (for example, "cause"), an identifier corresponding to the solution (for example, "solution"), and an identifier corresponding to the event recorder (for example, "event recorder"). Two of the multiple data groups are respectively a data group corresponding to the vehicle after-sales event of vehicle A and a data group corresponding to the vehicle after-sales event of vehicle B. The feature information of the vehicle after-sales event of vehicle A corresponding to the above multiple feature identifiers are respectively 01, CC0CCCC0011111111 (that is, the specific vehicle identification code of vehicle A), yes, D brand (that is, the specific brand name of vehicle A), SUV, 2023-11-11, headlights not on, headlights damaged, replace headlights, Person A, the vehicle after-sales event of vehicle B corresponds to the characteristic information of the above-mentioned multiple characteristic identifiers, respectively, 07, CC0CCCC0022222222 (that is, the specific vehicle identification code of vehicle B), no, E brand (that is, the specific brand name of vehicle B), sedan, 2021-05-22, car cannot start, battery power is low, replace battery, person B; based on this, the number of rows in the above-mentioned database is equal to the total number of data groups, and the number of columns in the above-mentioned database is 10, among which the data group corresponding to the vehicle after-sales event of vehicle A includes data stored in the same column of the above-mentioned database. In a row, the 10 columns of data in the row are, from front to back, 01, CC0CCCC0011111111, yes, brand D, SUV, 2023-11-11, headlights not on, headlights damaged, replace headlights, person A. The data group corresponding to the vehicle after-sales events of vehicle B is stored in the same row of the above database. The 10 columns of data in the row are, from front to back, 07, CC0CCCC0022222222, no, brand E, sedan, 2021-05-22, car cannot start, battery low, replace battery, person B.
[0025] Step 102: based on the input question text and feature information in the multiple data groups corresponding to the target identifier in the multiple feature identifiers, at least some data groups are screened out from the multiple data groups to form a first data set.
[0026] Among them, the characteristic information corresponding to the target identifier is the characteristic identifier of any preset information corresponding to the target identifier. For example, the characteristic information corresponding to the characteristic identifier "Has it been resolved" is any one of the preset information "yes" corresponding to the characteristic identifier and the preset information "no" corresponding to the characteristic identifier. Therefore, the characteristic identifier "Has it been resolved" is the target identifier; for another example, the characteristic information corresponding to the characteristic identifier "VIN code" is any one of the VIN codes of all sold vehicles (the VIN code of each sold vehicle is the preset information corresponding to the characteristic information), therefore, the characteristic identifier "VIN code" is the target identifier, and the characteristic information corresponding to the characteristic identifier "problem description" is relatively diverse. The characteristic identifier has no corresponding preset information. Therefore, the characteristic identifier "problem description" is not the target identifier.
[0027] In a specific implementation, part of the feature information that is relatively relevant to the question text may be determined from the feature information corresponding to all target identifiers in multiple data groups, and then the data groups containing the part of the feature information may be combined into a first data set.
[0028] Step 103: perform a search based on the question text using at least a portion of the data in the first data set as a search scope, and determine the answer text corresponding to the question text based on the search result.
[0029] In a specific embodiment, after obtaining the first data set, a RAG search can be performed based on the question text with the first data set as the search scope to determine partial data related to the question text in the first data set, and then the partial data and the question text are input into the LLM so that the LLM outputs the answer text.
[0030] In an embodiment of the present application, multiple data groups can be obtained, and based on an input question text and feature information in the multiple data groups corresponding to a target identifier in multiple feature identifiers, at least some of the data groups can be screened out from the multiple data groups to form a first data set, and then based on the question text, a search is performed with at least some of the data in the first data set as the search range, and an answer text corresponding to the question text is determined based on the search results. Therefore, before determining the answer text corresponding to the question text, multiple data groups can be screened according to the question text and the feature information corresponding to the target identifier in the multiple data groups to obtain a first data set composed of data groups that are relatively relevant to the question text. Since the feature information corresponding to the target identifier is the feature identifier of any preset information corresponding to the target identifier, the feature information corresponding to the target identifier has a more fixed format and / or content than the feature information corresponding to the feature identifier that is not the target identifier. Compared with randomly screening multiple data groups, the possibility of screening out data related to the question text based on feature information with relatively fixed format and / or content is small, that is, the possibility of data related to the question text in multiple data groups not being in the first data set is small. Furthermore, subsequently, at least part of the data in the first data set is used as the search range for retrieval, and the answer text is determined according to the search results. This can narrow the search range while making the search more comprehensive, so that the data referenced when determining the answer text is more comprehensive, and therefore, the answer text determined according to the question text can be more accurate.
[0031] Furthermore, by constructing different databases that store data in different forms, the answer generation method in the present application can be adapted to different application scenarios. Therefore, the answer generation method in the present application has good scalability.
[0032] In one possible implementation, the event is a vehicle after-sales event. Optionally, the vehicle after-sales event may specifically refer to a vehicle after-sales failure event; the multiple feature identifiers are respectively at least two of an identifier corresponding to a case number, an identifier corresponding to a vehicle identification code, an identifier corresponding to whether the problem has been solved, an identifier corresponding to a brand, an identifier corresponding to a vehicle model, an identifier corresponding to a date, an identifier corresponding to a problem description, an identifier corresponding to a cause, an identifier corresponding to a solution, and an identifier corresponding to a person recording the event; the identifier corresponding to the case number, the identifier corresponding to the vehicle identification code, the identifier corresponding to whether the problem has been solved, the identifier corresponding to the brand, the identifier corresponding to the vehicle model, and the identifier corresponding to the date among the multiple feature identifiers are all target identifiers.
[0033] Among them, the feature identifier can be text or numbers, etc., which is not limited in the embodiments of the present application.
[0034] For example, as in the above example, the multiple feature identifiers are respectively an identifier corresponding to the case number, an identifier corresponding to the vehicle identification code, an identifier corresponding to whether the problem has been solved, an identifier corresponding to the brand, an identifier corresponding to the vehicle model, an identifier corresponding to the date, an identifier corresponding to the problem description, an identifier corresponding to the cause, an identifier corresponding to the solution, and an identifier corresponding to the person who recorded the event, among which the identifier corresponding to the case number, the identifier corresponding to the vehicle identification code, an identifier corresponding to whether the problem has been solved, an identifier corresponding to the brand, an identifier corresponding to the vehicle model, and an identifier corresponding to the date are all target identifiers.
[0035] In a possible implementation, the answer generation method further includes the following specific processing: splitting the question text to obtain text information corresponding to at least some of the feature identifiers among the multiple feature identifiers, and the logical relationship between at least some of the text information.
[0036] In a specific implementation, the question text can be split and processed according to the question body (referring to the target of the question text inquiry, such as what is the reason, what to do, who is it, etc.), question conditions (referring to the conditions that need to be met by the target of the question text inquiry, such as XX brand, XX model, etc.), logical relationships between conditions, and matching column names. The question body includes text information corresponding to at least one feature identifier, the question condition includes text information corresponding to at least one feature identifier, the logical relationship between conditions includes the logical relationship between different text information in the question conditions, and the matching column names include the feature identifier corresponding to each text information.
[0037] For example, if the question text is "What should I do if XXX problem occurs on a car of XX brand?", the result of splitting the question text is as follows:
[0038] Question: What to do?
[0039] Problem conditions: XX brand, XXX problem occurred
[0040] The logical relationship between the conditions: (XX brand) ∩ (XXX problem occurred)
[0041] Matching column names: What to do: Solution, XX brand: Brand, XXX problem occurred: Problem description
[0042] Among them, "What to do" is the text information corresponding to the feature identifier "Solution", "XX brand" is the text information corresponding to the feature identifier "Brand", "XXX problem occurred" is the text information corresponding to the feature identifier "Problem description", and "(XX brand) ∩(XXX problem occurred)" is the logical relationship between the text information "XX brand" and the text information "XXX problem occurred" in the above problem conditions.
[0043] Optionally, the above splitting process can be implemented by a large language model, which is not limited in the embodiment of the present application.
[0044] Based on this:
[0045] The above-mentioned step 102 includes the following specific processing: determining the target identifier in the above-mentioned at least part of the feature identifier as the first identifier; according to the logical relationship, among the feature information corresponding to the first identifier in multiple data groups, the data group containing at least part of the feature information matching the corresponding text information is formed into a first data set, wherein the text information corresponding to the feature information is the text information corresponding to the first identifier corresponding to the feature information.
[0046] In a specific embodiment, after obtaining the split results of the question text, the feature identifiers corresponding to the text information in the question body and the question conditions can be obtained according to the matching column names in the split results, and then each target identifier in this part of the feature identifiers is determined as the first identifier, and then for each first identifier, it is determined whether each feature information corresponding to the first identifier matches the text information corresponding to the first identifier, and according to the logical relationship, the data group containing at least part of the feature information corresponding to the first identifier that matches the text information corresponding to the first identifier is used as the data group in the first data set to obtain the first data set.
[0047] The above process of obtaining the first data set by taking the data group containing at least part of the feature information corresponding to the first identifier that matches the text information corresponding to the first identifier as the data group in the first data set according to the logical relationship can be divided into three stages, and each stage processes a different first identifier, wherein the feature information corresponding to the first identifier in the first stage is obtained by a direct input method, and the format of the feature information is unique, the feature information corresponding to the first identifier in the second stage is obtained by a selected input method, and the feature information corresponding to the first identifier in the third stage is obtained by a direct input method, and the format of the feature information is not unique.
[0048] For example, after obtaining the split result after splitting the problem text, 6 first identifiers can be obtained, which are respectively an identifier corresponding to the case number, an identifier corresponding to the vehicle identification code, an identifier corresponding to whether it has been solved, an identifier corresponding to the brand, an identifier corresponding to the vehicle model, and an identifier corresponding to the date; then, for each of the two first identifiers, the identifier corresponding to the case number and the identifier corresponding to the vehicle identification code, a regular matching method can be used to determine whether each feature information corresponding to the first identifier in all data groups matches the text information corresponding to the first identifier, and according to the logical relationship, the data group containing at least part of the feature information corresponding to the first identifier that matches the text information corresponding to the first identifier is taken as the first data group; then, for each of the three first identifiers, the identifier corresponding to whether it has been solved, the identifier corresponding to the brand, and the identifier corresponding to the vehicle model, a string matching method can be used to determine whether each feature information corresponding to the first identifier in all first data groups matches the text information corresponding to the first identifier, and based on the logical relationship, the data group containing at least part of the feature information corresponding to the first identifier that matches the text information corresponding to the first identifier is taken as the first data group. According to the logical relationship, all first data groups containing at least part of the feature information corresponding to the first identifier that matches the text information corresponding to the first identifier are taken as the second data group; then for the first identifier corresponding to the date, the text information corresponding to the first identifier is first converted into the same format as the feature information corresponding to the first identifier, for example, the text information about the date in the problem condition is converted into a format in which the start and end dates are given in the format of YYYY-MM-DD by using LLM, and then a string matching method is used to determine whether each feature information corresponding to the first identifier in all the second data groups matches the text information corresponding to the first identifier after the format conversion (if the feature information corresponding to the first identifier is within the date specified by the text information corresponding to the first identifier after the format conversion, the two match, otherwise the two do not match), and according to the logical relationship, all second data groups containing at least part of the feature information corresponding to the first identifier that matches the text information corresponding to the first identifier after the format conversion are taken as the third data group, and all the third data groups can constitute the first data set.
[0049] It should be noted that, in the above example, when determining the first data group according to the logical relationship, the first data group is specifically determined according to the specific logical relationship between the text information corresponding to the identifier corresponding to the case number and the identifier corresponding to the vehicle identification code; when determining the second data group according to the logical relationship, the second data group is specifically determined according to the specific logical relationship between the text information corresponding to any two first identifiers among the identifier corresponding to the case number, the identifier corresponding to the vehicle identification code, the identifier corresponding to whether the problem has been solved, the identifier corresponding to the brand, and the identifier corresponding to the vehicle model; when determining the third data group according to the logical relationship, the second data group is specifically determined according to the specific logical relationship between the text information corresponding to any two first identifiers among the identifier corresponding to the case number, the identifier corresponding to the vehicle identification code, the identifier corresponding to whether the problem has been solved, the identifier corresponding to the brand, the identifier corresponding to the vehicle model, and the identifier corresponding to the date; for example, when determining the second data group according to the logical relationship, if the identifier corresponding to the case number (recorded as the first identifier a) and the identifier corresponding to whether the problem has been solved (recorded as the first identifier b) in the logical relationship are in an and relationship, then A first data group may be determined as a second data group only if there is feature information corresponding to the first identifier a that matches the text information corresponding to the first identifier a, and there is feature information corresponding to the first identifier b that matches the text information corresponding to the first identifier b (whether it will be determined as the second data group also depends on the specific logical relationship with other first identifiers). A first data group that only has one of these two feature information will not be determined as a second data group. However, if the identifier corresponding to the case number (recorded as the first identifier a) and the identifier corresponding to whether it has been resolved (recorded as the first identifier b) in the logical relationship are in an or relationship, then a first data group that has feature information corresponding to the first identifier a that matches the text information corresponding to the first identifier a, or a first data group that has feature information corresponding to the first identifier b that matches the text information corresponding to the first identifier b may be determined as a second data group, that is, a first data group that only has one of these two feature information may be determined as a second data group. The specific process of determining the first data group and the third data group according to the logical relationship is similar, and the embodiments of the present application will not be repeated here.
[0050] Therefore, when determining the first data set, not only the text information included in the question text is taken into consideration, but also the logical relationship between at least part of the text information included in the question text is taken into consideration, so as to make the data volume of the first data set smaller and make the data included in the first data set more relevant to the question text. Furthermore, subsequently, at least part of the data in the first data set is used as the search scope for retrieval, and the answer text is determined based on the search results. This can narrow the search scope while making the search more comprehensive, so that the data referenced when determining the answer text is more comprehensive. Therefore, the answer text determined based on the question text is more accurate.
[0051] In a possible implementation, the above step 103 includes the following specific processing: based on the question text and multiple feature identifiers, deleting the feature information corresponding to at least part of the feature identifiers in the first data set to obtain a second data set; based on the question text, searching with the second data set as the search range, and determining the answer text corresponding to the question text based on the search results.
[0052] In an embodiment of the present application, before searching based on the question text, feature information corresponding to at least part of the feature identifiers in the first data set can be deleted based on the question text and multiple feature identifiers, that is, information in the first data set that is not related to the question text can be further deleted, so that the second data set has a smaller data volume than the first data set and has a higher degree of relevance to the question text. Furthermore, subsequent searches are performed using the second data set as the search scope, and the answer text is determined based on the search results. This can further narrow the search scope while making the search more comprehensive, so that the data referenced when determining the answer text is more comprehensive, and therefore, the answer text determined based on the question text is more accurate.
[0053] In a possible implementation, the answer generation method further includes the following specific processing: splitting the question text to obtain text information corresponding to at least some of the feature identifiers among the multiple feature identifiers.
[0054] The specific implementation method for splitting the question text has been described above and will not be repeated here.
[0055] Based on this:
[0056] The above-mentioned process of deleting feature information corresponding to at least some feature identifiers in the first data set based on the question text and multiple feature identifiers to obtain the second data set includes the following specific processing: determining at least some of the above-mentioned feature identifiers as second identifiers respectively (for example, determining each feature identifier in the column name matched above as the second identifier); in the first data set, deleting feature information corresponding to feature identifiers that are different from any second identifiers to obtain the second data set.
[0057] In an embodiment of the present application, after deleting part of the data from multiple data groups to obtain a first data set, when deleting feature information that is not related to the question text, it can be deleted based on the feature identifier corresponding to the text information in the question text obtained by the splitting process, so as to be able to more accurately delete the feature information that is not related to the question text.
[0058] In a possible implementation, the above-mentioned searching is performed based on the question text with the second data set as the search scope, and the answer text corresponding to the question text is determined based on the search result, including: searching based on the question text with the second data set as the search scope to obtain a third data set; inputting the third data set and the question text into the target model to obtain the answer text output by the target model.
[0059] The target model may be LLM or the like.
[0060] In a specific implementation, after obtaining the second data set, a RAG search can be performed based on the question text with the second data set as the search scope. Specifically, the second data set can be input into an embedding model to vectorize the data in the second data set to obtain a vector data set, and the question text can also be input into the embedding model to vectorize the question text to obtain a question vector. Then, based on the question vector and the vector data set, vector data whose similarity to the question vector is greater than or equal to a preset similarity is determined from the vector data set by using a text similarity matching method, and this part of the vector data is converted back into text form to form a third data set. Thereafter, the third data set and the question text can be input into the target model, and the target model can output the answer text corresponding to the question text. In this way, the answer text is determined based on the question text, that is, intelligent question and answer is achieved.
[0061] In the related art, some data groups are randomly selected from multiple data groups as the search scope. Since there are more data with low relevance to the question text in the partial data group, the similarity corresponding to top-3 or top-5 is generally used as the preset similarity. In the embodiment of the present application, the second data set is used as the search scope. Since the data in the second data set is more highly relevant to the question text, the similarity corresponding to top-6 or top-10 can generally be used as the preset similarity. That is, compared with the related art, the present application can use a higher preset similarity to make the third data set obtained after RAG retrieval more relevant to the question text, thereby making the answer text determined according to the question text more accurate.
[0062] Optionally, the embedding model may be a text2vec model or a bge (BAAI General Embedding) model, etc.
[0063] Based on this, since the second data set is obtained by deleting the feature information corresponding to at least part of the feature identifiers in the first data set, which is equivalent to a smaller data volume for each data group in the second data set, when the second data set is used as the retrieval range, the RAG retrieval parameters can be adjusted (for example, not using too high a preset similarity) to retain more data groups. At this time, although the number of data groups is larger, the data volume of the third data set can still meet the processing capacity of the target model, and customized data for different question texts is also achieved.
[0064] Optionally, each module used to execute the answer generation method of the present application is deployed in the cloud, so that each module can be improved differently according to different actual application scenarios, flexibly adapted to the actual scenarios, and has less impact on actual online applications.
[0065] Answer Generator
[0066] Corresponding to the above method embodiment, Figure 2 A schematic diagram of an answer generation device according to an embodiment of the present application is shown. Figure 2 As shown, the answer generating device 200 comprises:
[0067] An acquisition unit 201 is used to acquire multiple data groups, wherein the data groups include feature information corresponding to multiple feature identifiers, the feature information is information about events corresponding to the data groups where the feature information is located, and different data groups correspond to different events;
[0068] A screening unit 202 is used to screen out at least some data groups from the multiple data groups to form a first data set according to the input question text and the feature information corresponding to the target identifier in the multiple feature identifiers in the multiple data groups, wherein the feature information corresponding to the target identifier is the feature identifier of any preset information corresponding to the target identifier;
[0069] The determination unit 203 is used to perform a search based on the question text and at least a portion of the data in the first data set as a search range, and determine the answer text corresponding to the question text based on the search result.
[0070] It should be noted that the answer generation device of this embodiment is used to implement the corresponding answer generation method in the aforementioned method embodiment, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.
[0071] Electronic devices
[0072] Figure 3 This is a schematic block diagram of an electronic device provided in an embodiment of the present application. The specific embodiment of the present application does not limit the specific implementation of the electronic device. Figure 3 As shown, the electronic device may include: a processor 302, a communications interface 304, a memory 306, and a communications bus 308. Among them:
[0073] The processor 302 , the communication interface 304 , and the memory 306 communicate with each other via the communication bus 308 .
[0074] The communication interface 304 is used to communicate with other electronic devices or servers.
[0075] The processor 302 is used to execute the program 310, and specifically can execute the relevant steps in any of the aforementioned answer generation method embodiments.
[0076] Specifically, the program 310 may include program codes, which include computer operation instructions.
[0077] The processor 302 may be a CPU, or an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0078] RISC-V is an open source instruction set architecture based on the Reduced Instruction Set (RISC) principle. It can be applied to various aspects such as single-chip microcomputers and FPGA chips. Specifically, it can be applied to the fields of IoT security, industrial control, mobile phones, personal computers, etc., and because it is designed with small, fast, and low-power realities in mind, it is particularly suitable for modern computing devices such as warehouse-scale cloud computers, high-end mobile phones, and tiny embedded systems. With the rise of artificial intelligence Internet of Things (AIoT), the RISC-V instruction set architecture has also received more and more attention and support, and is expected to become the next generation of widely used CPU architecture.
[0079] The computer operation instructions in the embodiment of the present application may be computer operation instructions based on the RISC-V instruction set architecture, and correspondingly, the processor 302 may be designed based on the RISC-V instruction set. Specifically, the processor chip in the electronic device provided in the embodiment of the present application may be a chip designed using the RISC-V instruction set, and the chip may execute executable code based on the configured instructions, thereby implementing the answer generation method in the above embodiment.
[0080] The memory 306 is used to store the program 310. The memory 306 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0081] The program 310 may be specifically configured to enable the processor 302 to execute the answer generation method in any of the aforementioned embodiments.
[0082] The specific implementation of each step in program 310 can refer to the corresponding description of the corresponding steps and units in any of the above-mentioned answer generation method embodiments, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above-mentioned method embodiments, which will not be repeated here.
[0083] Through the electronic device of the embodiment of the present application, multiple data groups can be obtained, and based on the input question text and the feature information in the multiple data groups corresponding to the target identifier in the multiple feature identifiers, at least part of the data groups can be screened out from the multiple data groups to form a first data set, and then based on the question text, a search is performed with at least part of the data in the first data set as the search range, and the answer text corresponding to the question text is determined based on the search results. Therefore, before determining the answer text corresponding to the question text, multiple data groups can be screened according to the question text and the feature information corresponding to the target identifier in the multiple data groups to obtain a first data set composed of data groups that are relatively relevant to the question text. Since the feature information corresponding to the target identifier is the feature identifier of any preset information corresponding to the target identifier, the feature information corresponding to the target identifier has a more fixed format and / or content than the feature information corresponding to the feature identifier that is not the target identifier. Compared with randomly screening multiple data groups, the possibility of screening out data related to the question text based on feature information with relatively fixed format and / or content is small, that is, the possibility of data related to the question text in multiple data groups not being in the first data set is small. Furthermore, subsequently, at least part of the data in the first data set is used as the search range for retrieval, and the answer text is determined according to the search results. This can narrow the search range while making the search more comprehensive, so that the data referenced when determining the answer text is more comprehensive, and therefore, the answer text determined according to the question text can be more accurate.
[0084] Computer storage media
[0085] The present application also provides a computer-readable storage medium storing instructions for causing a machine to execute the answer generation method as described herein. Specifically, a system or device equipped with a storage medium can be provided, on which a software program code implementing the functions of any of the above embodiments is stored, and a computer (or CPU or MPU) of the system or device reads and executes the program code stored in the storage medium.
[0086] In this case, the program code read from the storage medium itself can implement the function of any one of the above embodiments, so the program code and the storage medium storing the program code constitute part of the present application.
[0087] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.
[0088] Computer program product
[0089] An embodiment of the present application also provides a computer program product, including computer instructions, which instruct a computing device to perform any corresponding operation in the above-mentioned multiple method embodiments.
[0090] It should be noted that the user-related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to sample data used to train the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present 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 need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0091] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0092] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a special-purpose processor or programmable or special-purpose hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown here, the execution of the code converts the general-purpose computer into a special-purpose computer for executing the method shown here.
[0093] It should be noted that the user-related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to sample data used to train the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present 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 need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0094] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for specific applications, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
[0095] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.
Claims
1. A method for generating an answer, characterized in that: include: Acquire multiple data groups, wherein the data groups include feature information corresponding to multiple feature identifiers, the feature information is information about events corresponding to the data groups where the feature information is located, and different data groups correspond to different events; According to the input question text and the feature information in the multiple data groups corresponding to the target identifier in the multiple feature identifiers, at least part of the data groups are screened out from the multiple data groups to form a first data set, wherein the feature information corresponding to the target identifier is the feature identifier of any preset information corresponding to the target identifier; According to the question text, a search is performed with at least part of the data in the first data set as a search scope, and an answer text corresponding to the question text is determined according to the search result.
2. The method according to claim 1, characterized in that The method further comprises: Splitting the question text to obtain text information corresponding to at least some of the feature identifiers, and logical relationships between at least some of the text information; The step of selecting at least part of the data groups from the plurality of data groups according to the input question text and the feature information corresponding to the target identifier in the plurality of feature identifiers to form a first data set includes: Determine the target identifier in the at least part of the feature identifiers as a first identifier; According to the logical relationship, among the feature information corresponding to the first identifier in the multiple data groups, the data group containing at least part of the feature information that matches the corresponding text information will form the first data set, wherein the text information corresponding to the feature information is the text information corresponding to the first identifier corresponding to the feature information.
3. The method according to claim 1, characterized in that The step of searching based on the question text and taking at least part of the data in the first data set as a search scope, and determining the answer text corresponding to the question text based on the search result, includes: According to the question text and the multiple feature identifiers, deleting feature information corresponding to at least part of the feature identifiers in the first data set to obtain a second data set; According to the question text, a search is performed with the second data set as a search scope, and an answer text corresponding to the question text is determined according to the search result.
4. The method according to claim 3, characterized in that The method further comprises: Splitting the question text to obtain text information corresponding to at least some of the multiple feature identifiers; The step of deleting feature information corresponding to at least part of the feature identifiers in the first data set according to the question text and the multiple feature identifiers to obtain a second data set includes: Determining at least part of the characteristic identifiers as second identifiers respectively; In the first data set, feature information corresponding to the feature identifiers that are different from any of the second identifiers is deleted to obtain the second data set.
5. The method according to claim 3, characterized in that: The step of searching the question text with the second data set as a search scope, and determining the answer text corresponding to the question text according to the search result includes: According to the question text, searching the second data set as a search scope to obtain a third data set; The third data set and the question text are input into a target model, and the answer text output by the target model is obtained.
6. The method according to any one of claims 1 to 5, characterized in that The incident described is a post-sale vehicle incident; The multiple feature identifiers are at least two of an identifier corresponding to the case number, an identifier corresponding to the vehicle identification code, an identifier corresponding to whether the problem has been solved, an identifier corresponding to the brand, an identifier corresponding to the vehicle model, an identifier corresponding to the date, an identifier corresponding to the problem description, an identifier corresponding to the cause, an identifier corresponding to the solution, and an identifier corresponding to the person who recorded the event; Among the multiple feature identifiers, the identifier corresponding to the case number, the identifier corresponding to the vehicle identification code, the identifier corresponding to whether the problem has been solved, the identifier corresponding to the brand, the identifier corresponding to the vehicle model, and the identifier corresponding to the date are all the target identifiers.
7. An answer generation device, characterized in that: include: An acquisition unit, used for acquiring a plurality of data groups, wherein the data groups include characteristic information corresponding to a plurality of characteristic identifiers, the characteristic information is information of an event corresponding to the data group where the characteristic information is located, and different data groups correspond to different events; a screening unit, configured to screen out at least some of the data groups from the plurality of data groups to form a first data set according to an input question text and feature information in the plurality of data groups corresponding to a target identifier in the plurality of feature identifiers, wherein the feature information corresponding to the target identifier is the feature identifier of any preset information corresponding to the target identifier; The determination unit is used to perform a search based on the question text and at least a portion of the data in the first data set as a search range, and determine the answer text corresponding to the question text based on the search result.
8. An electronic device, characterized in that: include: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute an operation corresponding to the method according to any one of claims 1 to 6.
9. A computer storage medium, characterized in that: A computer program is stored thereon, and when the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that The method comprises computer instructions for instructing a computing device to execute the method according to any one of claims 1 to 6.