Intelligent question and answer method and device and electronic equipment

By conducting compliance inspections on the results of the Q & A system, the problem of low content accuracy of large -language models has been solved, and data security and public opinion stability is ensured.

CN119336882APending Publication Date: 2025-01-21SHANGHAI HUAXING DIGITAL TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411427327.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

In the intelligent question-and-answer system, when responding to user questions, large language models may have low accuracy in generating content due to model size and randomness factors, which affects data security and may cause public opinion risks.

Method used

After generating the question and answer results, the results are checked in compliance. If the rules are displayed, the question and answer results are displayed.

Benefits of technology

To ensure the accuracy and legality of the question and answer results through compliance, avoid affecting data security and reducing the risk of public opinion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336882A_ABST
    Figure CN119336882A_ABST
Patent Text Reader

Abstract

The invention provides an intelligent question and answer method and device and electronic equipment, and the method comprises the steps: carrying out the retrieval in a knowledge base based on an obtained user question, generating a question and answer result, carrying out the compliance check of the question and answer result, obtaining a first check result, and displaying the question and answer result when the first check result represents that the question and answer result is compliant. When the first check result represents that the question and answer result is not compliant, first prompt information is displayed, and the first prompt information is used for prompting that the question and answer result is not compliant. Therefore, the question-answer result is generated and displayed when the question-answer result is compliant, so that the response to the user question can be ensured to be legal and compliant, and the influence on data security and even the public opinion risk are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and specifically to an intelligent question-answering method, device, and electronic device. Background Art

[0002] Intelligent question-answering system is a system that uses artificial intelligence technologies, such as natural language processing and large language models, to automatically understand, process and respond to user questions. It is widely used in customer service, technical support, e-commerce and online consultation. Among them, the large language model can be trained based on massive data and store knowledge in the weights of the neural network.

[0003] When using a large language model to generate knowledge beyond the training data, the output of the large language model may be inaccurate, resulting in model hallucinations. To avoid model hallucinations, retrieval-enhanced generation technology can be used to combine the generation model, i.e. the large language model mentioned above, with the retriever module, first building an external knowledge base to store new knowledge, and using retrieval and enhancement technology to provide the large language model with additional information from the external knowledge base.

[0004] In the process of intelligent question-answering systems using large language models to respond to user questions, although users do not subjectively engage in improper use of the system, it is limited by the scale of the model and the influence of random factors, and the model is easily misled. This may lead to low accuracy of the content generated by the model during the question-answering process, thereby affecting data security and even causing public opinion risks. Summary of the invention

[0005] Based on the defects and shortcomings of the above-mentioned prior art, the present application proposes an intelligent question and answer method, device and electronic device, which can perform a compliance check on the question and answer results after generating the question and answer results, display the question and answer results when they are compliant, and display a first prompt message when the question and answer results are not compliant, so as to solve the problem that the accuracy of the content generated by the model during the question and answer process is low, thereby affecting data security and even causing public opinion risks.

[0006] According to a first aspect of an embodiment of the present application, there is provided an intelligent question-answering method, comprising:

[0007] Get user questions;

[0008] Searching the knowledge base based on the user question to generate a question-answering result;

[0009] Performing a compliance check on the question and answer result to obtain a first check result;

[0010] If the first inspection result indicates that the question and answer result is compliant, displaying the question and answer result;

[0011] If the first inspection result indicates that the question and answer result is not compliant, a first prompt message is displayed, where the first prompt message is used to prompt that the question and answer result is not compliant.

[0012] In some embodiments, the method further comprises:

[0013] Performing a compliance check on the user question to obtain a second check result;

[0014] If the second inspection result indicates that the user question is compliant, performing the operation of searching the knowledge base based on the user question and generating a question-answer result;

[0015] If the second inspection result indicates that the user problem is not compliant, a second prompt message is displayed, where the second prompt message is used to prompt the user that the user problem is not compliant.

[0016] In some embodiments, performing a compliance check on the question and answer result to obtain a first check result includes:

[0017] Based on the question-answer result and in combination with the first prompt word template, a first prompt word is generated;

[0018] Inputting the first prompt word into a large language model, performing a compliance check on the question and answer result, and obtaining the first check result;

[0019] The performing a compliance check on the user question to obtain a second check result includes:

[0020] Based on the user question and in combination with the second prompt word template, generate a second prompt word;

[0021] The second prompt word is input into the large language model, and a compliance check is performed on the user question to obtain the second check result.

[0022] In some embodiments, searching the knowledge base based on the user question to generate a question-and-answer result includes:

[0023] Based on the user question, the knowledge in the knowledge base is searched to obtain target-related knowledge, where the target-related knowledge is at least one piece of knowledge in the knowledge base;

[0024] Based on the target-related knowledge and in combination with a third prompt word template, generating a third prompt word;

[0025] The third prompt word is input into the large language model to generate the question-answering result.

[0026] In some embodiments, searching the knowledge in the knowledge base based on the user question to obtain target-related knowledge includes:

[0027] Based on the user question, the knowledge in the knowledge base is matched to determine the similarity between the knowledge in the knowledge base and the user question;

[0028] Determining initial relevant knowledge based on the similarity between the knowledge in the knowledge base and the user question;

[0029] Based on the difference between the current time and the creation time of the initial relevant knowledge, the similarity between the initial relevant knowledge and the user question is adjusted to obtain a target similarity, where the target similarity is the adjusted similarity between the initial relevant knowledge and the user question;

[0030] The initial relevant knowledge is screened based on the target similarity to obtain the target relevant knowledge.

