Man-machine conversation method and device, computer equipment and storage medium
Through vector similarity matching and large-model classification, the problem of degraded quality of Q&A library and insufficient reply accuracy in the human-computer dialogue system is solved, and more accurate and widely covered reply results are achieved.
Patent Information
- Application Number
- CN202411734368.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-21
AI Technical Summary
With the increase in users of human-computer dialogue systems, the knowledge corpus is complicated, and it is difficult for manual maintenance of high-quality question-and-answer libraries, resulting in insufficient response accuracy and frequent occurrence of incorrect questions in the text.
By obtaining the similarity of the vector of the pending question, matches the vector of the Q&A text in the Q&A library. If the similarity is less than the preset threshold, use the big model and classification prompt words to determine the target classification result. If it is a functional function, perform parameter extraction to obtain the output result.
It improves the accuracy of the reply of the human-computer dialogue system, avoids the incorrect questions in the text, and enhances the coverage and quality of the question-and-answer library.
Smart Images

Figure CN119669414A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a human-computer dialogue method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] With the continuous development of artificial intelligence, businesses in various fields can now automatically identify user questions through human-computer dialogue systems and return answers to the questions to the user terminals, thereby improving business service efficiency and quality. In related technologies, the Q&A database is usually maintained by manually sorting out related common questions and the answers to the questions to ensure the quality of the questions and answers, and the best answer is determined in the Q&A database through keyword matching.
[0003] However, as the number of users of the human-computer dialogue system increases, the knowledge corpus involved becomes more complex, and it is no longer possible to manually understand and organize high-quality question and answer content, resulting in a decrease in the quality of the question and answer database. In addition, as the content of the question and answer database increases, keyword matching cannot accurately find the best answer. In summary, as the amount of data in the human-computer dialogue system increases, the answers returned to users are not relevant to the topic, resulting in insufficient accuracy of the human-computer dialogue system's responses. Summary of the invention
[0004] Based on this, it is necessary to provide a human-computer dialogue method, device, computer equipment, computer-readable storage medium and computer program product that can improve the response accuracy of the human-computer dialogue system in response to the above technical problems.
[0005] In a first aspect, the present application provides a human-computer dialogue method. The method comprises:
[0006] For the question to be processed sent by the user terminal, obtain the vector similarity corresponding to the question to be processed; the vector similarity is determined based on the vector of the question to be processed and the vectors corresponding to each question and answer text in the question and answer library;
[0007] When the vector similarities are all less than a preset threshold, a target classification result corresponding to the problem to be processed is determined based on the large model and the classification prompt word; the target classification result is a category of the question and answer text in the question and answer library and the function function in the function library;
[0008] When the target classification result is a function in the function library, based on the large model and parameter prompt words, parameters of the problem to be processed are extracted to obtain function parameters corresponding to the function;
[0009] The output result of the functional function is determined by the function parameter, and the output result is returned to the user terminal.
[0010] In one embodiment, obtaining the vector similarity corresponding to the problem to be processed includes:
[0011] Determining a question vector corresponding to the question to be processed sent by the user terminal;
[0012] Determine the vector similarity between the question vector and other question vectors in a question vector library; the question vector library is determined based on the vectors corresponding to each question and answer text in the question and answer library.
[0013] In one embodiment, after obtaining the vector similarity corresponding to the problem to be processed, the method further includes:
[0014] For each vector similarity corresponding to the question vector, when the vector similarity is greater than a preset threshold, determining an optimal question vector from each of the other question vectors according to the magnitude of the vector similarity, and determining the answer text corresponding to the optimal question vector as the output result;
[0015] Alternatively, when the vector similarities are all less than a preset threshold, after determining the target classification result corresponding to the problem to be processed based on the large model and the classification prompt word, the method further includes:
[0016] In the case where the target classification result is a question and answer text in a question and answer library, the answer text in the question and answer text is determined as the output result.
[0017] In one embodiment, determining the target classification result corresponding to the problem to be processed based on the large model and the classification prompt words includes:
[0018] Determine each question and answer text in the question and answer library and each function in the function library as classification information, and determine a classification prompt word based on the classification information;
[0019] The classification prompt words and the problem to be processed are input into the trained large model to obtain the target classification result corresponding to the problem to be processed.
[0020] In one embodiment, the extracting parameters of the problem to be processed based on the large model and the parameter prompt words to obtain the function parameters corresponding to the functional function includes:
[0021] Determine the function name, function description, return format and parameter description of the function as function information;
[0022] The problem to be processed, the function information, and the format-restricted text are combined to obtain a parameter prompt word corresponding to the function;
[0023] The parameter prompt words are input into the trained large model to obtain the function parameters corresponding to the functional function.
[0024] In one embodiment, the question and answer text includes a question text and an answer text; the method further includes:
[0025] In the case where the target classification result is a function in the function library, determining that the question to be processed sent by the user terminal is a question text, and determining that the function is an answer text;
[0026] Determine the question text and the answer text as the question and answer text corresponding to the question to be processed, and add the question and answer text to the question and answer library;
[0027] In the case where the target classification result is a question and answer text in the question and answer library, the question to be processed is added to the question text corresponding to the question and answer text in the question and answer library to obtain an updated question and answer text.
[0028] In one embodiment, the method further comprises:
[0029] Determine a quality inspection prompt word based on the question text of each question and answer text in the question and answer library and the quality inspection limiting text; the quality inspection limiting text is used to determine whether the question text is a repeated question or an ambiguous question; the ambiguous question is used to represent multiple different questions with the same answer text;
[0030] The quality inspection prompt words are input into the trained large model to obtain a question list corresponding to repeated questions and a question list corresponding to ambiguous questions.
[0031] In a second aspect, the present application also provides a human-computer dialogue device. The device comprises:
[0032] A similarity acquisition module, for acquiring the vector similarity corresponding to the pending question sent by the user terminal; the vector similarity is determined based on the vector of the pending question and the vector corresponding to each question and answer text in the question and answer library;
[0033] A classification result determination module is used to determine, when the vector similarities are all less than a preset threshold, a target classification result corresponding to the problem to be processed based on the large model and the classification prompt word; the target classification result is a category of question and answer texts in the question and answer library and function functions in the function library;
[0034] A parameter determination module, used for, when the target classification result is a function in the function library, extracting parameters of the problem to be processed based on the large model and parameter prompt words, and obtaining function parameters corresponding to the function;
[0035] The result returning module is used to determine the output result of the functional function through the function parameter and return the output result to the user terminal.
[0036] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the following steps are implemented:
[0037] For the question to be processed sent by the user terminal, obtain the vector similarity corresponding to the question to be processed; the vector similarity is determined based on the vector of the question to be processed and the vectors corresponding to each question and answer text in the question and answer library;
[0038] When the vector similarities are all less than a preset threshold, a target classification result corresponding to the problem to be processed is determined based on the large model and the classification prompt word; the target classification result is a category of the question and answer text in the question and answer library and the function function in the function library;
[0039] When the target classification result is a function in the function library, based on the large model and parameter prompt words, parameters of the problem to be processed are extracted to obtain function parameters corresponding to the function;
[0040] The output result of the functional function is determined by the function parameter, and the output result is returned to the user terminal.
[0041] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0042] For the question to be processed sent by the user terminal, obtain the vector similarity corresponding to the question to be processed; the vector similarity is determined based on the vector of the question to be processed and the vectors corresponding to each question and answer text in the question and answer library;
[0043] When the vector similarities are all less than a preset threshold, a target classification result corresponding to the problem to be processed is determined based on the large model and the classification prompt word; the target classification result is a category of the question and answer text in the question and answer library and the function function in the function library;
[0044] When the target classification result is a function in the function library, based on the large model and parameter prompt words, parameters of the problem to be processed are extracted to obtain function parameters corresponding to the function;
[0045] The output result of the functional function is determined by the function parameter, and the output result is returned to the user terminal.
[0046] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0047] For the question to be processed sent by the user terminal, obtain the vector similarity corresponding to the question to be processed; the vector similarity is determined based on the vector of the question to be processed and the vectors corresponding to each question and answer text in the question and answer library;
[0048] When the vector similarities are all less than a preset threshold, a target classification result corresponding to the problem to be processed is determined based on the large model and the classification prompt word; the target classification result is a category of the question and answer text in the question and answer library and the function function in the function library;
[0049] When the target classification result is a function in the function library, based on the large model and the parameter prompt word, the parameters of the problem to be processed are extracted to obtain the function parameters corresponding to the function;
[0050] The output result of the functional function is determined by the function parameter, and the output result is returned to the user terminal.
[0051] The above-mentioned human-computer dialogue method, device, computer equipment, storage medium and computer program product can determine the corresponding vector similarity through the vector of the problem to be processed and the vector corresponding to each question and answer text in the question and answer library. The server can determine whether the size of the similarity of each vector of the problem to be processed is less than the preset threshold. When all vector similarities are less than the preset threshold, the target classification result of the problem to be processed can be determined through the large model and classification prompt words. And when the target classification result is a function function in the function library, the large model and parameter prompt words can be used to extract parameters of the problem to be processed, obtain function parameters corresponding to the function function, and determine the output result of the function parameter in the function function, and return the output result to the user terminal.
[0052] Since the vector similarities are all less than the preset threshold, the optimal output result cannot be directly obtained in the question-and-answer library. The server can classify the questions to be processed through the large model, and then determine through the large model that the output result of the question to be processed is the question-and-answer text in the question-and-answer library, or the function in the function library. Therefore, when the vector similarity cannot determine the output result, the target classification result is used to determine whether there is a corresponding output result, thereby improving the answer coverage rate and avoiding the situation where the text is irrelevant to the question. In addition, when the target classification result is a function function, the function function can be called, and parameters can be extracted from the question to be processed and used as function parameters of the function function, so as to obtain the output result through the function function, and accurate output results can be obtained without relying on the question-and-answer library, thereby improving the accuracy of the response of the human-computer dialogue system. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0054] Figure 1 An application environment diagram of a human-computer dialogue method in an embodiment;
[0055] Figure 2 A schematic diagram of a flow chart of a human-computer dialogue method in one embodiment;
[0056] Figure 3 A schematic diagram of a flow chart of a human-computer dialogue method in another embodiment;
[0057] Figure 4 is a structural block diagram of a human-machine dialogue device in one embodiment;
[0058] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0060] The human-computer dialogue method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the user terminal 102 communicates with the server 104 through the network, and the user terminal 102 can display the pending problem through the chat interface, and send the pending problem to the server 104 through the communication network. The server 104 processes the pending problem and obtains the vector of the pending problem. The server 104 determines the vector similarity between a pair of vectors based on the vector of the pending problem and the vector corresponding to each question and answer text in the question and answer library. When the server 104 determines that the vector similarity is less than the preset threshold, it can determine the target classification result of the pending problem through the large model and the classification prompt word. The target classification result is the question and answer text in the question and answer library, and the function function in the function library. Based on this, when the target classification result is the function function in the function library, the server 104 can extract the parameters of the pending problem through the large model and the parameter prompt word, and input the extracted function parameters into the function function, thereby obtaining the output result. The server 104 returns the output result to the user terminal 102, and the chat interface of the user terminal 102 can display the output result after the pending problem, thereby completing a human-computer dialogue.
[0061] Among them, the data storage system can store the data that the server 104 needs to process. For example, the data storage system may include a question and answer library and a function library. The question and answer library stores multiple question and answer texts, and the function library stores multiple functional functions. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0062] In an exemplary embodiment, Figure 2 As shown, a human-computer dialogue method is provided, which is applied to Figure 1 The server 104 in the example is used as an example to illustrate the method, which includes the following steps S202 to S208. Among them:
[0063] Step S202: for the question to be processed sent by the user terminal, obtain the vector similarity corresponding to the question to be processed.
[0064] Among them, the vector similarity is determined based on the vector of the question to be processed and the vector corresponding to each question and answer text in the question and answer library. The question and answer library contains multiple sets of question and answer texts, and the question and answer texts are used to answer a specific question to be processed. The vector similarity is used to indicate the similarity between the question to be processed and the question and answer text. The higher the vector similarity, the more similar the question to be processed is to the corresponding question and answer text. The server can determine the question and answer text corresponding to the question to be processed based on the vector similarity.
[0065] Specifically, the server may receive one or more pending questions sent by the user terminal. For each pending question, the server may determine the vector of the pending question and the vectors corresponding to each question and answer text in the question and answer library through a vector calculation strategy, and determine to use the vector of the pending question and the vector of the question and answer text as a group of vectors, and finally determine the vector similarity of the group of vectors. Finally, the server may obtain the vector similarity of multiple groups of vectors, and determine the vector similarity of multiple groups of vectors as the vector similarity corresponding to the pending question.
[0066] Step S204, when the vector similarities are all less than the preset threshold, the target classification result corresponding to the problem to be processed is determined based on the large model and the classification prompt words.
[0067] Among them, the preset threshold is a pre-configured value, and the value can be changed manually. The preset threshold is used to determine whether the similarity of each vector meets the benchmark value for directly determining the question and answer text. The large model is a large language processing model built based on a large pre-trained model (such as GPT-3, GPT-4, etc.). The large model can perform a variety of natural language processing tasks. The classification prompt word is a prompt word used to enable the large model to perform a specific classification task. The target classification result is a category of question and answer texts in the question and answer library and function functions in the function library. Multiple function functions can be stored in the function library, and each function function can receive input function parameters and output the output result corresponding to the function parameters.
[0068] Specifically, the server can compare the similarities of each vector corresponding to the pending question to determine whether the vector similarity is less than a preset threshold. If it is determined that all the vector similarities corresponding to the pending question are less than the preset threshold, it can be determined that the server cannot directly determine the output result of the reply to the user terminal from the question and answer library through the vector similarity. Based on this, the server can call the large model and input the classification prompt words into the large model. The large model can classify the pending question according to the classification prompt words to obtain the target classification result corresponding to the pending question. The target classification result of the pending question can be any question and answer text in the question and answer library, or any function function in the function library.
[0069] Step S206, when the target classification result is a functional function in the function library, based on the large model and parameter prompt words, parameters are extracted for the problem to be processed to obtain function parameters corresponding to the functional function.
[0070] Among them, the parameter prompt words are prompt words used to enable the large model to perform specific parameter extraction tasks.
[0071] Specifically, after determining the target classification result of the question to be processed, if the target classification result of the question to be processed is any function in the function library, it can be determined that the answer text corresponding to the question to be processed is not in the question and answer library. The server can call the big model through the pre-configured parameter prompt words, and extract parameters from the text of the question to be processed through the big model, so as to obtain function parameters adapted to the function.
[0072] Step S208: determine the output result of the function through the function parameters, and return the output result to the user terminal.
[0073] The output result of the function is the result obtained by calculation after the function receives the function parameters.
[0074] Specifically, the server can take the function parameter as input to the function, execute the function, and obtain the output result of the function. The server returns the output result to the user terminal, completing a human-computer dialogue.
[0075] In the above-mentioned human-computer dialogue method, the corresponding vector similarity can be determined by the vector of the problem to be processed and the vector corresponding to each question and answer text in the question and answer library. The server can determine whether the size of the similarity of each vector of the problem to be processed is less than the preset threshold. If all vector similarities are less than the preset threshold, the target classification result of the problem to be processed can be determined through the large model and classification prompt words. And when the target classification result is a function function in the function library, the large model and parameter prompt words can be used to extract parameters of the problem to be processed, obtain the function parameters corresponding to the function function, and determine the output result of the function parameters in the function function, and return the output result to the user terminal.
[0076] Since the vector similarities are all less than the preset threshold, the optimal output result cannot be directly obtained in the question-and-answer library. The server can classify the questions to be processed through the large model, and then determine through the large model that the output result of the question to be processed is the question-and-answer text in the question-and-answer library, or the function in the function library. Therefore, when the vector similarity cannot determine the output result, the target classification result is used to determine whether there is a corresponding output result, thereby improving the answer coverage rate and avoiding the situation where the text is irrelevant to the question. In addition, when the target classification result is a function function, the function function can be called, and parameters can be extracted from the question to be processed and used as function parameters of the function function, so as to obtain the output result through the function function, and accurate output results can be obtained without relying on the question-and-answer library, thereby improving the accuracy of the response of the human-computer dialogue system.
[0077] In an exemplary embodiment, the specific implementation process of the step of "obtaining the vector similarity corresponding to the problem to be processed" includes:
[0078] Determine a question vector corresponding to the to-be-processed question sent by the user terminal; and determine a vector similarity between the question vector and other question vectors in a question vector library.
[0079] The question vector library is determined based on the vectors corresponding to each question and answer text in the question and answer library. The question vector library contains the vectors corresponding to the question texts of each question and answer text. The question vector is obtained by vectorizing the text of the question to be processed.
[0080] Specifically, the server can vectorize the text of the question to be processed through a vector calculation strategy to obtain the question vector corresponding to the question to be processed. The server can retrieve the question vector corresponding to each question and answer text in the question vector library. The server traverses each other question vector in the question vector library to determine the vector similarity between the current question vector and the question vector corresponding to the question to be processed. Finally, the server can obtain multiple vector similarities corresponding to the question to be processed.
[0081] In one example, the server may determine the distance value between two question vectors by using a cosine distance strategy. The smaller the distance value, the higher the vector similarity between the two question vectors.
[0082] Optionally, the server may traverse each question and answer text in the question and answer library, determine the question text in each question and answer text, and determine the vector of the question text. The server may obtain the vectors of all the question texts in the question and answer library, store the vectors of the question texts in a pre-established database, and determine the database as a question vector library.
[0083] In this embodiment, by determining the problem vector of the problem to be processed, and determining the similarity between the problem vector and each other problem vector in the problem vector library, the vector similarity of the problem to be processed is obtained, and it can be quickly traversed to obtain multiple vector similarities, thereby improving the efficiency of determining vector similarity.
[0084] In an exemplary embodiment, after the step of “obtaining the vector similarity corresponding to the problem to be processed”, the method further includes:
[0085] For each vector similarity corresponding to the question vector, when the vector similarity is greater than a preset threshold, the optimal question vector is determined from other question vectors according to the magnitude of the vector similarity, and the answer text corresponding to the optimal question vector is determined as the output result.
[0086] The optimal problem vector is the problem vector with the largest vector similarity to the problem vector of the problem to be processed. For example, if the vector similarities of the problem vector of the problem to be processed with problem vector 1, problem vector 2, and problem vector 3 are 0.2, 0.4, and 0.8, respectively, then problem vector 3 is determined to be the optimal problem vector.
[0087] Specifically, the server may compare the vector similarities of each question to be processed with a preset threshold value, and determine other question vectors whose vector similarities are greater than the preset threshold value. If there are multiple other question vectors whose vector similarities are greater than the preset threshold value, the other question vector with the largest vector similarity may be determined as the optimal question vector from the multiple other question vectors according to the magnitude of the vector similarity. The server determines the corresponding question and answer text in the question and answer library according to the optimal question vector, obtains the answer text in the question and answer text, determines the answer text as the output result, and returns the output result to the user terminal.
[0088] Alternatively, in an exemplary embodiment, when the vector similarities are all less than a preset threshold, after determining the target classification result corresponding to the problem to be processed based on the large model and the classification prompt words, the method further includes:
[0089] When the target classification result is a question and answer text in the question and answer library, the answer text in the question and answer text is determined as the output result.
[0090] Specifically, if it is determined that the target classification result of the question to be processed is any question and answer text in the question and answer library, the server can determine the answer text from the question and answer text, and use the answer text as the output result, and return the output result to the user terminal.
[0091] In this embodiment, by limiting the case where the vector similarity is greater than a preset threshold, and the case where the similarities of multiple vectors are greater than a preset threshold, the answer text corresponding to the optimal question vector is determined as the output result, and the optimal output can be obtained. In addition, when the server determines that the target classification result is the question and answer text in the question and answer library, it can determine the answer text corresponding to the question and answer text as the output result, and can determine the answer text through the classification result, thereby improving the accuracy of the output result.
[0092] In an exemplary embodiment, the specific implementation process of the step of "determining the target classification result corresponding to the problem to be processed based on the large model and the classification prompt words" includes:
[0093] Each question and answer text in the question and answer library and each function in the function library are determined as classification information, and classification prompt words are determined based on the classification information; the classification prompt words and the questions to be processed are input into the trained large model to obtain the target classification results corresponding to the questions to be processed.
[0094] The classification information includes two categories: question and answer text and functional functions. The question and answer text category may contain multiple subcategories, and the functional functions category may contain multiple subcategories.
[0095] Specifically, the server can determine each question and answer text in the question and answer library as a classification, and each function in the function library as a classification, thereby obtaining classification information composed of question and answer texts and function functions. The server can generate classification texts for classifying the problems to be processed, and associate the classification texts with the classification information, thereby generating classification prompt words. The server inputs the classification prompt words into the trained large model, and inputs the problems to be processed into the trained large model. The large model can classify the problems to be processed according to the classification texts and classification information in the classification prompt words, and obtain the target classification results. The target classification result is at least one classification in the classification information.
[0096] In this embodiment, the classification prompt words generated by the classification information including multiple classifications such as question and answer texts, functional functions, etc., and the large model can be used to classify the problems to be processed and obtain the target classification results, which can improve the accuracy and efficiency of the classification of the problems to be processed.
[0097] In an exemplary embodiment, the specific implementation process of the step of "extracting parameters of the problem to be processed based on the large model and the parameter prompt words to obtain function parameters corresponding to the function function" includes:
[0098] The function name, function description, return format and parameter description of the function function are determined as function information; the problem to be processed, function information, and format-limited text are merged to obtain parameter prompt words corresponding to the function function; the parameter prompt words are input into the trained large model to obtain function parameters corresponding to the function function.
[0099] The format restriction text is used to restrict the format of the parameters required by the function function extracted from the large model, ensuring that the output format can be called by the function function. The function function can receive function parameters and execute the function function based on the function parameters to obtain the output result.
[0100] Specifically, after the server determines that the type of the problem to be processed is a certain function, for the function, the server can merge the function name, function description, return format and parameter description of the function in the form of structured data to obtain the function information of the function. The function name is used to record the name of the function in the system. The function description is used to record the function that the function can complete. The return format is used to record the data structure of the input parameters required for the output result generated by the function. The parameter description is used to record the detailed description of the input parameters required by the function.
[0101] The server merges the problem to be processed, function information and format-limited text through a preset parameter prompt word template to obtain the parameter prompt word corresponding to the function. Finally, the server inputs the parameter prompt word into the trained big model, so that the big model extracts the entity of the problem to be processed according to the parameter prompt word and obtains the function parameters corresponding to the function. The format-limited text can limit the data format of the function parameters to be returned in the form of a parameter list and returned in Json format.
[0102] In this embodiment, by taking the function name, function description, return format and parameter description of the function function as part of the parameter prompt words, and taking the problem to be processed and the format limitation text as part of the parameter prompt words, and finally inputting the parameter prompt words into the large model, entity extraction can be performed in the problem to be processed, and the function parameters corresponding to the function function can be obtained, which can improve the accuracy of obtaining the function parameters of the function function.
[0103] In an exemplary embodiment, the question-answer text includes a question text and an answer text, and the method further includes:
[0104] When the target classification result is a function in a function library, the question to be processed sent by the user terminal is determined to be a question text, and the function function is determined to be an answer text; the question text and the answer text are determined to be the question and answer text corresponding to the question to be processed, and the question and answer text is added to the question and answer library.
[0105] Specifically, if the target classification result is determined to be a function in the function library, after obtaining the output result according to the function function, the server can determine that the pending question sent by the user terminal is the question text. The server can determine the function function as the answer text corresponding to the pending question. The server uses the question text and the answer text as a pair of question and answer texts. The question and answer text is the question and answer text corresponding to the pending question. The server can add the question and answer text to the question and answer library in the human-computer dialogue system, thereby completing the expansion of the question and answer library.
[0106] In an exemplary embodiment, when the target classification result is a question and answer text in a question and answer library, the question to be processed is added to the question text corresponding to the question and answer text in the question and answer library to obtain an updated question and answer text.
[0107] Specifically, if it is determined that the target classification result is a question and answer text in the question and answer library, the server can obtain the answer text of the pending question based on the question and answer text. Based on this, the server can use the pending question as a new question text and add the new question text to the original question and answer text. At this time, the question and answer text may have multiple question texts and a corresponding answer text. For example, the pending question is question M, and the question and answer text corresponding to the pending question is question N and answer N. The server can add question M to the question text, and the question text changes from question N to question M and question N. At this time, the question and answer text is question M, question N and answer N, where question M and question N share the same answer N.
[0108] In this embodiment, the question and answer library can be expanded and updated through various situations in which the target classification result is a functional function or a question and answer text, which can improve the richness of the question and answer library and improve the question and answer instructions of the question and answer library.
[0109] In an exemplary embodiment, the method further includes: determining quality inspection prompt words based on the question text of each question and answer text in the question and answer library, and the quality inspection limiting text; inputting the quality inspection prompt words into the trained large model to obtain a question list corresponding to repeated questions and a question list corresponding to ambiguous questions.
[0110] Among them, the quality inspection limit text is used to limit whether the question text is a repeated question or an ambiguous question; ambiguous questions are used to represent multiple different questions with the same answer text.
[0111] Specifically, the server can obtain the question text corresponding to each question and answer text in the question and answer library, and generate a question list containing each question text. The server logically associates the pre-configured limiting text with the question list, and merges the question list with the limiting text to obtain a quality inspection prompt word. The server inputs the quality inspection prompt word into the trained large model, and the large model will perform quality inspection on the question text in the question list based on the limiting text, determine whether there are repeated questions in the question list, and determine whether there are questions in the question list with the same answer but obviously different meanings of the question text. When the server determines whether all questions in the question and answer library are repeated questions, and whether they are ambiguous questions, the repeated questions and ambiguous questions can be recorded in two question lists in a list format, and the question list is returned to the staff's terminal for the staff to adjust the question and answer library.
[0112] In one example, for example, the answer texts corresponding to the two question texts "What time is it now?" and "What time is it now" are both functional functions for determining the current time, so the two questions can be determined to be repeated questions. For example, the answer texts corresponding to the two question texts "What is the weather like today?" and "What is the weather like in winter?" are both functional functions for obtaining weather information at the current time, so the question text can be determined to have an ambiguous problem based on the meaning of the question text.
[0113] In this embodiment, by generating quality inspection prompt words and inputting the quality inspection prompt words into the big model, a list of questions with quality problems in the question and answer database can be obtained, so that the staff can optimize the question and answer database according to the question list and improve the quality of the question and answer database.
[0114] like Figure 3 As shown, the specific execution process of the above-mentioned human-computer dialogue method is described in detail below in combination with a specific embodiment. The embodiment of the present application introduces vector retrieval technology. Specifically, when a user asks a relevant question, it is processed in two steps: first, the user question is searched in the form of a question-and-answer library. The search method introduces keywords and vectorized retrieval methods, and the answer is determined by setting a threshold and returned to the user; second, for the question vectors in the question-and-answer library that are all lower than the threshold, the answer cannot be found through the question-and-answer library. A large model can be used to classify and extract entities from the problem to be processed, and the corresponding function function can be found according to the classification result. The entity of the problem to be processed is extracted through the large model, the function parameters are determined, and the function parameters are filled into the function function. After the function is called, the output result is fed back to the user terminal.
[0115] At the same time, after the introduction of the large model, the response efficiency of the human-computer dialogue system is considered. After answering the pending questions, the server can use the answers determined by the large model in the second step as a supplement to the question-and-answer library, thereby improving the richness of the question-and-answer library. Based on this, most questions can be answered through the question-and-answer library; a small number of questions are answered in the large model, and the question-and-answer records are added to the question-and-answer library; in addition, at intervals, the server can perform quality inspections on the question-and-answer library to remove duplicate questions and ambiguous questions to ensure the quality of the question-and-answer library.
[0116] The specific implementation process of the human-computer dialogue method includes the following steps:
[0117] Step 1: Information retrieval based on vectorized question-answer database.
[0118] Specifically, the server can manually maintain a complete question-and-answer database, which contains frequently asked questions and corresponding answers. The answers can be in the form of single text, pictures and words, or can be in the form of calling a function method.
[0119] All questions in the existing question-and-answer library can be vectorized and stored through the server to form a question vector library. The answer is used as additional information of the question vector library. When a user's question request arrives, the user's question vector to be processed is matched with the question vector library for similarity, and the vector similarity above the threshold is determined. The answer text corresponding to the TOP1 is selected from multiple vector similarities and returned to the user terminal, so that the answer is displayed on the human-computer dialogue interface of the user terminal.
[0120] The above content adds vector search to the existing keyword search to improve the accuracy of the search. However, the manual maintenance cost is high, so a large model can be introduced in the subsequent steps for in-depth classification and entity extraction.
[0121] Step 2: Classification and entity extraction based on large models.
[0122] Specifically, when the answer cannot be determined in the question vector library and the question and answer library (that is, the vector similarity is lower than a preset threshold), the server can organize the question information in the question and answer library and the function description information in the function library into Prompt words, so that the large model can be classified by the prompt words.
[0123] The format of the prompt is as follows: "The following classification information is available. Please give the classification result based on the user's question, and the classification result must be unique. If the classification result cannot be found, please give "none" for the time being. [Classification information]: [Category 1]: Question 1, [Category 2]: Question 2, ..., [Category N1]: Function 1, [Category N2]: Function 2, ...".
[0124] After the server inputs the prompt word and the question to be processed into the big model, it obtains the classification result of the question to be processed. If the classification result output by the big model is the result in the question and answer library, the corresponding answer information in the question and answer library is directly given. If the classification result of the big model is a function in the function library, then combined with the parameter description of the function, a new prompt calls the big model to extract the entity of the function function.
[0125] For example, if the classification result is a function, and the function is "Science Park Meeting and Science Park Agenda Query", the prompt corresponding to the entity extraction is:
[0126] "Suppose you are a function for processing science park meetings and science park agenda queries, please extract relevant field information according to [user input] and return the results according to the corresponding requirements. {{"[Function name]": Science park meeting and science park agenda query." [Function description 3]": This tool can be used to obtain ongoing science park meetings and the latest science park-related agendas that need to be attended." [Return format 3]": {{"Time": "****-**-**", "Explanation": "Reason for extracting fields", "Do you want to query me": "Yes"}}." [Parameter description 3]": {{"Time": "Fill in the date you try to identify from the user's input here, in the format of xxxx-xx-xx, and the default year is 2024. If the date cannot be identified, it is directly output in text (such as today, tomorrow, next week, etc.). For example, the user asks 'What meeting is there on January 1st', and the date is 2024-01-01. For example, the user asks 'What meeting do I have to attend next Wednesday? ', the date is next Wednesday; for example, the user asks 'What meeting do I have to attend on March 31st? ', the date is 2024-03-31;", "Explanation": "Please explain why you extracted fields such as \"time\" and \"whether to query myself\", "whether to query myself": "Please clarify whether to query my meeting agenda based on the user's input, and select [yes, no]"}}}}. [User input]: {q}. [Note] You need to extract the parameter list required by the function based on the user's input and return it in json format. The json format sample is as follows: {{"Function type": "same as function name", "parameter list": "the result you identified"}}. If the user description is indeed not related to the function, please return: [Sorry, we cannot meet your needs for the time being. Please try another question.]".
[0127] The server can use the entity text after entity extraction as a function parameter, make a function call through the function, and finally feed back the call result to the user.
[0128] To summarize, the embodiment of the present application completes the overall question-and-answer process of human-computer dialogue. Since calling the large model requires additional performance overhead (occupying GPU resources), and the calculation response speed of the large model is slower than the question-and-answer library, in order to speed up user response, combined with the 80 / 20 principle, it is necessary to fill the question text flowing into the large model back into the question-and-answer library so that most questions can get answers from the question-and-answer library.
[0129] Step 3: Supplement and quality check the content of the Q&A database.
[0130] First, let’s supplement the content of the Q&A database. For questions answered by the big model, the user’s questions and answers are written back to the Q&A database from the record table. There are two situations: (1) For results classified by the big model as in the Q&A database, the user’s questions and answers are directly written into the Q&A database. (2) For results classified by the big model as in the function library, the user’s questions are written into the questions in the Q&A database. The corresponding answers are functions pointing to a specific function library, and it is marked whether the function needs to perform parameter entity extraction. If parameter entity extraction is required, it is marked that the question needs to call the big model for entity extraction.
[0131] Secondly, regarding the quality inspection of the Q&A database, the server uses a large model to automatically traverse all questions in the Q&A database every night, including removing duplicate questions, prompting ambiguous questions, etc., to ensure the quality of the Q&A database. The relevant quality inspection prompts are as follows:
[0132] "Please sort out the questions in the following question and answer database. The sorting results include repeated questions, ambiguous questions, and contradictory questions. [Question list in the question and answer database]: [Question one]: *****. [Question two]: *****. [Question N]: *****. Please output: [Duplicate questions]: Please output a list of repeated questions based on the question list. If there are none, give "none". [Ambiguous questions]: Please give questions with the same answer but different answers and obviously different questions based on the question list. If there are none, give "none".
[0133] The embodiment of the present application saves the workload of manually maintaining and reviewing the question and answer library through daily quality inspection of the large model question and answer library. By introducing vectorization and large model question retrieval technology, the ability to accurately match questions is improved. Through the agent intelligent body method, that is, the classification and entity extraction of the large model, the dynamic presentation of content can be achieved. Through the reflow question and answer library of the large model question and answer record, the advantages of the question and answer library can be effectively utilized, thereby reducing GPU resource overhead and improving the system resource utilization ability.
[0134] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0135] Based on the same inventive concept, the embodiment of the present application also provides a human-computer dialogue device for implementing the human-computer dialogue method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more human-computer dialogue device embodiments provided below can refer to the limitations on the human-computer dialogue method above, and will not be repeated here.
[0136] In an exemplary embodiment, Figure 4 As shown, a human-computer dialogue device 400 is provided, comprising: a similarity acquisition module 401, a classification result determination module 402, a parameter determination module 403 and a result return module 404, wherein:
[0137] The similarity acquisition module 401 is used to acquire the vector similarity corresponding to the pending question sent by the user terminal; the vector similarity is determined based on the vector of the pending question and the vector corresponding to each question and answer text in the question and answer library;
[0138] The classification result determination module 402 is used to determine the target classification result corresponding to the problem to be processed based on the large model and the classification prompt word when the vector similarities are all less than the preset threshold; the target classification result is a category of the question and answer text in the question and answer library and the function function in the function library;
[0139] The parameter determination module 403 is used to extract parameters of the problem to be processed based on the large model and parameter prompt words to obtain function parameters corresponding to the function function when the target classification result is a function function in the function library;
[0140] The result returning module 404 is used to determine the output result of the functional function through the function parameters and return the output result to the user terminal.
[0141] Furthermore, the similarity acquisition module is specifically used to: determine the question vector corresponding to the question to be processed sent by the user terminal; determine the vector similarity between the question vector and other question vectors in the question vector library; the question vector library is determined based on the vectors corresponding to each question and answer text in the question and answer library.
[0142] Furthermore, the result returning module 404 is also used to: for each vector similarity corresponding to the question vector, when the vector similarity is greater than a preset threshold, determine the optimal question vector from other question vectors according to the size of the vector similarity, and determine the answer text corresponding to the optimal question vector as the output result.
[0143] Furthermore, the result returning module 404 is also used to: when the target classification result is a question and answer text in the question and answer library, determine the answer text in the question and answer text as the output result.
[0144] Furthermore, the classification result determination module is specifically used to: determine each question and answer text in the question and answer library, and each function in the function library as classification information, and determine the classification prompt words based on the classification information; input the classification prompt words and the question to be processed into the trained large model to obtain the target classification result corresponding to the question to be processed.
[0145] Furthermore, the parameter determination module 403 is specifically used to: determine the function name, function description, return format and parameter description of the function function as function information; merge the problem to be processed, function information, and format-limited text to obtain parameter prompt words corresponding to the function function; input the parameter prompt words into the trained large model to obtain function parameters corresponding to the function function.
[0146] Furthermore, the question and answer text includes a question text and an answer text, and the device also includes a question and answer library update module, which is specifically used to: when the target classification result is a function in the function library, determine that the question to be processed sent by the user terminal is the question text, and determine that the function function is the answer text; determine the question text and the answer text as the question and answer text corresponding to the question to be processed, and add the question and answer text to the question and answer library; when the target classification result is the question and answer text in the question and answer library, add the question to be processed to the question text corresponding to the question and answer text in the question and answer library to obtain an updated question and answer text.
[0147] Furthermore, the device also includes a question and answer library quality inspection module, which is specifically used to: determine quality inspection prompt words based on the question text of each question and answer text in the question and answer library, and the quality inspection limitation text; the quality inspection limitation text is used to limit whether the question text is a repeated question or an ambiguous question; ambiguous questions are used to represent multiple different questions with the same answer text; the quality inspection prompt words are input into the trained large model to obtain a question list corresponding to repeated questions and a question list corresponding to ambiguous questions.
[0148] Each module in the above-mentioned human-computer dialogue device can be implemented in whole or in part by software, hardware or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0149] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as vectors of question and answer texts, question and answer texts, and functional functions. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a human-computer dialogue method is implemented.
[0150] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0151] In an exemplary embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0152] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0153] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0154] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0155] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0156] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0157] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A human-computer dialogue method, characterized in that: The method comprises: For the question to be processed sent by the user terminal, obtain the vector similarity corresponding to the question to be processed; the vector similarity is determined based on the vector of the question to be processed and the vectors corresponding to each question and answer text in the question and answer library; When the vector similarities are all less than a preset threshold, a target classification result corresponding to the problem to be processed is determined based on the large model and the classification prompt word; the target classification result is a category of the question and answer text in the question and answer library and the function function in the function library; When the target classification result is a function in the function library, based on the large model and the parameter prompt word, the parameters of the problem to be processed are extracted to obtain the function parameters corresponding to the function; The output result of the functional function is determined by the function parameter, and the output result is returned to the user terminal.
2. The method according to claim 1, characterized in that The obtaining of the vector similarity corresponding to the problem to be processed includes: Determining a question vector corresponding to the question to be processed sent by the user terminal; Determine the vector similarity between the question vector and other question vectors in a question vector library; the question vector library is determined based on the vectors corresponding to each question and answer text in the question and answer library.
3. The method according to claim 2, characterized in that After obtaining the vector similarity corresponding to the problem to be processed, the method further includes: For each vector similarity corresponding to the question vector, when the vector similarity is greater than a preset threshold, determining an optimal question vector from each of the other question vectors according to the magnitude of the vector similarity, and determining the answer text corresponding to the optimal question vector as the output result; Alternatively, when the vector similarities are all less than a preset threshold, after determining the target classification result corresponding to the problem to be processed based on the large model and the classification prompt word, the method further includes: In the case where the target classification result is a question and answer text in a question and answer library, the answer text in the question and answer text is determined as the output result.
4. The method according to claim 1, characterized in that: Determining the target classification result corresponding to the problem to be processed based on the large model and the classification prompt words includes: Determine each question and answer text in the question and answer library and each function in the function library as classification information, and determine a classification prompt word based on the classification information; The classification prompt words and the problem to be processed are input into the trained large model to obtain the target classification result corresponding to the problem to be processed.
5. The method according to claim 1, characterized in that The step of extracting parameters of the problem to be processed based on the large model and the parameter prompt words to obtain function parameters corresponding to the functional function includes: Determine the function name, function description, return format and parameter description of the function as function information; The problem to be processed, the function information, and the format-restricted text are combined to obtain a parameter prompt word corresponding to the function; The parameter prompt words are input into the trained large model to obtain the function parameters corresponding to the functional function.
6. The method according to claim 1, characterized in that The question and answer text includes a question text and an answer text; the method further includes: In the case where the target classification result is a function in the function library, determining that the question to be processed sent by the user terminal is a question text, and determining that the function is an answer text; Determine the question text and the answer text as the question and answer text corresponding to the question to be processed, and add the question and answer text to the question and answer library; In the case where the target classification result is a question and answer text in the question and answer library, the question to be processed is added to the question text corresponding to the question and answer text in the question and answer library to obtain an updated question and answer text.
7. The method according to claim 6, characterized in that The method further comprises: Determine a quality inspection prompt word based on the question text of each question and answer text in the question and answer library and the quality inspection limiting text; the quality inspection limiting text is used to determine whether the question text is a repeated question or an ambiguous question; the ambiguous question is used to represent multiple different questions with the same answer text; The quality inspection prompt words are input into the trained large model to obtain a question list corresponding to repeated questions and a question list corresponding to ambiguous questions.
8. A human-computer dialogue device, characterized in that: The device comprises: A similarity acquisition module, for acquiring the vector similarity corresponding to the pending question sent by the user terminal; the vector similarity is determined based on the vector of the pending question and the vector corresponding to each question and answer text in the question and answer library; A classification result determination module is used to determine, when the vector similarities are all less than a preset threshold, a target classification result corresponding to the problem to be processed based on the large model and the classification prompt word; the target classification result is a category of question and answer texts in the question and answer library and function functions in the function library; A parameter determination module, used for, when the target classification result is a function in the function library, extracting parameters of the problem to be processed based on the large model and parameter prompt words, and obtaining function parameters corresponding to the function; The result returning module is used to determine the output result of the functional function through the function parameter and return the output result to the user terminal.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Data classification method and device based on large model
CN120632109A