Traditional Chinese medicine intelligent agent construction method and system based on LangChain framework and medium

By building a traditional Chinese medicine intelligent body operation and maintenance platform based on the LangChain framework, sorting out the knowledge base of paste formula and selecting suitable large models, realizing multi-agent collaboration, solving the problems of high complexity and single functions of the existing platform, and improving user experience and efficiency.

CN120297318AActive Publication Date: 2025-07-11QIYUAN MIAOHE MEDICAL TECHNOLOGY (SICHUAN) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510426719.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-07
Publication Date
2025-07-11
Estimated Expiration
2045-04-07

AI Technical Summary

Technical Problem

The existing traditional Chinese medicine large model intelligent platform has high complexity, is difficult to get started, has a single function, poor coordination between intelligent units, poor user experience, and cannot meet diversified needs.

Method used

Based on the LangChain framework, a Chinese medicine Guzheng intelligent body operation and maintenance platform is built, and a Chinese medicine paste prescription is organized through an expert system, a professional knowledge base is built, suitable underlying model is selected, business logic arrangement is realized, and switching and collaborative work of multiple intelligent bodies is realized on the Chinese medicine Guzheng mini program terminal.

Benefits of technology

The platform architecture is simple, easy to use by non-technical personnel, and has comprehensive functions. Multiple agents work together on the same chat page, improving operational convenience and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120297318A_ABST
    Figure CN120297318A_ABST
Patent Text Reader

Abstract

The invention discloses a traditional Chinese medicine agent construction method and system based on a LangChain framework and a medium, and belongs to the technical field of agent construction. The method comprises the following steps: a platform construction stage: constructing a traditional Chinese medicine consolidation and correction agent operation and maintenance platform based on a LangChain architecture; a knowledge base construction stage: arranging traditional Chinese medicine ointment and meridian prescriptions through an expert system, and constructing a traditional Chinese medicine professional knowledge base based on a fragment embedding mode; selecting a bottom-layer large model of the intelligent agent according to limitation and requirements; a service logic arrangement stage: performing service logic arrangement of a specific scene agent based on the advanced arrangement capability, embedding a knowledge base and deploying professional cue words; and an agent release stage: releasing the agents, constructing a traditional Chinese medicine consolidation applet based on the agents, and realizing switching collaboration of different agents in a single dialogue at a traditional Chinese medicine consolidation applet end. The platform is simple in architecture, the intelligent agent is basically achieved through workflow advanced arrangement, and many users, especially non-technical personnel, can rapidly master the using method of the intelligent agent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of agent construction, and particularly to a method, system and medium for constructing a traditional Chinese medicine agent based on the LangChain framework. Background Art

[0002] Currently, the application of the combination of the traditional Chinese medicine industry and large models mainly focuses on aspects such as auxiliary diagnosis, personalized treatment, traditional Chinese medicine research and development, health management, and knowledge dissemination. In the field of auxiliary diagnosis, large models help doctors identify syndromes and predict diseases by analyzing multi-modal data such as patients' medical records, tongue images, and pulse conditions. For example, the AI traditional Chinese medicine diagnostic instrument generates a constitution analysis report through tongue image and face recognition. In terms of personalized treatment, large models can recommend personalized traditional Chinese medicine prescriptions and acupuncture plans according to the patient's constitution and condition, improving the accuracy of treatment. In traditional Chinese medicine research and development, large models accelerate the screening and optimization of new drugs by analyzing the components and mechanisms of traditional Chinese medicines. For example, the "Digital and Intelligent Materia Medica" large model of Tasly has made progress in the drug screening for diabetic nephropathy and pulmonary fibrosis. In addition, large models are also used in health management to provide constitution identification and health preservation suggestions by analyzing users' health data, and even to recommend tea drinks in some tea shops. In terms of knowledge dissemination, large models provide a convenient way for practitioners and the public to obtain knowledge by constructing a traditional Chinese medicine knowledge graph and integrating ancient books and the experience of famous doctors.

