A multi-service report generation method and system based on intent routing and deterministic query
By employing intent routing and deterministic querying methods, the uncertainties and data consistency issues in the process of converting natural language requests into database queries are resolved. This ensures the accuracy and credibility of multi-business analysis reports, guarantees the reproducibility of query results, and guarantees the factual consistency of report content.
Patent Information
- Application Number
- CN202611261817.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-11-24
AI Technical Summary
In existing technologies, the query logic during the conversion of natural language requests to underlying database queries is susceptible to semantic understanding biases and dynamic generation mechanisms, making it difficult to verify and trace the analysis conclusions. Furthermore, the data directly generated by the large language model is inconsistent with the facts in the database, reducing the accuracy and credibility of multi-business analysis reports.
By employing intent routing and deterministic querying, the system receives natural language analysis requests and performs semantic parsing, generates request state objects, reads parameter integrity rules, identifies missing parameters and generates clarification prompts, selects a structured query template and adds it to the permission context, forms a deterministic query plan, executes the query and converts it into a structured fact snapshot, uses a large language model to generate natural language content and performs fact consistency checks, and finally generates a target analysis report.
It achieves reproducibility of query results and consistency of factual data in the report, solves the uncertainty of the query process and the inconsistency of data generated by the large language model, and ensures the accuracy and credibility of the analysis report.
Smart Images

