Information query method and device based on large model and terminal equipment
Patent Information
- Application Number
- CN202511741292.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-25
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2045-11-25
AI Technical Summary
传统SQL无法理解这些同义词
[0049]In this embodiment, the raw data is first converted into XML information, which includes entities, cost centers, accounts, time, amounts, permission tags, and business scenario text. Then, the XML information is divided into multiple XML information blocks according to preset conditions, which include at least one of cost centers, accounts, and time. Next, the multiple XML information blocks are converted into vectors and stored to obtain a vector database. When a user inputs a query, the target XML information block is determined from the vector database based on the query. Finally, the user's permissions for the target XML information block are determined based on the user's account information. When the user has permissions for the target XML information block, a response to the query is generated based on the target XML information block. This allows users to use natural language to flexibly, accurately, and securely query data from the data sharing center, bypassing the unreliable step of directly generating SQL.
Smart Images

Figure CN121561053B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, specifically to an information query method, apparatus, and terminal device based on a large model. Background Technology
[0002] In the daily operation of a company's data sharing service center, various types of data, such as financial and operational data, need to be frequently queried. During the research process, the inventors of this application discovered that data retrieval through traditional SQL queries or fixed reports has at least the following problems:
[0003] 1. Difficulty in mapping natural language to data: Database schemas include multiple modules (such as general ledger, accounts receivable, accounts payable, costs and expenses, etc.), and table names and field names are mostly English abbreviations (such as GL_ACCT, AP_INV, COST_CTR). For example, when a user queries a specific piece of data at a certain time point for their department within their branch office, the LLM (Large Language Model) needs to accurately map to the branch office, department, time point, data type, etc., which is prone to errors.
[0004] 2. Diversity and specialization of financial terminology: Users may use different terms to refer to the same concept, such as "travel expenses," "travel costs," and "business trip expenses," or "accounts payable" and "pending bills." Traditional SQL cannot understand these synonyms.
[0005] 3. Complex data access and security control: In database tables, data is usually stored in the form of rows and columns. Columns represent data attributes, and rows represent a specific data record. Directly generating SQL makes it difficult to flexibly embed complex row-level data access control. For example, Manager A can only query the expenses of the departments under his jurisdiction.
[0006] 4. Reliance on pre-built reports and lack of flexibility: Business users have ever-changing needs, and it is impossible to pre-build reports and BI charts for all potential problems, resulting in slow response.
[0007] 5. Insufficient support for summarizing and deducing data queries: For example, if a user queries "which product line has the highest profit margin", this requires calculating (revenue - cost) / revenue. In SQL, multiple tables need to be correctly joined and the calculation needs to be performed. The complexity of generating such queries by LLM is extremely high. Summary of the Invention
[0008] In view of this, embodiments of this application provide an information query method, apparatus, and terminal device based on a large model, which enables users to use natural language to flexibly, accurately, and securely query data in a data sharing center, bypassing the unreliable process of directly generating SQL.
[0009] To achieve the above objectives, this application adopts the following technical solution:
[0010] Firstly, embodiments of this application provide an information query method based on a large model, including:
[0011] The raw data is converted into XML information, which includes entities, cost centers, accounts, time, amount, permission tags, and business scenario text;
[0012] The XML information is divided into multiple XML information blocks according to preset conditions, and the preset conditions include at least one of cost center, subject and time.
[0013] The multiple XML information blocks are converted into vectors and stored to obtain a vector database;
[0014] Obtain the user's query information, and determine the target XML information block from the vector database based on the query information;
[0015] The user's permissions for the target XML information block are determined based on the user account information. When the user has permissions for the target XML information block, the response information for the query information is generated based on the target XML information block.
[0016] Based on the first aspect, in some embodiments, the conversion of the raw data into XML information includes:
[0017] Extract entities, cost centers, accounts, times, and amounts from the raw data, where the amounts include budgeted amounts and actual amounts incurred.
[0018] Calculate the difference amount and difference percentage based on the budgeted amount and the actual amount incurred;
[0019] Based on the entity, the cost center, the account, the time, the budget amount, the actual amount incurred, the difference amount, and the difference percentage, generate business scenario text;
[0020] Generate permission tags based on the entity and the cost center.
[0021] Based on the first aspect, in some embodiments, dividing the XML information into multiple XML information blocks according to preset conditions includes:
[0022] Divide the data for each item in each cost center for each preset unit of time in the XML information into an XML block; or...
[0023] The XML information is divided into multiple XML information blocks according to the subject, with each subject corresponding to one XML information block.
[0024] Based on the first aspect, in some embodiments, converting the plurality of XML information blocks into vectors for storage to obtain a vector database includes:
[0025] Convert the business scenario text into a semantic search vector;
[0026] Category tags are generated based on the entity, the cost center, the subject, and the time; wherein the subjects in the category tags and the subjects in the XML information block are expressed in different forms.
[0027] The semantic search vector, the classification label, and the corresponding XML information block are associated and stored in the vector database.
[0028] Based on the first aspect, in some embodiments, obtaining the user's query information and determining the target XML information block from the vector database based on the query information includes:
[0029] Convert the user's query information into a query vector;
[0030] Search the vector database for a semantic search vector that matches the query vector to determine the target XML information block.
[0031] Based on the first aspect, in some embodiments, determining the user's permissions for the target XML information block based on the user account information includes:
[0032] The user's entity and cost center are determined based on the user account information;
[0033] If the entity in the permission tag of the target XML information block is the same as the entity the user is in, and the cost year center in the permission tag is the same as the cost center the user is in, then the user has permission to the target XML information block; otherwise, the user does not have permission to the target XML information block.
[0034] Based on the first aspect, in some embodiments, generating the response information for the query information based on the target XML information block includes:
[0035] Generate suggestion words based on the user's query information;
[0036] The response information for the query is generated based on the prompt words and the target XML information block.
[0037] Based on the first aspect, in some embodiments, generating prompt words based on the user's query information includes:
[0038] Determine the user's query intent and query area based on the user's query information;
[0039] Build user profiles based on users' historical query information;
[0040] Based on the user profile, the query intent, and the query domain, prompt words are generated.
[0041] Secondly, embodiments of this application provide an information query device based on a large model, including:
[0042] The data conversion module is used to convert raw data into XML information, which includes entities, cost centers, accounts, time, amount, permission tags, and business scenario text.
[0043] A segmentation module is used to divide the XML information into multiple XML information blocks according to preset conditions, wherein the preset conditions include at least one of cost center, subject and time.
[0044] The vector conversion module is used to convert the multiple XML information blocks into vectors for storage, thereby obtaining a vector database.
[0045] The information determination module is used to obtain the user's query information and determine the target XML information block from the vector database based on the query information.
[0046] The response module is used to determine the user's permissions for the target XML information block based on the user account information, and when the user has permissions for the target XML information block, to generate response information for the query information based on the target XML information block.
[0047] Thirdly, embodiments of this application provide a terminal device, including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the computer program, it implements the information query method based on a large model as described in any of the first aspects.
[0048] The beneficial effects of the embodiments of this application compared with the prior art include:
[0049] In this embodiment, the raw data is first converted into XML information, which includes entities, cost centers, accounts, time, amounts, permission tags, and business scenario text. Then, the XML information is divided into multiple XML information blocks according to preset conditions, which include at least one of cost centers, accounts, and time. Next, the multiple XML information blocks are converted into vectors and stored to obtain a vector database. When a user inputs a query, the target XML information block is determined from the vector database based on the query. Finally, the user's permissions for the target XML information block are determined based on the user's account information. When the user has permissions for the target XML information block, a response to the query is generated based on the target XML information block. This allows users to use natural language to flexibly, accurately, and securely query data from the data sharing center, bypassing the unreliable step of directly generating SQL. Attached Figure Description
[0050] To more clearly illustrate the technical solutions in the embodiments of this application, 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 this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0051] Figure 1 This is a flowchart illustrating the information query method based on a large model provided in an embodiment of this application;
[0052] Figure 2 This is a schematic diagram of the structure of the information query device based on a large model provided in the embodiments of this application;
[0053] Figure 3 This is a schematic diagram of the terminal device provided in the embodiments of this application. Detailed Implementation
[0054] The present application will be described more clearly below with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the function of the present application, but do not limit the present application in any way. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application. These all fall within the protection scope of the present application.
[0055] To make the objectives, technical solutions, and advantages of this application clearer, the following description will be provided in conjunction with the accompanying drawings and specific embodiments.
[0056] To make the objectives, technical solutions, and advantages of this application clearer, the following description will be provided in conjunction with the accompanying drawings and specific embodiments.
[0057] See Figure 1 The information query method based on a large model provided in this application embodiment may include the following steps:
[0058] Step 101: Convert the raw data into XML information.
[0059] The XML information includes entities, cost centers, accounts, time, amounts, permission tags, and business scenario text.
[0060] In some embodiments, step 101 may include: extracting entities, cost centers, accounts, times, and amounts from the raw data, wherein the amounts include budgeted amounts and actual amounts incurred; calculating the difference amount and difference percentage based on the budgeted amount and the actual amounts incurred; generating business scenario text based on the entities, cost centers, accounts, times, budgeted amounts, actual amounts incurred, difference amount, and difference percentage; and generating permission tags based on the entities and cost centers.
[0061] In this embodiment, the core purpose of converting raw data into XML information is to inject business semantics into the cold data, making the converted XML information searchable in natural language. Financial data will be used as an example for illustration.
[0062] The source data comes from a summary table in a data warehouse or ERP system, such as `fact_financial_data`. The original data behavior is ('Beijing', 'Travel', 202310, 500000, 480000, 'Sales'), where 'Beijing' represents the Beijing branch (corresponding to the entity mentioned above), 'Travel' represents travel expenses (corresponding to the item mentioned above), 202310 represents October 2023 (corresponding to the time mentioned above), 500000 represents a budgeted amount of 500000 (corresponding to the budgeted amount mentioned above), 480000 represents an actual amount incurred of 480000 (corresponding to the actual amount incurred above), and 'Sales' represents the sales department (corresponding to the cost center mentioned above). Based on this, the variance is calculated to be 20000 (savings of 20000), with a variance percentage of 4%. Then, permission tags, including department and region, are generated based on the entity and cost center. Based on the above, the converted XML information is as follows:
[0063] <financial_record>
[0064] <entity> Beijing Branch< / entity>
[0065] <cost_center> Sales Department< / cost_center>
[0066] <account_name>Travel expenses< / account_name>
[0067] <account_code> 660101< / account_code>
[0068] <period> October 2023< / period>
[0069] <budget_amount> 500000< / budget_amount>
[0070] <actual_amount> 480000< / actual_amount>
[0071] <variance_amount> -20000< / variance_amount>
[0072] <variance_percentage> -4%< / variance_percentage>
[0073] <description> The Beijing branch's sales department's travel expense budget execution in October 2023: The budget was 500,000 yuan, the actual expense was 480,000 yuan, resulting in a saving of 20,000 yuan, or 4%.< / description>
[0074] <security_tags>
[0075] <department> Sales< / department>
[0076] <region> North< / region>
[0077] < / security_tags>
[0078] < / financial_record>
[0079] In this data record, "Travel Expenses" is the account name, "660101" is the account code, "description" is the business scenario text, and "security_tags" are the permission tags (including department permission "Sales" and region permission "North"). The business scenario text uses complete natural language to describe this data record, greatly enriching its semantic information.
[0080] Step 102: Divide the XML information into multiple XML information blocks according to preset conditions.
[0081] The preset conditions include at least one of cost center, account and time.
[0082] In some embodiments, step 102 may include: dividing the data of each subject in each cost center for each preset unit time in the XML information into an XML block; or, dividing the XML information into multiple XML information blocks according to the subject, with each subject corresponding to one XML information block.
[0083] For example, data can be segmented by subject boundaries, such as dividing the data for each item in each cost center into a single XML block for each month. Alternatively, for master data (e.g., a chart of accounts), each item can be divided into a separate XML block. These are just examples; XML information can also be divided into multiple XML blocks based on other criteria.
[0084] Step 103: Convert the multiple XML information blocks into vectors for storage to obtain a vector database.
[0085] In some embodiments, step 103 may include: converting the business scenario text into a semantic search vector; generating classification tags based on the entity, the cost center, the subject, and the time; wherein the subjects in the classification tags and the subjects in the XML information block adopt different representation forms; and associating and storing the semantic search vector, the classification tags, and the corresponding XML information blocks in a vector database.
[0086] For example, the BERT model can be used to transform business scenario text into a high-dimensional, semantically rich vector. For instance, converting business scenario text into a 384-dimensional or 768-dimensional vector might place it in a high-dimensional space, close to concepts such as "financial report," "budget execution," "travel expenses," "savings," and "branch office." It captures the overall meaning of the text, rather than specific numbers.
[0087] For example, key structured information can be extracted from business scenario text and organized into a fixed-length numerical vector. For instance, this vector could be [organization code, department code, year, month, budget amount, actual amount incurred, savings amount, savings percentage], and the final vector could be [1, 2, 2023, 10, 500000, 480000, 20000, 0.04], where 1 represents the branch office number and 2 represents the department number.
[0088] Category tags are generated based on the entity, cost center, account, and time. Category tags can be generated by combining the entity, cost center, account, and time. For example, the category tags could be { "entity": "Beijing", "account": "Travel", "period": "202310", "security_department": "Sales", "security_region": "North"}.
[0089] After obtaining the vector and category tags of the business scenario text, the semantic search vector, category tags, and XML information blocks of the business scenario text are stored in the vector database, and a unique identifier is assigned. For example, in the vector database, the storage format is as follows:
[0090] ID (unique identifier): "fin_record_123"
[0091] Vector (Semantic Search Vector): [...] (by...) <description>(This is obtained by vectorizing the text concatenated with the text from other fields.)
[0092] Content (XML information block): "The entire XML string"
[0093] Metadata (category tags): { "entity": "Beijing", "account": "Travel", "period": "202310", "security_department": "Sales", "security_region": "North"}.
[0094] Furthermore, the categories in the category tags and the categories in the XML information blocks use different expressions, which can cover various synonyms that users may use, thereby improving the accuracy of user query matching. For example, for travel expenses, multiple expressions such as "travel expenses" and "travel" are used to cover various synonyms that users may use.
[0095] Step 104: Obtain the user's query information and determine the target XML information block from the vector database based on the query information.
[0096] In some embodiments, step 104 may include: converting the user's query information into a query vector; searching the vector database for a semantic search vector that matches the query vector to determine the target XML information block.
[0097] For a specific implementation of converting user query information into query vectors, please refer to step 103, which involves converting business scenario text into semantic search vectors. The BERT model is used to convert user query information into high-dimensional, semantically meaningful vectors, or to extract key structured information from user query information and organize it into a fixed-length numerical vector.
[0098] For a vector database, an index can be built for each XML information block. Similar XML information blocks can be grouped into a branch based on category labels, thus forming a tree-structured index. After obtaining the vector corresponding to the user's query information, the first similarity between the vector corresponding to the user's query information and each branch is calculated; the second similarity between the vector corresponding to the user's query information and the voice search vectors of each XML information block in the branch with the highest first similarity is calculated; the XML information block with the highest second similarity is determined as the target information block.
[0099] Step 105: Determine the user's permissions for the target XML information block based on the user account information. When the user has permissions for the target XML information block, generate the response information for the query information based on the target XML information block.
[0100] In some embodiments, said determining the user's permission to the target XML information block based on the user account information may comprise: determining the entity and cost center that the user belongs to according to said user account information; if the entity in the permission label of the target XML information block is the same as the entity the user belongs to, and the cost center in the permission label is the same as the cost center the user belongs to, then the user has permission to said target XML information block; otherwise, the user does not have permission to said target XML information block.
[0101] For example, before returning a result, the system matches the user identity information (i.e., user account information, for example, user_department = "Sales", user_region = "North") with the permission label security_tags in the target XML information block to ensure data security. After confirmation, the hit target XML information block is placed into a prompt generator, and response information corresponding to the user's query information is generated by the prompt generator.
[0102] In some embodiments, said generating response information for the query information according to said target XML information block may comprise: generating a prompt according to the user's query information; and generating the response information for the query information according to said prompt and said target XML information block.
[0103] By way of example, said generating a prompt according to the user's query information may comprise: determining the user's query intention and query field according to the user's query information; constructing a user portrait according to the user's historical query information; generating a prompt according to said user portrait, said query intention and said query field.
[0104] For example, the user's query information is "Has the travel expense of our department exceeded the budget in October?", and the prompt generated by the prompt generator according to the query information is:
[0105] You are a financial analyst. Please answer the user's question accurately based on the following financial data:
[0106] <Financial Data>
[0107] <financial_record>...Sales Department 1, Beijing Branch...October 2023...travel expense...budget 500,000...actual 480,000...< / financial_record>
[0108] < / Financial Data>
[0109] The user's query information is: Has the travel expense of our department exceeded the budget in October?
[0110] First, determine whether it's an overspending or a cost-saving measure, then provide the key data. Keep your answer concise and professional.
[0111] The final response message was: "No overspending. Your department (Beijing Branch Sales Department) had a travel expense budget of 500,000 yuan for October 2023, and actually incurred 480,000 yuan, saving 20,000 yuan, a saving rate of 4%."
[0112] In this embodiment of the application, the business scenario text in the XML information block <description>and subjects<account_name> Fields like these bridge the gap between users' natural language and structured data. Even if a user's query is phrased as "...Did we overspend?" without directly mentioning "budget" or "actual," the business context text effectively conveys the message. <description>It contains a complete description of the business scenario, which enables semantic matching to succeed.
[0113] It should be noted that steps 101 to 103 can be completed offline in advance, while steps 104 to 105 can be completed online.
[0114] The above-mentioned information retrieval method based on large models has the following advantages:
[0115] 1. Empower business users and improve efficiency: Finance and business personnel do not need to learn SQL or complex reporting tools. They can directly obtain the required financial information by asking questions, which greatly speeds up decision-making.
[0116] 2. Revolutionary improvement in query accuracy: The answers are based on accurate, permission-filtered underlying data, avoiding SQL generation errors. At the same time, LLM can provide concise and professional answers after understanding the financial context.
[0117] 3. Naturally integrated data security: By adding permission tag filtering before and after vector retrieval, flexible and mandatory row-level data security control can be achieved, which is difficult to do by directly generating SQL.
[0118] 4. Flexible handling of long-tail queries: It solves the problem of large-scale, fragmented and personalized data query needs that cannot be met by pre-made reports, reducing the report development pressure on IT and financial analysis departments.
[0119] 5. Unified query portal: Financial data, budget data, financial system policies, etc. can all be queried through this system, which serves as a unified intelligent financial Q&A portal, improving user experience.
[0120] 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 this application.
[0121] Corresponding to the information query method based on a large model described in the above embodiments, Figure 2 The diagram shows a structural block diagram of an information query device based on a large model provided in an embodiment of this application. For ease of explanation, only the parts related to the embodiments of this application are shown.
[0122] See Figure 2 This application provides an information query device based on a large model, including a data conversion module 201, a partitioning module 202, a vector conversion module 203, an information determination module 204, and a response module 205.
[0123] The data conversion module 201 is used to convert the raw data into XML information, which includes entities, cost centers, accounts, time, amount, permission tags, and business scenario text.
[0124] The segmentation module 202 is used to divide the XML information into multiple XML information blocks according to preset conditions, wherein the preset conditions include at least one of cost center, subject and time.
[0125] The vector conversion module 203 is used to convert the multiple XML information blocks into vectors for storage, thereby obtaining a vector database.
[0126] The information determination module 204 is used to obtain the user's query information and determine the target XML information block from the vector database based on the query information.
[0127] The response module 205 is used to determine the user's permissions for the target XML information block based on the user account information, and when the user has permissions for the target XML information block, it generates response information for the query information based on the target XML information block.
[0128] Optionally, the data conversion module 201 can be specifically used to: extract entities, cost centers, accounts, time, and amounts from the original data, wherein the amounts include budgeted amounts and actual amounts incurred; calculate the difference amount and difference percentage based on the budgeted amount and the actual amounts incurred; generate business scenario text based on the entities, cost centers, accounts, time, budgeted amounts, actual amounts incurred, difference amount, and difference percentage; and generate permission tags based on the entities and cost centers.
[0129] Optionally, the partitioning module 202 can be used to: partition the data of each subject in each cost center for each preset unit time in the XML information into an XML block; or, partition the XML information into multiple XML information blocks according to the subject, with each subject corresponding to an XML information block.
[0130] Optionally, the vector conversion module 203 can be specifically used to: convert the business scenario text into a semantic search vector; generate classification tags based on the entity, the cost center, the subject, and the time; wherein the subject in the classification tag and the subject in the XML information block adopt different representation forms; and associate and store the semantic search vector, the classification tag, and the corresponding XML information block in a vector database.
[0131] Optionally, the information determination module 204 can be specifically used to: convert the user's query information into a query vector; search the vector database for a semantic search vector that matches the query vector, and determine the target XML information block.
[0132] Optionally, determining the user's permissions for the target XML information block based on the user account information includes: determining the entity and cost center where the user is located based on the user account information; if the entity in the permission tag of the target XML information block is the same as the entity where the user is located, and the cost center in the permission tag is the same as the cost center where the user is located, then the user has permissions for the target XML information block; otherwise, the user does not have permissions for the target XML information block.
[0133] Optionally, generating response information for the query information based on the target XML information block includes: generating prompt words based on the user's query information; and generating response information for the query information based on the prompt words and the target XML information block.
[0134] Optionally, generating prompt words based on the user's query information includes: determining the user's query intent and query domain based on the user's query information; constructing a user profile based on the user's historical query information; and generating prompt words based on the user profile, the query intent, and the query domain.
[0135] Figure 3 This is a schematic diagram of a terminal device provided in an embodiment of the present invention. Figure 3 As shown, the terminal device 300 of this embodiment includes a processor 310 and a memory 320. The memory 320 stores a computer program that can run on the processor 310, such as an information query program based on a large model. When the processor 310 executes the computer program, it implements the steps in the above-described embodiment of the information query method based on a large model, for example... Figure 1 As shown in 101 to 105. Alternatively, when the processor 310 executes the computer program, it implements the functions of each module / unit in the above-described device embodiments, for example... Figure 2 The functions of modules 201 to 205 are shown.
[0136] For example, the computer program can be divided into one or more modules / units, which are stored in the memory 320 and executed by the processor 310 to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the terminal device 300. For example, the computer program can be divided into a data conversion module, a partitioning module, a vector conversion module, an information determination module, and a response module.
[0137] The terminal device 300 can be a desktop computer, laptop, handheld computer, cloud server, or other computing device. The terminal device may include, but is not limited to, a processor 310 and a memory 320. Those skilled in the art will understand that... Figure 3 This is merely an example of terminal device 300 and does not constitute a limitation on terminal device 300. It may include more or fewer components than shown, or combine certain components, or different components. For example, the terminal device may also include input / output devices, network access devices, buses, etc.
[0138] The processor 320 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0139] The memory 320 can be an internal storage unit of the terminal device 300, such as a hard disk or memory of the terminal device 300. The memory 320 can also be an external storage device of the terminal device 300, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the terminal device 300. Furthermore, the memory 320 can include both internal and external storage units of the terminal device 300. The memory 320 is used to store the computer program and other programs and data required by the terminal device. The memory 320 can also be used to temporarily store data that has been output or will be output.
[0140] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.< / description> < / description> < / description>
Claims
1. An information retrieval method based on a large model, characterized in that, include: The raw data is converted into XML information, which includes entities, cost centers, accounts, time, amount, permission tags and business scenario text. The raw data is financial data, which comes from summary tables in data warehouses or ERP systems. The XML information is divided into multiple XML information blocks according to preset conditions, and the preset conditions include at least one of cost center, subject and time. The multiple XML information blocks are converted into vectors and stored to obtain a vector database; Obtain the user's query information, and determine the target XML information block from the vector database based on the query information; The user's permissions for the target XML information block are determined based on the user account information. When the user has permissions for the target XML information block, response information for the query information is generated based on the target XML information block. The process of converting raw data into XML information includes: extracting entities, cost centers, accounts, time, and amounts from the raw data, wherein the amounts include budgeted amounts and actual amounts incurred; calculating the difference amount and difference percentage based on the budgeted amount and the actual amounts incurred; generating business scenario text based on the entities, cost centers, accounts, time, budgeted amounts, actual amounts incurred, difference amount, and difference percentage; and generating permission tags based on the entities and cost centers; wherein the business scenario text uses complete natural language to describe this data record. The step of dividing the XML information into multiple XML information blocks according to preset conditions includes: dividing the data of each subject of each cost center for each preset unit time in the XML information into an XML block; or, dividing the XML information into multiple XML blocks according to subjects, with each subject corresponding to one XML block; The step of converting the multiple XML information blocks into vectors for storage to obtain a vector database includes: converting the business scenario text into semantic search vectors; generating classification tags based on the entity, the cost center, the subject, and the time; wherein the subjects in the classification tags and the subjects in the XML information blocks adopt different representation forms; and associating and storing the semantic search vectors, the classification tags, and the corresponding XML information blocks in the vector database. For the vector database, an index is built for each XML information block. Similar XML information blocks are set in a branch according to the classification label to form a tree index. After obtaining the vector corresponding to the user's query information, the first similarity between the vector corresponding to the user's query information and each branch is calculated. The second similarity between the vector corresponding to the user's query information and the semantic search vector of each XML information block in the branch with the highest first similarity is calculated. The XML information block with the highest second similarity is determined as the target information block.
2. The information query method based on a large model according to claim 1, characterized in that, The step of obtaining the user's query information and determining the target XML information block from the vector database based on the query information includes: Convert the user's query information into a query vector; Search the vector database for a semantic search vector that matches the query vector to determine the target XML information block.
3. The information query method based on a large model according to claim 1, characterized in that, The step of determining the user's permissions for the target XML information block based on the user account information includes: The user's entity and cost center are determined based on the user account information; If the entity in the permission tag of the target XML information block is the same as the entity the user is in, and the cost year center in the permission tag is the same as the cost center the user is in, then the user has permission to the target XML information block; otherwise, the user does not have permission to the target XML information block.
4. The information query method based on a large model according to claim 1, characterized in that, The step of generating the response information based on the target XML information block includes: Generate suggestion words based on the user's query information; The response information for the query is generated based on the prompt words and the target XML information block.
5. The information query method based on a large model according to claim 4, characterized in that, The step of generating prompts based on the user's query information includes: Determine the user's query intent and query area based on the user's query information; Build user profiles based on users' historical query information; Based on the user profile, the query intent, and the query domain, prompt words are generated.
6. An information query device based on a large model, characterized in that, include: The data conversion module is used to convert raw data into XML information. The XML information includes entities, cost centers, accounts, time, amount, permission tags and business scenario text. The raw data is financial data, which comes from summary tables in data warehouses or ERP systems. A segmentation module is used to divide the XML information into multiple XML information blocks according to preset conditions, wherein the preset conditions include at least one of cost center, subject and time. The vector conversion module is used to convert the multiple XML information blocks into vectors for storage, thereby obtaining a vector database. The information determination module is used to obtain the user's query information and determine the target XML information block from the vector database based on the query information. The response module is used to determine the user's permissions for the target XML information block based on the user account information, and when the user has permissions for the target XML information block, to generate response information for the query information based on the target XML information block; The data transformation module is specifically used for: extracting entities, cost centers, accounts, times, and amounts from the original data, where the amounts include budgeted amounts and actual amounts incurred; calculating the difference amount and difference percentage based on the budgeted amount and the actual amount incurred; generating business scenario text based on the entities, cost centers, accounts, times, budgeted amounts, actual amounts incurred, difference amount, and difference percentage; and generating permission tags based on the entities and cost centers. The business scenario text uses complete natural language to describe this data record. The partitioning module is specifically used to: partition the data of each subject in each cost center for each preset unit time in the XML information into an XML block; or, partition the XML information into multiple XML information blocks according to the subject, with each subject corresponding to one XML block; The vector conversion module is specifically used to: convert the business scenario text into a semantic search vector; generate classification tags based on the entity, the cost center, the subject, and the time; wherein the subject in the classification tag and the subject in the XML information block adopt different representation forms; and associate and store the semantic search vector, the classification tag, and the corresponding XML information block in the vector database. For the vector database, an index is built for each XML information block. Similar XML information blocks are set in a branch according to the classification label to form a tree index. After obtaining the vector corresponding to the user's query information, the first similarity between the vector corresponding to the user's query information and each branch is calculated. The second similarity between the vector corresponding to the user's query information and the semantic search vector of each XML information block in the branch with the highest first similarity is calculated. The XML information block with the highest second similarity is determined as the target information block.
7. A terminal device, comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the information query method based on a large model as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Data retrieval method and system based on large language model
CN116701431A
Prompt information determination method and device, storage medium and electronic equipment
CN117669589A
Input instruction enhancement method and device, equipment, storage medium and program product
CN118364076A
Enterprise knowledge base query method based on large language model
CN119719345A
Deepseek-R1 dialogue question answering method based on RAG
CN120561218A