Traditional Chinese medicine diagnosis scene simulation method based on large model agent collaborative planning
Through the multi-agent system, multiple agents are simulated and multiple agents are constructed for multiple rounds of interaction, which solves the problem of insufficient information integration and reasoning capabilities of the existing intelligent consultation system, and realizes comprehensive and accurate simulation of the traditional Chinese medicine diagnosis process, improving the accuracy and transparency of the diagnosis.
Patent Information
- Application Number
- CN202510385785.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-29
- Publication Date
- 2025-07-11
AI Technical Summary
The existing intelligent consultation system has insufficient information integration capabilities, lack of complex reasoning capabilities and single-role diagnostic limitations in traditional Chinese medicine diagnosis, resulting in insufficient comprehensive and accurate diagnosis process and lack of scientific evaluation of the traditional Chinese medicine theoretical system.
Multi-agent system is used to simulate the Chinese medicine consultation situation, design multi-dimensional patient clinical information structured templates, and build multiple agent roles such as patients, doctors, assistants and experts. Through multiple rounds of interaction and collaborative reasoning, the semantic understanding and dialogue generation ability of the large language model can be used to realize the simulation and reproduction of the Chinese medicine diagnosis and treatment process.
It improves the accuracy and transparency of traditional Chinese medicine diagnosis, can dynamically adjust interactive strategies according to the characteristics of different cases, generate diagnosis and treatment dialogues and plans that conform to the theoretical system of traditional Chinese medicine, and provide innovative support for traditional Chinese medicine teaching, clinical assistance and knowledge inheritance.
Smart Images

