Question and answer method and system, electronic equipment and medium
By identifying the user's emotional state and generating appropriate reply information, the intelligent customer service system can effectively soothe user's emotions while solving user problems, improve user experience and service quality.
Patent Information
- Application Number
- CN202510270627.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-06-24
AI Technical Summary
When handling user complaints and negative emotions, the intelligent customer service system fails to effectively identify the user's emotional state and provide appropriate comfort and replies.
By obtaining the user's question text, identifying the user's emotional state, generating initial reply information, and combining the user's emotional state and initial reply information, generating final reply information to provide solutions and comforting speeches for the user's current emotions.
It realizes that while solving user problems, it effectively soothes users' emotions and improves user experience and service quality.
Smart Images

Figure CN120196719A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular, to a question - answering method, system, electronic device, and medium. Background Art
[0002] With the development of artificial intelligence technology, intelligent customer service systems have become effective tools for many enterprises to improve service quality and efficiency. One of the core functions of an intelligent customer service system is intelligent question - answering, which can quickly understand the questions raised by users and give accurate and clear answers, greatly improving the speed and satisfaction of users in obtaining information. In the field of customer service, when encountering negative emotions such as user complaints and grievances and poor communication, an intelligent customer service not only needs to solve the user's problems, but more importantly, soothe the user's emotions and bring the user and the customer service back to the track of normal communication. However, intelligent customer service systems or intelligent question - answering systems generally use deep learning of a large amount of data (such as text, audio - video) to understand the meaning of user questions and give answers, without considering the user's emotions. Summary of the Invention
[0003] To solve the above - mentioned technical problems or at least partially solve the above - mentioned technical problems, embodiments of the present invention provide a question - answering method, system, electronic device, and medium.
[0004] In a first aspect, embodiments of the present invention provide a question - answering method, including:
[0005] Obtain the question text of the user;
[0006] Based on the question text, identify the emotional state of the user and generate a first reply message corresponding to the question text;
[0007] Based on the emotional state of the user and the first reply message, construct a first prompt word, and use the first prompt word and a preset first large - language model to generate a second reply message;
[0008] Output the second reply message to the user.
[0009] In a second aspect, embodiments of the present invention provide a question - answering system, including:
[0010] An obtaining module, configured to obtain the question text of the user;
[0011] An emotion recognition module, configured to identify the emotional state of the user based on the question text;
[0012] A first reply module, configured to generate a first reply message corresponding to the question text;
[0013] A second response module, configured to construct a first prompt word based on the user's emotional state and the first response information, and use the first prompt word and a preset first large language model to generate a second response information;
[0014] An output module, configured to output the second response information to the user.
[0015] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete mutual communication through the communication bus; the memory is used to store a computer program; the processor is configured to implement the question-and-answer method provided in any embodiment of the present invention when executing the program stored on the memory.
[0016] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the question-and-answer method provided in any embodiment of the present invention is implemented.
[0017] The technical solutions provided by the embodiments of the present disclosure at least bring the following beneficial effects:
[0018] The question-and-answer method provided by the embodiment of the present invention identifies the user's emotional state through the user's question text, and generates a first response information corresponding to the question text. Based on the user's emotional state and the first response information corresponding to the question text, a second response information is generated. The second response information not only includes the answer to solve the user's problem, but also includes the words for soothing the user's emotions. The question-and-answer method can identify the user's emotional state according to the user's question, and can also generate an initial response information, and then combine the user's emotional state and the initial response information to obtain the final response information, so as to output a response information for the user's current emotion to the user, which can not only effectively solve the user's problem, but also effectively soothe the user's emotions. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art.
[0020] Figure 1 Shows a schematic flow chart of the question-and-answer method according to an embodiment of the present invention;
[0021] Figure 2 Shows a schematic flow chart of identifying the user's emotion in the question-and-answer method according to an embodiment of the present invention;
[0022] Figure 3 Shows a schematic flow chart of generating the first response information in the question-and-answer method according to an embodiment of the present invention;
[0023] Figure 4Shows the schematic flow chart of the Q&A method provided by another embodiment of the present invention;
[0024] Figure 5 Shows the schematic flow chart of the Q&A method of yet another embodiment of the present invention;
[0025] Figure 6 Shows the schematic structural diagram of the Q&A system provided by the embodiment of the present invention;
[0026] Figure 7 Shows the schematic structural diagram of the electronic device according to the embodiment of the present invention. Detailed implementation manners
[0027] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following.
[0028] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or multiple. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally indicates an "or" relationship between the associated objects before and after.
[0029] The Q&A method provided by the embodiment of the present invention can be applied to intelligent customer service in various scenarios, such as e-commerce platforms, online car-hailing platforms, etc. This Q&A method can identify the emotional state of the user according to the user's question, and can also generate an initial reply message, and then combine the user's emotional state and the initial reply message to obtain the final reply message, so as to output a reply message for the user's current emotion to the user, which can not only effectively solve the user's problem, but also effectively soothe the user's emotion.
[0030] Figure 1 Shows the schematic flow chart of the Q&A method of an embodiment of the present invention. This Q&A method can be applied to the field of intelligent customer service. As Figure 1 shown, the method includes:
[0031] Step S101: Obtain the question text of the user.
[0032] In some alternative embodiments, when a user needs to consult a customer service, the user logs in to the customer service system and inputs problem text through the interface provided by the customer service system, and the customer service system receives the problem text input by the user.
[0033] In some other alternative embodiments, for example, in the field of voice intelligent customer service, the user inputs voice information through the microphone of an electronic device such as a mobile phone, and the customer service system receives the voice information input by the user and converts the voice information into problem text through voice recognition technology.
[0034] Step S102: Based on the problem text, identify the emotional state of the user and generate a first reply message corresponding to the problem text.
[0035] Among them, the emotional state of the user is used to represent the current emotion of the user. In this embodiment, the emotional state of the user can be represented by an emotion label.
[0036] As an alternative example, the emotion labels can include: positive, negative, and neutral. When the emotion label is positive, it indicates that the current emotional state of the user is positive and active. When the emotion label is negative, it indicates that the current emotional state of the user is negative and passive. For example, the user is currently in an angry, impatient, or irritable mood. When the emotion label is neutral, it indicates that the current emotional state of the user is calm.
[0037] As another alternative example, the emotion labels can include angry, impatient, grateful, abusive, emotionless, etc. Among them, when it is recognized that the emotion label corresponding to the user is angry, impatient, or abusive, it indicates that the current emotion of the user is negative and passive. When it is recognized that the emotion label corresponding to the user is grateful, it indicates that the emotion of the user is positive and active. When it is recognized that the emotion label corresponding to the user is neither angry, impatient, or abusive, nor grateful, it is determined that the emotion label corresponding to the user is emotionless.
[0038] In alternative embodiments, the emotion label corresponding to the problem text can be identified through keyword matching or semantic recognition technology. As an alternative example, a keyword library corresponding to various emotion labels can be preset in advance, and the problem text is matched based on the keyword library. According to the matched keywords, the emotion label corresponding to the problem text is determined, and thus the emotional state of the user is determined. As another alternative example, a pre-trained neural network model can be used to classify the problem text to determine the emotional state corresponding to the problem text. As yet another alternative example, a search can be performed in a pre-constructed problem database to obtain at least one candidate problem similar to the problem text, and according to the similarity between each candidate problem and the problem text, as well as the emotion label corresponding to each candidate problem, the emotion label corresponding to the problem text is determined.
[0039] In the case of identifying the user's emotional state, generate a first reply message corresponding to the problem text. The first reply message is an answer to the user's question. As an optional example, it can be matched in a pre-constructed Q&A database to obtain a Q&A pair related to the problem text, and use this Q&A pair as the first reply message. Among them, the Q&A database includes multiple questions and answers for solving each question. As another optional example, the problem text can be analyzed through a large language model to obtain the first reply message corresponding to the problem text. A large language model (LLM) refers to a deep learning model trained with a large amount of text data, enabling the model to generate natural language text or understand the meaning of language text.
[0040] Step S103: Based on the user's emotional state and the first reply message, construct a first prompt, and use the first prompt and a preset first large language model to generate a second reply message.
[0041] Among them, a prompt refers to the text prompt or instruction input to the model, which is used to guide the model to generate a corresponding reply or complete a specific task. Optionally, the prompt can include a task description (the task description is used to indicate the task of the large language model), requirements, and limiting conditions. For example, the first prompt includes:
[0042] You are a customer service of xx company, and you are very good at replying to users' (such as drivers') questions.
[0043] Now the user's question is:
xxxxxx
[0044] The user's current emotional state is:
xxxx
[0045] According to the user's question, I provide the following several solution messages (first reply messages):
[0046] 1.
Solution Message 1
[0047] 2.
Solution Message 2
[0048] Please comfort the user according to the user's emotion, and answer the user's question in combination with the solution information I gave.
[0049] In this step, combine the user's emotional state and the first reply message corresponding to the user's problem text to generate the final reply message, that is, the second reply message. The second reply message not only includes the reply to the user's question but also includes the comforting words for the user, which can not only answer the user's question but also take care of the user's emotion, and can effectively comfort the user when the user's emotional state is not good.
[0050] Step S104: Output the second reply information to the user.
[0051] The question-answering method provided by the embodiments of the present invention identifies the emotional state of the user through the user's question text, generates a first reply information corresponding to the question text, and generates a second reply information based on the emotional state of the user and the first reply information corresponding to the question text. The second reply information not only includes the answer to solve the user's problem, but also includes the words for calming the user's emotions. The question-answering method can identify the emotional state of the user according to the user's question, generate the initial reply information, and then combine the emotional state of the user and the initial reply information to obtain the final reply information, so as to output the reply information for the user's current emotion to the user, which can not only effectively solve the user's problem, but also effectively calm the user's emotions.
[0052] In an optional embodiment, if the question-answering method is applied to the field of voice customer service, the second reply information can be converted into voice information and output to the user.
[0053] In some other optional embodiments, to improve the user experience, the question-answering method can also transcribe the second reply information into a colloquial text through a colloquial transcription model, and convert the colloquial text into voice information for output. For example, in the process of transcribing the second reply information into a colloquial text, the formal and standard words can be converted into common and easy-to-understand colloquial words or dialect words through the colloquial transcription model, and the complex long sentences in the second reply information can also be converted into short sentences, etc.
[0054] Figure 2 Shows a schematic flowchart of identifying the user's emotion in the question-answering method according to an embodiment of the present invention. As Figure 2 shown, the method includes:
[0055] Step S201: Match the question text with the keywords in the preset keyword library to determine whether there are keywords in the question text.
[0056] Step S202: When it is determined that there are keywords in the question text, use the emotion label corresponding to the keyword as the emotional state of the user.
[0057] Optionally, the keyword library includes multiple keywords, and the emotion labels corresponding to each keyword can be different. For example, taking the emotion labels including angry, impatient, grateful, abusive, and emotionless as an example, the keyword library can include keywords corresponding to angry, impatient, grateful, and / or abusive.
[0058] When the keyword library includes keywords corresponding to multiple emotion tags, one keyword, multiple keywords, or no keyword may be matched in the question text. When one keyword is matched in the question text, the emotion tag corresponding to the keyword is taken as the user's emotional state. When multiple keywords are matched in the question text, if the emotion tags corresponding to the multiple keywords are the same, the emotion tag corresponding to the emotion tag is taken as the user's emotional state. If the emotion tags corresponding to the multiple keywords are different, the multiple emotion tags corresponding to the multiple keywords can be taken as the user's emotional state, or one of the multiple emotion tags can be selected as the user's emotional state. For example, among the multiple keywords matched in the question text, if the number of keywords corresponding to anger is 2 and the number of keywords corresponding to impatience is 1, then anger can be taken as the user's emotional state. Another example is that the priority of each emotion tag can be set in advance. For example, in the order from high to low priority: abuse, anger, impatience, gratitude, no emotion. When multiple emotion tags are matched, the emotion tag with the highest priority among the multiple emotion tags can be taken as the user's emotional state. When no keyword is matched in the question text, step S203 is executed.
[0059] When the keyword library only includes keywords corresponding to one emotion tag, if one or more keywords are matched in the question, the emotion tag is taken as the user's emotional state. If no keyword is matched in the question text, step S203 is executed.
[0060] Step S203: When it is determined that there are no keywords in the question text, at least one candidate question similar to the question text is determined from the preset question database. The question database includes multiple questions and the emotion tags corresponding to each question.
[0061] Optionally, this step can use the text vectorization method to map the question text into a vector, calculate the similarity between the vector corresponding to the question text and the vectors of each question in the question database, and screen out the candidate questions similar to the question text according to the similarity. For example, sort them in descending order of similarity, and take the K questions with the largest similarity as the candidate questions similar to the question text (K is an integer greater than or equal to 1), or take the questions with similarity greater than the specified threshold as the subsequent questions similar to the question text.
[0062] Step S204: When the similarity between at least one candidate question and the question text is greater than or equal to the preset threshold, the emotion tag corresponding to the candidate question is taken as the user's emotional state.
[0063] Step S205: In the case where the similarity between all candidate questions and the question text is less than a preset threshold, the question text is used as input data to be input into a preset emotion multi-classification model, and the probability values corresponding to the question text and each emotion label output by the emotion multi-classification model are obtained.
[0064] Among them, the emotion multi-classification model can be trained by algorithms such as random forest algorithm, decision tree algorithm or naive Bayes algorithm. The emotion multi-classification model converts the question text into a feature vector, and determines the probability values corresponding to the question text and each emotion label according to the feature vector.
[0065] Step S206: Combine the probability values output by the emotion multi-classification model, the similarity between each candidate question and the question text, and the emotion label corresponding to the candidate question to determine the user's emotional state.
[0066] Optionally, the emotion label can be used as the statistical dimension, calculate the sum of the similarity between the candidate question corresponding to the emotion label and the question text and the probability value corresponding to the emotion label output by the emotion multi-classification model, and determine the user's emotional state according to the sum values corresponding to each emotion label. For example, the emotion label with the largest sum value is used as the user's emotional state. Another example is to use the emotion label with a sum value greater than a specified threshold as the user's emotional state. If there is no sum value greater than the specified threshold, the emotionless state can be used as the user's emotional state, or the emotion label with the largest sum value can be used as the user's emotional state.
[0067] The question-answering method according to the embodiment of the present invention determines the user's emotional state by means of keyword matching (word-level matching), question text matching (sentence-level matching), and emotion multi-classification model classification in sequence, realizes multi-level and multi-layer identification of the user's emotional state, can accurately identify the user's emotional state, and then generate a conversation statement corresponding to the emotional state, which can effectively soothe the user's emotions.
[0068] Figure 3 The flowchart showing the generation of the first reply message in the question-answering method according to an embodiment of the present invention is as follows Figure 3 As shown, the method includes:
[0069] Step S301: Based on a preset question detection model, the historical messages of the user's current session, and the question text, determine the type corresponding to the question text.
[0070] Among them, the historical messages of the user's current session refer to the historical messages of the user's communication with the intelligent customer service this time, including the historical question texts input by the user and the corresponding historical second reply information output by the intelligent customer service for the historical question texts. The types corresponding to the question texts are inquiry types and non-inquiry types (which can also be called query types). If the type corresponding to the question text is an inquiry type, it indicates that the user needs to be asked before answering the user's question to collect some information. If the type corresponding to the question text is a non-inquiry type, it indicates that the input question text can be replied without collecting information from the user.
[0071] The question detection model is a binary classification model, and the question detection model can be trained through algorithms such as random forest algorithm, logistic regression algorithm, decision tree algorithm, or naive Bayes algorithm.
[0072] Step S302: When the type corresponding to the question text is an inquiry type, generate a question text based on the historical messages of the user's current session and the question text, and use the question text as the first reply information.
[0073] Optionally, a prompt word can be constructed based on the historical messages of the user's current session and the question text. Using this prompt word and a large language model, determine the information required to answer the question text, and then generate a question text. As an optional example, the prompt word constructed based on the historical messages of the user's current session and the question text is as follows:
[0074] You are a smart question analyst. Please tell me what information you need to answer the user's question based on the historical messages of the current session and the current question.
[0075] Example:
[0076] User: [Historical messages of the current session, current question]
[0077] Information to be collected: [xxxxx].
[0078] Step S303: When the type corresponding to the question text is a non-inquiry type, retrieve in a preset Q&A database to determine the Q&A pair related to the question text, and use the Q&A pair as the first reply information. Among them, the similarity between the question text and the Q&A pair can be determined by calculating the similarity between the vector corresponding to the question text and the vector of the question in the Q&A pair, and then the Q&A pair related to the question text can be screened out.
[0079] Step S304: When the type corresponding to the question text is a non-inquiry type, retrieve in the historical event database to determine the historical events related to the user's current session, and use the historical events as the first reply information. The historical event database stores the description information of the events that occurred before. For example, in xx month of xxx year, driver x reported xxx problem, the driver's appeal was xxxx, the customer service comforted and gave suggestions xxxx. In this step, the similarity between the question text and the historical events can be determined by calculating the similarity between the vector corresponding to the question text and the vectors of the historical questions recorded in the historical event database, and then filtering out the historical events related to the user's current session.
[0080] Step S305: When the type corresponding to the question text is a non-inquiry type, use the user's basic information as the first reply information. The user's basic information includes the identification information for characterizing the user's identity and the specific information in the application scenario. Taking the online car-hailing scenario as an example, the user's basic information may include: driver's address, driver's city, driver's current location, driver's account status (such as normal, frozen, and risk-controlled, etc.), driver's recent order information (such as the departure place of the last order), etc.
[0081] Step S306: When the type corresponding to the question text is a non-inquiry type, determine the scenario theme corresponding to the question text, and use the scenario theme corresponding to the question text as the first reply information. Among them, the scenario theme is used to indicate the specific scenario corresponding to the question text in a specific application scenario. Taking the application scenario of online car-hailing as an example, the scenario themes include low price, being misjudged for responsibility, unable to contact the passenger, etc.
[0082] In this embodiment, according to the historical messages of the current session and the user's current question text, the type of the question text is identified, and different reply information is generated for different types of question texts, improving the accuracy of the reply information, and thus being able to effectively solve the user's problem.
[0083] Optionally, the question-answering method of the embodiment of the present invention can also automatically identify the user's intention and transfer the user to the artificial customer service according to the user's intention, thereby improving work efficiency and enhancing the user experience.
[0084] Figure 4 The flowchart of the question-answering method provided by another embodiment of the present invention is shown. As Figure 4 shown, the method includes:
[0085] Step S401: Obtain the user's question text and the historical messages of the user's current session. The historical messages of the user's current session refer to the historical messages of the user's current interaction with the intelligent customer service, including the historical question texts input by the user and the historical second reply information corresponding to the historical question texts output by the intelligent customer service.
[0086] Step S402: According to the historical messages and the question text of the user's current session, construct a second prompt word, and based on the second prompt word and the second large language model, identify the user's primary intention. Optionally, the primary intention includes three types of intentions, namely: transfer to a human customer service, reply, and end the session.
[0087] As an optional example, the second prompt word constructed according to the historical messages and the question text of the user's current session is as follows:
[0088] You are a robot for identifying the intentions of online car-hailing drivers. Now I will give you a conversation between a driver and a customer service. Please judge which of the following intentions the current driver has according to the conversation content:
[0089] 1. Transfer to human:
[0090] 2. End the call:
[0091] 3. Ask a question:
[0092] Just output the corresponding serial number.
[0093] Step S403: In the case where it is identified that the user's primary intention is to transfer to a human customer service, transfer the user's current session to the human customer service.
[0094] Step S404: In the case where it is identified that the user's primary intention is to reply, based on the question text, identify the user's emotional state and generate a first reply message corresponding to the question text.
[0095] Step S405: Based on the user's emotional state and the first reply message, construct a first prompt word, and use the first prompt word and the preset first large language model to generate a second reply message.
[0096] Step S406: Output the second reply message to the user.
[0097] Step S407: In the case where it is identified that the user's primary intention is to end the session, end the user's current session.
[0098] The Q&A method provided by the embodiments of the present invention first identifies the user's intention when receiving the user's question, and transfers the session to the human customer service when it is identified that the user expects to transfer to the human customer service, which meets the user's needs and improves the user experience.
[0099] In an optional embodiment, in the case where it is identified that the user's primary intention is to transfer to a human customer service, it is also necessary to further confirm with the user whether they need to be transferred to the human customer service to avoid mis-transfer.
[0100] Therefore, the Q&A method further includes:
[0101] When it is recognized that the user's primary intention is to transfer to a human customer service, determine the user's secondary intention;
[0102] When the user's secondary intention is confirmed to transfer to a human customer service, transfer the user's current session to a human customer service;
[0103] When the user's secondary intention is not confirmed to transfer to a human customer service, output a first inquiry message to the user to confirm the transfer to a human customer service;
[0104] When the user's secondary intention is to cancel the transfer to a human customer service, identify the user's emotional state based on the problem text and generate a first reply message corresponding to the problem text.
[0105] Among them, the user's secondary intention can be identified according to the historical messages and problem text of the user's current session. For example, the following prompt words are constructed according to the historical messages and problem text of the user's current session, and the large language model and the prompt words are used to identify the user's secondary intention:
[0106] You are a robot for identifying the intention of a car-hailing driver. It is known that the driver wants to transfer to a human. Please judge according to the conversation content whether the driver confirms the transfer to a human:
[0107] 1. Transfer to a human not confirmed:
[0108] 2. Transfer to a human confirmed:
[0109] 3. Transfer to a human cancelled:
[0110] Only output the corresponding serial number.
[0111] Optionally, when the user's secondary intention is not confirmed to transfer to a human customer service, the first inquiry message output to the user not only needs to confirm with the user whether to transfer to a human customer service, but also can inform the user of the current working situation of the human customer service to avoid the user waiting for a long time.
[0112] In an alternative embodiment, when it is recognized that the user's primary intention is to end the session, the question-and-answer method further includes: summarizing the user's current session according to a preset session summarization model to obtain a summary result; determining whether to output a second inquiry message to the user according to the summary result; outputting the second inquiry message to the user when it is determined to output the second inquiry message; and ending the user's current session when it is determined not to output the second inquiry message. Among them, the preset session summarization model can be a large language model, which summarizes the historical messages of the user's current session to obtain content such as the user's question, the solution to the question, and whether the user accepts the solution. For example, a prompt is constructed based on the historical messages of the user's current session, and the current session is summarized using the prompt and the large language model to obtain a summary result. Optionally, the prompt constructed based on the historical messages of the user's current session may include: You are a customer service of XX company. Now the driver wants to hang up the phone. Please combine the historical messages between the user and the customer service to summarize the current session, summarize the user's question, the solution given by the customer service, and whether the user accepts the solution. Please ask the driver according to the summary result and the questioning formula I give you whether there are other questions that need help.
[0113] Figure 5 FIG. shows a schematic flowchart of a question-and-answer method according to another embodiment of the present invention. As Figure 5 shown, the method includes:
[0114] Step S501: Obtain the user's question text and the historical messages of the user's current session.
[0115] Step S502: Qualify the user's current session according to the historical messages and the question text of the user's current session. If the quality inspection fails, step S503 is executed. If the quality inspection passes, step S504 is executed.
[0116] Step S503: Transfer the user's current session to a human customer service.
[0117] Step S504: When the quality inspection passes, construct a second prompt according to the historical messages and the question text of the user's current session, and identify the user's primary intention according to the second prompt and the second large language model.
[0118] Step S505: When it is recognized that the user's primary intention is to transfer to a human customer service, transfer the user's current session to a human customer service.
[0119] Step S506: When it is recognized that the user's primary intention is to reply, identify the user's emotional state based on the question text and generate a first reply message corresponding to the question text.
[0120] Step S507: Based on the user's emotional state and the first reply message, construct a first prompt, and use the first prompt and a preset first large language model to generate a second reply message.
[0121] Step S508: Output the second reply message to the user.
[0122] Step S509: When it is recognized that the user's primary intention is to end the session, end the user's current session.
[0123] Among them, steps S504 - S509 can refer to Figure 4 the embodiments shown. To avoid repetition, they will not be elaborated here. It should be noted that the process of quality inspection of the current session in step S502 and the process of identifying the user's primary intention in step S504 can be carried out simultaneously, that is, quality inspection of the current session and identification of the user's primary intention are carried out simultaneously. In the case where the quality inspection of the current session fails, or, in the case where it is recognized that the user's primary intention is to transfer to a human customer service, it will be transferred to a human customer service. When the quality inspection of the current session passes and the user's primary intention is to reply, a first reply message is generated. When the quality inspection of the current session passes and the user's primary intention is to end the call, the current session is ended. Optionally, the order of quality inspection of the current session in step S502 and identification of the user's primary intention in step S504 can be exchanged, that is, the user's primary intention can be identified first. In the case where it is recognized that the user's primary intention is to reply, the current session is quality inspected. If the quality inspection passes, a first reply message is generated. If the quality inspection fails, it is transferred to a human customer service.
[0124] For steps S501 - S503, the current session can be quality inspected according to the following process:
[0125] Based on the historical messages and problem text of the user's current session, construct a third prompt, and use the third prompt and a preset third large language model to score the user's current session, and obtain the score value output by the third large language model;
[0126] According to the number of turns of the user's current session and the initial threshold, determine the threshold corresponding to the number of turns of the current session;
[0127] According to the score value output by the third large language model and the threshold corresponding to the number of turns of the current session, quality inspect the user's current session.
[0128] Optionally, the third prompt constructed based on the historical messages and problem text of the user's current session is as follows:
[0129] You are a staff member specializing in dialogue quality inspection. You are very good at quality inspecting and scoring the conversations of customer service. You will analyze from the following points and finally give a score.
[0130] 1. Degree of acceptance of the driver towards the customer service's answer;
[0131] 2. Emotional changes of the driver;
[0132] 3. Whether the driver has verbally abused;
[0133] 4. Whether the driver said they would file a complaint;
[0134] Please analyze based on the above 5 points. The final score should be between 0 - 100. 100 points indicates a very good conversation, and 0 points indicates a very poor one. Please directly output the score.
[0135] After obtaining the score given by the third - largest language model, determine whether the current conversation passes the quality inspection according to this score. As the number of dialogue turns between the user and the intelligent customer service increases, the score given by the third - largest language model will gradually decrease. However, the decrease in score does not mean that the user's satisfaction with the intelligent customer service decreases. Therefore, to improve the accuracy of conversation quality inspection, this embodiment does not use a fixed threshold but a dynamic threshold, and this dynamic threshold is related to the number of turns in the current conversation. For example, this dynamic threshold is negatively correlated with the number of turns in the current conversation. The larger the number of turns, the smaller the dynamic threshold.
[0136] As an optional example, the formula for determining the dynamic threshold S(n) based on the number of turns in the current conversation is as follows:
[0137]
[0138] Among them, n represents the current number of dialogue turns. k is an adjustment factor used to control the rate of decrease in the strictness of quality inspection (default value is 0.1). S0 is the initial dialogue quality inspection threshold (for example, 95). Optionally, when the calculated dynamic threshold S(n) is a non - integer according to the above formula, it can be rounded up, and this integer is used as the dynamic threshold. The specific calculation example is as follows:
[0139] When n = 1, 2, 3, or 4, S(n)=0;
[0140] When n = 5, S(5)=95 / (1 + 0.1*(5 - 5)) = 95;
[0141] When n = 6, S(6)=95 / (1 + 0.1*(6 - 5)) = 95*(1 / 1.1)=87;
[0142] When n = 7, S(7)=95 / (1 + 1.1*(7 - 5)) = 95*(1 / 1.2)=80.
[0143] The Q&A method provided by the embodiments of the present invention performs quality inspection on the current user conversation. In the case of failed quality inspection, it actively transfers to the artificial customer service to improve the user experience. In the case of passed quality inspection, it identifies the user's intention, and when it is recognized that the user expects to transfer to the artificial customer service, it actively transfers to the artificial customer service, further improving the user experience and work efficiency.
[0144] Figure 6 The structural schematic diagram of the Q&A system provided by the embodiments of the present invention is shown. As Figure 6 shown, the Q&A system 600 includes:
[0145] An acquisition module 601, configured to acquire the problem text of the user;
[0146] An emotion recognition module 602, configured to recognize the emotion state of the user based on the problem text;
[0147] A first reply module 603, configured to generate a first reply message corresponding to the problem text;
[0148] A second reply module 604, configured to construct a first prompt word based on the emotion state of the user and the first reply message, and use the first prompt word and a preset first large language model to generate a second reply message;
[0149] An output module 605, configured to output the second reply message to the user.
[0150] Optionally, the emotion recognition module is further configured to: match the problem text with keywords in a preset keyword library to determine whether there are keywords in the problem text; in the case of determining that there are keywords in the problem text, use the emotion label corresponding to the keyword as the emotion state of the user; in the case of determining that there are no keywords in the problem text, determine at least one candidate problem similar to the problem text from a preset problem database; determine the emotion state of the user according to the similarity between each candidate problem and the problem text and the emotion label corresponding to the candidate problem.
[0151] Optionally, the emotion recognition module is further configured to: use the problem text as input data to input a preset emotion multi-classification model, and obtain the probability values corresponding to the problem text and each emotion label output by the emotion multi-classification model; combine the probability values output by the emotion multi-classification model, the similarity between each candidate problem and the problem text, and the emotion label corresponding to the candidate problem to determine the emotion state of the user.
[0152] Optionally, the first reply module is further configured to: determine the type corresponding to the question text based on a preset question detection model; in the case where the type corresponding to the question text is an inquiry type, generate a question text according to the historical messages of the user's current session and the question text, and use the question text as the first reply information; in the case where the type corresponding to the question text is a non-inquiry type, retrieve in a preset Q&A database to determine a Q&A pair related to the question text, and use the Q&A pair as the first reply information.
[0153] Optionally, the first reply module is further configured to: in the case where the type corresponding to the question text is a non-inquiry type, retrieve in a historical event database to determine a historical event related to the user's current session, and use the historical event as the first reply information.
[0154] Optionally, the first reply module is further configured to: in the case where the type corresponding to the question text is a non-inquiry type, use the user's basic information as the first reply information.
[0155] Optionally, the first reply module is further configured to: determine the scenario theme corresponding to the question text; use the scenario theme corresponding to the question text as the first reply information.
[0156] Optionally, the Q&A system further includes an intention recognition module, configured to: construct a second prompt word according to the historical messages of the user's current session and the question text, and recognize the user's primary intention according to the second prompt word and a second large language model; in the case where the recognized primary intention of the user is to transfer to a human customer service, transfer the user's current session to the human customer service; in the case where the recognized primary intention of the user is to reply, recognize the user's emotional state based on the question text and generate the first reply information corresponding to the question text; in the case where the recognized primary intention of the user is to end the session, end the user's current session.
[0157] Optionally, the intention recognition module is further configured to: in the case where the recognized primary intention of the user is to transfer to a human customer service, judge the user's secondary intention; in the case where the user's secondary intention is to transfer to a human customer service and has been confirmed, transfer the user's current session to the human customer service; in the case where the user's secondary intention is to transfer to a human customer service and has not been confirmed, output a first inquiry message to the user to enable the user to confirm the transfer to the human customer service; in the case where the user's secondary intention is to transfer to a human customer service and has been cancelled, recognize the user's emotional state based on the question text and generate the first reply information corresponding to the question text.
[0158] Optionally, the intention recognition module is further configured to: when it is recognized that the primary intention of the user is to end the session, summarize the current session of the user according to a preset session summary model to obtain a summary result; determine whether to output a second inquiry message to the user according to the summary result; when it is determined to output a second inquiry message to the user, output the second inquiry message to the user; when it is determined not to output the second inquiry message to the user, end the current session of the user.
[0159] Optionally, the question-and-answer system further includes a quality inspection module, configured to: perform quality inspection on the current session of the user according to the historical messages of the current session of the user and the question text; when the quality inspection fails, transfer the current session of the user to a human customer service.
[0160] Optionally, the quality inspection module is further configured to: based on the historical messages of the current session of the user and the question text, construct a third prompt word, use the third prompt word and a preset third large language model to score the current session of the user, and obtain the score value output by the third large language model; determine the threshold corresponding to the current session round according to the round number of the current session of the user and an initial threshold; perform quality inspection on the current session of the user according to the score value output by the third large language model and the threshold corresponding to the current session round.
[0161] The above system can execute the method provided by the embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. For technical details not described in detail in this embodiment, reference can be made to the question-and-answer method provided by the embodiments of the present invention.
[0162] Figure 7 The structural schematic diagram of the electronic device according to the embodiment of the present invention is shown. As Figure 7 shown, the electronic device includes:
[0163] A processor 701, a communication interface 702, a memory 703, and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704.
[0164] The memory 703 is used for storing a computer program.
[0165] When the processor 701 executes the program stored on the memory 703, the following steps are implemented:
[0166] Obtain the question text of the user.
[0167] Based on the question text, recognize the emotional state of the user and generate a first reply message corresponding to the question text.
[0168] Construct a first prompt word based on the user's emotional state and the first reply message, and use the first prompt word and a preset first large language model to generate a second reply message;
[0169] Output the second reply message to the user.
[0170] The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity, only a thick line is used to represent it in the figure, but it does not mean that there is only one bus or one type of bus.
[0171] The communication interface is used for communication between the above terminal and other devices.
[0172] The memory may include a Random Access Memory (RAM), or may also include a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.
[0173] The above-mentioned processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; 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.
[0174] In another embodiment provided by the present invention, there is also provided a computer-readable storage medium, in which instructions are stored, and when it runs on a computer, it causes the computer to execute any one of the above-mentioned question-and-answer methods.
[0175] In another embodiment provided by the present invention, there is also provided a computer program product containing instructions, and when it runs on a computer, it causes the computer to execute any one of the above-mentioned question-and-answer methods.
[0176] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer, or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)).
[0177] It should be noted that in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including", or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article, or device including a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or device. Without further limitation, an element defined by the statement "including a..." does not exclude the presence of additional identical elements in the process, method, article, or device including the element.
[0178] Each embodiment in this specification is described in a related manner. The same or similar parts among the embodiments can be referred to each other, and the differences between each embodiment and other embodiments are emphasized. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
[0179] The above are only the preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention are all included in the protection scope of the present invention.
Claims
1. A question-answering method, characterized in that: include: Get the user's question text; Based on the question text, identifying the user's emotional state and generating first reply information corresponding to the question text; Based on the emotional state of the user and the first reply information, construct a first prompt word, and generate a second reply information by using the first prompt word and a preset first language model; The second reply information is output to the user.
2. The question-answering method according to claim 1, characterized in that: Based on the question text, identifying the user's emotional state includes: Matching the question text with keywords in a preset keyword database to determine whether the keywords exist in the question text; When it is determined that the keyword exists in the question text, taking the emotion tag corresponding to the keyword as the emotional state of the user; When it is determined that the keyword does not exist in the question text, at least one candidate question similar to the question text is determined from a preset question database; and the user's emotional state is determined based on the similarity between each candidate question and the question text and the emotional label corresponding to the candidate question.
3. The method according to claim 2, characterized in that The determining the emotional state of the user according to the similarity between each of the candidate questions and the question text and the emotional label corresponding to the candidate question includes: Input the question text as input data into a preset emotion multi-classification model, and obtain probability values corresponding to the question text and each emotion label output by the emotion multi-classification model; The emotional state of the user is determined by combining the probability value output by the emotion multi-classification model, the similarity between each of the candidate questions and the question text, and the emotion label corresponding to the candidate question.
4. The method according to claim 1, characterized in that Based on the question text, generating first reply information corresponding to the question text includes: Based on a preset question detection model, determine the type corresponding to the question text; In the case where the type corresponding to the question text is an inquiry type, generating a question text according to the historical messages of the current session of the user and the question text, and using the question text as the first reply information; In the case that the type corresponding to the question text is a non-inquiry type, a search is performed in a preset question and answer database to determine a question and answer pair related to the question text, and the question and answer pair is used as the first reply information.
5. The method according to claim 4, characterized in that The method further comprises: In the case that the type corresponding to the question text is a non-inquiry type, a search is performed in a historical event database to determine a historical event related to the current session of the user, and the historical event is used as the first reply information.
6. The method according to claim 4, characterized in that The method further comprises: In the case that the type corresponding to the question text is a non-inquiry type, the basic information of the user is used as the first reply information.
7. The method according to any one of claims 4 to 6, characterized in that: The method further comprises: In the case where the type corresponding to the question text is a non-inquiry type, determining the scene theme corresponding to the question text; The scenario theme corresponding to the question text is used as the first reply information.
8. The method according to claim 1, characterized in that Based on the question text, identifying the user's emotional state and generating first reply information corresponding to the question text includes: constructing a second prompt word according to the historical messages of the current session of the user and the question text, and identifying the primary intention of the user according to the second prompt word and the second language model; When it is identified that the primary intention of the user is to transfer to a manual customer service, transferring the current session of the user to the manual customer service; In the case where it is identified that the primary intention of the user is to reply, based on the question text, identifying the emotional state of the user and generating first reply information corresponding to the question text; When it is identified that the primary intention of the user is to end the session, the current session of the user is ended.
9. The method according to claim 8, characterized in that When it is identified that the primary intention of the user is to transfer to a manual customer service, transferring the current session of the user to a manual customer service comprises: When it is identified that the primary intention of the user is to transfer to manual customer service, determining the secondary intention of the user; If the secondary intention of the user is to transfer to a manual customer service and it has been confirmed, transferring the current session of the user to the manual customer service; If the secondary intention of the user is to transfer to manual customer service but has not been confirmed, output a first inquiry message to the user to make the user confirm the transfer to manual customer service; In the case that the secondary intention of the user is to cancel the transfer to manual customer service, based on the question text, the emotional state of the user is identified and the first reply information corresponding to the question text is generated.
10. The method according to claim 8, characterized in that When it is recognized that the primary intention of the user is to end the session, ending the current session of the user includes: When it is identified that the primary intention of the user is to end the session, summarizing the current session of the user according to a preset session summarization model to obtain a summary result; Determining whether to output a second inquiry message to the user according to the summary result; In a case where it is determined that a second inquiry message is to be output to the user, outputting a second inquiry message to the user; If it is determined that the second inquiry information is not to be output to the user, the current session of the user is terminated.
11. The method according to claim 1, characterized in that: The method further comprises: Performing quality inspection on the current session of the user according to the historical messages of the current session of the user and the question text; If the quality inspection fails, the current session of the user is transferred to manual customer service.
12. The method according to claim 11, characterized in that The step of performing quality inspection on the current session of the user according to the historical messages of the current session of the user and the question text includes: Based on the historical messages of the current session of the user and the question text, construct a third prompt word, score the current session of the user by using the third prompt word and a preset third language model, and obtain the score value output by the third language model; Determine a threshold value corresponding to the number of rounds of the current session according to the number of rounds of the current session of the user and the initial threshold value; The current session of the user is quality checked according to the score value output by the third largest language model and a threshold value corresponding to the number of rounds of the current session.
13. A question-answering system, characterized in that: include: The acquisition module is used to obtain the user's question text; An emotion recognition module, used to recognize the emotional state of the user based on the question text; A first reply module, used to generate first reply information corresponding to the question text; A second reply module, configured to construct a first prompt word based on the user's emotional state and the first reply information, and generate a second reply information using the first prompt word and a preset first language model; An output module is used to output the second reply information to the user.
14. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, configured to implement the method according to any one of claims 1 to 12 when executing a program stored in a memory.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.