[0031] In some embodiments, the method further comprises:

[0032] Obtain knowledge materials to be updated;

[0033] Acquiring the knowledge to be updated from the knowledge material to be updated based on a target text segmenter, wherein the target text segmenter is a text segmenter corresponding to the data type of the knowledge material to be updated;

[0034] The knowledge to be updated is periodically stored in the knowledge base.

[0035] In some embodiments, the step of acquiring the knowledge to be updated from the knowledge material to be updated based on the target text segmenter includes:

[0036] If the data type of the knowledge material to be updated is structured data, the text segmenter corresponding to the structured data is determined as the target text segmenter, and based on the target text segmenter, the target data in the knowledge material to be updated is combined to obtain the knowledge to be updated;

[0037] If the data type of the knowledge material to be updated is unstructured data, the text segmenter corresponding to the unstructured data is determined as the target text segmenter, and based on the target text segmenter, the target data is extracted from the knowledge material to be updated through a large language model, and the target data is combined into the knowledge to be updated.

[0038] In some embodiments, the target data includes a label, a fault description and a creation time, the label is a complete description of the fault phenomenon, the fault cause or the fault solution, the fault description includes a comprehensive description of the fault phenomenon, the fault cause and the fault solution, and the creation time is the collection time of the knowledge material to be updated.

[0039] According to a second aspect of an embodiment of the present application, there is provided an intelligent question-answering device, comprising:

[0040] Acquisition module, used to obtain user questions;

[0041] A generation module, used to search the knowledge base based on the user question and generate a question-answering result;

[0042] A checking module, used for performing a compliance check on the question and answer result to obtain a first checking result;

[0043] The display module is used to display the question and answer result if the first inspection result indicates that the question and answer result is compliant, and to display a first prompt message if the first inspection result indicates that the question and answer result is not compliant, wherein the first prompt message is used to prompt that the question and answer result is not compliant.

[0044] According to a third aspect of an embodiment of the present application, there is provided an electronic device, including a memory and a processor;

[0045] The memory is connected to the processor and is used to store programs;

[0046] The processor is used to implement the intelligent question-answering method as described in the first aspect by running the program in the memory.

[0047] According to a fourth aspect of an embodiment of the present application, a storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the intelligent question and answer method as described in the first aspect is implemented.

[0048] In the intelligent question-and-answer method, device, and electronic device provided by the present invention, a question-and-answer result can be generated by searching the knowledge base based on the acquired user question, and the compliance check can be performed on the question-and-answer result to obtain a first check result. When the first check result indicates that the question-and-answer result is compliant, the question-and-answer result is displayed. When the first check result indicates that the question-and-answer result is not compliant, a first prompt message is displayed, and the first prompt message is used to prompt that the question-and-answer result is not compliant. In this way, when the question-and-answer result is generated and the question-and-answer result is compliant, the question-and-answer result is displayed, which can ensure that the response to the user's question is legal and compliant, avoiding affecting data security or even causing public opinion risks. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] 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 embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0050] Figure 1 A flowchart of an intelligent question-answering method provided in an embodiment of the present application;

[0051] Figure 2 A schematic diagram of a compliance check process provided in an embodiment of the present application;

[0052] Figure 3 A schematic diagram of a relevant knowledge screening process provided in an embodiment of the present application;

[0053] Figure 4 A schematic diagram of a knowledge base update process proposed in an embodiment of the present application;

[0054] Figure 5 A schematic diagram of an intelligent question-answering system proposed in an embodiment of the present application;

[0055] Figure 6 A schematic diagram of the structure of an intelligent question-answering device proposed in an embodiment of the present application;

[0056] Figure 7 A schematic diagram of the structure of an electronic device proposed in an embodiment of the present application. DETAILED DESCRIPTION

[0057] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0058] As described in the background technology, in the process of the intelligent question-answering system using a large language model to respond to user questions, although the user does not subjectively engage in improper use of the information, it is limited by the model size and random factors, and the model is easily misled. This may lead to low accuracy of the content generated by the model during the question-answering process, thereby affecting data security and even causing public opinion risks.

[0059] On this basis, the inventors have found through further research that by searching the knowledge base based on the acquired user questions, generating question and answer results, and performing compliance checks on the question and answer results, a first check result is obtained. When the first check result indicates that the question and answer results are compliant, the question and answer results are displayed. When the first check result indicates that the question and answer results are not compliant, a first prompt message is displayed, and the first prompt message is used to indicate that the question and answer results are not compliant. In this way, when the question and answer results are generated and the question and answer results are compliant, the question and answer results are displayed, which can ensure that the responses to user questions are legal and compliant, avoiding affecting data security or even causing public opinion risks.

[0060] Based on the above concept, an embodiment of this specification provides an intelligent question and answer method, which will be exemplarily described below in conjunction with the accompanying drawings.

[0061] See also Figure 1 In an exemplary embodiment, an intelligent question-answering method is provided, which is applied to any electronic device. Figure 1 As shown, the intelligent question-answering method includes steps S101-S104:

[0062] S101: Obtain user questions.

[0063] The user's question is obtained through voice, text, instructions, etc. input by the user.

[0064] S102: Search the knowledge base based on the user's question and generate a question-answering result.

[0065] Based on the user's question, the external knowledge base is called through the large language model, and the knowledge stored in the knowledge base is retrieved to obtain the knowledge related to the user's question, that is, to obtain relevant knowledge.

[0066] Generally, the relevant knowledge is the knowledge in the knowledge base whose matching degree with the user's question exceeds a preset matching degree, wherein the matching degree may refer to similarity.

