User question and answer interaction method and device, equipment and storage medium

By integrating the user input questions and the relevant knowledge retrieved from the knowledge base into the prompt word structure in the AI ​​dialogue system, the problem of poor answer quality in the existing technology is solved, and a higher quality user question-and-answer interaction is achieved.

CN119848196APending Publication Date: 2025-04-1858 CHANG LIFE (BEIJING) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411908528.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

In user Q&A interaction, existing AI dialogue systems often do not match the relevant knowledge retrieved in the knowledge base and the user input questions, resulting in poor answer quality and prone to errors or insmooth replies.

Method used

In the prompt word structure of the large language model, the questions entered by the user are added to the description text corresponding to the user role, and the relevant knowledge is retrieved in the corresponding knowledge base, and it is added to the description text corresponding to the system role to generate the prompt word, and enter the large language model to obtain the answer content.

Benefits of technology

Through this method, we ensure that the large language model can accurately understand the user's questions and generate high-quality answers, avoiding answering errors and inefficient questions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119848196A_ABST
    Figure CN119848196A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a user question-answer interaction method and device, equipment and a storage medium, and the method comprises the steps: receiving first question content inputted by a user in an ith round of dialogue, the first question content corresponding to a first dialogue scene; in a cue word structure corresponding to the large language model, adding the first question content into a description text corresponding to the user role in the ith round of dialogue; searching first related knowledge corresponding to the first question content in a first knowledge base corresponding to the first dialogue scene; in the cue word structure, adding the first related knowledge into a description text corresponding to the system role to obtain a first cue word; and inputting the first cue word into the large language model to obtain first answer content corresponding to the first question content, and adding the first answer content into a description text corresponding to the AI assistant role in the ith round of dialogue. According to the scheme, the user can obtain the answer content with better quality, and the phenomena of wrong reply, unsmooth reply and the like are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a user question-and-answer interaction method, device, equipment and storage medium. Background Art

[0002] With the continuous development of science and technology, artificial intelligence (AI) dialogue systems have been widely used in users' work, life, entertainment, etc. Users can communicate with AI dialogue systems (such as chatbots, virtual dialogue assistants, etc.) through voice or text.

[0003] The AI ​​dialogue system used in the prior art is generally based on a large language model (Large Language Model, LLM for short) to realize the dialogue with the user. In actual application, the user enters a question in the AI ​​dialogue system, and the AI ​​dialogue system will retrieve the corresponding relevant knowledge in the knowledge base corresponding to the current dialogue scene based on the question entered by the user. After that, the relevant knowledge found and the question entered by the user are input into the large language model as the text description corresponding to the user role (user) in this round of dialogue, so as to obtain the answer content output by the large language model. This method of using relevant knowledge retrieved from the knowledge base often results in poor quality of the answer content, such as incorrect answers, unsmooth answers, etc. Summary of the invention

[0004] The embodiments of the present invention provide a user question-answering interaction method, apparatus, device and storage medium, which can enable users to obtain answers of better quality and avoid phenomena such as answer errors and unsmooth answers.

[0005] In a first aspect, an embodiment of the present invention provides a user question-answering interaction method, the method comprising:

[0006] Receive a first question content input by a user in an i-th round of dialogue, where the first question content corresponds to a first dialogue scenario, and i is greater than or equal to 1;

[0007] In the prompt word structure corresponding to the large language model, adding the first question content to the description text corresponding to the user role in the i-th round of dialogue;

[0008] Retrieving first relevant knowledge corresponding to the first question content in a first knowledge base corresponding to the first dialogue scenario;

[0009] In the prompt word structure, the first relevant knowledge is added to the description text corresponding to the system role to obtain a first prompt word, wherein the first prompt word includes the description text corresponding to the system role and the description text corresponding to the user role in the i-th round of dialogue;

[0010] The first prompt word is input into the large language model to obtain a first answer content corresponding to the first question content, and in the prompt word structure, the first answer content is added to the description text corresponding to the AI ​​assistant role in the i-th round of dialogue.

[0011] In a second aspect, an embodiment of the present invention provides a user question-answering interaction device, the device comprising:

[0012] A receiving module, configured to receive a first question content input by a user in an i-th round of dialogue, wherein the first question content corresponds to a first dialogue scenario, and i is greater than or equal to 1;

[0013] An adding module, configured to add the first question content to the description text corresponding to the user role in the i-th round of dialogue in the prompt word structure corresponding to the large language model;

[0014] A retrieval module, configured to retrieve first relevant knowledge corresponding to the first question content in a first knowledge base corresponding to the first dialogue scenario;

[0015] An acquisition module is used to add the first relevant knowledge to the description text corresponding to the system role in the prompt word structure to obtain a first prompt word, and input the first prompt word into the large language model to obtain a first answer content corresponding to the first question content, and in the prompt word structure, add the first answer content to the description text corresponding to the AI ​​assistant role in the i-th round of dialogue, wherein the first prompt word includes the description text corresponding to the system role and the description text corresponding to the user role in the i-th round of dialogue.