[0003] However, there are still some problems in the existing technical solutions. First, the current various intelligent agent platforms based on large models are highly complex and difficult to get started, and many users, especially non-technical personnel, are difficult to quickly master their usage methods, which limits their wide application. Second, the business goals achieved by these platforms are single, often focusing on a specific task, such as only providing diagnostic suggestions or health management services, and lacking comprehensive function integration, resulting in poor user experience and unable to meet diverse needs. Finally, the collaboration between intelligent agents is poor, usually unable to switch and collaborate multiple intelligent agents on the same chat page, and users need to use different platforms or tools respectively to complete complex tasks, which not only increases the operation complexity but also reduces the efficiency. These problems limit the further promotion and application of large model technology in the traditional Chinese medicine industry. Summary of the Invention

[0004] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a method, system and medium for constructing a traditional Chinese medicine agent based on the LangChain framework.

[0005] The purpose of the present invention is achieved by the following technical solutions: The first aspect of the present invention provides: A method for constructing a traditional Chinese medicine agent based on the LangChain framework, including the following steps: Platform construction stage: Build the operation and maintenance platform for the Traditional Chinese Medicine Guzheng intelligent agent based on the LangChain architecture; Knowledge base construction stage: Organize the traditional Chinese medicine plaster prescriptions and classical prescriptions through an expert system, and build a professional knowledge base of traditional Chinese medicine based on the sharding embedding mode; Large model selection stage: Select the underlying large model of the intelligent agent according to input limitations, output limitations, scenario requirement limitations, and the business processing ability requirements of the model; Business logic orchestration stage: Orchestrate the business logic of the intelligent agent for specific scenarios based on advanced orchestration capabilities, embed the knowledge base, and deploy professional prompt words; Intelligent agent release stage: Release the intelligent agent, construct the Traditional Chinese Medicine Guzheng mini-program based on the intelligent agent, and realize the switching and collaboration of different intelligent agents in a single conversation on the Traditional Chinese Medicine Guzheng mini-program side.

[0006] Preferably, the knowledge base construction stage further includes the following steps: Collect plaster prescription data and classical prescription data from traditional Chinese medicine classic literatures, modern research papers, and clinical practice cases; Clean, classify, and label the plaster prescription data and classical prescription data to establish a structured database; Adopt the sharding embedding method to decompose the plaster prescription knowledge and classical prescription knowledge into multiple semantic fragments, each semantic fragment contains specific knowledge points, and convert the text into vectors through an embedding model.

[0007] Preferably, the specific knowledge points include medicinal material composition, efficacy, indications, and taboos; the embedding model is Doubao-embedding.

[0008] Preferably, the input limitations include symptom descriptions, data matched in the knowledge base, prompt words, and context; the output limitations include plaster prescription recommendations; the scenario requirement limitations include the ability to understand traditional Chinese medicine terms and a logical reasoning ability greater than a preset threshold; the business processing ability requirements include supporting knowledge base calls, context memory, and multi-task processing; the underlying large models include Doubao-1.5-pro-256k, Doubao-1.5-vision-pro-32k, and DeepSeek-R1.

[0009] Preferably, the specific scenarios include plaster prescription recommendations, symptom diagnosis, and health consultation. The business logic orchestration stage further includes the following steps: Orchestrate the business process of the intelligent agent according to specific scenarios, embed the plaster prescription knowledge base and classical prescription knowledge base into the intelligent agent through the integrated deployment of the platform, and set traditional Chinese medicine scenario prompt words.

[0010] Preferably, the intelligent agent release stage further includes the following steps: Deploy the trained and orchestrated agents to a cloud platform or on-premises server and configure the API interface; Construct the Traditional Chinese Medicine Strengthening Health Mini Program based on the deployed agents; When the user switches different agents in the Traditional Chinese Medicine Strengthening Health Mini Program according to requirements, preserve the context information for sharing and enable the different agents to work collaboratively; Real-time optimize the interaction experience of the agents through natural language processing methods.