[0067] Specifically, based on the user question and the question and answer prompt word template, a question and answer prompt is generated, the question and answer prompt includes the user question, and the question and answer prompt is input into the large language model. The large language model performs knowledge retrieval based on the question and answer prompt, obtains relevant knowledge, and generates a question and answer result based on the relevant knowledge.

[0068] S103: Perform a compliance check on the question and answer result to obtain a first check result.

[0069] Based on the question-and-answer result obtained in step S102 and the corresponding compliance check prompt word template, a compliance check prompt word is generated, and the compliance check prompt word includes the question-and-answer result. Afterwards, the compliance check prompt word is input into the large language model to call the large language model to perform compliance check on the question-and-answer result based on the compliance check prompt word, including but not limited to whether it violates laws and regulations and violates common knowledge.

[0070] Among them, the first inspection result is used to indicate whether the question and answer result is compliant.

[0071] It should also be noted that the large language model involved in S102 and S103 can be the same large language model or different types of large language models. The large language model involved in S102 and S103 can be a general large model or a large language model trained based on different tasks.

[0072] S104: If the first inspection result indicates that the question and answer result is compliant, the question and answer result is displayed; if the first inspection result indicates that the question and answer result is not compliant, a first prompt message is displayed.

[0073] Among them, the first prompt information is used to prompt that the question and answer result is not compliant.

[0074] The first prompt information may be in text form.

[0075] While the first prompt information is displayed, the first prompt information can be played by voice.

[0076] The first prompt information may also include reasons for non-compliance and modification suggestions, etc., so as to adjust the generated question and answer results, output compliant question and answer results as soon as possible, and ensure question and answer efficiency.

[0077] In this embodiment, by searching the knowledge base based on the acquired user questions, generating question and answer results, and performing compliance checks on the question and answer results, a first check result is obtained. When the first check result indicates that the question and answer results are compliant, the question and answer results are displayed. When the first check result indicates that the question and answer results are not compliant, a first prompt message is displayed, and the first prompt message is used to prompt that the question and answer results are not compliant. In this way, when the question and answer results are generated and the question and answer results are compliant, the question and answer results are displayed, which can ensure that the responses to user questions are legal and compliant, avoiding affecting data security or even causing public opinion risks.

[0078] Since user questions are affected by subjective and objective factors, they may also be non-compliant. To ensure the accuracy of the generated question and answer results, in some embodiments, after obtaining the user questions, the user questions are checked for compliance to obtain a second check result, and subsequent operations are performed based on the second check result.

[0079] Similarly, the second check result is used to characterize whether the user question is compliant.

[0080] If the second check result indicates that the user question is compliant, a subsequent search operation is performed, that is, a search is performed in the knowledge base based on the user question to generate a question and answer result.

[0081] Correspondingly, if the second inspection result indicates that the user's question is not compliant, a second prompt message is displayed.

[0082] The second prompt information is used to prompt the user that the question is not compliant.

[0083] Similarly, the second prompt information includes the reason why the user's question is non-compliant and / or modification suggestions.

[0084] Specifically, if the second check result indicates that the user problem is not compliant, a second prompt message is first generated, and then a compliance check is performed on the second prompt message. When the second prompt message passes the compliance check, that is, the second prompt message is compliant, the second prompt message is displayed.

[0085] More specifically, a prompt word is constructed according to the fourth prompt word template, and the prompt word is input into the large language model to generate the second prompt information.

[0086] Correspondingly, when the second prompt information fails to pass the compliance check, that is, the second prompt information is not compliant, the second prompt information is not displayed, and the third prompt information is displayed.

[0087] The third prompt information is used to indicate that the second prompt information is non-compliant.

[0088] Similarly, the third prompt information may include reasons for the non-compliance of the second prompt information and / or modification suggestions.

[0089] According to different actual needs, the third prompt information is also used to indicate that the user's question is non-compliant, and may even include reasons for the user's question being non-compliant and / or modification suggestions.

[0090] In this embodiment, a compliance check is performed on user questions, and based on whether the user questions are compliant, a search is performed to generate question and answer results when the user questions are compliant, and a second prompt message is displayed when the user questions are not compliant to remind the user of the non-compliant questions, thereby ensuring the compliance of the user questions, and further ensuring the accuracy of the question and answer results generated based on the user questions to avoid affecting data security.

[0091] In some embodiments, when a compliance check is performed on the question and answer results and a first check result is obtained, a large language model is called based on the question and answer results and combined with a first prompt word template to perform a compliance check on the question and answer results and obtain the first check result.

[0092] Specifically, based on the question-answering result and the first prompt word template, the question-answering result is added to the first prompt word template to obtain the first prompt word, that is, the first prompt word is generated. Afterwards, based on the first prompt word, the large language model is called to perform a compliance check on the question-answering result to obtain a first check result.

[0093] That is, the first prompt word is input into the large language model, and the compliance check is performed on the question and answer result in the first prompt word to obtain a first check result.

[0094] When a compliance check is performed on the user question and a second check result is obtained, based on the user question and in combination with the second prompt word template, a large language model is called to perform a compliance check on the question and answer result to obtain a second check result.

[0095] Specifically, based on the user question and in combination with the second prompt word template, the user question is added to the second prompt word template to obtain the second prompt word, that is, the second prompt word is generated. Then, based on the second prompt word, the large language model is called to perform a compliance check on the user question in the second prompt word to obtain a second check result.