[0016] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a communication interface; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor executes the user question and answer interaction method as described in the first aspect.

[0017] In a fourth aspect, an embodiment of the present invention provides a non-temporary machine-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor executes the user question-and-answer interaction method as described in the first aspect.

[0018] In a fifth aspect, an embodiment of the present invention provides a computer program product, comprising: a computer program, which, when executed by a processor of an electronic device, enables the processor to execute the user question and answer interaction method as described in the first aspect.

[0019] The user question-answer interaction method provided by the embodiment of the present invention can add the first question content to the description text corresponding to the user role of the corresponding round after receiving the first question content input by the user in any round of dialogue, so as to ensure that the large language model can accurately obtain the question content input by the user. At the same time, the first relevant knowledge corresponding to the first question content can be retrieved from the first knowledge base, and the first relevant knowledge can be added to the description text corresponding to the system role to generate a first prompt word, and the first prompt word can be subsequently input into the large language model to obtain the first answer content corresponding to the first question content. In this process, by adding the first relevant knowledge to the description text corresponding to the system role, the first relevant knowledge is prevented from interfering with the description text corresponding to the user role, thereby affecting the effect of the large language model generating the answer content based on the description text corresponding to the user role, so that the user can obtain a better quality answer content and avoid the occurrence of answer errors, unsmooth answers, etc. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 A flowchart of a user question-and-answer interaction method provided by an embodiment of the present invention;

[0022] Figure 2 A flowchart of another user question-and-answer interaction method provided by an embodiment of the present invention;

[0023] Figure 3 A flowchart of another user question-and-answer interaction method provided by an embodiment of the present invention;

[0024] Figure 4 A schematic diagram of a dialogue interface provided by an embodiment of the present invention;

[0025] Figure 5 A schematic diagram of the structure of a user question-answering interactive device provided by an embodiment of the present invention;

[0026] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0028] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present invention 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 the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0029] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0030] First, the terms or concepts involved in the embodiments of the present invention are explained:

[0031] Large Language Model (LLM): refers to a deep learning model trained on massive text data, which has strong expressive and generalization capabilities. It can not only generate natural language text, but also deeply understand the meaning of the text and handle various natural language tasks such as text summarization, question answering, translation, etc.

[0032] It should be noted that the prompt word structure of the large language model contains at least three roles, namely: user role, system role and AI assistant role. Among them, the user role can be understood as the role played by the end user, who can ask questions to the large language model. The system role can be understood as the role played by the large language model. The AI ​​assistant role can be understood as the role that answers the user's questions based on the large language model.

[0033] In actual applications, users and question-answering robots (which can also be AI conversation assistants, intelligent chat assistants, etc., as long as they can run a large language model to ask and answer questions with users, the following uses the question-answering robot as an example to illustrate this solution) may have multiple rounds of conversations. For ease of understanding, the following examples illustrate the description texts corresponding to each role in the current prompt word structure:

[0034] System role description text: [“Role name: Auntie recommendation customer service. Task: You are a customer service representative who recommends aunties to users. You need to guide users to state their needs and recommend aunties to them. When users mention “cooking, making breakfast, lunch, dinner, three meals a day, making delicious food, cleaning, washing dishes, and tidying up the house”, they are actually cooking and doing housework. When users express complaints or dissatisfaction, you need to comfort them appropriately. When users express their intention to find a job, you need to say: I am a customer service representative who recommends aunties to users, and I cannot recommend a job for you yet. Please make sure that the language is as brief, clear, natural, and friendly as possible. Avoid using overly professional and complex expressions. Do not reply. Do not answer questions that violate laws, public order and good morals; formulate answers carefully and pay attention to the ability to connect with the context. If the user asks for a phone number or consulting service, do not provide any contact information; when the user needs a auntie who works in "morning" or "forenoon", they are actually saying that the auntie's working hours are "0:00-12:00"; when the user needs a auntie who works in "noon", they are actually saying that the auntie's working hours are 10:00-14:00; when the user needs a auntie who works in "afternoon", they are actually saying that the auntie's working hours are 12:00-19:00; when the user needs a auntie who works in "evening", they are actually saying that the auntie's working hours are 17:00-24:00.

[0035] Background knowledge: The characteristics of day shift nannies are: not living at home, day shift, cooking, doing housework, cleaning, caring for the elderly, and taking care of the elderly; the characteristics of live-in nannies are: living at home, cooking, doing housework, cleaning, caring for the elderly, and taking care of the elderly; the characteristics of hourly workers are: hourly workers, hourly workers, temporary workers; the characteristics of day shift childcare nannies are: not living at home, day shift, taking care of children, bringing children, making complementary foods, and coaxing to sleep; the characteristics of live-in childcare nannies are: living at home, taking care of children, bringing children, making complementary foods, and coaxing to sleep; the characteristics of taking care of children are: bringing children, making complementary foods, and coaxing to sleep; the characteristics of taking care of the elderly are: self-care elderly, semi-self-care elderly, elderly who cannot take care of themselves, elderly with limited mobility, and nursing the elderly; the characteristics of cooking and doing housework are: cooking, cleaning, and doing housework]

