A method, system and medium for constructing a TCM intelligent agent based on the LangChain framework
By building a TCM intelligent agent operation and maintenance platform based on the LangChain framework, organizing the knowledge base of TCM prescriptions and selecting suitable large models, the problems of high complexity and single functionality of the existing platform were solved, multi-agent collaborative work was achieved, and user experience and efficiency were improved.
Patent Information
- Application Number
- CN202510426719.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2045-04-07
AI Technical Summary
The existing TCM large-scale model intelligent agent platform is highly complex, difficult to use, has single functions, poor user experience, poor coordination between intelligent agents, and cannot achieve switching and collaborative work of multiple intelligent agents on the same chat page, which limits its wide application.
Based on the LangChain framework, we build a TCM Guzheng intelligent agent operation and maintenance platform. Through the expert system, we organize TCM prescriptions and classics, build a professional knowledge base, select the appropriate underlying large model, perform business logic orchestration, and realize the switching and coordination of different intelligent agents on the TCM Guzheng mini-program. We use sharding embedding methods and natural language processing to optimize the interactive experience.
The platform has a simple architecture, is easy to use for non-technical personnel, has comprehensive functions, and multiple agents can work together on the same page, improving operational convenience and efficiency.
Smart Images

Figure CN120297318B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent body construction, and in particular to a method, system and medium for constructing a traditional Chinese medicine intelligent body based on the LangChain framework. Background Art
[0002] Currently, the application of big models in the Traditional Chinese Medicine (TCM) industry is primarily focused on auxiliary diagnosis, personalized treatment, TCM R&D, health management, and knowledge dissemination. In the field of auxiliary diagnosis, big models analyze multimodal data such as patient medical records, tongue patterns, and pulse patterns to help doctors identify syndromes and predict diseases. For example, AI TCM diagnostic instruments generate constitution analysis reports based on tongue and facial features. In personalized treatment, big models can recommend personalized TCM prescriptions and acupuncture plans based on the patient's constitution and condition, improving treatment precision. In TCM R&D, big models accelerate new drug screening and optimization by analyzing TCM components and mechanisms of action. For example, Tasly's "Digital Materia Medica" big model has made progress in drug screening for diabetic nephropathy and pulmonary fibrosis. Big models are also being used in health management, analyzing users' health data to provide constitution identification and health recommendations, and are even used to recommend teas in some tea shops. In terms of knowledge dissemination, big models build TCM knowledge graphs, integrating ancient texts and the experience of renowned doctors, providing convenient access to knowledge for practitioners and the public.
[0003] However, there are still some problems with the existing technical solutions. First, the various current large-model-based intelligent agent platforms are highly complex and difficult to use. Many users, especially non-technical personnel, find it difficult to quickly master their use, which limits their widespread application. Secondly, the business goals achieved by these platforms are single, and they often focus on a specific task, such as only providing diagnostic advice or health management services, and lack comprehensive functional integration, resulting in poor user experience and an inability to meet diverse needs. Finally, the collaboration between intelligent agents is poor, and it is usually impossible to switch and collaborate between multiple intelligent agents on the same chat page. Users need to use different platforms or tools to complete complex tasks, which not only increases the complexity of operations, but also reduces 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 TCM intelligent agent based on the LangChain framework.
[0005] The object of the present invention is achieved through the following technical solutions: In a first aspect, the present invention provides: a method for constructing a TCM intelligent agent based on the LangChain framework, comprising the following steps:
[0006] Platform construction phase: Build a TCM solidification intelligent operation and maintenance platform based on the LangChain architecture;
[0007] Knowledge base construction stage: organize TCM prescriptions and ointments through an expert system, and build a TCM professional knowledge base based on a fragmented embedding model;
[0008] Large model selection stage: Based on input constraints, output constraints, scenario requirements, and the business processing capability requirements of the model, the underlying large model of the intelligent agent is selected;
[0009] Business logic orchestration phase: Based on advanced orchestration capabilities, business logic orchestration of intelligent agents in specific scenarios is performed, with an embedded knowledge base and professional prompts deployed.
[0010] 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 coordination of different intelligent agents in a single conversation on the Traditional Chinese Medicine Guzheng mini program.
[0011] Preferably, the knowledge base construction stage further includes the following steps:
[0012] Collect paste prescription data and classical prescription data from traditional Chinese medicine classics, modern research papers, and clinical practice cases;
[0013] Clean, classify and label the paste prescription data and classical prescription data to establish a structured database;
[0014] A piecewise embedding method is used to decompose the knowledge of paste prescriptions and classical prescriptions into multiple semantic fragments, each of which contains specific knowledge points, and the text is converted into vectors through an embedding model.
[0015] Preferably, the specific knowledge points include medicinal material composition, efficacy, indications, and contraindications; and the embedding model is Doubao-embedding.
[0016] Preferably, the input restrictions include symptom description, knowledge base matching data, prompt words, and context; the output restrictions include paste prescription recommendations; the scenario requirement restrictions include the ability to understand Chinese medicine terminology and logical reasoning ability greater than a preset threshold; the business processing capability requirements include support for knowledge base calls, context memory, and multi-tasking; the underlying large models include Doubao-1.5-pro-256k, Doubao-1.5-vision-pro-32k, and DeepSeek-R1.
[0017] Preferably, the specific scenarios include ointment prescription recommendation, symptom diagnosis, and health consultation, and the business logic arrangement stage further includes the following steps:
[0018] The business processes of the intelligent body are arranged according to specific scenarios. The knowledge base of paste prescriptions and the knowledge base of classical prescriptions are embedded into the intelligent body through the integrated deployment of the platform, and TCM scenario prompts are set.
[0019] Preferably, the agent publishing stage further includes the following steps:
[0020] Deploy the trained and orchestrated agent to a cloud platform or local server and configure the API interface;
[0021] Based on the deployed intelligent agent, construct a TCM maintenance program;
[0022] When users switch between different intelligent agents in the TCM Guzheng applet according to their needs, contextual information is retained and shared, allowing different intelligent agents to work collaboratively;
[0023] Optimize the interactive experience of intelligent agents in real time through natural language processing methods.
[0024] Preferably, the TCM solidification intelligent body operation and maintenance platform includes a model layer, an interaction layer and a data layer;
[0025] The model layer is used to provide model support and is responsible for managing and distributing AI models. The model layer includes the One API management and distribution system, which connects the Doubao model and DeepSeek.
[0026] The interaction layer is used to provide service support. It includes the LangChain framework, the React framework, and provides plug-in services and advanced orchestration functions.
[0027] The data layer is used to provide data support and is 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 plug-in. 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 plug-in is used to store and retrieve embedded vectors.
[0028] Preferably, the unstructured data includes user conversation records and a traditional Chinese medicine knowledge base; the high-frequency access data includes user replies and model inference results; the structured data includes user information and model configuration; and the embedded vector includes a semantic vector of a traditional Chinese medicine knowledge base.
[0029] The second aspect of the present invention provides: a TCM intelligent agent construction system based on the LangChain framework, which is used to implement any of the above-mentioned TCM intelligent agent construction methods based on the LangChain framework, comprising:
[0030] Platform construction module, used to build a TCM solidification intelligent body operation and maintenance platform based on the LangChain architecture;
[0031] The knowledge base construction module is used to organize TCM prescriptions and classic prescriptions through an expert system and build a TCM professional knowledge base based on a fragmented embedding model;
[0032] The large model selection module is used to select the underlying large model of the intelligent agent based on input constraints, output constraints, scenario requirements, and the business processing capability requirements of the model;
[0033] The business logic orchestration module is used to orchestrate the business logic of intelligent agents in specific scenarios based on advanced orchestration capabilities, with an embedded knowledge base and professional prompts.
[0034] The intelligent agent publishing module is used to publish intelligent agents, construct a TCM Guzheng mini-program based on the intelligent agents, and realize the switching and coordination of different intelligent agents in a single conversation on the TCM Guzheng mini-program side.
[0035] The third aspect of the present invention provides: a computer-readable storage medium, wherein the computer stores computer-executable instructions, and when the computer-executable instructions are loaded and executed by a processor, any of the above-mentioned methods for constructing a traditional Chinese medicine intelligent body based on the LangChain framework is implemented.
[0036] The beneficial effects of the present invention are:
[0037] 1) The platform has a simple architecture, and intelligent agents are basically implemented through advanced workflow orchestration. Many users, especially non-technical personnel, can quickly master its usage.
[0038] 2) When constructing the TCM intelligent agent, a relatively comprehensive set of capabilities was considered. It not only has basic question-answering capabilities, but is also adapted to two sets of prompt words and knowledge bases. It is a comprehensive functional integration that can meet diverse needs.
[0039] 3) On the mini program side, a collaborative working mode between multiple intelligent agents is adopted to realize the switching and collaborative work of multiple intelligent agents in the same chat page. Users no longer need to use different platforms or tools to complete complex tasks. This not only increases the convenience of operation, but also greatly improves efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A flowchart of the method for building a TCM agent based on the LangChain framework;
[0041] Figure 2 This is the structural diagram of the TCM Guzheng intelligent body operation and maintenance platform;
[0042] Figure 3 Compile a flow chart for the paste prescription and classical prescription intelligent agent;
[0043] Figure 4 This is a schematic diagram of the collaborative work of multiple intelligent agents in the Traditional Chinese Medicine Guzheng mini program. DETAILED DESCRIPTION
[0044] The following will clearly and completely describe the technical solutions of the present invention in conjunction with the embodiments. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.
[0045] See Figures 1-4 The first aspect of the present invention provides: a method for constructing a TCM intelligent agent based on the LangChain framework, comprising the following steps:
[0046] Platform construction phase: Build a TCM solidification intelligent operation and maintenance platform based on the LangChain architecture;
[0047] Knowledge base construction stage: organize TCM prescriptions and classic prescriptions through expert systems, and build a TCM professional knowledge base based on the fragmented embedding model;
[0048] Large model selection stage: Based on input constraints, output constraints, scenario requirements, and the business processing capability requirements of the model, the underlying large model of the intelligent agent is selected;
[0049] Business logic orchestration phase: Based on advanced orchestration capabilities, business logic orchestration of intelligent agents in specific scenarios is performed, with an embedded knowledge base and professional prompts deployed.
[0050] 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 coordination of different intelligent agents in a single conversation on the Traditional Chinese Medicine Guzheng mini program.
[0051] In this embodiment, if Figure 3The figure shows the orchestration process of an intelligent agent for paste prescriptions and traditional Chinese medicine prescriptions based on the Guzheng platform, enabling the agent to simultaneously prescribe prescriptions, answer professional knowledge questions, and perform basic question-and-answering. In the first link, the model (Doubao) controls the prescription logic through customized prompts and stably outputs prescription templates. In the second link, the model (DeepSeek-R1) combines knowledge base retrieval content with optimized output format prompts to respond to users with specialized industry expert knowledge. In the third link, when users ask questions unrelated to Guzheng prescriptions, responses are based on the model's own capabilities, while also implementing certain response restrictions based on prompts to ensure security.
[0052] like Figure 4 As shown, the solution of multi-agent collaboration of the TCM Guzheng mini-program is demonstrated. After the user enters the main page of the mini-program, a single conversation can open a new conversation window, in which the user can freely switch agents and use diverse agents to cooperate to complete their tasks. For example: the user can first upload a tongue coating picture, and use the image recognition agent to identify and describe the tongue coating information, and then ask the Jingfang agent for his own symptoms to prescribe a prescription. The Jingfang agent can understand the patient's description and reply with the prescription based on the tongue coating content output by the image recognition agent in the above text. This is more suitable for the needs of actual scenarios.
[0053] In some embodiments, the knowledge base construction stage further includes the following steps:
[0054] Collect paste prescription data and classical prescription data from traditional Chinese medicine classics, modern research papers, and clinical practice cases;
[0055] Clean, classify and label the paste prescription data and classical prescription data to establish a structured database;
[0056] A piecewise embedding method is used to decompose the knowledge of paste prescriptions and classical prescriptions into multiple semantic fragments, each of which contains specific knowledge points, and the text is converted into vectors through an embedding model.
[0057] In this embodiment, it includes two parts: 1. Data collection and organization: Collect relevant data on paste prescriptions and classical prescriptions from multiple channels such as classical Chinese medicine 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 to facilitate subsequent knowledge base construction and intelligent agent call. 2. Build a knowledge base in a shard embedding mode: Use shard embedding technology (such as vectorized embedding) to decompose the knowledge of Chinese medicine paste prescriptions and classical prescriptions into multiple semantic fragments. Each fragment contains specific knowledge points (such as medicinal material composition, efficacy, indications, contraindications, etc.), which is convenient for intelligent agents to quickly retrieve and understand. Convert text into vectors through embedding models (such as Doubao-embedding, etc.) to support semantic search and context understanding.
[0058] In some embodiments, the specific knowledge points include medicinal material composition, efficacy, indications, and contraindications; and the embedding model is Doubao-embedding.
[0059] In some embodiments, the input restrictions include symptom description, knowledge base matching data, prompt words, and context; the output restrictions include paste prescription recommendations; the scenario requirement restrictions include the ability to understand Chinese medicine terminology and logical reasoning ability greater than a preset threshold; the business processing capability requirements include support for knowledge base calls, context memory, and multi-tasking; the underlying large models include Doubao-1.5-pro-256k, Doubao-1.5-vision-pro-32k, and DeepSeek-R1.
[0060] In this embodiment, the model selection criteria are as follows: Input and output restrictions: Based on the complexity of user input (such as symptom description, knowledge base matching data, prompt words, context, etc.) and output (such as paste prescription recommendation), select a model that can handle multiple rounds of dialogue and long texts. Scenario requirement restrictions: For the scenario of TCM consolidation, select a model that can understand TCM terminology and has strong logical reasoning capabilities. Business processing capability requirements: The model must support knowledge base calls, 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 model, which has stronger Chinese capabilities and can better understand TCM professional terminology and logic.
[0061] In some embodiments, the specific scenarios include prescription recommendations, symptom diagnosis, and health consultation. The business logic orchestration stage further includes the following steps:
[0062] The business processes of the intelligent body are arranged according to specific scenarios. The knowledge base of paste prescriptions and the knowledge base of classical prescriptions are embedded into the intelligent body through the integrated deployment of the platform, and TCM scenario prompts are set.
[0063] In this embodiment, business logic design involves designing the agent's business processes based on specific TCM prescription scenarios (such as ointment prescription recommendations, symptom diagnosis, and health consultation). For example, after a user enters a symptom, the agent sequentially invokes modules such as knowledge base retrieval, logical reasoning, and result generation. Knowledge base embedding involves embedding the TCM ointment prescription and classical prescription knowledge base into the agent, supporting real-time retrieval and access. Integrated platform deployment ensures efficient access to the knowledge base. Professional prompts are designed for TCM scenarios to guide the model in generating more professional responses.
[0064] In some embodiments, the agent publishing stage further includes the following steps:
[0065] Deploy the trained and orchestrated agent to a cloud platform or local server and configure the API interface;
[0066] Based on the deployed intelligent agent, construct a TCM maintenance program;
[0067] When users switch between different intelligent agents in the TCM Guzheng applet according to their needs, contextual information is retained and shared, allowing different intelligent agents to work collaboratively;
[0068] Optimize the interactive experience of intelligent agents in real time through natural language processing methods.
[0069] In this embodiment, agent deployment involves deploying trained and orchestrated agents to a cloud platform or local server to ensure stable operation. APIs are configured to support multi-device invocation, including applets and web pages.
[0070] 2. Development of a mini-program for TCM consolidation: Based on the published intelligent agent, a mini-program for TCM consolidation is developed to provide a user-friendly interactive interface. Functions include symptom input, paste prescription recommendation, health consultation, history query, etc. Implement agent switching and collaboration on the mini-program side. Agent switching function: Design an agent switching function in the mini-program, and users can choose different agents according to their needs (such as paste prescription recommendation agent, image recognition agent, etc.). Retain context information during switching to ensure the continuity of the conversation. Agent collaboration: Share context information between different agents to achieve collaborative work. For example, after the image recognition agent recognizes the user's tongue coating, the paste prescription recommendation agent recommends a suitable paste prescription based on the diagnosis results and symptom description, and explains its principle. User experience optimization: Through natural language processing technology, enhance the interactive experience of the agent, making it closer to the real TCM consultation scene. Provide multi-round dialogue support, allowing users to supplement information or adjust their needs at any time.
[0071] In some embodiments, the TCM solidification intelligent body operation and maintenance platform includes a model layer, an interaction layer, and a data layer;
[0072] The model layer is used to provide model support and is responsible for managing and distributing AI models. The model layer includes the One API management and distribution system, which connects the Doubao model and DeepSeek.
[0073] The interaction layer is used to provide service support. It includes the LangChain framework, the React framework, and provides plug-in services and advanced orchestration functions.
[0074] The data layer is used to provide data support and is 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 plug-in. 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 plug-in is used to store and retrieve embedded vectors.
[0075] In this embodiment, if Figure 2 The following describes an intelligent operations and maintenance system built on modern artificial intelligence (AI) technology and TCM expertise. This system aims to provide efficient and accurate TCM health preservation services through AI big models, data management, and interaction technologies. The platform is divided into four main layers: model support, model layer, interaction layer, and data layer.
[0076] The model layer is the technical core of the platform, responsible for managing and distributing AI models. The One API Management & Distribution System primarily manages API interfaces for multiple AI models, streamlining the call process. It supports model distribution and load balancing, ensuring stability in high-concurrency scenarios. The underlying models managed include Doubao models and DeepSeek.
[0077] The interaction layer serves as a bridge between the platform and users, providing a user-friendly interactive experience and functional support. LangChain is a framework for building intelligent agents, supporting multi-round dialogue and contextual memory. It is used within the platform to orchestrate business logic and access knowledge bases for TCM agents. React is a front-end development framework for building user-friendly interactive interfaces. It is used within the platform to develop TCM mini-programs and web interfaces. Plugin services support functional expansion and customized development, such as the development of networking plugins. Advanced orchestration supports the orchestration of complex business logic, enabling multi-agent collaboration.
[0078] The data layer is the platform's infrastructure, responsible for data storage and management. The main data is stored in four areas: MongoDB is a NoSQL database used to store unstructured data (such as user conversation records, TCM knowledge base, 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 configuration, etc.). It supports transaction processing and complex queries. PgVector is a database extension that supports vector search and is used to store and retrieve embedded vectors (such as semantic vectors of TCM knowledge base). It supports efficient semantic search and similarity calculation.
[0079] In some embodiments, the unstructured data includes user conversation records and a traditional Chinese medicine knowledge base; the high-frequency access data includes user replies and model inference results; the structured data includes user information and model configuration; and the embedded vector includes a semantic vector of the traditional Chinese medicine knowledge base.
[0080] The second aspect of the present invention provides: a TCM intelligent agent construction system based on the LangChain framework, which is used to implement any of the above-mentioned TCM intelligent agent construction methods based on the LangChain framework, comprising:
[0081] Platform construction module, used to build a TCM solidification intelligent body operation and maintenance platform based on the LangChain architecture;
[0082] The knowledge base construction module is used to organize TCM prescriptions and classic prescriptions through an expert system and build a TCM professional knowledge base based on a fragmented embedding model;
[0083] The large model selection module is used to select the underlying large model of the intelligent agent based on input constraints, output constraints, scenario requirements, and the business processing capability requirements of the model;
[0084] The business logic orchestration module is used to orchestrate the business logic of intelligent agents in specific scenarios based on advanced orchestration capabilities, with an embedded knowledge base and professional prompts.
[0085] The intelligent agent publishing module is used to publish intelligent agents, construct a TCM Guzheng mini-program based on the intelligent agents, and realize the switching and coordination of different intelligent agents in a single conversation on the TCM Guzheng mini-program side.
[0086] The third aspect of the present invention provides: a computer-readable storage medium, wherein the computer stores computer-executable instructions, and when the computer-executable instructions are loaded and executed by a processor, any of the above-mentioned methods for constructing a traditional Chinese medicine intelligent body based on the LangChain framework is implemented.
[0087] The foregoing description is merely a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the form disclosed herein and should not be construed as excluding other embodiments. Rather, the present invention can be used in various other combinations, modifications, and environments and can be modified within the scope of the concept described herein through the above teachings or techniques or knowledge in the relevant field. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention are intended to be protected by the appended claims.
Claims
1. A method for constructing a TCM intelligent agent based on the LangChain framework, characterized by: The following steps are involved: Platform construction phase: Build a TCM solidification intelligent operation and maintenance platform based on the LangChain architecture; Knowledge base construction stage: organize TCM prescriptions and ointments through an expert system, and build a TCM professional knowledge base based on a fragmented embedding model; Large model selection stage: Based on input constraints, output constraints, scenario requirements, and the business processing capability requirements of the model, the underlying large model of the intelligent agent is selected; Business logic orchestration phase: Based on advanced orchestration capabilities, business logic orchestration of intelligent agents in specific scenarios is performed, with an embedded knowledge base and professional prompts deployed. Agent release phase: Release the agent, construct the TCM Guzheng mini-program based on the agent, and implement switching and coordination between different agents in a single conversation on the TCM Guzheng mini-program. The knowledge base construction phase also includes the following steps: Collect paste prescription data and classical prescription data from traditional Chinese medicine classics, modern research papers, and clinical practice cases; Clean, classify and label the paste prescription data and classical prescription data to establish a structured database; Using a piecewise embedding method, we decompose the knowledge of paste prescriptions and classical prescriptions into multiple semantic segments, each containing specific knowledge points. The embedding model then converts the text into vectors. The specific knowledge points include medicinal material composition, efficacy, indications, and contraindications; the embedding model is Doubao-embedding; The input restrictions include symptom descriptions, knowledge base matching data, prompt words, and context; the output restrictions include paste prescription recommendations; the scenario requirements include the ability to understand Chinese medicine terminology and logical reasoning ability greater than a preset threshold; the business processing capability requirements include support for knowledge base calls, context memory, and multi-tasking; the underlying large models include Doubao-1.5-pro-256k, Doubao-1.5-vision-pro-32k, and DeepSeek-R1; The specific scenarios include ointment prescription recommendation, symptom diagnosis, and health consultation. The business logic arrangement stage also includes the following steps: Orchestrating the intelligent agent's business processes based on specific scenarios, embedding the paste prescription knowledge base and the classical prescription knowledge base into the intelligent agent through the integrated deployment of the platform, and setting TCM scenario prompts; The agent publishing phase also includes the following steps: Deploy the trained and orchestrated agent to a cloud platform or local server and configure the API interface; Based on the deployed intelligent agent, construct a TCM maintenance program; When users switch between different intelligent agents in the TCM Guzheng applet according to their needs, contextual information is retained and shared, allowing different intelligent agents to work collaboratively; Optimize the interactive experience of intelligent agents in real time through natural language processing methods; The TCM solidification intelligent body operation and maintenance platform includes a model layer, an interaction layer and a data layer; The model layer is used to provide model support and is responsible for managing and distributing AI models. The model layer includes the One API management and distribution system, which connects the Doubao model and DeepSeek. The interaction layer is used to provide service support. It includes the LangChain framework, the React framework, and provides plug-in services and advanced orchestration functions. The data layer is used to provide data support and is 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 plug-in. 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; and the PgVector database extension plug-in is used to store and retrieve embedded vectors. The unstructured data includes user conversation records and traditional Chinese medicine knowledge base; the high-frequency access data includes user replies and model inference results; the structured data includes user information and model configuration; and the embedded vector includes the semantic vector of the traditional Chinese medicine knowledge base.
2. A TCM intelligent agent construction system based on the LangChain framework, characterized by: The method for constructing a TCM intelligent agent based on the LangChain framework as claimed in claim 1 comprises: Platform construction module, used to build a TCM solidification intelligent body operation and maintenance platform based on the LangChain architecture; The knowledge base construction module is used to organize TCM prescriptions and classic prescriptions through an expert system and build a TCM professional knowledge base based on a fragmented embedding model; The large model selection module is used to select the underlying large model of the intelligent agent based on input constraints, output constraints, scenario requirements, and the business processing capability requirements of the model; The business logic orchestration module is used to orchestrate the business logic of intelligent agents in specific scenarios based on advanced orchestration capabilities, with an embedded knowledge base and professional prompts. The intelligent agent publishing module is used to publish intelligent agents, construct a TCM Guzheng mini-program based on the intelligent agents, and realize the switching and coordination of different intelligent agents in a single conversation on the TCM Guzheng mini-program side.
3. A computer-readable storage medium, characterized in that: The computer stores computer-executable instructions, which, when loaded and executed by the processor, implement the method for constructing a traditional Chinese medicine intelligent body based on the LangChain framework as claimed in claim 1.
Citation Information
Patent Citations
Intelligent agent construction and sharing platform and method for enterprise
CN117709452A
LLM-based insurance professional knowledge management system
CN118035418A