[0011] Preferably, the Traditional Chinese Medicine Strengthening Health Agent Operation and Maintenance Platform includes a model layer, an interaction layer, and a data layer; The model layer is used to provide model support, responsible for managing and distributing AI models. The model layer includes a One API Management & Distribution System, and the One API Management & Distribution System connects to the Doubao model and DeepSeek; The interaction layer is used to provide service support. The interaction layer includes the LangChain framework, the React framework, and provides plugin services and advanced orchestration functions; The data layer is used to provide data support, responsible for data storage and management. The data layer includes a MongoDB database, a Redis in-memory database, a MySQL relational database, and a PgVector database extension plugin; the MongoDB database is used to store unstructured data; the Redis in-memory database is used to cache frequently accessed data to improve the response speed and performance of the system; the MySQL relational database is used to store structured data; the PgVector database extension plugin is used to store and retrieve embedding vectors.

[0012] Preferably, the unstructured data includes user conversation records and Traditional Chinese Medicine knowledge bases; the frequently accessed data includes user conversations and model inference results; the structured data includes user information and model configurations; the embedding vectors include semantic vectors of the Traditional Chinese Medicine knowledge base.

[0013] The second aspect of the present invention provides: A Traditional Chinese Medicine intelligent agent construction system based on the LangChain framework, used to implement any of the above Traditional Chinese Medicine intelligent agent construction methods based on the LangChain framework, including: A platform construction module, used to construct the Traditional Chinese Medicine Strengthening Health Agent Operation and Maintenance Platform based on the LangChain architecture; A knowledge base construction module, used to organize Traditional Chinese Medicine plaster prescriptions and classical prescriptions through an expert system and construct a Traditional Chinese Medicine professional knowledge base based on a sharded embedding mode; A large model selection module, used to select the underlying large model of the agent according to input limitations, output limitations, scenario requirement limitations, and the business processing ability requirements of the model; The business logic orchestration module is used to orchestrate the business logic of specific scenario agents based on advanced orchestration capabilities, embed a knowledge base, and deploy professional prompt words. The agent publishing module is used to publish agents, construct the Traditional Chinese Medicine Solidarity Mini Program based on the agents, and realize the switching and collaboration of different agents in a single conversation on the Traditional Chinese Medicine Solidarity Mini Program side.

[0014] The third aspect of the present invention provides: a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are loaded and executed by a processor, the above-mentioned method for constructing a Traditional Chinese Medicine agent based on the LangChain framework is realized.

[0015] The beneficial effects of the present invention are: 1) The architecture of the platform is simple. Agents are basically realized through advanced workflow orchestration, and many users, especially non-technical personnel, can quickly master its usage method.

[0016] 2) When constructing Traditional Chinese Medicine agents, relatively comprehensive capabilities are considered. It not only has basic question-and-answer capabilities but also adapts to two sets of prompt words and knowledge bases, which is a comprehensive function integration and can meet diverse needs.

[0017] 3) On the mini-program side, a collaborative working method among multiple agents is adopted to realize the switching and collaborative working of multiple agents on the same chat page. Users no longer need to use different platforms or tools separately to complete complex tasks, which not only increases the operation convenience but also greatly improves the efficiency. Description of the Drawings

[0018] Figure 1 It is a flowchart of the method for constructing a Traditional Chinese Medicine agent based on the LangChain framework; Figure 2 It is a structural block diagram of the Traditional Chinese Medicine Solidarity agent operation and maintenance platform; Figure 3 It is a flowchart of the orchestration of the paste formula and classical formula agent; Figure 4 It is a schematic diagram of the collaborative working of multiple agents on the Traditional Chinese Medicine Solidarity Mini Program. Detailed Embodiments

[0019] Next, the technical solutions of the present invention will be clearly and completely described in conjunction with the embodiments. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts fall within the protection scope of the present invention.

