Method and device for generating reply text data, computer equipment, readable storage medium and program product
By using the reply text data generation method on the online education platform, the problem that traditional class teachers cannot respond to a large number of students’ questions in a timely manner is solved, efficient and accurate reply text data generation is achieved, and the response ability of the education platform is improved.
Patent Information
- Application Number
- CN202411590711.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-02-28
AI Technical Summary
Due to the sharp expansion of the number of students on the online education platform, traditional class teachers cannot respond to all students' questions in a timely manner, and it is difficult to quickly and accurately respond when dealing with a large number of and complex problems.
Provide a method for generating reply text data, obtaining question text data, classifying intents, selecting pre-configured multiple large language models, generating reply text data based on reply prompt templates, and improving reply quality through vector matching and model priority adjustment.
It improves the efficiency and quality of reply text data generation, can quickly and accurately deal with large and complex problems, and meets the efficient reply needs of online education platforms.
Smart Images

Figure CN119537692A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method, apparatus, computer device, computer-readable storage medium and computer program product for generating reply text data. Background Art
[0002] With the rapid development of information technology, the field of adult vocational education has undergone significant changes. Online education platforms have become the main way for adults to improve their professional skills due to their high portability, efficiency and flexibility. At present, adult students can purchase and watch online live courses through online education platforms, and have one-on-one Q&A interactions with online live course instructors.
[0003] However, with the rapid increase in the number of students, their questions and needs are becoming more and more diverse. The traditional way of answering questions by class teachers is not only limited in capacity and unable to answer all students' questions in a timely manner, but also difficult to give accurate answers quickly when dealing with a large number of complex questions. Therefore, a more efficient method for generating response text data is urgently needed to cope with the current dilemma of online education platforms. Summary of the invention
[0004] Based on this, it is necessary to provide a method, device, computer equipment, computer-readable storage medium and computer program product for generating reply text data in an efficient manner in response to the above technical problems.
[0005] In a first aspect, the present application provides a method for generating reply text data, comprising:
[0006] Get question text data;
[0007] Performing intent classification on the question text data to obtain a target intent category to which the question text data belongs;
[0008] According to a plurality of pre-configured large language models corresponding to the target intent category and a model priority of each of the large language models, a target large model whose model priority meets a preset condition is selected from the plurality of large language models;
[0009] Model input data is generated according to a pre-configured reply prompt template corresponding to the target large model and the question text data, and the model input data is input into the target large model to obtain reply text data corresponding to the question text data.
[0010] In one embodiment, the method further comprises:
[0011] Intercepting the reply text data, and matching the reply text data with the question-answer vector data stored in a preset vector library to obtain an answer score for the reply text data;
[0012] When the answer score is lower than a preset score threshold, generating a failure detection reason corresponding to the reply text data;
[0013] updating the model input data according to the reason for failure of the test;
[0014] The updated model input data is input into the target large model to obtain new reply text data corresponding to the question text data.
[0015] In one embodiment, the method further comprises:
[0016] When the number of times the target large model repeatedly generates new reply text data reaches a preset number threshold, and the answer score of the new reply text data is lower than the preset score threshold, a new target large model is selected according to the model priority;
[0017] New model input data is generated according to the new reply prompt template corresponding to the new target large model and the question text data, and the new model input data is input into the new target large model to obtain new reply text data corresponding to the question text data.
[0018] In one embodiment, the method further comprises:
[0019] When the answer scores of the reply text data of the target large model obtained after traversing each of the large language models are all lower than the preset score threshold, generating an intention to-do tag corresponding to the question text data according to the target intention category;
[0020] Determine the processing priority corresponding to the question text data according to the intended to-do tag;
[0021] The question text data and the intended to-do label are returned to the client for display according to the processing priority.
[0022] In one embodiment, the method further comprises:
[0023] Under the preset business scenario, obtain the multi-round conversation data currently generated;
[0024] A target business chain corresponding to the preset business scenario is determined based on the multi-round dialogue data using multi-agent routing, and the target business chain is used to guide the business processing operations that need to be performed during the generation of the reply text data.
[0025] In one embodiment, the performing intent classification on the question text data to obtain the target intent category to which the question text data belongs includes:
[0026] Matching the question text data with preset intent keywords;
[0027] When it is determined that there is no intention keyword corresponding to the question text data, calculating the similarity between the question text data and the question vector data in a preset vector library;
[0028] When the similarity is lower than a preset similarity threshold, the intention classification model is used to perform intention classification processing on the question text data to obtain the target intention category.
[0029] In a second aspect, the present application also provides a device for generating reply text data, comprising:
[0030] A question acquisition module is used to obtain question text data;
[0031] An intent classification module is used to classify the intent of the question text data to obtain a target intent category to which the question text data belongs;
[0032] A configuration acquisition module is configured to select a target large model whose model priority meets a preset condition from a plurality of large language models that are pre-configured to correspond to the target intent category and a model priority of each of the large language models;
[0033] A reply generation module is used to generate model input data according to a pre-configured reply prompt template corresponding to the target large model and the question text data, input the model input data into the target large model, and obtain reply text data corresponding to the question text data.
[0034] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method for generating reply text data as described in any one of the embodiments of the first aspect is implemented.
[0035] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for generating reply text data as described in any one of the embodiments of the first aspect above is implemented.
[0036] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the method for generating reply text data described in any one of the embodiments of the first aspect is implemented.
[0037] The above-mentioned method, device, computer equipment, computer-readable storage medium and computer program product for generating reply text data obtain question text data, classify the question text data in intent, obtain the target intent category to which the question text data belongs, select a target large model whose model priority meets preset conditions from a plurality of large language models according to a plurality of pre-configured large language models corresponding to the target intent category and the model priority of each large language model, generate model input data according to a pre-configured reply prompt template corresponding to the target large model and the question text data, input the model input data into the target large model, obtain reply text data corresponding to the question text data, and can specifically use the large language model corresponding to the target intent category and its reply prompt template to generate reply text data, thereby improving the generation efficiency and generation quality of reply text data.
[0038] At the same time, due to the adoption of the above-mentioned reply text data generation method, the corresponding large-scale language model and its reply prompt template are pre-configured for the target intent category, so that it can be quickly called during the reply text data generation process, and the reply text data generation function can be low-code: when the above-mentioned reply text data generation method is connected to various complex business scenarios, only relevant configuration is required without writing any additional code, which greatly saves development time and development costs, and is simpler and more efficient. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0040] Figure 1 An application environment diagram of a method for generating reply text data in one embodiment;
[0041] Figure 2 A schematic diagram of a process for generating reply text data in one embodiment;
[0042] Figure 3 A schematic flow chart of a step of generating new reply text data in one embodiment;
[0043] Figure 4A flowchart of steps for generating an intended to-do tag in one embodiment;
[0044] Figure 5 A flowchart of a target intent category generation step in one embodiment;
[0045] Figure 6 is a flow chart of a method for generating reply text data in another embodiment;
[0046] Figure 7 is a structural block diagram of a device 700 for generating reply text data in one embodiment;
[0047] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0048] 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.
[0049] 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.
[0050] The method for generating reply text data provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The client of the online education platform can be run in the terminal 102. The backend business system of the online education platform can be deployed in the server 104.
[0051] Specifically, the server 104 can obtain the question text data currently input by the student through the terminal 102. The server 104 can perform intent classification on the question text data to obtain the target intent category to which the question text data belongs. The server 104 can select a target large model whose model priority meets the preset conditions from a plurality of large language models according to a plurality of pre-configured large language models corresponding to the target intent category and the model priority of each large language model. The server 104 can generate model input data according to a pre-configured reply prompt template corresponding to the target large model and the question text data, input the model input data into the target large model, and obtain reply text data corresponding to the question text data.
[0052] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart car devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 may be an independent physical server, or a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0053] In an exemplary embodiment, Figure 2 As shown, a method for generating reply text data is provided, and the method 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:
[0054] Step S202, obtaining question text data.
[0055] For example, the server may parse the generated request for reply text data in response to the generated request sent by the terminal to obtain the question text data, wherein the question text data may be obtained by the terminal interacting with the learner through various interactive components such as input controls, voice recognition controls or motion recognition controls.
[0056] Step S204, performing intent classification on the question text data to obtain the target intent category to which the question text data belongs.
[0057] Among them, the target intent category may include but is not limited to a query intent category, a transaction intent category, a service intent category, a content generation intent category, etc.
[0058] Optionally, in some embodiments, the server may store intent keywords corresponding to each intent category. The intent keywords under different intent categories are used to perform string comparison with the question text data. When it is determined that a certain intent keyword exists in the question text data, the intent category corresponding to the intent keyword is used as the target intent category corresponding to the question text data.
[0059] Alternatively, in some other embodiments, the server may also store a vector library composed of question and answer messages generated by artificial intelligence based on manual evaluation (e.g., full marks in manual evaluation). The question text data is converted into corresponding vector data. The similarity (e.g., cosine similarity) between the vector data of the question text data and the vector data of the question and answer messages in the vector library is calculated. The intent category corresponding to the question and answer message with the highest similarity is used as the target intent category corresponding to the current question text data.
[0060] Alternatively, in some other implementations, the server may also store a large language model (LLM model) trained based on an artificial intelligence classification algorithm. The question text data is input into the large language model for intent classification, and the large language model predicts the intent category based on the features of the question text data and the features of the text samples learned in the pre-training phase, thereby outputting the intent classification result corresponding to the question text data.
[0061] Step S206, according to the preset multiple large language models corresponding to the target intent category and the model priority of each large language model, a target large model whose model priority meets the preset conditions is selected from the multiple large language models.
[0062] Among them, the large language model, Large Language Model, referred to as LLM model, is a deep learning model trained using a large amount of text data. In this embodiment, the large language model can be used to generate natural language text.
[0063] Exemplarily, the server can use the question-and-answer messages corresponding to each intent category obtained at a historical moment to pre-train several large language models, and obtain the accuracy, generation efficiency, computing resources consumed in the generation process, and other performance parameters of the corresponding reply text data generated by various large language models. According to the performance parameters of various large language models, the model priority corresponding to each large language model is determined. Multiple large language models (for example, the top n large language models with the best performance parameters) and their model priorities are stored in the intent configuration information under this intent category, so that in subsequent applications, the required types of large language models and the model priority of each large language model can be quickly read from the intent configuration information.
[0064] The server can read multiple pre-configured large language models corresponding to the target intent category and the model priority of each large language model from the intent configuration information corresponding to the target intent category according to the target intent category corresponding to the currently acquired question text data, and use the large language model with the highest model priority as the target large model that meets the preset conditions.
[0065] Optionally, in some implementations, the preset condition may also be to select a large language model with the highest model priority from the large language models currently in an idle state. The server may first poll and obtain the working status of various large language models. Then, the large language model with the highest model priority is selected from the large language models whose working status is an idle state as the target large model that meets the preset condition.
[0066] Step S208, generating model input data according to the pre-configured reply prompt template corresponding to the target large model and the question text data, inputting the model input data into the target large model, and obtaining reply text data corresponding to the question text data.
[0067] Among them, the reply prompt template, also known as the PROMPT template, is an input form or template for interacting with a large language model. It is usually a text paragraph or phrase that serves as a starting point or guide for the large language model to generate a reply text information output.
[0068] Exemplarily, after the server determines the large language model corresponding to each intent category, it can use the question and answer messages under the intent category to form prompt templates of different formats. The large language model is pre-trained using prompt templates of different formats, and based on the model parameters of the trained large language model, a prompt template that can make the model parameters of the trained large language model reach the optimal state is determined as the most suitable prompt template corresponding to the large language model. When constructing the intent configuration information, the configuration information of the prompt template corresponding to the large language model can also be stored.
[0069] The server can read the pre-configured reply prompt template corresponding to the target large model from the intent configuration information corresponding to the target intent category. The question text data is processed according to the question sentence format in the reply prompt template to obtain the question sentence corresponding to the question text data. The question sentence is filled into the reply prompt template to obtain model input data. The model input data is input into the target large model, and the target large model adjusts its own model parameters based on the known question sentences in the reply prompt template and the corresponding known reply sentences. The adjusted model parameters are used to predict and output the reply text data corresponding to the question text data. Among them, the known question sentences in the reply prompt template and the corresponding known reply sentences can be extracted from the corpus data corresponding to the target intent category.
[0070] In the above-mentioned method for generating reply text data, by obtaining question text data, the question text data is classified for intent to obtain the target intent category to which the question text data belongs, and according to a plurality of pre-configured large language models corresponding to the target intent category and the model priority of each large language model, a target large model whose model priority meets preset conditions is selected from the plurality of large language models, and model input data is generated according to a pre-configured reply prompt template corresponding to the target large model and the question text data, and the model input data is input into the target large model to obtain reply text data corresponding to the question text data. The large language model corresponding to the target intent category and its reply prompt template can be used in a targeted manner to generate reply text data, thereby improving the generation efficiency and quality of reply text data.
[0071] At the same time, due to the adoption of the above-mentioned reply text data generation method, the corresponding large-scale language model and its reply prompt template are pre-configured for the target intent category, so that it can be quickly called during the reply text data generation process, and the reply text data generation function can be low-code: when the above-mentioned reply text data generation method is connected to various complex business scenarios, only relevant configuration is required without writing any additional code, which greatly saves development time and development costs, and is simpler and more efficient.
[0072] In an exemplary embodiment, Figure 3 As shown, a reply text data compliance detection method is also provided, including the following steps S302 to S308. Among them:
[0073] Step S302, intercepting the reply text data, and matching the reply text data with the question and answer vector data stored in the preset vector library to obtain the answer score of the reply text data.
[0074] Among them, the preset vector library can store vector data of question and answer messages generated by a large language model at historical moments and that have been manually evaluated and met the standards, that is, the question and answer vector data referred to in this embodiment.
[0075] The answer score can be used to measure the similarity between the reply text data and the question-answer vector data. The higher the answer score, the more similar the reply text data is to the existing question-answer vector data. On the contrary, the greater the gap between the reply text data and the existing question-answer vector data, the more likely the answer may be lost.
[0076] Exemplarily, in order to ensure that the reply text data generated by the target large model is legal and compliant, and to avoid the occurrence of artificial intelligence reply escape (ie, AI escape) and irrelevant answers. The server can intercept the reply text data output by the target large model and convert the reply text data into corresponding vector data. The vector data corresponding to the reply text data is matched with the question and answer vector data stored in the preset vector library to obtain the similarity between the vector data of the reply text data and the question and answer vector data. Determine the answer score of the reply text data based on the similarity. For example, the similarity can be directly used as the answer score of the reply text data; or, the score level of the reply text data can be determined based on the numerical value of the similarity, and then the score corresponding to the score level is used as the answer score of the reply text data.
[0077] Step S304, when the answer score is lower than the preset score threshold, a failure detection reason corresponding to the reply text data is generated.
[0078] Exemplarily, the server compares the answer score of the reply text data with a preset score threshold. When the answer score is lower than the preset score threshold, a failure detection reason corresponding to the reply text data can be generated: for example, the reason why the similarity between the question and answer vector data stored in the pre-vector library and the reply text data is low. Alternatively, in the case where illegal words appear in the reply text data, a failure detection reason can also be generated based on the illegal words that appear. Alternatively, when the answer score of the reply text data is lower than the preset score threshold, the reply text data can be returned to the client to be displayed to the user, and the failure detection reason obtained by the user's manual evaluation of the reply text data can be received.
[0079] Step S306, updating the model input data according to the reason for failure of the test.
[0080] Step S308, input the updated model input data into the target large model to obtain new reply text data corresponding to the question text data.
[0081] Exemplarily, the server can write the failure detection reason of the currently generated reply text data into a preset position in the model input data as new PROMPT prompt information to obtain updated model input data. The updated model input data is input into the target large model so that the target large model readjusts the model parameters or reconstructs the model network according to the failure detection reason, and uses the readjusted model parameters or the reconstructed model network to process the question text data, and outputs new reply text data corresponding to the question text data.
[0082] Optionally, in other implementations, when the answer score of the reply text data is greater than a preset score threshold, the current reply text data may be directly returned to the user side for interaction.
[0083] In this embodiment, by intercepting the reply text data for compliance verification before the reply text data reaches the user side, the question and answer vector data stored in the preset vector library generates the answer score of the reply text data. When the answer score is lower than the preset score threshold, the failure detection reason corresponding to the reply text data is generated, the model input data is updated according to the failure detection reason, and the target large model is adjusted using the updated model input data to obtain new reply text data, which can ensure the accuracy of the reply text data.
[0084] In an exemplary embodiment, the method for generating reply text data provided in the present application may also include: when the number of times the target large model repeatedly generates new reply text data reaches a preset number threshold, and the answer score of the new reply text data is lower than the preset score threshold, selecting a new target large model according to the model priority; generating new model input data according to a new reply prompt template and question text data corresponding to the new target large model, inputting the new model input data into the new target large model, and obtaining new reply text data corresponding to the question text data.
[0085] Exemplarily, when the answer score of the reply text data generated by the target large model is lower than the preset score threshold, the server can repeat the operation means of the above steps S302 to S308 to generate new reply text data. When the target large model repeatedly executes the generation of new reply text data for the number of times reaching the preset number threshold, and the answer score of the reply text data finally generated is still lower than the preset score threshold, the large language model second only to the current target large model can be selected as the new target large model according to the model priority of the large language model corresponding to the target intent category pre-configured. Referring to the operation of step S208 above, new model input data is generated according to the new reply prompt template and question text data corresponding to the new target large model, and the new model input data is input into the new target large model to obtain new reply text data corresponding to the question text data. The specific generation process of the reply text data can be implemented with reference to the limitation of the generation method of the reply text data given in the above embodiment, which will not be repeated here. Optionally, in some embodiments, the preset number threshold can be 5 times.
[0086] In this embodiment, by selecting a new target large model according to the model priority to generate reply text data when the answer scores of the reply text data repeatedly generated by the target large model are all less than the preset score threshold, the disaster recovery capability can be enhanced, and the influence of the instability of the target large model on the generation of reply text data can be effectively prevented, thereby ensuring a higher response rate and improving the stability and reliability of the reply text data generation method.
[0087] In an exemplary embodiment, Figure 4 As shown, a feedback method for question text data is also provided, including the following steps S402 to S406. Among them:
[0088] Step S402, when the answer scores of the reply text data of the target large model obtained after traversing each large language model are all lower than the preset score threshold, an intention to-do tag corresponding to the question text data is generated according to the target intention category.
[0089] Exemplarily, when the answer score of the reply text data generated by the target large model is always lower than the preset score threshold, the server can repeatedly perform the above operation of updating the model input data according to the reason why the reply text data failed the detection, and using the new model input data to adjust the target large model to generate new reply text data. In the case where the number of executions of the above steps S302 to S308 by the same target large model reaches the preset number threshold and no reply text data with an answer score greater than the preset score threshold is obtained, the operation of selecting a new target large model according to the model priority can be repeated. Until each pre-configured large language model corresponding to the target intent category is traversed, and the reply text data obtained after all large language models are repeatedly executed for the preset number threshold is obtained.
[0090] When the answer scores of the reply text data obtained by all large language models are lower than the preset score threshold, an intent to-do tag corresponding to the question text data can be generated according to the target intent category. For example, when the target intent category is a transaction category, a transaction intent to-do tag corresponding to the question text data can be generated, such as a pre-refund to-do tag. When the target intent category is a service intent category, a service intent to-do tag corresponding to the question text data can be generated, such as a media message to-do tag.
[0091] Step S404, determining the processing priority corresponding to the question text data according to the intended to-do tag.
[0092] Step S406, returning the question text data and the intended to-do tags to the client for display according to the processing priority.
[0093] Exemplarily, the server may pre-store processing priorities corresponding to each intent to-do tag. According to the intent to-do tag corresponding to the question text data, the processing priority corresponding to the current question text data may be determined. Question text data carrying different intent to-do tags are returned to the client for display in the order of processing priority.
[0094] Optionally, in some embodiments, the processing priority of the pre-refund pending label is higher than the processing priority of the media message pending label. That is, the question text data of the pre-refund pending label returned by the server to the client will be displayed above the question text data of the media message pending label, so that the class teacher can give priority to processing the question text data of the pre-refund pending label.
[0095] In this embodiment, when accurate reply text data cannot be obtained, the processing priority of the question text data is determined according to the target intent category corresponding to the question text data and the corresponding intent to-do tag, and the question text data and the intent to-do tag are returned to the client for display according to the processing priority. This can help improve the interaction efficiency of the question text data and enable learners' needs to be responded to faster and more efficiently.
[0096] In an exemplary embodiment, the method for generating reply text data provided by the present application may also include: obtaining the currently generated multi-round conversation data under a preset business scenario; using multi-agent routing to determine the target business chain corresponding to the preset business scenario based on the multi-round conversation data, and the target business chain is used to guide the business processing operations that need to be performed during the generation of the reply text data.
[0097] Among them, the preset business scenarios can be used to represent complex scenarios involving multiple business chains, such as the need to query various data from the business system of an online education platform, and then use the target large model to generate reply text data based on the various data obtained from the query.
[0098] Multi-agent routing can be used to characterize the routing of multiple tool agents that access a business system, which are equipped with a processor chip to achieve self-decision-making functions.
[0099] The target business chain can be used to guide the business processing operations that need to be performed during the generation of the reply text data, and is formed by connecting multiple business nodes. The business nodes can be used to perform corresponding business processing operations.
[0100] For example, as the business becomes increasingly complex, the series connection of business chains required to realize the generation of reply text data becomes increasingly complex. The server can obtain the data of multiple rounds of conversations between the same student and the online education platform in the client under the preset business scenario. The server can make routing tool decisions based on the multiple rounds of conversation data through multi-agent routing to determine the target business chain corresponding to the preset business scenario. The corresponding business processing operation is performed according to the target business chain to generate reply text data.
[0101] For example, in a preset business scenario of inquiring about the logistics of express items, the multi-round dialogue data is sent to the multi-agent routing. The multi-agent routing makes a business chain decision based on whether the express items inquired by the student are already known in the current multi-round dialogue data. If the express item information is unknown, the agent of the tool "obtain the express items in the student's inquiry" can be executed to perform the business processing operation of "analyzing the express items inquired by the student from the historical messages of the multi-round dialogue data" or "obtaining the express items purchased by the student from the order system" through this tool "obtaining the express items in the student's inquiry". After obtaining the items inquired by the student, the subsequent "query express progress" and "reply to the student's express information according to the reply rules (that is, the operations of steps S202 to S208 above)" will be executed. If the student has been informed in the multi-round dialogue data that the express has been signed for, the multi-agent routing will directly skip the step of "query express progress" and inform the student that the express has been received.
[0102] Alternatively, in a preset business scenario of inquiring about the class time of the next class, the multi-round conversation data is sent to the multi-agent routing. The multi-agent routing determines whether the specific information of the course inquired by the student is already known in the current multi-round conversation data. If the student has already informed which specific class in the multi-round conversation data, the multi-agent routing can directly query the class schedule of the course inquired by the student based on the known course information, and generate subsequent reply text data based on the inquired class schedule (that is, the operations of steps S202 to S208 above). If the student does not inform which specific class, the multi-agent routing first needs to query what course the student will take next, and then query the class schedule of the course.
[0103] In this embodiment, by using multi-agent routing to independently decide on the business processing that needs to be performed in the current business scenario based on the data of multiple rounds of conversations that have currently occurred, developers no longer need to pay attention to the execution process. They only need to hand over the agent tools to the multi-agent routing management, which simplifies the business process of generating reply text data and avoids the troubles caused to developers by complex processes in preset business scenarios.
[0104] In an exemplary embodiment, Figure 5 As shown, the above step S204 may include the following steps S502 to S506. Among them:
[0105] Step S502, matching the question text data with preset intention keywords.
[0106] Step S504: when it is determined that there is no intended keyword corresponding to the question text data, the similarity between the question text data and the question vector data in the preset vector library is calculated.
[0107] Step S506, when the similarity is lower than the preset similarity threshold, the intention classification model is used to perform intention classification processing on the question text data to obtain the target intention category.
[0108] Among them, the question vector data can be converted according to question samples of known intent categories.
[0109] The intent classification large model can be used to represent the artificial intelligence model obtained by pre-training a large language model based on the intent classification algorithm.
[0110] Exemplarily, preset intent keywords corresponding to a variety of intent categories may be pre-stored in the server. Match the question text data with the preset intent keywords. When it is determined that there is no intent keyword corresponding to the current question text data, read the question vector data stored in the preset vector library. Convert the question text data into corresponding vector data. Use a similarity algorithm (such as a cosine similarity algorithm) to process the vector data of the question text data and the question vector data to obtain the similarity between the question text data and the question vector data in the preset vector library. When the similarity is lower than the preset similarity threshold, use the intent classification model to extract features from the question text data, and match the obtained feature extraction results with sample features under different intent categories to obtain the target intent category corresponding to the question text data.
[0111] In this embodiment, the target intent category is determined by respectively using keyword matching, vector matching, and artificial intelligence-based large model intent classification methods, which can improve the recognition success rate of the target intent category.
[0112] In an exemplary embodiment, Figure 6 As shown, a device for generating reply text data is also provided, comprising the following steps S602 to S616. Among them:
[0113] Step S602: Under a preset business scenario, multiple rounds of dialogue data and question text data are obtained.
[0114] Step S604: using multi-agent routing to determine a target business chain corresponding to a preset business scenario based on multi-round conversation data.
[0115] For example, the server can obtain multiple rounds of conversation data between the student and the class teacher or artificial intelligence, as well as the text data of the question currently asked by the student under a preset business scenario. Multi-agent routing is used to determine the business processing operations to be performed based on the multiple rounds of conversation data, thereby forming a target business chain corresponding to the current question text data.
[0116] Optionally, in some implementations, the multi-agent routing can detect and track the data processing status, data processing results, data processing records and other information of each business processing node in the target business chain to achieve full process control of the generation of reply text data. For example, when the data processing status of a link node detected by the multi-agent routing is the first state, it means that the current chain can continue to be executed and the question text data can be replied. When the data processing status is the second state, it means that the current business node can be skipped and the next business node can be directly entered.
[0117] Step S606, performing intent classification on the question text data to obtain the target intent category to which the question text data belongs.
[0118] Exemplarily, the server may obtain question text data. Preset keywords corresponding to each intent category are used to match the question text data. When it is determined that the intent keyword corresponding to the question text data does not exist, the similarity between the question text data and the question vector data in the pre-vector library is calculated. When the similarity is lower than a preset similarity threshold, the intent classification model is used to perform intent classification processing on the question text data to obtain the target intent category.
[0119] Optionally, in some embodiments, when it is determined that the question text data matches a regular expression of a preset keyword, the intent category corresponding to the preset keyword is used as the target intent category corresponding to the question text data. The preset reply content corresponding to the preset keyword is used as the reply text data corresponding to the question text data. When there are multiple preset reply contents corresponding to the preset keyword, one of the multiple preset reply contents can also be randomly selected as the reply text data currently output.
[0120] Optionally, in other embodiments, the server may also be configured with prohibited keywords corresponding to each intent category. When a prohibited keyword is hit in the question text data, the intent category corresponding to the prohibited keyword is deleted from the intent classification of the question text data. That is, the question text data will definitely not fall into the intent category.
[0121] Alternatively, in other embodiments, when it is determined that the similarity between the question text data and the question vector data is higher than a preset similarity threshold, the reply vector data corresponding to the most similar question vector data can be used to determine the reply text data corresponding to the question text data. The similarity between the question text data and the question vector data ranges from -1 to 1. When the value of the similarity is close to 1, it can be indicated that the directions of the vector data corresponding to the question text data and the question vector data are very similar, and almost point to the same direction. When the value of the similarity is 0, it indicates that the vector data corresponding to the question text data and the question vector data are orthogonal and lack a relationship. When the value of the similarity is close to -1, it indicates that the directions of the vector data corresponding to the question text data and the question vector data are almost completely opposite. The server can determine the similarity using the following formula:
[0122] ,
[0123] Among them, θ is the vector angle between the vector data corresponding to the question text data and the question vector data. A\B represent the vector data corresponding to the question text data and the question vector data respectively.
[0124] Optionally, in other implementations, the intent classification model can be used to perform a second intent judgment based on the target intent category obtained after the question text data has been classified once, so as to refine the intent classification and make the target intent category more accurate.
[0125] Optionally, in some implementations, the preset vector library may be obtained by vectorizing a historical message corpus corresponding to the target intent category.
[0126] Step S608, based on the pre-configured multiple large language models corresponding to the target intent category and the model priority of each large language model, a target large model whose model priority meets the preset conditions is selected from the multiple large language models.
[0127] Step S610, generating model input data according to a pre-configured reply prompt template corresponding to the target large model and question text data, inputting the model input data into the target large model, and obtaining reply text data corresponding to the question text data.
[0128] Exemplarily, a large model proxy (LLM PROXY) may be deployed in the server. The large model proxy may store intent configuration information corresponding to each intent category. The intent configuration information may store a plurality of large language models corresponding to the intent category, the model priority of each large language model, and a prompt template corresponding to each large language model. The large model proxy is used to select the large language model with the highest model priority from the intent configuration information as the target large model. Model input data is generated and input according to the reply prompt template corresponding to the target large model and the question text data, and the reply text data corresponding to the question text data output by the target large model is obtained.
[0129] Step S612, intercepting the reply text data, and matching the reply text data with the question and answer vector data stored in the preset vector library to obtain the answer score of the reply text data.
[0130] For example, after acquiring the reply text data, the server may match the reply text data with the question-answer vector data stored in the preset vector library to obtain the similarity between the reply text data and the question-answer vector data, and determine the answer score of the reply text data according to the similarity.
[0131] Optionally, in some embodiments, when the answer score is greater than a preset score threshold, the reply text data may be verified twice using artificial intelligence detection rules. If the reply text data passes the artificial intelligence verification, the reply text data is output again to improve the quality and accuracy of the reply text data and prevent certain replies that do not meet the standards or are overdue from being output.
[0132] Step S614, when the answer score is lower than the preset score threshold, a failure detection reason corresponding to the reply text data is generated.
[0133] Step S616, updating the model input data according to the reason for failing the detection, and inputting the updated model input data into the target large model to obtain new reply text data corresponding to the question text data.
[0134] Exemplarily, when the answer score of the reply text data is lower than the preset score threshold, the server can generate a failure detection reason corresponding to the reply text data based on the matched question-answer vector data. The model input data is updated according to the failure detection reason, and the updated model input data is input into the target large model to obtain new reply text data corresponding to the question text data, so as to ensure that the newly generated reply text data meets the reply conditions and improve the reply rate.
[0135] Optionally, in some embodiments, when the same target large model repeatedly executes to generate new reply text data for a number of times exceeding a preset number threshold, and the target large model does not obtain reply text data higher than a preset score threshold, a next-level large language model can be selected according to the model priority as the new target large model to repeat the above operation to generate new reply text data.
[0136] Optionally, in some embodiments, when the reply text data fails the artificial intelligence verification, the model input data can be updated according to the artificial intelligence verification rules. The updated model input data is input into the target large model to obtain new reply text data corresponding to the question text data.
[0137] Optionally, in other embodiments, when all large language models have been traversed and reply text data with an answer score higher than a preset score threshold cannot be obtained, an intention to-do label corresponding to the question text data can be generated according to the target intention category corresponding to the question text data. The processing priority corresponding to the question text data is determined according to the intention to-do label. And the question text data is pushed to the class teacher for processing according to the processing priority.
[0138] In this embodiment, the problem text data is classified by the intent through keywords, preset vector library and intention classification big model based on artificial intelligence, and the target intention category corresponding to the problem text data is targeted to use the target big model and reply prompt template of the preset configuration model priority to meet the preset conditions to generate reply text data, and intercept the reply text data for compliance verification detection, which can improve the generation quality and accuracy of the reply text data and ensure that the reply text data is legal and compliant. By using the big model proxy disaster recovery system, when a certain target big model is not available, it can automatically switch to the next more suitable target big model for processing, and automatically switch to the reply prompt template corresponding to the target big model, so as to ensure the stability and efficiency of the generation of reply text data. The reply text data corresponding to the problem text data is automatically generated by the target big model, which can realize the automation, standardization and humanized answer to the common problems of the students, and reduce the workload of the head teacher. At the same time, due to the generation method of the reply text data provided in this embodiment, the target big model based on artificial intelligence is used for data processing, which can handle more professional and more difficult problems, thereby reducing the high standard requirements for the professional knowledge level of the head teacher. In addition, when reply text data cannot be generated, by adding an intention to-do tag to the question text data and displaying the question text data according to the processing priority corresponding to the intention to-do tag, the efficiency of problem handling can be improved.
[0139] It should be understood that, although the steps in the flowcharts involved in the above 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 description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may 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.
[0140] Based on the same inventive concept, the embodiment of the present application also provides a device for generating reply text data for implementing the above-mentioned method for generating reply text data. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in the embodiments of one or more devices for generating reply text data provided below can refer to the limitations of the method for generating reply text data above, and will not be repeated here.
[0141] In an exemplary embodiment, Figure 7 As shown, a device 700 for generating reply text data is provided, comprising: a question acquisition module 702, an intention classification module 704, a configuration acquisition module 706 and a reply generation module 708, wherein:
[0142] The question acquisition module 702 is used to acquire question text data.
[0143] The intention classification module 704 is used to perform intention classification on the question text data to obtain the target intention category to which the question text data belongs.
[0144] The configuration acquisition module 706 is used to select a target large model whose model priority meets preset conditions from multiple large language models according to the pre-configured multiple large language models corresponding to the target intent category and the model priority of each large language model.
[0145] The reply generation module 708 is used to generate model input data according to the pre-configured reply prompt template corresponding to the target large model and the question text data, input the model input data into the target large model, and obtain the reply text data corresponding to the question text data.
[0146] In an exemplary embodiment, the reply text data generating device 700 further includes: an interception verification module, which is used to intercept the reply text data and match the reply text data with the question and answer vector data stored in the preset vector library to obtain the answer score of the reply text data; when the answer score is lower than the preset score threshold, generate a failure detection reason corresponding to the reply text data;
[0147] The model input data is updated according to the reason for failure of the test; the updated model input data is input into the target large model to obtain new response text data corresponding to the question text data.
[0148] In an exemplary embodiment, the reply text data generating device 700 also includes: a model replacement module, which is used to select a new target large model according to the model priority when the number of times the target large model repeatedly generates new reply text data reaches a preset number threshold, and the answer score of the new reply text data is lower than the preset score threshold; generate new model input data according to a new reply prompt template and question text data corresponding to the new target large model, input the new model input data into the new target large model, and obtain new reply text data corresponding to the question text data.
[0149] In an exemplary embodiment, the reply text data generating device 700 also includes: a priority labeling module, which is used to generate an intent to-do label corresponding to the question text data according to the target intent category when the answer scores of the reply text data of the target large model obtained after traversing each large language model are lower than a preset score threshold; determine the processing priority corresponding to the question text data according to the intent to-do label; and return the question text data and the intent to-do label to the client for display according to the processing priority.
[0150] In an exemplary embodiment, the reply text data generation device 700 also includes: a business chain determination module, which is used to obtain the multi-round dialogue data currently generated under a preset business scenario; use multi-agent routing to determine the target business chain corresponding to the preset business scenario based on the multi-round dialogue data, and the target business chain is used to guide the business processing operations that need to be performed during the reply text data generation process.
[0151] In an exemplary embodiment, the intent classification module 704 is also used to match the question text data with preset intent keywords; when it is determined that there are no intent keywords corresponding to the question text data, the similarity between the question text data and the question vector data in the preset vector library is calculated; when the similarity is lower than the preset similarity threshold, the intent classification model is used to perform intent classification processing on the question text data to obtain the target intent category.
[0152] Each module in the above-mentioned reply text data generating device 700 can be implemented in whole or in part by software, hardware or a combination thereof. Each module 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 operations corresponding to each module.
[0153] 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 8 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 question text data, target intent categories, large language models and their model priorities, target large models, reply prompt templates, model input data, reply text data and other data. 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 method for generating reply text data is implemented.
[0154] Those skilled in the art will understand that Figure 8 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.
[0155] In an exemplary embodiment, a computer device is 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.
[0156] In an exemplary 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.
[0157] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0158] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method 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 the present application can include at least one of non-volatile memory 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), magnetic 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, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0159] 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 application.
[0160] 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 method for generating reply text data, characterized in that: The method comprises: Get question text data; Performing intent classification on the question text data to obtain a target intent category to which the question text data belongs; According to a plurality of pre-configured large language models corresponding to the target intent category and a model priority of each of the large language models, a target large model whose model priority meets a preset condition is selected from the plurality of large language models; Model input data is generated according to a pre-configured reply prompt template corresponding to the target large model and the question text data, and the model input data is input into the target large model to obtain reply text data corresponding to the question text data.
2. The method according to claim 1, characterized in that The method further comprises: Intercepting the reply text data, and matching the reply text data with the question-answer vector data stored in a preset vector library to obtain an answer score for the reply text data; When the answer score is lower than a preset score threshold, generating a failure detection reason corresponding to the reply text data; updating the model input data according to the reason for failure of the test; The updated model input data is input into the target large model to obtain new reply text data corresponding to the question text data.
3. The method according to claim 2, characterized in that The method further comprises: When the number of times the target large model repeatedly generates new reply text data reaches a preset number threshold, and the answer score of the new reply text data is lower than the preset score threshold, a new target large model is selected according to the model priority; New model input data is generated according to the new reply prompt template corresponding to the new target large model and the question text data, and the new model input data is input into the new target large model to obtain new reply text data corresponding to the question text data.
4. The method according to claim 3, characterized in that The method further comprises: When the answer scores of the reply text data of the target large model obtained after traversing each of the large language models are all lower than the preset score threshold, generating an intention to-do tag corresponding to the question text data according to the target intention category; Determine the processing priority corresponding to the question text data according to the intended to-do tag; The question text data and the intended to-do label are returned to the client for display according to the processing priority.
5. The method according to claim 1, characterized in that The method further comprises: Under the preset business scenario, obtain the multi-round conversation data currently generated; A target business chain corresponding to the preset business scenario is determined based on the multi-round dialogue data using multi-agent routing, and the target business chain is used to guide the business processing operations that need to be performed in the generation process of the reply text data.
6. The method according to any one of claims 1 to 5, characterized in that The performing intent classification on the question text data to obtain the target intent category to which the question text data belongs includes: Matching the question text data with preset intent keywords; When it is determined that there is no intention keyword corresponding to the question text data, calculating the similarity between the question text data and the question vector data in a preset vector library; When the similarity is lower than a preset similarity threshold, the intention classification model is used to perform intention classification processing on the question text data to obtain the target intention category.
7. A device for generating reply text data, characterized in that: The device comprises: A question acquisition module is used to obtain question text data; An intent classification module is used to classify the intent of the question text data to obtain a target intent category to which the question text data belongs; A configuration acquisition module is configured to select a target large model whose model priority meets a preset condition from a plurality of large language models that are pre-configured to correspond to the target intent category and a model priority of each of the large language models; A reply generation module is used to generate model input data according to a pre-configured reply prompt template corresponding to the target large model and the question text data, input the model input data into the target large model, and obtain reply text data corresponding to the question text data.
8. 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 6 are implemented.
9. 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 6 are implemented.
10. A computer program product, comprising a computer program, 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 6 are implemented.
Citation Information
Cited By
system
JP2026155549A