Automatic reply method and device, electronic equipment, storage medium and program product

By combining the dialogue context and associated information to generate prompt information, the problems of low reply efficiency and inaccurate answers in the prior art are solved, and a more efficient and intelligent automatic reply system is realized.

CN119938848APending Publication Date: 2025-05-06BEIJING YOUZHUJU NETWORK TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202510031328.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-08
Publication Date
2025-05-06

Smart Images

  • Figure CN119938848A_ABST
    Figure CN119938848A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic reply method and device, electronic equipment, a storage medium and a program product, and relates to the field of data processing technologies, artificial intelligence technologies, large model technologies and large language models.The method comprises the steps that a first question aiming at a target object and a first historical question and answer pair of a current conversation are obtained, the first historical question and answer pair comprises a historical question aiming at the target object and an automatically generated historical reply; performing information retrieval based on the first question to obtain associated information of the target object; generating prompt information for a target language model based on the first question, the first historical question and answer pair and associated information; and processing the prompt information by utilizing the target language model to obtain a reply of the first question. According to the method, the accurate reply can be automatically given for the first question, and the reply efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the fields of data processing technology, artificial intelligence technology, large model technology, and large language model, and specifically to automatic reply methods, devices, electronic devices, storage media, and program products. Background Art

[0002] In application scenarios involving question-and-answer, users generally ask questions and want to get corresponding replies. For example, users want to inquire about the properties or usage of an item. In this scenario, timely replies are required. If manual replies are used, the efficiency of the replies will be low. Summary of the invention

[0003] In view of this, the present disclosure provides an automatic reply method, device, electronic device, storage medium and program product to solve the problem of low reply efficiency.

[0004] In a first aspect, the present disclosure provides an automatic reply method, the method comprising:

[0005] Obtaining a first question for a target object and a first historical question-answer pair of a current conversation, wherein the first historical question-answer pair includes a historical question for the target object and an automatically generated historical reply;

[0006] Perform information retrieval based on the first question to obtain related information of the target object;

[0007] Based on the first question, the first historical question-answer pair, and the associated information, generating prompt information for a target language model;

[0008] The prompt information is processed using the target language model to obtain a response to the first question.

[0009] In a second aspect, the present disclosure provides an automatic reply device, the device comprising:

[0010] An acquisition module, configured to acquire a first question for a target object and a first historical question-answer pair of a current conversation, wherein the first historical question-answer pair includes a historical question for the target object and an automatically generated historical reply;

[0011] A retrieval module, used to perform information retrieval based on the first question to obtain related information of the target object;

[0012] A generation module, configured to generate prompt information for a target language model based on the first question, the first historical question-answer pair, and associated information;

[0013] A processing module is used to process the prompt information using the target language model to obtain a response to the first question.

[0014] In a third aspect, the present disclosure provides an electronic device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the automatic reply method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0015] In a fourth aspect, the present disclosure provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the automatic reply method of the first aspect or any corresponding embodiment thereof.

[0016] In a fifth aspect, the present disclosure provides a computer program product, including computer instructions, which are used to enable a computer to execute the automatic reply method of the above-mentioned first aspect or any corresponding embodiment thereof.

[0017] The automatic reply method provided by the disclosed embodiment obtains a first question for a target object and a first historical question-answer pair of a current conversation, wherein the first historical question-answer pair includes historical questions for the target object and automatically generated historical replies, that is, not only the latest first question but also the context information of the first question is obtained; information retrieval is performed based on the first question to obtain related information of the target object; prompt information for a target language model is generated based on the first question, the first historical question-answer pair and the related information; and the prompt information is processed using the target language model to obtain a reply to the first question. In this method, the prompt information of the target language model is generated by combining the first question and its context information, as well as the rich related information, thereby ensuring that the prompt information includes rich content about the first question, so that the target language model can give an accurate reply, that is, the method can automatically give an accurate reply to the first question, thereby improving the reply efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 is a schematic diagram of an optional application scenario according to an embodiment of the present disclosure;

[0020] Figure 2is a flowchart of an automatic reply method according to an embodiment of the present disclosure;

[0021] Figure 3 is a flowchart of another automatic reply method according to an embodiment of the present disclosure;

[0022] Figure 4 is a schematic diagram of first prompt information according to an embodiment of the present disclosure;

