Modular medical agent construction method and system

By employing a modular construction method based on text data streams, and utilizing vector databases and reordering models, text fragments are extracted and concatenated, solving the resource integration problem in the construction of modular medical intelligent agents. This improves the conversational relevance and accuracy of the agents and supports the customized construction and upgrade of the system.

CN121034646AActive Publication Date: 2025-11-28CAPITAL UNIVERSITY OF MEDICAL SCIENCES
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202511152886.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-18
Publication Date
2025-11-28
Estimated Expiration
2045-08-18

AI Technical Summary

Technical Problem

In the process of building modular medical intelligent agents in existing technologies, how can we make full use of various artificial intelligence resources to achieve the integration of artificial intelligence technology, knowledge base and medical technology, improve the relevance and accuracy of intelligent agent conversations, and at the same time facilitate the customized construction and upgrading of the system?

Method used

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. Combining the reordering model and the large language model, the text fragments are spliced ​​and integrated to form prompt words to answer user questions.

Benefits of technology

It achieves improved relevance and accuracy of the question-answering process by incorporating contextual information entropy without altering the reordering model, facilitating knowledge base updates and modifications, and supporting modular construction and upgrades of intelligent agents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121034646A_ABST
    Figure CN121034646A_ABST
Patent Text Reader

Abstract

The invention relates to a modular medical agent construction method and system, and the method achieves the intelligent medical assistance through the modular design and integration of an agent model. Comprising the following steps: searching a vector database based on a vector group, a vector group and a weight value to obtain a first text fragment and a second text fragment; inputting the first text fragment and the second text fragments into a reordering model, and extracting most relevant tK partial fragments; and using a template to integrate the tK partial fragments and the user questions to form a cue word input large language model. According to the method, a modular construction mode based on the text data stream is adopted, on the basis of remarkably improving the session correlation and accuracy of the agents, selection, replacement and upgrading of the agents are facilitated, compatibility is high, systematic customized construction can be carried out for users, and a new solution is provided for individualized intelligent medical assistance.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of intelligent medical treatment, and particularly relates to a modular medical intelligent body construction method and system. BACKGROUND

[0002] The application of artificial intelligence in the medical field is becoming more and more necessary; the specific combination of artificial intelligence technology and the medical field includes: for improving the accuracy of diagnosis: the demand for professional doctors for medical image analysis, pathological diagnosis and other tasks is extremely high, and artificial intelligence can assist doctors in faster and more accurate diagnosis through deep learning and other technologies, reduce human errors and improve the quality of medical services. For optimizing treatment plan: analyzing a large amount of medical data, including patient medical history, genetic information, living habits, etc., to provide personalized treatment plan for doctors and improve treatment effect. For alleviating the shortage of medical resources: in areas where medical resources are unevenly distributed, through remote diagnosis, intelligent monitoring and other ways, provide timely medical services for patients and alleviate the problem of doctor shortage. For improving the quality of patient care: through intelligent devices to monitor the physiological parameters of patients, timely find abnormal conditions and provide continuous nursing services for patients. For enhancing disease prevention: by analyzing public health data, help predict the trend of disease prevalence, provide scientific basis for disease prevention and control. For improving medical decision: assist doctors in making complex medical decisions, provide data-based decision support to help doctors choose the best treatment plan. For promoting the use of medical data: a large amount of data has been generated in the medical field, which helps to analyze and interpret these data and 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. Agents are software entities capable of autonomous task execution, perceiving the environment, making decisions, and taking actions. The background technology of modular medical agents covers multiple fields, including artificial intelligence, machine learning, natural language processing, medical image analysis, etc. The agent framework is a reference architecture for deploying and orchestrating multi-modal AI agents, enabling multi-step reasoning by integrating image and text data with human-like logic. It supports custom workflows through agent-based customizable processing and reduces integration complexity by easily bridging visual and linguistic components; modular construction techniques can use a variety of artificial intelligence resources, and can be freely selected through module reloading, and these artificial intelligence resources can be compatible and expanded; for example: MONAI agent architecture adopts a modular design, supporting cross-modal reasoning for medical AI, enabling multi-step reasoning by integrating image and text data with human-like logic. Large language models are the "brain" of the agent, responsible for coordinating decision-making. LLMs reason through tasks, develop action plans, select appropriate tools, and manage access to necessary data to achieve goals. Specifically: individualized precision medicine based on patient-specific characteristics such as genetics, physiology, and pathology can improve treatment efficacy while reducing adverse reactions, and can promote more rational allocation of medical resources. The development of LLMs provides new means for individualized precision medicine. Current research has attempted to explore the application of LLMs in precision medicine. With natural language interaction and efficient integration of patient information and existing knowledge, LLMs show great potential in this area, but the illusion problem of LLMs often leads to inaccurate answers. Memory modules can maintain context through memory and can be adjusted based on ongoing tasks or historical tasks, including short-term memory and long-term memory. PPK research provides an important reference for clinical individualized medication and has been widely used in drug therapy, involving narrow therapeutic window, large metabolic individual differences, and special population medication. PPK models encounter many inconveniences in clinical applications. First, each model is only applicable to a specific drug and population range. Selecting the appropriate model from numerous models based on patient-specific characteristics requires clinical practitioners to familiarize themselves with the characteristics of each model. Second, the usability of PPK models needs to be improved. In addition to the complex user interface, using PPK models requires setting numerous parameters, which is tedious and prone to errors, limiting their clinical application. Using modular construction techniques can make full use of artificial intelligence resources based on the characteristics and differences of various types of artificial agents, enabling computer systems to perform tasks that require human intelligence, such as diagnosis, treatment recommendations, and health management.