[0096] Among them, the first prompt word template and the second prompt word template can be the same, that is, the above-mentioned compliance check prompt word template, and the first prompt word is the above-mentioned compliance check prompt word. At this time, the question and answer result in the first prompt word is replaced with the user question to obtain the second prompt word.

[0097] It can be explained that the large language model used in the compliance check can be selected according to the hardware and software conditions and model performance. For example, in this embodiment, chatglm2-6B can be selected as the large language model used in the compliance check.

[0098] In addition, the compliance check of user questions and Q&A results can be developed as an independent API. Compliance check can be performed by calling this API in smart Q&A.

[0099] For example, the implementation method within the API, i.e., the compliance check process, can be as follows: Figure 2 As shown, the user question / question and answer result is obtained, the prompt word is constructed according to the prompt word template of the compliance check, and the check result is generated by the large language model, so as to obtain a judgment result that can characterize whether the user question / question and answer result is compliant or not, and the judgment result is output.

[0100] In this embodiment, corresponding prompt words are generated based on the content that requires compliance check, i.e., user questions or question and answer results, and compliance checks are performed based on the corresponding prompt words to obtain inspection results. This saves a lot of manual review costs and improves the security of question and answer with little impact on users and thus on user experience (mainly referring to the length of question and answer time).

[0101] In some embodiments, a search is performed in a knowledge base based on a user question, and when generating a question and answer result, the knowledge in the knowledge base is searched based on the user question to obtain target-related knowledge, and then a question and answer result is generated based on the target-related knowledge.

[0102] The target-related knowledge is at least one piece of knowledge in the knowledge base.

[0103] Specifically, based on the user question, a matching search is performed in the knowledge base to determine the matching degree between the knowledge in the knowledge base and the user question, and based on the matching degree, at least one piece of knowledge in the knowledge base is determined to be target-related knowledge.

[0104] In addition, when generating question and answer results based on target-related knowledge, a third prompt word, i.e. the above-mentioned question and answer prompt word template, can be generated based on the target-related knowledge and combined with a third prompt word template, i.e. the above-mentioned question and answer prompt. After that, the third prompt word is input into the large language model to generate the question and answer result.

[0105] For an introduction to the large language model, please refer to the above introduction to the large language model used for compliance checking, which will not be repeated here.

[0106] In this embodiment, knowledge in the knowledge base is retrieved based on user questions to obtain target-related knowledge, and prompt words are generated based on the target-related knowledge, and then question and answer results are generated through a large language model to achieve intelligent responses to user questions and achieve the effect of intelligent question and answer.

[0107] In some embodiments, when the target-related knowledge is obtained by matching the knowledge in the knowledge base based on the user's question, the matching degree between the knowledge in the knowledge base and the user's question is determined, and then the initial-related knowledge is determined based on the matching degree between the knowledge in the knowledge base and the user's question, and then the initial-related knowledge is screened to obtain the target-related knowledge.

[0108] Specifically, similarity can be used as the matching degree, that is, similarity matching is performed on the knowledge in the knowledge base based on the user's question to determine the similarity between the knowledge in the knowledge base and the user's question.

[0109] The knowledge in the knowledge base includes labels, fault descriptions, and creation time.

[0110] More specifically, based on the labels of the user question and the knowledge in the knowledge base, similarity matching is performed on the knowledge in the knowledge base, and the similarity between the labels of the knowledge in the knowledge base and the user question is determined as the similarity between the knowledge in the knowledge base and the user question.

[0111] Among them, the label is used to match the user's question and determine the similarity between the knowledge item corresponding to the label and the user's question. The fault description is used to generate the question-and-answer result in response to the user's question.

[0112] Afterwards, using similarity as the matching degree, based on the matching degree between the knowledge in the knowledge base and the user's question, when determining the initial relevant knowledge, the knowledge in the knowledge base whose similarity with the user's question is greater than the preset similarity is determined as the initial relevant knowledge.

[0113] Afterwards, the initial relevant knowledge is screened to obtain the target relevant knowledge. Based on the current time, the creation time of the initial relevant knowledge, and the similarity between the initial relevant knowledge and the user's question, the initial relevant knowledge is screened to obtain the target relevant knowledge.

[0114] The creation time of the initial relevant knowledge is the time when the knowledge material containing the initial relevant knowledge is obtained. Of course, based on different actual needs, the creation time of the initial relevant knowledge can also be the time when the initial relevant knowledge is stored in the knowledge base.

[0115] Specifically, based on the difference between the current time and the creation time of the initial relevant knowledge, the similarity between the initial relevant knowledge and the user question is adjusted to obtain the target similarity, and the corresponding initial relevant knowledge is screened based on the target similarity to obtain the target relevant knowledge.

[0116] Among them, the target similarity is the similarity between the adjusted initial relevant knowledge and the user question, which corresponds to the initial knowledge.

[0117] It is understandable that the earlier the creation time of the initial relevant knowledge, the greater the difference between the current time and the creation time, and the worse the referenceability of the initial relevant knowledge. Therefore, under the same similarity, the earlier the creation time, that is, the greater the difference between the current time and the creation time, the smaller the target similarity obtained after adjustment.

[0118] More specifically, based on the difference between the current time and the creation time of the initial relevant knowledge, a corresponding weight is applied to the similarity between the initial relevant knowledge and the user's question. The earlier the creation time, the greater the difference, and the smaller the target similarity obtained after applying the corresponding weight. Of course, the corresponding weight can also be applied directly to the similarity between the initial relevant knowledge and the user's question based on the creation time of the initial relevant knowledge.