[0023] Figure 5 is a schematic diagram of second prompt information according to an embodiment of the present disclosure;

[0024] Figure 6 is a schematic diagram of the system architecture of automatic reply according to an embodiment of the present disclosure;

[0025] Figure 7 is a schematic diagram of an answer instruction according to an embodiment of the present disclosure;

[0026] Figure 8 is a schematic diagram of a thought chain instruction according to an embodiment of the present disclosure;

[0027] Fig. 9 is a schematic diagram of a session instruction according to an embodiment of the present disclosure;

[0028] Fig.10 is a flowchart of another automatic reply method according to an embodiment of the present disclosure;

[0029] Fig.11 is a structural block diagram of an automatic reply device according to an embodiment of the present disclosure;

[0030] Fig.12 It is a schematic diagram of the hardware structure of the electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0032] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0033] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0034] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0035] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0036] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.

[0037] In related technologies, there are also solutions that use automatic replies, which are generally single-round interactive solutions based on question retrieval, that is, matching answers to highly relevant questions from historical conversations and related knowledge bases to perform automatic replies. However, this solution may suffer from context loss, low answer accuracy, and difficulty in handling complex questions.

[0038] Specifically, since the single-round interaction scheme cannot effectively understand and utilize the contextual information of the conversation, each response is isolated from a single question. This scheme is difficult to conduct multiple rounds of conversations and is difficult to handle information that needs to be continuously understood and tracked, resulting in the automatic response giving answers that are not accurate and appropriate.

[0039] In addition, retrieval-based reply solutions rely on existing answers from historical conversations and knowledge bases, and the quality and coverage of these answers directly affect the quality of the system's responses. When information is updated quickly and the knowledge base is incomplete, it is easy to provide outdated or incomplete answers, making it difficult to meet timely needs.

[0040] Furthermore, a single search response cannot accurately handle complex and multi-layered questions, especially when they require reasoning and comprehensive analysis. This limitation makes it difficult for automatic response systems to provide accurate answers when faced with complex questions.

[0041] Based on this, the disclosed embodiment provides an automatic reply method, which not only obtains the latest first question, but also obtains the context information of the first question, and generates prompt information of the target language model by combining the first question and its context information, as well as rich associated information, so that the target language model can generate accurate replies based on the rich prompt content. This method can better understand and respond to user needs, achieve more fluent and coherent multi-round dialogues, and make the automatic reply system more intelligent and efficient.

[0042] Figure 1 A schematic diagram of an optional application scenario of an embodiment of the present disclosure is shown, in which a user interacts with an automatic reply object through a terminal 100, and the automatic reply object may be an agent obtained based on a language model deployed on a server 200. The terminal 100 uses an agent to automatically reply to questions given by the user through a communication connection with the server 200, thereby realizing multiple rounds of dialogue with the user. The application scenarios involved in this application may be inquiry scenarios, customer service scenarios, etc., and no limitation is made here to the application scenarios, and they may be set according to actual needs.

[0043] According to an embodiment of the present disclosure, an automatic reply method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0044] In this embodiment, an automatic reply method is provided, which can be used in the above-mentioned electronic device, such as a server, Figure 2 is a flow chart of an automatic reply method according to an embodiment of the present disclosure. Figure 2 As shown, the process includes the following steps:

[0045] Step S201, obtaining a first question for a target object and a first historical question-answer pair of a current conversation.

[0046] Among them, the first historical question and answer pair includes historical questions for the target object and automatically generated historical replies.

[0047] The target object may be the object currently being consulted, for example, an item, a route, etc., and the specific form is not limited here.

[0048] The first question for the target object refers to the question asked by the user in the current conversation, which is the latest question. For example, in the current conversation scenario, the user asks question 1, and the automatic reply gives reply 1; for question 2, the automatic reply gives reply 2; ...; the current question n asked by the user is waiting for the automatic reply, and the current question n can be called the first question.

[0049] The current conversation refers to the conversation formed for the target object, and the first historical question and answer pair of the current conversation refers to the historical questions and automatically generated historical replies for the target object. Continuing with the above example, the user and the automatic reply object have had (n-1) rounds of conversations. Questions 1 to n-1 can be called historical questions, and replies 1 to n-1 can be called historical replies. Among them, all question and answer pairs involved in the (n-1) rounds of conversations can be called the first historical question and answer pairs, and the question and answer pairs involved in the most recent m rounds of conversations can also be called the first historical question and answer pairs. Among them, the specific value of m is set according to actual needs, and there is no limitation on it here.

