A method and system for implementing a service query assistant based on multi-round dialogue
By rewriting and clarifying the question through a multi-turn dialogue assistant, combined with a large language model and business knowledge base, the problems of high interaction threshold and low accuracy in traditional data query methods are solved, and a closed loop of efficient and accurate data analysis and business operation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INSPUR GENERSOFT CO LTD
- Filing Date
- 2026-04-29
- Publication Date
- 2026-07-21
AI Technical Summary
Traditional data analysis and query methods suffer from high interaction barriers, low query efficiency, and poor accuracy. Especially in complex enterprise resource planning (ERP) systems, users need to manually navigate through complicated menus and fill out complex forms. Cross-module query success rates are low, and it is difficult to understand vague or colloquial intentions. Integration with existing systems is also challenging.
A business query assistant based on multi-turn dialogue is adopted. It receives natural language query statements, rewrites and clarifies them with counter-questions, generates standardized query requirements, breaks them down into sub-tasks and plans the execution order, and generates accurate analysis results by combining a large language model and a business knowledge base.
It lowers the interaction threshold, improves query efficiency and accuracy, ensures the completeness of query requirements, automates the processing of complex cross-module business scenarios, provides in-depth analysis reports, and completes the business operation loop.
Smart Images

Figure CN122432192A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of artificial intelligence and natural language processing technology, specifically relating to a business query assistant implementation method and system based on multi-turn dialogue. Background Technology
[0002] In the digital age, data has become a crucial basis for corporate decision-making. With the increasing complexity of business operations, especially the widespread application of business systems such as Enterprise Resource Planning (ERP), the needs of managers and business personnel for data analysis are becoming more diversified, personalized, and frequent.
[0003] Traditional data analysis and query methods mainly fall into the following patterns: First, relying on data analysts or IT experts to understand business needs through communication, then writing code to query and analyze data and generate reports, which are ultimately interpreted by business personnel. This process is costly in terms of communication and has a long decision-making cycle. Second, directly operating the business system, where users need to manually find the corresponding query function in a complex menu system and fill out fixed forms containing numerous fields and complex filtering conditions. For example, a complex combined query in an ERP system can take an average of 8-12 minutes. This form-based interaction mode requires users to accurately remember field names and data structures, resulting in a very high barrier to entry. Third, keyword-based retrieval methods, while simplifying operations to some extent, struggle to understand users' vague expressions and colloquial intentions. For example, the accuracy in recognizing business terms such as urgent orders, abnormal inventory, or slow-moving goods from last week is insufficient, often requiring secondary confirmation from users, leading to low query accuracy and efficiency. In addition, existing business systems are mostly modularly built, and cross-module queries (such as simultaneously linking inventory and financial data) require complex API integration, resulting in a low integration success rate and further increasing the difficulty of data acquisition.
[0004] Therefore, how to lower the interaction threshold of business systems and improve query efficiency and accuracy is an urgent technical problem to be solved. Summary of the Invention
[0005] In a first aspect, embodiments of this application provide a method for implementing a business query assistant based on multi-turn dialogue, comprising the following steps: S1. Receive the natural language query statement input by the user; S2. Based on the dialogue history, the natural language query statement is rewritten and clarified through several rounds of questioning to clarify the user's query intent and generate standardized query requirements; S3. Perform task planning, break down standardized query requirements into at least one sub-query task, determine the execution order of the sub-query tasks, and generate task planning information; S4. Based on the task planning information, retrieve the business knowledge associated with the subquery task from the knowledge base and generate an enhanced query context; S5. Based on the enhanced query context, schedule and execute subquery tasks to obtain raw query data from the business system; S6. Input the raw query data into the large language model to generate and output query analysis results in natural language format.
[0006] Furthermore, the specific steps of step S1 are as follows: S11. Identify the input device; When it is a text input device, it receives natural language text query statements entered by the user through the text input device; When it is a voice input device, it receives voice query statements input by the user through the voice input device, performs voice recognition on the voice query statements, and converts the voice query statements into natural language text query statements; S12. Store the received natural language query statement in the dialogue history cache.
[0007] Furthermore, the specific steps of step S2 are as follows: S21. Input the natural language query statement and dialogue history into the large language model to generate the rewritten query statement; S22. Perform necessary information integrity checks on the rewritten query statement and identify missing key query parameters; S23. When the number of missing key query parameters exceeds a preset threshold, generate and output a natural language rhetorical question for the missing key query parameters, and receive supplementary information from the user regarding the natural language rhetorical question. S24. Use the supplementary information to generate or update standardized query requirements; S25. Determine whether the updated standardized query requirements meet the completeness requirements; If so, proceed to step S3; If not, return to step S21 for the next round of rewriting and clarification.
[0008] Furthermore, the necessary information integrity check in step S22 specifically includes: Preset sets of required parameters for different query scenarios ; Extract the currently identified parameter set from the rewritten query statement. ; Calculate the information completeness score ; If information completeness score If the value is less than the preset integrity threshold T, it is determined that information is missing, and the missing parameter set is recorded. This serves as the basis for generating rhetorical questions.
[0009] Furthermore, the specific steps of step S3 are as follows: S31. Perform task decomposition, input standardized query requirements into the large language model, and decompose the standardized query requirements into several atomic-level sub-query tasks through intent recognition; S32. Execution step planning: Based on the data dependencies and business logic between subquery tasks, determine the execution order of each subquery task and generate an initial execution plan; S33. Execution plan adjustment: Based on historical execution records or preset business rules, dynamically adjust the initial execution plan to optimize the execution order or merge subquery tasks of the same type; S34. Execute scheduling: According to the adjusted execution plan, schedule the corresponding query interfaces or functions in sequence.
[0010] Furthermore, the specific steps of step S4 are as follows: S41. Perform synonym recall, and match the corresponding standard business terms in the thesaurus based on the keywords in the subquery task; S42. Perform dictionary recall, and search for the unique identifier code corresponding to each standard business term in the basic digital dictionary in the business system; S43. Perform query scenario recall, and determine the current business scenario based on the standardized query requirements or dialogue history to limit the scope of subsequent data queries; S44. Perform business knowledge retrieval, and retrieve relevant business logic, calculation rules or indicator definitions from the business knowledge base according to user intent to guide data query and analysis; S45. Perform sample recall: Based on the user's intent, retrieve the most similar query statement or function call example from the query function and code sample library as a few-sample hint for the large language model.
[0011] Furthermore, the specific steps of step S5 are as follows: S51. Use standard business terms and their unique identifier codes in the enhanced query context as filtering conditions for data queries; S52. Based on the results of the query scenario retrieval, locate the specific functional module or data table in the business system; S53. Based on the results of business knowledge retrieval, determine the metrics to be queried and their calculation logic; S54. Combining the filtering conditions, the positioned functional modules, and the calculation logic, generate a structured query statement or calling instruction that can be executed in the business system; S55. Before initiating a query, obtain the current user's permission information and verify whether the structured query statement or call command is within the scope permitted by the function permissions and data permissions; If the validation passes, the query will be executed to retrieve the original query data; If the verification fails, an "Access Denied" message will be generated.
[0012] Furthermore, step S6 is detailed as follows: S61. Combine the original query data and standardized query requirements to construct suggestion keywords; S62. Input the prompt words into the large language model to generate natural language text containing data summaries, trend analysis, or anomaly alerts; S63. Based on the user's preferences expressed in the preceding dialogue, the presentation format of the query analysis results is customized and then output.
[0013] Furthermore, it also includes the following steps: S7. After outputting the query analysis results, receive natural language operation instructions issued by the user based on the query analysis results; S8. Parse and plan the natural language operation instructions, call the corresponding business processes or services in the business system, and complete the business operation.
[0014] Secondly, embodiments of this application also provide a business query assistant implementation system based on multi-turn dialogue, including: The natural language input module is used to receive natural language query statements input by the user; The multi-turn dialogue management module is used to rewrite and clarify natural language query statements in several rounds based on the dialogue history, so as to clarify the user's query intent and generate standardized query requirements. The task planning module is used to perform task planning, break down standardized query requirements into at least one sub-query task, determine the execution order of the sub-query tasks, and generate task planning information. The knowledge retrieval module is used to retrieve business knowledge related to the subquery task from the knowledge base based on task planning information, and generate an enhanced query context. The data query execution module is used to schedule and execute subquery tasks based on an enhanced query context to obtain raw query data from the business system. The results generation module is used to input raw query data into the large language model and generate and output query analysis results in natural language format.
[0015] As can be seen from the above technical solutions, this application has the following advantages: The business query assistant implementation method and system provided in this application, based on multi-turn dialogue, achieves proactive identification and accurate completion of users' ambiguous or missing intentions through a multi-turn question clarification mechanism driven by a preset parameter set and information completeness scoring algorithm, ensuring the completeness of query requirements; through atomic-level task decomposition and dependency planning driven by a large language model, it achieves automated logical orchestration and optimal execution order generation for complex cross-module business requirements; through five-layer knowledge retrieval of synonyms, standard codes, business rules, and code examples, it achieves seamless mapping between natural language and enterprise internal standard business terms and logic, eliminating semantic barriers; and through the result generation combining raw data with the analytical capabilities of a large model, it achieves output that includes trend analysis, anomaly alerts, and customized reports, and realizes a closed loop of direct business operations based on the results. Attached Figure Description
[0016] To more clearly illustrate the technical solution of this application, the accompanying drawings used in the description will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating the implementation method of the business query assistant based on multi-turn dialogue of the present invention.
[0018] Figure 2 This is a schematic diagram of the business query assistant system based on multi-turn dialogue of the present invention. Detailed Implementation
[0019] The various embodiments of this disclosure will be described more fully in the following detailed description of the specific steps of the implementation method of the business query assistant based on multi-turn dialogue. This disclosure may have various embodiments, and adjustments and changes may be made therein. However, it should be understood that there is no intention to limit the various embodiments of this disclosure to the specific embodiments disclosed herein, but rather this disclosure should be understood to cover all adjustments, equivalents, and / or alternatives falling within the spirit and scope of the various embodiments of this disclosure.
[0020] For example, in digital transformation, data has become the core of enterprise decision-making. However, facing increasingly complex business systems such as ERP, traditional data query methods can hardly meet the diverse and high-frequency needs of business personnel: First, they rely on manual development, requiring a lengthy process of business requests, IT coding, and report generation, resulting in high communication costs and slow decision response. Second, form operations are cumbersome, requiring users to search through complex menus and accurately memorize fields to fill out fixed forms; a single complex query often takes more than ten minutes, making it extremely difficult to access. Third, keyword retrieval is limited, making it difficult to understand vague or colloquial expressions such as urgent orders and slow-moving goods, resulting in low recognition accuracy and frequent need for repeated confirmation. Fourth, cross-module integration is difficult; the modularity of the system leads to complex integration for cross-domain data queries (such as inventory linked to finance), resulting in a low success rate.
[0021] In summary, there is an urgent need for an intelligent solution that can lower the interaction threshold and significantly improve query efficiency and accuracy.
[0022] To address the aforementioned issues, this embodiment provides a business query assistant implementation method based on multi-turn dialogue. It utilizes multi-turn back-questions to complete missing parameters, intelligently decomposes and plans sub-tasks, and combines business knowledge to generate accurate analysis results.
[0023] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] Please see Figure 1 The diagram shows a flowchart of a business query assistant implementation method based on multi-turn dialogue in a specific embodiment. The method includes the following steps: S1. Receive the natural language query statement input by the user; It should be noted that this step breaks through the limitations of traditional form input, allowing users to express their needs in the most natural way, reducing the cognitive load and operational costs for users; S2. Based on the dialogue history, the natural language query statement is rewritten and clarified through several rounds of questioning to clarify the user's query intent and generate standardized query requirements; It should be noted that this step resolves referential issues and completes intent by combining historical context, and guides users to supplement key parameters by actively asking questions, ensuring that the system accurately understands the user's true intent, transforming unstructured natural language into standardized requirements that the system can process, improving the query success rate, and solving the inherent ambiguity and incomplete information problems of natural language. S3. Perform task planning, break down standardized query requirements into at least one sub-query task, determine the execution order of the sub-query tasks, and generate task planning information; It should be noted that by breaking down macro-level requirements into micro-level atomic tasks and intelligently orchestrating execution logic, the system is able to handle complex business scenarios involving multi-table joins and multi-step calculations, improving the logical rigor and efficiency of task execution and solving the problem that complex query requirements cannot be directly mapped to a single interface. S4. Based on the task planning information, retrieve the business knowledge associated with the subquery task from the knowledge base and generate an enhanced query context; It should be noted that by introducing external knowledge such as thesaurus, basic dictionary, and business rule base, accurate term mapping, encoding information and calculation logic are provided to the model, ensuring that the generated query instructions conform to the actual business specifications of enterprises, improving the professionalism and accuracy of queries, and overcoming the deficiency of large language models lacking specific enterprise domain knowledge; S5. Based on the enhanced query context, schedule and execute subquery tasks to obtain raw query data from the business system; It should be noted that by using the enhanced context to accurately construct executable structured query statements and directly extracting real data from the business system, the real-time, accuracy and authority of the data source are guaranteed. At the same time, permission verification is implicitly included in the process to ensure data security and realize the transformation from understanding to action. S6. Input the raw query data into the large language model to generate and output query analysis results in natural language format; It should be noted that by utilizing the inductive and reasoning capabilities of large language models, data can be transformed into natural language reports containing insights, trend judgments, and recommendations, and these reports can be personalized to directly assist users in making business decisions.
[0025] This embodiment accurately identifies user intent through a multi-round questioning and clarification mechanism, uses a large model to dynamically decompose and plan complex tasks, and combines five layers of knowledge retrieval to eliminate semantic barriers, achieving a fully automated closed loop from fuzzy natural language input to accurate data acquisition and deep intelligent analysis report generation.
[0026] Furthermore, as a refinement and extension of the specific implementation methods of the above embodiments, in order to fully illustrate the specific implementation process of this embodiment, another method for implementing a business query assistant based on multi-turn dialogue is provided, which includes the following steps: S1. Receive the natural language query statement input by the user; The specific steps of step S1 are as follows: S11. Identify the input device; When it is a text input device, it receives natural language text query statements entered by the user through the text input device; When it is a voice input device, it receives voice query statements input by the user through the voice input device, performs voice recognition on the voice query statements, and converts the voice query statements into natural language text query statements; S12. Store the received natural language query statement in the dialogue history cache; S2. Based on the dialogue history, the natural language query statement is rewritten and clarified through several rounds of questioning to clarify the user's query intent and generate standardized query requirements; The specific steps of step S2 are as follows: S21. Input the natural language query statement and dialogue history into the large language model to generate the rewritten query statement; S22. Perform necessary information integrity checks on the rewritten query statement and identify missing key query parameters; The necessary information integrity check in step S22 specifically includes: Preset sets of required parameters for different query scenarios ; Extract the currently identified parameter set from the rewritten query statement. ; Calculate the information completeness score ; If information completeness score If the value is less than the preset integrity threshold T (e.g., T=0.8), it is determined to be missing information, and the missing parameter set is recorded. As a basis for generating rhetorical questions; The preset integrity threshold T mentioned in step S22 is a dynamic threshold, determined in the following way: Retrieve the current user's conversation history and count the average number of times the user proactively adds information in the historical conversations. ; Analyze current standardized query requirements and determine the complexity coefficient of the query scenario. ; According to the average number and the complexity coefficient Dynamically calculate the integrity threshold T; The integrity threshold T is calculated using the following formula:
[0027] in, Basic threshold; The normalization factor is the historical maximum number of active replenishments; α, β, and γ are preset weighting coefficients that satisfy α+β+γ=1. The complexity coefficient The calculation is based on the number of fields and table joins involved in the standardized query requirements; S23. When the number of missing key query parameters exceeds a preset threshold, generate and output a natural language rhetorical question for the missing key query parameters, and receive supplementary information from the user regarding the natural language rhetorical question. S24. Use the supplementary information to generate or update standardized query requirements; S25. Determine whether the updated standardized query requirements meet the completeness requirements; If so, proceed to step S3; If not, return to step S21 for the next round of rewriting and clarification. For example, this embodiment uses the example of a business person querying the inventory data of Company B to illustrate the specific implementation process of the dynamic threshold adaptive algorithm; Scene setting: User A: A financial analyst who habitually provides detailed information in past conversations, proactively adding information an average of 8 out of every 10 queries. =0.8; User B: Warehouse administrator, habitually uses brief language in past conversations, and proactively adds information twice out of every 10 queries. =0.2; Both individuals checked "Company B's inventory status"; Perform the natural language input for step S1 (same for both users). User input: "Company B's inventory status"; Perform multiple rounds of rewriting and clarification through questioning. Perform basic processing (same for both): The system rewrites the query as: "Query Company B's inventory"; a set of required parameters is preset. Currently identified parameters Basic completeness ; Perform dynamic threshold calculation (different for each person): System parameter settings:
[0028] (Normalized value of the highest number of active replenishments in history) (Inventory queries involve multiple fields such as material type and warehouse location, and are of medium complexity.) α=0.5, β=0.3, γ=0.2 User A (detailed expression):
[0029] User B (brief expression):
[0030] Perform integrity checks: The current completeness score is S=0.33; For user A: The system determines that information is missing, triggering a follow-up question. For User B: Similarly, if information is missing, a counter-question is triggered; Execution of questions and supplements The system generates a follow-up question: "What type of inventory do you wish to query? (e.g., finished goods, raw materials, semi-finished goods)?" User A added: "Finished goods inventory"; User B added: "Finished goods inventory"; Perform a second round of integrity checks After the update Completeness rating ; User A: If the requirements are met, proceed to step S3; User B: If the requirements are met, proceed to step S3; Technical effect comparison: If a fixed threshold T=0.8 is used, both individuals need to ask a third round, "Which point in time do you want to query the inventory for?" to satisfy the requirement. After adopting dynamic thresholds, User A, who provided detailed information, met the requirements in the second round (due to the lower threshold), reducing unnecessary interaction rounds; User B, who provided brief information, still needed two rounds, but the threshold was relatively high, ensuring the completeness of the query. S3. Perform task planning, break down standardized query requirements into at least one sub-query task, determine the execution order of the sub-query tasks, and generate task planning information; The specific steps of step S3 are as follows: S31. Perform task decomposition, input standardized query requirements into the large language model, and decompose the standardized query requirements into several atomic-level sub-query tasks through intent recognition; S32. Execution step planning: Based on the data dependencies and business logic between subquery tasks, determine the execution order of each subquery task and generate an initial execution plan; S33. Execution plan adjustment: Based on historical execution records or preset business rules, dynamically adjust the initial execution plan to optimize the execution order or merge subquery tasks of the same type; Step S33 involves planning and adjusting based on a reinforcement learning model, specifically including: Construct the state space, action space, and reward function for reinforcement learning; Obtain the execution status of the current task plan and input it into the reinforcement learning model; Based on the output of the reinforcement learning model, determine the planning adjustment strategy; The state space Including subtask types Dependency graph encoding between subtasks Average execution time of similar historical tasks Current system available resources ; The action space This includes adjusting the execution order of subtasks, merging subtasks of the same type, splitting larger and smaller tasks, and executing dependent subtasks in parallel. The reward function R is defined as follows:
[0031] in, The estimated time for the initial execution plan, The actual execution time after adjustment. To determine whether any errors occurred during execution, Preset penalty coefficient; The reinforcement learning model employs the Q-learning algorithm, and its Q-value update formula is as follows:
[0032] in, For learning rate, As a discount factor, To perform the action The new state afterwards; S34. Execute scheduling, and schedule the corresponding query interfaces or functions in sequence according to the adjusted execution plan; This example uses a business person querying Company C's "Inventory and Financial Linkage Analysis" to illustrate how a reinforcement learning engine can optimize the task execution order through historical learning. Scene setting: The system has been running for three months and has accumulated a large number of task execution records. The reinforcement learning model has been trained and the Q-table has initially converged. Execution of task planning: Task breakdown: Standardized query requirement: "Analyze the correlation between inventory turnover and accounts receivable turnover of Company C in the first quarter of 2025"; The large language model breaks it down into four sub-tasks: Subtask A: Obtain inventory data for Company C (Inventory Module) Subtask B: Obtain financial data from Company C (finance module) Subtask C: Calculate inventory turnover rate Subtask D: Calculate accounts receivable turnover ratio Subtask E: Correlation analysis and report generation Execute the initial execution plan: Based on data dependencies, subtask C depends on A, subtask D depends on B, and subtask E depends on both C and D; there are two possible initial execution plans: Plan 1: A→B→C→D→E (execute sequentially) Plan 2: A and B execute in parallel → C and D execute in parallel → E Implement reinforcement learning-based planning adjustments: The system extracts the current state. : Task types include [data query, data query, calculation, calculation, analysis]. The dependency graph is encoded as [A→C, B→D, C→E, D→E]. Historically, the average execution time for similar tasks was 3 seconds for inventory queries, 5 seconds for financial queries, 1 second for calculation tasks, and 2 seconds for analysis tasks. Current system resources: Database connection pool idle connections: 8; Computing unit load: 30%. The system queries the Q-table; for state S, the Q-value for each action is: Action 1 (parallel execution of A and B): Q=8.5 Action 2 (execute sequentially A→B): Q=6.2 Action 3 (execute B first, then A): Q=5.8 Action 4 (Merge A and B into a batch query): Q=7.3 The system selects action 1 with the largest Q value (executes A and B in parallel) and generates an adjusted execution plan; Implementation and Feedback: Execution process: Execute A and B in parallel, taking the maximum time of 5 seconds (financial query time). Executing C and D in parallel takes 1 second. Execution of E takes 2 seconds Total time =8 seconds Estimated time for initial plan 1 (sequential execution) Second Calculate the reward:
[0033] Perform Q-value update: The system records the new status. (Changes in resource status after execution), and update the Q value:
[0034] Assumption ,but:
[0035] Technical effects: As similar tasks are executed repeatedly, the Q-value of parallel execution in the Q-table will continue to be optimized. When faced with similar states, the system will increasingly tend to choose the optimal execution strategy, thereby continuously improving the efficiency of task execution. S4. Based on the task planning information, retrieve the business knowledge associated with the subquery task from the knowledge base and generate an enhanced query context; The specific steps of step S4 are as follows: S41. Perform synonym recall, and match the corresponding standard business terms in the thesaurus based on the keywords in the subquery task; S42. Perform dictionary recall, and search for the unique identifier code corresponding to each standard business term in the basic digital dictionary in the business system; S43. Perform query scenario recall, and determine the current business scenario based on the standardized query requirements or dialogue history to limit the scope of subsequent data queries; S44. Perform business knowledge retrieval, and retrieve relevant business logic, calculation rules or indicator definitions from the business knowledge base according to user intent to guide data query and analysis; After retrieving the business knowledge associated with the subquery task from the knowledge base, the process also includes: Perform conflict detection on related business knowledge retrieved from multiple knowledge sources; When a conflict is detected, the business knowledge to be used is selected through a weighted voting mechanism based on the pre-set reliability weights of each knowledge source. The selection of the final adopted business knowledge through a weighted voting mechanism specifically includes: For the same business term T, if k knowledge sources provide different mapping results... Each mapping result corresponds to the support of one or more knowledge sources; The final selected mapping result for:
[0036] in, To support the mapping results The collection of knowledge sources, Pre-set reliability weights for knowledge source s; The knowledge sources include at least two or more of the following: a thesaurus, a basic digital dictionary, a business knowledge base, a query scenario tag library, and a query sample library; The generation of the enhanced query context specifically includes: The final selected business knowledge is structurally fused with the recall rule text, scenario tags, and sample embedding vectors to generate a query context vector. :
[0037] in, The standard mapping result after resolution. For rule text vectors retrieved from the business rule base, Encode scene labels, This is the embedding vector for the sample query statement; S45. Perform sample recall: based on the user's intent, retrieve the most similar query statement or function call example from the query function and code example library as a few-sample hint for the large language model; For example, this embodiment uses a business person querying Company D's "profit this month" as an example to illustrate how to resolve conflicts through confidence-weighted voting when multiple knowledge sources give different interpretations of the same term; Execution scenario settings: The user inputs: "Company D's profit this month"; the system needs to map "profit" to a specific database field.
[0038] Step S4, knowledge retrieval and conflict detection, is executed. The knowledge retrieval module retrieves information from multiple knowledge sources, as shown in Table 1. Table 1
[0039] Conflict situation: Mapping result M1: "Profit" should be mapped to "Net Profit" (net_profit). Supported sources: Basic numeric dictionary (0.9), business rule base (0.8), query sample base (0.5) Mapping result M2: "Profit" should be mapped to "Gross Profit" (gross_profit). Supported sources: Thesaurus (0.7), Query Sample Library (0.5) Mapping result M3: "Profit" should be mapped to "Operating Profit" (operating_profit). Supported sources: Thesaurus (0.7), Query Sample Library (0.5) Execute weighted voting resolution of S42 Calculate the total support weights for each mapping result:
[0040]
[0041]
[0042] The system selects the mapping result M1 with the largest total weight, which is "net profit"; Execute the enhanced query context generation of S43: The system integrates the resolved results with other recall knowledge to generate a query context vector:
[0043] in, =The database field "net_profit" corresponding to "Net Profit" and its table location: "Financial Module - Profit Statement" =Net profit calculation rule retrieved from the business rule base: "Net profit = Operating revenue - Operating cost - Taxes - Period expenses + Non-operating income - Non-operating expenses" =Scene tag encoding; since there is no clear history, the default value [financial, general] is used. =Embedded vector of historical best matching query example: "SELECT net_profit FROM profit_table WHERE company='D company' AND month='2025-03'"; The weighted voting mechanism automatically resolves conflicts between multiple knowledge sources, selects the most authoritative and reasonable mapping result, and avoids erroneous queries caused by ambiguity in terminology. If simple majority voting is used, M1, M2, and M3 each have only two supporting sources and cannot be distinguished. Weighted voting fully considers the authority of different knowledge sources, ensuring the reliability of the results. S5. Based on the enhanced query context, schedule and execute subquery tasks to obtain raw query data from the business system; The specific steps of step S5 are as follows: S51. Use standard business terms and their unique identifier codes in the enhanced query context as filtering conditions for data queries; S52. Based on the results of the query scenario retrieval, locate the specific functional module or data table in the business system; S53. Based on the results of business knowledge retrieval, determine the metrics to be queried and their calculation logic; S54. Combining the filtering conditions, the positioned functional modules, and the calculation logic, generate a structured query statement or calling instruction that can be executed in the business system; S55. Before initiating a query, obtain the current user's permission information and verify whether the structured query statement or call command is within the scope permitted by the function permissions and data permissions; If the validation passes, the query will be executed to retrieve the original query data; If the verification fails, an "Access Denied" message will be generated. S6. Input the raw query data into the large language model to generate and output query analysis results in natural language format; The specific steps of step S6 are as follows: S61. Combine the original query data and standardized query requirements to construct suggestion keywords; S62. Input the prompt words into the large language model to generate natural language text containing data summaries, trend analysis, or anomaly alerts; S63. Based on the user's preferences expressed in the preceding dialogue, the presentation format of the query analysis results is customized and then output; In step S63, the presentation format of the query analysis results is customized based on the preferences expressed by the user in the preceding dialogue, specifically including: Maintain a style preference vector for each user The style preference vector includes at least three dimensions: simplicity, technical depth, and chart preference. When a user provides feedback on the historical generated results, the style preference vector is updated based on the feedback. The current user's style preference vector is used as a control signal and input into the large language model along with the original query data to generate query analysis results that match the user's preferences. The updating of the style preference vector specifically includes: Record the feature vector of each generated result and user feedback on the result (Positive feedback is +1, negative feedback is -1); Update user preference vectors using online learning algorithms:
[0044] in, Set the learning rate; The step of using the current user's style preference vector as a control signal specifically includes: If the conciseness dimension value in the style preference vector exceeds the first preset threshold, then a conciseness guidance statement will be added to the prompt word; If the technical depth dimension value in the style preference vector exceeds the second preset threshold, then add technical terms and detailed calculation process guidance statements to the prompt words; If the chart preference dimension value in the style preference vector exceeds the third preset threshold, the chart component will be called first to generate the visualization result, and the text result will be used as a supplementary explanation. For example, this embodiment uses the same query "Sales performance of Company E in the first quarter of 2025" as an example to illustrate how to generate different query analysis results based on the preferences of two different users; Scene setting: User A: A company executive who prefers concise conclusions and charts. User B: Sales analyst, likes detailed data, prefers textual analysis The result of step S6 is generated: Execute user style preference vector: The system maintains a preference vector for each user: User A:
[0045] User B:
[0046] The original query data for step S62: The system retrieves the same data from the database: First quarter sales: 12.5 million yuan Year-on-year growth: 15% Month-on-month growth: 3% Sales breakdown by product line: Product A 45%, Product B 30%, Product C 25% Sales area distribution: Part I 40%, Part II 30%, Part III 20%, Part IV 10% Execution step S63: Construction of stylized prompt words: For User A (Senior Executive): Add the following to the prompt: Please summarize the core conclusion in one sentence. Prioritize using charts to display data. Avoid using professional financial terminology. For User B (Analyst): Add the following to the prompt: Please provide detailed data analysis. "Including the detailed calculation process for year-on-year and month-on-month changes" Explain the sales performance of each product line and region and the reasons behind it. Execution results: The result generated for user A: Key findings: Company E's sales revenue in the first quarter of 2025 was RMB 12.5 million, representing a year-on-year increase of 15%, demonstrating a strong growth momentum.
[0047] Visual presentation: Use a bar chart to show a comparison of sales over the past four quarters; Use pie charts to represent the sales percentage of product lines; Use a pie chart to represent regional sales distribution; Brief analysis: Product A remains the mainstay, while Product I contributes the most in some regions.
[0048] The result generated for user B: The detailed analysis report is as follows: I. General Situation Company E achieved sales of RMB 12.5 million in the first quarter of 2025, representing a 3.0% increase compared to RMB 12.14 million in the fourth quarter of 2024, and a 15.0% increase compared to RMB 10.87 million in the first quarter of 2024. This growth rate exceeded the industry average (12% year-on-year growth), demonstrating outstanding performance.
[0049] II. Year-on-Year and Month-on-Month Analysis The year-on-year increase of 15.0% was mainly due to the market expansion of product A and the launch of new product C.
[0050] The month-on-month increase was 3.0%, a slower growth rate than the previous quarter (8% month-on-month), and seasonal factors need to be considered.
[0051] III. Product Line Analysis Product A: Sales reached 5.625 million yuan, accounting for 45% of total revenue, remaining the core source of income. Year-on-year growth was 12%, lower than the company's overall growth rate; product iteration should be monitored.
[0052] Product B: Sales revenue was 3.75 million yuan, accounting for 30% of total sales. Year-on-year growth was 8%, indicating weak growth.
[0053] Product C: Sales reached 3.125 million yuan, accounting for 25%. As a new product, it made a significant contribution in the first quarter after its launch, with a 25% increase compared to the previous quarter, demonstrating great potential.
[0054] IV. Regional Analysis Part I region: Sales reached 5 million yuan, accounting for 40% of the total, representing a year-on-year increase of 18%, maintaining its leading position.
[0055] Part II: Sales reached 3.75 million yuan, accounting for 30% of the total, representing a year-on-year increase of 12%, with a steady increase in market share.
[0056] Part III: Sales revenue was 2.5 million yuan, accounting for 20% of total sales, representing a year-on-year increase of 10%, which was lower than expected.
[0057] IV. Partial Region: Sales of RMB 1.25 million, accounting for 10%, with a year-on-year growth of 25%, the fastest growth rate but with a small base.
[0058] V. Recommendations Increase resource investment in product C to maintain growth momentum; Analyze the reasons for the slow growth in Part III and adjust strategies accordingly; Pay attention to the slowdown in quarter-on-quarter growth and plan ahead for marketing activities in the second quarter.
[0059] User feedback and preference updates implemented User A liked the result. User B liked the result. ); The system records the feature vector of the generated result: User A's Result Characteristics
[0060] User B's Result Characteristics
[0061] Update the user preference vector (μ=0.1): User A:
[0062] User B:
[0063] This application can generate completely different analysis results based on user preferences. Executives can obtain concise conclusions needed for quick decision-making, and analysts can obtain detailed reports needed for in-depth analysis. Moreover, as user feedback increases, the style of the generated results matches user expectations more and more. It also includes the following steps: S7. After outputting the query analysis results, receive natural language operation instructions issued by the user based on the query analysis results; S8. Parse and plan the natural language operation instructions, call the corresponding business processes or services in the business system, and complete the business operation.
[0064] This embodiment uses the example of a business person querying the financial data of Company A to illustrate the implementation process of this application; Natural language input for step S1: The user says through the voice input device, "I want to see Company A's profit and loss statement"; after receiving the voice, the system converts it into text through the voice recognition module and stores the natural language query in the dialogue history cache; Execution step S2 involves multiple rounds of rewriting and questioning clarification: The system inputs the user's current query statement "I want to view the income statement of Company A" and the conversation history (which is empty if there is no history) into the large language model to generate a rewritten query statement: "Query the income statement of Company A"; Subsequently, a necessary information integrity check is performed. The system presets a set of required parameters for the income statement query scenario ; Extract the currently recognized parameter set from the rewritten query statement ; Calculate the information integrity score ; Preset the integrity threshold T = 0.8. Since S < T, it is determined that information is missing, and the missing parameter set ; The system generates a natural language rhetorical question for the missing parameter: "Which period's income statement do you want to query?" and outputs it to the user; The user replies: "The fourth quarter of 2023"; The system receives this supplementary information and uses it to update the standardized query requirement to obtain the complete requirement: "Query the income statement of Company A for the fourth quarter of 2023"; At this time, the integrity check is performed again, , the integrity score S = 1, which meets the requirements, and enters step S3; Execute the task planning in step S3: The task planning module receives the standardized requirement and inputs it into the large language model for intention recognition, decomposing it into two atomic-level sub-query tasks: Sub-task 1: Obtain the unique identification code (ID) of Company A in the business system; Sub-task 2: Query data from the income statement in the financial module based on the company ID and time range; According to the data dependency (sub-task 2 requires the output of sub-task 1 as input), determine the execution order as first execute sub-task 1 and then sub-task 2; Generate an initial execution plan; Since there is no conflict in the historical execution records, no adjustment is required. The scheduling module calls the corresponding interfaces in sequence according to the plan; Execute the knowledge recall in step S4: According to the task planning information, the knowledge recall module performs the following recall operations: Synonym recall: For the keyword "Company A" in sub-task 1, match the standard business term "Company A" in the synonym library (no synonyms); For "income statement" in sub-task 2, match the standard term "income statement"; Dictionary recall: According to the standard term "Company A", look up its unique identification code "COMP001" in the basic digital dictionary; "Income statement" corresponds to the database table name "profit_table"; Query scenario recall: According to the standardized requirement and conversation history, determine that the current business scenario is "financial query" to limit the data range for subsequent use; Business knowledge retrieval: Retrieve the definitions of indicators in the profit and loss statement from the business knowledge base, such as the calculation rules for "operating revenue", "operating cost" and "net profit"; Sample Recall: Retrieve SQL samples similar to "Query profit and loss statement by company ID and time" from the query function and code sample library; The above recall information is integrated to generate an enhanced query context, which includes the company ID "COMP001", standard terms, scenario tags, business rules and SQL samples; Perform the data query in step S5: Based on the enhanced query context, the data query execution module: Use company ID "COMP001" and time range "2023-10-01 to 2023-12-31" as the filtering criteria; Locate the profit table "profit_table" in the finance module; Based on the business rules, the query indicators are determined to be "operating revenue", "operating costs", and "net profit". Generate structured query statements (SQL): SQL SELECT company_id, date, revenue, cost, profit FROM profit_table WHERE company_id = 'COMP001' AND date BETWEEN '2023-10-01' AND '2023-12-31'; Before initiating a query, obtain the current user's permission information and verify that they have permission to view Company A's financial data. If the verification is successful, execute the query. Obtain the original query data: Assume that a record is returned, containing operating revenue of 10 million yuan, operating costs of 6 million yuan, and net profit of 4 million yuan; Result generation of step S6 The results generation module merges the original query data and standardized requirements to construct a large language model for prompt word input. The large model generates natural language analysis results: "Company A achieved operating revenue of 10 million yuan, operating costs of 6 million yuan, and net profit of 4 million yuan in the fourth quarter of 2023; compared with the previous quarter, revenue increased by 10%, cost control was good, and profitability improved." At the same time, based on the user's preferences expressed in the preceding dialogue (such as liking charts), the system calls the intelligent chart component to generate a bar chart to display the quarterly comparison, and outputs the natural language text along with the chart to the user; Execute S7 business operations: After viewing the results, the user can further input a natural language command: "Please generate a detailed report and send it to Manager Li". The system receives the command, parses it through the task planning module, calls the report generation service and email sending service in the business system, completes the report generation and sending, and realizes a closed loop from query to business operation.
[0065] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0066] like Figure 2 As shown, the following are embodiments of a business query assistant implementation system based on multi-turn dialogue provided in this disclosure. This system and the business query assistant implementation methods based on multi-turn dialogue in the above embodiments belong to the same inventive concept. For details not described in detail in the embodiments of the business query assistant implementation system based on multi-turn dialogue, please refer to the embodiments of the business query assistant implementation methods based on multi-turn dialogue described above.
[0067] The system includes: The natural language input module is used to receive natural language query statements input by the user; The multi-turn dialogue management module is used to rewrite and clarify natural language query statements in several rounds based on the dialogue history, so as to clarify the user's query intent and generate standardized query requirements. The task planning module is used to perform task planning, break down standardized query requirements into at least one sub-query task, determine the execution order of the sub-query tasks, and generate task planning information. The knowledge retrieval module is used to retrieve business knowledge related to the subquery task from the knowledge base based on task planning information, and generate an enhanced query context. The data query execution module is used to schedule and execute subquery tasks based on an enhanced query context to obtain raw query data from the business system. The results generation module is used to input raw query data into the large language model and generate and output query analysis results in natural language format.
[0068] This embodiment achieves efficient and secure natural language data query and analysis through the interactive collaboration of a natural language input module, a multi-turn dialogue management module, a task planning module, a knowledge retrieval module, a data query execution module, and a result generation module. It uses a multi-turn dialogue mechanism to accurately complete query parameters, intelligently decomposes and plans the execution order of complex tasks, and combines business knowledge base retrieval.
[0069] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for implementing a business query assistant based on multi-turn dialogue, characterized in that, Includes the following steps: S1. Receive the natural language query statement input by the user; S2. Based on the dialogue history, the natural language query statement is rewritten and clarified through several rounds of questioning to clarify the user's query intent and generate standardized query requirements; S3. Perform task planning, break down standardized query requirements into at least one sub-query task, determine the execution order of the sub-query tasks, and generate task planning information; S4. Based on the task planning information, retrieve the business knowledge associated with the subquery task from the knowledge base and generate an enhanced query context; S5. Based on the enhanced query context, schedule and execute subquery tasks to obtain raw query data from the business system; S6. Input the raw query data into the large language model to generate and output query analysis results in natural language format.
2. The method for implementing a business query assistant based on multi-turn dialogue according to claim 1, characterized in that, The specific steps of step S1 are as follows: S11. Identify the input device; When it is a text input device, it receives natural language text query statements entered by the user through the text input device; When it is a voice input device, it receives voice query statements input by the user through the voice input device, performs voice recognition on the voice query statements, and converts the voice query statements into natural language text query statements; S12. Store the received natural language query statement in the dialogue history cache.
3. The method for implementing a business query assistant based on multi-turn dialogue according to claim 1, characterized in that, The specific steps of step S2 are as follows: S21. Input the natural language query statement and dialogue history into the large language model to generate the rewritten query statement; S22. Perform necessary information integrity checks on the rewritten query statement and identify missing key query parameters; S23. When the number of missing key query parameters exceeds a preset threshold, generate and output a natural language rhetorical question for the missing key query parameters, and receive supplementary information from the user regarding the natural language rhetorical question. S24. Use the supplementary information to generate or update standardized query requirements; S25. Determine whether the updated standardized query requirements meet the completeness requirements; If so, proceed to step S3; If not, return to step S21 for the next round of rewriting and clarification.
4. The method for implementing a business query assistant based on multi-turn dialogue according to claim 3, characterized in that, The necessary information integrity check in step S22 specifically includes: Preset sets of required parameters for different query scenarios ; Extract the currently identified parameter set from the rewritten query statement. ; Calculate the information completeness score ; If information completeness score If the value is less than the preset integrity threshold T, it is determined that information is missing, and the missing parameter set is recorded. This serves as the basis for generating rhetorical questions.
5. The method for implementing a business query assistant based on multi-turn dialogue according to claim 1, characterized in that, The specific steps of step S3 are as follows: S31. Perform task decomposition, input standardized query requirements into the large language model, and decompose the standardized query requirements into several atomic-level sub-query tasks through intent recognition; S32. Execution step planning: Based on the data dependencies and business logic between subquery tasks, determine the execution order of each subquery task and generate an initial execution plan; S33. Execution plan adjustment: Based on historical execution records or preset business rules, dynamically adjust the initial execution plan to optimize the execution order or merge subquery tasks of the same type; S34. Execute scheduling: According to the adjusted execution plan, schedule the corresponding query interfaces or functions in sequence.
6. The method for implementing a business query assistant based on multi-turn dialogue according to claim 1, characterized in that, The specific steps of step S4 are as follows: S41. Perform synonym recall, and match the corresponding standard business terms in the thesaurus based on the keywords in the subquery task; S42. Perform dictionary recall, and search for the unique identifier code corresponding to each standard business term in the basic digital dictionary in the business system; S43. Perform query scenario recall, and determine the current business scenario based on the standardized query requirements or dialogue history to limit the scope of subsequent data queries; S44. Perform business knowledge retrieval, and retrieve relevant business logic, calculation rules or indicator definitions from the business knowledge base according to user intent to guide data query and analysis; S45. Perform sample recall: Based on the user's intent, retrieve the most similar query statement or function call example from the query function and code sample library as a few-sample hint for the large language model.
7. The method for implementing a business query assistant based on multi-turn dialogue according to claim 6, characterized in that, The specific steps of step S5 are as follows: S51. Use standard business terms and their unique identifier codes in the enhanced query context as filtering conditions for data queries; S52. Based on the results of the query scenario retrieval, locate the specific functional module or data table in the business system; S53. Based on the results of business knowledge retrieval, determine the metrics to be queried and their calculation logic; S54. Combining the filtering conditions, the positioned functional modules, and the calculation logic, generate a structured query statement or calling instruction that can be executed in the business system; S55. Before initiating a query, obtain the current user's permission information and verify whether the structured query statement or call command is within the scope permitted by the function permissions and data permissions; If the validation passes, the query will be executed to retrieve the original query data; If the verification fails, an "Access Denied" message will be generated.
8. The method for implementing a business query assistant based on multi-turn dialogue according to claim 1, characterized in that, The specific steps of step S6 are as follows: S61. Combine the original query data and standardized query requirements to construct suggestion keywords; S62. Input the prompt words into the large language model to generate natural language text containing data summaries, trend analysis, or anomaly alerts; S63. Based on the user's preferences expressed in the preceding dialogue, the presentation format of the query analysis results is customized and then output.
9. The method for implementing a business query assistant based on multi-turn dialogue according to claim 1, characterized in that, It also includes the following steps: S7. After outputting the query analysis results, receive natural language operation instructions issued by the user based on the query analysis results; S8. Parse and plan the natural language operation instructions, call the corresponding business processes or services in the business system, and complete the business operation.
10. A business query assistant implementation system based on multi-turn dialogue, characterized in that, include: The natural language input module is used to receive natural language query statements input by the user; The multi-turn dialogue management module is used to rewrite and clarify natural language query statements in several rounds based on the dialogue history, so as to clarify the user's query intent and generate standardized query requirements. The task planning module is used to perform task planning, break down standardized query requirements into at least one sub-query task, determine the execution order of the sub-query tasks, and generate task planning information. The knowledge retrieval module is used to retrieve business knowledge related to the subquery task from the knowledge base based on task planning information, and generate an enhanced query context. The data query execution module is used to schedule and execute subquery tasks based on an enhanced query context to obtain raw query data from the business system. The results generation module is used to input raw query data into the large language model and generate and output query analysis results in natural language format.