A modular medical intelligent agent construction method and system
By using a modular construction method for text data streams, extracting text fragments using association information entropy and reordering models, and integrating information with a large language model, this approach solves the problems of complex model selection and poor usability in personalized precision medicine for modular medical agents, and realizes customized construction of agents and personalized medical assistance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CAPITAL UNIVERSITY OF MEDICAL SCIENCES
- Filing Date
- 2025-08-18
- Publication Date
- 2026-05-26
AI Technical Summary
Existing modular medical intelligence agents suffer from problems such as complex model selection, poor usability, and cumbersome parameter settings in personalized precision medicine, which limits their clinical application and makes it difficult to fully utilize artificial intelligence resources for personalized medical assistance.
A modular construction method based on text data streams is adopted. The current text is divided into multiple text blocks and converted into vectors. Weight values are set using the association information entropy. Relevant text fragments are extracted from the vector database. The information is spliced and integrated by combining the reordering model and the large language model to form prompt words to answer user questions.
It improves the relevance and accuracy of agent conversations, supports the selection, replacement and upgrading of agents, has strong compatibility, and can be customized, providing a new solution for personalized intelligent medical assistance.
Smart Images

Figure CN121034646B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of smart healthcare technology, and in particular relates to a modular medical intelligent agent construction method and system. Background Technology
[0002] The application of artificial intelligence (AI) in the medical field is becoming increasingly necessary. Specific applications of AI technology in medicine include: improving diagnostic accuracy: Tasks such as medical image analysis and pathological diagnosis require highly skilled physicians, and AI, through technologies like deep learning, can assist doctors in making faster and more accurate diagnoses, reducing human error and improving the quality of medical services. Optimizing treatment plans: Analyzing vast amounts of medical data, including patient medical history, genetic information, and lifestyle habits, allows for personalized treatment plans, improving treatment outcomes. Alleviating medical resource shortages: In areas with uneven distribution of medical resources, remote diagnosis and intelligent monitoring can provide timely medical services to patients, alleviating doctor shortages. Improving patient care quality: Monitoring patients' physiological parameters through intelligent devices allows for timely detection of abnormalities and provides continuous care. Enhancing disease prevention: Analyzing public health data helps predict disease trends, providing a scientific basis for disease prevention and control. Improving medical decision-making: Assisting doctors in making complex medical decisions by providing data-driven decision support helps them choose the best treatment options. Promoting the utilization of medical data: The medical field generates a large amount of data; analyzing and interpreting this data helps extract valuable information to support medical research and clinical practice.
[0003] Modular design allows complex systems to be broken down into smaller, more manageable parts, each responsible for a specific function, facilitating updates and maintenance. An agent is a software entity capable of autonomously performing tasks; it can perceive its environment, make decisions, and take actions. The background technologies for modular medical agents encompass multiple fields, including artificial intelligence, machine learning, natural language processing, and medical image analysis. An agent framework is a reference architecture for deploying and orchestrating multimodal AI agents, enabling multi-step reasoning by integrating image and text data with human-like logic. It supports customizable workflows through agent-based customizable processing and reduces integration complexity by easily bridging visual and language components. Modular construction techniques utilize various AI resources, which can be freely selected and compatibly expanded through module reloading; for example, the MONAI agent architecture employs a modular design to support cross-modal reasoning in medical AI, achieving multi-step reasoning by integrating image and text data with human-like logic. The large language model (LLM) is the "brain" of the agent, responsible for coordinating decision-making. The LLM achieves its goals by reasoning through tasks, developing action plans, selecting appropriate tools, and managing access to necessary data. Specifically, individualized precision medicine based on patients' individual characteristics, such as genetics, physiology, and pathology, can effectively improve treatment outcomes while reducing adverse reactions and promoting a more rational allocation of medical resources. The development of LLM (Liver Memory Model) provides new tools for personalized precision medicine. Current research has explored and attempted its application in precision medicine. With its natural language interaction and efficient integration of patient information and existing knowledge, LLM shows great potential in this area; however, the hallucination problem in LLM often leads to inaccurate answers. Memory modules can maintain context through memory and can be adjusted according to ongoing or historical tasks, including short-term and long-term memory. PPK (Positive Pharmacokinetic Response) research provides important references for clinical personalized medicine and has been widely implemented in drug therapy, including situations with narrow therapeutic windows, significant individual metabolic differences, and medication use in special populations. However, PPK models encounter many inconveniences in clinical application. First, each model is only applicable to specific drugs and populations. Selecting the appropriate model from among many models based on the patient's individual characteristics requires clinicians to spend time familiarizing themselves with the characteristics of each model. Second, the usability of PPK models needs improvement. Besides its complex user interface, using the PPK model requires setting numerous parameters, a cumbersome and error-prone process that limits its clinical application. Modular construction techniques, based on the characteristics and differences of various types of AI agents, can fully utilize AI resources, enabling computer systems to perform tasks requiring human intelligence, such as diagnosis, treatment recommendations, and health management.
[0004] In the process of constructing modular medical intelligent agents, how to build these agents to fully utilize various artificial intelligence resources and achieve a comprehensive integration of artificial intelligence technology, knowledge base, and medical technology is a technical problem to be solved. Based on this problem, this invention proposes a modular construction method based on text data streams. This method significantly improves the relevance and accuracy of agent conversations, facilitates the selection, replacement, and upgrading of agents, has strong compatibility, and enables customized system construction for users, providing a new solution for personalized intelligent medical assistance. Summary of the Invention
[0005] To address the aforementioned problems in the prior art, this invention proposes a modular medical intelligent agent construction method and system, the method comprising:
[0006] Step S1: Segment the current text into multiple text blocks and convert them into corresponding vectors; search the vector database to obtain the first text segment; set weight values for the vectors based on the correlation between the text blocks and the context; search the vector database based on the weight values to obtain the second text segment;
[0007] Step S2: Input the first and second text segments into the re-ranking model and extract the tK most relevant partial segments; specifically:
[0008] Step S21: Input the first text segment into the reordering model to extract the most relevant first part segment and the first other segments that were not extracted; input the second text segment into the reordering model to extract the most relevant second part segment and the second other segments that were not extracted.
[0009] Step S22: Place the first part of the fragment and the second part of the fragment into the partial fragment set; place the first other fragment and the second other fragment into the other fragment set;
[0010] Step S23: Select a partial fragment from the partial fragment set and another fragment from the other fragment set, and concatenate the two to obtain a temporary text fragment; input the temporary text fragment into the reordering model to extract the most relevant temporary partial fragment and the other temporary fragments that were not extracted;
[0011] Step S24: Place the most relevant temporary fragment into the partial fragment set, and other temporary fragments into the other fragment set; when placing them, remove duplicates and increment the number of duplicates for the partial fragment being removed; if the cutoff condition is met, proceed to the next step; otherwise, return to step S23.
[0012] Step S25: Select the top tK partial fragments from the partial fragment set, sorted by the number of times duplicates are removed;
[0013] Step S3: Use templates to integrate tK partial fragments and user questions to form a large language model for prompt word input.
[0014] Furthermore, a vector database is pre-built, and prior knowledge is segmented into text blocks, vectorized, and then stored in the vector database.
[0015] Furthermore, step S1 specifically includes:
[0016] Step S11: Obtain the current text and context in the session; organize the context into multiple historical texts according to chronological order or importance. ;
[0017] Step S12: Set the current text Divide into multiple current text blocks ,in: The current text The The number of text blocks; IC is the number of text blocks divided.
[0018] Step S13: Determine each current text block and historical texts The degree of relevance of each of them ;
[0019] Step S14: For each current text block Calculate its entropy of association information relative to historical text. ;
[0020] Step S15: Extract each text block Convert the text block c into a corresponding vector vc. Based on the vector vc corresponding to the text block c, search the vector database to obtain the K1 first text segments most similar to the current text. Then, associate the entropy information. As the weight value of the current vector vc; based on the vector vc corresponding to all text blocks c and their respective weight values, search the vector database to obtain K2 second text segments that are most similar to the current text under the weighted condition.
[0021] Furthermore, the context includes patient attribute information and historical dialogue information to which the current text is targeted.
[0022] Furthermore, the current text and the context are both in the same session.
[0023] Furthermore, K1 and K2 are preset values.
[0024] Furthermore, K1 = K2.
[0025] Furthermore, the text blocks are converted into vectors using an embedding model.
[0026] A modular medical intelligent agent construction system is provided, which is used to implement the above-mentioned modular medical intelligent agent construction method.
[0027] A modular medical intelligent agent construction platform is provided, which is used to implement the above-mentioned modular medical intelligent agent construction method.
[0028] The beneficial effects of this invention include:
[0029] (1) Modular construction of medical agents based on conversational text data streams can extract and incorporate information from text data streams based on the functional differences of different agent types. For example, without changing the reordering model, context-related differential information can be incorporated into text fragment extraction through association information entropy. By constructing text fragments through hybridization, relevant knowledge base information can be fully and hierarchically obtained in a one-dimensional computational space, providing a foundation for the construction of detailed prompt words. The modular construction method facilitates the selection, replacement and upgrading of agents.
[0030] (2) By associating information entropy, non-semantic correlations can be formed between the question-and-answer process and the context; when searching the knowledge base, there is no need to introduce semantic information of the context to maintain the current knowledge base data entry size, which facilitates the updating and modification of the knowledge base, provides support for the modular construction of intelligent agents, and is also compatible with the existing search weight system. Attached Figure Description
[0031] The accompanying drawings, which are provided to further illustrate the invention and form part of this application, are not intended to unduly limit the invention. In the drawings:
[0032] Figure 1 This is a schematic diagram of the modular medical intelligent agent construction method provided by the present invention.
[0033] Figure 2 This is a schematic diagram of the text data flow in the modular medical intelligent agent provided by the present invention. Detailed Implementation
[0034] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. The illustrative embodiments and descriptions are only used to explain the present invention and are not intended to limit the present invention.
[0035] Modular construction technology can utilize a variety of artificial intelligence resources and can freely select and expand these resources through module reloading. It can also compatibly expand these resources to build a local knowledge base that covers medical knowledge needs, serving as the core support for knowledge query questions. In the process of building a modular medical intelligent agent, the construction of a local knowledge base is often the first step.
[0036] Building a local knowledge base mainly includes: knowledge source collection, which involves extensively collecting various types of medical knowledge sources, including medical textbooks, clinical practice guidelines (such as domestic and international guidelines for the diagnosis and treatment of various specialties), drug instructions (covering indications, usage, dosage, contraindications, etc. for various drugs), high-quality medical research literature (journal articles, evidence-based medicine reports), clinical pathway documents, etc., to form a raw knowledge material library; then, data preprocessing, which involves cleaning and formatting the collected knowledge sources; removing duplicate and invalid content (such as advertisements and incorrect formatting information in the literature), and standardizing text encoding and formatting (organizing the titles and paragraph structures of different documents according to a preset template); and for unstructured text (such as freely written case discussions), using named entity recognition (identifying disease names, drug names, diagnosis and treatment procedures, etc.) and relation extraction (extracting disease-drug, drug-relationship, etc.) to process the data. (Contraindications, etc.) are transformed into structured or semi-structured data for easy subsequent retrieval; the above knowledge is stored in vector form, and the preprocessed medical knowledge text is converted into a high-dimensional vector representation using a text vectorization model to capture the semantic features of the knowledge; a vector database is built to store the knowledge vectors and corresponding text content and metadata (knowledge source, update time) into the database, establishing a local knowledge base that supports efficient semantic retrieval and providing a foundation for RAG retrieval;
[0037] As attached Figure 1 and 2 As shown, the modular medical intelligent agent construction method includes the following steps:
[0038] Step S1: Obtain the current text and context in the session; set the current text... The text is segmented into multiple blocks and converted into corresponding vectors (vc). Based on the vector vc group, the vector database is searched to obtain the K1 first text segments most similar to the current text. Weight values are set for the vector vc based on the correlation between the text block and the context. Based on the vector vc group and its weight values, the vector database is searched to obtain the K2 second text segments most similar to the current text under weighted conditions. In other words, the user is taken as the starting point of the method. Through natural language such as everyday conversational language, such as describing symptoms or asking about medication dosage, the user raises questions and requests related to medical treatment and medication to the system, thus initiating the entire intelligent agent processing.
[0039] Preferred approach: Before the dialogue is initiated, a session is created, and text is continuously received within a session; each received current text is segmented, and the resulting text blocks are vectorized, with a vector weight determined for each vector.
[0040] Step S1 specifically includes the following steps:
[0041] Step S11: Obtain the current text and context in the session; organize the context into multiple historical texts according to chronological order or importance. ;
[0042] Preferably, the context includes patient attribute information and historical dialogue information to which the current text is targeted; both the current text and the context are in the same session; the current text can be the user's current dialogue content, and the historical text contains the user's historical dialogue content in the same session;
[0043] Step S12: Set the current text Divide into multiple current text blocks ,in: The current text The The number of text blocks; IC is the number of text blocks segmented.
[0044] Step S13: Determine each current text block and historical texts The degree of relevance of each of them ;
[0045] Preferably, the degree of relevance is semantic relevance; for example, semantic similarity is calculated using methods such as TF-IDF weighted cosine similarity, LDA topic distribution similarity, Word2Vec / GloVe average pooling, and context-aware models.
[0046] Step S14: For each current text block Calculate its entropy of association information relative to historical text. Specifically, the entropy of its association information with historical text is calculated based on the following formulas (1) to (3). ;in: It is a normalized value of the degree of correlation; For intermediate parameters;
[0047] (1);
[0048] (2);
[0049] (3);
[0050] Step S15: Extract each text block Convert the text block c into a corresponding vector vc. Based on the vector vc corresponding to the text block c, search the vector database to obtain the K1 first text segments most similar to the current text. Then, associate the entropy information. As the weight value of the current vector vc; based on the vector vc corresponding to all text blocks c and their respective weight values, search the vector database to obtain the K2 second text segments that are most similar to the current text under the weighted condition;
[0051] Preferably, K is a preset value; the value of K can be set according to the processing capability of the agent involved in subsequent steps; the processing capability is the ability to accept input data;
[0052] Replaceable: The weight value of the current vector is a preset value, and the weight is set based on the rule base; the association information entropy enables non-semantic correlation between the question-and-answer process and the context; when searching the knowledge base, there is no need to introduce the semantic information of the context to maintain the current knowledge base data entry size, which facilitates the updating and modification of the knowledge base, provides support for the modular construction of intelligent agents, and is also compatible with the existing search weight system.
[0053] The step of searching the vector database based on the vector vc corresponding to all text blocks c to obtain the K1 first text segments most similar to the current text specifically involves: for each text block... This is converted into a corresponding vector 'vc', and based on this vector 'vc', a vector database is searched to obtain the text blocks respectively. The most relevant first set of text fragments Determine the set of all first text fragments. The intersection (or union) of the first text fragment in the intersection; based on the relevance information entropy... (Related information entropy combination) Sort, and extract the top K1 first text fragments as the K1 first text fragments most similar to the current text; the way to get the K2 second text fragments is similar, but weight values need to be considered when querying or sorting.
[0054] Preferably: K1 and K2 are preset values; K1 and K2 are of similar order of magnitude; for example, set K1=K2;
[0055] Preferably, the first text fragment and the second text fragment may or may not contain the same text fragment;
[0056] Preferred method: The text blocks are converted into vectors using an embedding model; the embedding model is bge-large-zh-v1.5; a vector database is pre-built, and prior knowledge such as clinical guidelines and literature is segmented into text blocks and vectorized, and then stored in the vector database to form a local knowledge base;
[0057] Preferred approach: Load different vector databases for different contexts; vectorization of text can speed up retrieval and facilitate weighted retrieval using multiple text blocks;
[0058] Preferred method: Before executing step S1, perform semantic parsing and classification on the current text and context in the session, identify the core needs of the problem based on the pre-trained medical problem classification system, determine whether it involves personalized pharmacokinetic calculation problem and thus requires calling the PPK module, if so, proceed to step S4;
[0059] Step S2: Input the K1 first text fragments and K2 second text fragments into the re-ranking model to extract the top K most relevant fragments; specifically:
[0060] Step S21: Input K1 first text fragments into the reordering model to extract U most relevant first part fragments and U other first fragments that were not extracted; input K2 second text fragments into the reordering model to extract U most relevant second part fragments and U other second fragments that were not extracted; that is, the other fragments are the remaining parts of the extracted part fragments;
[0061] Preferably, U is a preset value;
[0062] Preferably: the entire text segment composed of the aforementioned partial fragment and other fragments, or the main part of the text segment; here, the text segment is divided into two parts by extraction. Of course, if computational complexity is not considered, or if the text segment is large, the text segment can be divided into multiple parts.
[0063] Step S22: Place the U first part fragments and the U most relevant second part fragments into the partial fragment set; place the U first other fragments and the U second other fragments into the other fragment set; wherein: the initial values of the partial fragment set and the other fragment set are empty sets;
[0064] Preferred method: When placing the first part fragment into the partial judgment set, remove duplicates; this removal is either absolute removal or loose removal; absolute removal is a common form of set merging, where only one element is retained when two elements in the set are identical; relative removal is removal within a certain similarity range, so that two highly similar part fragments are merged into one part fragment or one is retained while the other part fragment is deleted.
[0065] Step S23: Select a partial fragment from the partial fragment set and select another fragment from the other fragment set, and concatenate the two to obtain a temporary text fragment; repeat this step to obtain Uk temporary text fragments; input the Uk temporary text fragments into the reordering model to extract the Uk most relevant temporary partial fragments and the Uk other temporary fragments that were not extracted;
[0066] Preferably: the Uk value is a preset value; the setting and selection of Uk are related to the size of the partial fragment set;
[0067] Preferred method: Before splicing a partial fragment with another fragment, determine whether the two meet the splicing conditions. If they do, splice them together to obtain a temporary text fragment; otherwise, select again.
[0068] Preferred methods include random selection, non-repeating random selection, and selection based on text segment length.
[0069] The determination of whether the two meet the splicing conditions specifically involves: the temporary text fragment obtained after splicing is different from the first text fragment and the second text fragment, and also different from the already obtained temporary text fragment; further, determining the first similarity between the partial fragment and the current text; determining the second similarity between the other fragments and the current text; determining the third similarity between the spliced temporary text fragment and the current text; when the third similarity is greater than the first similarity and the third similarity is greater than the second similarity, it is determined that the splicing conditions are met.
[0070] Replaceable: When the third similarity is greater than the first similarity, the third similarity is greater than the second similarity, and the sum of the first similarity and the second similarity is greater than the third similarity, the splicing condition is determined to be met;
[0071] The determination of whether the two meet the splicing conditions specifically involves: determining whether the semantic distribution of the temporary text fragments is balanced; if so, the splicing conditions are met; otherwise, they are not met. This includes the following steps:
[0072] Step S231: Determine the temporary text fragment Similarity between each of the text blocks ic And based on the aforementioned similarity, a similarity vector is constructed. >,ic=1~IC;
[0073] Step S232: For the K1th first text segment among the K1 first text segments, determine its similarity to each of the text blocks ic. Based on the aforementioned similarity, and the K1 first similarity vectors corresponding to the K1 first text segments, >, ic = 1 ~ IC, k1 = 1 ~ K1;
[0074] Preferred: Calculate the K2 first similarity vectors corresponding to the K2 second text segments using a similar method. >, ic = 1 ~ IC, k2 = 1 ~ K2;
[0075] Step S233: Calculate the mean vector of the K1 first similarity vectors. >=< >As a threshold vector;
[0076] Preferred: Calculate the mean vector of the K2 second similarity vectors using a similar method. >=< >As another threshold vector; the mean of one or both of the threshold vectors and the other threshold vector is used as the final threshold vector;
[0077] Step S234: Determine the variance between the similarity vector and the threshold vector. If variance If the semantic distribution of the temporary text fragment is balanced, then the splicing condition is satisfied; otherwise, it is not satisfied.
[0078] Preferred: Variance threshold It is a preset value;
[0079] Step S24: Add the Uk most relevant temporary partial fragments to the partial fragment set; when adding them, deduplication is required. When deduplication occurs, increment the deduplication count of the partial fragment (temporary partial fragment) to be deduplicated; add the Uk other temporary fragments to the other fragment set, and deduplication is required when adding them; determine whether the first cutoff condition is met. If yes, proceed to the next step; otherwise, return to step S23.
[0080] Wherein: the first cutoff condition is that any one of the Uk most relevant temporary partial fragments obtained has a partial fragment in the partial fragment set that is similar to it; of course, the cutoff condition can also be relaxed appropriately. When almost all the most relevant temporary partial fragments have a partial fragment in the partial fragment set that is similar to it, the first cutoff condition is determined to be satisfied.
[0081] Replaceable if: the number of elements in a partial fragment set is greater than a preset number or the number of times steps S23-S24 are executed exceeds a preset number of executions; for example: set the preset number of executions to 1-5;
[0082] Preferably, the initial value for the number of deduplications associated with each partial fragment in the partial fragment set is 0;
[0083] Step S25: Select the top K most similar partial segments from the partial segment set; specifically: sort the partial segments in the partial segment set according to the number of times they are deduplicated, and select the top K partial segments from the top of the sort as the selected partial segments;
[0084] Preferably, the reranking model is bce-reranker-base_v1, Cross-Encoder Reranker, BERT, etc.
[0085] Preferred: In the initial state when the context is empty, in steps S1-S2, each text block... Convert it into a corresponding vector vc. Based on the vector vc corresponding to all text blocks c, search the vector database to obtain the K1 first text segments that are most similar to the current text. Input the K1 first text segments into the reordering model to extract the top K most relevant partial segments; then proceed to step S3.
[0086] As can be seen, the above repeated splicing process is the process of constructing text fragments through hybridization. By constructing text fragments through hybridization, relevant information from the knowledge base can be fully and comprehensively obtained in a one-dimensional computational space (the splitting method is a one-dimensional computational method). Since there are bound to be many repeated text parts between the successively obtained temporary text fragments, important text parts are obtained multiple times, and vice versa. Correspondingly, the relevant information from the knowledge base obtained must be hierarchical. When the input information of many large language models is sufficient, it is conducive to obtaining more accurate and effective answer information. Therefore, hybridization is beneficial to improving the efficiency of human-computer interaction.
[0087] Step S3: Use a template to integrate the top K fragments and user questions to form prompt words; input the prompt words into a large language model to obtain an answer, and then provide the answer back to the user;
[0088] Preferred methods include: filtering and cleaning certain segments; specifically: removing redundancy from the top K reordered segments and removing duplicate text segments; also including: truncating excessively long text segments and retaining only the core sentences;
[0089] Preferred length of each final prompt word; for example, controlling its length to be between 50 and 100 characters; of course, the length of the prompt word is related to the input size of the large oracle model;
[0090] Preferably, the template is a dynamic template, obtained based on the type of user question and the template corresponding to that type; a field-content matching rule table is established for each field in the template; the matching rules and priorities for each field are set in this table; for example: define a field whose matching rule is professional terminology and priority is high; a data support field whose matching rule is containing numbers / percentages and priority is medium; a reference type field whose matching rule is containing specific names of people, organizations and / or time and location, and priority is low.
[0091] The template is used to integrate the fragments and user questions; specifically: metadata annotation is performed to generate metadata tags for each component of the fragments and user questions; these metadata tags are then populated into the corresponding fields of the template.
[0092] Preferably, the large language model is one of DeepSeek-R1, OpenAI, PaLM, LLaMA, Anthropic, Med-PaLM 2, BioGPT, GitHub Copilot, StarCoder, etc.
[0093] Preferred approach: Use Dify workflow to integrate agents, and implement the above method steps by setting functional modules to achieve the integration of agent workflows;
[0094] Preferred approach: Before session creation, select AI agents such as the aforementioned embedded models, vector databases, large language models, and reordering models based on contextual information and patient attribute information; patient attribute information can be manually entered or actively obtained through natural language interaction.
[0095] Based on the same inventive concept, this invention also provides a modular medical intelligent agent construction system, which is used to implement the above-described modular medical intelligent agent construction method; the constructed intelligent agent can answer questions and conduct corresponding dialogues based on a knowledge base through natural language interaction; such as Figure 2 As shown, when a user asks for medication recommendations for neonatal lung candidiasis, the agent first searches the local knowledge base and provides an answer based on the knowledge base content, while also listing the reference sources.
[0096] Preferably, the method further includes step S4: the large language model agent includes a pharmacokinetic model, which can further select a suitable pharmacokinetic model based on user attribute information and user questions to calculate the recommended dose and provide an answer; the calculated individual pharmacokinetic parameters and the pharmacokinetic curve plotted accordingly are fed back to the user; and the answer is saved as context information.
[0097] Specifically, the prompt word is sent to the population pharmacokinetic (PPK) model; the PPK model establishes a mathematical model framework for pharmacokinetic calculations by defining the differential equations of blood drug concentration in each compartment of a specific drug compartment model and the mean, distribution, and interrelationships of each parameter; the mathematical model is run using a programming language to solve the pharmacokinetic process and perform sampling calculations related to the Bayesian feedback method; the PPK model has a reserved parameter interface for receiving user attributes (age, weight, liver and kidney function indicators, medication history, etc.).
[0098] Preferred method: By defining parameter formats, JSON formats, key-value pair mappings, and other transmission rules through a pre-defined standardized input interface, external data can be accurately input into the population pharmacokinetic PPK model for calculation;
[0099] Preferred approach: Using web frameworks such as Flask, the constructed PPK model is encapsulated as a callable service module and deployed to the server; the pharmacokinetic model is triggered based on input information (such as prompt words) to output pharmacokinetic calculation results such as drug concentration-time curve data and dosage adjustment suggestions;
[0100] Preferably, step S4 specifically includes the following steps:
[0101] Step S41: Identify user attribute information from the prompt words; for example, extract parameters such as age (55 years old), gender (female), height (160cm), weight (55kg), liver function grade (Child-Pugh B), current drug (carbamazepine), and blood drug concentration (2μg / ml) from the prompt "55-year-old female, height (160cm), weight (55kg), liver function grade (Child-Pugh B), current drug (carbamazepine), and blood drug concentration (2μg / ml); and further convert them into structured data that can be recognized by the pharmacokinetic model (such as dictionary format: {"age":55, "gender":"female", "height":160, "weight":55, "liver_function":"Child-Pugh B", "drug":"carbamazepine", "current_concentration":2}).
[0102] Step S42: Select an appropriate population pharmacokinetic (PPK) model; specifically, based on the extracted user attributes, drug information, and response requirements (such as "predict steady-state concentration" and "optimize dosing interval"), select the model with the highest matching degree from the deployed PPK model library (containing dedicated models for different drugs and different populations); for example, for the dose calculation of vancomycin in patients with renal insufficiency, call the pre-built "vancomycin-renal insufficiency population PPK model" and output the model call command.
[0103] Step S43: Passing parameters to the PPK model: The system passes structured user attributes to the selected PPK model according to the parameter interface rules reserved by the PPK model, triggering the calculation task; for example, by sending the user attribute JSON data to the API interface deployed by the PPK model via an HTTP POST request.
[0104] Step S44: After receiving user attributes, the PPK model combines user attributes with drug characteristics to perform calculations. For example, it simulates the absorption, distribution, metabolism, and excretion of the drug in the user's body, and calculates the blood drug concentration-time curves, steady-state time, and optimal dosage under different dosing regimens. It can also further estimate individual user parameters based on a small amount of previously measured blood drug concentrations using Bayesian feedback. Finally, it outputs structured calculation results, such as a JSON file containing concentration predictions and dosage suggestions.
[0105] Step S45: Return the structured computation results;
[0106] Preferred approach: After returning the structured computation results from the PPK model, integrate the results; receive the outputs from both branches (step S3 and step S4) and integrate them uniformly:
[0107] Preferred approach: During unified integration, pharmacokinetic calculation results such as dosage recommendations and concentration predictions are transformed into clinically interpretable natural language; for example, "This patient is using vancomycin, the recommended initial dose is ×× mg, administered every ×× hours, the expected steady-state plasma concentration is ×× μg / ml, renal function needs to be monitored and the regimen adjusted," and a visual description / data of the drug-time curve is generated (e.g., "The drug-time curve shows that the peak concentration is reached 2 hours after administration, and the concentration drops to ×× μg / ml after 12 hours"); the answers from step S3 are transformed into concise and accurate answers (e.g., "For patients with hypertension and diabetes, ACEI / ARB antihypertensive drugs, such as enalapril, are preferred, as they can improve glucose metabolism and protect the kidneys; pay attention to monitoring serum potassium levels"); the content integrated from the large language model is output in natural language text form, ensuring that it is easy to understand, conforms to medical communication standards, and covers the understanding needs of patients / medical staff.
[0108] Preferred method: Generate drug-time curve based on PPK model. By calling the visualization modules Matplotlib and Plotly, generate drug-time curve based on the blood drug concentration-time data calculated by PPK model. The drug-time curve includes coordinate axis labels, concentration change trend, concentration values at key time points, etc.; and embed feedback content in the form of images and interactive charts.
[0109] Preferred: Through user interaction interfaces such as web pages, mobile applications, and API interfaces, natural language answers and drug timing curves are synchronously fed back to users, completing the "question-answer" closed loop and supporting users to ask further questions and interact.
[0110] A computer program (also referred to as a program, software, software application, script, or code) can be written in any form of programming language, including assembly or interpreted languages, declarative or procedural languages, and can be deployed in any form, including as a standalone program or as a module, component, subroutine, object, or other unit suitable for use in a computing environment. A computer program may, but does not necessarily, correspond to a file in a file system. A program can be stored as part of a file that holds other programs or data (e.g., one or more scripts stored in a markup language document), in a single file dedicated to said program, or in multiple co-located files (e.g., a file storing one or more modules, subroutines, or code portions). A computer program can be deployed to execute on a single computer or on multiple computers located at a single site or distributed across multiple sites and interconnected by a communications network.
[0111] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied 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.
[0112] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1A device that provides the functions specified in one or more boxes.
[0113] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0114] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A modular medical intelligent agent construction method, characterized in that, The method includes: Step S1: Segment the current text into multiple text blocks and convert them into corresponding vectors; search the vector database to obtain the first text segment; set weight values for the vectors based on the correlation between the text blocks and the context. The second text fragment is obtained by searching a vector database based on weight values; The context includes patient attribute information and historical dialogue information for the current text. Step S1 specifically involves: Step S11: Obtain the current text and context in the session; organize the context into multiple historical texts according to chronological order or importance. ; Step S12: Set the current text Divide into multiple current text blocks ,in: The current text The A text block; Step S13: Determine each current text block and historical texts The degree of relevance of each of them ; Step S14: For each current text block Calculate its entropy of association information relative to historical text. ; Step S15: Convert each text block into a corresponding vector vc, and search the vector database based on the vector vc combinations corresponding to the text blocks to obtain the K1 first text segments most similar to the current text; associate the information entropy As the weight value of the current vector vc; based on the vector vc corresponding to all text blocks and their respective weight values, search the vector database to obtain the K2 second text segments that are most similar to the current text under the weighted condition; Step S2: Input the first and second text segments into the re-ranking model and extract the tK most relevant partial segments; specifically: Step S21: Input the first text segment into the reordering model to extract the most relevant first part segment and the first other segments that were not extracted; input the second text segment into the reordering model to extract the most relevant second part segment and the second other segments that were not extracted. Step S22: Place the first part of the fragment and the second part of the fragment into the partial fragment set; place the first other fragment and the second other fragment into the other fragment set; Step S23: Select a partial fragment from the partial fragment set and another fragment from the other fragment set, and concatenate the two to obtain a temporary text fragment; input the temporary text fragment into the reordering model to extract the most relevant temporary partial fragment and the other temporary fragments that were not extracted; Step S24: Place the most relevant temporary fragment into the partial fragment set, and other temporary fragments into the other fragment set; when placing them, remove duplicates and increment the number of duplicates for the partial fragment being removed; if the cutoff condition is met, proceed to the next step; otherwise, return to step S23. Step S25: Select the top tK partial fragments from the partial fragment set, sorted by the number of times duplicates are removed; Step S3: Use templates to integrate tK partial fragments and user questions to form a large language model for prompt word input.
2. The modular medical intelligent agent construction method according to claim 1, characterized in that, A vector database is pre-built. Prior knowledge is segmented into text blocks, vectorized, and then stored in the vector database.
3. The modular medical intelligent agent construction method according to claim 2, characterized in that, The current text and context are both in the same session.
4. The modular medical intelligent agent construction method according to claim 3, characterized in that, K1 and K2 are preset values.
5. The modular medical intelligent agent construction method according to claim 4, characterized in that, K1=K2.
6. The modular medical intelligent agent construction method according to claim 5, characterized in that, Use an embedding model to convert text blocks into vectors.
7. A modular medical intelligent agent construction system, characterized in that, The modular medical intelligent agent construction system is used to implement the modular medical intelligent agent construction method according to any one of claims 1-6.
8. A modular medical intelligent agent construction platform, characterized in that, The modular medical intelligent agent construction platform is used to implement the modular medical intelligent agent construction method according to any one of claims 1-6.