[0050] Step S202: perform information retrieval based on the first question to obtain relevant information of the target object.

[0051] As described above, the first question is a question asked to the target object. Then, the first question can be used to search in other dialogue scenarios to obtain questions and replies related to the first question, which can be used as related information of the target object.

[0052] Alternatively, the first question can be used to search in the existing knowledge base to obtain some attribute information of the target object. If the target object is an item, the attribute information can be a detailed description of the item, feedback information of the item, etc.; if the target object is a route, the attribute information can be an introduction to the places involved in the route, detailed information of the places, etc.

[0053] Of course, the search scope for information retrieval based on the first question can be set according to actual needs and is not limited to the content described above, and no limitation is made here.

[0054] In addition, if it involves a search against a knowledge base, the content in the knowledge base can be updated according to a preset period of time to ensure the real-time and accuracy of the data in the knowledge base.

[0055] The information retrieval based on the first question can be performed directly using the first question. Since the first question is for the target object, the target object can also be used for retrieval; or the first question and the target object can be combined for retrieval. There is no limitation on the retrieval form here, and it can be set according to actual needs. Regardless of the retrieval scope and retrieval form, the results of the information retrieval are uniformly referred to as the associated information of the target object.

[0056] Step S203: Generate prompt information for the target language model based on the first question, the first historical question-answer pair, and the associated information.

[0057] The input of the target language model includes prompt information, and the output includes a response to the first question. Specifically, the prompt information is generated based on the first question, the first historical question and answer pair, and the associated information. The first question is the focus of this consultation, the first historical question and answer involves the contextual information of the first question, and the associated information involves information related to the first question and / or the target object. Therefore, combining these three to generate prompt information can ensure the richness of the prompt content.

[0058] There may be a corresponding prompt information template corresponding to the prompt information, and the prompt information template has some fixed description information and variables, wherein the description information includes but is not limited to indicating the role of the target language model, the things that the target language model needs to complete, and the principles to be followed in completing the things, etc.; the variables include the above three information, namely, the first question, the first historical question-answer pair, and the associated information. The prompt information of the target language model can be generated by filling these three information into the position where the variables are located in the prompt information template.

[0059] Step S204: Process the prompt information using the target language model to obtain a response to the first question.

[0060] The prompt information is input into the target language model to obtain a corresponding reply. The reply is referred to as the reply to the first question. The reply to the first question can be an answer given to the first question, or a non-reply determined by the target language model, etc. The form and content of the reply to the first question are not limited in any way.

[0061] The automatic reply method provided in this embodiment not only obtains the latest first question, but also obtains the context information of the first question, and generates prompt information of the target language model by combining the first question and its context information, as well as rich associated information, thereby ensuring that the prompt information includes rich content about the first question, so that the target language model can give an accurate reply. That is, the method can automatically give an accurate reply to the first question, thereby improving the reply efficiency.

[0062] In this embodiment, an automatic reply method is provided, which can be used in the above-mentioned electronic device, such as a server, Figure 3 is a flow chart of an automatic reply method according to an embodiment of the present disclosure. Figure 3 As shown, the process includes the following steps:

[0063] Step S301, obtaining a first question for a target object and a first historical question-answer pair of a current conversation.

[0064] The first historical question-answer pair includes historical questions for the target object and automatically generated historical responses. Figure 2 The description of step S201 of the illustrated embodiment will not be repeated here.

[0065] Step S302: perform information retrieval based on the first question to obtain relevant information of the target object. Figure 2 The description of step S202 of the illustrated embodiment will not be repeated here.

[0066] Step S303: Generate prompt information for the target language model based on the first question, the first historical question-answer pair, and the associated information.

[0067] The target language model includes a target rejection model and a target answer model. Accordingly, the prompt information includes first prompt information for the target rejection model and second prompt information for the target answer model. The target rejection model is used to determine whether the first question can be answered based on the first prompt information, and the target answer model is used to determine the answer to the first question based on the second prompt information.