[0119] Among them, the weight is the inverse coefficient.

[0120] In addition, the weight may also be related to the time unit. For example, the weight corresponding to a time difference within one year is 0.7, the weight corresponding to a time difference within two years is 0.3, and the weight corresponding to a time difference within one day is other coefficients such as 0.9.

[0121] For example, the target similarity between each initial relevant knowledge and the user question can be determined according to the formula s=s_0*(t_now-t)*coe. Among them, s_0 is the original similarity, t_now is the current time, t is the timestamp corresponding to the generation of the relevant knowledge, coe is the custom reverse coefficient, and s is the recalculated similarity, that is, the target similarity. Among them, the parameters in the formula can be adjusted accordingly based on actual needs.

[0122] The initial relevant knowledge is screened based on the target similarity. When the target relevant knowledge is obtained, the initial relevant knowledge is sorted in descending order of target similarity based on the target similarity between each initial relevant knowledge and the user question to obtain the target sorting. After that, the initial relevant knowledge with the first preset number of digits in the target sorting is retained, and the other initial relevant knowledge is deleted to obtain the target relevant knowledge.

[0123] The preset number may be a directly determined preset value.

[0124] Of course, based on different actual needs, the preset number can also be determined based on the above-mentioned preset similarity or other similarity threshold, that is, the initial relevant knowledge in the target sorting whose target similarity is greater than the preset similarity or other similarity threshold is retained, and other initial relevant knowledge is deleted to obtain the target relevant knowledge.

[0125] For example, the relevant knowledge screening process can be as follows: Figure 3 As shown, taking the number of initial relevant knowledge as 20 as an example, 20 initial relevant knowledge are retrieved and matched from the vector database (i.e., the above-mentioned knowledge base) according to the user question. These 20 initial relevant knowledge have the highest correlation with the user question relative to other knowledge in the vector database. Afterwards, according to the timestamp, i.e., the creation timestamp parameter of these 20 initial relevant knowledge, a weight is applied to the similarity between the initial relevant knowledge and the user question, and the similarity (between each initial relevant knowledge and the user question) is recalculated. Among them, the greater the difference between the creation time and the current time, the smaller the weight applied, and the similarity after the weight is applied will also become smaller. Afterwards, based on the new similarity of the 20 initial relevant knowledge obtained by recalculation (i.e., the above-mentioned target similarity), these 20 initial relevant knowledge are reordered according to the new similarity, and the top 5 knowledge are selected as the target relevant knowledge.

[0126] The number of initial relevant knowledge, 20, and the number of target relevant knowledge, 5, can be determined based on actual needs and are not limited to the 20 and 5 proposed here.

[0127] In this embodiment, based on the creation time of the knowledge in the knowledge base, the similarity between the knowledge in the knowledge base and the user's question is adjusted to obtain a target similarity that can reflect whether the knowledge matches the user's question, and based on the target similarity, the initial similarity is screened to obtain target-related knowledge. In this way, on the basis of vector similarities of the same size, the initial related knowledge with a more distant creation time, i.e., a larger difference between the creation time and the current time, can be screened out to obtain target-related knowledge that is more relevant to the user's question, thereby improving the accuracy of the question and answer results generated based on the target-related knowledge. Compared with the overall update of the knowledge base (eliminating the false and retaining the true), it is easier and faster to determine accurate question and answer results and reduce the question and answer cost.

[0128] In order to ensure the real-time nature of the knowledge in the knowledge base, retrieve real-time and accurate relevant knowledge, and thus improve the accuracy of the question and answer results, in some embodiments, the knowledge base is updated periodically.

[0129] When the knowledge base is updated periodically, the knowledge material to be updated is first obtained, the knowledge to be updated is obtained from the knowledge material to be updated, and the knowledge to be updated is periodically stored in the knowledge base. Of course, based on different actual needs, the knowledge material to be updated can also be periodically obtained, and the knowledge to be updated obtained from the knowledge material to be updated can be stored in the knowledge base.

[0130] Specifically, a target text segmenter may be used to obtain the knowledge to be updated from the knowledge material to be updated, wherein the target text segmenter is a text segmenter corresponding to the data type of the knowledge material to be updated.

[0131] It is understandable that the text segmenters corresponding to the above-mentioned different data types are pre-set and can be used on demand when the knowledge to be updated is uploaded to the knowledge base, so as to improve the text segmentation effect in a targeted manner and ensure the consistency of the content and semantics obtained by segmentation, thereby improving the accuracy of knowledge retrieval (or knowledge recall) and helping the large language model to generate better question and answer results.

[0132] In this embodiment, based on the text segmenter corresponding to the data type of the material to be updated, that is, the target text segmenter, accurate knowledge to be updated can be quickly obtained from the knowledge material to be updated, and then the extracted knowledge to be updated is periodically stored in the knowledge base, which can realize the periodic update of the knowledge base and effectively ensure the real-time and accuracy of the knowledge in the knowledge base.

[0133] Specifically, in some embodiments, a target text segmenter is first determined based on the data type of the knowledge material to be updated, and then target data is obtained from the knowledge material to be updated based on the target text segmenter and combined to obtain the knowledge to be updated.

[0134] When the knowledge materials to be updated are divided into structured data and unstructured data:

[0135] If the data type of the knowledge material to be updated is structured data, the text segmenter corresponding to the structured data is determined as the target text segmenter, and based on the target text segmenter, the target data in the knowledge material to be updated is combined to obtain the knowledge to be updated.

[0136] The target data includes labels, fault descriptions, and creation time.