[0020] Refer to Figures 1 - 4, the first aspect of the present invention provides: A method for constructing a traditional Chinese medicine intelligent agent based on the LangChain framework, including the following steps: Platform construction stage: Construct a traditional Chinese medicine Guzheng intelligent agent operation and maintenance platform based on the LangChain architecture; Knowledge base construction stage: Organize traditional Chinese medicine plaster prescriptions and classical prescriptions through an expert system, and construct a traditional Chinese medicine professional knowledge base based on the sharding embedding mode; Large model selection stage: Select the underlying large model of the intelligent agent according to input restrictions, output restrictions, scenario requirement restrictions, and the business processing ability requirements of the model; Business logic orchestration stage: Orchestrate the business logic of the intelligent agent for specific scenarios based on advanced orchestration capabilities, embed the knowledge base, and deploy professional prompt words; Intelligent agent release stage: Release the intelligent agent, construct a traditional Chinese medicine Guzheng mini-program based on the intelligent agent, and realize the switching and collaboration of different intelligent agents in a single conversation on the traditional Chinese medicine Guzheng mini-program side.

[0021] In this embodiment, as Figure 3 shown, it demonstrates the intelligent agent orchestration process of plaster prescriptions and classical prescriptions implemented based on the Guzheng platform, enabling the intelligent agent to simultaneously possess the capabilities of prescribing, professional knowledge answering, and basic answering. In the first link, the model (Doubao) can not only control the prescribing logic through professional customized prompt words but also stably output the prescription template for prescribing. In the second link, the model (DeepSeek-R1) can combine the content retrieved from the knowledge base and the prompt words for optimizing the output format to reply to the user with professional knowledge of industry experts. In the third link, when the user asks something unrelated to traditional Chinese medicine Guzheng prescribing, it will reply based on the capabilities of the model itself, and at the same time, there are certain reply restrictions according to the prompt words to ensure security.

[0022] As Figure 4 shown, it demonstrates the solution for multi-intelligent agent collaborative work in the traditional Chinese medicine Guzheng mini-program. After the user enters the main page of the mini-program, a new conversation window can be opened for a single conversation, where the intelligent agent can be freely switched at will, and diverse intelligent agents are used to cooperate to complete their tasks. For example: The user can first upload a tongue coating image, and the image recognition intelligent agent can recognize and describe the tongue coating information. Then, the user can ask the classical prescription intelligent agent to prescribe for their symptoms. While understanding the patient's description, the classical prescription intelligent agent can combine the tongue coating content output by the image recognition intelligent agent in the above text to reply and prescribe, which is more suitable for the needs of the actual scenario.

[0023] In some embodiments, the knowledge base construction stage further includes the following steps: Collect plaster data and classical prescription data from traditional Chinese medicine classic literatures, modern research papers, and clinical practice cases; Clean, classify, and label the plaster data and classical prescription data to establish a structured database; Using the sharding embedding method, the knowledge of paste prescriptions and classical prescriptions is decomposed into multiple semantic fragments, each semantic fragment contains specific knowledge points, and the text is transformed into vectors through an embedding model.

[0024] In this embodiment, it includes two parts: 1. Data collection and collation: Collect relevant data on paste prescriptions and classical prescriptions from multiple channels such as traditional Chinese medicine classic literature, modern research papers, and clinical practice cases. Clean, classify, and label the data to ensure the accuracy and availability of the data. Establish a structured database for subsequent knowledge base construction and agent invocation. 2. Construct a knowledge base in the sharding embedding mode: Use sharding embedding technology (such as vectorized embedding) to decompose the knowledge of traditional Chinese medicine paste prescriptions and classical prescriptions into multiple semantic fragments. Each fragment contains specific knowledge points (such as medicinal material composition, efficacy, indications, taboos, etc.), which is convenient for the agent to quickly retrieve and understand. Transform the text into vectors through an embedding model (such as Doubao-embedding, etc.) to support semantic search and context understanding.

[0025] In some embodiments, the specific knowledge points include medicinal material composition, efficacy, indications, taboos; the embedding model is Doubao-embedding.