[0068] Specifically, the first prompt information is input into the target rejection model to obtain a conclusion on whether the first question can be answered; the second prompt information is input into the target answer model to obtain the answer to the first question. The target rejection model and the target answer model can be processed in parallel without any influence between the two. The output results of the two models are fused in the post-processing stage to obtain the answer to the first question.

[0069] The hallucination problem refers to the output of fictitious, inaccurate or non-input text by natural language processing or generative models when generating text. This phenomenon is manifested in that the content generated by the model seems reasonable, but in fact is inconsistent with the facts or has no basis, which may lead to erroneous and misleading information. The method includes a target rejection model and a target answer model in the target language model, and determines whether to answer the first question through the target rejection model, thereby reducing the hallucination of the target language model and improving the accuracy of the response to the first question.

[0070] Specifically, the above step S303 includes:

[0071] Step S3031, integrating the first question, the first historical question-answer pair and the associated information with the first prompt template to obtain the first prompt information.

[0072] The first prompt template includes an analysis step for determining whether the first question can be answered.

[0073] The first prompt template corresponds to the target rejection model. The first prompt template includes some fixed content, that is, the analysis steps of whether the first question can be answered, which is used to guide the target rejection model to think and obtain accurate output. The first prompt template also includes some variables. The first question, the first historical question-answer pair and the associated information are associated with the corresponding variables in the first prompt template to obtain the first prompt information.

[0074] Of course, the first prompt template may also include other fixed contents, such as the role played by the given target rejection model and the principles followed in model processing, etc.

[0075] For example, Figure 4 As shown, the fixed content in the first prompt template includes the role description, some prompts, and the analysis steps to answer the question; the variables in the first prompt template include related information, historical question-answer pairs, and the first question. The analysis steps may include whether the question can be answered in combination with the related information, whether the question can be answered in combination with the first historical question-answer pair, whether the question can be answered by combining the related information and the first historical question-answer pair, and so on.

[0076] In addition, the output fields of the first prompt template include: whether the answer can be given, the source of the answer, and the reasoning process. Among them, the field contents corresponding to these three fields need to be determined by the target rejection model after analysis based on the first prompt information. Specifically, whether the answer can be given represents whether the target rejection model can answer the first question, the source of the answer represents the basis of the target rejection model in determining whether the answer can be given, and the reasoning process represents the analysis process of the target rejection model in determining whether the answer can be given.

[0077] Since the output field of the first prompt template includes information other than whether the answer can be given, the target rejection model can analyze the first prompt information in detail when analyzing and determining the source of the answer and the reasoning process, thereby affecting the output of the conclusion of whether the answer can be given, further improving the accuracy of the conclusion of whether the answer can be given.

[0078] Step S3032: merge the first question, the first historical question-answer pair, and the associated information with the second prompt template to obtain second prompt information.

[0079] The second prompt template corresponds to the target answer model, and includes some fixed contents, namely, role definition and prompt words. The second prompt template also includes some variables, and the first question, the first historical question-answer pair and the associated information are associated with the corresponding variables in the second prompt template to obtain the second prompt information.

[0080] Of course, the second prompt template may also include other fixed contents, such as principles followed in model processing, etc.

[0081] For example, Figure 5 As shown, the fixed content in the second prompt template includes role description, some prompts, and principles to be followed in answering questions; the variables in the second prompt template include associated information, historical question and answer pairs, and the first question.

[0082] Step S304: Process the prompt information using the target language model to obtain a response to the first question.

[0083] Specifically, the above step S304 includes:

[0084] Step S3041: Process the first prompt information using the target rejection model to determine whether the first question can be answered.

[0085] Step S3042: Use the target answer model to process the second prompt information to determine the answer to the first question.

[0086] The first prompt information is input into the target rejection model to obtain a conclusion on whether the first question can be answered; the second prompt information is input into the target answering model to obtain the answer to the first question.

[0087] Step S3043: If it is determined that the first question can be answered, then it is determined that the reply to the first question includes the answer to the first question.

[0088] Step S3044: If it is determined that the first question cannot be answered, then determining that the response to the first question includes no answer.

[0089] The outputs of the target rejection model and the target answer model are fused and analyzed to determine whether the output of the target rejection model indicates that the first question can be answered. If the first question cannot be answered, the response to the first question is directly determined to include no answer, for example, the output may be: no answer. If the first question can be answered, the output of the target answer model is used as the response to the first question, for example, the output may be: the output result of the target answer model.

