Intelligent number asking method and system based on prompt word dynamic assembly and program product
By decoupling user intent from business prompts through data asset catalog IDs and dynamically assembling prompts, the problem of adapting to multiple business scenarios in the traditional model is solved, achieving accurate question answering and improved system flexibility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-17
- Publication Date
- 2026-03-10
AI Technical Summary
Traditional prompt word configuration mode cannot adapt to multiple business scenarios, has high maintenance costs, lacks dynamic association with data assets, and the large model context window limitation leads to a decrease in question answering accuracy.
By decoupling user intent and business prompts through data asset catalog IDs, prompts are dynamically assembled. The data asset catalog IDs are used to match and concatenate business prompts with general framework prompts to generate complete prompts, which are then input into a large model for question-and-answer analysis.
It enables accurate question answering across multiple business scenarios under a single question entry point, reducing configuration and maintenance costs, improving system flexibility, and avoiding issues such as slow response or exceeding token limits for large models.
Smart Images

Figure CN121638256A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of data analysis, and particularly relates to an intelligent query method, system and program product based on dynamic assembly of prompt words. BACKGROUND
[0002] With the deepening of digital transformation, the demand of enterprises for data value mining is increasingly urgent, and intelligent query (i.e., data query and analysis through natural language interaction) has become a core tool for improving data utilization efficiency. Users expect to obtain business insights directly with colloquial instructions, rather than relying on complex database instruction writing or report configuration. In intelligent query applications, prompt word engineering is a key link to achieve accurate query and answer. By designing structured prompt words, large models can understand user intent, call data, and generate intelligent query results.
[0003] However, the traditional prompt word configuration mode has significant limitations and cannot meet the personalized needs of multiple business scenarios: 1. Prompt words are fixed and cannot adapt to multiple business scenarios In traditional solutions, prompt words are usually "one set of templates for all scenarios". For example, prompt words for sales data may include "query time range", "indicator definition", "dimension filtering", and other fixed elements. However, when the business scenario switches to financial data or operational data, the original template cannot cover the special needs of the new scenario (such as financial indicator calculation logic, user behavior tag system). If forced to reuse, it is easy to cause large models to misunderstand the intent and return incorrect results.
[0004] 2. Manual reconstruction of prompt words is required when business changes, with high maintenance costs When enterprise data assets and business logic change dynamically (such as adding data tables, adjusting indicator caliber, expanding business lines), the traditional mode requires manual modification of prompt word templates to adapt to changes.
[0005] 3. Lack of dynamic association with data assets, lack of flexibility Data asset catalog (such as data set, indicator library, etc.) is the core achievement of enterprise data governance, including asset ID, name, business meaning, association, and other key information. Traditional prompt words are not explicitly associated with data asset catalogs, and cannot automatically locate target data assets based on user input "business keywords". Only by hard coding can the asset path be specified, resulting in repeated configuration of similar prompt words for cross-business scenario query and answer, with serious resource waste.
[0006] 4. Conflict between large model context window limit and Token explosion Large language models rely on a "context window" for reasoning; content exceeding this window can be truncated or cause a sharp drop in model performance. Enterprise internal data assets are typically massive (e.g., hundreds of data tables, thousands of business metrics, dozens of business line scenarios). Traditional fixed prompt word templates, in order to cover all scenarios, require writing all the details of each business's metric definitions, dimension rules, calculation logic, and filtering conditions into the template. This leads to key information being truncated during actual use, the model failing to fully understand business rules, and a significant drop in question-answering accuracy. Summary of the Invention
[0007] The purpose of this invention is to provide an intelligent questioning method, system, and program product based on dynamic assembly of prompt words, in order to solve the above-mentioned problems existing in the prior art.
[0008] To achieve the above objectives, the present invention adopts the following technical solution: Firstly, it provides an intelligent question counting method based on dynamic assembly of prompt words, including: Obtain natural language commands input by the user; Perform semantic recognition on natural language instructions and extract the core business elements contained in the natural language instructions; Based on the core business elements, match the corresponding data asset catalog ID in the data asset catalog, and determine the corresponding general framework prompt words based on the core business elements; Based on the data asset catalog ID, the corresponding business prompt words are extracted from the business prompt word mapping table in the prompt word library; By concatenating the business prompt with the general framework prompt, a dynamically assembled complete prompt is obtained; The dynamically assembled complete prompts are input into a pre-set large model for question-and-answer analysis to obtain the corresponding intelligent question count results, and the intelligent question count results are fed back to the user.
[0009] In one possible design, before matching the corresponding data asset catalog ID in the data asset catalog based on core business elements, the method further includes: Collect data assets from several enterprises and extract business metadata from each enterprise's data assets; Determine the business domain classification of each enterprise's data assets, and assign a unique data asset catalog ID to each enterprise's data assets based on the business domain classification; Build a data asset catalog, and import the data asset catalog IDs of each enterprise's data assets into the data asset catalog after associating them with business metadata.
[0010] In one possible design, the matching of the corresponding data asset catalog ID in the data asset catalog based on core business elements includes: Compare the core business elements with the business metadata associated with each data asset catalog ID in the data asset catalog; If a data asset catalog contains a data asset catalog ID that matches the associated business metadata and core business elements, then that data asset catalog ID will be used as the matching data asset catalog ID.
[0011] In one possible design, the corresponding data asset catalog ID is matched in the data asset catalog based on the core business elements, including: The similarity between the core business elements and the business metadata associated with each data asset catalog ID in the data asset catalog is determined. If a data asset directory ID exists in the data asset directory and the similarity between the associated business metadata and the core business elements meets the set similarity conditions, then that data asset directory ID will be used as the matching data asset directory ID.
[0012] In one possible design, before retrieving the corresponding business prompt from the business prompt mapping table of the prompt word library based on the data asset catalog ID, the method further includes: A business prompt word mapping table is constructed in the prompt word library. The business prompt word mapping table contains several data asset directory IDs and the corresponding business prompt words associated with each data asset directory ID.
[0013] In one possible design, determining the corresponding general framework prompts based on core business elements includes: Extract business dimension information from core business elements and retrieve general framework prompts associated with the business dimension information from the prompt word library.
[0014] In one possible design, the method further includes: Based on core business elements, multiple data asset catalog IDs are matched in the data asset catalog, and corresponding general framework prompt words are determined based on core business elements. Based on the ID of each data asset catalog, the corresponding business prompt words are extracted from the business prompt word mapping table; By concatenating the business prompts corresponding to each data asset catalog ID and the general framework prompts, a dynamically assembled complete prompt is obtained.
[0015] Secondly, an intelligent question-and-answer system based on dynamic assembly of prompt words is provided, including an instruction parsing unit, a data matching unit, a mapping extraction unit, a dynamic assembly unit, and a question-and-answer feedback unit, wherein: The instruction parsing unit is used to acquire natural language instructions input by the user, perform semantic recognition on the natural language instructions, and extract the core business elements contained in the natural language instructions. The data matching unit is used to match the corresponding data asset catalog ID in the data asset catalog based on the core business elements, and to determine the corresponding general framework prompt words based on the core business elements. The mapping and extraction unit is used to map and extract the corresponding business prompt words from the business prompt word mapping table of the prompt word library according to the data asset catalog ID; The dynamic assembly unit is used to concatenate business prompts with general framework prompts to obtain dynamically assembled complete prompts; The question-and-answer feedback unit is used to input the dynamically assembled complete prompt words into a pre-set large model for question-and-answer analysis, obtain the corresponding intelligent question count results, and provide feedback on the intelligent question count results to the user.
[0016] Thirdly, it provides an intelligent question-answering system based on dynamic assembly of prompt words, including: Memory, used to store instructions; The processor is configured to read instructions stored in the memory and execute any one of the intelligent question-answering methods based on prompt words dynamic assembly as described in the first aspect above, according to the instructions.
[0017] Fourthly, a computer-readable storage medium is provided, on which instructions are stored, which, when executed on a computer, cause the computer to execute any one of the intelligent question-answering methods based on dynamic assembly of prompt words as described in the first aspect. Simultaneously, a computer program product is also provided, which, when executed on a computer, executes any one of the intelligent question-answering methods based on dynamic assembly of prompt words as described in the first aspect.
[0018] Beneficial Effects: This invention breaks away from the traditional fixed-mode prompting, using data asset catalog IDs as a bridge to decouple "user intent" from "business prompting," avoiding the strong binding of intent and full-scale rules in the traditional model. Through dynamic parsing of data asset catalog IDs and on-demand splicing of prompting templates, intelligent linkage between user intent, data asset catalog ID, and business prompting can be achieved. This supports accurate question answering in multiple business scenarios under a single question entry point, reducing configuration and maintenance costs and improving system flexibility. This invention can achieve conversational and accurate data retrieval for data assets in different business domains within an enterprise, effectively solving the cumbersome operation problem of creating different question intelligence agents in different business domains in the traditional model. It also effectively solves the problem of excessively long context caused by the full reading of prompting words for data assets in different business domains during the dialogue process in the traditional model, leading to slow response or exceeding the token limit. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a flowchart illustrating the method in Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the system configuration in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of the system configuration in Embodiment 3 of the present invention. Detailed Implementation
[0021] It should be noted that the descriptions of these embodiments are intended to aid in understanding the invention and do not constitute a limitation thereof. The specific structural and functional details disclosed herein are merely for describing exemplary embodiments of the invention. However, the invention may be embodied in many alternative forms and should not be construed as being limited to the embodiments described herein.
[0022] It should be understood that, unless otherwise explicitly specified and limited, the corresponding terms should be interpreted broadly. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be a connection within two components. Those skilled in the art can understand the specific meaning of the above terms in the embodiments according to the specific circumstances.
[0023] Specific details are provided in the following description to provide a complete understanding of the exemplary embodiments. However, those skilled in the art will understand that the exemplary embodiments can be implemented without these specific details. For example, apparatus may be shown in block diagrams to avoid obscuring the examples with unnecessary details. In other embodiments, well-known processes, structures, and techniques may be omitted with non-essential details to avoid obscuring the embodiments.
[0024] Example 1: This embodiment provides an intelligent question counting method based on dynamic assembly of prompt words, which can be applied to corresponding intelligent question answering systems, such as... Figure 1 As shown, the method includes the following steps: S1. Obtain the natural language instructions input by the user, perform semantic recognition on the natural language instructions, and extract the core business elements contained in the natural language instructions.
[0025] In practice, the system obtains natural language commands input by the user, and then performs semantic recognition / intent parsing on the natural language commands through the natural language processing part in order to identify and extract the core business elements contained in the natural language commands. The core business elements may include information such as business scenarios, data indicators, business dimensions, and analysis objectives.
[0026] S2. Match the corresponding data asset catalog ID in the data asset catalog based on the core business elements, and determine the corresponding general framework prompt words based on the core business elements.
[0027] In practice, the system pre-builds a data asset catalog. The process includes: collecting and sorting out several enterprise data assets and extracting business metadata (including business scenarios, data indicators, and relationships) from each enterprise's data assets; then determining the business domain classification of each enterprise's data assets and assigning each enterprise's data assets a unique data asset catalog ID based on the business domain classification; finally, building the data asset catalog and associating the data asset catalog ID of each enterprise's data assets with the business metadata before importing them into the data asset catalog.
[0028] Furthermore, the system pre-constructs a business prompt word mapping table in the prompt word library. This table contains several data asset directory IDs and the corresponding business prompt words associated with each data asset directory ID. This allows for the pre-definition of lightweight business prompt words for different data asset directory IDs. Simultaneously, general framework prompt words can be pre-defined in the prompt word library for different business dimensions. For example, the general framework prompt words for financial indicators (preliminary reports and final accounts) default to time-dimensional extraction rules, with monthly prompts defaulting to preliminary reports and annual final accounts defaulting to final accounts.
[0029] After obtaining core business elements through user intent parsing, the system can use these core business elements to match data asset catalog IDs that are strongly related to user needs within the data asset catalog, including: The core business element is compared with the business metadata associated with each data asset directory ID in the data asset catalog. If a data asset directory ID exists in the data asset catalog whose associated business metadata matches the core business element, then that data asset directory ID is used as the matching data asset directory ID. For example, if the core business element obtained from the user instruction intent parsing includes "total profit," and "total profit" corresponds to the "total profit" indicator business metadata in the financial statement domain, then the data asset directory ID of the financial statement is extracted.
[0030] Alternatively, the similarity between the core business elements and the business metadata associated with each data asset directory ID in the data asset directory can be determined. If there is a data asset directory ID in the data asset directory whose associated business metadata and core business elements have a similarity that meets the set similarity conditions, then that data asset directory ID can be used as the matching data asset directory ID.
[0031] Simultaneously, the system extracts business dimension information from core business elements and retrieves general framework prompts associated with the business dimension information from the prompt word library. For example, if the business dimension information is the corresponding time dimension, when the time dimension is month, the system defaults to using quick report data; when the time dimension is year, the system defaults to using final accounts data.
[0032] S3. Based on the data asset catalog ID, extract the corresponding business prompt word from the business prompt word mapping table in the prompt word library.
[0033] In practice, after obtaining the data asset catalog ID, the system can extract the corresponding business prompt words from the business prompt word mapping table of the prompt word library based on the data asset catalog ID, so as to realize the "on-demand loading" of prompt words, only loading the business prompt words required for the current scenario, practicing the "minimum necessary token principle", and controlling the amount of single input tokens (the basic unit of text processing) from the source.
[0034] S4. Concatenate the business prompt with the general framework prompt to obtain a dynamically assembled complete prompt.
[0035] In practical implementation, the system can concatenate the business prompt words corresponding to the data asset catalog ID with the general framework prompt words to obtain dynamically assembled complete prompt words. When matching multiple data asset catalog IDs based on core business elements in the data asset catalog, the system can extract the corresponding business prompt words from the business prompt word mapping table according to each data asset catalog ID, and then concatenate the business prompt words corresponding to each data asset catalog ID with the general framework prompt words to obtain dynamically assembled complete prompt words. This supports multiple ID combinations (such as concatenating multiple business prompt words when querying across assets) and adapts to complex business scenarios (such as the "reimbursement + financial joint analysis" scenario).
[0036] S5. Input the dynamically assembled complete prompts into the pre-set large model for question-and-answer analysis, obtain the corresponding intelligent question count results, and provide feedback on the intelligent question count results to the user.
[0037] In practice, the system inputs dynamically assembled complete prompts into a pre-set large model for question-and-answer analysis (the large model is guided to query, calculate and analyze by dynamically assembled complete prompts) to obtain corresponding intelligent question count results, and finally provides the user with accurate intelligent question count results.
[0038] This method breaks away from the traditional fixed-mode prompt words. Using the data asset catalog ID as a bridge, it decouples "user intent" from "business prompt words," avoiding the strong binding between intent and all rules in the traditional model. Through dynamic parsing of the data asset catalog ID and on-demand splicing of prompt word templates, it can achieve intelligent linkage between user intent, data asset catalog ID, and business prompt words. This supports accurate question answering in multiple business scenarios under a single question entry point, reducing configuration and maintenance costs and improving system flexibility.
[0039] Example 2: This embodiment provides an intelligent question-and-answer system based on dynamic assembly of prompt words, such as... Figure 2 As shown, it includes an instruction parsing unit, a data matching unit, a mapping extraction unit, a dynamic assembly unit, and a question-and-answer feedback unit, wherein: The instruction parsing unit is used to acquire natural language instructions input by the user, perform semantic recognition on the natural language instructions, and extract the core business elements contained in the natural language instructions. The data matching unit is used to match the corresponding data asset catalog ID in the data asset catalog based on the core business elements, and to determine the corresponding general framework prompt words based on the core business elements. The mapping and extraction unit is used to map and extract the corresponding business prompt words from the business prompt word mapping table of the prompt word library according to the data asset catalog ID; The dynamic assembly unit is used to concatenate business prompts with general framework prompts to obtain dynamically assembled complete prompts; The question-and-answer feedback unit is used to input the dynamically assembled complete prompt words into a pre-set large model for question-and-answer analysis, obtain the corresponding intelligent question count results, and provide feedback on the intelligent question count results to the user.
[0040] Example 3: This embodiment provides an intelligent question-and-answer system based on dynamic assembly of prompt words, such as... Figure 3 As shown, at the hardware level, it includes: The data interface is used to establish data communication between the processor and external data terminals; Memory, used to store instructions; The processor is configured to read instructions stored in the memory and execute the intelligent question-asking method based on prompt words dynamic assembly in Embodiment 1 according to the instructions.
[0041] Optionally, the system also includes an internal bus, through which the processor, memory, and data interface can be interconnected. This internal bus can be a PCIe (Peripheral Component Interconnect Eexpress) bus, which can be divided into an address bus, a data bus, a control bus, etc. The memory can include, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Flash Memory, First Input First Output (FIFO), and / or First In Last Out (FILO). The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0042] Example 4: This embodiment provides a computer-readable storage medium storing instructions. When these instructions are executed on a computer, the computer performs the intelligent question-answering method based on prompt words dynamically assembled in Embodiment 1. The computer-readable storage medium refers to a data storage medium, which may include, but is not limited to, floppy disks, optical disks, hard disks, flash memory, USB flash drives, and / or Memory Sticks. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
[0043] This embodiment also provides a computer program product that, when run on a computer, executes the intelligent question-answering method based on prompt words dynamically assembled in Embodiment 1. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
[0044] Finally, it should be noted that the above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. An intelligent question answering method based on dynamic assembly of prompt words, characterized in that, The method comprises the following steps: acquiring a natural language instruction input by a user; performing semantic recognition on the natural language instruction to extract core business elements contained in the natural language instruction; matching a corresponding data asset directory ID in a data asset directory based on the core business elements, and determining a corresponding general framework prompt word based on the core business elements; mapping and extracting a corresponding business prompt word from a business prompt word mapping table in a prompt word library according to the data asset directory ID; splicing the business prompt word and the general framework prompt word to obtain a dynamically assembled complete prompt word; inputting the dynamically assembled complete prompt word into a preset large model to perform question and answer analysis and obtain a corresponding intelligent question result, and feeding back the intelligent question result to the user. 2.The smart question answering method based on dynamic assembly of prompt words according to claim 1, wherein, Before matching the corresponding data asset directory ID in the data asset directory based on the core business elements, the method further comprises the following steps: collecting a plurality of enterprise data assets and extracting business metadata of each enterprise data asset; determining a business domain classification to which each enterprise data asset belongs, and assigning a unique data asset directory ID to each enterprise data asset according to the business domain classification of each enterprise data asset; building a data asset directory and importing the data asset directory ID and the business metadata of each enterprise data asset into the data asset directory after association. 3.The smart question answering method based on dynamic assembly of prompt words according to claim 2, wherein, The matching of the corresponding data asset directory ID in the data asset directory based on the core business elements comprises the following steps: comparing the core business elements with the business metadata associated with each data asset directory ID in the data asset directory; if the associated business metadata in the data asset directory is consistent with the core business elements, the data asset directory ID is taken as the matched data asset directory ID. 4.The smart question answering method based on dynamic assembly of prompt words according to claim 2, wherein, The matching of the corresponding data asset directory ID in the data asset directory based on the core business elements comprises the following steps: determining the similarity of the core business elements and the business metadata associated with each data asset directory ID in the data asset directory; if the similarity of the associated business metadata in the data asset directory and the core business elements meets the set similarity condition, the data asset directory ID is taken as the matched data asset directory ID. 5.The smart question answering method based on dynamic assembly of prompt words according to claim 1, wherein, Before mapping and extracting the corresponding business prompt word from the business prompt word mapping table in the prompt word library according to the data asset directory ID, the method further comprises the following steps: building a business prompt word mapping table in the prompt word library, wherein the business prompt word mapping table contains a plurality of data asset directory IDs and the business prompt words associated with each data asset directory ID. 6.The smart question answering method based on dynamic assembly of prompt words according to claim 1, wherein, The determination of the corresponding general framework prompt word based on the core business elements comprises the following steps: extracting business dimension information from the core business elements, and searching and determining the general framework prompt word associated with the business dimension information in the prompt word library.
7. The method of claim 1, wherein, The method further comprises the following steps: matching a plurality of data asset directory IDs in the data asset directory based on the core business elements, and determining a corresponding general framework prompt word based on the core business elements; mapping and extracting a corresponding business prompt word from the business prompt word mapping table according to each data asset directory ID; splicing the business prompt word corresponding to each data asset directory ID and the general framework prompt word to obtain a dynamically assembled complete prompt word.
8. The intelligent question answering system based on dynamic assembly of prompt words, characterized in that, The method comprises the following steps: a command analysis unit, a data matching unit, a mapping extraction unit, a dynamic assembly unit, and a question and answer feedback unit are included, wherein: The command analysis unit is used for acquiring a natural language instruction input by a user, performing semantic recognition on the natural language instruction, and extracting core business elements contained in the natural language instruction; The data matching unit is used for matching a corresponding data asset directory ID in a data asset directory based on the core business elements, and determining a corresponding general framework prompt word based on the core business elements; The mapping extraction unit is used for mapping and extracting a corresponding business prompt word from a business prompt word mapping table of a prompt word library according to the data asset directory ID; The dynamic assembly unit is used for splicing the business prompt word and the general framework prompt word to obtain a complete prompt word assembled dynamically; The question and answer feedback unit is used for inputting the complete prompt word assembled dynamically into a pre-set large model to perform question and answer analysis, obtaining a corresponding intelligent question and answer result, and feeding back the intelligent question and answer result to the user.
9. The intelligent question answering system based on dynamic assembly of prompt words, characterized in that, It comprises: A memory is used for storing instructions; A processor is used for reading the instructions stored in the memory, and executing the intelligent question and answer method based on prompt word dynamic assembly according to any one of claims 1-7.
10. A computer program product, characterised in that, When the computer program product runs on the computer, the intelligent question and answer method based on prompt word dynamic assembly according to any one of claims 1-7 is executed.