[0026] In some embodiments, the input restrictions include symptom description, data matched with the knowledge base, prompt words, context; the output restrictions include paste prescription recommendations; the scenario requirement restrictions include the ability to understand traditional Chinese medicine terms and a logical reasoning ability greater than a preset threshold; the business processing ability requirements include supporting knowledge base invocation, context memory, and multi-task processing; the underlying large models include Doubao-1.5-pro-256k, Doubao-1.5-vision-pro-32k, DeepSeek-R1.

[0027] In this embodiment, the model selection criteria: Input and output restrictions: According to the complexity of the user input (such as symptom description, data matched with the knowledge base, prompt words, context, etc.) and output (such as paste prescription recommendations), select a model that can handle multi-round conversations and long texts. Scenario requirement restrictions: For the scenario of traditional Chinese medicine reinforcement, select a model that can understand traditional Chinese medicine terms and has strong logical reasoning ability. Business processing ability requirements: The model needs to support knowledge base invocation, context memory, and multi-task processing (such as recommendations, explanations, etc.). Model type: Select large language models such as Doubao-1.5-pro-256k, Doubao-1.5-vision-pro-32k, DeepSeek-R1, etc. as the underlying models, which have stronger Chinese capabilities and can better understand traditional Chinese medicine professional terms and logic.

[0028] In some embodiments, the specific scenarios include paste prescription recommendation, symptom diagnosis, and health consultation. The business logic orchestration stage further includes the following steps: Orchestrate the business processes of the intelligent agents according to the specific scenarios, embed the paste prescription knowledge base and classical prescription knowledge base into the intelligent agents through the integrated deployment of the platform, and set Chinese medicine scenario prompt words.

[0029] In this embodiment, business logic design: Design the business processes of the intelligent agents according to the specific scenarios of traditional Chinese medicine consolidation (such as paste prescription recommendation, symptom diagnosis, health consultation, etc.). For example, after the user inputs symptoms, the intelligent agent sequentially invokes modules such as knowledge base retrieval, logical reasoning, and result generation. Knowledge base embedding: Embed the traditional Chinese medicine paste prescription and classical prescription knowledge bases into the intelligent agents to support real-time retrieval and invocation. Through the integrated deployment of the platform, ensure the efficient access to the knowledge bases. Professional prompt word deployment: Design prompt words (Prompts) for Chinese medicine scenarios to guide the model to generate more professional answers.

[0030] In some embodiments, the intelligent agent publishing stage further includes the following steps: Deploy the trained and orchestrated intelligent agents to the cloud platform or local server and configure the API interfaces; Construct a traditional Chinese medicine consolidation mini-program based on the deployed intelligent agents; When the user switches different intelligent agents in the traditional Chinese medicine consolidation mini-program according to the needs, retain the context information for sharing and enable the different intelligent agents to work collaboratively; Real-time optimize the interaction experience of the intelligent agents through natural language processing methods.

[0031] In this embodiment, intelligent agent deployment: Deploy the trained and orchestrated intelligent agents to the cloud platform or local server to ensure their stable operation. Configure the API interfaces to support multi-terminal calls such as mini-programs and web pages.

[0032] 2. Development of the traditional Chinese medicine consolidation mini-program: Develop a traditional Chinese medicine consolidation mini-program based on the published intelligent agents to provide a user-friendly interaction interface. The functions include symptom input, paste prescription recommendation, health consultation, historical record query, etc. Implement intelligent agent switching and collaboration on the mini-program side. Intelligent agent switching function: Design an intelligent agent switching function in the mini-program, and the user can select different intelligent agents according to the needs (such as paste prescription recommendation intelligent agent, image recognition intelligent agent, etc.). Retain the context information during switching to ensure the coherence of the conversation. Intelligent agent collaborative work: Share the context information between different intelligent agents to achieve collaborative work. For example, after the image recognition intelligent agent recognizes the user's tongue coating, the paste prescription recommendation intelligent agent recommends a suitable paste prescription according to the diagnosis result combined with the symptom description and explains its principle. User experience optimization: Improve the interaction experience of the intelligent agents through natural language processing technology to make it closer to the real traditional Chinese medicine consultation scenario. Provide support for multi-round conversations and allow the user to supplement information or adjust the needs at any time.