[0004] In the modular medical agent construction process, how to build the agent so as to fully utilize various artificial intelligence resources and realize the full integration of artificial intelligence technology, knowledge base and medical technology is a technical problem to be solved. Based on the above problems, the modular construction method based on text data flow is beneficial to the selection, replacement and upgrading of the agent, has strong compatibility, can be customized for the user, and provides a new solution for individual intelligent medical assistance. SUMMARY

[0005] In order to solve the above problems in the prior art, the present application provides a modular medical agent construction method and system, the method comprising: Step S1: divide the current text into multiple text blocks and convert them into corresponding vectors, search the vector database to obtain a first text segment; set a weight value for the vector based on the relevance of the text block and the context; search the vector database based on the weight value to obtain a second text segment; Step S2: input the first text segment and the second text segment into a reordering model to extract the most relevant tK partial segments; specifically: Step S21: input the first text segment into the reordering model to extract the most relevant first partial segment and the first other segment that has not been extracted; input the second text segment into the reordering model to extract the most relevant second partial segment and the second other segment that has not been extracted; Step S22: place the first partial segment and the second partial segment in the partial segment set; place the first other segment and the second other segment in the other segment set; Step S23: select one partial segment from the partial segment set and one other segment from the other segment set, and splice the two to obtain a temporary text segment; input the temporary text segment into the reordering model to extract the most relevant temporary partial segment and the temporary other segment that has not been extracted; Step S24: place the most relevant temporary partial segment in the partial segment set and the temporary other segment in the other segment set; remove duplicates and increment the duplicate removal number for the partial segment when placing; if the cutoff condition is met, proceed to the next step; otherwise, return to step S23; Step S25: select the top tK partial segments in the partial segment set according to the duplicate removal number; Step S3: integrate the tK partial segments and the user's question with the template to form a prompt word and input it into a large language model.

[0006] Further, the vector database is pre-constructed, and the prior knowledge is divided into text blocks and vectorized for storage in the vector database.

[0007] Further, the step S1 is specifically: Step S11: obtaining the current text and context in the conversation; arranging the context into a plurality of historical texts in chronological order or according to importance ; Step S12: dividing the current text into a plurality of current text blocks , wherein: is the c-th text block of the current text ; IC is the number of divided text blocks ; Step S13: determining the correlation degree of each current text block with each of the historical texts ; Step S14: calculating the association information entropy of each current text block relative to the historical texts ; Step S15: converting each text block into a corresponding vector vc, combining the vectors vc corresponding to the text blocks c to search the vector database to obtain K1 first text segments most similar to the current text; taking the association information entropy as the weight value of the current vector vc; searching the vector database based on the vectors vc corresponding to all text blocks c and their respective weight values to obtain K2 second text segments most similar to the current text under the condition of weighting.

[0008] Further, the context includes patient attribute information and historical dialogue information to which the current text is directed.

[0009] Further, the current text and the context are in the same conversation.

[0010] Further, K1 and K2 are preset values.