[0036] Description text of the user role: [Please answer the following questions based on the knowledge base and context; Knowledge base: empty; Please answer the following questions: Hello; Based on what I said before, please help me recommend it]

[0037] AI assistant role description text: [Please tell me what specific needs you need from an auntie, such as cooking, cleaning, taking care of the elderly or children, etc., or do you have any requirements for the auntie's age, working hours, province, etc.? This way I can better recommend a suitable auntie for you]

[0038] Description text of user role: [Please answer the following questions based on the knowledge base and context; Knowledge base: {Question: Is there any fee? Answer: We do not charge intermediary fees. You can directly contact all the aunties on the platform within a week to communicate your needs with a minimum cost of 299. If you communicate well with the aunties later, you can sign a contract with them offline directly, and we do not charge any additional service fees}. Please answer the following question: What is the algorithm for charging for this chat? Based on what I said before, please help me recommend it]

[0039] Description text of the AI ​​assistant role: [We do not charge agency fees. You can directly contact all the aunties on the platform within a week to communicate your needs with a minimum cost of 299. If you communicate well with the auntie later, you can sign a contract with the auntie offline directly, and we do not charge any additional service fees. Please tell me the specific needs of the auntie, such as cooking, cleaning, caring for the elderly or children, etc., or do you have any requirements for the auntie's age, working hours, province, etc.? This way I can better recommend a suitable auntie for you]

[0040] It should be noted that in the above example, "knowledge base" refers to the relevant knowledge retrieved from the set knowledge base based on the user's question. As for the description text of each role, in general, the description text of the system role includes: "Expert role definition (such as the first paragraph of the system role description text)" and "Background knowledge / job requirements (such as the second paragraph of the system role description text)". The description text of the user role includes: "Contextual dialogue information between the user and the Q&A robot", "User questions (such as what is the algorithm for charging for this chat)", "Fixed task description information (such as please answer the following questions based on the knowledge base and contextual content)" and "Related knowledge retrieved from the knowledge base (such as question: What is the fee? Answer: We do not charge an agency fee. You can directly contact all the aunties on the platform within one week to communicate your needs with a minimum cost of 299. If you communicate well with the auntie later, you can sign a contract with the auntie offline directly, and we do not charge any additional service fees)". The description text of the AI ​​assistant role includes: "Response to user questions".

[0041] It can be seen that the relevant knowledge currently retrieved from the knowledge base is added to the description text of the user role. In actual application, since the large language model does not involve the retrieval of relevant knowledge during the training process, the training data corresponding to the description text of the user role does not contain the above-mentioned "relevant knowledge retrieved from the knowledge base", that is, the data structure of the training data used in the training process is different from that of the actual data used in the actual application, which makes it easy for the user question-and-answer robot to answer the questions raised by the user unsmoothly or even give wrong answers. In view of this, the embodiment of the present invention modifies the location where the "relevant knowledge retrieved from the knowledge base" is added, from adding it to the "description text of the user role" to adding it to the "description text of the system role", so as to ensure that the training data of the large language model has the same data structure as the actual data used in the actual application, and ensure that the user can get a better quality answer content, and avoid the phenomenon of wrong answer, unsmooth answer, etc.

[0042] Figure 1 A flowchart of a user question-answering interaction method provided by an embodiment of the present invention, which can be applied to a question-answering robot running a large language model, such as Figure 1 As shown, the method comprises the following steps:

[0043] 101. Receive a first question content input by a user in an i-th round of dialogue, where the first question content corresponds to a first dialogue scenario, and i is greater than or equal to 1.

[0044] 102. In the prompt word structure corresponding to the large language model, add the first question content to the description text corresponding to the user role in the i-th round of dialogue.

[0045] 103. Retrieve first relevant knowledge corresponding to the first question content from a first knowledge base corresponding to the first dialogue scenario.

[0046] 104. In the prompt word structure, the first relevant knowledge is added to the description text corresponding to the system role to obtain a first prompt word, wherein the first prompt word includes the description text corresponding to the system role and the description text corresponding to the user role in the i-th round of dialogue.

[0047] 105. Input the first prompt word into the large language model to obtain a first answer content corresponding to the first question content. In the prompt word structure, add the first answer content to the description text corresponding to the AI ​​assistant role in the i-th round of dialogue.

[0048] In actual applications, users can have multiple rounds of dialogue with the question-answering robot, and multiple rounds of dialogue can include multiple dialogue scenarios (such as the scenario of recommending a aunt, the scenario of recommending a job, the scenario of recommending a game, etc., which are not listed here one by one). For ease of understanding, the following takes the first round of dialogue between the user and the question-answering robot (i.e., i=1) as an example for specific explanation:

[0049] In specific implementation, after receiving the first question content (such as "Recommend me an auntie") input by the user in the first round of dialogue, the question-answering robot adds the first question content to the description text corresponding to the user role in the first round of dialogue, and retrieves the first relevant knowledge corresponding to the first question content from the first knowledge base corresponding to the first dialogue scene. The first knowledge base can be stored locally in the question-answering robot or in a server that interacts with the question-answering robot, and the first knowledge base stores knowledge related to "recommended auntie".

[0050] After the first relevant knowledge is retrieved, it is added to the description text corresponding to the system role to obtain the first prompt word (including the description text corresponding to the system role and the description text corresponding to the user role in the first round of dialogue). At this time, the description text corresponding to the system role includes "expert role definition", "background knowledge / job requirements" and "first relevant knowledge". The description text of the user role includes "contextual dialogue information between the user and the question-answering robot (it can be understood that in the first round of dialogue, the context information is empty)", "first question content" and "fixed task description information (such as please answer the following questions according to the context content)".

[0051] After that, the first prompt word is input into the pre-trained large language model to obtain the first answer content corresponding to the first question content (such as please tell me the specific needs you need from the aunt, such as cooking, cleaning, taking care of the elderly or children, etc.). It is understandable that at this time, the first answer content will be added to the description text corresponding to the AI ​​assistant role in the first round of dialogue.

[0052] Based on the above, the user question-answering interaction method provided by the embodiment of the present invention can retrieve the first relevant knowledge corresponding to the first question content in the first knowledge base after receiving the first question content input by the user in any round of dialogue, and add the first relevant knowledge to the description text corresponding to the system role to generate a first prompt word, and then input the first prompt word into the large language model to obtain the first answer content corresponding to the first question content. In this process, after the first relevant knowledge corresponding to the first question content is retrieved, its adding position is changed from the previous "description text of the user role" to "description text of the system role", ensuring that the training data of the large language model and the actual data used in actual applications have the same data structure, thereby ensuring that users can get better quality answers and avoid answer errors, unsmooth answers, etc.

[0053] Figure 2 A flowchart of another user question-answering interactive method provided by an embodiment of the present invention, such as Figure 2 As shown, the method comprises the following steps:

[0054] 201. Receive a second question content input by a user in a j-th round of dialogue, where the second question content corresponds to a first dialogue scenario, and j is greater than i.

[0055] 202. In the prompt word structure, add the second question content to the description text corresponding to the user role in the j-th round of dialogue.

[0056] 203. Retrieve second relevant knowledge corresponding to the second question content in the first knowledge base.

[0057] 204. In the prompt word structure, the second relevant knowledge is added to the description text corresponding to the system role to obtain a second prompt word, wherein the second prompt word includes the description text corresponding to the current system role, the description text corresponding to the user role in the jth round of dialogue, and the description text corresponding to the user role in each round of dialogue before the jth round of dialogue and the description text corresponding to the AI ​​assistant role.

[0058] 205. Input the second prompt word into the large language model to obtain the second answer content corresponding to the second question content. In the prompt word structure, add the second answer content to the description text corresponding to the AI ​​assistant role in the j-th round of dialogue.

[0059] For ease of understanding, following the example in the above embodiment, a second round of dialogue between a user and a question-answering robot (i.e., j=2) is used as an example for specific description:

[0060] In specific implementation, in response to receiving the second question content, the question-answering robot can identify whether the second question content and the first question content correspond to the same first dialogue scene. For example, the question-answering robot can determine whether the second question content and the first question content correspond to the same first dialogue scene through "keyword recognition" and "semantic recognition in natural language processing". For example, assuming that the first question content is "Please recommend an aunt for me" and the second question content is "I need an aunt to take care of the elderly", then, according to the semantic recognition of the above two question contents, it can be found that they both need help recommending an aunt. At this point, it can be determined that the second question content and the first question content correspond to the same first dialogue scene.

[0061] After determining that the second question content and the first question content correspond to the same first dialogue scenario, the question-answering robot adds the second question content to the description text corresponding to the user role in the second round of dialogue, and retrieves the second related knowledge corresponding to the second question content in the first knowledge base corresponding to the first dialogue scenario.

[0062] After the second relevant knowledge is retrieved, it is added to the description text corresponding to the system role to obtain the second prompt word (including the description text corresponding to the current system role, the description text corresponding to the user role in the second round of dialogue, and the description text corresponding to the user role in each round of dialogue before the second round of dialogue and the description text corresponding to the AI ​​assistant role). At this time, the description text corresponding to the system role includes "expert role definition", "background knowledge / job requirements" and "second relevant knowledge". The description text of the user role includes "contextual dialogue information between the user and the question-answering robot", "second question content" and "fixed task description information (such as please answer the following questions according to the context content)".

[0063] After that, the second prompt word is input into the pre-trained large language model to obtain the second answer content corresponding to the second question content (such as please tell me what your requirements are for the aunt's age and working hours). It is understandable that at this time, the second answer content will be added to the description text corresponding to the AI ​​assistant role in the second round of dialogue.

[0064] It can be understood that by utilizing the descriptive text corresponding to the current system role, the descriptive text corresponding to the user role in the jth round of dialogue, the descriptive text corresponding to the user role in each round of dialogue before the jth round of dialogue, and the descriptive text corresponding to the AI ​​assistant role to form the second prompt word, the large language model can fully consider all relevant information of the second question content input by the user, thereby improving the accuracy of the corresponding second answer content output by the large language model.

[0065] Furthermore, since the conversation scenarios corresponding to the first question content and the second question content are the same (both are scenarios for recommending an aunt), and the conversation round to which the second question content belongs is located after the conversation round to which the first question content belongs, the second related knowledge retrieved from the first knowledge base through the second question content may have a certain correlation with the first related knowledge retrieved from the first knowledge base through the first question content. If the related first related knowledge and second related knowledge are both added to the description text corresponding to the system role, data duplication will occur, resulting in a certain amount of data redundancy, which will affect the question answering speed of the large language model.

[0066] In view of this, the embodiment of the present invention adds the second relevant knowledge to the description text corresponding to the system role through the following steps: determine the correlation between the first relevant knowledge and the second relevant knowledge; if the correlation meets the set conditions, merge and remove the first relevant knowledge and add the processed relevant knowledge to the description text corresponding to the system role, and delete the first relevant knowledge. If the correlation does not meet the set conditions, replace the first relevant knowledge with the second relevant knowledge to add to the description text corresponding to the system role.

[0067] In specific implementation, a variety of methods can be used to determine the relevance between the first relevant knowledge and the second relevant knowledge. For example, a trained machine learning model can be used for similarity judgment, or a natural language processing algorithm can be used for semantic similarity judgment, etc., which are not listed here one by one. After the similarity judgment, a correlation value can be obtained, and the correlation value is compared with a pre-set correlation threshold. If the correlation value is greater than or equal to the correlation threshold, it means that the correlation meets the set conditions. At this time, the first relevant knowledge and the second relevant knowledge are fused and deduplicated, and the processed relevant knowledge is added to the description text corresponding to the system role, and the first relevant knowledge is deleted at the same time, which effectively avoids the problem of data redundancy in the description text corresponding to the system role and ensures the speed of answering questions of the large language model.

[0068] On the contrary, if the correlation value is less than the correlation threshold, it means that the correlation does not meet the set conditions. At this time, the second relevant knowledge can replace the first relevant knowledge and be added to the description text corresponding to the system role to avoid the first relevant knowledge occupying the space in the description text corresponding to the system role, which not only affects the question answering speed of the large language model, but also interferes with the subsequent question answers of the large language model, affecting the accuracy of the question answers.

[0069] Figure 3 A flowchart of another user question-answering interaction method provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, the method comprises the following steps:

[0070] 301. Receive a third question content input by a user in a k-th round of dialogue, where the third question content corresponds to a second dialogue scenario, and k is greater than j.

[0071] 302. In the prompt word structure, add the third question content to the description text corresponding to the user role in the kth round of dialogue.

[0072] 303. Retrieve third related knowledge corresponding to the third question content in the second knowledge base.

[0073] 304. In the prompt word structure, the third relevant knowledge is added to the description text corresponding to the system role, and the relevant knowledge corresponding to the first dialogue scenario in the description text corresponding to the system role is deleted to obtain a third prompt word, wherein the third prompt word includes the description text corresponding to the current system role, the description text corresponding to the user role in the kth round of dialogue, and the description text corresponding to the user role in each round of dialogue before the kth round of dialogue and the description text corresponding to the AI ​​assistant role.

[0074] 305. Input the third prompt word into the large language model to obtain a third answer content corresponding to the third question content. In the prompt word structure, add the third answer content to the description text corresponding to the AI ​​assistant role in the kth round of dialogue.

[0075] For ease of understanding, following the example in the above embodiment, a third round of dialogue between a user and a question-answering robot (i.e., k=3) is used as an example for specific description:

[0076] In specific implementation, after receiving the third question content (such as "Recommend me a job") input by the user in the third round of dialogue, the Q&A robot adds the third question content to the description text corresponding to the user role in the third round of dialogue, and retrieves the third related knowledge corresponding to the third question content in the second knowledge base corresponding to the second dialogue scene. The second knowledge base can be stored in the Q&A robot or in a server that interacts with the Q&A robot, and the second knowledge base stores knowledge related to "recommended jobs".

[0077] After the third relevant knowledge is retrieved, it is added to the description text corresponding to the system role, and the relevant knowledge corresponding to the first dialogue scene in the description text corresponding to the system role is deleted to obtain the third prompt word (including the description text corresponding to the current system role, the description text corresponding to the user role in the third round of dialogue, and the description text corresponding to the user role in each round of dialogue before the third round of dialogue and the description text corresponding to the AI ​​assistant role). At this time, the description text corresponding to the system role includes "expert role definition", "background knowledge / job requirements" and "second relevant knowledge". The description text of the user role includes "contextual dialogue information between the user and the question-answering robot", "third question content" and "fixed task description information (such as please answer the following questions according to the context content)".

[0078] After that, the third prompt word is input into the pre-trained large language model to obtain the third answer content corresponding to the third question content (such as please tell me what you require from the job). It is understandable that at this time, the third answer content will be added to the description text corresponding to the AI ​​assistant role in the third round of dialogue.

[0079] It can be understood that by using the description text corresponding to the current system role, the description text corresponding to the user role in the kth round of dialogue, and the description text corresponding to the user role in each round of dialogue before the kth round of dialogue and the description text corresponding to the AI ​​assistant role to form the third prompt word, the large language model can fully consider all relevant information of the third question content input by the user, and improve the accuracy of the large language model outputting the corresponding third answer content. By deleting the relevant knowledge corresponding to the first dialogue scene in the description text corresponding to the system role in the process of generating the third prompt word, the interference of irrelevant knowledge on the large language model is reduced, and the accuracy of the large language model outputting the corresponding third answer content is further improved. At the same time, the data redundancy in the description text corresponding to the system role is also reduced, and the speed of the large language model outputting the corresponding third answer content is improved.

[0080] Furthermore, in an embodiment of the present invention, when the above-mentioned dialogue scene is changed from the first dialogue scene to the second dialogue scene, the background information corresponding to the first dialogue scene in the description text corresponding to the system role can be replaced with the background information of the second dialogue scene.

[0081] It is understandable that in each round of dialogue, background information (including background knowledge, job requirements, etc.) needs to be used as part of the description text corresponding to the system role to generate prompt words. Therefore, when the dialogue scene changes, by replacing the background information corresponding to the first dialogue scene in the description text corresponding to the system role with the background information of the second dialogue scene, the interference of the background information of the first dialogue scene on the output of the second answer content by the large language model can be reduced, thereby ensuring the accuracy of the second answer content output by the large language model.

[0082] For ease of understanding, the following provides a description of each role in the specific prompt word structure to illustrate this solution:

[0083] System role description text: [“Role name: Exclusive customer service.

[0084] Requirements: If the merchant's inquiry is beyond the scope of your knowledge base, please reply "Wait a moment {transfer to manual service}". If the merchant says "OK dear" or "OK", these are simple affirmations of customer service. At this time, reply "OK, then contact me if you have any questions". If the merchant's last sentence expresses affirmation of the customer service work "for example, OK, OK", reply "You're welcome, you can contact me anytime if you have any questions". Refer to the knowledge base to answer questions when replying, and do not make up stories at will. Do not use words such as "If you need to be transferred to manual customer service, I will transfer you to manual customer service" in your reply. It is strictly forbidden to fabricate answers, and replies must strictly follow the content of the knowledge base. Do not include content that closes promotion in your reply.

[0085] Background knowledge:

[0086] What are platforms, merchants and users? Merchants promote their services or businesses on the platform. Users search for the services they want on the platform, and after finding them, they call the phone number on the merchant's post to contact the merchant to obtain services. Merchants mainly provide services related to local life, such as cleaning, decoration building materials, and garbage recycling, which are also called categories. What is a member? Merchants can open membership on the platform, and during the membership activation period, merchants will receive certain discounts when purchasing commercial products.

[0087] Task:

[0088] 1. Please answer the questions based on the relevant knowledge, contextual information and background knowledge retrieved from the knowledge base.

[0089] 2. If the knowledge base is not relevant, you don’t need to contact it.

[0090] Relevant knowledge retrieved from the knowledge base:

[0091] If the merchant reports that the click deduction fee is serious, reply: The user traffic of the platform is high recently. You should continue to promote and see the effect. Pay more attention to visitors and WeChat chats. If the merchant wants to adjust the brightness of the picture or other visual effects, reply: Wait a minute, I will help you deal with it. If the merchant expresses that he is unwilling to continue to recharge, reply: I understand your concerns. The current insufficient account balance will affect the exposure of the post. I suggest that you consider a small recharge to seize more opportunities. If the merchant expresses that he wants to understand the situation, reply: OK, what do you want to know? If the merchant asks for advice on recharging, reply: There is a recharge activity at present, with many discounts, you can consider recharging. 】

[0092] User role description text: [Hello]

[0093] Description text of the AI ​​assistant role: [Hello, it is non-working hours now, please leave a message and I will reply as soon as possible]

[0094] User role description text: [Is my membership not expired yet? ]

[0095] Description text of the AI ​​assistant role: [Your membership will expire on March 21]

[0096] User role description text: [OK]

[0097] Description text of the AI ​​assistant role: [You’re welcome. Feel free to contact me if you have any questions.]

[0098] It can be understood that after adding "relevant knowledge retrieved from the knowledge base" to the description text of the system role, the description text of the user role and the description text of the AI ​​assistant role are both the conversation content between the user and the question-answering robot, and the fluency of the conversation is greatly improved. The diagram of the conversation interface between the user and the question-answering robot can be seen in Figure 4 .

[0099] The user question-answering interaction device of one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these devices can be configured using commercially available hardware components through the steps taught in this solution.

[0100] Figure 5 A schematic diagram of the structure of a user question-answering interactive device provided by an embodiment of the present invention, such as Figure 5 As shown, the device includes: a receiving module 11, an adding module 12, a searching module 13 and an acquiring module 14.

[0101] The receiving module 11 is used to receive a first question content input by a user in an i-th round of dialogue, where the first question content corresponds to a first dialogue scenario, and i is greater than or equal to 1.

[0102] The adding module 12 is used to add the first question content to the description text corresponding to the user role in the i-th round of dialogue in the prompt word structure corresponding to the large language model.

[0103] The retrieval module 13 is used to retrieve first relevant knowledge corresponding to the first question content in a first knowledge base corresponding to the first dialogue scenario.

[0104] The acquisition module 14 is used to add the first relevant knowledge to the description text corresponding to the system role in the prompt word structure to obtain a first prompt word, and input the first prompt word into the large language model to obtain a first answer content corresponding to the first question content. In the prompt word structure, the first answer content is added to the description text corresponding to the AI ​​assistant role in the i-th round of dialogue, and the first prompt word includes the description text corresponding to the system role and the description text corresponding to the user role in the i-th round of dialogue.

[0105] Optionally, the receiving module 11 is further used to: receive a second question content input by a user in a j-th round of dialogue, the second question content corresponds to the first dialogue scenario, and j is greater than i.

[0106] The adding module 12 is further used for: in the prompt word structure, adding the second question content to the description text corresponding to the user role in the j-th round of dialogue.

[0107] The retrieval module 13 is further used to retrieve second related knowledge corresponding to the second question content in the first knowledge base.

[0108] The acquisition module 14 is also used for: in the prompt word structure, adding the second relevant knowledge to the description text corresponding to the system role to obtain a second prompt word, and inputting the second prompt word into the large language model to obtain a second answer content corresponding to the second question content, and in the prompt word structure, adding the second answer content to the description text corresponding to the AI ​​assistant role in the j-th round of dialogue, the second prompt word includes the description text corresponding to the current system role, the description text corresponding to the user role in the j-th round of dialogue, and the description text corresponding to the user role and the description text corresponding to the AI ​​assistant role in each round of dialogue before the j-th round of dialogue.

[0109] Among them, optionally, the acquisition module 14 is specifically used to: determine the correlation between the first relevant knowledge and the second relevant knowledge; if the correlation meets the set conditions, merge and deduplicate the first relevant knowledge and the second relevant knowledge to add the processed relevant knowledge to the description text corresponding to the system role, and delete the first relevant knowledge; and if the correlation does not meet the set conditions, replace the first relevant knowledge with the second relevant knowledge to add it to the description text corresponding to the system role.

[0110] Optionally, the device further includes: an identification module, configured to identify, in response to receiving the second question content, whether the second question content and the first question content correspond to the same first dialogue scenario.

[0111] Optionally, the receiving module 11 is further used to: receive a third question content input by the user in the kth round of dialogue, the third question content corresponds to the second dialogue scenario, and k is greater than j;

[0112] The adding module 12 is further used to: in the prompt word structure, add the third question content to the description text corresponding to the user role in the kth round of dialogue;

[0113] The retrieval module 13 is further used to: retrieve third related knowledge corresponding to the third question content in the second knowledge base;

[0114] The acquisition module 14 is also used for: in the prompt word structure, adding the third relevant knowledge to the description text corresponding to the system role, and deleting the relevant knowledge corresponding to the first dialogue scenario in the description text corresponding to the system role to obtain a third prompt word, and inputting the third prompt word into the large language model to obtain a third answer content corresponding to the third question content, and in the prompt word structure, adding the third answer content to the description text corresponding to the AI ​​assistant role in the kth round of dialogue, the third prompt word includes the description text corresponding to the current system role, the description text corresponding to the user role in the kth round of dialogue, and the description text corresponding to the user role and the description text corresponding to the AI ​​assistant role in each round of dialogue before the kth round of dialogue.

[0115] Optionally, the device further includes: a replacement module, configured to replace the background information corresponding to the first dialogue scene in the description text corresponding to the system role with the background information of the second dialogue scene.

[0116] Figure 5 The device shown can execute the steps provided in the aforementioned embodiments. For detailed execution process and technical effects, please refer to the description in the aforementioned embodiments, which will not be repeated here.

[0117] In one possible design, the above Figure 5 The structure of the user question-answering interactive device shown can be implemented as an electronic device. Figure 6 As shown, the electronic device may include: a processor 21, a memory 22, and a communication interface 23. The memory 22 stores executable codes, and when the executable codes are executed by the processor 21, the processor 21 can at least implement the user question-and-answer interaction method provided in the above-mentioned embodiment.

[0118] In addition, an embodiment of the present invention provides a non-temporary machine-readable storage medium, on which executable code is stored. When the executable code is executed by a processor of an electronic device, the processor can at least implement the user question and answer interaction method provided in the aforementioned embodiment.

[0119] An embodiment of the present application provides a computer program product, including: a computer program, when the computer program is executed by a processor of an electronic device, the processor is caused to execute the user question and answer interaction method provided in the above-mentioned embodiment.

[0120] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.

[0121] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and application programs. Based on such an understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a computer product, and the present invention can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0122] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A user question-answering interactive method, characterized in that: The method comprises: Receive a first question content input by a user in an i-th round of dialogue, where the first question content corresponds to a first dialogue scenario, and i is greater than or equal to 1; In the prompt word structure corresponding to the large language model, adding the first question content to the description text corresponding to the user role in the i-th round of dialogue; Retrieving first relevant knowledge corresponding to the first question content in a first knowledge base corresponding to the first dialogue scenario; In the prompt word structure, the first relevant knowledge is added to the description text corresponding to the system role to obtain a first prompt word, wherein the first prompt word includes the description text corresponding to the system role and the description text corresponding to the user role in the i-th round of dialogue; The first prompt word is input into the large language model to obtain a first answer content corresponding to the first question content, and in the prompt word structure, the first answer content is added to the description text corresponding to the AI ​​assistant role in the i-th round of dialogue.

2. The method according to claim 1, characterized in that: The method further comprises: receiving a second question content input by the user in the j-th round of dialogue, where the second question content corresponds to the first dialogue scenario, and j is greater than i; In the prompt word structure, the second question content is added to the description text corresponding to the user role in the j-th round of dialogue; Retrieving second related knowledge corresponding to the second question content in the first knowledge base; In the prompt word structure, the second relevant knowledge is added to the description text corresponding to the system role to obtain a second prompt word, wherein the second prompt word includes the description text corresponding to the current system role, the description text corresponding to the user role in the j-th round of dialogue, and the description text corresponding to the user role in each round of dialogue before the j-th round of dialogue and the description text corresponding to the AI ​​assistant role; The second prompt word is input into the large language model to obtain a second answer content corresponding to the second question content. In the prompt word structure, the second answer content is added to the description text corresponding to the AI ​​assistant role in the j-th round of dialogue.

3. The method according to claim 2, characterized in that The adding the second related knowledge to the description text corresponding to the system role includes: Determining the relevance between the first relevant knowledge and the second relevant knowledge; If the correlation meets the set conditions, the first relevant knowledge and the second relevant knowledge are merged and deduplicated, so as to add the relevant knowledge obtained after the processing to the description text corresponding to the system role, and delete the first relevant knowledge.

4. The method according to claim 3, characterized in that The adding the second related knowledge to the description text corresponding to the system role includes: If the relevance does not satisfy the set condition, the second relevant knowledge replaces the first relevant knowledge to be added to the description text corresponding to the system role.

5. The method according to claim 2, characterized in that: The method further comprises: In response to receiving the second question content, it is identified whether the second question content and the first question content correspond to the same first dialogue scenario.

6. The method according to claim 1, characterized in that The method further comprises: receiving a third question content input by the user in the kth round of dialogue, wherein the third question content corresponds to the second dialogue scenario, and k is greater than j; In the prompt word structure, the third question content is added to the description text corresponding to the user role in the k-th round of dialogue; Retrieving third related knowledge corresponding to the third question content in the second knowledge base; In the prompt word structure, the third relevant knowledge is added to the description text corresponding to the system role, and the relevant knowledge corresponding to the first dialogue scenario in the description text corresponding to the system role is deleted to obtain a third prompt word, wherein the third prompt word includes the description text corresponding to the current system role, the description text corresponding to the user role in the kth round of dialogue, and the description text corresponding to the user role in each round of dialogue before the kth round of dialogue and the description text corresponding to the AI ​​assistant role; The third prompt word is input into the large language model to obtain a third answer content corresponding to the third question content. In the prompt word structure, the third answer content is added to the description text corresponding to the AI ​​assistant role in the kth round of dialogue.

7. The method according to claim 6, characterized in that The method further comprises: The background information corresponding to the first dialogue scene in the description text corresponding to the system role is replaced with the background information of the second dialogue scene.

8. A user question-answering interactive device, characterized in that: The device comprises: A receiving module, configured to receive a first question content input by a user in an i-th round of dialogue, wherein the first question content corresponds to a first dialogue scenario, and i is greater than or equal to 1; An adding module, configured to add the first question content to the description text corresponding to the user role in the i-th round of dialogue in the prompt word structure corresponding to the large language model; A retrieval module, configured to retrieve first relevant knowledge corresponding to the first question content in a first knowledge base corresponding to the first dialogue scenario; An acquisition module is used to add the first relevant knowledge to the description text corresponding to the system role in the prompt word structure to obtain a first prompt word, and input the first prompt word into the large language model to obtain a first answer content corresponding to the first question content, and in the prompt word structure, add the first answer content to the description text corresponding to the AI ​​assistant role in the i-th round of dialogue, wherein the first prompt word includes the description text corresponding to the system role and the description text corresponding to the user role in the i-th round of dialogue.

9. An electronic device, characterized in that: include: A memory, a processor, and a communication interface; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor executes the user question-and-answer interaction method as described in any one of claims 1 to 7.

10. A non-transitory machine-readable storage medium, characterized in that: The non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by a processor of an electronic device, the processor executes the user question-and-answer interaction method as described in any one of claims 1 to 7.