[0090] For example, Figure 6The schematic diagram of the system architecture of automatic reply is shown. For the first question, the first historical question-answer pair and related information are obtained, and the first prompt information and the second prompt information are obtained by combining the prompt templates corresponding to the target rejection model and the target answer model. Then the first prompt information is input into the target rejection model, and the second prompt information is input into the target answer model to obtain the corresponding output results. It is judged whether the output of the target rejection model is an answer. If it represents a non-answer, it can be output: no answer; if it represents an answer, the output of the target answer model can be output as a reply to the first question.

[0091] The automatic reply method provided in this embodiment has corresponding prompt templates for the target rejection model and the target answer model, and generates corresponding prompt information in combination with the prompt template, thereby improving the efficiency of prompt information generation. Furthermore, the first prompt template includes an analysis step for determining whether the first question can be answered, which can guide the target rejection model to conduct detailed analysis and thinking, thereby improving the reliability of the output result of the target rejection model. When the target rejection model determines that it can answer the first question, the answer to the first question obtained by the target answer model based on the second prompt information is used as the reply to the first question. This method can reduce the illusion of the target answer model. When the target rejection model determines that it cannot answer the first question, the answer to the first question determined by the target answer model is ignored, and the reply to the first question is determined as no answer, so as to improve the accuracy of the automatic reply.

[0092] In some optional implementations, the target language model is obtained based on the following method:

[0093] Step a1, obtaining sample instructions of at least one instruction type, the sample instructions including a first sample instruction for an initial rejection model and a second sample instruction for an initial answer model, and the instruction types include answer instructions, thought chain instructions and conversation instructions.

[0094] Step a2, using sample instructions of at least one instruction type, respectively adjusting the parameters of the initial rejection model and the initial answer model to obtain a target rejection model and a target answer model.

[0095] As described above, the target language model includes a target rejection model and a target answer model, and these two models are obtained by fine-tuning them separately. For example, before fine-tuning, the pre-trained initial rejection model and initial answer model are obtained, and the initial rejection model and the initial answer model are fine-tuned using sample instructions, that is, the parameters of the two models are adjusted, and finally the target rejection model and the target answer model are determined.

[0096] Among them, the sample instructions used to fine-tune the initial rejection model and the initial answer model can be at least one type of instruction, including but not limited to answer instructions, thought chain instructions and conversation instructions. There are corresponding standard answers for answer instructions and thought chain instructions, so as to facilitate fine-tuning of the model. For example, when constructing a thought chain instruction, the corresponding standard answer can be marked based on the rejection judgment standard. The rejection judgment standard includes: historical question and answer pairs can find answers, so they can be rejected; historical answers include correct answers and wrong answers, so they can be rejected; for detail questions, candidate questions can be answered, so they can be rejected; remarks and other manual operations are directly rejected.

[0097] Specifically, answer instructions are used to instruct the model to give answers to corresponding questions, that is, to define task objectives and model inputs, and guide the model to generate correct answers, one question and one answer.

[0098] For example, Figure 7 An example of a question-and-answer instruction is shown in Figure 1. Figure 7 In the above, the historical question-answer pairs may represent non-automatic question-answer pairs, that is, historical question-answer pairs are obtained by manually answering questions raised by users. The initial answer model or initial rejection model is fine-tuned through question-answer instructions so that it can master a variety of answer strategies.

[0099] Thought chaining instructions are used to implement thought chaining tasks and help the model alleviate the hallucination problem. For example, Figure 8 An example of a thought instruction is shown in Figure 8 In the algorithm, historical question-answer pairs are given and the initial answer model or the initial rejection model is fine-tuned to master a rich set of answer strategies.

[0100] Dialogue instructions, i.e., multiple non-automatic reply dialogue contents, are used to understand the dialogue style and corresponding common sense. Fig. 9 An example of a dialog instruction is shown in FIG. Fig. 9 In the process, multiple rounds of question-answer pairs are given to the model so that the model can master the corresponding reply strategy.

[0101] The parameters of the initial rejection model and the initial answer model are adjusted using sample instructions of at least one instruction type. Since different instruction types can instruct the model to learn different content, the accuracy of the obtained target rejection model and target answer model is further improved.