[0011] Further, K1=K2.

[0012] Further, the text blocks are converted into vectors by using an embedding model.

[0013] A modular medical intelligent agent construction system for implementing the above modular medical intelligent agent construction method.

[0014] A modular medical intelligent agent construction platform for implementing the above modular medical intelligent agent construction method.

[0015] The beneficial effects of the present application include: ​(1) Based on the session-based text data stream, the modular construction of the medical agent can be carried out, and the information extraction and information carrying can be carried out based on the functional differences of different agent types. For example, by associating information entropy, the context-related differential information can be carried in the text segment extraction without changing the reordering model, and by hybrid construction, the text segment can fully and hierarchically obtain the relevant information of the knowledge base in the one-dimensional calculation space, thereby providing a basis for the construction of detailed prompt words. The modular construction method is beneficial to the selection, replacement and upgrading of the agent. (2) By associating information entropy, the question and answer process and the context can form a non-semantic level correlation. When searching the knowledge base, the semantic information of the context does not need to be introduced to maintain the current knowledge base data entry size, which can facilitate the updating and modification of the knowledge base, and can support the modular construction of the agent. In addition, it can also be compatible with the existing search weight system. BRIEF DESCRIPTION OF DRAWINGS

[0016] The drawings described herein are used to provide a further understanding of the present application, and form a part of the present application, but do not constitute an improper limitation on the present application. In the drawings: Figure 1 The modular medical agent construction method provided by the present application is shown in the figure.

[0017] Figure 2 The modular medical agent text data stream provided by the present application is shown in the figure. DETAILED DESCRIPTION

[0018] The present application will be described in detail below in conjunction with the drawings and specific embodiments, wherein the illustrative embodiments and descriptions are only used to explain the present application, but do not constitute a limitation on the present application.

