Medical agent construction method and related device
By understanding the target medical task and planning coarse-grained steps, assigning sub-task agents and configuring standard steps, the problem of low efficiency of existing medical large language models in complex medical tasks is solved, and high success rate and efficient construction of medical agents are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-29
- Publication Date
- 2026-04-21
AI Technical Summary
Existing medical big language models suffer from insufficient understanding of professional knowledge and limited task planning capabilities when dealing with complex medical tasks, resulting in low efficiency and low success rate in building medical intelligent agents.
By acquiring the task requirements of the target medical task, performing task understanding and coarse-grained step planning, assigning sub-task agents and configuring standard steps, a medical agent is constructed to handle the target medical task.
It improves the success rate of medical intelligent agents in handling target medical tasks, lowers the construction threshold and improves efficiency, and ensures the logical coherence and resource utilization of each step.
Smart Images

Figure CN121902841A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent agent technology, and in particular to a method for constructing a medical intelligent agent and related devices. Background Technology
[0002] Large Language Models (LLMs) have demonstrated certain advantages in many fields due to their powerful natural language processing and knowledge integration capabilities. However, when faced with complex medical tasks, LLMs have obvious shortcomings, such as insufficient depth of understanding of medical expertise and limited ability to handle complex medical processes.
[0003] Compared to large language models, intelligent agents possess stronger task planning capabilities and are better suited for handling complex medical tasks. Currently, the construction methods for medical agents mainly include those based on orchestration platforms and those based on open-source tools such as Manus. However, orchestration platform-based methods require users to have certain medical knowledge and master the platform's usage, and also require significant time for process orchestration and configuration, resulting in low efficiency and a high barrier to entry in building medical agents. On the other hand, medical agents built using open-source tools can only plan one step at a time. After that step is completed, the next step is planned based on the result and the goal of the medical task. However, planning one step at a time can easily lead to loops, resulting in a low success rate for medical tasks. Summary of the Invention
[0004] In view of the above problems, this application provides a method and related apparatus for constructing a medical intelligent agent, so as to achieve the goal of rapidly constructing a medical intelligent agent that can improve the success rate of medical tasks. The specific solution is as follows:
[0005] The first aspect of this application provides a method for constructing a medical intelligent agent, comprising:
[0006] Obtain the task requirements for the target medical mission;
[0007] The task requirements are understood and coarse-grained step planning is performed to obtain task understanding information and a set of basic steps that the task execution depends on. The set of basic steps includes multiple ordered basic steps.
[0008] A subtask agent is assigned to each of the basic steps, and a standard step is configured to be executed by the subtask agent according to the task requirements, the task understanding information and the basic steps. The standard step is obtained by adding step details to the basic step corresponding to the subtask agent. The step details include step input, step output and resource retrieval. The step input is determined according to the step output of the preceding basic step.
[0009] The subtask agent configured with the standard steps is used as the target agent. Based on all the target agents, a medical agent is constructed to handle the target medical task.
[0010] In one possible implementation, the process of performing task understanding and coarse-grained step planning on the task requirements to obtain a set of basic steps for task understanding and task execution dependencies includes:
[0011] Based on the task requirements, a task understanding prompt instruction is generated. The task understanding prompt instruction is used to prompt the task understanding agent to retrieve knowledge related to the task requirements from the knowledge base, perform a deep understanding of the task requirements based on the retrieved knowledge, and plan it into feasible steps with step objectives.
[0012] The task understanding prompt is input into the task understanding agent to obtain the task understanding information and the basic step set, wherein the basic steps in the basic step set include a step name and a step purpose.
[0013] In one possible implementation, generating task understanding prompts based on the task requirements includes:
[0014] A typical example of obtaining the target medical task;
[0015] The task comprehension prompts are generated based on the task requirements and the typical examples.
[0016] In one possible implementation, before constructing a medical agent for handling the target medical task based on all the target agents, the method further includes:
[0017] An overall rationality analysis is performed on the set of standard steps to determine whether it meets the overall rationality requirements. The overall rationality requirements are that the set of standard steps covers all task dimensions of the target medical task without omission and has no logical loopholes. The set of standard steps includes the standard steps configured by each of the target agents.
[0018] If not, then the set of standard steps is adjusted in a first planning step until the overall rationality requirement is met.
[0019] In one possible implementation, before constructing a medical agent for handling the target medical task based on all the target agents, the method further includes:
[0020] For each of the target agents:
[0021] Simulated input data is generated for the target intelligent agent and input into the target intelligent agent to obtain the subtask results corresponding to the simulated input data;
[0022] Determine whether the result of the subtask has completed the objective of the standard steps configured for the target agent;
[0023] If not, a second planning adjustment is made to the step details and / or input prompts of the standard steps configured for the target agent; until the subtask result can accomplish the purpose of the step, the input prompts are used to prompt the generation of the standard steps configured for the target agent.
[0024] In one possible implementation, before constructing a medical agent for handling the target medical task based on all the target agents, the method further includes:
[0025] For each standard step in the set of standard steps:
[0026] The task difficulty assessment agent evaluates the sub-task difficulty of the standard step to determine whether the standard step is difficult.
[0027] If so, the standard step is broken down into multiple sub-steps that are less difficult than the standard step, and the standard step is replaced by the multiple sub-steps.
[0028] Generate target agents corresponding to the multiple sub-steps respectively, and replace the target agent configured for the standard step with the target agents corresponding to the multiple sub-steps respectively.
[0029] In one possible implementation, after constructing a medical agent for handling the target medical task based on all the target agents, the method further includes:
[0030] Obtain a test task instance of the target medical task;
[0031] The medical intelligent agent is tested according to the test task instance. When each target intelligent agent is tested, the output data of the target intelligent agent is determined by the verification agent to determine whether the output data of the target intelligent agent contains content that is not in the input data of the target intelligent agent.
[0032] If so, a first error message indicating a mismatch between input and output is generated, so that the target agent can regenerate the output data based on the first error message and the input data and make the judgment again.
[0033] One possible implementation also includes:
[0034] When the medical intelligent agent finishes executing the test task instance, it obtains the task result data corresponding to the test task instance.
[0035] The error feedback agent determines whether the task result data meets expectations. If not, a second error message is collected. The second error message includes at least one of the following: the standard steps and target agent where the error occurred, the error form, and the error content.
[0036] Based on the second error message, a third planning adjustment is made to the standard procedure set until the task result data meets expectations.
[0037] In one possible implementation, a first dataset is obtained, wherein each data pair contained in the first dataset consists of a first test task instance and first planning data corresponding to the first test task instance;
[0038] Obtain a second dataset. Each data pair in the second dataset consists of a second test task instance, first planning data corresponding to the second test task instance, and second planning data corresponding to the second test task instance. The planning effect of the first planning data is higher than the planning effect of the second planning data. The first planning data and the second planning data include a set of standard steps.
[0039] A supervised fine-tuning loss is generated based on the first dataset, and a direct preference optimization loss is generated based on the second dataset;
[0040] The target large language model is trained based on the supervised fine-tuning loss and the direct preference optimization loss. The target large language model includes at least one of the following large language models: a task understanding agent, a planning agent, a verification agent, an error feedback agent, a task difficulty assessment agent, an experience summarization agent, and a step optimization agent. The planning agent is used to plan and generate the standard steps. The experience summarization agent is used to generate the first dataset and the second dataset. The step optimization agent is used to implement the first planning adjustment, the second planning adjustment, and the third planning adjustment.
[0041] In one possible implementation, before constructing a medical agent for handling the target medical task based on all the target agents, using the subtask agents configured with the standard steps as target agents, the method further includes:
[0042] The basic steps are output and displayed. The user's first feedback result on the output and displayed basic steps is obtained. If the first feedback result indicates that the basic steps should be modified, the basic steps to be modified are modified according to the first feedback result, and the sub-task agents are reassigned to the modified basic steps.
[0043] And / or, output and display the step details, obtain the user's second feedback result on the output and displayed step details, and if the second feedback result indicates that the step details to be modified are modified according to the second feedback result.
[0044] A second aspect of this application provides a computer program product including computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the medical intelligent agent construction method of the first aspect or any implementation thereof.
[0045] A third aspect of this application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0046] The memory is used to store computer programs;
[0047] The processor is used to execute the computer program so that the electronic device can implement the medical intelligent agent construction method of the first aspect or any implementation thereof.
[0048] The fourth aspect of this application provides a computer storage medium carrying one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the medical intelligent agent construction method of the first aspect or any implementation thereof.
[0049] By employing the aforementioned technical solution, the medical intelligent agent construction method provided in this application obtains the task requirements of the target medical task. To accurately construct the ordered basic steps for executing the target medical task, this application performs task understanding and coarse-grained step planning on the task requirements, obtaining task understanding information and a set of basic steps that the task execution depends on. Since this application performs overall task planning based on task understanding, it has a stronger global perspective, ensuring more coherent logic and consistent goals between each step, avoiding getting trapped in local optima and causing overall path deviation, thus improving the success rate of medical tasks. Simultaneously, the global planning approach allows for the anticipation of all resources required for the entire process, improving overall resource utilization.
[0050] To enable the execution of each basic step within the set of basic steps by the intelligent agent, a sub-task intelligent agent can be assigned to each basic step. Furthermore, to ensure that each sub-task intelligent agent has a clearer understanding of its responsibilities and can more accurately handle its assigned sub-tasks, this application can configure standard steps for the sub-task intelligent agents based on task requirements, task understanding information, and the basic steps. Compared to the basic steps, the standard steps add details such as step input, step output, and resource retrieval, allowing the sub-task intelligent agents to better understand the inputs required for execution, the resources to be retrieved, and the output to be processed. This improves their understanding of the sub-tasks and thus increases their success rate in handling them. Based on this, the sub-task intelligent agents configured with the standard steps are used as target intelligent agents. By constructing a medical intelligent agent to handle the target medical task based on all the target intelligent agents, the success rate of the medical intelligent agent in handling the target medical task can be effectively improved.
[0051] In the process of building the aforementioned medical intelligent agent, users can automatically build a medical intelligent agent that can improve the success rate of the target medical task simply by inputting task requirements, without having to arrange task processes or configure other task parameters. This approach has a lower barrier to entry and higher construction efficiency. Attached Figure Description
[0052] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0053] Figure 1 A schematic diagram of a system architecture provided for this application;
[0054] Figure 2 A flowchart illustrating a method for constructing a medical intelligent agent provided in this application;
[0055] Figure 3 A schematic diagram of a human-computer interaction interface provided in this application;
[0056] Figure 4 This application provides a schematic diagram illustrating the construction process of a medical intelligent agent.
[0057] Figure 5 This application provides a schematic diagram of the structure of a medical intelligent agent construction device;
[0058] Figure 6 This is a schematic diagram of the structure of an electronic device provided in this application. Detailed Implementation
[0059] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0060] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0061] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0062] This application provides a method and related apparatus for constructing a medical intelligent agent, which can be applied to medical task-related scenarios, especially medical task processing scenarios where users lack medical knowledge and programming knowledge. To quickly process target medical tasks according to specific needs, the medical intelligent agent construction method provided in this application can be used. The task requirements of the target medical task are input to construct a medical intelligent agent that meets the specific needs. Then, by inputting a task instance of the target medical task, the target medical task can be processed quickly.
[0063] For example, for the target medical task of "analyzing and summarizing medical duplicate billing events", if the user's task requirement is "analyzing errors of duplicate billing type in medical management event reporting cases", then the task requirement can be input into the intelligent agent. After fully understanding the task requirements, the intelligent agent can plan the overall task process, refine the details of each step of the sub-task execution, build a medical intelligent agent that meets the task requirements, and then input the task instance of the target medical task to quickly process the target medical task.
[0064] It should be noted that the above scenarios are merely examples and are not intended to limit this application.
[0065] Optionally, the medical intelligent agent construction method provided in this application can be applied to, for example... Figure 1 The system architecture shown includes a terminal 100 and a server 200. The server 200 may include one or more servers (…). Figure 1(This example uses a server as an illustration).
[0066] Either terminal 100 or server 200 can be used independently to execute the medical intelligent agent construction method provided in the embodiments of this application. Alternatively, terminal 100 and server 200 can also be used collaboratively to execute the medical intelligent agent construction method provided in the embodiments of this application.
[0067] The following description Figure 1 The product form of the mid-terminal 100;
[0068] The terminal 100 in this application embodiment can be a mobile phone, tablet computer, wearable device, vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), etc., and this application embodiment does not impose any restrictions on it.
[0069] To enable those skilled in the art to better understand this application, the medical intelligent agent construction method of the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0070] Reference Figure 2 , Figure 2 This is a flowchart illustrating a method for constructing a medical intelligent agent provided in an embodiment of this application, such as... Figure 2 As shown, the method for constructing a medical intelligent agent may include:
[0071] Step S101: Obtain the task requirements of the target medical task.
[0072] Here, the target medical task refers to the real medical task that the user needs to handle, such as auxiliary diagnostic tasks, ICD (International Classification of Diseases) coding tasks, etc.
[0073] In order to process the target medical task, task requirements can be input for the target medical task, so that this application can obtain the task requirements of the target medical task.
[0074] For example, for the medical task of “analyzing and summarizing medical double-charge events”, the following task requirement can be entered: Analyze the errors of double-charge type in medical management event reporting cases.
[0075] Step S102: Perform task understanding and coarse-grained step planning on the task requirements to obtain task understanding information and a set of basic steps that the task execution depends on.
[0076] Here, the set of basic steps includes multiple ordered basic steps, which are necessary steps for the execution of the target medical task. "Ordered" means that the basic steps have dependencies on each other, and can be executed one by one based on these dependencies to obtain the task result data of the target medical task. The dependencies between the basic steps are determined based on the professional knowledge and task logic of the target medical task.
[0077] In order to plan the target medical task more accurately from a global perspective, we can first understand the task requirements mentioned above, and then plan the steps in a coarse-grained manner based on the understanding of the task, so as to obtain the basic steps corresponding to each sub-task of the task, that is, the set of basic steps.
[0078] Here, the basic steps include the step name and the step purpose. For example, when a user inputs the task requirement of "analyzing the error of duplicate billing type in medical management event notification cases", it can be broken down into the following basic steps:
[0079] Basic Step 1: Case Collection and Summary; Purpose: To obtain all relevant official case reports in a comprehensive and complete manner, ensuring the integrity and authority of the data for analysis, and providing reliable original materials for subsequent work;
[0080] Basic Step 2: Preliminary Screening and Summarization; Purpose: To quickly identify and extract cases related to the "fee" issue from all cases, and to initially separate a set of cases suspected of "double charging" to improve the efficiency of subsequent in-depth analysis;
[0081] Basic Step 3: In-depth analysis and feature extraction; Purpose: To carefully analyze the selected cases, accurately define each "double billing" error instance, and systematically extract its key features (such as the specific manifestation of the error, the departments involved, the amount, the system links, etc.), transforming unstructured text into analyzable structured data;
[0082] Basic Step 4: Pattern Induction and Cause Analysis; Purpose: Based on the extracted structured features, summarize the common patterns, high-frequency risk points, and direct / root causes of duplicate charges (such as process loopholes, system defects, human errors, and management deficiencies), and complete the transformation from "individual phenomena" to "universal laws".
[0083] Basic Step 5: Report Writing and Recommendation Generation; Purpose: To integrate all the aforementioned analysis processes and conclusions into a well-structured, well-supported, and clearly defined analysis report, and based on the identified root causes, to propose actionable improvement or prevention recommendations, thus achieving a value leap from "analyzing problems" to "supporting decision-making".
[0084] It should be noted that the above basic steps are merely examples and are not intended to limit this application.
[0085] In one possible implementation, the process of "understanding the task requirements and planning coarse-grained steps to obtain task understanding information and a set of basic steps that the task execution depends on" may include: generating task understanding prompts based on the task requirements, which prompt the task understanding agent to retrieve knowledge related to the task requirements from a knowledge base; performing a deep understanding of the task requirements based on the retrieved knowledge and planning them into feasible steps with step objectives; and inputting the task understanding prompts into the task understanding agent to obtain task understanding information and a set of basic steps, wherein the basic steps in the set of basic steps include step names and step objectives.
[0086] In other words, this step can be achieved by a task understanding agent. After receiving a task understanding prompt, the task understanding agent can understand the task according to the task requirements, obtain task understanding information, and decompose the task based on the task understanding to obtain basic steps that correspond one-to-one with the decomposed sub-tasks.
[0087] The process of "understanding the task based on the task requirements" may include: retrieving relevant knowledge from the knowledge base based on the task requirements, and then conducting in-depth task understanding based on the relevant knowledge and task requirements to obtain task understanding information.
[0088] Optionally, the knowledge base may include a medical knowledge base and a policy and rule base. The medical knowledge base covers professional knowledge such as symptoms, diagnostic criteria, treatment plans, relevant cases, and medical definitions for various diseases, while the policy and rule base covers knowledge such as medical industry norms and medical insurance policies.
[0089] Taking "analyzing errors in duplicate billing types in medical management incident reporting cases" as an example, optionally, the task understanding agent can retrieve relevant definitions of duplicate billing, violation reporting cases, and other medical knowledge from the medical knowledge base, and obtain knowledge such as medical insurance regulations on charging items from the policy and rule base. This knowledge can supplement the missing medical professional details in the requirements, enabling the task understanding agent to grasp the knowledge that the execution of the target medical task requires identifying medical operations involving duplicate billing, determining the specific type of charging violation, and the relevant medical insurance policy clauses based on the violation reporting case base. This allows for a clearer definition of the task objectives and the basic steps required to complete the task, providing a foundation for the subsequent construction of the medical agent.
[0090] For example, a possible task comprehension prompt could be as follows:
[0091] "You are an expert in understanding and planning medical tasks. Based on the [task requirements] and [optional knowledge base], please think more deeply about the task and plan it into feasible basic steps. Clearly describe the purpose of each basic step, and standardize the overall input and output of the task to ensure that each step is irreplaceable."
[0092] Output format (JSON): {"Task Requirements":"","Task Understanding":"","Basic Steps": [{"Step Name":"","Step Purpose":""}],"Input Format":"","Output Format":""}"
[0093] [Task Requirements]:
[0094] {{input["requirement"]}}
[0095] [Optional Knowledge Base]:
[0096] {{input["knowledge"]}}”.
[0097] The “input format” and “output format” mentioned above refer to the input and output requirements and their format requirements for the “current task (i.e., task understanding and coarse-grained step planning)” task. The same applies below, and will not be repeated here.
[0098] It should also be noted that the above prompts are merely examples and are not intended to limit this application.
[0099] In an optional embodiment, in order to improve the depth of the task understanding agent's understanding of the task, this embodiment can also obtain typical examples of the target medical task. Optionally, the typical example is preferably a real task instance, such as "a typical example of repeated charges for hospital examination items". Then, the above-mentioned task understanding prompt instructions can be generated according to the task requirements and typical examples.
[0100] As mentioned earlier, the task understanding agent can retrieve relevant knowledge from a knowledge base. Optionally, this knowledge base can be specified by the user or obtained by semantic retrieval using techniques such as RAG (Retrieval-Augmented Generation) with task requirements as the query vector.
[0101] Step S103: Assign a subtask agent to each basic step, and configure the standard steps to be executed by the subtask agent according to the task requirements, task understanding information and basic steps.
[0102] In this embodiment, to ensure that the planned set of basic steps can be executed accurately to complete the target medical task, a sub-task agent can be assigned to each basic step. Optionally, different basic steps can be assigned different sub-task agents, allowing each sub-task agent to focus on the execution of its own sub-task.
[0103] After assigning subtask agents, to help them better understand their own subtasks, standard steps for execution can be generated based on task requirements, task understanding information, and basic steps. These standard steps are then configured for the subtask agents, enabling them to execute the subtasks according to these standard steps. Here, the standard steps are obtained by adding step details to the basic steps corresponding to the subtask agents. These details include step inputs, step outputs, and resource retrieval.
[0104] As mentioned earlier, the basic steps in the set of basic steps are ordered steps with dependencies. Therefore, the step input in the standard step corresponding to any basic step is determined based on the step output of the preceding basic step. That is, each subtask agent executes its own standard step to complete the target medical task. Here, the preceding basic step refers to the basic step that was executed before this basic step and has an output.
[0105] Optionally, the step details may also include the respective formats of the step inputs and step outputs. That is, this embodiment can not only configure the inputs, outputs, and retrieved resources of the subtask agents, but also configure the input and output formats of the subtask agents. By standardizing the formats, it can ensure that the inputs and outputs of each subtask agent can be connected more smoothly, thereby improving the success rate of the task.
[0106] Optionally, the step details may also include specific judgment criteria and reference cases. Here, the specific judgment criteria are the judgment standards that the subtask agent needs to follow when executing its own subtask, which can help the subtask agent better understand what it needs to do to execute its own subtask; the reference cases provide input and output data so that the subtask agent can better understand what its step input and step output are respectively.
[0107] Optionally, the process of generating the standard steps corresponding to the subtask agent can be implemented by a planning agent, that is, the planning agent can plan and generate the above standard steps.
[0108] For example, taking resource retrieval as a knowledge base, an optional prompt instruction for the standard steps corresponding to the subtask agent could be as follows:
[0109] "Based on the following [Task Requirements], [Optional Knowledge Base], and [Task Understanding], please determine the specific form of each standard step, including the step input, the resources to be retrieved, the step output, the specific judgment criteria that can be executed, and provide a case for each step."
[0110] Output format: {"Task Objective":"","Task Understanding Information":"","Input Format":"","Output Format":"","Standard Steps":[{"Step Name":"","Step Purpose":"","Step Input":{"Input Name":"","Type":""},"Knowledge Base to be Searched":[],"Step Output":{"Output Name":"","Type":""}},"Specific Judgment Criteria":[""],"Reference Case":{"Input":{},"Output":{}}}]}
[0111] [Task Requirements]:
[0112] {{input["requirement"]}}
[0113] [Optional Knowledge Base]:
[0114] {{input["knowledge"]}}
[0115] [Task Understanding]:
[0116] {{steps}}
[0117] Require:
[0118] 1. If a certain step does not require searching the knowledge base, then the "Knowledge Base to be Searched" field will be empty.
[0119] 2. The knowledge base to be searched must be selected from the optional knowledge bases and cannot be modified.
[0120] Fill in the task requirements, optional knowledge base (which can be empty), and task understanding in the above instruction template with the corresponding content. For example, fill in the basic step set and task understanding information in the task understanding to get the standard step generation prompt instruction. Under the prompt instruction, the planning agent can generate each standard step that meets the task objective according to the "output format".
[0121] It should be noted that the above instructions are merely examples and are not intended to limit this application.
[0122] Step S104: Take the subtask agent configured with standard steps as the target agent, and construct a medical agent for handling the target medical task based on all the target agents.
[0123] As described above, each subtask agent configured with standard steps executes its own standard steps to complete the target medical task. Therefore, in this embodiment, all target agents can be combined to form a medical agent to process the target medical task. More precisely, the medical agent processes the task instance (i.e., the real task data) of the target medical task to obtain the task result data.
[0124] The medical intelligent agent construction method provided in this application obtains the task requirements of a target medical task. To accurately construct the ordered basic steps for executing the target medical task, this application performs task understanding and coarse-grained step planning on the task requirements, obtaining task understanding information and a set of basic steps that the task execution depends on. Because this application performs overall task planning based on task understanding, it has a stronger global perspective, ensuring more coherent logic and consistent goals between steps, avoiding getting trapped in local optima and causing deviations from the overall path, thus improving the success rate of medical tasks. Simultaneously, the global planning approach allows for the anticipation of all resources required for the entire process, improving overall resource utilization.
[0125] To enable the execution of each basic step within the set of basic steps by the intelligent agent, a sub-task intelligent agent can be assigned to each basic step. Furthermore, to ensure that each sub-task intelligent agent has a clearer understanding of its responsibilities and can more accurately handle its assigned sub-tasks, this application can configure standard steps for the sub-task intelligent agents based on task requirements, task understanding information, and the basic steps. Compared to the basic steps, the standard steps add details such as step input, step output, and resource retrieval, allowing the sub-task intelligent agents to better understand the inputs required for execution, the resources to be retrieved, and the output to be processed. This improves their understanding of the sub-tasks and thus increases their success rate in handling them. Based on this, the sub-task intelligent agents configured with the standard steps are used as target intelligent agents. By constructing a medical intelligent agent to handle the target medical task based on all the target intelligent agents, the success rate of the medical intelligent agent in handling the target medical task can be effectively improved.
[0126] In the process of building the aforementioned medical intelligent agent, users can automatically build a medical intelligent agent that can improve the success rate of the target medical task simply by inputting task requirements, without having to arrange task processes or configure other task parameters. This approach has a lower barrier to entry and higher construction efficiency.
[0127] In some embodiments of this application, considering that the medical intelligent agent described above is theoretically constructed to improve the success rate of tasks, its success rate depends not only on the design of steps S102 and S103, but may also be limited by the capabilities of the task understanding agent and the planning agent. To avoid the standard steps planned above being unreasonable due to the limited capabilities of these two agents, resulting in the task failing to execute, this embodiment can provide the following verification function.
[0128] Optionally, before executing step S104 "Construct a medical agent for handling target medical tasks based on all target agents", the overall rationality of the plan can be analyzed.
[0129] Specifically, for ease of description, the standard steps configured by all the target agents mentioned above are defined as a set of standard steps. In this embodiment, an overall rationality analysis can be performed on the set of standard steps to determine whether it meets the overall rationality requirements. The overall rationality requirements are that the set of standard steps covers all task dimensions of the target medical task without omission and has no logical loopholes. The set of standard steps includes the standard steps configured by all the target agents. If not, the set of standard steps is adjusted in the first planning stage until the overall rationality requirements are met.
[0130] More specifically, this embodiment can combine the task objective (as mentioned above, the task objective can be determined based on task requirements, task understanding information, etc.) to determine whether the standard step set planned above can comprehensively (i.e. without omissions) and effectively cover all task dimensions of the target medical task, and to determine whether there are logical loopholes and missing links in the "ordered" execution sequence of the standard step set. If so, it is determined that the standard step set meets the overall rationality requirements of the task, and therefore no adjustment is made to the standard step set.
[0131] Conversely, if it is determined that the set of standard steps does not meet the overall rationality requirements of the task—for example, if the task requirement is "to analyze the cases of duplicate charges from the regional medical management incident reports. This requires: 1. identifying which two medical procedures resulted in duplicate charges; 2. matching them with the provided medical insurance catalogs"—but the planned set of standard steps only includes the subtask of analyzing duplicate charge errors, without any subtask of matching with the medical insurance catalogs or determining the nature of the duplicate charge violation, then the set of standard steps will undergo a first planning adjustment. After the adjustment, the overall rationality will be re-verified, and this process will continue until the set of standard steps meets the overall rationality requirements.
[0132] Optionally, the process of determining whether the set of standard steps meets the overall rationality requirements of the task can be implemented by a verification agent.
[0133] Optionally, the first planning adjustment can be achieved by optimizing the agent through steps.
[0134] Optionally, the first planning adjustment includes at least one of the following adjustment methods: adding standard steps, deleting standard steps, modifying standard steps, modifying step details in standard steps, modifying input prompt instructions used to generate standard steps, etc.
[0135] Of course, there are other ways to make adjustments, which will not be elaborated on in this application.
[0136] It should also be noted that if standard steps are added or removed, target agents need to be added or removed accordingly to achieve a complete planning adjustment.
[0137] Optionally, before executing step S104 "Constructing a medical agent for handling target medical tasks based on all target agents", the task executability of each planned standard step (i.e. each target agent) can be analyzed.
[0138] Specifically, for each target agent, this embodiment can generate simulated input data for the target agent and input it into the target agent to obtain the sub-task result corresponding to the simulated input data. Further, it is determined whether the sub-task result has completed the step purpose of the standard steps configured for the target agent. If not, the step details and / or input prompt instructions (such as the prompt instructions in step S103 above) of the standard steps configured for the target agent are adjusted in a second planning manner until the sub-task result can complete the step purpose. The input prompt instructions are used to prompt the generation of the standard steps configured for the target agent.
[0139] Optionally, the process of determining whether the subtask result has completed the standard steps configured for the target agent can be implemented by verifying the agent.
[0140] Optionally, the second planning adjustment can also be achieved by optimizing the agent through steps.
[0141] For example, when analyzing a target agent for violation cases, the system can input hospital billing records to determine whether it can correctly extract key information such as billing items, billing amounts, and billing departments (i.e., the purpose of the steps). If not, the system can analyze the instruction description of the input prompt and the input-output logic in the standard steps configured for the target agent to identify the specific problem. If the instruction description is unclear, the input prompt can be adjusted. If there is a problem with the input-output logic, the step input and step output in the standard instructions can be optimized.
[0142] In another possible implementation, considering that in actual task decomposition, there may be situations where a subtask is particularly difficult (e.g., complex, or with high resource requirements), it may be challenging for a target agent to execute the corresponding standard steps. For example, the medical data to be processed may be too complex, or the medical knowledge involved may be too specialized and intricate, exceeding the processing capacity of the target agent. To improve the processing efficiency and success rate of this subtask, optionally, this embodiment can decompose and replan the difficult subtask before executing step S104, "Construct a medical agent for processing the target medical task based on all target agents."
[0143] That is, for each standard step in the set of standard steps, that is, for each standard step configured for each target agent, the subtask difficulty is evaluated to determine whether the standard step has difficulty. If so, the standard step is decomposed to obtain multiple substeps with lower difficulty than the standard step. The standard step is replaced with multiple substeps to generate target agents corresponding to multiple substeps. The target agents configured with the standard step are replaced with the target agents corresponding to the multiple substeps.
[0144] Optionally, the process of evaluating the subtask difficulty of each standard step in the set of standard steps can be implemented by a task difficulty evaluation agent.
[0145] For example, the prompts used to assess the subtask difficulty of each standard step in the set of standard steps could be:
[0146] "Based on the following [task requirements] and [optional knowledge base], please determine the difficulty of the sub-tasks in this standard step. The evaluation criteria are as follows:"
[0147] 1. Resource Requirements (1-10 points): This includes books, knowledge, tools, etc. The more resources required, the higher the score.
[0148] 2. Execution difficulty, 1-10 points. The higher the difficulty of the steps, the higher the execution difficulty score.
[0149] 3. Input / output complexity, 1-10 points. The higher the difficulty, the more difficult it is if the output of each standard step is different from the input format requirement of the next standard step.
[0150] Based on this standard, determine the difficulty score for each step and the overall task difficulty score, and provide suggestions according to the task objectives:
[0151] 1. Are there any reasonable suggestions for dividing the steps (if so)? Can they be optimized to simplify the operation of each step and make the connection between steps easier, while ensuring that the steps are executable and can achieve the final goal?
[0152] 2. Optimization suggestions for each step (if any), whether the output can be obtained by analyzing the input, and whether the case study is reasonable. Ultimately, the design should be made more reasonable, including the input, output, requirements, and case study.
[0153] Output format: {"Overall Task":{"Score":"","Overall Evaluation":"","Step Division Suggestions":""},"Steps":[{"Step 1":"","Step Score":"","Step Evaluation":"","Step Optimization Suggestions":{"Input":"","Output":"","Judgment Criteria":"","Case Study":""}}]}
[0154] [Task Requirements]:
[0155] {{input["requirement"]}}
[0156] [Optional Knowledge Base]:
[0157] {{input["knowledge"]}}
[0158] [Standard Procedures Set]:
[0159] {{standard_steps}}.
[0160] Of course, the above prompts are merely examples and are not intended to limit this application. In addition, there may be other forms, such as including a "Task Understanding" slot in the prompts.
[0161] In this embodiment of the application, by verifying and replanning the standard steps of the plan from three perspectives—overall rationality, local task executability, and local task difficulty—a comprehensive verification of the plan of this application can be achieved, ensuring that each target intelligent agent can efficiently complete sub-tasks within its capabilities, thereby improving the overall success rate of the task.
[0162] To verify whether the medical agent constructed above can successfully complete the task, this embodiment can also obtain a test task instance of the target medical task after step S104 "construct a medical agent for processing the target medical task based on all target agents", and then test the medical agent according to the test task instance. When testing each target agent, the output data of the target agent is checked to determine whether the output data of the target agent contains content that is not in the input data of the target agent. If so, a first error message indicating that the input and output do not match is generated, so that the target agent can regenerate the output data according to the first error message and the input data and make the judgment again.
[0163] The input data for the first target agent is the test task instance, and the output data for the last target agent is the task result data corresponding to the test task instance.
[0164] Specifically, in this embodiment, a test task instance can be input to the medical intelligent agent, so that each target intelligent agent that makes up the medical intelligent agent can carry out sub-task execution work in the execution order planned above, and then a verification intelligent agent can be used to check and verify the operation of each target intelligent agent.
[0165] In the medical field, output data is generated by an agent through analysis and processing of input data. Therefore, the entire content of the output data must be contained within the input data; theoretically, the agent's output data should not contain content not present in the input data. However, "the entire content of the output data must be contained within the input data" does not mean that the output data is a direct copy of the input data. Rather, it means that the entire content of the output data falls within the scope of the input data. For example, if the input data is about the treatment process for disease A, then the output data cannot be data related to disease B, which is completely unrelated to disease A.
[0166] Therefore, the main verification content of the verification agent in this embodiment is: to detect whether the input data and output data of the target agent match, that is, to detect whether the output data contains content that is not in the input data.
[0167] If the verification agent finds that the subtask results (i.e., output data) output by the target agent have deviations or errors, such as the charging items extracted by the target agent not matching the actual medical services input, it generates a first error message indicating that the input and output do not match. This first error message contains information about where the input and output data do not match. The target agent can then reprocess the task based on the first error message and the input data to obtain new output data, and then perform the above matching verification again, and so on, until the input and output match.
[0168] For example, one possible prompting instruction used by the verification agent could be:
[0169] "Based on the following task requirements, determine: 1) whether the input data and output data match; 2) whether the output format meets the requirements. Output the result as json{"Input and output match":{"Match":"Match|No Match","Analysis":""},"Output format meets requirements":"No|Yes"}."
[0170] [Standard Procedure]:
[0171] {{standard_step}}
[0172] [Input Data]:
[0173] {{input}}
[0174] Output Data:
[0175] {{output}}.
[0176] In this embodiment, the verification agent performs input-output matching verification at each stage of the test task instance execution. If a mismatch occurs, the sub-task is re-executed, which optimizes the execution process of a single task, reduces error propagation, and effectively improves the task success rate.
[0177] Although the above embodiments can ensure that the execution of each subtask satisfies the input-output matching relationship, input-output matching does not mean that the output data meets the requirements. On the contrary, there may be cases where the task result data corresponding to the test task instance does not meet expectations, that is, the task is not executed successfully.
[0178] It should be understood that the failure of the task to be executed is most likely due to the unreasonable set of standard steps planned above. Therefore, optionally, this embodiment can also optimize the plan based on whether the task result data meets expectations.
[0179] That is, in this embodiment, when the medical agent completes the execution of the test task instance, the task result data corresponding to the test task instance can be obtained, and the error feedback agent can determine whether the task result data meets the expectations. If not, the second error information is collected. The second error information includes at least one of the following: the standard steps and target agent where the error occurred, the error form, the error content, etc. The standard step set is adjusted according to the second error information in a third planning until the task result data meets the expectations.
[0180] Here, the adjustment method for the third plan can be the same as that for the first plan mentioned above. For details, please refer to the previous introduction, which will not be repeated here.
[0181] For example, the error feedback agent can comprehensively collect the second error information and then feed it back to the planning agent. The planning agent can then make a third planning adjustment to the standard step set based on the second error information, such as modifying the collaboration order of each standard step in the standard step set and the corresponding target agent, or modifying the prompts and instructions in the preceding text.
[0182] For example, one possible prompting instruction used by the error feedback agent could be:
[0183] "Step Optimization: Based on the following [task requirements], [task understanding], and [feedback evaluation] (optional suggestions), please optimize the specific form of each standard step in the standard step set, including input form, output form, specific executable judgment criteria, and provide a reference case for each step."
[0184] Output format: {"Overall Goal":"","Task Understanding":"","Input Format":"","Output Format":"","Standard Steps":[{"Step Name":"","Step Purpose":"","Step Input":{"Input Name":"","Type":""},"Resources to be Retrieved":[],"Step Output":{"Output Name":"","Type":""}},"Specific Judgment Criteria":[""],"Reference Case":{"Input":{},"Output":{}}}]}
[0185] [Task Requirements]:
[0186] {{input["requirement"]}}
[0187] [Task Understanding]:
[0188] {{steps}}
[0189] [Standard Procedures Set]:
[0190] {{standard_steps}}
[0191] [Feedback and Evaluation]:
[0192] {{review}}.
[0193] The aforementioned feedback evaluation refers to the user's feedback evaluation for each standard step in the standard step set. It can be that the standard step set is output to the user, who then provides the evaluation. This feedback evaluation is an optional slot; if no user interaction is set up, the feedback evaluation may not be included in the instruction.
[0194] Similarly, the above prompts are merely examples and are not intended to limit this application.
[0195] By using an error feedback mechanism based on task outcome data, the planning of target medical tasks can be further optimized, thereby improving the success rate of the tasks.
[0196] In one possible implementation, considering that the core of each of the aforementioned agents (including but not limited to task understanding agent, planning agent, verification agent, error feedback agent, task difficulty assessment agent, experience summarization agent, step optimization agent, etc.) is a large language model, in order to improve the ability of the large language model to understand the target medical task, the large language model can be trained by combining the input and output of the medical agent, such as reinforcement learning and supervised fine-tuning (SFT (Supervised Fine-Tuning, which uses labeled medical data to train the LLM in a targeted manner).
[0197] In order to train large language models more accurately, this embodiment can obtain the following two types of datasets as training data.
[0198] First dataset: Each data pair in the first dataset consists of a first test task instance and the first planning data corresponding to the first test task instance.
[0199] The second dataset contains each data pair consisting of a second test task instance, the first planning data corresponding to the second test task instance, and the second planning data corresponding to the second test task instance. More specifically, each data pair in the second dataset includes a positive preference data pair and a negative preference data pair. The positive preference data pair consists of the second test task instance and its corresponding first planning data, and the negative preference data pair consists of the second test task instance and its corresponding second planning data.
[0200] Here, the planning effect of the first planning data is higher than that of the second planning data. More specifically, the task result data obtained by processing the second test task instance according to the first planning data is more in line with expectations than the task result data obtained by processing the second test task instance according to the second planning data.
[0201] Here, the first planning data and the second planning data include a standard data set. Optionally, the first planning data and the second planning data may also include prompts and instructions from the previous stages.
[0202] In this embodiment, the generation process of the first and second datasets can be implemented by an experience-summarizing agent. Optionally, the experience-summarizing agent can determine the first and second planning data according to the following rules:
[0203] Rule 1: The final planning data (first planning data) is better than the planning data of the intermediate optimization stage (second planning data);
[0204] Rule 2: Planning data with positive user feedback (first planning data) is better than planning data with no feedback or negative feedback (second planning data).
[0205] Rule 3: Planning data that follows the output format (first planning data) is better than planning data that does not follow the output format (second planning data).
[0206] Rule 4: Planning data obtained based on user feedback (first planning data) is better than planning data before feedback (second planning data).
[0207] Furthermore, in this embodiment, a supervised fine-tuning loss can be generated based on the first dataset, and a direct preference optimization loss can be generated based on the second dataset. Finally, the target large language model is trained based on the supervised fine-tuning loss and the direct preference optimization loss. The target large language model includes at least one of the following agents: a task understanding agent, a planning agent, a verification agent, an error feedback agent, a task difficulty assessment agent, an experience summarization agent, and a step optimization agent. The planning agent is used to plan and generate standard steps, the experience summarization agent is used to generate the first and second datasets, and the step optimization agent is used to implement the first planning adjustment, the second planning adjustment, and the third planning adjustment.
[0208] See formula (1) for the calculation of supervised fine-tuning loss, and see formula (2) for the calculation of direct preference optimization loss, where DPO represents direct preference optimization.
[0209] Formula (1);
[0210] Formula (2);
[0211] in, Indicates the first dataset. This represents the second dataset. This represents the parameters of the large language model before optimization. This represents the parameters of the optimized large language model. This represents the first planning data. This indicates the second planning data. This refers to a test task instance (i.e., the first and second test task instances mentioned above). This indicates the loss from monitoring and fine-tuning. This represents the direct preference optimization loss. and The known parameters are those used in the formula for calculating the loss of direct preference optimization.
[0212] In this embodiment, in order to train the target large language model, the supervised fine-tuning loss and the direct preference optimization loss can be fused to obtain the total loss, and then the target large language model can be trained.
[0213] Optionally, the method of fusing the supervised fine-tuning loss and the direct preference optimization loss can be weighted fusion, that is, using a preset weight hyperparameter to weight and sum the supervised fine-tuning loss and the direct preference optimization loss to obtain the total loss, as shown in the following formula (3).
[0214] Formula (3);
[0215] in, This represents the preset weight hyperparameters, i.e., the weight hyperparameters used in SFT and DPO training. This indicates the total loss.
[0216] In this embodiment, by constructing a large amount of first planning data and second planning data, and after accumulating a certain amount, the target large language model can be trained periodically using the training loss of SFT and DPO, which can effectively improve the overall medical intelligent agent construction capability.
[0217] In order to improve the medical intelligence agent's ability to handle target medical tasks, this embodiment also provides the following multi-faceted human-computer interaction methods.
[0218] The first method: In this embodiment, the basic steps can be output and displayed, thereby obtaining the user's first feedback result on the basic steps displayed. If the first feedback result indicates that the basic steps should be modified, the basic steps to be modified are modified according to the first feedback result, and the sub-task agents are reassigned to the modified basic steps. The previous stages are repeated until the medical agent is constructed.
[0219] The second method is to output and display the step details, thereby obtaining the user's second feedback result on the output step details. If the second feedback result indicates that the step details to be modified should be modified according to the second feedback result.
[0220] The third approach is to display the task result data output by the medical intelligent agent for the test task instance, thereby obtaining the third feedback result from the user regarding the displayed task result data. If the third feedback result indicates that the task result data does not meet expectations, the standard step set is adjusted according to the third feedback result as described above.
[0221] See Figure 3 The diagram shown is a schematic representation of a human-computer interaction interface provided in this application. The left side represents user input, and the right side represents the outputs of each intelligent agent. Figure 3 After the user inputs the task requirements, the task understanding agent and the planning agent collaborate to complete the task planning, obtaining a task planning result (a set of standard steps, including basic steps and step details). This task planning result can be output and displayed to the user, who can then judge whether the plan meets the requirements. If the user needs to modify the plan, they can input a first feedback result and / or a second feedback result, allowing the step optimization agent to update the task plan and provide feedback to the user again for verification. Once the user confirms that the plan is correct, a medical agent can be generated, and the user can input violation cases (such as test task instances). The task execution result data can then be obtained, and the user can verify it again. At this point, the user can input a third feedback result to further adjust the plan, thereby updating the medical agent, and so on.
[0222] The multi-user interactive medical agent construction method provided in this embodiment allows users to quickly construct a medical agent without writing code by simply inputting text-based task requirements and feedback results. This greatly reduces the barrier to entry and significantly improves the efficiency of medical agent construction.
[0223] To enable those skilled in the art to better understand this application, please refer to Figure 4 This is a schematic diagram illustrating the construction process of a medical intelligent agent provided in this application.
[0224] After the user inputs the task requirements, the task can be processed sequentially by the task understanding agent (intelligent agent), the planning and verification agent (including the planning agent and the verification agent), the task difficulty evaluation agent, and the step optimization agent to obtain the initially constructed medical intelligent agent.
[0225] Furthermore, violation cases can be input into the initially constructed medical AI agent, which can then analyze these cases and perform multi-dimensional matching with the three medical insurance catalogs to obtain structured output. During the analysis process, after each target agent completes its execution, a verification agent matches the input and output data of the target agent. If the match is correct, the next target agent is executed, and so on, until structured task result data is obtained.
[0226] Furthermore, the latest plan can be adjusted using the second error information generated by the error feedback agent. On the other hand, the second error information can be fed back to the experience summarization agent to help the experience summarization agent generate the first and second datasets. Then, reinforcement learning and / or SFT methods can be used to train the large language model in each agent.
[0227] In this embodiment, the medical intelligent agent construction method using human-computer interaction and multi-stage optimization not only lowers the threshold for use, but also allows for the rapid construction of medical intelligent agents that better meet the needs. Furthermore, the multi-stage optimization mechanism continuously improves the overall task success rate of the system.
[0228] The above describes a method for constructing a medical intelligent agent according to embodiments of this application. The following describes the apparatus for performing the above-described method for constructing a medical intelligent agent.
[0229] Please see Figure 5 , Figure 5 This is a schematic diagram of a medical intelligent agent construction device provided in an embodiment of this application. Figure 5 As shown, the medical intelligent agent construction device may include:
[0230] Data input unit 501 is used to obtain the task requirements of the target medical task;
[0231] The first planning unit 502 is used to understand the task requirements and plan coarse-grained steps to obtain task understanding information and a set of basic steps that the task execution depends on. The set of basic steps includes multiple ordered basic steps.
[0232] The second planning unit 503 is used to assign sub-task agents to each basic step, and configure the standard steps to be executed by the sub-task agents according to the task requirements, task understanding information and basic steps. The standard steps are obtained by adding step details to the basic steps corresponding to the sub-task agents. The step details include step input, step output and resource retrieval. The step input is determined according to the step output of the preceding basic steps.
[0233] The agent building unit 504 is used to take the subtask agents configured with standard steps as target agents and build a medical agent for handling target medical tasks based on all target agents.
[0234] Each module in the aforementioned medical intelligent agent construction device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0235] This application also provides an electronic device, which may include at least one processor and a memory connected to the processor, wherein:
[0236] Memory is used to store computer programs;
[0237] The processor is used to execute computer programs to enable electronic devices to implement any of the medical intelligent agent construction methods provided in the embodiments of this application.
[0238] refer to Figure 6 The diagram illustrates a structural schematic suitable for implementing the electronic device in the embodiments of this application. The electronic device in the embodiments of this application may include, but is not limited to, fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 6 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0239] like Figure 6 As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. When the electronic device is powered on, the RAM 603 also stores various programs and data required for the operation of the electronic device. The processing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0240] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, memory cards, hard drives, etc.; and communication devices 609. Communication device 609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0241] This application also provides a computer program product including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the medical intelligent agent construction methods provided in this application.
[0242] This application also provides a computer-readable storage medium carrying one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the medical intelligent agent construction methods provided in this application.
[0243] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0244] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0245] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0246] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A method for constructing a medical intelligent agent, characterized in that, include: Obtain the task requirements for the target medical mission; The task requirements are understood and coarse-grained step planning is performed to obtain task understanding information and a set of basic steps that the task execution depends on. The set of basic steps includes multiple ordered basic steps. A subtask agent is assigned to each of the basic steps, and a standard step is configured to be executed by the subtask agent according to the task requirements, the task understanding information and the basic steps. The standard step is obtained by adding step details to the basic step corresponding to the subtask agent. The step details include step input, step output and resource retrieval. The step input is determined according to the step output of the preceding basic step. The subtask agent configured with the standard steps is used as the target agent. Based on all the target agents, a medical agent is constructed to handle the target medical task.
2. The method for constructing a medical intelligent agent according to claim 1, characterized in that, The process of understanding the task requirements and planning coarse-grained steps yields a set of basic steps for task understanding and task execution dependencies, including: Based on the task requirements, a task understanding prompt instruction is generated. The task understanding prompt instruction is used to prompt the task understanding agent to retrieve knowledge related to the task requirements from the knowledge base, perform a deep understanding of the task requirements based on the retrieved knowledge, and plan it into feasible steps with step objectives. The task understanding prompt is input into the task understanding agent to obtain the task understanding information and the basic step set, wherein the basic steps in the basic step set include a step name and a step purpose.
3. The method for constructing a medical intelligent agent according to claim 1 or 2, characterized in that, Before constructing a medical agent for handling the target medical task based on all the target agents, the method further includes: An overall rationality analysis is performed on the set of standard steps to determine whether it meets the overall rationality requirements. The overall rationality requirements are that the set of standard steps covers all task dimensions of the target medical task without omission and has no logical loopholes. The set of standard steps includes the standard steps configured by each of the target agents. If not, then the set of standard steps is adjusted in a first planning step until the overall rationality requirement is met.
4. The method for constructing a medical intelligent agent according to claim 3, characterized in that, Before constructing a medical agent for handling the target medical task based on all the target agents, the method further includes: For each of the target agents: Simulated input data is generated for the target intelligent agent and input into the target intelligent agent to obtain the subtask results corresponding to the simulated input data; Determine whether the result of the subtask has completed the objective of the standard steps configured for the target agent; If not, a second planning adjustment is made to the step details and / or input prompts of the standard steps configured for the target agent; until the subtask result can accomplish the purpose of the step, the input prompts are used to prompt the generation of the standard steps configured for the target agent.
5. The method for constructing a medical intelligent agent according to claim 4, characterized in that, Before constructing a medical agent for handling the target medical task based on all the target agents, the method further includes: For each standard step in the set of standard steps: The task difficulty assessment agent evaluates the sub-task difficulty of the standard step to determine whether the standard step is difficult. If so, the standard step is broken down into multiple sub-steps that are less difficult than the standard step, and the standard step is replaced by the multiple sub-steps. Generate target agents corresponding to the multiple sub-steps respectively, and replace the target agent configured for the standard step with the target agents corresponding to the multiple sub-steps respectively.
6. The method for constructing a medical intelligent agent according to claim 1 or 5, characterized in that, After constructing a medical agent for handling the target medical task based on all the target agents, the process further includes: Obtain a test task instance of the target medical task; The medical intelligent agent is tested according to the test task instance. When each target intelligent agent is tested, the output data of the target intelligent agent is determined by the verification agent to determine whether the output data of the target intelligent agent contains content that is not in the input data of the target intelligent agent. If so, a first error message indicating a mismatch between input and output is generated, so that the target agent can regenerate the output data based on the first error message and the input data and make the judgment again.
7. The method for constructing a medical intelligent agent according to claim 6, characterized in that, Also includes: When the medical intelligent agent finishes executing the test task instance, it obtains the task result data corresponding to the test task instance. The error feedback agent determines whether the task result data meets expectations. If not, a second error message is collected. The second error message includes at least one of the following: the standard steps and target agent where the error occurred, the error form, and the error content. Based on the second error message, a third planning adjustment is made to the standard procedure set until the task result data meets expectations.
8. The method for constructing a medical intelligent agent according to claim 7, characterized in that, Also includes: Obtain a first dataset, wherein each data pair contained in the first dataset consists of a first test task instance and the first planning data corresponding to the first test task instance; Obtain a second dataset. Each data pair in the second dataset consists of a second test task instance, first planning data corresponding to the second test task instance, and second planning data corresponding to the second test task instance. The planning effect of the first planning data is higher than the planning effect of the second planning data. The first planning data and the second planning data include a set of standard steps. A supervised fine-tuning loss is generated based on the first dataset, and a direct preference optimization loss is generated based on the second dataset; The target large language model is trained based on the supervised fine-tuning loss and the direct preference optimization loss. The target large language model includes at least one of the following large language models: a task understanding agent, a planning agent, a verification agent, an error feedback agent, a task difficulty assessment agent, an experience summarization agent, and a step optimization agent. The planning agent is used to plan and generate the standard steps. The experience summarization agent is used to generate the first dataset and the second dataset. The step optimization agent is used to implement the first planning adjustment, the second planning adjustment, and the third planning adjustment.
9. The method for constructing a medical intelligent agent according to claim 1, characterized in that, Before constructing a medical agent for handling the target medical task based on all the target agents, using the subtask agents configured with the standard steps as target agents, the method further includes: The basic steps are output and displayed. The user's first feedback result on the output and displayed basic steps is obtained. If the first feedback result indicates that the basic steps should be modified, the basic steps to be modified are modified according to the first feedback result, and the sub-task agents are reassigned to the modified basic steps. And / or, output and display the step details, obtain the user's second feedback result on the output and displayed step details, and if the second feedback result indicates that the step details to be modified are modified according to the second feedback result.
10. A computer program product, characterized in that, It includes computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the medical agent construction method as described in any one of claims 1 to 9.
11. An electronic device, characterized in that, It includes at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to enable the electronic device to implement the medical intelligent agent construction method as described in any one of claims 1 to 9.
12. A computer storage medium, characterized in that, The storage medium carries one or more computer programs that, when executed by an electronic device, enable the electronic device to implement the medical intelligent agent construction method as described in any one of claims 1 to 9.
Citation Information
Cited By
Clinical multi-agent task sequence generation method and system
CN122091138A