Question and answer method and device
By introducing multi-agent collaboration and large-model rewriting mechanisms into the intelligent medical Q&A system, the problem that existing systems are difficult to provide authoritative and multi-functional Q&A in complex medical scenarios is solved, and efficient and accurate medical consulting services are achieved.
Patent Information
- Application Number
- CN202411605017.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-11-11
AI Technical Summary
The existing intelligent medical Q&A system mainly relies on keyword matching, making it difficult to provide authoritative, accurate and multi-functional Q&A services, especially in complex medical scenarios, which are difficult to meet the multiple intentions and needs of users.
A question-and-answer method based on multi-agent collaboration is proposed. Through the division of labor between decision-making agents and task agents, combined with large models and rewriting mechanisms, a deep understanding of user problems and effective handling of multiple rounds of dialogue is achieved.
It realizes an authoritative, convenient and highly satisfying question-and-answer system, which can provide accurate and authoritative answers in intelligent medical scenarios, improve the efficiency and accuracy of health consultation, and provide users with more comprehensive intelligent health services.
Smart Images

Figure CN119557397A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to the field of natural language processing, deep learning and large language model technology. Background Art
[0002] The question-answering system is an advanced form of information retrieval system that can answer questions raised by users in natural language. When applied to medical scenarios, the intelligent medical question-answering system can understand the patient's main complaint, simulate the doctor's consultation ideas to help the patient systematically sort out the condition, output standardized pre-diagnosis reports, help doctors understand the patient more comprehensively, and improve consultation efficiency.
[0003] At present, the intelligent medical question-and-answer system is mainly based on keyword matching. Through a pre-set keyword list, the questions raised by the user are matched and the corresponding answers are given according to the keyword hits. This solution can be applied to simple drug information query or health science popularization, and has the characteristics of simple implementation and low cost. Summary of the invention
[0004] The embodiments of the present disclosure provide a question-answering method, apparatus, device, storage medium, and program product.
[0005] In the first aspect, the embodiments of the present disclosure propose a question-answering method, including: inputting a current question input by a user into a decision-making agent, and outputting a task agent chain; selecting a task agent corresponding to the task agent chain from a set of task agents; and executing the selected task agent in the order of the task agent chain to obtain an answer to the current question.
[0006] In the second aspect, an embodiment of the present disclosure proposes a question-answering device, including: a decision module, configured to input a current question input by a user into a decision agent, and output a task agent chain; a selection module, configured to select a task agent corresponding to the task agent chain from a set of task agents; and an execution module, configured to execute the selected task agent in the order of the task agent chain to obtain an answer to the current question.
[0007] In the third aspect, an embodiment of the present disclosure proposes an intelligent agent, including: an input module for receiving input information; a processing module for determining a target task based on the input information received by the input module, determining a first large model based on the target task, and obtaining output information by calling the first large model to execute the method described in the first aspect; and an output module for outputting the output information obtained by the processing module.
[0008] In a fourth aspect, an embodiment of the present disclosure proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the first aspect.
[0009] In a fifth aspect, an embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, where the computer instructions are used to cause a computer to execute the method described in the first aspect.
[0010] In a sixth aspect, an embodiment of the present disclosure proposes a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.
[0011] The key or important features of the embodiments of the present disclosure are not intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Other features, purposes and advantages of the present disclosure will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings. The drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure. Among them:
[0013] Figure 1 is a flow chart of an embodiment of a question-answering method according to the present disclosure;
[0014] Figure 2 is a flow chart of another embodiment of the question-answering method according to the present disclosure;
[0015] Figure 3 is a flow chart of another embodiment of the question-answering method according to the present disclosure;
[0016] Figure 4 is an architectural diagram for implementing the question-answering method of the embodiment of the present disclosure;
[0017] Figure 5 is a structural schematic diagram of an embodiment of a question-answering device according to the present disclosure;
[0018] Figure 6 The block diagram of an electronic device used to implement the question-answering method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0019] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0020] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0021] Figure 1 A process 100 of an embodiment of a question-answering method according to the present disclosure is shown. The question-answering method comprises the following steps:
[0022] Step 101, input the current question input by the user into the decision agent, and output the task agent chain.
[0023] In this embodiment, the execution subject of the question-answering method can input the current question input by the user into the decision-making agent and output the task agent chain.
[0024] The execution subject of the question-and-answer method is usually a server. The server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules (for example, used to provide distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0025] Usually, a question-and-answer application or a browser is installed on the user's terminal. The user can input questions through the question-and-answer application or the question-and-answer webpage in the browser. After receiving the current question input by the user, the current question can be input into the decision agent, and a task agent chain is output. Among them, the decision agent can be composed of one or more models for understanding the questions input by the user and distributing tasks. The task agent chain may include the task agents required to answer the questions input by the user, and the execution order between the task agents. The task agent set may include multiple different task agents for performing different tasks. When applied to an intelligent medical question-and-answer system, the task agent set may include but is not limited to: medical science knowledge answers, report interpretation, skin disease detection, medical question questions, medical question questions, etc. Task agents. The task agent chain may include but is not limited to at least one of the following connection forms: parallel connection of task agents, serial connection of task agents, and serial-parallel combination connection of task agents, etc.
[0026] In some embodiments, the information of the decision agent and the task agent set is stored in the environment variable for sharing information between the decision agent and the task agent set. Among them, the information of the decision agent can be the result of understanding the question input by the user. When applied to the intelligent medical question-answering system, the information of the decision agent can include but is not limited to: historical summary, key medical entities, user medical intentions, etc. The information of the task agent set can be historical dialogue information, that is, the questions input by the user and the answers to the questions obtained by the task agent. In order to facilitate query, the information in the environment variable can be stored in the form of key-value pairs (kv, key-value).
[0027] Step 102, selecting a task agent corresponding to the task agent chain from the task agent set.
[0028] In this embodiment, the execution subject can select the task agent corresponding to the task agent chain from the task agent set. When applied to the intelligent medical question-answering system, the task agent set may include but is not limited to: medical science knowledge answering, report interpretation, skin disease detection, medical question follow-up, medical question counter-questioning and other task agents.
[0029] Step 103, execute the selected task agent in the order of the task agent chain to obtain an answer to the current question.
[0030] In this embodiment, the execution subject can execute the selected task agent in the order of the task agent chain to obtain the answer to the current question. The execution order indicated by the task agent chain may include but is not limited to: parallel execution of task agents, serial execution of task agents, and combined execution of task agents in parallel and serial.
[0031] The disclosed embodiment provides an authoritative, convenient, and highly satisfying question-answering method based on multi-agent collaboration. Accurate and authoritative questions and answers are provided through the collaboration of multiple agents with different functions and fields. The organic collaboration of multiple agents is achieved through information understanding, task distribution, memory transfer, etc., so as to obtain an answer with better effect and wider coverage. Through the division of labor between decision-making agents and task agents, the questions input by users are broken down into multiple categories and multiple steps for answering, thereby reducing the difficulty of the task and obtaining more authoritative and professional answers. In addition, by introducing environmental variables, information sharing among multiple agents is achieved.
[0032] Figure 2 A process 200 of another embodiment of the question-answering method according to the present disclosure is shown. The question-answering method comprises the following steps:
[0033] Step 201, in response to receiving the current question, obtaining the user's historical information from the environment variables.
[0034] In this embodiment, the execution subject of the question-answering method can obtain the user's historical information from the environment variable after receiving the current question input by the user.
[0035] The execution subject of the question-and-answer method is usually a server. The server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules (for example, used to provide distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0036] Usually, a question-and-answer application or a browser is installed on the user's terminal. The user can input questions through the question-and-answer application or the question-and-answer webpage in the browser. After receiving the current question input by the user, the user's historical information can be obtained from the environment variable. Among them, the historical information can be the user's historical questions. For example, the historical information can be the historical conversation information of this question and answer, and can be the historical search questions entered by the user on a third-party platform (such as a search application). The user's historical information can assist the first large model in identifying the intent of the current question entered by the user, thereby improving the accuracy of intent recognition.
[0037] In some embodiments, if the current question is the first question in this Q&A session, the historical search questions entered by the user on the third-party platform can be obtained. For Q&A sessions without historical dialogues, the user's historical information can also be tracked, thereby assisting the first model in intent recognition and improving the accuracy of intent recognition.
[0038] In some embodiments, if the current question is not the first question in this Q&A session, the historical conversation information of the user in this Q&A session can be obtained. For Q&A sessions with historical conversations, the user's contextual needs can be effectively understood and tracked in multiple rounds of conversations, thereby accurately identifying the user's true intentions.
[0039] Step 202: Generate prompt information based on the current question and historical information.
[0040] In this embodiment, the execution entity may generate prompt information based on the current question and historical information.
[0041] In the field of artificial intelligence, prompt refers to text or instructions that provide input to a model to guide it to produce a specific output. Prompt is a text paragraph provided by the user when interacting with the model, which is used to describe the information, answer, text, etc. that the user wants to obtain from the model. The purpose of prompt is to guide the model to produce the desired response so as to better control the generated output.
[0042] For the big model, the prompt can be a short question, a full paragraph, or a set of instructions, depending on the user's needs and scenario. When generating text, the big model tries to understand the prompt and generate a corresponding response based on its understanding.
[0043] In some embodiments, before generating prompt information, the current question and historical information may be processed. For example, the current question and historical information may be spliced. For another example, the historical information may be truncated to avoid the historical information being too long. For another example, based on the current question, the historical information may be filtered for relevance to avoid interference from irrelevant information.
[0044] Usually, after collecting the user's historical information, CNN (convolutional neural network) can be used to roughly identify the user's historical information, and the identified intent can be annotated on the user's historical information in the form of a label. After receiving the current question input by the user, CNN can also be used to roughly identify the current question's intent, and filter out historical information related to the current question based on the identified intent.
[0045] In some embodiments, different application scenarios may correspond to different prompt information templates. By setting different prompt information templates corresponding to different application scenarios, an integrated and multifunctional question-and-answer system can be provided. Effectively integrate multiple functional entrances and accurately understand user needs in multiple rounds of dialogue. When applied to an intelligent medical question-and-answer system, the application scenarios may include but are not limited to: drug consultation, disease diagnosis, drug and equipment purchase, doctor registration, etc., thereby integrating multiple functions so that users can complete a one-stop experience from health consultation to registration appointment in an intelligent medical question-and-answer system. Thereby improving the efficiency and accuracy of health consultation and providing users with more comprehensive intelligent health services.
[0046] In some embodiments, the user may select an application scenario before conducting the current question and answer session. Based on the application scenario selected by the user, a corresponding prompt information template may be determined. The prompt information may be generated by filling the current question and historical information into the prompt information template. For example, the processed current question and historical information are filled into the corresponding position of the prompt information template as variables to generate the prompt information.
[0047] Step 203, input the prompt information into the first large model, and output the rewritten question and user intention information.
[0048] In this embodiment, the execution subject may input the prompt information into the first large model, output the rewritten question and the user intention information, and then generate the answer to the current question based on the rewritten question and the user intention information.
[0049] A large model refers to a machine learning model with large-scale parameters and complex computational structures. These models are usually built with deep neural networks and have billions or even hundreds of billions of parameters. The purpose of designing a large model is to improve the expressiveness and predictive performance of the model and to be able to handle more complex tasks and data. By training massive amounts of data to learn complex patterns and features, the large model has a stronger generalization ability and can make accurate predictions on unseen data. Here, the large model understands and rewrites the prompt information through a rewriting mechanism. The rewriting mechanism can be a rewriting of multiple rounds of dialogue. Rewriting can include but is not limited to: reference omission rewriting, error correction, style alignment, etc., so that the rewriting problem is more standardized and standardized, thereby improving the accuracy of intent recognition. Through the large model and rewriting mechanism, the user's input can be deeply understood and rewritten to generate optimized queries for subsequent task retrieval and historical summaries. In addition, the large model can output segmented user intent, providing an accurate basis for the prompt information and other rule processing of segmented scenarios for subsequent tasks.
[0050] In some embodiments, the prompt information is input into the first large model, and the original token corresponding to each word of the prompt information can be obtained. For the original token corresponding to the i-th word, the first processing step can be performed. Among them, the initial value of i is 1. The first processing step may include: rewriting the original token corresponding to the i-th word to generate a rewritten token corresponding to the i-th word; based on the rewritten token corresponding to the first i words, generating the intention data corresponding to the i-th word; in response to the i-th word being the last word of the prompt information, generating a rewriting question based on the rewritten token corresponding to the first i words; based on the intention data corresponding to the first i words, generating user intention information. In response to the i-th word not being the last word of the prompt information, i is increased by 1, and the first processing step is continued.
[0051] Step 204, generating a task agent chain based on the rewritten question and user intention information.
[0052] In this embodiment, the above-mentioned execution entity can generate a task agent chain based on the rewriting question and user intention information.
[0053] Among them, the decision agent can be composed of one or more models, which are used to understand the questions input by the user and distribute tasks. The task agent chain may include the task agents that need to be executed to answer the questions input by the user, as well as the execution order between the task agents. The task agent set may include multiple different task agents for performing different tasks. When applied to the intelligent medical question-answering system, the task agent set may include but is not limited to: medical science knowledge answers, report interpretation, skin disease detection, medical question follow-up, medical question rhetoric and other task agents. The task agent chain may include but is not limited to at least one of the following connection forms: parallel connection of task agents, serial connection of task agents, serial and parallel combination connection of task agents, etc.
[0054] In some embodiments, the information of the decision agent and the task agent set is stored in the environment variable for sharing information between the decision agent and the task agent set. Among them, the information of the decision agent can be the result of understanding the question input by the user. When applied to the intelligent medical question-answering system, the information of the decision agent can include but is not limited to: historical summary, key medical entities, user medical intentions, etc. The information of the task agent set can be historical dialogue information, that is, the questions input by the user and the answers to the questions obtained by the task agent. In order to facilitate query, the information in the environment variable can be stored in the form of key-value pairs (kv, key-value).
[0055] Step 205: Select a task agent corresponding to the task agent chain from the task agent set.
[0056] In this embodiment, the execution subject can select the task agent corresponding to the task agent chain from the task agent set. When applied to the intelligent medical question-answering system, the task agent set may include but is not limited to: medical science knowledge answering, report interpretation, skin disease detection, medical question follow-up, medical question counter-questioning and other task agents.
[0057] Step 206, execute the selected task agent in the order of the task agent chain to obtain an answer to the current question.
[0058] In this embodiment, the execution subject can execute the selected task agent in the order of the task agent chain to obtain the answer to the current question. The execution order indicated by the task agent chain may include but is not limited to: parallel execution of task agents, serial execution of task agents, and combined execution of task agents in parallel and serial.
[0059] The disclosed embodiment provides a question-answering method, which introduces a large model to segment intent and a rewriting mechanism. The rewriting mechanism can be used to extract the core demands of users. Furthermore, the large model can be used to simultaneously identify and process multiple intents of users. This helps to solve multiple problems of users at one time and improve user satisfaction.
[0060] Figure 3 A process 300 of another embodiment of the question-answering method according to the present disclosure is shown. The question-answering method comprises the following steps:
[0061] Step 301, in response to receiving the current question, obtaining the user's historical information from the environment variables.
[0062] In this embodiment, the execution subject of the question-answering method can obtain the user's historical information from the environment variable after receiving the current question input by the user.
[0063] The execution subject of the question-and-answer method is usually a server. The server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules (for example, used to provide distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0064] Usually, a question-and-answer application or a browser is installed on the user's terminal. The user can input questions through the question-and-answer application or the question-and-answer webpage in the browser. After receiving the current question input by the user, the user's historical information can be obtained from the environment variable. Among them, the historical information can be the user's historical questions. For example, the historical information can be the historical conversation information of this question and answer, and can be the historical search questions entered by the user on a third-party platform (such as a search application). The user's historical information can assist the first large model in identifying the intent of the current question entered by the user, thereby improving the accuracy of intent recognition.
[0065] In some embodiments, if the current question is the first question in this Q&A session, the historical search questions entered by the user on the third-party platform can be obtained. For Q&A sessions without historical dialogues, the user's historical information can also be tracked, thereby assisting the first model in intent recognition and improving the accuracy of intent recognition.
[0066] In some embodiments, if the current question is not the first question in this Q&A session, the historical conversation information of the user in this Q&A session can be obtained. For Q&A sessions with historical conversations, the user's contextual needs can be effectively understood and tracked in multiple rounds of conversations, thereby accurately identifying the user's true intentions.
[0067] Step 302: Generate prompt information based on the current question and historical information.
[0068] In this embodiment, the execution entity may generate prompt information based on the current question and historical information.
[0069] In the field of artificial intelligence, prompt refers to text or instructions that provide input to a model to guide it to produce a specific output. Prompt is a text paragraph provided by the user when interacting with the model, which is used to describe the information, answer, text, etc. that the user wants to obtain from the model. The purpose of prompt is to guide the model to produce the desired response so as to better control the generated output.
[0070] For the big model, the prompt can be a short question, a full paragraph, or a set of instructions, depending on the user's needs and scenario. When generating text, the big model tries to understand the prompt and generate a corresponding response based on its understanding.
[0071] In some embodiments, before generating prompt information, the current question and historical information may be processed. For example, the current question and historical information may be spliced. For another example, the historical information may be truncated to avoid the historical information being too long. For another example, based on the current question, the historical information may be filtered for relevance to avoid interference from irrelevant information.
[0072] Usually, after collecting the user's historical information, CNN (convolutional neural network) can be used to roughly identify the user's historical information, and the identified intent can be annotated on the user's historical information in the form of a label. After receiving the current question input by the user, CNN can also be used to roughly identify the current question's intent, and filter out historical information related to the current question based on the identified intent.
[0073] In some embodiments, different application scenarios may correspond to different prompt information templates. By setting different prompt information templates corresponding to different application scenarios, an integrated and multifunctional question-and-answer system can be provided. Effectively integrate multiple functional entrances and accurately understand user needs in multiple rounds of dialogue. When applied to an intelligent medical question-and-answer system, the application scenarios may include but are not limited to: drug consultation, disease diagnosis, drug and equipment purchase, doctor registration, etc., thereby integrating multiple functions so that users can complete a one-stop experience from health consultation to registration appointment in an intelligent medical question-and-answer system. Thereby improving the efficiency and accuracy of health consultation and providing users with more comprehensive intelligent health services.
[0074] In some embodiments, the user may select an application scenario before conducting the current question and answer session. Based on the application scenario selected by the user, a corresponding prompt information template may be determined. The prompt information may be generated by filling the current question and historical information into the prompt information template. For example, the processed current question and historical information are filled into the corresponding position of the prompt information template as variables to generate the prompt information.
[0075] Step 303, input the prompt information into the first large model, and output the rewritten question, user intention information and user additional category.
[0076] In this embodiment, the execution subject may input the prompt information into the first large model, output the rewritten question, user intention information and user additional category, and then generate the answer to the current question based on the rewritten question, user intention information and user additional category.
[0077] A large model refers to a machine learning model with large-scale parameters and complex computational structures. These models are usually built with deep neural networks and have billions or even hundreds of billions of parameters. The purpose of designing a large model is to improve the expressiveness and predictive performance of the model and to be able to handle more complex tasks and data. By training massive amounts of data to learn complex patterns and features, the large model has a stronger generalization ability and can make accurate predictions on unseen data. Here, the large model understands and rewrites the prompt information through a rewriting mechanism. The rewriting mechanism can be a rewriting of multiple rounds of dialogue. Rewriting can include but is not limited to: reference omission rewriting, error correction, style alignment, etc., so that the rewriting problem is more standardized and standardized, thereby improving the accuracy of intent recognition. Through the large model and rewriting mechanism, the user's input can be deeply understood and rewritten to generate optimized queries for subsequent task retrieval and historical summarization. In addition, the large model can output segmented user intent and the additional category to which the user belongs, providing an accurate basis for the prompt information and other rule processing of the segmented scene selection for subsequent tasks. By establishing a flexible classification framework, multiple potential intents contained in user queries can be identified and presented.
[0078] In some embodiments, the prompt information is input into the first large model, and the original token corresponding to each word of the prompt information can be obtained. For the original token corresponding to the i-th word, the second processing step can be performed. Among them, the initial value of i is 1. The second processing step may include: rewriting the original token corresponding to the i-th word to generate a rewritten token corresponding to the i-th word; based on the rewritten token corresponding to the first i words, generating the intention data corresponding to the i-th word; in response to the i-th word being the last word of the prompt information, based on the rewritten token corresponding to the first i words, generating a rewriting question; based on the intention data corresponding to the first i words, generating user intention information; based on the category data corresponding to the first i words, generating a user additional category. In response to the i-th word not being the last word of the prompt information, i is increased by 1, and the second processing step is continued.
[0079] Step 304, generating a task agent chain based on the rewritten question and user intention information.
[0080] In this embodiment, the above-mentioned execution entity can generate a task agent chain based on the rewriting question and user intention information.
[0081] Among them, the decision agent can be composed of one or more models, which are used to understand the questions input by the user and distribute tasks. The task agent chain may include the task agents that need to be executed to answer the questions input by the user, as well as the execution order between the task agents. The task agent set may include multiple different task agents for performing different tasks. When applied to the intelligent medical question-answering system, the task agent set may include but is not limited to: medical science knowledge answers, report interpretation, skin disease detection, medical question follow-up, medical question rhetoric and other task agents. The task agent chain may include but is not limited to at least one of the following connection forms: parallel connection of task agents, serial connection of task agents, serial and parallel combination connection of task agents, etc.
[0082] In some embodiments, the information of the decision agent and the task agent set is stored in the environment variable for sharing information between the decision agent and the task agent set. Among them, the information of the decision agent can be the result of understanding the question input by the user. When applied to the intelligent medical question-answering system, the information of the decision agent can include but is not limited to: historical summary, key medical entities, user medical intentions, etc. The information of the task agent set can be historical dialogue information, that is, the questions input by the user and the answers to the questions obtained by the task agent. In order to facilitate query, the information in the environment variable can be stored in the form of key-value pairs (kv, key-value).
[0083] Step 305: Select the task agent corresponding to the task agent chain from the task agent set.
[0084] In this embodiment, the execution subject can select the task agent corresponding to the task agent chain from the task agent set. When applied to the intelligent medical question-answering system, the task agent set may include but is not limited to: medical science knowledge answering, report interpretation, skin disease detection, medical question follow-up, medical question counter-questioning and other task agents.
[0085] Step 306, execute the selected task agent in the order of the task agent chain to obtain an answer to the current question.
[0086] In this embodiment, the execution subject can execute the selected task agent in the order of the task agent chain to obtain the answer to the current question. The execution order indicated by the task agent chain may include but is not limited to: parallel execution of task agents, serial execution of task agents, and combined execution of task agents in parallel and serial.
[0087] Step 307 , in response to the training sample data generated based on the current question and the user intention information belonging to a new application scenario, a second largest model is trained based on the training sample data of at least one existing application scenario and the training sample data of the new application scenario.
[0088] In this embodiment, when the training sample data generated based on the current question and user intention information belongs to a new application scenario, the above execution can mainly train a second largest model based on the training sample data of at least one existing application scenario and the training sample data of the new application scenario.
[0089] Among them, the first large model can be trained using training sample data of at least one existing application scenario. The second large model can be trained using training sample data of at least one existing application scenario and training sample data of a new application scenario. The number of parameters of the second large model is smaller than that of the first large model. The first large model is usually used in the initial stage of the question-answering system. It is slow and costly, but effective. The second large model is usually trained after the question-answering system accumulates a certain amount of training sample data of new application scenarios. After the second large model is trained, the second large model can be used to replace the first large model. It is fast and cost-effective, but the effect is slightly worse. It should be noted that for application scenarios with high recognition accuracy requirements, the first large model can always be used.
[0090] Typically, the answer to the current question generated based on the rewritten question, user intent information, and user-added categories is returned to the user. The user can also provide real-time data feedback. Based on user feedback, training sample data can be generated. For example, user scores greater than a first preset score threshold are used as positive training sample data. User scores less than a second preset score threshold are used as negative training sample data. Based on the positive training sample data and the negative training sample data, the large model can be continuously optimized to adapt to the ever-changing user needs and behavior patterns. Among them, the first preset score threshold is not less than the second preset score threshold.
[0091] The disclosed embodiment provides a question-answering method, which introduces a large model to segment intent, a rewriting mechanism, and a dynamic multi-dimensional classification method. The rewriting mechanism can be used to extract the core demands of users. Furthermore, the large model can simultaneously identify and process multiple intentions of users, and based on the user's consultation, determine whether the relevant information currently requires medical treatment, so as to dynamically add additional categories. The model is continuously optimized through real-time data feedback, the user portrait is richer, and the system is more adaptable.
[0092] Figure 4 The structure 400 for implementing the question-answering method of the embodiment of the present disclosure is shown. The structure 400 may include user input 410, decision agent 420, task agent set 430, environment variable 440 and output result 450, and is used to perform the following steps:
[0093] 1. User input request.
[0094] 2. Get the task agent chain.
[0095] 3. Task agent chain execution.
[0096] 4. Output the results.
[0097] User input 410 may be used to input a user question.
[0098] The decision agent 420 may include input understanding 421 and task distribution 422, which are used to understand user input and perform task distribution. At this time, the decision agent 420 may output a task agent chain, as well as user problem understanding results such as historical summaries, key medical entities, and user medical intentions.
[0099] The task agent set 430 may include, but is not limited to: medical knowledge answers, report interpretation, skin disease detection, medical question follow-up, medical question counter-questioning, etc. task agents, which are used to solve user tasks.
[0100] The task agent chain may include but is not limited to at least one of the following connection forms: parallel connection of task agents (such as operator 1, operator 2 and operator 3 in parallel), serial connection of task agents (such as operator 4, operator 5 and operator 6 in series), serial and parallel connection of task agents (such as operator 7, operator 9 and operator 10 in series, and operator 10 and operator 8 in parallel), etc.
[0101] According to the task agent chain, a corresponding agent may be selected from the task agent set 430 to answer, until the last agent is executed, and the result is output to the user by the output result 450 .
[0102] The environment variables 440 can share information about the decision-making agent and the task agent, as well as information in the history of multiple rounds of dialogues between agents.
[0103] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a question-answering device. Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0104] like Figure 5 As shown, the question-answering device 500 of this embodiment may include: a decision module 501, a selection module 502 and an execution module 503. The decision module 501 is configured to input the current question input by the user into the decision agent and output a task agent chain; the selection module 502 is configured to select a task agent corresponding to the task agent chain from the task agent set; and the execution module 503 is configured to execute the selected task agent in the order of the task agent chain to obtain an answer to the current question.
[0105] In this embodiment, in the question-answering device 500, the specific processing of the decision module 501, the selection module 502 and the execution module 503 and the technical effects thereof can be referred to in Figure 1 The relevant descriptions of steps 101 - 103 in the corresponding embodiment are not repeated here.
[0106] In some optional implementations of this embodiment, the task agent set includes at least one of the following task agents: answering medical knowledge, interpreting report sheets, detecting skin diseases, asking medical questions, and asking medical questions in return.
[0107] In some optional implementations of this embodiment, the task agent chain includes at least one of the following connection forms: parallel connection of task agents, serial connection of task agents, and a combination of serial and parallel connection of task agents.
[0108] In some optional implementations of this embodiment, information of the decision-making agent and the task agent set is stored in environment variables for sharing information between the decision-making agent and the task agent set.
[0109] In some optional implementations of this embodiment, the decision module 501 includes: an acquisition sub-module, configured to acquire the user's historical information from environmental variables in response to receiving a current question; a first generation sub-module, configured to generate prompt information based on the current question and historical information; an output sub-module, configured to input the prompt information into the first large model, and output the rewritten question and user intention information, wherein the large model understands and rewrites the prompt information through a rewriting mechanism; and a second generation sub-module, configured to generate a task agent chain based on the rewritten question and user intention information.
[0110] In some optional implementations of this embodiment, the first generating submodule is further configured to: determine a prompt information template for an application scenario selected by a user; fill the prompt information template with the current question and historical information to generate prompt information.
[0111] In some optional implementations of this embodiment, the application scenario includes at least one of the following: drug consultation, disease diagnosis, drug and equipment purchase, and doctor registration.
[0112] In some optional implementations of the present embodiment, the output submodule is further configured to: input the prompt information into the first large model to obtain the original token corresponding to each word of the prompt information; execute the following first processing step: rewrite the original token corresponding to the i-th word to generate a rewritten token corresponding to the i-th word, generate intention data corresponding to the i-th word based on the rewritten tokens corresponding to the first i words, in response to the i-th word being the last word of the prompt information, generate a rewriting question based on the rewritten tokens corresponding to the first i words, and generate user intention information based on the intention data corresponding to the first i words, wherein the initial value of i is 1; in response to the i-th word not being the last word of the prompt information, add 1 to i and continue to execute the first processing step.
[0113] In some optional implementations of the present embodiment, the first large model also outputs user additional categories; and the output submodule is further configured to: input the prompt information into the first large model to obtain the original token corresponding to each word of the prompt information; execute the following second processing step: rewrite the original token corresponding to the i-th word, generate a rewritten token corresponding to the i-th word, generate intention data corresponding to the i-th word based on the rewritten token corresponding to the first i words, generate category data corresponding to the i-th word based on the intention data corresponding to the first i words, in response to the i-th word being the last word of the prompt information, generate a rewriting question based on the rewritten token corresponding to the first i words, generate user intention information based on the intention data corresponding to the first i words, and generate user additional categories based on the category data corresponding to the first i words, wherein the initial value of i is 1; in response to the i-th word not being the last word of the prompt information, add 1 to i and continue to execute the second processing step.
[0114] In some optional implementations of this embodiment, the first large model is trained using training sample data of at least one existing application scenario.
[0115] In some optional implementations of this embodiment, the question-and-answer device 500 also includes: a training module, configured to respond to the training sample data generated based on the current question and user intention information belonging to a new application scenario, and train a second largest model based on the training sample data of at least one existing application scenario and the training sample data of the new application scenario, wherein the parameter amount of the second largest model is smaller than that of the first largest model.
[0116] According to an embodiment of the present disclosure, the present disclosure also provides an intelligent agent, including: an input module for receiving input information; a processing module for determining a target task based on the input information received by the input module, determining a first large model based on the target task, and obtaining output information by calling the first large model to execute the method described in the first aspect; and an output module for outputting the output information obtained by the processing module.
[0117] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0118] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0119] Figure 6A schematic block diagram of an example electronic device 600 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0120] like Figure 6 As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0121] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0122] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as the question-and-answer method. For example, in some embodiments, the question-and-answer method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the question-and-answer method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the question-and-answer method in any other appropriate manner (e.g., by means of firmware).
[0123] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0124] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0125] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0126] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0127] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0128] A computer system may include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises through computer programs running on respective computers and having a client-server relationship to each other. The server may be a cloud server, a server in a distributed system, or a server combined with a blockchain.
[0129] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions provided by this disclosure can be achieved, and this document does not limit this.
[0130] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A question-answering method, comprising: Input the current question input by the user into the decision agent and output the task agent chain; Selecting a task agent corresponding to the task agent chain from the task agent set; The selected task agent is executed in the order of the task agent chain to obtain an answer to the current question.
2. The method according to claim 1, wherein: The task agent set includes at least one of the following task agents: answering medical knowledge, interpreting report sheets, detecting skin diseases, asking medical questions, and asking medical questions in return.
3. The method according to claim 1, wherein: The task agent chain includes at least one of the following connection forms: parallel connection of task agents, serial connection of task agents, and a combination of serial and parallel connection of task agents.
4. The method according to claim 1, wherein: The information of the decision-making agent and the task agent set is stored in the environment variable for sharing information between the decision-making agent and the task agent set.
5. The method according to claim 4, wherein: The current question input by the user is input into the decision agent, and the task agent chain is output, including: In response to receiving the current question, obtaining historical information of the user from the environment variable; Generate prompt information based on the current question and the historical information; Inputting the prompt information into the first large model, outputting the rewriting question and user intention information, wherein the large model understands and rewrites the prompt information through a rewriting mechanism; Based on the rewritten question and the user intention information, the task agent chain is generated.
6. The method according to claim 5, wherein: The generating prompt information based on the current question and the historical information includes: Determine a prompt information template for the application scenario selected by the user; The current question and the historical information are filled into the prompt information template to generate the prompt information.
7. The method according to claim 6, wherein: The application scenarios include at least one of the following: drug consultation, disease diagnosis, drug and equipment purchase, and doctor registration.
8. The method according to claim 5, wherein: The step of inputting the prompt information into the first large model and outputting the rewritten question and user intention information includes: Input the prompt information into the first large model to obtain the original token corresponding to each word of the prompt information; Perform the following first processing step: rewrite the original token corresponding to the i-th word, generate a rewritten token corresponding to the i-th word, generate the intention data corresponding to the i-th word based on the rewritten token corresponding to the first i words, in response to the i-th word being the last word of the prompt information, generate the rewriting question based on the rewritten token corresponding to the first i words, and generate the user intention information based on the intention data corresponding to the first i words, wherein the initial value of i is 1; In response to the i-th word not being the last word of the prompt information, i is incremented by 1, and the first processing step is continued.
9. The method according to claim 5, wherein: The first model also outputs additional categories of users; as well as The step of inputting the prompt information into the first large model to obtain the rewritten question and user intention information includes: Input the prompt information into the first large model to obtain the original token corresponding to each word of the prompt information; Perform the following second processing steps: rewrite the original token corresponding to the i-th word, generate the rewritten token corresponding to the i-th word, generate the intention data corresponding to the i-th word based on the rewritten token corresponding to the first i words, generate the category data corresponding to the i-th word based on the intention data corresponding to the first i words, in response to the i-th word being the last word of the prompt information, generate the rewriting question based on the rewritten token corresponding to the first i words, generate the user intention information based on the intention data corresponding to the first i words, and generate the user additional category based on the category data corresponding to the first i words, wherein the initial value of i is 1; In response to the i-th word not being the last word of the prompt information, i is incremented by 1, and the second processing step is continued.
10. The method according to claim 5, wherein: The first large model is trained using training sample data of at least one existing application scenario.
11. The method according to claim 10, wherein: The method further comprises: In response to the training sample data generated based on the current problem and the user intention information belonging to a new application scenario, a second large model is trained based on the training sample data of at least one existing application scenario and the training sample data of the new application scenario, wherein the number of parameters of the second large model is smaller than that of the first large model.
12. A question-answering device, comprising: A decision module, configured to input the current question input by the user to the decision agent, and output a task agent chain; A selection module is configured to select a task agent corresponding to the task agent chain from a set of task agents; The execution module is configured to execute the selected task agent in the order of the task agent chain to obtain an answer to the current question.
13. The device according to claim 12, wherein: The task agent set includes at least one of the following task agents: answering medical knowledge, interpreting report sheets, detecting skin diseases, asking medical questions, and asking medical questions in return.
14. The device according to claim 12, wherein: The task agent chain includes at least one of the following connection forms: parallel connection of task agents, serial connection of task agents, and a combination of serial and parallel connection of task agents.
15. The device according to claim 12, wherein: The information of the decision-making agent and the task agent set is stored in the environment variable for sharing information between the decision-making agent and the task agent set.
16. The method according to claim 15, wherein: The decision module comprises: an acquisition submodule, configured to acquire the user's historical information from the environment variable in response to receiving the current question; A first generating submodule is configured to generate prompt information based on the current question and the historical information; an output submodule, configured to input the prompt information into the first large model, and output the rewriting question and user intention information, wherein the large model understands and rewrites the prompt information through a rewriting mechanism; The second generation submodule is configured to generate the task agent chain based on the rewriting problem and the user intention information.
17. The device according to claim 16, wherein: The first generation submodule is further configured to: Determine a prompt information template for the application scenario selected by the user; The current question and the historical information are filled into the prompt information template to generate the prompt information.
18. The device according to claim 17, wherein: The application scenarios include at least one of the following: drug consultation, disease diagnosis, drug and equipment purchase, and doctor registration.
19. The device according to claim 16, wherein: The output submodule is further configured to: Input the prompt information into the first large model to obtain the original token corresponding to each word of the prompt information; Perform the following first processing step: rewrite the original token corresponding to the i-th word, generate a rewritten token corresponding to the i-th word, generate the intention data corresponding to the i-th word based on the rewritten token corresponding to the first i words, in response to the i-th word being the last word of the prompt information, generate the rewriting question based on the rewritten token corresponding to the first i words, and generate the user intention information based on the intention data corresponding to the first i words, wherein the initial value of i is 1; In response to the i-th word not being the last word of the prompt information, i is incremented by 1, and the first processing step is continued.
20. The device according to claim 16, wherein: The first model also outputs additional categories of users; and The output submodule is further configured to: Input the prompt information into the first large model to obtain the original token corresponding to each word of the prompt information; Perform the following second processing steps: rewrite the original token corresponding to the i-th word, generate the rewritten token corresponding to the i-th word, generate the intention data corresponding to the i-th word based on the rewritten token corresponding to the first i words, generate the category data corresponding to the i-th word based on the intention data corresponding to the first i words, in response to the i-th word being the last word of the prompt information, generate the rewriting question based on the rewritten token corresponding to the first i words, generate the user intention information based on the intention data corresponding to the first i words, and generate the user additional category based on the category data corresponding to the first i words, wherein the initial value of i is 1; In response to the i-th word not being the last word of the prompt information, i is incremented by 1, and the second processing step is continued.
21. The device according to claim 16, wherein: The first large model is trained using training sample data of at least one existing application scenario.
22. The device according to claim 21, wherein The device also includes: The training module is configured to train a second large model based on the training sample data of at least one existing application scenario and the training sample data of the new application scenario in response to the training sample data generated based on the current problem and the user intention information belonging to a new application scenario, wherein the parameter amount of the second large model is smaller than that of the first large model.
23. An intelligent agent, comprising: An input module, used for receiving input information; a processing module, configured to determine a target task based on the input information received by the input module, determine a first large model based on the target task, and obtain output information by executing the method according to any one of claims 5 to 9 by calling the first large model; An output module is used to output the output information obtained by the processing module.
24. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 11.
25. A non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the method of any one of claims 1-11.
26. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Information processing method and device based on large language model, equipment and storage medium
CN117521675A
Multi-agent question answering system and method based on large language model
CN118093833A
Question and answer processing method and device
CN118260404A
Intelligent agent interaction method, electronic equipment and computer readable storage medium
CN118585109A
Problem processing method and device based on multiple agents and product
CN118672782A
Cited By
Task processing method and device, equipment and storage medium
CN120610823A