[0137] For example, a tag is a single description of a fault phenomenon, fault cause, or fault solution, etc., a fault description is a comprehensive description of the fault phenomenon, fault cause, and fault solution, etc., and the creation time is the collection time of the corresponding knowledge material to be updated. The collection time of the knowledge material to be updated can also be said to be the creation time of the knowledge material to be updated. The two expressions are different, but the meaning is the same.

[0138] That is to say, in order to obtain better retrieval results, the text block obtained by the custom text segmenter, i.e., the target data, includes the text content to be vectorized, i.e., the label, the text content to be retrieved and matched, i.e., the fault description, and the creation time, i.e., the collection time of the knowledge material to be updated. The role of the creation time can be seen in the above content, and can be used to recalculate the target similarity between the initial relevant knowledge and the user's question.

[0139] Exemplarily, the knowledge material to be updated whose data type is structured data may be, for example, order records accumulated by a customer relationship management (CRM) system in the process of providing after-sales services to users. Order records usually contain triples such as "fault phenomenon, fault cause, and fault solution", and the order data is stored in a structured database Mysql; it may also be, for example, a product design table that does not need to be stored in the CRM system, containing triples such as "fault code, fault name, and fault solution".

[0140] Since the data in the structured knowledge material to be updated is stored in a certain format such as a table, it can be directly obtained from the knowledge material to be updated. Therefore, for structured data, the target data in the knowledge material to be updated can be directly combined based on the target text segmenter to obtain the required knowledge to be updated.

[0141] Correspondingly, if the data type of the knowledge material to be updated is unstructured data, the text segmenter corresponding to the unstructured data is determined as the target text segmenter, and based on the target text segmenter, the target data is extracted from the knowledge material to be updated through the large language model, and the target data is combined into the knowledge to be updated.

[0142] In other words, the target text segmenter needs to use the understanding and analysis capabilities of the large language model to understand and analyze the knowledge materials to be updated to extract the target data. For an introduction to the target data, see the above content.

[0143] For example, in the field of intelligent question and answer of engineering machinery, users usually obtain the cause and solution of the fault through question and answer, such as inputting a description of the fault phenomenon, etc. When the user does not know the cause and solution of the fault, he usually only provides a description of the fault phenomenon during the question and answer process, including but not limited to giving a textual description of the corresponding fault phenomenon and providing a fault code, etc.

[0144] Exemplarily, the data structure is unstructured knowledge material to be updated, which may be, for example, training materials in PDF format. Generally, one PDF file corresponds to an independent fault phenomenon.

[0145] Exemplarily, the large language model for extracting target data may be, for example, ChatGPT, which is used to post-process the data in the document to obtain target data that is more coherent, clear, and meets the needs of question and answer.

[0146] Specifically, before text segmentation of the knowledge document, that is, the knowledge material to be updated, the content and scope of the knowledge material can be determined first, the knowledge material required for the knowledge base update can be selected, and the required knowledge material to be updated can be loaded into the system code. After that, a suitable text segmenter is automatically selected according to the data format and other characteristics of the knowledge material to be updated, that is, a text segmenter corresponding to the data format and other characteristics. Finally, the segmented text information is vectorized and stored in the knowledge base. Among them, this entire knowledge update process can be solidified into a standard process, and the content in the knowledge base can be automatically updated at a regular interval to ensure the timeliness of the knowledge in the database.

[0147] Before loading the knowledge material to be updated into the system code, the knowledge material to be used, ie, the knowledge material to be updated, may be subjected to data cleaning and other processing, and then the processed knowledge material to be updated may be loaded into the system code.

[0148] For example, the knowledge base update process can be as follows: Figure 4As shown, first obtain various knowledge materials, and use the document loader to load various knowledge materials into the system code. For different knowledge materials, if the knowledge materials (such as CRM orders) are stored in the database, then this node will pull data from the database through the document loader. After that, the pulled data is preprocessed with knowledge. Only simple combination operations are required to extract the page_content content. After removing spaces, adding necessary punctuation marks, and combining different contents, full_content is obtained. For unstructured data in PDF format, such as training materials, we use the power of the big model to extract tags from the materials, such as the description of the fault phenomenon, and use it as page_content. We extract the description of "fault phenomenon, fault cause and fault solution" in the materials, that is, the fault description, and combine it into the content of full_content. We also extract the creation time in the materials as create_time, and output the knowledge block (vector, page_conent, full_content, create_time). Finally, after vectorization and other operations, we vectorize page_conent into vector, and upload the knowledge block content, including the dynamic array (vector, page_conent, full_content, create_time), to the vector knowledge base. Vector represents an array.

[0149] Exemplarily, the embodiments of the present application may use, for example, Tencent Cloud vector database tecentVectorDB. In the similarity retrieval process of the question-answering process, the full_content in the retrieved knowledge block is used as the most relevant knowledge for use by the large language model.

[0150] Exemplarily, the above operation may also be implemented through a vector database such as faiss, milvus, etc.

[0151] Exemplarily, the present application embodiment also provides an intelligent question-answering system, such as Figure 5 As shown, the intelligent question and answer system includes a knowledge base management module and an intelligent question and answer module.

[0152] Among them, the intelligent question-answering module receives user questions and performs compliance checks on user questions. At this time,

[0153] If the question fails, i.e. the user's question does not conform to the rules, a prompt word is constructed according to the prompt word template, a second prompt message is generated through a large language model, and a compliance check is performed on the second prompt message. If the question passes, i.e. the second prompt message is compliant, the front end displays (or shows) the second prompt message. If the question fails, i.e. the second prompt message is not compliant, the front end does not display (the second prompt message) and gives a reason, i.e. the third prompt message mentioned above.