[0033] In some embodiments, the traditional Chinese medicine solid orthosis intelligent agent operation and maintenance platform includes a model layer, an interaction layer, and a data layer; The model layer is used to provide model support, responsible for managing and distributing AI models. The model layer includes a One API management & distribution system, and the One API management & distribution system connects the Doubao model and DeepSeek; The interaction layer is used to provide service support. The interaction layer includes the LangChain framework, the React framework, and provides plugin services and advanced orchestration functions; The data layer is used to provide data support, responsible for data storage and management. The data layer includes a MongoDB database, a Redis in-memory database, a MySQL relational database, and a PgVector database extension plugin; the MongoDB database is used to store unstructured data; the Redis in-memory database is used to cache frequently accessed data to improve the system's response speed and performance; the MySQL relational database is used to store structured data; the PgVector database extension plugin is used to store and retrieve embedding vectors.

[0034] In this embodiment, as Figure 2 shown, an intelligent operation and maintenance system based on modern artificial intelligence technology and traditional Chinese medicine expertise is described, aiming to provide efficient and accurate traditional Chinese medicine solid orthosis services through AI large models, data management, and interaction technologies. The platform is divided into four main layers: model support, model layer, interaction layer, and data layer.

[0035] The model layer is the technical core of the platform, responsible for managing and distributing AI models. The One API management & distribution system mainly uniformly manages the API interfaces of multiple AI models, simplifies the call process, supports model distribution and load balancing, and ensures stability in high-concurrency scenarios. The underlying models managed include the Doubao model and DeepSeek.

[0036] The interaction layer is the bridge between the platform and users, responsible for providing a friendly interaction experience and functional support. LangChain is a framework for building agents, supporting multi-turn conversations and context memory. It is used in the platform to implement the business logic orchestration and knowledge base invocation of the traditional Chinese medicine solid orthosis intelligent agent. React is a front-end development framework used to build user-friendly interaction interfaces. It is used in the platform to develop traditional Chinese medicine solid orthosis mini-programs and web interfaces. The plugin service supports function extension and customized development. For example, network connection plugins can be developed. Advanced orchestration supports the orchestration of complex business logics to achieve multi-agent collaborative work.

[0037] The data layer is the infrastructure of the platform, responsible for data storage and management. The main data is stored in four parts: MongoDB is a NoSQL database used to store unstructured data (such as user conversation records, traditional Chinese medicine knowledge bases, etc.). It supports efficient data retrieval and expansion. Redis is an in-memory database used to cache frequently accessed data (such as user sessions, model inference results, etc.). It improves the system's response speed and performance. MySQL is a relational database used to store structured data (such as user information, model configurations, etc.). It supports transaction processing and complex queries. PgVector is a database extension that supports vector search, used to store and retrieve embedding vectors (such as semantic vectors of the traditional Chinese medicine knowledge base). It supports efficient semantic search and similarity calculation.

[0038] In some embodiments, the unstructured data includes user conversation records, traditional Chinese medicine knowledge bases; the frequently accessed data includes user conversations, model inference results; the structured data includes user information, model configurations; and the embedding vectors include semantic vectors of the traditional Chinese medicine knowledge base.