[0102] In this embodiment, an automatic reply method is provided, which can be used in the above-mentioned electronic device, such as a server, Fig.10 is a flow chart of an automatic reply method according to an embodiment of the present disclosure. Fig.10 As shown, the process includes the following steps:

[0103] Step S1001, obtaining a first question for a target object and a first historical question-answer pair of a current conversation.

[0104] The first historical question-answer pair includes historical questions for the target object and automatically generated historical responses. Figure 2 The description of step S201 of the illustrated embodiment will not be repeated here.

[0105] Step S1002: perform information retrieval based on the first question to obtain relevant information of the target object.

[0106] Specifically, the above step S1002 includes:

[0107] Step S10021: Use the first question to search among the objects to which the target object belongs to obtain first attribute information of the target object.

[0108] The belonging object of the target object represents the owner of the target object, for example, the owner of the item, the merchant corresponding to the product, etc. When describing the target object, the belonging object will provide corresponding description information. Based on this, the first question is used to search in the belonging object, and further, the description information provided by the belonging object is searched to obtain the first attribute information of the target object.

[0109] Step S10022: Use the first question to search the detailed information of the target object to obtain second attribute information of the target object.

[0110] The associated information includes first attribute information and second attribute information.

[0111] The detailed information of the target object represents the detailed description of the target object. Corresponding to the above-mentioned belonging object, the description information given by the belonging object may be some brief descriptions, while here it is the detailed information of the target object. For example, for a certain product, the product details page of the product can be analyzed to obtain the second attribute information of the product, including but not limited to the material, production date, shelf life, etc., which can be determined according to the type of the target object.

[0112] Furthermore, the detailed information may also query the upstream and downstream information about the target object, for example, the production information of the target object, the feedback information corresponding to the target object, etc., which are not limited here.

[0113] The obtained first attribute information and second attribute information are used as association information of the target object to fill in the corresponding prompt template.

[0114] Step S10023, using the first question to query in the associated data storage space, to determine the second historical question-answer pair corresponding to the associated object of the target object.

[0115] The second historical question-answer pair includes historical questions for the associated object and non-automatically generated historical replies, the associated data storage space is updated based on a preset period, and the associated information includes the second historical question-answer pair.

[0116] For the target object, the associated objects can be analyzed from the business or performance perspective, etc. For example, from product 1, its associated product 2 can be analyzed, and then information query can be performed from the historical question and answer pairs of product 2 to obtain the second historical question and answer pair.

[0117] The second historical question-answer pair is obtained based on non-automatically generated historical replies, that is, historical replies manually given to historical questions of the associated object. The historical questions and historical replies of the associated object are stored in an associated data storage space, and the associated data storage space is updated according to a preset period. Specifically, the associated data storage space is used to store historical question-answer pairs, and all historical question-answer pairs can be stored in the same associated data storage space, or they can be stored based on the association between objects, and so on. Among them, the preset period can be 1S, 10S or 1 hour, etc., and there is no limitation on the specific value.

[0118] After obtaining the first question, the first question may be used to query in the associated data storage space, and the first m historical question-answer pairs with the highest similarity are used as the second historical question-answer pairs corresponding to the associated object.

[0119] Step S1003: Generate prompt information for the target language model based on the first question, the first historical question-answer pair, and the associated information. Figure 3 The description of step S303 of the illustrated embodiment will not be repeated here.

[0120] Step S1004: Use the target language model to process the prompt information to obtain a response to the first question. Figure 3 The description of step S304 of the illustrated embodiment will not be repeated here.

[0121] The automatic reply method provided in this embodiment retrieves the attribute information of the target object from different channels, and can obtain rich attribute information about the target object. The associated information also includes a second historical question-and-answer pair corresponding to the associated object of the target object, and the second historical question-and-answer pair includes non-automatically generated replies, so that the subsequent target language model can learn the content of the non-automatically generated replies. Furthermore, the associated data storage space is updated according to a preset period, which can ensure the real-time nature of the data in the associated data storage space. In addition, this method is a method that combines information retrieval and generation models, that is, extracting relevant information from different channels, and then inputting the retrieved information into the generation model to generate more accurate and relevant answers.