[0019] In the modular construction technology, various artificial intelligence resources can be used, and these artificial intelligence resources can be freely selected and compatible expanded by reloading the modules to construct a local knowledge base covering the medical knowledge demand as the core support of the knowledge query type problem. In the process of constructing the modular medical agent, the construction of the local knowledge base is often the first step. 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; As attached Figure 1 and 2 As shown, the modular medical intelligent agent construction method includes the following steps: 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. 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. Step S1 specifically includes the following steps: Step S11: Obtain the current text and context in the session; organize the context into multiple historical texts according to chronological order or importance. ; 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; 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. Step S13: Determine each current text block and historical texts The degree of relevance of each of them ; 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. 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; (1); (2); (3); 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; 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; 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. 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. Preferably: K1 and K2 are preset values; K1 and K2 are of similar order of magnitude; for example, set K1=K2; Preferably, the first text fragment and the second text fragment may or may not contain the same text fragment; 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; Preferred approach: Load different vector databases for different contexts; vectorization of text can speed up retrieval and facilitate weighted retrieval using multiple text blocks; 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; 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: Step S21: inputting K1 first text segments into the reordering model to extract U most relevant first partial segments and U first other segments which are not extracted; inputting K2 second text segments into the reordering model to extract U most relevant second partial segments and U second other segments which are not extracted; that is, the other segments are the remaining part of the extracted partial segments; Preferably, the U is a preset value. Preferably, the partial segments and the other segments constitute the whole text segments or the main part of the text segments; here, the text segments are divided into two parts by extraction, of course, in the case of not considering the calculation complexity or the text segments being large, the text segments can be divided into multiple parts; Step S22: putting the U first partial segments and the U most relevant second partial segments into the partial segment set; putting the U first other segments and the U second other segments into the other segment set; wherein, the initial value of the partial segment set and the other segment set is an empty set; Preferably, when putting the first partial segments into the partial judgment set, the first partial segments are de-duplicated; the de-duplication is absolute de-duplication or loose de-duplication; the absolute de-duplication is a common form of set merging, when two elements in the set are exactly the same, only one element is retained in the set; the relative de-duplication is de-duplication within a certain similarity range, so that two partial segments with high similarity are merged into one partial segment or one of them is retained and the remaining other partial segment is deleted; Step S23: selecting one partial segment from the partial segment set and one other segment from the other segment set, and splicing the two to obtain a temporary text segment; repeating the step to obtain Uk temporary text segments; inputting the Uk temporary text segments into the reordering model to extract Uk most relevant temporary partial segments and Uk temporary other segments which are not extracted; Preferably, the Uk is a preset value; the setting and selection of the Uk are related to the size of the partial segment set; Preferably, before splicing one partial segment and one other segment, it is judged whether the two meet the splicing condition, if yes, the two are spliced to obtain a temporary text segment; otherwise, the selection is repeated; Preferably, the selection is random selection, non-repeated random selection, selection based on the length of the text segment, etc. 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. 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; 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: 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; 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; Preferred: Calculate the K2 first similarity vectors corresponding to the K2 second text segments using a similar method. >, ic = 1 ~ IC, k2 = 1 ~ K2; Step S233: Calculate the mean vector of the K1 first similarity vectors. >=< >As a threshold vector; 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; 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. Preferred: Variance threshold is a preset value; Step S24: Put the Uk most relevant temporary partial segments into the partial segment set; duplication needs to be removed when putting in, and when duplication occurs, the duplication number of the partial segment (temporary partial segment) to which the duplication is directed is incremented; put the Uk temporary other segments into the other segment set, and duplication needs to be removed when putting in; determine whether the first cutoff condition is met, if yes, go to the next step; otherwise, return to step S23; Wherein: the first cutoff condition is that any one of the Uk most relevant temporary partial segments obtained exists a partial segment and its similarity in the partial segment set; of course, the cutoff condition limit can also be appropriately relaxed, when almost all of the most relevant temporary partial segments exist a partial segment and its similarity in the partial segment set, it is determined that the first cutoff condition is met; Alternatively: the number of elements in the partial segment set is greater than a preset number or the execution number of steps S23-S24 exceeds a preset execution number; for example: set the preset execution number to 1-5; Preferably: the initial value of the duplication number associated with each partial segment in the partial segment set is 0; Step S25: Select the topK most similar partial segments from the partial segment set; Specifically: sort the partial segments in the partial segment set according to the duplication number, and select the topK partial segments as the selected partial segments; Preferably: the reordering model is bce-reranker-base_v1, Cross-Encoder Reranker, BERT, etc. Preferably: in the initial state when the context is empty, in this step S1-S2, each text block is converted into a corresponding vector vc, and the vector database is searched based on the vectors vc corresponding to all text blocks c to obtain K1 first text segments most similar to the current text, and the K1 first text segments are input into the reordering model to extract the topK most relevant partial segments; then go to step S3; It can be seen that the above-mentioned repeated splicing process is the process of hybrid construction of text segments, and the knowledge base related information is fully and sufficiently obtained in the one-dimensional calculation space (the splitting mode is a one-dimensional calculation mode) through hybrid construction of text segments. Therefore, important text parts are obtained multiple times due to the existence of many repeated text parts between the temporary text segments obtained in succession, and vice versa, the number of times of obtaining is less. Correspondingly, the knowledge base related information obtained is necessarily hierarchical, and when the input information of many large language models is sufficient, it is beneficial to obtain more accurate and effective answer information. Therefore, hybridization is conducive to improving the efficiency of human-computer interaction; Step S3: integrating the topK partial fragments and the user question using a template to form a prompt word; inputting the prompt word into a large language model to obtain an answer, and feeding back the answer to the user; Preferably, the partial fragments are screened and cleaned; specifically, the topK reordered partial fragments are subjected to a de-duplication process to remove duplicate text fragments; further including truncating the super-long text fragments and retaining only the core sentences; Preferably, the length of each finally formed prompt word is controlled, for example, the length is controlled to be 50-100 words; of course, the prompt word length is related to the input size of the large prediction model; Preferably, the template is a dynamic template, and the template corresponding to the type of the user question is obtained based on the type; a field-content matching rule table is established for each field in the template; the matching rule and priority of each field are set in the table; for example, a field is defined, the matching rule of which is a professional term, and the priority is high; the matching rule of a data support field is to contain numbers / percentages, and the priority is medium; the matching rule of a reference type field is to contain specific names of persons, institutions, and / or time and place, and the priority is low; The partial fragments and the user question are integrated using a template; specifically, metadata labels are generated for each component in the partial fragments and the user question; and the metadata labels are filled into the corresponding fields of the template based on the metadata labels; Preferably, the large language model is one of DeepSeek-R1, OpenAI, PaLM, LLaMA, Anthropic, Med-PaLM 2, BioGPT, GitHub Copilot, StarCoder, etc. Preferably, the intelligent agents are integrated using a Dify workflow, and the intelligent agent workflow is integrated by setting the functional modules to implement the above method steps; Preferably, before the conversation is created, the above-mentioned artificial intelligence agents such as embedding models, vector databases, large language models, and reordering models are selected based on context information and patient attribute information; the patient attribute information can be manually entered or actively obtained through natural language interaction; Based on the same inventive concept, the present application also provides a modular medical intelligent agent construction system, which is used to implement the above-mentioned modular medical intelligent agent construction method; the built intelligent agent can answer questions and conduct corresponding conversations according to the knowledge base through natural language interaction; for example, Figure 2 As shown, when the user asks for drug recommendations for neonatal pulmonary Candida albicans infection, the intelligent agent first searches the local knowledge base and makes an answer based on the knowledge base content, while listing the reference sources.