[0154] If the user question is vectorized according to the user question compliance rule, a question vector is obtained, and similarity retrieval is performed based on the user question vector to obtain initial relevant text knowledge, and the initial relevant text knowledge is rearranged and screened to obtain target relevant text knowledge. After that, prompt words are constructed according to the prompt word template based on the target relevant text knowledge, and the question and answer results are generated through the large language model. The compliance check of the question and answer results is performed. If it passes, the front end will display the question and answer results; if it fails, the question and answer results will not be displayed, and the reason will be given, that is, the first prompt information mentioned above.

[0155] Since the corresponding prompt word templates are different based on the different tasks to be completed, the prompt word template used to generate the second prompt information is different from the prompt word template used to generate the question and answer result.

[0156] In the knowledge base management module, the knowledge base content is updated periodically. During the update process, the knowledge material (i.e., the knowledge material to be updated) is first obtained, and the knowledge material is loaded into the system code through the document loader. Afterwards, for different types of data, a custom text segmenter is used. For example, for call orders, product manuals, fault code details, and training manuals, the corresponding call order text segmenter, product manual text segmenter, fault code details text segmenter, and training manual text segmenter are used to extract the required text information, including the (knowledge) labels to be vectorized, the complete text content (i.e., the full_content mentioned above), and other information. Afterwards, the label text is vectorized, that is, the label text is vectorized to obtain a label text vector, and the label text vector and the text information (i.e., the complete text content) are uploaded to the knowledge base and stored in the vector database.

[0157] like Figure 6 As shown, an embodiment of the present application also provides an intelligent question-answering device, including an acquisition module 601 , a generation module 602 , a checking module 603 and a display module 604 .

[0158] Wherein, the acquisition module 601 is used to acquire user questions;

[0159] A generating module 602 is used to search the knowledge base based on the user question and generate a question-answering result;

[0160] A checking module 603 is used to perform a compliance check on the question-and-answer result to obtain a first check result;

[0161] Display module 604 is used to display the question and answer result if the first inspection result indicates that the question and answer result is compliant, and to display first prompt information if the first inspection result indicates that the question and answer result is not compliant, wherein the first prompt information is used to prompt that the question and answer result is not compliant.

[0162] The intelligent question-answering device provided in this embodiment belongs to the same application concept as the intelligent question-answering method provided in the above embodiments of this application, and can execute the method provided in any of the above embodiments of this application, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not fully described in this embodiment, please refer to the specific processing content of the intelligent question-answering method provided in the above embodiments of this application, which will not be repeated here.

[0163] The functions implemented by the above acquisition module 601, generation module 602, inspection module 603 and display module 604 can be implemented in the form of software called by the same or different processors, and the embodiments of the present application are not limited thereto.

[0164] Another embodiment of the present application also provides an electronic device, see Figure 7 As shown, the electronic device includes: a memory 700 and a processor 710 .

[0165] The memory 700 is connected to the processor 710 and is used to store programs;

[0166] The processor 710 is used to implement the intelligent question-answering method disclosed in any of the above embodiments by running the program stored in the memory 700.

[0167] Specifically, the electronic device may further include: a bus, a communication interface 720 , an input device 730 and an output device 740 .

[0168] The processor 710, the memory 700, the communication interface 720, the input device 730 and the output device 740 are connected to each other via a bus.

[0169] A bus may include a pathway that transfers information between components of a computer system.

[0170] The processor 710 may be a general-purpose processor, such as a general-purpose central processing unit (CPU), a microprocessor, etc., or an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application. It may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0171] The processor 710 may include a main processor, and may also include a baseband chip, a modem, and the like.

[0172] The memory 700 stores a program for executing the technical solution of the present application, and may also store an operating system and other key services. Specifically, the program may include a program code, and the program code includes a computer operation instruction. More specifically, the memory 700 may include a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM), other types of dynamic storage devices that can store information and instructions, a disk storage, a flash, and the like.

[0173] The input device 730 may include a device for receiving data and information input by a user, such as a keyboard, a mouse, a camera, a scanner, a light pen, a voice input device, a touch screen, a pedometer, or a gravity sensor.

[0174] Output device 740 may include devices that allow information to be output to a user, such as a display screen, printer, speaker, etc.

[0175] The communication interface 720 may include any transceiver or the like to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.

[0176] The processor 710 executes the program stored in the memory 700 and calls other devices, which can be used to implement each step of any intelligent question-answering method provided in the above embodiments of the present application.

[0177] Those skilled in the art will understand that Figure 7 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0178] An embodiment of the present application also proposes a chip, which includes a processor and a data interface. The processor reads and runs a program stored in a memory through the data interface to execute the intelligent question and answer method introduced in any of the above embodiments. The specific processing process and its beneficial effects can be found in the introduction to the embodiment of the above-mentioned intelligent question and answer method.

[0179] In addition to the above-mentioned methods and devices, an embodiment of the present application proposes a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the intelligent question-answering method according to various embodiments of the present application described in the above "Exemplary Method" section of this specification.

[0180] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0181] In addition, an embodiment of the present application also proposes a storage medium on which a computer program is stored, and the computer program is executed by a processor to execute the steps of the intelligent question-answering method according to various embodiments of the present application described in the above "Exemplary Method" section of this specification.