[0039] The second aspect of the present invention provides: A traditional Chinese medicine intelligent agent construction system based on the LangChain framework, used to implement any of the above-mentioned traditional Chinese medicine intelligent agent construction methods based on the LangChain framework, including: A platform construction module, used to construct a traditional Chinese medicine Guzheng intelligent agent operation and maintenance platform based on the LangChain architecture; A knowledge base construction module, used to organize traditional Chinese medicine plaster prescriptions and classical prescriptions through an expert system, and construct a traditional Chinese medicine professional knowledge base based on the sharding embedding mode; A large model selection module, used to select the underlying large model of the intelligent agent according to input restrictions, output restrictions, scenario requirement restrictions, and the business processing ability requirements of the model; A business logic orchestration module, used to perform business logic orchestration of intelligent agents in specific scenarios based on advanced orchestration capabilities, embed the knowledge base and deploy professional prompt words; An intelligent agent publishing module, used to publish the intelligent agent, construct a traditional Chinese medicine Guzheng mini-program based on the intelligent agent, and realize the switching and coordination of different intelligent agents in a single conversation on the traditional Chinese medicine Guzheng mini-program side.

[0040] The third aspect of the present invention provides: A computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are loaded and executed by a processor, any of the above-mentioned traditional Chinese medicine intelligent agent construction methods based on the LangChain framework is realized.

[0041] The above are only the preferred embodiments of the present invention. It should be understood that the present invention is not limited to the forms disclosed herein, and should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be changed within the scope of the concept described herein through the above teachings or the technology or knowledge in the relevant field. And any changes and modifications made by those skilled in the art without departing from the spirit and scope of the present invention shall fall within the protection scope of the appended claims of the present invention.

Claims

1. A method for constructing a traditional Chinese medicine intelligent agent based on the LangChain framework, characterized in that: It includes the following steps: Platform construction phase: Build the operation and maintenance platform for traditional Chinese medicine Guzheng intelligent agent based on the LangChain architecture; Knowledge base construction phase: Organize the traditional Chinese medicine plaster prescriptions and classical prescriptions through an expert system, and build a professional knowledge base for traditional Chinese medicine based on the sharding embedding mode; Large model selection phase: Select the underlying large model of the intelligent agent according to the input restrictions, output restrictions, scenario requirement restrictions, and the business processing ability requirements of the model; Business logic orchestration phase: Orchestrate the business logic of the intelligent agent for specific scenarios based on advanced orchestration capabilities, embed the knowledge base, and deploy professional prompt words; Intelligent agent release phase: Release the intelligent agent, construct the traditional Chinese medicine Guzheng mini-program based on the intelligent agent, and realize the switching and collaboration of different intelligent agents in a single conversation on the traditional Chinese medicine Guzheng mini-program side.

2. The method for constructing a traditional Chinese medicine intelligent agent based on the LangChain framework according to claim 1, wherein: The knowledge base construction phase also includes the following steps: Collect plaster prescription data and classical prescription data from traditional Chinese medicine classic literature, modern research papers, and clinical practice cases; Clean, classify, and annotate the plaster prescription data and classical prescription data to establish a structured database; Adopt the sharding embedding method to decompose the plaster prescription knowledge and classical prescription knowledge into multiple semantic fragments, each semantic fragment contains specific knowledge points, and convert the text into vectors through an embedding model.

3. The method for constructing a traditional Chinese medicine intelligent agent based on the LangChain framework according to claim 2, wherein: The specific knowledge points include medicinal material composition, efficacy, indications, and taboos; the embedding model is Doubao-embedding.

4. The method for constructing a traditional Chinese medicine intelligent agent based on the LangChain framework according to claim 1, characterized in that: The input restrictions include symptom description, data matched in the knowledge base, prompt words, and context; the output restrictions include plaster prescription recommendations; the scenario requirement restrictions include the ability to understand traditional Chinese medicine terms and the logical reasoning ability being greater than a preset threshold; the business processing ability requirements include supporting knowledge base calls, context memory, and multi-task processing; the underlying large models include Doubao-1.5-pro-256k, Doubao-1.5-vision-pro-32k, DeepSeek-R1.

5. The method for constructing a traditional Chinese medicine intelligent agent based on the LangChain framework according to claim 1, wherein: The specific scenarios include plaster prescription recommendations, symptom diagnosis, and health consultation. The business logic orchestration phase also includes the following steps: Orchestrate the business process of the intelligent agent according to specific scenarios, embed the plaster prescription knowledge base and classical prescription knowledge base into the intelligent agent through the integrated deployment of the platform, and set traditional Chinese medicine scenario prompt words.