Figure CN123159294A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of natural language processing technology, specifically relating to a method and system for generating multi-service reports based on intent routing and deterministic querying. Background Technology
[0002] As enterprises deepen their digital transformation, business systems such as human resources, payroll, performance management, engineering projects, workflow approvals, and document archiving are gradually going live. These systems exhibit significant differences in data structure, field definitions, and access permissions. To lower the professional barrier to cross-system data analysis, utilizing natural language interaction to initiate multi-business analysis requests has become an important direction for enterprise data applications. Simultaneously, large language models are continuously improving their capabilities in natural language understanding and content generation, and are being widely applied to the automated generation of analysis reports to improve report production efficiency.
[0003] However, during the conversion of natural language requests into underlying database queries, the query logic is susceptible to semantic understanding biases and dynamic generation mechanisms. This can lead to different query paths and result sets for the same request at different execution times, making it difficult to verify and trace analytical conclusions. Furthermore, when generative models directly participate in the generation of indicator values, trend descriptions, or statistical conclusions, their output may deviate from the actual records in the underlying business database, causing factual contradictions between the analytical results and the original data, thus reducing the accuracy and credibility of multi-business analysis reports for enterprises. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention aims to provide a multi-service report generation method and system based on intent routing and deterministic querying. This solves the problems of uncertainty in the query process and inconsistencies between data generated directly from large language models and database facts in existing technologies. The specific solution is as follows:
[0005] In a first aspect, embodiments of this application provide a method for generating multi-service reports based on intent routing and deterministic querying, comprising the following steps:
[0006] Receive natural language analysis requests along with corresponding session information and permission context, perform semantic parsing on the natural language analysis requests, and generate a request state object including intent type, candidate business domain, report type, filtering parameters, and analysis dimensions;
[0007] Read the parameter integrity rules, determine the missing parameter set of the request status object, generate a clarification prompt when the missing parameter set is not empty, and receive supplementary information from the user to update the request status object until the missing parameter set is empty or the preset termination condition is met.
[0008] Identify the target business domain, convert the request status object into a task description object, and schedule the corresponding business analysis agent;
[0009] The business analysis agent selects a structured query template, verifies the filtering parameters and writes them into the structured query template, adds data range predicates according to the permission context, forms a deterministic query plan and executes it to obtain structured query results.
[0010] Convert the structured query results into a structured fact snapshot;
[0011] Select a fixed report template based on the report type and target business domain, and map the structured fact snapshot to a structured report payload;
[0012] The structured fact snapshot is anonymized to form the model input snapshot, which is then sent to the large language model to generate natural language content and perform fact consistency verification.
[0013] The natural language content that has passed the fact consistency check is written into the structured report payload to generate the target analysis report.
[0014] In one embodiment, a natural language analysis request and corresponding session information and permission context are received; semantic parsing is performed on the natural language analysis request to generate a request state object including intent type, candidate business domain, report type, filtering parameters, and analysis dimensions, including:
[0015] Receive natural language analysis requests from users through web chat portals, business workbench, or other interactive terminals;
[0016] Obtain the user's authentication information, session information, and permission context;
[0017] Perform intent recognition on natural language analysis requests to determine intent type and candidate business domain;
[0018] Entity extraction is performed on natural language analysis requests to determine report type, screening parameters, and analysis dimensions;
[0019] Combine intent type, candidate business domain, report type, filtering parameters, analysis dimensions, session information, and permission context to generate a request state object.
[0020] In one embodiment, the parameter integrity rules are read to determine the set of missing parameters for the request status object. When the set of missing parameters is not empty, a clarification prompt is generated and supplementary information from the user is received to update the request status object, until the set of missing parameters is empty or a preset termination condition is met, including:
[0021] Based on the candidate business domain and intent type, the corresponding parameter integrity rules are read from the preset rule base. The parameter integrity rules include at least the set of required parameters, the set of optional parameters, the parameter data type, the parameter value range, the parameter dependency relationship, the default value usage conditions, and the permission verification conditions.
[0022] The set of missing parameters is determined by taking the difference between the valid parameters verified in the request status object and the set of required parameters.
[0023] Determine if the set of missing parameters is empty. If the set of missing parameters is not empty, pause the data query process and generate a clarification prompt based on the type, dependency and priority of the missing parameters.
[0024] Receive supplementary information from the user and update the request status object;
[0025] Perform missing parameter checks again on the updated request status object until the set of missing parameters is empty or the preset termination condition is met.
[0026] In one embodiment, determining the target business domain, converting the request state object into a task description object, and scheduling the corresponding business analysis agent includes:
[0027] Obtain the business intelligence agent registration information, which includes the business domain identifier, supported intent types, and required permission identifiers;
[0028] Based on intent type, filtering parameters, session information, permission context, and business agent registration information, calculate the matching score for each candidate business domain, and select the candidate business domain with the highest matching score as the target business domain.
[0029] The request status object is converted into a task description object and sent to the business analysis agent corresponding to the target business domain.
[0030] In one embodiment, a structured query template is selected based on the business analysis agent, the filtering parameters are validated and written into the structured query template, data range predicates are added according to the permission context, a deterministic query plan is formed and executed, and structured query results are obtained, including:
[0031] The business analysis agent selects a pre-defined and versioned structured query template from the associated query template library;
[0032] Perform type validation, format standardization, and value range validation on the filtering parameters to obtain the filtering parameters that pass the validation;
[0033] Read the parameter placeholders in the structured query template and write the validated filter parameters into the parameter placeholders of the structured query template using parameter binding.
[0034] Generate row-level data range predicates based on the permission context and insert them into the corresponding positions in the structured query template;
[0035] Formulate a deterministic query plan and execute it to obtain structured query results.
[0036] In one embodiment, converting a structured query result into a structured fact snapshot includes:
[0037] Perform field type conversion, null value handling, unit conversion, precision handling, dimension alignment, and indicator definition annotation on each field in the structured query results to generate processed data;
[0038] The processed data is organized into a structured fact snapshot containing fact identifiers, indicator values, dimension values, data time ranges, query template identifiers, query template versions, parameter sets, permission range identifiers, and data versions. The structured fact snapshot contains several fact items.
[0039] In one embodiment, a fixed report template is selected based on the report type and target business domain, and the structured fact snapshot is mapped to a structured report payload, including:
[0040] Select a fixed report template based on the target business domain and report type;
[0041] The structured fact snapshot is mapped into a structured report payload that includes report metadata, indicator cards, key conclusions, chapters, charts, tables, details, overall summary placeholders, data quality information, and tracking information;
[0042] The chart data, table data, and indicator card data are derived from structured fact snapshots.
[0043] In one embodiment, the structured fact snapshot is anonymized to form a model input snapshot, which is then sent to a large language model to generate natural language content and perform fact consistency verification, including:
[0044] Based on the permission context, the structured fact snapshot is cropped and anonymized to form a model input snapshot;
[0045] The model input snapshot is sent to the big language model, which generates a natural language summary, key points, risk statement or management suggestions based on the indicator values, dimension values and data time range in the structured fact snapshot;
[0046] Numerical representations, time range representations, and object range representations are extracted from the output of the large language model and matched against the corresponding fact items in the structured fact snapshot.
[0047] When the numerical representation, time range representation, and object range representation can all be found in the structured fact snapshot and the values are consistent, the fact consistency check is passed.
[0048] In one embodiment, natural language content that has passed fact consistency verification is written into a structured report payload to generate a target analysis report, including:
[0049] Write the natural language content that has passed the fact consistency check into the overall summary placeholder area of the structured report payload;
[0050] Generate a target analysis report based on the structured report payload;
[0051] Based on the permission context, perform front-end rendering, report preview, streaming progress output, session saving, document export, spreadsheet export, or controlled sharing on the target analysis report.
[0052] Secondly, embodiments of this application provide a multi-service report generation system based on intent routing and deterministic querying, including:
[0053] The request parsing unit is used to receive natural language analysis requests and corresponding session information and permission context, perform semantic parsing on the natural language analysis requests, and generate a request status object including intent type, candidate business domain, report type, filtering parameters and analysis dimensions;
[0054] The parameter verification unit is used to read the parameter integrity rules, determine the missing parameter set of the request status object, generate a clarification prompt when the missing parameter set is not empty, and receive supplementary information from the user to update the request status object until the missing parameter set is empty or the preset termination condition is met.
[0055] The routing and scheduling unit is used to determine the target business domain, convert the request status object into a task description object, and schedule the corresponding business analysis agent.
[0056] The query execution unit is used to select a structured query template based on the business analysis intelligence agent, verify the filtering parameters and write them into the structured query template, add data range predicates according to the permission context, form a deterministic query plan and execute it to obtain structured query results.
[0057] The snapshot generation unit is used to convert structured query results into structured fact snapshots;
[0058] The report building unit is used to select a fixed report template based on the report type and target business domain, and to map structured fact snapshots into structured report payloads;
[0059] The summary generation unit is used to desensitize the structured fact snapshot to form a model input snapshot, which is then sent to the large language model to generate natural language content and perform fact consistency verification.
[0060] The output processing unit is used to write the natural language content that has passed the fact consistency check into the structured report payload to generate the target analysis report.
[0061] Beneficial effects of the invention
[0062] 1. This invention solves the problems of uncertainty in the query process and inconsistency between data generated directly by the large language model and the database facts in the prior art, by having a business analysis intelligent agent select a preset and versioned structured query template, verify the filtering parameters and write them in a parameter binding manner, add data range predicates according to the permission context to form a deterministic query plan, convert the query results into a structured fact snapshot, and perform fact consistency verification on the output of the large language model. This invention achieves the reproducibility of query results and the fact consistency of reported data.
[0063] 2. This invention solves the problem of invalid and erroneous queries caused by missing parameters by reading parameter integrity rules before database querying and generating clarification prompts to receive supplementary information from users until the parameters are complete. It also achieves accurate conversion from natural language requests to structured execution links.
[0064] 3. This invention solves the problem of the potential spread of sensitive data in the query, model input, and sharing stages by performing field clipping and desensitization processing based on the permission context throughout the query and report output process, and realizes full-process security governance of enterprise multi-business data. Attached Figure Description
[0065] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments, and the advantages of the present invention in the above and / or other aspects will become clearer.
[0066] Figure 1 A flowchart illustrating the multi-service report generation method based on intent routing and deterministic query provided by the present invention;
[0067] Figure 2 Technical roadmap for the intent recognition model provided by this invention;
[0068] Figure 3 A schematic diagram of the network structure of the intent recognition model provided by this invention;
[0069] Figure 4 The missing condition clarification and multi-round interaction flowchart provided for this invention;
[0070] Figure 5The flowchart for the generation and execution of a deterministic query plan provided by this invention;
[0071] Figure 6 This is a schematic block diagram of the multi-service report generation system based on intent routing and deterministic query provided by the present invention. Detailed Implementation
[0072] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0073] The multi-service report generation method based on intent routing and deterministic query provided in this application embodiment is executed by at least one electronic device, which can be a server, desktop computer, laptop computer, or computing node deployed in a controlled cloud environment. The electronic device is equipped with application software that implements this method. The application software is logically divided into an interactive access layer, a request understanding layer, a central control routing layer, a business intelligence agent layer, a deterministic data access layer, a fact snapshot layer, a report construction layer, a fact constraint summary layer, a permission governance layer, and an output layer. Enterprises typically deploy multiple business systems such as payroll, engineering projects, process approval, personnel files, performance, security management, document archives, and voice recording. The data of each business system is stored in a relational database or data warehouse. The deterministic data access layer is the only layer among all layers that is allowed to access the above data sources. The layers only transmit information through structured request status objects, task description objects, structured query results, structured fact snapshots, and structured report payloads, without using natural language text as the data carrier between layers, thereby ensuring that any intermediate result can be serialized, recorded, and reviewed.
[0074] It should be noted that the application scenarios described in the following embodiments are for the purpose of more clearly illustrating the technical solutions of this application and do not constitute a limitation on the scope of application of this application; as enterprise business systems are added or removed, those skilled in the art will know that the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0075] like Figure 1 As shown, the multi-service report generation method based on intent routing and deterministic query includes steps S1 to S8.
[0076] S1. Receive natural language analysis requests along with corresponding session information and permission context, perform semantic parsing on the natural language analysis requests, and generate a request state object including intent type, candidate business domain, report type, filtering parameters, and analysis dimensions.
[0077] Specifically, the request status object is the data foundation for all subsequent steps of this application. Once its fields are generated, they are continuously updated in multiple rounds of interaction. The intent type, candidate business domain, report type, filtering parameters and analysis dimensions required by subsequent steps are all read from this object. There are no parameters that are passed separately from this object, thus ensuring that the parameter versions read in each step during multiple rounds of clarification are consistent.
[0078] In some embodiments, step S1 includes steps S11 to S15.
[0079] S11. Receive natural language analysis requests from users through web chat portals, business workbench, or other interactive terminals; other interactive terminals can be mobile office clients or dialogue components embedded in business systems. Requests received through different portals are uniformly converted into plain text before entering the request understanding layer, and the differences in portals do not affect subsequent processing.
[0080] S12. Obtain the user's identity authentication information, session information, and permission context. The identity authentication information is issued by the enterprise's unified authentication service when the user logs in. The session information includes the session identifier, the request records of the most recent rounds, and supplementary records. The permission context includes at least the user role, accessible business domains, accessible organizational scope, accessible project scope, accessible personnel scope, and accessible field set. The permission context is read in once at the time of request reception and remains unchanged during this report generation task to avoid inconsistencies in the data scope before and after the same task due to permission changes during task execution.
[0081] S13. Perform intent recognition on natural language analysis requests to determine the intent type and candidate business domains. Intent types include report generation, data query, indicator comparison, and anomaly investigation. Candidate business domains are jointly determined with intent types. For example, if the intent type is report generation and the text involves a salary entity, the salary business domain and the performance business domain are simultaneously included in the candidate business domain set. In this embodiment, intent recognition adopts a two-level recognition mechanism with keyword rules as the priority and a large language model as a fallback. It does not rely on an independent model training process, so it can be deployed directly even when the enterprise's historical annotated corpus is insufficient, and the recognition rules can be directly maintained by business personnel.
[0082] The first level is keyword rule recognition: A keyword list is pre-configured for each intent type, and a hit weight is assigned to each keyword. The hit weight is set based on the keyword's relevance to the intent. For example, "generate report" and "export report" strongly indicate the intent to generate a report, so they receive a higher hit weight. "Take a look" and "check" are generalized verbs, so they receive a lower hit weight. Natural language analysis requests are matched against the keyword lists for each intent type. The hit weights of the hit keywords are accumulated for each intent type to obtain a rule hit score for that intent type. The intent type with the highest rule hit score is selected as the candidate intent type. When the rule hit score of a candidate intent type is not lower than a preset recognition threshold, and the difference between it and the second-highest rule hit score is greater than a preset difference, the candidate intent type is directly determined as the intent type.
[0083] The second level is a fallback identification using a large language model: When the highest rule hit score in the first level is lower than the preset identification threshold, or the difference between the highest rule hit score and the second highest rule hit score is not greater than the preset difference, it indicates that the keyword rule cannot make a confident judgment. In this case, the natural language analysis request, along with a closed tag set of the same type, is sent to the large language model. The large language model selects the intent type from the closed tag set and simultaneously provides candidate business domains. The output of the large language model is constrained to be structured tag text, and the output constraint requires that values can only be taken from the closed tag set and that tags outside the set cannot be generated. After receiving the output of the large language model, tag validity is checked. If the output tag belongs to the closed tag set, it is adopted; otherwise, it is treated as a verification failure, and the candidate intent type in the first level is returned. The request is then recorded in the review queue, and business personnel review it and supplement or adjust the intent keyword vocabulary so that when the same type of request appears again, it is directly hit by the first level. The two-level mechanism thus forms a closed loop of continuous rule accumulation.
[0084] It should be noted that in the above two-level recognition mechanism, the large language model only undertakes the function of determining the closed set of intent classification, and does not participate in parameter extraction, query generation and numerical generation, which is consistent with the constraint in step S4 that the large language model has no entry point on the query path.
[0085] In other embodiments, as an optional implementation, intent recognition can also be performed using a trained intent recognition model. The input of the intent recognition model is the segmented sequence of the natural language analysis request, and the output is the intent probability distribution for each intent type. The network structure of the intent recognition model consists of an embedding layer, a bidirectional long short-term memory layer, an attention-weighted layer, and a fully connected output layer. See also Figure 2 and Figure 3 The data flow process between different layers is as follows.
[0086] First, the natural language analysis request is segmented into word segments. ,in For the first Each word, To increase the number of words, word segmentation uses a hybrid approach of enterprise business vocabulary and general vocabulary. The business vocabulary includes project names, indicator names, and department names to avoid incorrect segmentation of business terms. The embedding layer maps each word segment to a word vector with a dimension of 300.
[0087] Secondly, the word vector sequence is input position-by-position into a bidirectional long short-term memory layer. Long short-term memory networks are a classic variant of recurrent neural networks, and their gating structure is used to alleviate gradient vanishing over long sequences; here, their standard structure is directly adopted. The forward hidden state and the backward hidden state are concatenated to obtain the... Context representation of each position The dimension of the one-way hidden layer is 128.
[0088] Secondly, since only a few keywords in the request text truly determine the intent, the attention weighting layer weights and merges the contextual representations of each position, and the attention weights adopt the normalized exponential form in the classic attention mechanism:
[0089] ;
[0090] ;
[0091] ;
[0092] in, For the first The attention energy value at each location, dimensionless; and For the attention-weighted layer, the weight matrix and bias vector are: For attention query vectors; For the first Attention weights at each position, dimensionless, and ; This is the context vector for the entire sentence; it's important to clarify that the normalized exponential function here applies to the attention energy values at each word segmentation position, and its output... The attention weight distribution, which is the row in the attention matrix corresponding to the current request, physically represents the contribution ratio of each word segmentation position to the determination of the intent of the whole sentence, rather than the probability of the intent type.
[0093] Finally, the fully connected output layer will output the context vector. Mapped to an intent probability distribution:
[0094] ;
[0095] in, and These are the output layer parameters; For length is The probability vector, This represents the total number of intent types; the normalization exponential function here applies to... The output layer score for each intent category, its output This is the probability distribution of intent. The The component indicates that the request belongs to the first... The probability of each intent type is used; the category with the highest probability is taken as the intent type. It is evident that although both the attention weight distribution and the intent probability distribution use normalized exponents, the former operates on the word segmentation position dimension and serves the weighted aggregation of the entire sentence representation, while the latter operates on the intent category dimension and serves classification determination. Their objects of action and uses differ.
[0096] The training loss for this alternative implementation uses cross-entropy loss from information theory:
[0097] ;
[0098] in, This represents the number of samples within a batch. For the first The first sample The actual class identifier; 1 if it belongs to the class, 0 otherwise. The corresponding probability is the output of the model; cross-entropy measures the difference between the predicted distribution and the true distribution and is the standard loss function for multi-class classification tasks.
[0099] The hyperparameters of this optional implementation were all determined through optimization rather than directly taking empirical initial values. The optimization process is as follows: The word vector dimension was tested on a self-built validation set with 100, 200, 300, and 400 dimensions respectively. After 300 dimensions, the improvement in intent classification accuracy was less than 0.2 percentage points, while the model size and inference time increased significantly, so 300 dimensions were chosen. The dimension of the one-way hidden layer was compared on the validation set with 64, 128, and 256 dimensions. Further increasing the dimension had limited contribution to accuracy, so 128 dimensions were chosen. The initial learning rate was performed using grid search with values of 0.0001, 0.0005, 0.001, and 0.005, and 0.001 was selected as 0.001 to achieve the highest accuracy on the validation set. The batch size was 32 entries. An early stopping strategy was adopted during training. Training was stopped when the validation set loss no longer decreased after 5 consecutive rounds to avoid overfitting. After optimization, the intent recognition model was solidified, and only forward computation was performed during online inference.
[0100] It should be emphasized that the above-mentioned trained intent recognition model is only an optional implementation method. In the deployment stage where sufficient labeled data has not been accumulated, the two-level recognition mechanism of prioritizing keyword rules and backing up with a large language model shall be used. The intent type and the position and format of the candidate business domain written into the request status object are completely consistent between the two. Subsequent steps do not need to distinguish which method the intent recognition is completed by.
[0101] S14. Entity extraction is performed on the natural language analysis request to determine the report type, screening parameters, and analysis dimensions. In this embodiment, entity extraction is completed using a deterministic parsing method, which does not rely on a trained sequence labeling model. Specifically, it includes three parts: regular expression parsing, keyword dictionary matching, and parameter parsing rules specific to each business module.
[0102] For time-related entities, regular expression parsing is used: Absolute time expression templates and relative time expression templates are pre-configured. Absolute time expression templates match text fragments with explicit year-month-day formats, while relative time expression templates match text fragments categorized as "last month," "this quarter," or "this past week." For matched text fragments, the requested date is used as the base date. The relative time expression is converted into explicit start and end dates. For example, when the base date is June 15, 2025, last month is converted to start date May 1, 2025 and end date May 31, 2025, and this quarter is converted to start date April 1, 2025 and end date June 30, 2025. The converted start and end dates are then written into the filter parameters.
[0103] For entities categorized as projects, personnel, departments, and regions, keyword dictionary matching is employed: Natural language analysis requests are matched against names and aliases in the enterprise master data dictionary one by one, with the longest match priority strategy to prevent short names from taking the lead over long names; entities that match successfully are identified by the master data and written into the filtering parameters, while entities that do not match are not written into the filtering parameters but are instead recorded in the entity set to be confirmed for use in the clarification process.
[0104] For entities categorized by report type, indicator, and analysis dimension, dedicated parameter parsing rules for each business module are adopted. Each business analysis agent registers its own dedicated parameter parsing rules during registration. These rules include mapping tables between indicator keywords and indicator codes, report type keywords and report type identifiers, analysis dimension keywords and dimension fields, and format regular expressions specific to the business domain. For example, the dedicated parameter parsing rules for the payroll business domain include regular expressions for amount ranges and a list of payroll component names; the dedicated parameter parsing rules for the engineering project business domain include a list of process names and a risk level keyword mapping table. During parsing, only the dedicated parameter parsing rules registered by the business domains already included in the candidate business domain set are enabled to avoid interference between identical terms from different business domains. For example, the term "ranking" maps to a payroll ranking indicator in the payroll business domain and a performance ranking indicator in the performance business domain. This limitation ensures that the same term is parsed to the correct indicator code according to the candidate business domain.
[0105] The reason for adopting the deterministic parsing method is that the report type, filtering parameters and analysis dimensions will directly enter the parameter verification and parameter binding stage in step S4. Any parsing deviation will be transmitted as query deviation. Each hit result of deterministic parsing can correspond to a specific regular expression template, dictionary entry or mapping table entry. The parsing process can be reviewed one by one, which is consistent with the overall design goal of the deterministic query plan.
[0106] In other embodiments, as an optional implementation, entity extraction can also be performed using a trained entity extraction model. This model employs a combination of a bidirectional long short-term memory network and a conditional random field. The input is also a word segmentation sequence, and the output is a label for each word segment. The labeling system uses BIO tags, and the label categories include time range, project, personnel, department, region, indicator, and report type. Each word belongs to the tag The launch score is recorded as The transition matrix is obtained by linearly mapping the output of a bidirectional long short-term memory network; the transition scores between labels constitute the transition matrix. , Indicates label Transfer to label The score; Conditional Random Fields (CRF) is a classic algorithm in probabilistic graphical models, and its labeled sequence score is defined as:
[0107] ;
[0108] in, Given a word segmentation sequence as input, The label sequence is given; the conditional probability of the labeled sequence is:
[0109] ;
[0110] in, The candidate tag sequence represents the sequence of tags that, given the tag system and tag validity constraints, can be compared with the input word segmentation sequence. For any one of the feasible label sequences of equal length, the denominator is summed over all feasible candidate label sequences. This normalizes the sum of the conditional probabilities of all candidate label sequences to 1. Label validity constraints require that the connection between labels must conform to the BIO labeling rules. For example, the preceding position of a class I label must be a class B label or a class I label of the same type. Sequences that violate this constraint are not considered feasible candidate label sequences and are not included in the denominator summation. The training loss is taken from the ground truth labeled sequence. Negative log-likelihood:
[0111] ;
[0112] in, The training samples contain manually labeled correct label sequences; the decoding stage uses the Viterbi algorithm to search for... The largest label sequence; the hyperparameters of this optional implementation were also optimized and determined: the initial learning rate was used to perform a grid search with 0.0001, 0.0005, and 0.001, and 0.0005 was selected with the highest entity-level accuracy on the validation set as the target. This is lower than the learning rate of the intent recognition model because the transition matrix of the conditional random field is more sensitive to parameter updates, and an excessively large learning rate will cause the transition score to oscillate; the batch size was 32, and the early stopping strategy was consistent with that of the intent recognition model.
[0113] Regardless of whether entity extraction uses a deterministic parsing method or an optional entity extraction model, the output consists of report type, filter parameters, and analysis dimensions, and the location and format of the written request status object are completely consistent. When using an entity extraction model, the model output must still undergo the aforementioned time standardization and master data dictionary matching processing before the filter parameters can be written to ensure consistency in the content written.
[0114] S15. Combine the intent type, candidate business domain, report type, filtering parameters, analysis dimensions, session information, and permission context to generate a request status object. The request status object carries a status version number. Each time user supplementary information is received, the version number is incremented. When any subsequent step reads the request status object, the version number read is also recorded to ensure that the request content on which each step is based can be restored during auditing.
[0115] S2. Read the parameter integrity rules, determine the missing parameter set of the request status object, generate a clarification prompt when the missing parameter set is not empty, and receive supplementary information from the user to update the request status object until the missing parameter set is empty or the preset termination condition is met.
[0116] In some embodiments, step S2 includes steps S21 to S25.
[0117] S21. Based on the candidate business domain and intent type, retrieve the corresponding parameter integrity rules from the preset rule base. The parameter integrity rules include at least the set of required parameters, the set of optional parameters, the parameter data type, the parameter value range, the parameter dependency relationship, the default value usage conditions, and the permission verification conditions. The rule base is indexed according to the combination of business domain and intent type. For example, the report generation intent of the payroll business domain corresponds to one rule, and the indicator comparison intent of the engineering project business domain corresponds to another rule. The rules are pre-configured by business analysts based on the minimum statistical scope of each business domain report and are version-updated as the business scope is adjusted.
[0118] S22. Perform a difference operation between the validated valid parameters in the request status object and the set of required parameters to determine the set of missing parameters. The difference operation originates from the difference operation in set theory. This application, based on this, also considers the case of default value supplementation. Let the set of required parameters corresponding to the candidate business domain be denoted as... The set of valid parameters in the request status object that have passed type and value range validation is: The set of parameters that can be supplemented with default values is Then the missing parameter set satisfy:
[0119] ;
[0120] The reasoning is as follows: A valid deterministic query requires that each parameter in the required parameter set has a definite value. These values can only come from two sources: either the user explicitly provides the value in the request and it is validated, thus falling within the range... Secondly, the rules allow for completion using default values, i.e., falling into... The union of the two sets represents the confirmed parameters. Subtracting the confirmed parameters from the set of required parameters leaves the parameters that must be clarified with the user. When the data is not empty, no database query task is generated; only a clarification task is generated to avoid executing a full query or an erroneous query when the statistical range is incomplete.
[0121] For example, the set of required parameters for the payroll business domain report generation intent. Including the time range, project identifier, and report type, the user's first input is the set of valid parameters for generating a project salary analysis report. Includes report type and analysis dimensions, and allows for a set of parameters supplemented by default values. Including the analysis dimensions and sorting methods, This includes report type, analysis dimensions, and sorting method. The system takes two parameters: time range and project identifier. If the set of missing parameters is not empty, the system will not perform any query.
[0122] S23. Determine if the missing parameter set is empty. If the missing parameter set is not empty, pause the data query process and generate clarification prompts based on the type, dependency, and priority of the missing parameters. The generation order of clarification prompts is determined by the parameter dependency. For multiple independent missing parameters, list them all at once in one prompt to avoid multiple rounds. For downstream parameters whose values depend on upstream parameters, clarify the upstream parameters first, and then generate candidate downstream parameters based on the values of the upstream parameters. For example, if the project identifier is not determined, do not prompt to select a project milestone. Once the project identifier is determined, use the project's milestone list as a candidate. Priority is configured according to the degree of influence of parameters on the query results. Parameters that affect the statistical scope take precedence over parameters that affect the display format.
[0123] S24. Receive supplementary information from the user and update the request status object; the supplementary information, after undergoing the same semantic parsing process as steps S13 to S15, extracts parameters and writes them into the same request status object, with the status version number incremented; for example, the user supplementary input analyzes Project A from last month, the time range is standardized and written, Project A is matched with the project identifier by the master data dictionary, and the updated request status object contains the set of valid parameters. It then expanded.
[0124] S25. Perform missing parameter detection again on the updated request status object until the missing parameter set is empty or the preset termination condition is met. The preset termination condition is that the clarification rounds reach the maximum number of rounds or the user chooses to give up in the prompt. The maximum number of rounds is 3 rounds, which is determined based on statistics of the enterprise's historical sessions. More than 95% of complete requests can complete all missing parameters within 3 rounds. Requests that still have missing parameters after more than 3 rounds are mostly due to unclear requirements. The marginal benefit of continuing to follow up is very low, so the task is terminated and the session is retained so that the user can re-initiate. In the second round of detection in the above example, If empty, proceed to step S3. Figure 4 This is a schematic diagram of the missing condition detection and multi-round clarification process of the present invention.
[0125] S3. Determine the target business domain, convert the request status object into a task description object, and schedule the corresponding business analysis agent.
[0126] In some embodiments, step S3 includes steps S31 to S33.
[0127] S31. Obtain business intelligence agent registration information. The business intelligence agent registration information includes business domain identifier, supported intent types, and required permission identifiers. Each business analysis intelligence agent also registers its parameter specifications, query template set, indicator definition set, report template set, dedicated parameter parsing rules, and intelligence agent version during registration. Business analysis intelligence agents can include payroll analysis intelligence agents, engineering project analysis intelligence agents, process approval analysis intelligence agents, personnel data archive analysis intelligence agents, performance analysis intelligence agents, security analysis intelligence agents, document archive analysis intelligence agents, and voice recording analysis intelligence agents. When adding a new business domain, only the new intelligence agent needs to be registered, without modifying the routing logic.
[0128] S32. Calculate the matching score for each candidate business domain based on intent type, filtering parameters, session information, permission context, and business agent registration information. The matching score uses a linear weighted summation method in multi-index comprehensive evaluation to synthesize a single score by weighting the matching degree of the four dimensions.
[0129] ;
[0130] in, For candidate business domains The matching score is dimensionless; For intent matching score, if the intent type determined in step S13 belongs to the business domain The set of supported intent types is 1 if it is set to 1, otherwise it is 0. The entity matching score is defined as the set of parameter names in the filter parameters. With business domain The set of parameter names in the parameter specification The overlap ratio:
[0131] ;
[0132] This formula originates from the classic definition of set overlap. The numerator is the number of elements in the intersection of two sets, and the denominator is the number of parameters on the request side. It means what proportion of the parameters appearing in the request fall within the parameter specifications of this business domain. When the empty set is in order ; The session context matching score is defined as the most recent. Business domains involved in round-robin sessions Round percentage:
[0133] ;
[0134] in, For the most recent Business domain mentioned in the round-robin session The number of rounds, Choose 5. This value is determined based on the statistics of user session topic switching. A complete analysis task is usually completed within 5 rounds. Choosing a longer window will bring the context error of the previous task into the current task. For permission matching scores, the permission context includes the business domain. The value is 1 if all required permissions are specified, and 0 otherwise. The candidate business domain is directly removed from the scheduling list, regardless of its total score, because business domains without permissions cannot execute queries even if the routing is correct; weight. , , , The values were 0.4, 0.25, 0.2, and 0.15, with a sum of 1. This set of values was determined by performing a grid search on the historical route validation set with a step size of 0.05, aiming for the highest route accuracy. The intent type most directly points to the service domain, therefore... The highest priority item has the lowest weight due to its elimination mechanism.
[0135] When determining the target business domain, it is not limited to a single business domain, but supports joint scheduling of multiple business domains. This is an important capability of this application for meeting the comprehensive analysis needs of enterprises: the matching scores of each candidate business domain are sorted in descending order, and the matching scores of the selected business domains are not lower than the minimum score threshold. The candidate business domains constitute the target business domain set, with a maximum of 3 business domains in the target business domain set, and the matching score is not lower than When there are more than 3 candidate business domains, only the 3 with the highest scores are selected. The reason for setting the upper limit of 3 is that the number of business partitions that a single report can accommodate is constrained by the readability of the report. The proportion of joint requests with more than 3 business domains in actual enterprise sessions is very low, and the orchestration overhead of joint scheduling increases significantly with the number of business domains. Therefore, the upper limit is fixed at 3. The business domains in the target business domain set are sorted in descending order of matching scores. The sorting result determines the order of each business partition in step S6.
[0136] Accordingly, minimum score threshold and difference threshold The usage is as follows: The value is 0.6, obtained by scanning the validation set with the goal of maximizing the harmonic mean of accuracy and recall in route determination; when the matching scores of all candidate service domains are lower than 0.6. When the target business domain set is empty, the business analysis agent is not directly dispatched; instead, a business domain confirmation prompt is generated, which the user specifies from the candidate business domains. When the target business domain set is not empty, the difference between the highest matching score and the second highest matching score in the set is then compared, and the difference is not less than [amount missing]. If only a single business domain within the set meets the threshold condition, scheduling is performed on a single business domain basis; if multiple business domains exist within the set and the difference between the highest and second-highest matching scores is less than [a certain value], then [the process is similar]. Instead of directly determining the primary and secondary tasks, a task assignment confirmation prompt is generated, listing the analysis content to be undertaken by each selected business domain. The task is then executed after user confirmation or adjustment, thus avoiding the erroneous splitting of the user's intended single-domain request into a multi-domain joint. The value is set to 0.05, which is taken from the first quartile of the distribution of the difference between the highest and second-highest scores of correct route samples in the validation set, approximately 0.048. Rounded up to 0.05, this means that when the credibility of two business domains is close to this level, the risk of automatic primary / secondary misjudgment exceeds an acceptable level, and the decision should be returned to the user. When multiple business domains exist in the set and the difference between the highest and second-highest matching scores is not less than [a certain value], [further details are needed]. If this is the case, it indicates that the user request indeed spans multiple business domains, and can be directly scheduled jointly according to multiple business domains without user confirmation.
[0137] For example, continuing from the previous example, the intent type after the update request is report generation, the filtering parameters include time range, project identifier, and report type, and the candidate business domain is the payroll business domain. Performance Business Domain and engineering project business domain Payroll business domain: , In the last five rounds of conversation, three involved compensation. Fully authorized permissions ,but Performance Business Domain: , , , ,but The scores for all sub-domains within the engineering project business area are 0. The matching score for the payroll business domain alone is no less than [amount missing]. The target business domain set contains only the payroll business domain, and scheduling is performed on a single business domain basis.
[0138] To further illustrate multi-business domain joint scheduling: User input analyzes the salary expenditure and construction progress of Project A in the previous quarter. After semantic parsing, the filtered parameters simultaneously include salary-related parameters and project-related parameters. The matching scores for the salary business domain and the project business domain are 0.88 and 0.79 respectively, both not lower than [the required scores]. And the difference between the two is not less than 0.09 The target business domain set includes two business domains: the payroll business domain and the engineering project business domain. The multi-business domain joint scheduling is directly implemented. The payroll analysis agent and the engineering project analysis agent are responsible for the analysis tasks of payroll partition and schedule partition, respectively, and finally summarized into a multi-module comprehensive analysis report.
[0139] S33. Convert the request status object into a task description object and send it to the corresponding business analysis agent in each business domain of the target business domain set. The task description object includes a task identifier, intent type, report type, filtering parameters, analysis dimension, permission scope identifier, and request status version number. The task description object only retains the fields required for executing queries and building reports, and does not contain authentication information to reduce the scope of sensitive information flow. When multiple business domains are jointly scheduled, a task description object is generated for each business domain in the target business domain set. Each task description object shares the same task identifier, the same time range, the same permission scope identifier, and the same request status version number. Only the part of the filtering parameters that is related to the parameter specification of this business domain is written into the corresponding task description object. This ensures that each business analysis agent works in parallel within a unified statistical range and permission boundary, and the execution record of any agent can be associated with the same report generation task through the task identifier.
[0140] S4. Select a structured query template based on the business analysis agent, verify the filtering parameters and write them into the structured query template, add data range predicates according to the permission context, form a deterministic query plan and execute it to obtain structured query results.
[0141] In some embodiments, step S4 includes steps S41 to S45.
[0142] S41. The business analysis agent selects a preset and versioned structured query template from the associated query template library. The structured query template includes at least a query template identifier, query template version, data source identifier, parameter placeholders, field whitelist, table association rules, aggregation rules, sorting rules, pagination rules, maximum number of rows returned, and permission predicate insertion position. The template is validated before being published. The field whitelist restricts the template to accessing only fields related to the business domain report. The maximum number of rows returned is used to prevent a single query from overloading the data source.
[0143] S42. Perform type validation, format standardization, and value range validation on the filtering parameters to obtain the filtering parameters that pass the validation. Type validation checks whether the parameter value conforms to the data type declared in the rule. Format standardization unifies the date, amount, and code into the format required by the template. Value range validation checks whether the value falls within the value range declared in the rule. If any validation fails, a parameter validation error is returned and the user is prompted to supplement the parameter. Parameter binding is not performed.
[0144] S43. Read the parameter placeholders in the structured query template and write the validated filter parameters into the parameter placeholders of the structured query template in the parameter binding manner. Parameter binding means that the parameter values are not concatenated into the query statement text, but are passed to the database execution engine as independent variables. The engine completes the type conversion and escaping. This mechanism eliminates the risk of injection and ensures that the same template has a completely consistent statement structure under different parameters.
[0145] S44. Generate a row-level data range predicate based on the permission context and insert it into the corresponding position in the structured query template; the row-level data range predicate limits the set of records hit by the query. For example, the set of items accessible to the user in the permission context is... The generated predicate is ,in The project identifier field is inserted into the template's permission predicate insertion position, which intersects with the template's own filtering conditions; column-level control is accomplished by a field whitelist, and fields outside the user's accessible field set are not included in the query output.
[0146] S45. Form and execute a deterministic query plan to obtain structured query results. The deterministic query plan is determined by the query template identifier, query template version, binding parameter set, permission predicate, and data source version. When the above elements are the same, the logical structure of the query plan is consistent with the execution result, so the report is reproducible and verifiable. The query execution module only accepts query plans from the query template library and does not accept arbitrary query statements generated freely by the large language model. The large language model has no entry point in the entire query path. When a task requires multiple indicators, the business analysis agent calls multiple query templates in sequence according to the preset orchestration rules. Each query task is attached with the same time conditions, range conditions, and permission predicates to ensure consistency between different indicators. When multiple business domains are jointly scheduled, each business analysis agent independently executes the deterministic query plan of its own business domain, but all query tasks are attached with the same time conditions, range conditions, and permission predicates to ensure consistency between query results of different business domains, providing a consistent data foundation for cross-business domain dimension alignment in step S5 and multi-module aggregation in step S6. Figure 5 This is a schematic diagram of the deterministic query plan generation and execution process of the present invention.
[0147] S5. Convert the structured query results into a structured fact snapshot.
[0148] Specifically, the system performs field type conversion, null value handling, unit conversion, precision processing, dimension alignment, and indicator definition labeling on each field in the structured query results to generate processed data. Unit conversion is used to standardize the units of measurement within the report, and the conversion relationships are derived from the basic radix of weights and measures.
[0149] ;
[0150] in, The original values are in ten thousand yuan. The values are converted and are in yuan; for example, if the original total salary was 1,254,000 yuan, then... Yuan; precision processing uses rounding to retain the nearest yuan. Decimal places:
[0151] ;
[0152] in, This is a floor function, derived from the floor operation in mathematics; For symbolic functions, Take 1 when it is a positive number. When the value is negative, take -1. When the value is zero, take 0; for The absolute value; the reason for introducing the absolute value and sign function is that the essence of rounding is to determine the rounding direction based on the distance from the nearest retained digit. If the absolute value is not taken, when When the value is negative, adding 0.5 and rounding down is equivalent to rounding towards positive infinity. For example... , Sometimes, the result might be -8654.32 instead of -8654.33. To make the rounding rules for positive and negative values symmetrical and consistent, the absolute value should be taken first to complete the rounding and then the sign should be restored. To retain decimal places, monetary indicators are set to 2; for example, average salary per person. Yuan, It is a positive number. ,but Rounding down gives 865432, dividing by 100 gives... The precision processing also determines the upper bound of the numerical tolerance in step S7, and the two must be matched; null value processing is carried out by either removing the record or filling it according to the rules, depending on the indicator caliber; dimension alignment connects multiple query results by common dimensions such as project identifier and region identifier; when multiple business domains are jointly scheduled, dimension alignment connects query results across different business domains, for example, the salary query results of the salary business domain and the progress query results of the engineering project business domain are connected by the project identifier, so that the fact items of the same project in different business domains are converged under the same dimension coordinate; the indicator caliber label specifies the statistical caliber for each indicator, for example, the pass rate is equal to the ratio of the number of passed to the number of valid submissions. The above indicators are all calculated deterministically and are not inferred by the language model.
[0153] The processed data is organized into structured fact snapshots containing fact identifiers, indicator values, dimension values, data time ranges, query template identifiers, query template versions, parameter sets, permission range identifiers, and data versions. Each structured fact snapshot contains several fact items. Fact identifiers are unique within the snapshot; for example, total wages correspond to fact identifier F001, number of personnel to fact identifier F002, and average salary per person to fact identifier F003. Subsequent indicator cards, charts, tables, details, and natural language summaries all derive data from the fact snapshots. Any reporting component can trace back to the corresponding query through the fact identifier. Template version and parameter set; each fact item also records the business domain identifier to which it belongs. When multiple business domains are jointly scheduled, fact items from different business analysis agents carry their respective business domain identifiers and are merged into the same structured fact snapshot for step S6 to retrieve data by business domain partition and step S7 to verify by business domain affiliation; in some embodiments, the snapshot hash value is calculated after the structured fact snapshot is normalized and serialized. The hash algorithm adopts a secure hash algorithm in cryptography. The snapshot hash value is used to identify whether the fact data has changed when the report is reviewed. If the data source has not changed, the recalculated hash value is consistent with the original value.
[0154] S6. Select a fixed report template based on the report type and target business domain, and map the structured fact snapshot to a structured report payload.
[0155] Specifically, the fixed report template is indexed by a combination of target business domain and report type, and the fixed report template limits the report structure with a machine-readable data model. The structured report payload includes report metadata, indicator cards, key conclusions, chapters, charts, tables, details, overall summary placeholder area, data quality information, and tracking information. Among them, chart data, table data, and indicator card data are derived from structured fact snapshots. That is, the values of indicator cards are taken from the indicator values of the corresponding fact items, the sequences of charts are taken from the set of fact items after dimension alignment, and the rows of tables are taken from detail-type fact items. None of the three are processed by any intermediate natural language. The overall summary placeholder area is kept empty in this step, waiting for the natural language content that has passed the verification in step S7 to be written, ensuring from the data flow perspective that the summary can only be generated after the fact data. When the report type, fixed report template version, and structured fact snapshot are the same, the indicator values, chart data, table data, and chapter structure of the report body remain consistent.
[0156] When multiple business domains are jointly scheduled, a multi-module summary report template is selected. The multi-module summary report template limits the structured report payload to several report partitions according to the business domain. Each report partition generates its own indicator cards, chapters, charts, tables and details according to the fixed report template of its business domain. Each report partition only reads fact items carrying the identifier of its own business domain, and the data between partitions are not mixed. The arrangement order of the report partitions is consistent with the order of the business domains in the target business domain set. The multi-module summary report template also limits the overall summary placeholder area to a cross-module comprehensive summary area, which is used to contain comprehensive natural language content covering all report partitions. Each report partition has a separate partition summary placeholder area, which is used to contain natural language content specific to its own partition. Both types of placeholder areas are kept empty in this step. In this way, a single request can automatically execute up to 3 business analysis modules and summarize them into a single multi-module comprehensive analysis report. Users do not need to make multiple separate requests to obtain a unified view across businesses, and the data in each partition is still strictly isolated and can be independently reviewed.
[0157] S7. De-identify the structured fact snapshot to form a model input snapshot, send it to the large language model to generate natural language content and perform fact consistency verification.
[0158] In some embodiments, step S7 includes steps S71 to S74.
[0159] S71. Based on the permission context, perform field trimming and anonymization on the structured fact snapshot to form a model input snapshot; field trimming deletes original detailed fields that are irrelevant to the summary task, while retaining fact identifiers, indicator names, indicator values, units, statistical calibers, dimension values, and data time ranges in the model input snapshot; anonymization methods include retaining partial characters, uniform placeholder replacement, irreversible hash replacement, field deletion, and precise value range. For example, for mobile phone numbers, the first 3 digits and the last 2 digits are retained, and the middle digits are replaced with placeholders. The selection of the number of digits to retain is based on the ability to distinguish different records to maintain the readability of the summary, while also ensuring that the complete number cannot be reconstructed from it; financial accounts, authentication passwords, access tokens, and keys are not included in the model input snapshot, regardless of the user's permission level.
[0160] S72. Send the model input snapshot to the large language model. The large language model generates a natural language summary, key points, risk statements, or management suggestions based on the indicator values, dimension values, and data time range in the structured fact snapshot. The large language model is deployed on a local device or in a controlled cloud environment. Its running account does not hold any access credentials to the business database, and the database service cannot be reached at the network level. Therefore, it can only write based on the model input snapshot. The content sent to the large language model consists of task instructions, serialized fact item text, and output constraints. The output constraints require that the statements be based only on the given fact items and that no values or dates other than the fact items be introduced. The input to the large language model is set as the fielded text of the fact items. The output is set to plain text paragraphs, and the correspondence between the two is established through fact identifiers. The model only undertakes the function of the expression layer. The original indicators, trend sequences and detailed data in the main body of the report are not generated or modified by it. When multiple business domains are jointly scheduled, the fact items carrying the same business domain identifier are first sent to the big language model to generate the partition summary according to the report partition. Then, the partition summaries along with the key fact items of each partition are sent to the big language model to generate the cross-module comprehensive summary. The task instruction of the comprehensive summary additionally requires to explain the relationship between the facts of each business domain, such as the correspondence between salary expenditure and construction progress in the same project. However, each value referenced in the comprehensive summary must still be able to find the corresponding fact item in the structured fact snapshot.
[0161] S73. Extract the numerical representation, time range representation, and object range representation from the output of the large language model, and match them with the corresponding fact items in the structured fact snapshot; compare the numerical representation with the index value of the fact item after unit normalization. Let the extracted numerical value in the model output be... The corresponding indicator value for the fact item is If the unit is yuan, then the consistency criterion is:
[0162] ;
[0163] in, This represents the numerical tolerance, expressed in yuan; the tolerance value is derived from the precision processing in step S5: rounding is performed. The maximum rounding error introduced by a decimal place is half of the minimum retention unit, that is... Amount-related indicators Therefore For rounding, a larger tolerance means allowing visible deviations between the model output and the facts; a smaller tolerance would misjudge legitimate identical values as inconsistent. Therefore, the upper bound of the rounding error is chosen. The time range expression is converted using the same standardization rules as in step S14 and compared with the data time range of the fact snapshot. The object range expression is matched with the dimension value after matching with the master data dictionary. During multi-business domain joint scheduling, the numerical expression in the partition summary is only compared with the fact items of its respective business domain. The numerical expression in the cross-module comprehensive summary is compared with the fact items of all business domains. For expressions involving cross-business domain comparison relationships in the comprehensive summary, each compared value must find a corresponding fact item. If any value cannot find a basis, the sentence is deemed unacceptable.
[0164] S74. When the numerical description, time range description, and object range description can all be found in the structured fact snapshot and the values are consistent, the fact consistency check is passed; for example, the summary sentence states that the average salary of Project A last month was 8654.32 yuan, and the numerical value is extracted... Yuan, the indicator value of fact identifier F003 Yuan, The time range, after conversion from last month, matches the snapshot data time range; Item A matches the dimension value; therefore, the assessment is passed. If the summary sentence states that the average salary is approximately 8700 yuan, then… If the value is greater than 0.005 yuan, the test result is deemed unsuccessful. The conflicting sentence is deleted, and a regeneration is triggered. If the regeneration still fails, the corresponding content is marked as unverified content. Unverified content is not included in the official report.
[0165] S8. Write the natural language content that has passed the fact consistency check into the structured report payload to generate the target analysis report.
[0166] Specifically, the natural language content that passes fact consistency verification is written into the overall summary placeholder area of the structured report payload, and the target analysis report is generated by the structured report payload. During multi-service domain joint scheduling, the partition summary that passes fact consistency verification is written into the partition summary placeholder area of the corresponding report partition, and the cross-module comprehensive summary that passes fact consistency verification is written into the overall summary placeholder area; the two do not substitute for each other. Front-end rendering, report preview, streaming progress output, session saving, document export, spreadsheet export, and controlled sharing are all based on the same structured report payload and are all subject to permission context constraints. For example, export requests are rejected when the user does not have export permissions, and the field range in the exported file does not exceed the set of fields accessible to the user. Controlled sharing is verified through sharing credentials. Currently, the sharing credential records the report identifier, access subject scope, validity period, maximum number of accesses, and revocation status. Access is denied when the validity period or access limit is reached, or when the credential is revoked. The validity period is set to 7 days by default, which is based on the usual confidentiality period for business analysis reports in the enterprise's data security management requirements. Each report generation task also records the request status version, business routing result, agent version, query template identifier and version, binding parameters, permission scope identifier, report template identifier and version, snapshot hash value, summary generation record, export record, and sharing record to support report review and auditing. During review, a deterministic query plan is reconstructed based on the saved elements. If the snapshot hash value obtained is consistent with the original value when the data source has not changed, it can be confirmed that the report is reproducible.
[0167] In the multi-service report generation method based on intent routing and deterministic query provided in this application embodiment, parameter integrity detection and missing condition clarification are completed before query execution. Then, matching scores are calculated according to business data domains and corresponding business analysis agents are scheduled. Multiple business domains with matching scores reaching the threshold can be jointly scheduled in a single request, automatically executing up to three business analysis modules and summarizing them into a multi-module comprehensive analysis report. The business analysis agent forms a deterministic query plan based on a preset and versioned query template, parameter binding, and permission predicate. The query results are uniformly imported into a structured fact snapshot. The report body and model summary share the same fact source. The large language model does not access the database, and its output must pass fact consistency verification before being written into the report. In this way, the convenience of natural language interaction is preserved, while the query process is deterministic, the report data is consistent, and sensitive information is controlled throughout the process. This solves the problems of incomplete request conditions, inaccurate cross-business domain routing, non-reproducible queries, fabricated model data, and lack of full-process governance of sensitive data in the prior art.
[0168] Specifically, please refer to Figure 6 , Figure 6 This is a schematic block diagram of a multi-service report generation system based on intent routing and deterministic query provided in an embodiment of this application.
[0169] like Figure 6 As shown, the multi-service report generation system based on intent routing and deterministic query includes a request parsing unit, a parameter verification unit, a route scheduling unit, a query execution unit, a snapshot generation unit, a report construction unit, a summary generation unit, and an output processing unit.
[0170] The request parsing unit is used to receive natural language analysis requests and corresponding session information and permission context, perform semantic parsing on the natural language analysis requests, and generate a request state object that includes intent type, candidate business domain, report type filtering parameters, and analysis dimensions.
[0171] The parameter verification unit is used to read the parameter integrity rules, determine the missing parameter set of the request status object, generate a clarification prompt when the missing parameter set is not empty, and receive supplementary information from the user to update the request status object until the missing parameter set is empty or the preset termination condition is met.
[0172] The routing and scheduling unit is used to determine the target business domain, convert the request status object into a task description object, and schedule the corresponding business analysis agent.
[0173] The query execution unit is used to select a structured query template based on the business analysis intelligence agent, verify the filtering parameters and write them into the structured query template, add data range predicates according to the permission context, form a deterministic query plan and execute it to obtain structured query results.
[0174] The snapshot generation unit is used to convert structured query results into structured fact snapshots;
[0175] The report building unit is used to select a fixed report template based on the report type and target business domain, and to map structured fact snapshots into structured report payloads;
[0176] The summary generation unit is used to desensitize the structured fact snapshot to form a model input snapshot, which is then sent to the large language model to generate natural language content and perform fact consistency verification.
[0177] The output processing unit is used to write the natural language content that has passed the fact consistency check into the structured report payload to generate the target analysis report.
[0178] This application also provides an electronic device, which includes a processor, a memory, and a network interface connected via a bus. The memory may include a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program includes program instructions. When the program instructions are executed by the processor, the processor executes the multi-service report generation method based on intent routing and deterministic query as described in any of the above embodiments. The processor may be a central processing unit, or other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays, or other programmable logic devices. The structure of the above electronic device is only illustrative. Actual electronic devices may include more or fewer components, or combine certain components, or have different component arrangements.
[0179] This application also provides a computer-readable storage medium storing a computer program thereon. The computer program includes program instructions, which, when executed by a processor, cause the processor to execute the multi-service report generation method based on intent routing and deterministic query as described in any of the above embodiments. The storage medium can be any medium capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory, a magnetic disk, or an optical disk.
[0180] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by computer program instructions to related hardware; the layers and modules in the above embodiments are only logical functional divisions, and there may be other division methods in actual implementation; multiple layers or modules may be combined or integrated into another system; some features may be ignored or not executed; the order of method steps may be adjusted, merged or deleted without causing data dependency contradictions.
[0181] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application; therefore, the scope of protection of this application should be determined by the scope of protection of the claims.
Claims
1. A method for generating multi-service reports based on intent routing and deterministic querying, characterized in that, Includes the following steps: Receive natural language analysis requests along with corresponding session information and permission context, perform semantic parsing on the natural language analysis requests, and generate a request state object including intent type, candidate business domain, report type, filtering parameters, and analysis dimensions; Read the parameter integrity rules, determine the missing parameter set of the request status object, generate a clarification prompt when the missing parameter set is not empty, and receive supplementary information from the user to update the request status object until the missing parameter set is empty or the preset termination condition is met. Identify the target business domain, convert the request status object into a task description object, and schedule the corresponding business analysis agent; The business analysis agent selects a structured query template, verifies the filtering parameters and writes them into the structured query template, adds data range predicates according to the permission context, forms a deterministic query plan and executes it to obtain structured query results. Convert the structured query results into a structured fact snapshot; Select a fixed report template based on the report type and target business domain, and map the structured fact snapshot to a structured report payload; The structured fact snapshot is anonymized to form the model input snapshot, which is then sent to the large language model to generate natural language content and perform fact consistency verification. The natural language content that has passed the fact consistency check is written into the structured report payload to generate the target analysis report.
2. The multi-service report generation method based on intent routing and deterministic query according to claim 1, characterized in that, It receives natural language analysis requests along with corresponding session information and permission context, performs semantic parsing on the natural language analysis requests, and generates a request state object including intent type, candidate business domain, report type, filtering parameters, and analysis dimensions, including: Receive natural language analysis requests from users through web chat portals, business workbench, or other interactive terminals; Obtain the user's authentication information, session information, and permission context; Perform intent recognition on natural language analysis requests to determine intent type and candidate business domain; Entity extraction is performed on natural language analysis requests to determine report type, screening parameters, and analysis dimensions; Combine intent type, candidate business domain, report type, filtering parameters, analysis dimensions, session information, and permission context to generate a request state object.
3. The multi-service report generation method based on intent routing and deterministic query according to claim 1, characterized in that, Read parameter integrity rules to determine the set of missing parameters for the request status object. If the set of missing parameters is not empty, generate a clarification prompt and receive supplementary information from the user to update the request status object, until the set of missing parameters is empty or a preset termination condition is met, including: Based on the candidate business domain and intent type, the corresponding parameter integrity rules are read from the preset rule base. The parameter integrity rules include at least the set of required parameters, the set of optional parameters, the parameter data type, the parameter value range, the parameter dependency relationship, the default value usage conditions, and the permission verification conditions. The set of missing parameters is determined by taking the difference between the valid parameters verified in the request status object and the set of required parameters. Determine if the set of missing parameters is empty. If the set of missing parameters is not empty, pause the data query process and generate a clarification prompt based on the type, dependency and priority of the missing parameters. Receive supplementary information from the user and update the request status object; Perform missing parameter checks again on the updated request status object until the set of missing parameters is empty or the preset termination condition is met.
4. The multi-service report generation method based on intent routing and deterministic query according to claim 1, characterized in that, Identify the target business domain, convert the request status object into a task description object, and schedule the corresponding business analysis agent, including: Obtain the business intelligence agent registration information, which includes the business domain identifier, supported intent types, and required permission identifiers; Based on intent type, filtering parameters, session information, permission context, and business agent registration information, calculate the matching score for each candidate business domain, and select the candidate business domain with the highest matching score as the target business domain. The request status object is converted into a task description object and sent to the business analysis agent corresponding to the target business domain.
5. The multi-service report generation method based on intent routing and deterministic query according to claim 1, characterized in that, The business analytics agent selects a structured query template, validates the filtering parameters and writes them into the template, adds data range predicates based on the permission context, forms a deterministic query plan, and executes it to obtain structured query results, including: The business analysis agent selects a pre-defined and versioned structured query template from the associated query template library; Perform type validation, format standardization, and value range validation on the filtering parameters to obtain the filtering parameters that pass the validation; Read the parameter placeholders in the structured query template and write the validated filter parameters into the parameter placeholders of the structured query template using parameter binding. Generate row-level data range predicates based on the permission context and insert them into the corresponding positions in the structured query template; Formulate a deterministic query plan and execute it to obtain structured query results.
6. The multi-service report generation method based on intent routing and deterministic query according to claim 1, characterized in that, Transform structured query results into a structured fact snapshot, including: Perform field type conversion, null value handling, unit conversion, precision handling, dimension alignment, and indicator definition annotation on each field in the structured query results to generate processed data; The processed data is organized into a structured fact snapshot containing fact identifiers, indicator values, dimension values, data time ranges, query template identifiers, query template versions, parameter sets, permission range identifiers, and data versions. The structured fact snapshot contains several fact items.
7. The multi-service report generation method based on intent routing and deterministic query according to claim 1, characterized in that, Select a fixed report template based on the report type and target business domain, and map the structured fact snapshot to a structured report payload, including: Select a fixed report template based on the target business domain and report type; The structured fact snapshot is mapped into a structured report payload that includes report metadata, indicator cards, key conclusions, chapters, charts, tables, details, overall summary placeholders, data quality information, and tracking information; The chart data, table data, and indicator card data are derived from structured fact snapshots.
8. The multi-service report generation method based on intent routing and deterministic query according to claim 6, characterized in that, The structured fact snapshot is anonymized to form the model input snapshot, which is then sent to the large language model to generate natural language content and perform fact consistency verification, including: Based on the permission context, the structured fact snapshot is cropped and anonymized to form a model input snapshot; The model input snapshot is sent to the big language model, which generates a natural language summary, key points, risk statement or management suggestions based on the indicator values, dimension values and data time range in the structured fact snapshot; Numerical representations, time range representations, and object range representations are extracted from the output of the large language model and matched against the corresponding fact items in the structured fact snapshot. When the numerical representation, time range representation, and object range representation can all be found in the structured fact snapshot and the values are consistent, the fact consistency check is passed.
9. The multi-service report generation method based on intent routing and deterministic query according to claim 7, characterized in that, The natural language content that has passed the fact consistency check is written into the structured report payload to generate the target analysis report, including: Write the natural language content that has passed the fact consistency check into the overall summary placeholder area of the structured report payload; Generate a target analysis report based on the structured report payload; Based on the permission context, perform front-end rendering, report preview, streaming progress output, session saving, document export, spreadsheet export, or controlled sharing on the target analysis report.
10. A multi-service report generation system based on intent routing and deterministic query, characterized in that, include: The request parsing unit is used to receive natural language analysis requests and corresponding session information and permission context, perform semantic parsing on the natural language analysis requests, and generate a request status object including intent type, candidate business domain, report type, filtering parameters and analysis dimensions; The parameter verification unit is used to read the parameter integrity rules, determine the missing parameter set of the request status object, generate a clarification prompt when the missing parameter set is not empty, and receive supplementary information from the user to update the request status object until the missing parameter set is empty or the preset termination condition is met. The routing and scheduling unit is used to determine the target business domain, convert the request status object into a task description object, and schedule the corresponding business analysis agent. The query execution unit is used to select a structured query template based on the business analysis intelligence agent, verify the filtering parameters and write them into the structured query template, add data range predicates according to the permission context, form a deterministic query plan and execute it to obtain structured query results. The snapshot generation unit is used to convert structured query results into structured fact snapshots; The report building unit is used to select a fixed report template based on the report type and target business domain, and to map structured fact snapshots into structured report payloads; The summary generation unit is used to desensitize the structured fact snapshot to form a model input snapshot, which is then sent to the large language model to generate natural language content and perform fact consistency verification. The output processing unit is used to write the natural language content that has passed the fact consistency check into the structured report payload to generate the target analysis report.