Figure CN120299726A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of natural language processing and artificial intelligence, and particularly relates to a method for simulating traditional Chinese medicine diagnosis scenarios based on large model intelligent agent collaborative planning. Background Art
[0002] Traditional Chinese medicine (TCM), as a traditional medical system with a history of thousands of years, has its unique theoretical basis and diagnosis and treatment methods. TCM diagnosis includes the process of synthesizing the four diagnostic methods (inspection, auscultation and olfaction, interrogation, and palpation) and syndrome differentiation and treatment. By comprehensively considering the patient's subjective symptoms, objective signs, and pathological changes, a comprehensive diagnosis and personalized treatment are carried out. The diagnostic methods of TCM emphasize the concept of wholism and at the same time distinguish the individual differences of patients. Therefore, the diagnostic process is complex and often depends on the doctor's experience and knowledge accumulation. The development of large language model-related technologies has brought new development paths for the intelligent diagnosis process of TCM. However, in the existing technologies, intelligent interrogation systems often have the following limitations: (1) insufficient information integration ability. Existing intelligent interrogation systems often can only process single-dimensional patient information (such as symptom descriptions), lacking the comprehensive integration of multi-dimensional and multi-angle patient information, resulting in an incomplete and inaccurate diagnostic process; (2) lack of complex reasoning ability. Many existing intelligent interrogation systems lack complex reasoning ability when faced with complex symptoms or atypical cases, and are prone to misdiagnosis or missed diagnosis; (3) single-role diagnostic perspective. Traditional intelligent interrogation systems usually only have the "doctor role", lacking multi-angle analysis and judgment, making the diagnostic results often limited to the machine's preset standards or empirical data. On the other hand, how to scientifically and objectively evaluate the diagnostic capabilities of each model is also an important challenge at present.
[0003] Multi-agent technology (MAS) originated from the fields of artificial intelligence and distributed computing, and refers to a system composed of multiple intelligent agents (Agents). These intelligent agents can make autonomous decisions, cooperate with each other, and interact with the environment. Each intelligent agent usually has certain perception, decision-making, and action capabilities, and multiple intelligent agents solve complex problems or complete tasks through mutual coordination, cooperation, or competition. Traditional intelligent interrogation systems usually rely on one-level logical reasoning and decision-making rules, lacking in-depth multi-dimensional analysis; in contrast, multi-agent systems can conduct multi-round dynamic interactions by establishing multiple roles. Using multi-agent technology to simulate the actual clinical diagnosis process, allowing large language models to play different roles, obtain different information, and give the final diagnostic result through a multi-round interaction and reasoning process. This hierarchical and role-based simulation of TCM diagnosis scenarios not only improves the accuracy of diagnosis, but also enhances the transparency and reliability during the diagnostic process. At the same time, the system can dynamically adjust the interaction strategy according to the characteristics of different cases, generate diagnostic conversations and treatment plans that conform to the TCM theoretical system, and provide innovative technical support for TCM teaching and training, clinical assistance, knowledge inheritance, and TCM large model evaluation. Summary of the Invention
[0004] In view of the above, in order to address the above technical problems, the present invention provides a method for simulating traditional Chinese medicine diagnosis scenarios based on large model intelligent agent collaboration planning, including the following steps:
[0005] Step 1: Design a structured template for multi-dimensional patient clinical information, and use a large language model and the structured template to convert the unstructured medical record information in the original medical record into structured medical record data;
[0006] Step 2: Classify and allocate the structured medical record data and design a role template to construct intelligent agents based on the traditional Chinese medicine scenario of the large model;
[0007] Step 3: Design an intelligent agent collaboration mechanism for simulating the traditional Chinese medicine diagnosis process, dynamically select intelligent agents of corresponding roles for interaction in the form of dialogue, and retain the context dialogue content;
[0008] Step 4: Use the intelligent agents and the intelligent agent collaboration mechanism to highly simulate and reproduce the traditional Chinese medicine diagnosis scenario by controlling the dialogue content generation and decision-making behaviors of the intelligent agents of each role.
[0009] Further, Step 1 includes the following steps:
[0010] Step 101: Design a structured template for multi-dimensional patient clinical information, and the structured template includes core dimension information such as "basic patient information, main symptoms, four diagnostic results, diagnosis conclusion, treatment principle, prescription medication, and clinical understanding of famous traditional Chinese medicine doctors";
[0011] Step 102: Utilize the semantic understanding ability of the large language model to achieve the mapping between the original medical record and the structured template, thereby extracting relevant information and combining with reference examples to form corresponding structured medical record data.
[0012] Further, Step 2 includes the following steps:
[0013] Step 201: Classify and divide the obtained structured medical record data D to obtain three major categories of subjective information I subj , objective information I obj and diagnostic information I diag , and satisfy D = I subj ∪I obj ∪I diag ;
[0014] Step 202: Based on the design of the large language model and the role template, construct multiple intelligent agent roles in the traditional Chinese medicine diagnosis scenario, including the patient intelligent agent Agent pt , assistant intelligent agent Agent asst , doctor intelligent agent AgentDr and the expert agent exp ;
[0015] Step 203, assign the subjective information I subj to the patient agent pt , and assign the objective information I obj to the assistant agent asst , the doctor agent Dr is default not to have the task of patient information, and the expert agent exp is assigned to have all the information.
[0016] Furthermore, the said Step 202 includes the following steps:
[0017] Step 20201: Build a unified large language model call framework, standardize the management of the large model interface through the Python SDK of OpenAI. For closed-source models, use their official API interfaces for calls; for open-source models, implement local deployment based on the high-performance vllm inference acceleration framework and encapsulate it as a local API interface;
[0018] Step 20202: Through the unified large language model API interface, design the patient role prompt template P pt ;
[0019] P pt = f prompt (I subj , R pt );
[0020] where f prompt is the prompting process, I subj is the subjective information, and R pt is the patient role definition, used to build the patient agent pt , enabling the patient to accurately reply to the doctor's questions based on their subjective information;
[0021] Step 20203: Through the unified large language model API interface, design the assistant role prompt template P asst ;
[0022] P asst = f prompt (I obj , R asst );
[0023] where f prompt is the prompting process, I obj is the objective information, and R asst is the assistant role definition, building the assistant agentasst , enabling the assistant to accurately reply to the doctor's questions based on its own objective information;
[0024] Step 20204: Design a doctor role prompt template P through a unified large language model API interface Dr ;
[0025]
[0026] Among them, f prompt is the prompting process, R Dr is the doctor role definition and initially does not hold patient information, and construct a doctor agent Dr , enabling the doctor to conduct multiple rounds of inquiries on the patient, collect necessary objective information from the assistant, and give a diagnosis result and diagnosis basis by integrating all the information;
[0027] Step 20205: Design an expert role prompt template Prompt through a unified large language model API interface exp , and construct an expert agent exp , enabling the expert to generate a traditional Chinese medicine case report and a diagnosis quality assessment opinion based on all the information collected.
[0028] Furthermore, step 3 includes the following steps:
[0029] Step 301, define the dialogue history set H t ={(s i , m i )|i = pt, Dr, asst, exp}; where i represents the serial number of different role agents, pt, Dr, asst, exp are different roles, s i represents the corresponding role agent, and m i represents the dialogue content of the corresponding role agent;
[0030] Step 302, require the patient agent to generate dialogue content m pt = f pt (I subj ) that conforms to the main complaint expression in the context of traditional Chinese medicine according to the assigned subjective information, and add it to the dialogue history set H t ; where I subj is the subjective information, and f pt is the generation process of the patient agent's dialogue content;
[0031] Step 303, require the assistant agent to generate the assistant's dialogue content m asst = f asst (I obj ) according to the assigned objective information, and add it to the dialogue history set Ht ; where I obj is objective information, and f asst is the generation process of the assistant agent's conversation content;
[0032] Step 304, the doctor agent needs to generate the conversation content m of the next round of diagnostic inquiry based on the conversation content between the patient agent and the assistant agent and the conversation history set Dr = f Dr (m pt , m asst , H t ) and add the inquiry content to the conversation history set H t ; where f Dr is the generation process of the doctor agent's conversation content;
[0033] Step 305, construct an intelligent routing by combining the large language model and prompt engineering, and judge the type of the conversation content T(m Dr ) ∈ {T subj , T obj , T diag}, where T subj , T obj , T diag respectively represent seeking subjective information, seeking objective information, and giving a diagnosis result, and dynamically determine the best response agent A for the next round of conversation according to the type of the conversation content next ∈ {Agent pt , Agent asst , Agent exp}; Agent pt , Agent asst , Agent exp respectively represent the doctor agent, the assistant agent, and the expert agent;
[0034] Step 306, the selected best response agent A next needs to reply to the doctor agent's inquiry according to the allocated information. At the same time, the doctor agent generates the next round of questions or the final diagnosis result based on the reply, and adds all the conversation content to the conversation history set H t ;
[0035] Step 307, the intelligent routing judges the type of the doctor agent's conversation content T(m Dr ), dynamically determines the best response agent A for the next round of conversation, and monitors the diagnosis process in real time; when it detects that T(m next ) = T Dr ) = T diag , the intelligent routing gives a diagnosis completion signal;
[0036] Step 308, loop through steps 302 to 307 until the preset maximum dialogue turn threshold t is reached max Or the intelligent routing outputs a clear diagnosis completion signal to end the diagnostic dialogue.
[0037] Further, step 4 includes the following steps:
[0038] Initialize the agents of each role through a unified large language model call framework, and realize the dynamic cooperation and information interaction of each agent by constructing an agent cooperation mechanism. The patient agent provides subjective symptoms, the assistant agent provides auxiliary examination results as objective information, and the doctor agent gradually collects all information through active interrogation and comprehensively analyzes it, and finally generates a diagnosis result and diagnostic basis (D result ,D basis );
[0039] Step 402: Transmit the complete dialogue history set H t and the diagnosis result and diagnostic basis (D result ,D basis ) of the doctor agent to the expert agent Agent exp , generate a standardized traditional Chinese medicine case report and a diagnostic quality evaluation opinion, and save the generated report and evaluation opinion.
[0040] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0041] The present invention adopts a multi-agent system to simulate the traditional Chinese medicine interrogation scenario. Through multi-round interactive dialogues simulating various roles such as patients, doctors, and assistants, compared with the traditional single intelligent model, it can more realistically and comprehensively restore the complex scenario in the traditional Chinese medicine diagnosis and treatment process;
[0042] The system can dynamically adjust the interaction strategy according to different case characteristics, generate diagnostic dialogues and solutions that conform to the traditional Chinese medicine theory system, and provide innovative technical support for traditional Chinese medicine teaching training, clinical assistance and knowledge inheritance, and traditional Chinese medicine large model evaluation. Description of the Drawings
[0043] Figure 1 Shows a schematic flowchart of the implementation method of the present invention; Detailed Embodiment
[0044] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0045] For the sake of citation and clarity, the technical terms, abbreviations, or acronyms used hereinafter are summarized and explained as follows:
[0046] Prompt: The prompt words input to the language model to guide the output of the language model.
[0047] TCM: Traditional Chinese Medicine, traditional Chinese medicine.
[0048] SDK: Python software development kit, which is a collection of libraries, tools, and documentation, allowing developers to interact with specific services or platforms using the Python language.
[0049] Agent: An intelligent agent refers to an agent that can perceive the environment and take actions to achieve specific goals.
[0050] API: Application Programming Interface, application programming interface.
[0051] VLLM: An efficient large language model inference and deployment framework.
[0052] The present invention discloses a method for simulating a traditional Chinese medicine diagnosis scenario based on large model intelligent agent collaborative planning to solve many problems existing in the prior art.
[0053] Figure 1 The flowchart of the embodiment of the present invention is shown. A method for simulating a traditional Chinese medicine diagnosis scenario based on large model intelligent agent collaborative planning includes the following steps:
[0054] Step 1, design a structured template for multi-dimensional patient clinical information, and use the large language model and the structured template to convert the unstructured medical record information in the original medical record into structured medical record data;
[0055] Step 2, classify and allocate the structured medical record data and design a role template to construct an intelligent agent based on the traditional Chinese medicine scenario of the large model;
[0056] Step 3: Design an intelligent agent collaboration mechanism for simulating the traditional Chinese medicine diagnosis process, dynamically select intelligent agents with corresponding roles for interaction in the form of dialogue, and retain the context of the dialogue content;
[0057] Step 4: Use the intelligent agents and the intelligent agent collaboration mechanism to highly simulate and reproduce the traditional Chinese medicine diagnosis scenario by controlling the dialogue content generation and decision-making behaviors of the intelligent agents with each role.
[0058] Execute Step 1.
[0059] Specifically, design a structured template for multi-dimensional patient clinical information, and use the large language model and the structured template to convert the unstructured medical record information in the original medical record into structured medical record data, including the following steps:
[0060] Step 101: Design a structured template for multi-dimensional patient clinical information. The structured template includes core dimension information such as "basic patient information, main symptoms, four diagnostic results, diagnosis conclusion, treatment principle, prescription medication, and clinical understanding of famous traditional Chinese medicine doctors".
[0061] Step 102: Use the semantic understanding ability of the large language model to realize the mapping between the original medical record and the structured template, so as to extract relevant information and combine with reference examples to form corresponding structured medical record data.
[0062] Specifically, the reference example of patient information is as follows:
[0063] Patient information: Yu, female, 52 years old;
[0064] Consultation information: This patient has suffered from asthma for many years and often relapses. Last winter, the cold symptoms worsened, with shortness of breath, audible wheezing, chest tightness, mild cough, and less, thin, white, foamy sputum. The patient has a pale complexion, likes warm drinks, and often feels cold, especially on the back;
[0065] Other information: The tongue coating is white, slippery, and moist, and the pulse is thin and stringy. Although treated with various Chinese and Western medicines, the symptoms have not been relieved;
[0066] Diagnosis: Cold-dampness stagnates in the lungs, blocking the airway and causing impaired lung function;
[0067] Note: This case involves chronic asthma, which recurs frequently due to endogenous wind-phlegm and exogenous wind-cold. The symptoms include thin and white sputum, preference for warm drinks, fear of cold, and white, slippery tongue coating, indicating cold-dampness in the lungs. During an attack, shortness of breath, wheezing, mild cough, and chest tightness indicate cold-dampness blocking the lungs. This is classified as "cold-type asthma". The treatment strategy should focus on warming the lungs, dispelling cold, resolving phlegm, and relieving asthma.
[0068] In practical applications, departments can also be divided according to the structured medical record data, and the structured medical record data of each department can be uniformly processed; examples of the departments include, but are not limited to, the department of cardiology and encephalopathy, the department of lung diseases, the department of otolaryngology, the department of gynecology and pediatrics, the department of hepatobiliary and nephrology, the department of spleen and stomach, and the department of surgery.
[0069] Execute step 2.
[0070] Specifically, classifying and allocating the structured medical record data and designing a role template, and constructing an intelligent agent based on the traditional Chinese medicine scenario of the large model, including the following steps:
[0071] Step 201: Classify and divide the obtained structured medical record data D to obtain three major categories of subjective information I subj , objective information I obj and diagnostic information I diag , and satisfy D = I subj ∪I obj ∪I diag ;
[0072] Among them, the subjective information includes information such as "symptoms, current medical history, past medical history, and personal history", the objective information includes information such as "tongue image, facial image, pulse condition, and modern medical examination results", and the diagnostic information includes information such as "syndrome differentiation, diagnosis result, and diagnostic basis".
[0073] Step 202: Based on the design of the large language model and the role template, construct multiple intelligent agent roles in the traditional Chinese medicine diagnosis scenario, including the patient intelligent agent Agent pt , assistant intelligent agent Agent asst , doctor intelligent agent Agent Dr and expert intelligent agent Agent exp ;
[0074] Step 203: Allocate the subjective information T subj to the patient intelligent agent Agent pt , allocate the objective information I obj to the assistant intelligent agent Agent asst , the doctor intelligent agent Agent Dr is default not to have the task of patient information, and the expert intelligent agent Agent exp is allocated to have all the information.
[0075] Specifically, in step 202, based on the design of the large language model and the role template, constructing multiple intelligent agent roles in the traditional Chinese medicine diagnosis scenario includes the following steps:
[0076] Step 20201: Construct a unified large language model call framework;
[0077] Standardize the management of large model interfaces through the Python SDK of OpenAI. For closed-source models, use their official API interfaces for calls; for open-source models, implement local deployment based on the high-performance vllm inference acceleration framework and encapsulate it as a local API interface;
[0078] Step 20202: Design the patient role prompt template P through the unified large language model API interface pt ;
[0079] P pt = f prompt (I subj , R pt );
[0080] Among them, f prompt is the prompting process, I subj is subjective information, and R pt is the patient role definition, used to construct the patient agent pt , enabling the patient to accurately respond to the doctor's questions based on their subjective information;
[0081] Furthermore, for the patient agent, its role definition is:
[0082] You are now a patient seeking medical advice from an experienced traditional Chinese medicine doctor. Please strictly follow the following requirements: (1) Keep close to the medical record information: Conduct examinations strictly according to the recorded symptom information, do not add symptoms not mentioned in the medical record, and convert professional symptom descriptions into everyday language. (2) Pay attention to the historical conversation: Follow the context and information mentioned in the previous conversation, avoid contradictions, and continue the conversation based on the stated symptoms. (3) Keep the initial description of symptoms brief: Only mention 1-2 of the most severe symptoms in the initial description of the main symptoms, and briefly describe the symptoms in everyday language. (4) Respond to the doctor's questions: Answer specific symptoms according to the case information, use spoken language, express the information in the medical record in everyday language, do not add information that does not exist in this medical record, and if the information requested by the doctor does not exist in the medical record, answer "not clear". (5) Principle of response: Do not mention too many symptoms at once to avoid sounding unnatural, describe concisely and naturally, do not use too many professional terms, and always be consistent with the symptom information in this medical record.
[0083] Step 20203: Design the assistant role prompt template P through the unified large language model API interface asst ;
[0084] P asst = f prompt (I obj , R asst );
[0085] Among them, fprompt For the prompting process, I obj For objective information, R asst For the assistant role definition, construct the assistant intelligent agent Agent asst so that the assistant can accurately reply to the doctor's questions based on its own objective information;
[0086] Furthermore, for the assistant intelligent agent, its role definition is as follows:
[0087] You are a traditional Chinese medicine assistant, mastering the patient's pulse diagnosis, tongue diagnosis and test results, and currently communicating with a doctor. Please follow the following guidelines: (1) Provide information according to the question: When the doctor asks about the pulse, tongue or test results, directly answer the relevant information. (2) If the relevant information is missing or the requested information is unavailable, answer "No relevant information". (3) Be concise, objective and accurate, only provide key information, and avoid unnecessary details. (4) Remain neutral: Convey information objectively without making personal interpretations.
[0088] Step 20204: Design the doctor role prompt template P through the unified large language model API interface Dr ;
[0089]
[0090] Among them, f prompt For the prompting process, R Dr For the doctor role definition and initially not holding patient information, construct the doctor intelligent agent Agent Dr so that the doctor can conduct multi-round consultations with the patient, collect necessary objective information from the assistant, and give a diagnosis result and diagnosis basis by integrating all the information;
[0091] Furthermore, for the doctor intelligent agent, its role definition is as follows:
[0092] As an experienced traditional Chinese medicine doctor, your responsibility is to conduct inquiries to assess the patient's condition and symptoms. For information that cannot be obtained through patient conversations, such as observation results, pulse diagnosis, and test results, you must interact with the assistant doctor. When communicating with the assistant, add "<To assistant>" before the output. Use the information collected to conduct a detailed differential diagnosis based on traditional Chinese medicine theory to identify potential diseases. (1) Avoid making premature diagnoses when there is insufficient information. (2) Actively ask the patient multiple questions to collect sufficient information. (3) Ask only one question at a time and keep it concise. (4) Once sufficient information is obtained, provide the diagnosis result and the corresponding reasons for the diagnosis in a timely manner. (5) The diagnosis result should include the disease name and the traditional Chinese medicine syndrome type. (6) Note: Do not ask the patient too many questions at once to avoid confusion. (7) Important reminder: In your final response, be sure to provide the diagnosis result and detailed diagnostic basis. (8) Important reminder: After providing the diagnosis result and basic principles, do not ask the patient any more questions. (9) When information such as tongue diagnosis, pulse diagnosis, or tests is required and cannot be obtained through conversations with the patient, add "<to assistant>" before your output and then make a query request to the assistant.
[0093] Step 20205: Design an expert role prompt template Prompt through the unified large language model API interface exp , and build an expert agent Agent exp , enabling the expert to generate a traditional Chinese medicine case report and a diagnostic quality evaluation opinion based on all the information collected.
[0094] Furthermore, for the expert agent, its role definition is as follows:
[0095] As a senior traditional Chinese medicine clinical expert, you need to complete the following tasks: (1) Review the conversation content of the simulated consultation process, focusing on the interaction content among the doctor, patient, and assistant. (2) Compare the patient-related content with the subjective information in the original case, compare the assistant-related content with the objective information in the original case, and compare the doctor's diagnosis information and basis with the diagnosis information in the original case. (3) Based on the comparison between the simulated consultation process and the real case data, generate a standardized traditional Chinese medicine case report and a diagnostic quality evaluation opinion, and evaluate the performance of the doctor, patient, and assistant agents.
[0096] Execute Step 3,
[0097] Specifically, design an intelligent agent collaboration mechanism for simulating the traditional Chinese medicine diagnosis process, dynamically select the intelligent agents of the corresponding roles for interaction in the form of a conversation, and retain the context conversation content, including the following steps:
[0098] Step 301, define the conversation history set H t ={(s i ,mi ) | i = {pt, Dr, asst, exp}; where i represents the serial number of different role agents, pt, Dr, asst, exp are different roles, si represents the agent corresponding to the role, and m i represents the conversation content of the agent corresponding to the role;
[0099] Step 302, require the patient agent to generate conversation content m that conforms to the main complaint expression in the context of traditional Chinese medicine based on the assigned subjective information pt = f pt (I subj ), and add it to the conversation history set H t ; where I subj is the subjective information, and f pt is the generation process of the patient agent's conversation content;
[0100] Step 303, require the assistant agent to generate the assistant's conversation content m based on the assigned objective information asst = f asst (I obj ), and add it to the conversation history set H t ; where I obj is the objective information, and f asst is the generation process of the assistant agent's conversation content;
[0101] Step 304, the doctor agent needs to generate the conversation content m for the next round of diagnostic inquiry based on the conversation content of the patient agent and the assistant agent and the conversation history set Dr = f Dr (m pt , m asst , H t ) and add the inquiry content to the conversation history set H t ; where f Dr is the generation process of the doctor agent's conversation content;
[0102] Step 305, construct an intelligent routing by combining the large language model and prompt engineering, and judge the type T(m Dr ) ∈ {T subj , T obj , T diag}, T subj , T obj , T diag respectively represent seeking subjective information, seeking objective information, and giving a diagnosis result, and dynamically determine the best response agent A for the next round of conversation according to the type of the conversation content next ∈ {Agent pt , Agent asst , Agent exp}; Agent pt , Agent asst , Agent exp They are respectively represented as the doctor agent, the assistant agent, and the expert agent;
[0103] Specifically, for the intelligent routing design Prompt:
[0104] As an intelligent routing, according to the question type of the doctor agent and the current diagnosis process, determine the best corresponding agent for the next round of conversation: (1) When the doctor asks about subjective symptoms, select the patient agent to reply and output "Object: Patient"; (2) When the doctor asks about objective symptoms, select the assistant agent to reply and output "Object: Assistant"; (3) When the doctor gives a diagnosis result, end the entire conversation and output: "Diagnosis completed";
[0105] Step 306, the selected best response agent A next needs to reply to the doctor agent's inquiry according to the assigned information. At the same time, the doctor agent generates the next round of questions or the final diagnosis result based on the reply, and adds all the conversation contents to the conversation history set H t ;
[0106] Step 307, the intelligent routing determines the type T(m Dr ) of the doctor agent's conversation content, dynamically determines the best response agent A for the next round of conversation next , and monitors the diagnosis process in real time; when it detects that T(m Dr ) = T diag , the intelligent routing gives a diagnosis completion signal;
[0107] Step 308, loop through steps 302 to 307 until the preset maximum conversation round threshold t max or the intelligent routing outputs a clear diagnosis completion signal to end the diagnostic conversation.
[0108] Execute step 4,
[0109] Specifically, using the agent and the agent collaboration mechanism, by controlling the conversation content generation and decision-making behaviors of the agents of each role, a highly simulated reproduction of the traditional Chinese medicine diagnosis scenario is achieved, including the following steps:
[0110] Step 401: Initialize the agents of each role through a unified large language model call framework, and realize the dynamic collaboration and information interaction of each agent by constructing an agent collaboration mechanism. The patient agent provides subjective symptoms, the assistant agent provides auxiliary examination results as objective information, and the doctor agent gradually collects all information through active interrogation and comprehensively analyzes it, and finally generates a diagnosis result and a diagnosis basis (D result , Dbasis );
[0111] Step 402: Transfer the complete conversation history set H t and the diagnosis results and diagnosis bases (D result , D basis ) of the doctor agent to the expert agent Agent exp , generate a standardized traditional Chinese medicine case report and a diagnosis quality assessment opinion, and save the generated report and assessment opinion.
[0112] In the present invention, to ensure that the evaluation criteria of all models are unified and the formats are consistent, we adopt a test framework based on a unified API. For closed-source models, we directly use their official API interfaces and adopt the default parameter configurations. For open-source models and TCM-specific models, we use the vllm inference engine to deploy local instances and encapsulate them as local API services. To maintain the consistency of all model interactions, we unify the call processes of remote and local API calls by adopting the OpenAI SDK format. In all settings, we fix the temperature parameter of the large model at 0.3 to balance the stability of the output and the controllable creativity.
[0113] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0114] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope described in this specification.
[0115] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0116] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A method for simulating traditional Chinese medicine diagnosis scenarios based on large model agent collaborative planning, characterized in that Including the following steps: Step 1: Design a structured template for multi-dimensional patient clinical information, and use a large language model and the structured template to convert the unstructured medical record information in the original medical record into structured medical record data; Step 2: Classify and allocate the structured medical record data and design a role template to construct an intelligent agent based on the traditional Chinese medicine scenario of the large model; Step 3: Design an intelligent agent collaboration mechanism for simulating the traditional Chinese medicine diagnosis process, dynamically select intelligent agents of corresponding roles for interaction in the form of dialogue, and retain the context dialogue content; Step 4: Use the intelligent agent and the intelligent agent collaboration mechanism to highly simulate and reproduce the traditional Chinese medicine diagnosis scenario by controlling the dialogue content generation and decision-making behaviors of the intelligent agents of each role.
2. The method for simulating a traditional Chinese medicine diagnosis scenario based on large model agent collaborative planning according to claim 1, wherein The said Step 1 includes the following steps: Step 101: Design a structured template for multi-dimensional patient clinical information, and the structured template includes core dimension information of "basic patient information, main symptoms, four diagnostic results, diagnosis conclusion, treatment principle, prescription medication, and clinical understanding of famous traditional Chinese medicine doctors"; Step 102: Utilize the semantic understanding ability of the large language model to realize the mapping between the original medical record and the structured template, so as to extract relevant information and combine with reference examples to form corresponding structured medical record data.
3. The Chinese medicine diagnosis scenario simulation method based on large model intelligent agent collaborative planning according to claim 1, characterized in that, The said Step 2 includes the following steps: Step 201, classify and partition the obtained structured medical record data D to obtain subjective information I subj , objective information I obj , and diagnostic information I diag into three categories, and satisfy D = I subj ∪I obj ∪I diag ; Step 202, based on the design of the large language model and the role template, construct multiple intelligent agent roles in the traditional Chinese medicine diagnosis scenario, including the patient agent pt , the assistant agent asst , the doctor agent Dr and the expert agent exp ; Step 203, assign subjective information I subj to the patient agent pt , and assign objective information I obj to the assistant agent asst , and the doctor agent Dr by default does not have the task patient information, and the expert agent exp is assigned to have all the information.
4. A traditional Chinese medicine diagnosis scenario simulation method based on large model agent collaborative planning according to claim 3, characterized in that, The said Step 202 includes the following steps: Step 20201: Construct a unified large language model call framework, standardize the management of the large model interface through the Python SDK of OpenAI. For closed-source models, use their official API interfaces for calling; for open-source models, implement local deployment based on the high-performance vllm inference acceleration framework and encapsulate it as a local API interface; Step 20202: Design the patient role prompt template P through a unified large language model API interface pt ; P pt = f prompt (I subj , R pt ); Among them, f prompt is the prompting process, I subj is the subjective information, R pt is the patient role definition, which is used to construct the patient intelligent agent Agent pt , enabling the patient to accurately reply to the doctor's questions based on their own subjective information; Step 20203: Design the assistant role prompt template P through the unified large language model API interface asst ; R asst = f prompt (I obj , R asst ); Among them, f prompt is the prompting process, I obj is the objective information, R asst is the assistant role definition, constructing the assistant intelligent agent Agent asst so that the assistant can accurately reply to the doctor's questions based on its own objective information; Step 20204: Design the doctor role prompt template P through the unified large language model API interface Dr ; Among them, f prompt is a prompting process, R Dr is defined as the doctor role and initially does not hold patient information. Build a doctor intelligent agent Agent Dr so that the doctor can conduct multiple rounds of consultations with the patient, collect necessary objective information from the assistant, and give a diagnosis result and diagnosis basis by integrating all the information; Step 20205: Design an expert role prompt template Prompt through a unified large language model API interface exp , and build an expert intelligent agent Agent exp , enabling experts to generate traditional Chinese medicine case reports and diagnostic quality assessment opinions based on all the information collected.
5. A method for simulating a traditional Chinese medicine diagnosis scenario based on large model agent collaborative planning according to claim 1, characterized in that, The said Step 3 includes the following steps: Step 301, define the dialogue history set H t ={(s i , m i ) | i = pt, Dr, asst, exp}; where i represents the serial number of different role agents, pt, Dr, asst, exp are different roles, s i represents the agent corresponding to the role, and m i represents the dialogue content of the agent corresponding to the role; Step 302, require the patient agent to generate the dialogue content m that conforms to the main complaint expression in the context of traditional Chinese medicine according to the assigned subjective information pt = f pt (I subj ), and add it to the dialogue history set H t ; where I subj is the subjective information, and f pt is the generation process of the patient agent's dialogue content; Step 303, require the assistant agent to generate the conversation content m of the assistant according to the allocated objective information asst = f ass (I obj ), and add it to the conversation history set H t ; where I obj is the objective information, and f asst is the generation process of the assistant agent's conversation content; Step 304, the doctor agent needs to generate the dialogue content m for the next round of diagnostic inquiry based on the dialogue content between the patient agent and the assistant agent and the dialogue history set Dr = f Dr (m pt , m asst , H t ) and add the inquiry content to the dialogue history set H t ; where f Dr is the generation process of the doctor agent's dialogue content; Step 305: Construct an intelligent routing by combining a large language model and prompt engineering to determine the type of conversation content T(m Dr ) ∈ {T subj , T obj , T diag}, where T subj , T obj , T diag represent seeking subjective information, seeking objective information, and giving a diagnosis result respectively, and dynamically determine the best response agent A for the next round of conversation according to the type of the conversation content next ∈ {Agent pt , Agent asst , Agent exp}; Agent pt , Agent asst , Agent exp represent the doctor agent, the assistant agent, and the expert agent respectively; Step 306, the selected optimal response agent A next needs to reply to the inquiries of the doctor agent according to the allocated information. At the same time, the doctor agent generates the next round of questions or the final diagnosis result based on the reply, and adds all the conversation contents to the conversation history set H t ; Step 307, the intelligent routing determines the type of the conversation content T(m Dr ) of the doctor intelligent agent, and dynamically determines the best response intelligent agent A for the next round of conversation next , while monitoring the diagnosis process in real time; when it is detected that T(m Dr ) = T diag , the intelligent routing gives a diagnosis completion signal; Step 308: Loop through steps 302 to 307 until the preset maximum dialogue turn threshold t is reached max Or the intelligent routing outputs a clear diagnosis completion signal to end the diagnostic dialogue.
6. The method for simulating a traditional Chinese medicine diagnosis scenario based on large model agent collaborative planning according to claim 1, wherein, The said Step 4 includes the following steps: Step 401: Initialize the agents of each role through the unified large language model call framework, and realize the dynamic cooperation and information interaction of each agent by constructing an agent cooperation mechanism. The patient agent provides subjective symptoms, the assistant agent provides auxiliary examination results as objective information, and the doctor agent gradually collects all information through active interrogation and comprehensively analyzes it, and finally generates a diagnosis result and a diagnosis basis (D result ,D basis ); Step 402: Transfer the complete conversation history set H t and the diagnosis results and diagnosis basis (D result , D basis ) of the doctor agent to the expert agent Agent exp , generate a standardized traditional Chinese medicine case report and a diagnosis quality evaluation opinion, and save the generated report and evaluation opinion.