A method and system for intelligent question answering for vaccination

CN123012134APending Publication Date: 2026-10-30SHANGHAI MUNICIPAL CENT FOR DISEASE CONTROL & PREVENTION +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611518669.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-29
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0002]当前,疫苗咨询服务普遍采用基于静态知识库与规则引擎的组合方式,但该方式存在三大技术瓶颈:知识碎片化,即疫苗说明书、预防接种工作规范等权威数据分散存储,人工整合效率低下,导致问答内容的准确性难以保障;意图与任务割裂,例如用户咨询“入托入园需要哪些疫苗”时,系统无法自动关联查验凭证生成等功能模块,需人工切换服务界面,服务连续性较差;工具调用依赖人工配置,预约、查询、档案管理等工具调用需预设触发规则,面对复杂语义场景时响应能力不足

Benefits of technology

本发明采用多维度语义特征融合和分层决策架构,由预训练语言模型从多个领域专用处理单元中动态匹配唯一单元,替代传统硬编码规则,避免多级分类器的误差累积,显著提高复杂咨询意图的识别准确率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123012134A_ABST
    Figure CN123012134A_ABST
Patent Text Reader

Abstract

The application relates to the software field and discloses a vaccination intelligent question and answer method and system, which comprises the following steps: receiving a user query and performing format checking and user information acquisition; inputting the checked query and a conversation context into a pre-trained language model, dynamically selecting a unique matching processing unit from a plurality of preset field-specific processing units by the model; routing to the corresponding unit according to an identifier, autonomously judging whether to call an external tool by the pre-trained language model, and injecting a returned result into the context; segmenting and real-timely pushing the answer content to a user end, dynamically integrating a tool calling result, and updating a conversation. Through a hierarchical intention decision, dynamic tool scheduling and a fusion mechanism of a flow response, the application solves the problems of low question and answer accuracy, discontinuous interaction and response lag caused by knowledge fragmentation, intention task fragmentation and tool calling rigidity in the prior art, and realizes precise and real-time vaccination intelligent question and answer services.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software, and more particularly to an intelligent question-and-answer method and system for vaccine administration. Background Technology

[0002] Currently, vaccine consultation services generally adopt a combination of static knowledge bases and rule engines. However, this approach has three major technical bottlenecks: fragmented knowledge, meaning that authoritative data such as vaccine instructions and immunization guidelines are stored in a scattered manner, and manual integration is inefficient, making it difficult to guarantee the accuracy of the questions and answers; disconnect between intent and task, for example, when a user inquires about "which vaccines are needed for kindergarten or daycare," the system cannot automatically link to functional modules such as certificate generation, requiring manual switching of the service interface, resulting in poor service continuity; and tool invocation relies on manual configuration, with tools such as appointments, inquiries, and record management requiring preset trigger rules, leading to insufficient responsiveness in complex semantic scenarios.

[0003] Existing technologies cannot handle complex medical reasoning scenarios such as cross-validation of contraindications; a dynamic mapping relationship between intent and tools has not been established, requiring users to manually select functional modules; knowledge base updates rely on full reconstruction, making it difficult to meet the rapid response needs under public health emergencies.

[0004] In summary, existing solutions have not yet addressed the unique technical challenges in the field of immunization, such as regional differences, time-sensitive constraints, and multimodal service collaboration. There is an urgent need for an intelligent question-answering method that can integrate multi-source knowledge, adaptively understand intent, and autonomously collaborate with external tools. Summary of the Invention

[0005] To address the aforementioned technical problems, this invention provides an intelligent question-and-answer method for vaccine administration, comprising the following steps: The system receives user-input queries through a dialogue service interface, converts the queries into a standard text encoding format, and generates and records a unique session identifier. Verify the format compliance and session status validity of the query. If the verification fails, terminate the process and return an error message. The system obtains user real-name authentication information through the unified identity authentication service and user-related data from the vaccination record system, and stores the real-name authentication information and related data in the session context cache in a structured manner. The verified query text and conversation context are input into the pre-trained language model, which dynamically selects a unique matching processing unit from multiple pre-set domain-specific processing units and outputs the processing unit identifier and selection confidence. Based on the processing unit identifier, the query is routed to the corresponding dedicated processing unit, the dedicated configuration of the processing unit is loaded, and the internal state machine is initialized. Inside the dedicated processing unit, the pre-trained language model autonomously determines whether an external tool needs to be called. If it does, a tool call instruction is generated and executed, and the tool's return result is injected into the context of the pre-trained language model. The system employs a segmented real-time generation technology to push the generated response content to the user's end in real time, and dynamically integrates tool call results and updates the session context in real time during the push process.

[0006] As a technical solution of the present invention, the step of dynamically selecting a uniquely matching processing unit from a plurality of pre-set domain-specific processing units by a pre-trained language model specifically includes the following three-layer hierarchical decision-making steps: The first layer is a high-dimensional semantic coarse classification based on temporal decay. This involves using a dual-tower encoding structure to extract the dynamic query vector of the user query and the static description vector of the processing unit, respectively. A corrected similarity score is calculated between the dynamic query vector and the static description vector. The corrected similarity score introduces a temporal decay factor based on knowledge update time to reduce the weight of processing units corresponding to outdated knowledge. The corrected similarity scores are then sorted in descending order, and the top K processing units are selected as a candidate processing unit set. The second layer involves hard constraint filtering based on business rules. This involves obtaining the metadata configuration of each unit in the candidate processing unit set. The metadata configuration includes regional applicability tags, timeliness windows, and population applicability characteristics. The user's real-time context information is then matched and verified against the metadata configuration one by one: regional constraint verification is performed to determine whether the user's administrative region is within the service area of ​​the processing unit; timeliness constraint verification is performed to determine whether the current system time is within the effective service window of the processing unit; and population logic verification is performed to determine whether the user's age and health status tags conform to the preset logic of the processing unit. Any candidate processing unit that fails verification is eliminated, generating a compliant candidate set. The third layer is an adaptive weighted confidence evaluation, which involves constructing a multi-dimensional feature vector for each processing unit in the compliance candidate set. The multi-dimensional feature vector includes at least a semantic matching degree component, a rule verification result component, and a historical interaction consistency component. The final confidence of each processing unit is calculated using a pre-trained weighted evaluation function, and the processing unit with the highest final confidence is selected as the unique matching processing unit.