6. The method for constructing a traditional Chinese medicine intelligent agent based on the LangChain framework as claimed in claim 1, wherein: The intelligent agent release phase also includes the following steps: Deploy the trained and orchestrated intelligent agent to the cloud platform or local server and configure the API interface; Construct the traditional Chinese medicine Guzheng mini-program based on the deployed intelligent agent; When the user switches different intelligent agents on the traditional Chinese medicine Guzheng mini-program according to needs, retain the context information for sharing, and different intelligent agents work collaboratively; Optimize the interaction experience of the intelligent agent in real time through natural language processing methods.

7. The method for constructing a traditional Chinese medicine intelligent agent based on the LangChain framework according to any one of claims 1-6, characterized in that: The operation and maintenance platform for traditional Chinese medicine Guzheng intelligent agent includes a model layer, an interaction layer, and a data layer; The model layer is used to provide model support, responsible for managing and distributing AI models. The model layer includes the One API management & distribution system, and the One API management & distribution system connects the Doubao model and DeepSeek; The interaction layer is used to provide service support. The interaction layer includes the LangChain framework, the React framework, and provides plugin services and advanced orchestration capabilities; The data layer is used to provide data support and is responsible for data storage and management. The data layer includes the MongoDB database, the Redis in-memory database, the MySQL relational database, and the PgVector database extension plugin; the MongoDB database is used to store unstructured data; the Redis in-memory database is used to cache frequently accessed data and improve the response speed and performance of the system; the MySQL relational database is used to store structured data; the PgVector database extension plugin is used to store and retrieve embedding vectors.

8. The method for constructing a traditional Chinese medicine intelligent agent based on the LangChain framework according to claim 7, characterized in that: The unstructured data includes user conversation records and the traditional Chinese medicine knowledge base; the frequently accessed data includes user conversations and model inference results; the structured data includes user information and model configurations; the embedding vectors include the semantic vectors of the traditional Chinese medicine knowledge base.

9. A traditional Chinese medicine intelligent agent construction system based on the LangChain framework, characterized in that: To implement the method for constructing a traditional Chinese medicine intelligent agent based on the LangChain framework as described in any one of claims 1-8, including: A platform construction module, used to construct an operation and maintenance platform for the traditional Chinese medicine Guzheng intelligent agent based on the LangChain architecture; A knowledge base construction module, used to organize traditional Chinese medicine plaster prescriptions through an expert system and construct a traditional Chinese medicine professional knowledge base based on the sharding embedding mode; A large model selection module, used to select the underlying large model of the intelligent agent according to input restrictions, output restrictions, scenario requirement restrictions, and the business processing ability requirements of the model; A business logic orchestration module, used to perform the business logic orchestration of the intelligent agent for specific scenarios based on advanced orchestration capabilities, embed the knowledge base, and deploy professional prompt words; An intelligent agent publishing module, used to publish the intelligent agent, construct a traditional Chinese medicine Guzheng small program based on the intelligent agent, and realize the switching and collaboration of different intelligent agents in a single conversation on the traditional Chinese medicine Guzheng small program side.

10. A computer-readable storage medium, characterized in that: The computer stores computer-executable instructions, and when the computer-executable instructions are loaded and executed by a processor, the method for constructing a traditional Chinese medicine intelligent agent based on the LangChain framework as described in any one of claims 1-8 is implemented.

Citation Information

Patent Citations

  • Intelligent agent construction and sharing platform and method for enterprise

    CN117709452A

  • LLM-based insurance professional knowledge management system

    CN118035418A

  • Index question and answer intelligent platform realized based on large model Agent

    CN118964546A

  • Marine ecological multi-agent construction method and interaction system thereof

    CN119204861A

  • Leveraging data for platform support using large language machine-learned model-based agents

    US20250086651A1