[0020] Preferably, the method further comprises step S4: the large language model agent contains a pharmacokinetic model, which can further select a suitable pharmacokinetic model based on user attribute information and user questions to calculate recommended doses and answer; feedback individual pharmacokinetic parameters and drug-time curves drawn therefrom to the user; and save the answer as context information; Specifically: sending prompt words to the population pharmacokinetics PPK model; the population pharmacokinetics PPK model defines the differential equations of the blood drug concentration in each compartment of the specific drug compartment model and the mean, distribution and mutual relationship of each parameter, establishes a mathematical model framework for pharmacokinetic calculation; uses a programming language to run the mathematical model to realize the solution of the pharmacokinetic process and the sampling calculation related to the Bayesian feedback method; the PPK model is provided with a reserved parameter interface for receiving user attributes (age, weight, liver and kidney function indicators, medication history, etc.); Preferably: through a pre-set standardized input interface, define parameter formats, JSON formats, key-value pair mapping and other delivery rules to ensure that external data can be accurately transmitted into the population pharmacokinetics PPK model for calculation; Preferably: with the help of a Web framework such as Flask, encapsulate the built PPK model into a callable service module and deploy it to a server; based on input information (such as prompt words), trigger the pharmacokinetic model to output pharmacokinetic calculation results such as drug concentration-time curve data and dose adjustment suggestions; Preferably, step S4 specifically comprises the following steps: Step S41: identify user attribute information from prompt words; for example, from "55-year-old female, 160cm tall, 55kg weight, liver function Child-Pugh B level, using carbamazepine, current blood drug concentration 2μg / ml, adjusting dose", extract parameters such as age (55 years old), gender (female), height (160cm), weight (55kg), liver function classification (Child-Pugh B level), current drug (carbamazepine), and blood drug concentration (2μg / ml); and further convert them into structured data (such as dictionary format: {"age": 55, "gender": "female", "height": 160, "weight": 55, "liver_function": "Child-Pugh B", "drug": "carbamazepine", "current_concentration": 2}) recognizable by the pharmacokinetic model.

[0021] 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.

[0022] 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. 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. Step S45: Return the structured computation results; 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: 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. Preferred: Based on the PPK model to generate the drug-time curve, by calling the visualization module Matplotlib, Plotly, according to the blood concentration-time data calculated by the PPK model, the drug-time curve is generated, which contains coordinate axis annotation, concentration change trend, key time point concentration value, etc.; and the feedback content is embedded in the form of pictures, interactive charts; Preferred: Through the user interaction interface of the web page, mobile terminal application, API interface, the natural language answer and the drug-time curve are fed back to the user synchronously, completing the "question-answer" closed loop, and supporting further questioning and interaction of the user; A computer program (also known as a program, software, software application, script, or code) can be written in any form of programming language, including compiled or interpreted languages, declarative or procedural languages, and it can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, object, or other unit suitable for use in a computing environment. A computer program may, but need not, correspond to a file in a file system. A program can be stored in a portion 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 the program in question, or in multiple coordinated files (e.g., files that store one or more modules, sub programs, or portions of code). A computer program can be deployed to be executed on one computer or on multiple computers that are located at one site or distributed across multiple sites and interconnected by a communication network.

[0023] Those skilled in the art will appreciate that embodiments of the present application can be provided as methods, systems, or computer program products. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage media, etc.) having computer usable program code embodied in the medium.