[0007] As one technical solution of the present invention, the calculation formula of the weighted evaluation function is as follows: C = αS + βR + γH + δU Wherein, C is the final confidence level; S is the semantic matching degree component, representing the vector space distance between the query text and the function of the processing unit; R is the rule verification result component, which takes a value of 1 when the processing unit passes all hard constraint verifications, and 0 otherwise; H is the historical interaction consistency component, representing the frequency weight of the processing unit being called in the user's current session history; U is the user profile matching degree component, representing the degree of matching between the characteristics of the applicable population of the processing unit and the user's real-name authentication information and vaccination record; α, β, γ, and δ are configurable dynamic weight coefficients, and α+β+γ+δ=1.

[0008] As a technical solution of the present invention, the pre-trained language model autonomously determines whether external tools need to be called within the dedicated processing unit, specifically including: The dedicated processing unit maintains a dedicated tool registry, which records the interface definition, input parameter format, and function description of external tools. The pre-trained language model generates a tool call thought chain based on the user's query intent. If the tool call thought chain determines that real-time data needs to be obtained or a transaction operation needs to be performed, the target tool identifier and corresponding parameters are parsed out. The parsed parameters are subjected to structured validation. Once the validation is successful, they are encapsulated into API commands and sent to external tools for execution. The returned JSON format results are then converted into natural language context and injected into the pre-trained language model.

[0009] As a technical solution of the present invention, the segmented real-time generation technology is used to push the generated response content to the user terminal in segments in real time, specifically including: Establish a real-time transmission channel based on token streams; The pre-trained language model immediately triggers a push event upon generating a preset number of tokens, transmitting the encrypted text fragments to the user's device. The client uses a typewriter effect to render text fragments word by word. At the same time, it asynchronously preloads the results of tool calls that may be triggered in the background. If the tool call returns a result, a placeholder for the result is inserted into the current text stream and the rendered content is dynamically refreshed.

[0010] As a technical solution of the present invention, the dynamic integration tool call result further includes a multimodal collaborative presentation step: Based on the semantics of the content, key data points are automatically identified and visual charts are generated, including vaccination timelines or vaccine coverage maps. Dynamically insert interactive controls into the text stream, including a "Generate Inspection Report with One Click" button or a "Map Navigation" link; Establish a semantic alignment mechanism to automatically populate the generated natural language text with the structured data returned by the tool, ensuring data consistency.

[0011] This invention also relates to an intelligent question-and-answer system for vaccine administration, comprising: The query receiving module is configured to receive user-input queries through a dialogue service interface, convert the queries into a standard text encoding format, and generate and record a session unique identifier. The verification module is configured to verify the format compliance and session status validity of the query. If the verification fails, the process will be terminated and an error message will be returned. The user information acquisition module is configured to acquire user real-name authentication information through the unified identity authentication service, acquire user-related data from the vaccination record system, and store the real-name authentication information and related data in a structured manner in the session context cache. The intent recognition and routing module is configured to input the verified query text and session context into a pre-trained language model, which dynamically selects a unique matching processing unit from a set of multiple domain-specific processing units, outputs the processing unit identifier and selection confidence, and routes the query to the corresponding dedicated processing unit according to the processing unit identifier, loads the dedicated configuration of the processing unit and initializes the internal state machine. The tool invocation module is configured to allow the pre-trained language model to autonomously determine whether an external tool needs to be invoked within the dedicated processing unit. If an external tool needs to be invoked, a tool invocation instruction is generated and executed, and the tool's return result is injected into the context of the pre-trained language model. The streaming response generation module is configured to use segmented real-time generation technology to push the generated response content to the user terminal in segments in real time, and dynamically integrate the tool call results and update the session context in real time during the push process.

[0012] As one technical solution of the present invention, the intent recognition and routing module includes: The semantic coarse classification unit is used to perform the first layer of processing: the dynamic query vector of the user query and the static description vector of the processing unit are extracted by using the dual-tower coding structure, the corrected similarity score is calculated by introducing the time decay factor based on the knowledge update time, and the top K candidate processing units are selected by sorting them in descending order of the score. The constraint verification unit is used to perform the second-level processing: obtain the metadata configuration of the candidate processing units, perform regional constraints, time constraints and population logic verification, and eliminate unqualified candidate units to generate a compliant candidate set; The confidence evaluation unit is used to perform the third layer of processing: construct a multi-dimensional feature vector for the compliance candidate set, calculate the final confidence using a pre-trained weighted evaluation function, and select the processing unit with the highest confidence.

[0013] As one technical solution of the present invention, the tool invocation module includes: The tool registry maintenance unit is used to record the interface definition, input parameter format, and function description of external tools; The thought chain generation unit is used to drive the pre-trained language model to generate a tool call thought chain based on the user's query intent, and to parse out the target tool identifier and parameters; The API encapsulation unit is used to perform structured validation on the parsed parameters. After successful validation, the parameters are encapsulated into API instructions and sent to external tools for execution. The returned JSON format results are then converted into natural language context and injected into the pre-trained language model.