[0122] As a specific application embodiment of the disclosed embodiment, in a commodity consultation scenario, the user interacts with a commodity consultation application through a mobile phone and enters a dialogue window. The user gives a question about commodity A, and the agent in the dialogue window gives a reply to the question. Specifically, the mobile phone is connected to the server where the agent is deployed, and the given question about commodity A is obtained by the server. The server determines the reply to the question by executing the automatic reply method described in the embodiment of the present application, and feeds the reply back to the dialogue window for display. Based on this, the user can communicate with the agent through the commodity consultation application of the mobile phone and the server to achieve automatic reply to the question.

[0123] This method introduces the conversation context and combines the understanding and generation capabilities of the large model to improve the accuracy of the agent's automatic reply. In addition, it also integrates the answer sources from multiple channels to improve the coverage of the agent's automatic reply messages.

[0124] In this embodiment, an automatic reply device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0125] This embodiment provides an automatic reply device, such as Fig.11 As shown, including:

[0126] The acquisition module 1101 is used to acquire a first question for the target object and a first historical question-answer pair of the current conversation, wherein the first historical question-answer pair includes a historical question for the target object and an automatically generated historical reply.

[0127] The retrieval module 1102 is used to perform information retrieval based on the first question to obtain related information of the target object.

[0128] The generation module 1103 is used to generate prompt information for the target language model based on the first question, the first historical question-answer pair and the associated information.

[0129] The processing module 1104 is used to process the prompt information using the target language model to obtain a response to the first question.

[0130] In some optional embodiments, the target language model includes a target rejection model and a target answer model; the prompt information includes first prompt information for the target rejection model and second prompt information for the target answer model; the target rejection model is used to determine whether the first question can be answered based on the first prompt information, and the target answer model is used to determine the answer to the first question based on the second prompt information.

[0131] In some optional implementations, the processing module 1104 includes:

[0132] The first processing unit is used to process the first prompt information by using a target rejection model to determine whether the first question can be answered.

[0133] The second processing unit is used to process the second prompt information using the target answer model to determine the answer to the first question.

[0134] The first determining unit is configured to determine that the response to the first question includes an answer to the first question if it is determined that the first question can be answered.

[0135] In some optional implementations, the processing module 1104 further includes:

[0136] The second determining unit is configured to determine that the answer to the first question includes no answer if it is determined that the first question cannot be answered.

[0137] In some optional implementations, the generating module 1103 includes:

[0138] The first prompt generating unit is used to merge the first question, the first historical question-answer pair and the associated information with the first prompt template to obtain the first prompt information. The first prompt template includes an analysis step for determining whether the first question can be answered.

[0139] The second prompt generating unit is used to fuse the first question, the first historical question-answer pair and the associated information with the second prompt template to obtain the second prompt information.

[0140] In some optional implementations, the output fields of the first prompt template include: whether the answer is possible, the source of the answer, and the reasoning process.

[0141] In some optional implementations, the target language model is obtained based on the following method:

[0142] Sample instructions of at least one instruction type are obtained, the sample instructions include a first sample instruction for an initial rejection model and a second sample instruction for an initial answer model, and the instruction types include answer instructions, thought chain instructions, and conversation instructions.

[0143] Parameters of the initial rejection model and the initial answer model are adjusted using sample instructions of at least one instruction type to obtain a target rejection model and a target answer model.

[0144] In some optional implementations, the retrieval module 1102 includes:

[0145] The first retrieval unit is used to search the objects to which the target object belongs by using the first question to obtain the first attribute information of the target object.

[0146] The second retrieval unit is used to search the detailed information of the target object by using the first question to obtain the second attribute information of the target object, where the associated information includes the first attribute information and the second attribute information.

[0147] In some optional implementations, the retrieval module 1102 further includes:

[0148] The third retrieval unit is used to use the first question to query in the associated data storage space to determine the second historical question and answer pair corresponding to the associated object of the target object, the second historical question and answer pair includes historical questions for the associated object and non-automatically generated historical replies, the associated data storage space is updated based on a preset period, and the associated information includes the second historical question and answer pair.

[0149] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0150] The automatic reply device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0151] The present disclosure also provides an electronic device having the above Fig.11 The automatic reply device shown.

[0152] See also Fig.12 , Fig.12 is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present disclosure, such as Fig.12As shown, the electronic device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.12 A processor 10 is taken as an example.