[0182] The basic principle of the present invention is described above in conjunction with specific embodiments. However, it should be pointed out that the advantages, strengths, effects, etc. mentioned in the present invention are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. must be possessed by each embodiment of the present invention. In addition, the specific details disclosed above are only for the purpose of illustration and facilitation of understanding, rather than limitation, and the above details do not limit the present invention to being implemented by adopting the above specific details.

[0183] The block diagrams of the devices, apparatuses, equipment, and systems involved in the present invention are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The word "such as" used here refers to the phrase "such as but not limited to", and can be used interchangeably with it.

[0184] It should also be noted that in the device, apparatus and method of the present invention, each component or each step can be decomposed and / or reassembled, and such decomposition and / or reassembly should be regarded as an equivalent solution of the present invention.

[0185] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present invention. Therefore, the present invention is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0186] It should be understood that the qualifiers "first", "second", "third", "fourth", "fifth" and "sixth" used in the description of the embodiments of the present invention are only used to more clearly explain the technical solutions and cannot be used to limit the scope of protection of the present invention.

[0187] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present invention to the forms disclosed herein. Although a number of example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.

Claims

1. An intelligent question-answering method, characterized in that: The method comprises: Get user questions; Searching the knowledge base based on the user question to generate a question-answering result; Performing a compliance check on the question and answer result to obtain a first check result; If the first inspection result indicates that the question and answer result is compliant, displaying the question and answer result; If the first inspection result indicates that the question and answer result is not compliant, a first prompt message is displayed, where the first prompt message is used to prompt that the question and answer result is not compliant.

2. The intelligent question-answering method according to claim 1, characterized in that: The method further comprises: Performing a compliance check on the user question to obtain a second check result; If the second inspection result indicates that the user question is compliant, performing the operation of searching the knowledge base based on the user question and generating a question-answer result; If the second inspection result indicates that the user problem is not compliant, a second prompt message is displayed, where the second prompt message is used to prompt the user that the user problem is not compliant.

3. The intelligent question-answering method according to claim 2, characterized in that: The step of performing a compliance check on the question and answer result to obtain a first check result includes: Based on the question-answer result and in combination with the first prompt word template, a first prompt word is generated; Inputting the first prompt word into a large language model, performing a compliance check on the question and answer result, and obtaining the first check result; The performing a compliance check on the user question to obtain a second check result includes: Based on the user question and in combination with the second prompt word template, generate a second prompt word; The second prompt word is input into the large language model, and a compliance check is performed on the user question to obtain the second check result.

4. The intelligent question-answering method according to claim 1, characterized in that: The step of searching the knowledge base based on the user question and generating a question-answer result includes: Based on the user question, the knowledge in the knowledge base is searched to obtain target-related knowledge, where the target-related knowledge is at least one piece of knowledge in the knowledge base; Based on the target-related knowledge and in combination with a third prompt word template, generating a third prompt word; The third prompt word is input into the large language model to generate the question-answering result.

5. The intelligent question-answering method according to claim 4, characterized in that: The step of retrieving the knowledge in the knowledge base based on the user question to obtain target-related knowledge includes: Based on the user question, the knowledge in the knowledge base is matched to determine the similarity between the knowledge in the knowledge base and the user question; Determining initial relevant knowledge based on the similarity between the knowledge in the knowledge base and the user question; Based on the difference between the current time and the creation time of the initial relevant knowledge, the similarity between the initial relevant knowledge and the user question is adjusted to obtain a target similarity, where the target similarity is the adjusted similarity between the initial relevant knowledge and the user question; The initial relevant knowledge is screened based on the target similarity to obtain the target relevant knowledge.

6. The intelligent question-answering method according to claim 1, characterized in that: The method further comprises: Obtain knowledge materials to be updated; Acquiring the knowledge to be updated from the knowledge material to be updated based on a target text segmenter, wherein the target text segmenter is a text segmenter corresponding to the data type of the knowledge material to be updated; The knowledge to be updated is periodically stored in the knowledge base.

7. The intelligent question-answering method according to claim 6, characterized in that: The step of acquiring the knowledge to be updated from the knowledge material to be updated based on the target text segmenter includes: If the data type of the knowledge material to be updated is structured data, the text segmenter corresponding to the structured data is determined as the target text segmenter, and based on the target text segmenter, the target data in the knowledge material to be updated is combined to obtain the knowledge to be updated; If the data type of the knowledge material to be updated is unstructured data, the text segmenter corresponding to the unstructured data is determined as the target text segmenter, and based on the target text segmenter, the target data is extracted from the knowledge material to be updated through a large language model, and the target data is combined into the knowledge to be updated.

8. The intelligent question-answering method according to claim 7, characterized in that: The target data includes labels, fault descriptions and creation time, wherein the labels are complete descriptions of the fault phenomenon, fault causes or fault solutions, the fault descriptions include a comprehensive description of the fault phenomenon, fault causes and fault solutions, and the creation time is the time when the knowledge materials to be updated are collected.

9. An intelligent question-answering device, characterized in that: The device comprises: Acquisition module, used to obtain user questions; A generation module, used to search the knowledge base based on the user question and generate a question-answering result; A checking module, used for performing a compliance check on the question and answer result to obtain a first checking result; The display module is used to display the question and answer result if the first inspection result indicates that the question and answer result is compliant, and to display a first prompt message if the first inspection result indicates that the question and answer result is not compliant, wherein the first prompt message is used to prompt that the question and answer result is not compliant.

10. An electronic device, characterized in that: including memory and processor; The memory is connected to the processor and is used to store programs; The processor is used to implement the intelligent question-answering method as described in any one of claims 1 to 8 by running the program in the memory.