[0014] The present invention also relates to a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method.

[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention employs a multi-dimensional semantic feature fusion and hierarchical decision architecture, in which a pre-trained language model dynamically matches a unique unit from multiple domain-specific processing units, replacing traditional hard-coded rules, avoiding the accumulation of errors in multi-level classifiers, and significantly improving the accuracy of identifying complex consultation intentions.

[0016] Within a dedicated processing unit, the invention enables a large language model to autonomously determine and trigger external tool calls based on semantic understanding, eliminating the need for manual maintenance of a complex rule base and allowing the system to flexibly respond to sudden or long-tail consultation scenarios.

[0017] This invention uses segmented real-time generation technology to generate and push response content simultaneously, significantly reducing user waiting time and enabling smooth and coherent multi-turn dialogues. It also dynamically integrates tool results in the text stream to ensure service continuity.

[0018] The tool of this invention can dynamically inject the results into the response stream, ensuring that the vaccination recommendations provided to users are always based on the latest policies and inventory information, effectively solving the problem of information failure. Attached Figure Description

[0019] Figure 1 A flowchart provided for an embodiment of the present invention. Detailed Implementation

[0020] The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the invention, and should not be construed as limiting the invention.

[0021] like Figure 1As shown, the intelligent question-answering method and system for vaccination according to this invention includes a query receiving module, a verification module, a user information acquisition module, a multi-dimensional semantic intent recognition and dynamic decision-making module, a routing module, a tool invocation module, a streaming response generation module, a session context cache, a pre-trained language model, a tool registry, a processing unit instance, a confidence threshold judgment module, and a user terminal. These modules are sequentially coupled and connected to form a complete processing loop from user query to intelligent response, realizing intelligent question-answering services in the field of vaccination.

[0022] Implementation of the query receiving module The query receiving module receives text or voice queries from users via a dialogue service interface. When a user inputs a voice query, the module invokes an automatic speech recognition component to convert the speech signal into a standard text encoding format. This component, built on a deep neural network model, can recognize various dialects and accents, ensuring a good user experience for users from different regions. Text input is received directly and processed uniformly using UTF-8 encoding. Upon receiving a query, the module generates and records a unique session identifier using UUIDv4 format to ensure global uniqueness, and also records a timestamp accurate to milliseconds for session timeliness management. The session identifier and timestamp are then passed to the session context cache for storage, providing basic identification information for subsequent multi-turn dialogue interactions.

[0023] Implementation of the verification module The verification module performs multi-level format compliance checks on received queries. First, it checks the character length range, setting a minimum length of five characters to filter meaningless input and a maximum length limit of five hundred characters to prevent system resource abuse. This length threshold can be dynamically adjusted according to actual business needs. Second, it performs sensitive word filtering. The sensitive word database is built based on the national cyberspace administration's standard word database, including categories such as pornographic and vulgar words, violent and terrorist words, and illegal and irregular words. A double-array Trie tree data structure is used for efficient matching, and the filtering operation uses a replacement strategy to replace sensitive words with asterisk characters. Special character cleaning removes special characters that may lead to system injection attacks, including but not limited to SQL injection characteristic characters, cross-site scripting characteristic characters, and command execution characteristic characters. The verification module also checks the validity of the session state, verifying whether the session identifier is within its validity period. The default session validity period is set to thirty minutes; sessions exceeding the validity period are considered invalid. When parameter verification fails, the subsequent processing flow is terminated, and a standardized error message containing an error code and description is returned. This error message is generated through a preset error code mapping table to ensure that the error information received by the user is clear and understandable.

[0024] Implementation of the User Information Acquisition Module The user information acquisition module obtains user real-name authentication information through a unified identity authentication service. This unified identity authentication service is based on the OAuth2.0 protocol and interfaces with the government service platform. Authentication information includes the user's unique identifier, real name, administrative division code, and age group identifier. The age group identifier is automatically calculated based on the user's date of birth, covering categories such as infants, children, adolescents, adults, and the elderly. The module also retrieves user-related data from the vaccination record system. This system stores the user's own vaccination records and those of their linked relatives. Vaccination records include fields such as vaccine name, vaccination date, number of doses, manufacturer, and vaccination unit. The module also obtains a contraindication identifier field, recording whether the user has any contraindications to vaccination, including but not limited to a history of severe allergies, immunodeficiency diseases, or acute febrile illness. Furthermore, the module retrieves historical consultation records for session context analysis. All the information obtained is structured and stored in a session context cache. The session context cache is implemented using a Redis cluster, supporting millisecond-level read / write responses. The cached data structure uses JSON format for easy parsing and use by various modules.

[0025] Implementation of the intent recognition and routing module The intent recognition module within the intent recognition and routing module employs a technical solution combining multi-dimensional semantic feature fusion analysis and a hierarchical intent decision architecture, and is the core intelligent processing component of this invention. As shown in the figure, this module comprises three layers of processing units: the first layer is high-dimensional semantic coarse classification based on temporal decay; the second layer is hard constraint filtering based on business rules; and the third layer is adaptive weighted confidence evaluation.

[0026] In the multi-dimensional semantic feature fusion analysis stage, the verified query text transmitted by the query receiving module is input into a pre-trained language model for multi-level feature extraction. Basic text feature extraction employs a word segmenter to process the query text into Chinese words. This word segmenter is trained on a large-scale vaccine domain corpus and can accurately identify the boundaries of specialized terms. The part-of-speech tagging component tags the segmented results, identifying functional words such as nouns, verbs, and quantifiers. The named entity recognition component uses a hybrid architecture combining conditional random fields and a pre-trained language model to specifically identify vaccine name entities such as hepatitis B vaccine, rabies vaccine, and influenza vaccine; disease name entities such as hepatitis B, tuberculosis, and rabies; and geographical information entities such as Shanghai, Pudong New Area, and a specific community.

[0027] Semantic deep feature extraction generates context-aware embedding vectors through a pre-trained language model. This pre-trained language model, built on the Transformer architecture, is fine-tuned on a large-scale corpus of vaccine administration data, enabling it to capture implicit semantic information and the user's true intent within the query text. Conversational context features fuse historical dialogue trajectories and user profile information. The historical dialogue trajectories are retrieved from the conversational context cache, containing the most recent ten rounds of dialogue. User profile information includes dimensions such as age grouping, vaccination history, and geographic attributes. Conversational context features are fused with current query features through an attention mechanism, with attention weights automatically learned and determined using learnable neural network parameters. Timeliness features combine dynamic variables such as the current policy timeliness window and vaccine supply status, and are retrieved in real-time from a policy timeliness database.

[0028] In the first-layer high-dimensional semantic coarse classification processing unit based on temporal decay, a dual-tower encoding structure is used to extract the dynamic query vector of the user query and the static description vector of the processing unit instance. The dynamic query vector is generated by the user query text through the query tower encoder, and the static description vector is generated by the semantic description text of each pre-defined domain-specific processing unit through the processing unit tower encoder. The cosine similarity between the dynamic query vector and the static description vector is calculated as the basic matching score. This basic matching score is corrected by a temporal decay factor based on knowledge update time. The formula for calculating the corrected similarity score is: the corrected score equals the basic score multiplied by e raised to the power of negative λt, where t is the number of days since the last update of the processing unit's knowledge base, and λ is a preset decay coefficient. The introduction of the temporal decay factor effectively reduces the weight of processing units corresponding to outdated knowledge, ensuring that the system prioritizes recommending processing units with timely knowledge base updates. The processing units are sorted in descending order according to the corrected similarity scores, and the three processing units with the highest corrected similarity scores are selected as the candidate processing unit set and output to the second layer.

[0029] In the second-layer hard-constraint filtering processing unit based on business rules, the metadata configuration of each processing unit instance in the candidate processing unit set is obtained. This metadata configuration includes fields such as regional applicability tags, timeliness windows, and population applicability characteristics. The user's real-time context information is matched and verified one by one against the metadata configuration. Regional constraint verification matches the user's administrative division code with the regional applicability tags of the processing unit, supporting precise matching at the provincial, municipal, and county levels. Timeliness constraint verification checks whether the current system time is within the processing unit's valid service window, which is determined by the policy document's effective and expiration times. Timeliness constraint verification also incorporates a time-series decay mechanism, automatically reducing the priority of soon-to-expire policy knowledge. Population logic verification determines whether the user's age group and health status tags conform to the processing unit's preset logic; for example, the kindergarten / daycare processing unit is only applicable to children aged 3 to 6. Contraindication cross-validation checks the contraindication knowledge base for security verification of queries involving health consultations, automatically filtering out processing units that are not applicable to the user if the user has specific contraindications. After hard constraint filtering, any candidate processing unit that fails the verification is removed, and a compliant candidate set is generated and output to the third layer.

[0030] In the third-layer adaptive weighted confidence evaluation processing unit, a multi-dimensional feature vector is constructed for each processing unit in the compliance candidate set. This multi-dimensional feature vector includes four dimensions: semantic matching degree component S, rule verification result component R, historical interaction consistency component H, and user profile matching degree component U. The semantic matching degree component S represents the vector space distance between the query text and the processing unit function, with a value ranging from 0 to 1, obtained by calculating the cosine similarity between the query vector and the processing unit description vector. The rule verification result component R has a value of 1 when the processing unit passes all hard constraint verifications, and a value of 0 when any verification fails. The historical interaction consistency component H represents the frequency weight of the processing unit being called in the user's current session history, calculated by dividing the number of times the processing unit was selected in the session history by the total number of interaction rounds. The user profile matching degree component U represents the degree of matching between the applicable population characteristics of the processing unit and the user's real-name authentication information and vaccination record, calculated by comparing the target population tags of the processing unit with the user profile characteristics.

[0031] The final confidence level C of each processing unit is calculated using a pre-trained weighted evaluation function. The formula for this function is C = α * S + β * R + γ * H + δ * U, where α, β, γ, and δ are configurable dynamic weight coefficients, and α + β + γ + δ equals 1. The initial values ​​of each weight coefficient are set based on the experience of business experts and are dynamically adjusted and optimized at runtime based on subsequent user interactions through an online learning mechanism. The processing unit with the highest final confidence level is selected as the uniquely matched processing unit, and its unique identifier, selected confidence level, and decision path interpretation are output to the confidence threshold judgment module.

[0032] The confidence threshold judgment module compares the calculated confidence level with a preset threshold. When the confidence level is greater than or equal to 0.85, it is considered high confidence, and a uniquely matching processing unit identifier is directly output to the routing module. When the confidence level is between 0.65 and 0.85, it is considered medium confidence, triggering a clarification dialogue strategy. This involves multiple rounds of interaction to guide the user to confirm their true intentions; the guiding language for the clarification dialogue is generated from a response style template. When the confidence level is below 0.65, it is considered low confidence, and the user is transferred to human customer service. The decision-making process log is recorded for subsequent model optimization analysis. The decision-making process log includes information such as input feature vectors, intermediate calculation results, and the basis for the final decision. The log data is stored in a distributed log system for continuous model optimization.

[0033] The multi-dimensional semantic intent recognition and dynamic decision-making module also establishes a decision output and feedback mechanism, outputting a unique identifier for the selected processing unit, the selection confidence level, and an explanation of the decision path. The decision path explanation is generated using explainable artificial intelligence technology, including a visual description of the complete reasoning chain from user query to final selection. Simultaneously, an online learning mechanism is established to dynamically optimize model parameters based on subsequent user interactions. When the user corrects the system's recommendation or selects another processing unit, this feedback information is used to update the parameter weights of the weighted evaluation function.

[0034] Implementation of the routing module in the intent recognition and routing module The routing module routes queries to the corresponding pre-configured dedicated processing unit instances based on the output processing unit identifier. Each pre-configured dedicated processing unit instance is pre-configured for specific vaccination scenarios, including various types such as childcare / kindergarten enrollment processing units, vaccination unit query processing units, appointment registration processing units, record verification processing units, and health consultation processing units. The routing module loads the dedicated configuration for each processing unit instance, which includes the domain knowledge base index type, available tool list, and response style template. The domain knowledge base index type is determined based on the business scenario of the processing unit; the childcare / kindergarten enrollment processing unit is associated with the Shanghai childcare / kindergarten enrollment policy knowledge base index, and the vaccination unit query processing unit is associated with the vaccination unit geographic information knowledge base index. The routing module initializes the internal state machine of the processing unit instance. This internal state machine maintains the current state, processing history, and context variables of the processing unit, providing state management services for subsequent tool calls and response generation.

[0035] Implementation of the tool calling module The tool invocation module runs within the processing unit instance. The pre-trained language model autonomously determines whether to invoke external tools based on semantic understanding. As shown in the figure, the tool invocation module includes three main external tools: an inoculation unit query tool, a recipient profile tool, and a policy document retrieval tool. The processing unit instance maintains a dedicated tool registry, which records the interface definitions, input parameter formats, and functional descriptions of each external tool, providing the pre-trained language model with the fundamental information for tool invocation capabilities.

[0036] When a user query involves scenarios requiring real-time data, the pre-trained language model generates a thought chain that simulates the human decision-making process. This thought chain uses step-by-step reasoning to determine whether and which external tool needs to be invoked. For example, when a user queries where nearby rabies vaccines can be administered, the pre-trained language model analyzes the query semantics and determines that real-time vaccination unit information is needed. The generated tool's thought chain includes steps such as identifying the target tool, analyzing input parameters, and generating invocation instructions. If the thought chain determines that real-time data or transaction operations are required, the target tool identifier and parameter mapping rules are parsed from the tool registry. The parameter mapping rules define the conversion relationship between the user's query semantics and the tool's input parameters, mapping the user's current location information to the query region parameter and the vaccine name to the vaccine type parameter.

[0037] The parsed parameters undergo structured validation, including checks on parameter type, range, and format. Upon successful validation, the parameters are encapsulated into standardized API commands and sent to the corresponding external tools for execution. The vaccination unit query tool, upon receiving the API command, queries the vaccination unit geographic information database and returns a list of qualified vaccination units, including unit name, detailed address, service hours, contact number, and straight-line distance from the user's location. The recipient record tool, upon receiving the API command, queries the vaccination record system and returns data such as the user's and their linked relatives' vaccination records and contraindication markers. The policy document retrieval tool, upon receiving the API command, queries the latest policy document database to retrieve the latest policy provisions for a specified region and business scenario.

[0038] The JSON-formatted results returned by external tools are injected with natural language context through a pre-trained language model. This injection process includes parsing the JSON structure, extracting key fields, and converting it into a natural language description. The tool invocation module establishes a tool invocation priority queue mechanism. High-priority tools are those with high real-time requirements, such as vaccination unit query tools; medium-priority tools are those with high accuracy requirements, such as recipient profile tools; and low-priority tools are auxiliary tools. This priority queue mechanism ensures that high-priority tools are executed first and their results are injected first, optimizing the user's waiting experience.

[0039] Implementation of the streaming response generation module The streaming response generation module adopts a technical solution that combines adaptive content segmentation strategy with multimodal collaborative presentation technology, which is the key module for achieving a good user experience in this invention.

[0040] Regarding the adaptive content segmentation strategy, the semantic integrity detection unit identifies semantic unit boundaries based on syntactic analysis. Semantic unit boundary identification employs dependency parsing technology, determining the semantically complete location points by analyzing the dependency relationships between sentence components. Semantic unit boundaries include the ending position of complete policy entries, the ending position of independent medical recommendations, and the ending position of list items. The semantic integrity detection unit uses an information density evaluation algorithm to assess the information value of each semantic unit, prioritizing high-value information fragments such as core policy points and key time nodes. The semantic integrity detection unit constructs a user cognitive load model, dynamically adjusting the segmentation granularity based on query complexity. Simple queries use coarse-grained segmentation, pushing content in paragraph units, while complex queries use fine-grained segmentation, such as pushing content in sentence or phrase units.

[0041] The multi-source asynchronous content fusion unit achieves the organic integration of tool invocation results and generated content. Pre-placement technology presets result placeholders in the content stream, identified by special markers, reserving a fixed width of display space to maintain page layout stability. A semantic alignment mechanism ensures semantic consistency and coherence between tool results and generated content, avoiding content fragmentation or semantic conflicts. The incremental update strategy only pushes changed content, leaving unchanged content untouched, effectively reducing network data transmission and user-side rendering overhead.

[0042] In terms of multimodal collaborative presentation technology, the text-visual collaborative generation unit automatically identifies key data points based on content semantics and generates visual charts. The key data point identification algorithm analyzes structured data such as time, location, and quantity information in the generated content, automatically calling the chart generation interface to generate visualization elements such as vaccination timeline charts, vaccine coverage maps, and vaccination record bar charts. Visual chart generation is implemented using a front-end chart library, supporting interactive operations such as zooming and dragging. Interactive controls are dynamically inserted into the text stream, including a one-click report generation button, map navigation links, and policy document detail links. The one-click report generation button triggers the document verification processing unit to generate a standardized kindergarten / school admission verification report document, and the map navigation link calls the device's map application for navigation guidance. A semantic alignment mechanism automatically fills the structured data returned by the tool into the generated natural language text; for example, it seamlessly embeds information such as vaccination site names, addresses, and phone numbers into the descriptive text, ensuring data consistency.

[0043] Real-time optimization mechanisms ensure a smooth user experience. The network quality awareness module monitors the user's network status in real time, including metrics such as latency, bandwidth, and packet loss rate. It dynamically adjusts content compression rates and segment sizes based on network conditions, automatically activating streaming degradation strategies in weak network environments. The user behavior prediction module predicts the user's next possible action based on historical interaction patterns, pre-loading relevant data in the background, prioritizing high-probability content segments. The priority reordering module reorders content to be pushed in weak network environments, prioritizing core information such as policy highlights and vaccination recommendations, while delaying the delivery of supplementary content such as detailed explanations and background information.

[0044] A session state continuity guarantee mechanism ensures the coherence of multi-turn conversations. A segmented content version control mechanism assigns a version number to each segment, ensuring context consistency across multiple turns of conversation; users will not see duplicate or contradictory content. An incremental context update mechanism only synchronizes the changed context portions, reducing data transmission overhead and synchronization latency between systems. A breakpoint resume mechanism records the last confirmed segment position after a network interruption; once the network is restored, content generation and delivery resume from that position, eliminating the need for users to re-initiate queries.

[0045] A real-time transmission channel based on token streams is established. A push event is triggered every five tokens generated by the pre-trained language model, encrypting and transmitting text fragments to the user terminal via the WebSocket protocol. The user terminal renders the text fragments word by word using a typewriter effect, with CSS animations used to achieve this effect and enhance the user's reading experience. Simultaneously, the results of potential tool calls are asynchronously preloaded in the background. If a tool call returns a result, a placeholder is inserted into the current text stream, and the rendered content is dynamically refreshed, ensuring synchronized display of tool results and generated content.

[0046] Overall system operation process The overall operation flow of the intelligent Q&A method for vaccination according to this invention in practical application is as follows: Users initiate text or voice queries through the user terminal, which are received and processed by the query receiving module. The query receiving module generates a unique session identifier and sends the query to the verification module for format verification. After successful verification, the user information acquisition module obtains relevant user information from the unified identity authentication service and vaccination record system and stores it in the session context cache. The multi-dimensional semantic intent recognition and dynamic decision-making module extracts multi-dimensional semantic features and performs three-layer hierarchical decision-making on the query, determines a uniquely matching processing unit instance, and calculates the confidence level. The confidence level threshold judgment module decides whether to directly output or trigger a clarification dialogue based on the confidence level. The routing module routes the query to the matching processing unit instance and loads its dedicated configuration. The tool invocation module autonomously decides whether to invoke external tools and obtain real-time data based on the query semantics. The streaming response generation module pushes the generated response content to the user terminal in segments in real time, simultaneously completing multi-modal content rendering and interactive control insertion. The entire processing flow realizes a complete closed loop from user query to intelligent response, significantly improving the intelligence level and user experience of vaccination consultation services.

[0047] Example 1: A parent asked, "What vaccines does my child need to get before starting kindergarten?" I. User Inquiry Reception (1) Receive the text query "What vaccines does my child need to get for kindergarten?" input by the user through the dialogue service interface, generate a unique session identifier and record the timestamp.

[0048] II. Parameter Verification (1) Verify that the length of the query text is within the compliant range; (2) Based on the national cyberspace administration's standard thesaurus, perform sensitive word filtering and special character cleaning; (3) Verify that the session identifier is valid. If the verification is successful, proceed to the next step.

[0049] III. Acquisition of User Information (1) Obtain user real-name authentication information through unified identity authentication service, including user's place of origin: Pudong New Area, Shanghai; (2) Obtain the associated child information from the vaccination record system: Name: Zhang San, Age: 4 years old, kinship already linked, no contraindications; (3) Store the above information in a structured manner in the session context cache.

[0050] IV. Intent Recognition (1) Input the validated query text and conversation context into the pre-trained language model; (2) The pre-trained language model calculates the matching degree between the query semantics and the description of each pre-set dedicated processing unit, and selects the "kindergarten and kindergarten processing unit"; (3) Output the unique identifier of the processing unit and the selected confidence level.

[0051] V. Processing Unit Routing (1) Based on the output processing unit identifier, route the query to the “kindergarten admission processing unit”; (2) Load the dedicated configuration for this processing unit: including the Shanghai Municipal Kindergarten and Childcare Policy Knowledge Base Index and the list of available tools; (3) Initialize the internal state machine of the processing unit.

[0052] VI. External Tool Invocation (1) Inside the dedicated processing unit, the pre-trained language model analyzes the query semantics and detects that kinship needs to be verified and vaccination records need to be queried; (2) Generate tool invocation instructions: including tool name and parameter mapping rules; (3) Execution tool call: Call the recipient file tool and return the verification result: the kinship is valid and the child's vaccination record is complete; (4) Automatically inject the results returned by the tool into the context of the pre-trained language model.

[0053] VII. Segmented Real-Time Response Generation (1) The first paragraph is immediately pushed to the user terminal after it is generated: "According to the regulations of Shanghai, children entering the kindergarten must complete the following vaccinations:"; (2) Subsequent content will be generated and pushed out in segments along with details of vaccination records and suggestions for catch-up vaccination; (3) Generate an interactive button for "Generate Inspection Report with One Click" and display it in real time; (4) Update the session context in real time to support subsequent conversations.

[0054] Example 2: A user inquired, "Where can I get a rabies vaccine nearby?" I. User Inquiry Reception (1) Receive the text query "Where can I get a rabies vaccine nearby?" input by the user through the dialogue service interface, generate a unique session identifier and record the timestamp.

[0055] II. Parameter Verification (1) Verify that the length of the query text is within the compliant range (no less than five characters and no more than five hundred characters); (2) Based on the national cyberspace administration's standard thesaurus, perform sensitive word filtering and special character cleaning; (3) Verify that the session identifier is valid. If the verification is successful, proceed to the next step.

[0056] III. Acquisition of User Information (1) With the user's authorization, obtain the user's current location information through the location service interface; (2) Obtain user real-name authentication information, including the administrative division to which the user belongs, through the unified identity authentication service; (3) Store the location information and administrative division information in a structured manner in the session context cache.

[0057] IV. Intent Recognition (1) Input the validated query text and conversation context into the pre-trained language model; (2) The pre-trained language model calculates the matching degree between the query semantics and the description of each pre-set dedicated processing unit, and selects "Vaccination Unit Query Processing Unit"; (3) Output the unique identifier of the processing unit and the selected confidence level.

[0058] V. Processing Unit Routing (1) Based on the output processing unit identifier, route the query to the “vaccination unit query processing unit”; (2) Load the dedicated configuration of this processing unit: including the rabies vaccination unit knowledge base index and the list of available tools (including the vaccination unit query tool); (3) Initialize the internal state machine of the processing unit.

[0059] VI. External Tool Invocation (1) Inside the dedicated processing unit, the pre-trained language model analyzes the query semantics and detects that real-time vaccination unit information needs to be obtained; (2) Generate tool call command: ① Tool Name: Vaccination Unit Inquiry Tool; ② Parameter mapping rules: Map the user's current location to the query region parameter, map "rabies vaccine" to the vaccine type parameter, and set the query time period to the current availability. (3) Execution tool call: The vaccination unit query tool queries the database according to the parameters and returns a list of vaccination units that meet the conditions, including unit name, detailed address, service time and contact number; (4) Automatically inject the results returned by the tool into the context of the pre-trained language model.

[0060] VII. Segmented Real-Time Response Generation (1) The first paragraph is immediately pushed to the user terminal after it is generated: "The following units that provide rabies vaccination services nearby have been found:"; (2) Subsequent content will be generated and pushed out in segments with detailed information on vaccination units (sorted by distance from nearest to farthest). (3) Generate and display the "Map Navigation" interactive button in real time; (4) If the tool takes a long time to call, first push the prompt "Searching for nearby vaccination units for you...", and then append the tool results to the response stream; (5) Update the session context in real time to provide support for possible follow-up questions.

[0061] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A smart question-and-answer method for vaccine administration, characterized in that, Includes the following steps: The system receives user-input queries through a dialogue service interface, converts the queries into a standard text encoding format, and generates and records a unique session identifier. Verify the format compliance and session status validity of the query. If the verification fails, terminate the process and return an error message. The system obtains user real-name authentication information through the unified identity authentication service and user-related data from the vaccination record system, and stores the real-name authentication information and related data in the session context cache in a structured manner. The verified query text and conversation context are input into the pre-trained language model, which dynamically selects a unique matching processing unit from multiple pre-set domain-specific processing units and outputs the processing unit identifier and selection confidence. Based on the processing unit identifier, the query is routed to the corresponding dedicated processing unit, the dedicated configuration of the processing unit is loaded, and the internal state machine is initialized. Inside the dedicated processing unit, the pre-trained language model autonomously determines whether an external tool needs to be called. If it does, a tool call instruction is generated and executed, and the tool's return result is injected into the context of the pre-trained language model. The system employs a segmented real-time generation technology to push the generated response content to the user's end in real time, and dynamically integrates tool call results and updates the session context in real time during the push process.

2. The method according to claim 1, characterized in that, The step of dynamically selecting a uniquely matching processing unit from a set of pre-set domain-specific processing units by the pre-trained language model specifically includes the following three hierarchical decision-making steps: The first layer is a high-dimensional semantic coarse classification based on temporal decay, which uses a dual-tower coding structure to extract the dynamic query vector of the user query and the static description vector of the processing unit, respectively, and calculates the corrected similarity score between the dynamic query vector and the static description vector. The corrected similarity score introduces a temporal decay factor based on the knowledge update time to reduce the weight of the processing unit corresponding to outdated knowledge. Based on the corrected similarity scores, sort them in descending order and select the top K processing units as a candidate processing unit set. The second layer involves hard constraint filtering based on business rules. This involves obtaining the metadata configuration of each unit in the candidate processing unit set. The metadata configuration includes regional applicability tags, timeliness windows, and population applicability characteristics. The user's real-time context information is then matched and verified against the metadata configuration one by one: regional constraint verification is performed to determine whether the user's administrative region is within the service area of ​​the processing unit; timeliness constraint verification is performed to determine whether the current system time is within the effective service window of the processing unit; and population logic verification is performed to determine whether the user's age and health status tags conform to the preset logic of the processing unit. Any candidate processing unit that fails verification is eliminated, generating a compliant candidate set. The third layer is an adaptive weighted confidence evaluation, which involves constructing a multi-dimensional feature vector for each processing unit in the compliance candidate set. The multi-dimensional feature vector includes at least a semantic matching degree component, a rule verification result component, and a historical interaction consistency component. The final confidence of each processing unit is calculated using a pre-trained weighted evaluation function, and the processing unit with the highest final confidence is selected as the unique matching processing unit.

3. The method according to claim 2, characterized in that, The formula for calculating the weighted evaluation function is as follows: C = αS + βR + γH + δU Wherein, C is the final confidence level; S is the semantic matching degree component, representing the vector space distance between the query text and the function of the processing unit; R is the rule verification result component, which takes a value of 1 when the processing unit passes all hard constraint verifications, and 0 otherwise; H is the historical interaction consistency component, representing the frequency weight of the processing unit being called in the user's current session history; U is the user profile matching degree component, representing the degree of matching between the characteristics of the applicable population of the processing unit and the user's real-name authentication information and vaccination record; α, β, γ, and δ are configurable dynamic weight coefficients, and α+β+γ+δ=1.

4. The method according to claim 1, characterized in that, Within the dedicated processing unit, the pre-trained language model autonomously determines whether external tools need to be invoked, specifically including: The dedicated processing unit maintains a dedicated tool registry, which records the interface definition, input parameter format, and function description of external tools. The pre-trained language model generates a tool call thought chain based on the user's query intent. If the tool call thought chain determines that real-time data needs to be obtained or a transaction operation needs to be performed, the target tool identifier and corresponding parameters are parsed out. The parsed parameters are subjected to structured validation. Once the validation is successful, they are encapsulated into API commands and sent to external tools for execution. The returned JSON format results are then converted into natural language context and injected into the pre-trained language model.

5. The method according to claim 1, characterized in that, The segmented real-time generation technology pushes the generated response content to the user terminal in segments in real time, specifically including: Establish a real-time transmission channel based on token streams; The pre-trained language model immediately triggers a push event upon generating a preset number of tokens, transmitting the encrypted text fragments to the user's device. The client uses a typewriter effect to render text fragments word by word. At the same time, it asynchronously preloads the results of tool calls that may be triggered in the background. If the tool call returns a result, a placeholder for the result is inserted into the current text stream and the rendered content is dynamically refreshed.

6. The method according to claim 5, characterized in that, The results of the dynamic integration tool call also include a multimodal collaborative presentation step: Based on the semantics of the content, key data points are automatically identified and visual charts are generated, including vaccination timelines or vaccine coverage maps. Dynamically insert interactive controls into the text stream, including a "Generate Inspection Report with One Click" button or a "Map Navigation" link; Establish a semantic alignment mechanism to automatically populate the generated natural language text with the structured data returned by the tool, ensuring data consistency.

7. A smart question-and-answer system for vaccine administration, characterized in that, include: The query receiving module is configured to receive user-input queries through a dialogue service interface, convert the queries into a standard text encoding format, and generate and record a session unique identifier. The verification module is configured to verify the format compliance and session status validity of the query. If the verification fails, the process will be terminated and an error message will be returned. The user information acquisition module is configured to acquire user real-name authentication information through the unified identity authentication service, acquire user-related data from the vaccination record system, and store the real-name authentication information and related data in a structured manner in the session context cache. The intent recognition and routing module is configured to input the verified query text and session context into a pre-trained language model, which dynamically selects a unique matching processing unit from a set of multiple domain-specific processing units, outputs the processing unit identifier and selection confidence, and routes the query to the corresponding dedicated processing unit according to the processing unit identifier, loads the dedicated configuration of the processing unit and initializes the internal state machine. The tool invocation module is configured to allow the pre-trained language model to autonomously determine whether an external tool needs to be invoked within the dedicated processing unit. If an external tool needs to be invoked, a tool invocation instruction is generated and executed, and the tool's return result is injected into the context of the pre-trained language model. The streaming response generation module is configured to use segmented real-time generation technology to push the generated response content to the user terminal in segments in real time, and dynamically integrate the tool call results and update the session context in real time during the push process.

8. The system according to claim 7, characterized in that, The intent recognition and routing module includes: The semantic coarse classification unit is used to perform the first layer of processing: the dynamic query vector of the user query and the static description vector of the processing unit are extracted by using the dual-tower coding structure, the corrected similarity score is calculated by introducing the time decay factor based on the knowledge update time, and the top K candidate processing units are selected by sorting them in descending order of the score. The constraint verification unit is used to perform the second-level processing: obtain the metadata configuration of the candidate processing units, perform regional constraints, time constraints and population logic verification, and eliminate unqualified candidate units to generate a compliant candidate set; The confidence evaluation unit is used to perform the third layer of processing: construct a multi-dimensional feature vector for the compliance candidate set, calculate the final confidence using a pre-trained weighted evaluation function, and select the processing unit with the highest confidence.

9. The system according to claim 7, characterized in that, The tool invocation module includes: The tool registry maintenance unit is used to record the interface definition, input parameter format, and function description of external tools; The thought chain generation unit is used to drive the pre-trained language model to generate a tool call thought chain based on the user's query intent, and to parse out the target tool identifier and parameters; The API encapsulation unit is used to perform structured validation on the parsed parameters. After successful validation, the parameters are encapsulated into API instructions and sent to external tools for execution. The returned JSON format results are then converted into natural language context and injected into the pre-trained language model.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 6.