[0153] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0154] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0155] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0156] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0157] The electronic device further comprises a communication interface 30 for the electronic device to communicate with other devices or a communication network.

[0158] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0159] A part of the present disclosure may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present disclosure through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.

[0160] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. An automatic reply method, characterized in that: The method comprises: Obtaining a first question for a target object and a first historical question-answer pair of a current conversation, wherein the first historical question-answer pair includes a historical question for the target object and an automatically generated historical reply; Perform information retrieval based on the first question to obtain related information of the target object; Based on the first question, the first historical question-answer pair, and the associated information, generating prompt information for a target language model; The prompt information is processed using the target language model to obtain a response to the first question.

2. The method according to claim 1, characterized in that The target language model includes a target rejection model and a target answer model; The prompt information includes first prompt information for the target rejection model and second prompt information for the target answer model; The target rejection model is used to determine whether the first question can be answered based on the first prompt information, and the target answer model is used to determine the answer to the first question based on the second prompt information.

3. The method according to claim 2, characterized in that The using the target language model to process the prompt information to obtain a response to the first question includes: Processing the first prompt information using the target rejection model to determine whether the first question can be answered; Processing the second prompt information using the target answer model to determine an answer to the first question; If it is determined that the first question can be answered, then it is determined that the response to the first question includes the answer to the first question.

4. The method according to claim 3, characterized in that The using the target language model to process the prompt information to obtain a response to the first question also includes: If it is determined that the first question cannot be answered, then determining that the response to the first question includes not answering.

5. The method according to claim 2, characterized in that: The generating prompt information for the target language model based on the first question, the first historical question-answer pair, and the associated information includes: The first question, the first historical question-answer pair, and the associated information are integrated with a first prompt template to obtain the first prompt information, wherein the first prompt template includes an analysis step for determining whether the first question can be answered; The first question, the first historical question-answer pair, and the associated information are integrated with a second prompt template to obtain the second prompt information.

6. The method according to claim 2, characterized in that The output fields of the first prompt template include: whether the answer can be given, the source of the answer, and the reasoning process.

7. The method according to claim 2, characterized in that: The target language model is obtained based on the following method: Acquire sample instructions of at least one instruction type, the sample instructions comprising a first sample instruction for an initial rejection model and a second sample instruction for an initial answer model, the instruction types comprising an answer instruction, a thought chain instruction, and a conversation instruction; The sample instructions of the at least one instruction type are used to adjust the parameters of the initial rejection model and the initial answer model respectively to obtain the target rejection model and the target answer model.

8. The method according to claim 1, characterized in that The performing information retrieval based on the first question to obtain the associated information of the target object includes: Using the first question, searching in the object to which the target object belongs, to obtain first attribute information of the target object; The first question is used to search the detailed information of the target object to obtain the second attribute information of the target object, and the associated information includes the first attribute information and the second attribute information.

9. The method according to claim 1, characterized in that: The performing information retrieval based on the first question to obtain the associated information of the target object also includes: The first question is used to query in the associated data storage space to determine a second historical question and answer pair corresponding to the associated object of the target object, the second historical question and answer pair including historical questions for the associated object and non-automatically generated historical replies, the associated data storage space is updated based on a preset period, and the associated information includes the second historical question and answer pair.

10. An automatic reply device, characterized in that: The device comprises: An acquisition module, configured to acquire a first question for a target object and a first historical question-answer pair of a current conversation, wherein the first historical question-answer pair includes a historical question for the target object and an automatically generated historical reply; A retrieval module, used to perform information retrieval based on the first question to obtain related information of the target object; A generation module, configured to generate prompt information for a target language model based on the first question, the first historical question-answer pair, and associated information; A processing module is used to process the prompt information using the target language model to obtain a response to the first question.

11. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the automatic reply method according to any one of claims 1 to 9 by executing the computer instructions.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the automatic reply method according to any one of claims 1 to 9.

13. A computer program product, characterized in that The invention comprises computer instructions, wherein the computer instructions are used to make a computer execute the automatic reply method according to any one of claims 1 to 9.

Citation Information

Cited By

  • Response method, model training method and related products

    CN120541178A

  • Dialogue method, virtual pet dialogue method, model training method and related products

    CN120542575A

  • Intelligent assistant question answering method and device based on large language model, equipment and medium

    CN120705270A