[0024] The present application is described with reference to the flowcharts and / or block diagrams of the methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowcharts 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, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in a flow or multiple flows and / or blocks Figure 1 The means for performing the functions specified in a flow or multiple flows and / or blocks.

[0025] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the flow Figure 1 one or more flow or block Figure 1 one or more blocks or blocks specified in the flow.

[0026] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions executed on the computer or other programmable apparatus provide steps for implementing the flow Figure 1 one or more flow or block Figure 1 one or more blocks or blocks specified in the flow.

[0027] Finally, it should be noted that the above-mentioned embodiments are merely used to illustrate the technical solutions of the present application, rather than limiting the same. Even though the present application has been described in detail with reference to the above-mentioned embodiments, those skilled in the art should understand that the specific embodiments of the present application can be modified or replaced equivalently without departing from the spirit and scope of the present application, and any modification or replacement without departing from the spirit and scope of the present application should be included in the protection scope of the claims of the present application.

Claims

1. A modular medical agent construction method, characterized by, The method comprises: Step S1: dividing the current text into multiple text blocks and converting them into corresponding vectors, searching a vector database to obtain a first text segment; setting a weight value for the vectors based on the relevance of the text blocks and the context; searching the vector database based on the weight value to obtain a second text segment; Step S2: inputting the first text segment and the second text segment into a reordering model to extract the most relevant tK partial segments; specifically: Step S21: inputting the first text segment into the reordering model to extract the most relevant first partial segment and the first other segment that has not been extracted; inputting the second text segment into the reordering model to extract the most relevant second partial segment and the second other segment that has not been extracted; Step S22: placing the first partial segment and the second partial segment into a partial segment set; placing the first other segment and the second other segment into an other segment set; Step S23: selecting one partial segment from the partial segment set and one other segment from the other segment set, and splicing the two to obtain a temporary text segment; inputting the temporary text segment into the reordering model to extract the most relevant temporary partial segment and the temporary other segment that has not been extracted; Step S24: placing the most relevant temporary partial segment into the partial segment set and the temporary other segment into the other segment set; removing duplicates and incrementing the duplicate removal number of the partial segment to which the duplicate removal is directed when placing; if the termination condition is met, proceeding to the next step; otherwise, returning to step S23; Step S25: selecting the top tK partial segments in the partial segment set according to the duplicate removal number of the partial segments; Step S3: integrating the tK partial segments and the user's question with a template to form a prompt word and inputting it into a large language model.

2. The modular medical agent construction method of claim 1, wherein, A vector database is constructed in advance, and the prior knowledge is divided into text blocks and vectorized, and then stored in the vector database.

3. The modular medical agent construction method of claim 2, wherein, The step S1 specifically comprises: Step S11: obtaining the current text and context in the conversation; arranging the context into a plurality of historical texts in chronological order or according to importance ; 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. 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 computing its associated information entropy relative to the historical texts ; 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; search the vector database based on the vector vc corresponding to all text blocks c and their respective weight values ​​to obtain K2 second text segments that are most similar to the current text under the weighted condition.

4. The modular medical agent construction method of claim 3, wherein, The context includes patient attribute information and historical dialogue information related to the current text.

5. The modular medical agent construction method of claim 4, wherein, The current text and the context are in the same session.

6. The modular medical agent construction method of claim 5, wherein, K1 and K2 are preset values.

7. The modular medical agent construction method of claim 6, wherein, K1=K2.

8. The modular medical agent construction method of claim 7, wherein, The text blocks are converted into vectors using an embedding model.

9. A modular medical agent construction system, comprising: The modular medical intelligent agent construction system is used to implement the modular medical intelligent agent construction method of any one of claims 1-8.

10. A modular medical agent building platform, comprising: The modular medical intelligent agent construction platform is used to implement the modular medical intelligent agent construction method of any one of claims 1-8.

Citation Information

Patent Citations

  • Medical auxiliary question and answer method and system based on knowledge calibration and retrieval enhancement

    CN117573843A

  • Government affair intelligent response device and method based on intention recognition and large language model

    CN118035419A

  • Medical question and answer method and system based on large language model and storage medium

    CN118152533A

  • Text processing method and device for improving information retrieval and generation quality and computer system

    CN118535710A

  • Memory retrieval method for enhancing multi-modal long-context dialogue ability of large language model

    CN119293139A