Table processing method, device and equipment based on intelligent agent and storage medium

The agent-based table processing method solves the problems of complex operation of traditional spreadsheet software and low flexibility in automation tools by determining the Schema definition and generating prompt word templates, using the agent to process the table, and realizes the natural language dialogue to complete table operations and data analysis, improving user experience and efficiency.

CN120257964AInactive Publication Date: 2025-07-04BEIJING FENGQING TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510741067.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-05
Publication Date
2025-07-04
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional spreadsheet software requires users to have professional skills to complete complex operations, high learning costs, low flexibility in existing automation tools, and inability to accurately understand users' natural language needs, resulting in poor user experience.

Method used

Through the agent-based table processing method, the target Schema definition corresponding to the table processing problem is determined, the prompt word template is generated, and the agent is used to process the table to realize natural language dialogue to complete table operations and data analysis.

Benefits of technology

It significantly lowers the technical threshold, and users can easily complete complex Excel tasks through natural language, improve user experience and operation efficiency, and improve the processing ability of complex table structures and support for cross-table related queries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120257964A_ABST
    Figure CN120257964A_ABST
Patent Text Reader

Abstract

The invention discloses an agent-based table processing method, device and equipment and a storage medium, and relates to the technical field of large language models and data process.The method comprises the steps that when a table processing problem corresponding to a to-be-processed table is received, a target Schema definition corresponding to the table processing problem is determined, the target Schema definition comprises a table building statement corresponding to the table to be processed; generating a first cue word template based on the table processing problem and the target Schema definition; and according to the cue word template, processing the table to be processed through the first intelligent agent to obtain a table processing result corresponding to the table processing problem. According to the technical scheme, the problem that data analysis and processing of traditional spreadsheet software are high in learning cost is solved, and the problems that an existing automatic tool is low in flexibility and cannot accurately understand the natural language requirement of a user are solved. Common table operation and data analysis tasks can be completed through natural language dialogues, the technical threshold is remarkably reduced, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical fields of large language models and data processing, and particularly to an agent-based table processing method, apparatus, device, and storage medium. Background Art

[0002] Traditional spreadsheet software (such as Microsoft Excel) is widely used in fields such as data analysis, table processing, and financial statements. However, for most users, using functions such as complex formulas, data processing, and statistical analysis in spreadsheets requires relatively high professional skills. Users often need to learn how to use specific functions, complex operation processes, and even write VBA scripts to complete specific tasks. For non-technical users, this learning cost and operation complexity significantly limit work efficiency.

[0003] Some existing automation tools can help some users perform simple table operations, but most rely on fixed rules or command patterns, lack flexibility and intelligence, and cannot accurately and effectively understand the natural language requirements of users, resulting in a poor user experience. Summary of the Invention

[0004] The present invention provides an agent-based table processing method, apparatus, device, and storage medium, enabling users to easily complete complex Excel tasks through natural language.

[0005] According to one aspect of the present invention, an agent-based table processing method is provided, the method comprising:

[0006] When receiving a table processing problem corresponding to a table to be processed, determining a target Schema definition corresponding to the table processing problem, wherein the target Schema definition includes a table creation statement corresponding to the table to be processed;

[0007] Generating a first prompt word template based on the table processing problem and the target Schema definition;

[0008] According to the first prompt word template, processing the table to be processed through a first agent to obtain a table processing result corresponding to the table processing problem.

[0009] According to another aspect of the present invention, an agent-based table processing apparatus is provided, the apparatus comprising:

[0010] A target Schema definition determination module, configured to determine a target Schema definition corresponding to a table processing problem when receiving the table processing problem corresponding to a table to be processed, wherein the target Schema definition includes a table creation statement corresponding to the table to be processed;

[0011] The first prompt template generation module is used to generate the first prompt template based on the table processing problem and the target Schema definition;

[0012] The table to be processed module is used to process the table to be processed by the first agent according to the first prompt template to obtain the table processing result corresponding to the table processing problem.

[0013] According to another aspect of the present invention, there is provided an electronic device, the electronic device includes:

[0014] At least one processor;

[0015] And a memory communicatively connected to the at least one processor; wherein,

[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the agent-based table processing method according to any embodiment of the present invention.

[0017] According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement the agent-based table processing method according to any embodiment of the present invention when executed.

[0018] In the technical solution of the embodiment of the present invention, when receiving a table processing problem corresponding to a table to be processed, the target Schema definition corresponding to the table processing problem is determined, where the target Schema definition includes a table creation statement corresponding to the table to be processed; a first prompt template is generated based on the table processing problem and the target Schema definition; according to the prompt template, the table to be processed is processed by the first agent to obtain the table processing result corresponding to the table processing problem. This technical solution solves the problems that the data analysis and processing of traditional spreadsheet software have a high learning cost, and the existing automation tools have low flexibility and cannot accurately understand the natural language requirements of users. It realizes that common table operations and data analysis tasks can be completed through natural language conversations, significantly reducing the technical threshold and improving the user experience.

[0019] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. Brief Description of the Drawings

[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0021] Figure 1 Flowchart of a method for processing tables based on an agent provided by an embodiment of the present invention;

[0022] Figure 2 Flowchart of another method for processing tables based on an agent provided by an embodiment of the present invention;

[0023] Figure 3 Flowchart of constructing a Schema definition provided by an embodiment of the present invention;

[0024] Figure 4 Flowchart of yet another method for processing tables based on an agent provided by an embodiment of the present invention;

[0025] Figure 5 Schematic diagram of modification, query, and revocation provided by an embodiment of the present invention;

[0026] Figure 6 Flowchart of a preferred embodiment provided by an embodiment of the present invention;

[0027] Figure 7 Schematic diagram of the structure of a device for processing tables based on an agent provided by an embodiment of the present invention;

[0028] Figure 8 Schematic diagram of the structure of an electronic device for implementing the method for processing tables based on an agent in the embodiments of the present invention. Detailed implementation manners

[0029] In order to enable those skilled in the art to better understand the solutions of the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0030] It should be noted that the terms "first", "second", etc. in the description, claims and above-mentioned drawings of the present invention are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present invention described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0031] Figure 1 FIG. is a flowchart of a table processing method based on an agent provided by an embodiment of the present invention. This embodiment is applicable to the situation of parsing a user's natural language into table processing instructions, and then processing the table and returning a processing result. This method can be executed by a table processing device based on an agent. The device can be implemented in the form of hardware and / or software, and the device can be configured in an electronic device, such as a server or a PC. As Figure 1 shown, the method specifically includes the following steps:

[0032] S110. When receiving a table processing problem corresponding to a table to be processed, determine a target Schema definition corresponding to the table processing problem.

[0033] Among them, the table to be processed can be the table that needs to be processed currently. The table processing problem can be a natural language problem proposed by the user to perform processing on the table. For example, the table processing problem is "query the data in column A of the table to be processed and sum", or "modify the data in cell B2 of the table to be processed to 100", etc. The specific content of the table processing problem in this embodiment is not limited.

[0034] Among them, the target Schema definition refers to the information reflecting the structural content of the table to be processed. Exemplarily, the Schema definition describes which columns (fields) are included in the table, the data type of each column (such as text, number, date, etc.), whether there are constraint conditions (such as non-null, unique, etc.), and other information related to the table structure. Different tables to be processed correspond to different target Schema definitions. The purpose of determining the target Schema definition in this embodiment is to accurately understand and process the table processing problems proposed by the user based on this target Schema subsequently.

[0035] In an embodiment of the present invention, the target Schema definition includes a table creation statement corresponding to the table to be processed. Specifically, the structural content of the table to be processed can be expressed through the table creation statement, and the table creation statement can be a Data Definition Language (DDL) table creation statement, for example, a CREATE TABLE statement.

[0036] Specifically, when a table processing problem sent by the user is received, the table to be processed, that is, the table to be processed, can be determined according to the table processing problem. Then, the target Schema definition corresponding to the table to be processed is determined. In this way, according to the target Schema definition, the first intelligent agent can accurately understand and process the table processing problem proposed by the user.

[0037] S120. Generate a first prompt word template based on the table processing problem and the target Schema definition.

[0038] Among them, the content of the first prompt word template includes but is not limited to the table processing problem and the corresponding target Schema definition. For example, it can also include some text instructions. The first prompt word template can guide the first intelligent agent to perform an operation corresponding to the table processing problem on the table to be processed. For example, a query operation, a modification operation, an analysis and statistics operation.

[0039] S130. Process the table to be processed through the first intelligent agent according to the first prompt word template to obtain a table processing result corresponding to the table processing problem.

[0040] Among them, the first intelligent agent can be understood as a large language model with thinking behavior and tool calling capabilities; the table processing result refers to the result obtained after processing the table to be processed. For example, the table processing result is a part of the data in the table to be processed, and it can also be a summary statistical value.

[0041] Specifically, the first prompt word template can be used to guide the first intelligent agent to process the table to be processed. The first intelligent agent can understand the instructions and the target Schema definition in the first prompt word template, and then perform corresponding operations on the table to be processed. After the execution is completed, a processing result, that is, a table processing result corresponding to the table processing problem, can be obtained.

[0042] The technical solution of the embodiment of the present invention, when receiving a table processing problem, determines the table to be processed corresponding to the table processing problem and the target Schema definition of the table to be processed, where the target Schema definition includes a table creation statement corresponding to the table to be processed; generates a first prompt word template based on the table processing problem and the target Schema definition; processes the table to be processed through the first intelligent agent according to the first prompt word template to obtain a table processing result corresponding to the table processing problem.

[0043] The technical solution of the embodiment of the present invention can solve the problems that traditional spreadsheet software requires users to use specific functions, complex operation processes, and even write VBA scripts to complete specific tasks, resulting in low efficiency, and the existing automation tools have low flexibility and cannot accurately understand the natural language requirements of users. This technical solution defines the semantics of tables and fields through DDL table creation language to obtain the target Schema definition, enabling the data and business meanings of tables to be clearly expressed in a standardized manner, improving the clarity of the table data structure, and enabling the large language model to more efficiently and accurately understand the intentions of users. It realizes that common table operations and data analysis tasks can be completed through natural language conversations, significantly reducing the technical threshold and improving the user experience.

[0044] Figure 2 FIG. is a flowchart of another agent-based table processing method provided by an embodiment of the present invention. On the basis of the above embodiment, this embodiment can pre-construct and store the candidate Schema definitions corresponding to each table to be used, and then directly search for the target Schema definition that matches the table processing problem. As Figure 2 shown, the method specifically includes the following steps:

[0045] S210. Receive at least one table to be used uploaded by the user, and traverse the sheets of the table to be used to determine whether the key data structure in the table to be used is complete.

[0046] Among them, the table to be used can be an Excel table uploaded by the user. The table to be used can include multiple sheets, and the number of tables to be used is one or more. The user can upload the Excel table that needs to be processed this time, or upload other tables that may be used subsequently.

[0047] Exemplarily, when it is necessary to process Table 1 currently, Table 1 can be uploaded, or other tables other than Table 1 can be uploaded at the same time. It should also be noted that the table to be processed can be a certain table to be used.

[0048] Among them, the key data structure includes at least one of the table header and column definitions of the table to be used.

[0049] Specifically, receive one or more tables to be used uploaded by the user. For a table containing multiple sheets, these sheets can be traversed one by one. During the traversal of each sheet, it can be determined whether the key data structure in the sheet is complete. For example, check whether there is a table header, and whether the table header clearly and accurately describes the data meaning or business meaning of each column.

[0050] In some embodiments, when the data key structure is incomplete, the missing content corresponding to the data key structure can be determined to generate a rhetorical question; the answer result corresponding to the rhetorical question is received, and the missing content of the data key structure is supplemented based on the answer result to make the data key structure complete.

[0051] Specifically, if it is found that the data key structure is incomplete, for example, the necessary table headers are missing, etc. It is possible to analyze and determine what specific content is missing, and then generate one or more rhetorical questions according to the missing content to ask the user for the missing information. The user can answer the rhetorical questions and provide the missing data key structure information. Further, the missing part of the data key structure is automatically supplemented according to the user's answer result to make the data key structure complete.

[0052] It should also be noted that when existing automated tools encounter a table without a table header, they can not only not process the headless table, but also the accuracy of generating query instructions is relatively low. In this embodiment, the business meaning in the table can be intelligently completed through multiple rounds of conversations. That is, when a table without a table header or a field with ambiguous business meaning is detected, a reverse inquiry is automatically sent to the user to clarify the unclear part, ensuring that the large language model can accurately understand the business meaning of each table and field. This clarification interaction greatly improves the processing ability of complex table structures.

[0053] S220. When the data key structure is complete, construct a second prompt template, and according to the second prompt template, generate a candidate Schema definition corresponding to the table to be used through a second intelligent agent.

[0054] Among them, the second prompt template is used to guide the second intelligent agent to understand the content and structure of the table and generate a suitable Schema definition accordingly. The second intelligent agent can also be a large language model, and the second intelligent agent can generate a candidate Schema definition.

[0055] Specifically, on the basis of the complete data structure, a second prompt template can be constructed, and then the constructed second prompt template is input into the second intelligent agent. The second intelligent agent analyzes the content and structure of the table to be used according to the information in the second prompt template and generates a Schema definition corresponding to the table as a candidate Schema definition.

[0056] It should also be noted that a table to be used can correspond to a candidate Schema definition. The candidate Schema definition is similar to the target Schema definition and also includes a table creation statement. However, its table creation statement is the table creation statement corresponding to the table to be used, reflecting the structural content of the table to be used.

[0057] In some embodiments, constructing a second prompt template, and based on the second prompt template, generating candidate Schema definitions corresponding to the tables to be used through a second intelligent agent may include: obtaining table data examples and corresponding table creation statement examples; constructing the second prompt template based on the table data examples and the table creation statement examples; guiding the second intelligent agent to generate table creation statements corresponding to each table to be used through the second prompt template, and using the table creation statements as candidate Schema definitions.

[0058] It can be understood that, in order to automatically generate candidate Schema definitions that match the tables to be used, that is, Schema in the form of table creation statements. This embodiment can construct a second prompt template based on the table data examples and the table creation statement examples, and guide the second intelligent agent to automatically generate candidate Schema based on the second prompt template.

[0059] Specifically, a part or all of the data in the table to be used uploaded by the user can be extracted as table data examples. For example, the first five rows of the table to be used. At the same time, provide corresponding table creation statement examples for the table data examples. Among them, the table creation statement examples can show how to represent the structure of the table data examples with DDL table creation statements.

[0060] Furthermore, construct a second prompt template based on the table data examples and the table creation statement examples, and then input the second prompt template into the second intelligent agent. The second intelligent agent generates table creation statements corresponding to the table to be used according to the information in the second prompt template, and uses the generated table creation statements as candidate Schema definitions.

[0061] In some embodiments, in order to solve the technical problem in the prior art that cross-table association queries cannot be supported, foreign key associations can also be defined in the table creation statements, where the foreign key associations are used to associate the same columns or different columns corresponding to the tables to be used.

[0062] Specifically, if there are the same or related column names between different sheets, define foreign key associations in the table creation statements. In this way, the association relationships between two or more columns with the same column name, and the association relationships between two or more columns with different column names but essentially related can be recorded in the table creation statements. When performing queries on the table to be processed using the target Schema definition composed of the table creation statements later, cross-table association queries can be realized.

[0063] S230. Store each candidate Schema definition in the long-term memory storage.

[0064] Specifically, after obtaining the candidate Schema definitions corresponding to each table to be used, the candidate Schema definitions can be stored in the long-term memory storage. In this way, when encountering a table to be processed later, the target Schema definition matching the table to be processed can be directly obtained from the long-term memory storage to construct the first prompt template.

[0065] Figure 3 FIG. is a flowchart for constructing a Schema definition provided by an embodiment of the present invention. Among them, the second prompt template used in this process can be:

[0066] As an SQL expert, you need to parse the first few rows of data in the following Excel table into DDL table creation statements. Please ensure that the field types in each table are reasonable and generate a CREATE TABLE statement for each table. If it is found that there are the same or related column names between different sheets, establish a foreign key association to ensure the correct relationship between them. For a table without a header, please directly reply to the user "The schema definition is unclear and needs to be completed". The following are the first few rows of data in the table for your reference:

[0067] [Table data example 1]

[0068] [Table data example 2]

[0069] Please output standard SQL DDL table creation statements to ensure that the foreign key constraints and data associations between all tables can be correctly generated.

[0070] Convert the two sheets in the table into table creation statements

[0071] CREATE TABLE sales_data (

[0072] id INT PRIMARY KEY AUTO_INCREMENT COMMENT 'Column A, unique identifier',

[0073] country_code VARCHAR(10) COMMENT 'Column B, country code',

[0074] region_code VARCHAR(10) COMMENT 'Column C, region code',

[0075] sales DECIMAL(10, 2) COMMENT 'Column D, sales amount',

[0076] sales_manager_name VARCHAR(100) COMMENT 'Column E, sales manager name',

[0077] FOREIGN KEY (country_code) REFERENCES name_code(code) COMMENT 'Associate country code with name',

[0078] FOREIGN KEY (region_code) REFERENCES name_code(code) COMMENT 'Associate region code with name'

[0079] ) COMMENT='Sheet1, Sales data table, including country code, region code and sales volume information';

[0080] CREATE TABLE name_code (

[0081] code VARCHAR(10) PRIMARY KEY COMMENT 'Column A, country or region code',

[0082] name VARCHAR(100) COMMENT 'Column B, country or region name',

[0083] type VARCHAR(32) COMMENT 'Column C, code type, country or region, country, region'

[0084] ) COMMENT='Sheet2, Name code table, storing the codes of countries and regions and their corresponding names'.

[0085] S240. When receiving a table processing problem, use the natural semantic processing module to perform intent recognition on the table processing problem to obtain the intent recognition result.

[0086] Specifically, when receiving a table processing problem raised by the user, the natural semantic processing module can be used to analyze the semantics of the problem and understand the user's true intent. For example, whether the user wants to query, filter, sort the table, or perform other more complex operations.

[0087] S250. According to the intent recognition result, obtain the candidate Schema definition that matches the intent recognition result from the long-term memory storage as the target Schema definition.

[0088] Specifically, according to the obtained intent recognition result, the candidate Schema definition that matches it can be found from the long-term memory storage and used as the target Schema definition.

[0089] Exemplarily, when the user's table processing problem is "query the data in column C of Table 1", at this time, through the analysis of the natural semantic processing module, the intention recognition result can be obtained as Table 1 and query the data in column C. Furthermore, it can be determined that a query operation is to be performed on Table 1, and the candidate Schema definition matching Table 1 can be searched from the long-term memory storage as the target Schema definition.

[0090] S260. Generate a first prompt word template based on the table processing problem and the target Schema definition.

[0091] S270. According to the first prompt word template, process the table to be processed through the first agent to obtain the table processing result corresponding to the table processing problem.

[0092] The technical solution of the embodiment of the present invention can pre-construct and store the candidate Schema definitions corresponding to each table to be used, and then directly search for the target Schema definition matching the table processing problem, improving the determination efficiency of the target Schema definition and the processing efficiency of the table to be processed. Secondly, in the case where the key data structure is incomplete, the missing content corresponding to the key data structure can be determined to generate a rhetorical question; receive the answer result corresponding to the rhetorical question, and supplement the missing content of the key data structure based on the answer result to make the key data structure complete, solving the problem that existing automated tools not only cannot process the table without a header, but also the accuracy of the corresponding generated query instructions is relatively low, ensuring that the large language model can accurately understand the business meaning of each table and field. This clarification interaction greatly improves the processing ability of complex table structures. In addition, to solve the technical problem that cross-table association queries cannot be supported in the prior art, foreign key associations can also be defined in the table creation statement to associate the same columns or different columns corresponding to the tables to be used. When performing a query on the table to be processed using the target Schema definition composed of the table creation statement subsequently, cross-table association queries can be realized.

[0093] Figure 4 This is a flowchart of another table processing method based on an agent provided by an embodiment of the present invention. On the basis of the above embodiment, this embodiment details the specific processing process of the table to be processed. As Figure 4 shown, the method specifically includes the following steps:

[0094] S310. When receiving a table processing problem corresponding to the table to be processed, determine the target Schema definition corresponding to the table processing problem.

[0095] Among them, the target Schema definition includes a table creation statement corresponding to the table to be processed.

[0096] S320. Generate a first prompt template based on the table processing problem and the target Schema definition.

[0097] S330. Determine the type of processing operation for the table processing problem, where the type of processing operation is a query operation or a modification operation.

[0098] Specifically, when receiving a table processing problem related to the table to be processed, it is first necessary to determine the type of processing operation for this problem. Query operations mainly retrieve information from the table, while modification operations mainly add, delete, or update table data.

[0099] S340. In the case where the type of processing operation is a query operation, based on the first prompt template, guide the first intelligent agent to generate a query statement.

[0100] S350. Execute a query operation on the table to be processed based on the query statement, and obtain the query result as the table processing result.

[0101] Specifically, if it is determined that the type of processing operation is a query operation, the first prompt template can be used to guide the first intelligent agent to generate a query statement, such as an SQL query statement. The first intelligent agent can use this query statement to retrieve the required data from the table to be processed. After the query operation is completed, the query result can be obtained and returned to the user as the final table processing result.

[0102] It can be understood that the target Schema definition in the embodiments of the present invention is essentially a table creation statement, which can accurately represent the structural content of the data table to be processed, improving the clarity of the data structure. The large language model can more efficiently understand the user's intention. Furthermore, accurate processing of the data table to be processed can be achieved. In addition, both the table creation statement and SQL are commonly used statements in database operations. Based on the first prompt template including the table creation statement, the large language model can automatically and more accurately generate SQL query statements, improving the subsequent processing efficiency and accuracy of the table. At the same time, users no longer need to master complex Excel functions or syntax.

[0103] S360. In the case where the type of processing operation is a modification operation, based on the first prompt template, guide the first intelligent agent to perform a modification operation on the table to be processed to obtain a modification result.

[0104] S370. Use the modification result as the table processing result.

[0105] If it is determined that the processing operation type is a modification type, the first intelligent agent can be guided based on the first prompt word template to perform corresponding modification operations on the table to be processed, such as adding new data, deleting old data, or updating existing data. After the modification operation is completed, a modification result can be obtained, and this modification result is used as the table processing result and returned to the user.

[0106] In some embodiments, the context information corresponding to the table processing problem can also be stored through the dialogue management module; when receiving the target problem to be processed for the table to be processed, a third prompt word template is generated based on the context information and the target problem to be processed; the table to be processed is processed based on the third prompt word template and the first intelligent agent to obtain the table processing result corresponding to the target problem to be processed.

[0107] In the embodiments of the present invention, the dialogue management module further enhances the intelligent performance. It can maintain context information during the dialogue process and support multi-round dialogue operations. After the user performs a certain operation, subsequent instructions can be issued based on the result of the previous operation without re-specifying the context data. For example, after the user calculates the sum of a certain column, the user can then issue an instruction of "sort the results in ascending order", and the operation data of the previous time can be automatically recognized and the sorting operation can be performed. This context-aware ability greatly improves the user's operation fluency and efficiency.

[0108] Among them, the context information includes at least one of the target Schema definition, query statement, query result, modification operation, and modification result corresponding to the table processing problem; the target problem to be processed can be understood as a new problem proposed by the user after the table processing problem is processed, and the table to be processed corresponding to the target problem to be processed can be the same table.

[0109] When receiving the target problem to be processed, compared with the table processing problem, the two are different operations for the same table. Therefore, when processing the target problem to be processed, the target Schema definition of the table processing problem that has been queried can be used. At this time, for the multi-round dialogue function of context awareness, information such as the query statement, query result, modification operation, and modification result corresponding to the table processing problem can be used as context information, and then a third prompt word template is generated.

[0110] Furthermore, the third prompt word template is input into the first intelligent agent, and the first intelligent agent can perform operations corresponding to the target problem to be processed on the table to be processed and also consider the context information.

[0111] In this way, not only can single-step operations be performed, but also multi-round dialogues can be understood and operations can be performed according to the context, enabling the user to perform continuous and dynamic operations.

[0112] In a preferred embodiment, the present invention not only preserves the dialogue context generated during the dialogue, but also introduces a long-term memory function to ensure that part of the data and operations generated at each step are retained. Specifically, the present invention can save multiple versions of a DataFrame (data frame) and record the history of each step of the redo operation. This design enables users to handle instructions such as "undo the previous operation" or "return to a certain historical node" in multi-turn conversations, greatly enhancing the flexibility of operations and the controllability of data management. Through this mechanism, users can easily roll back, modify, or restore data without having to repeat complex operations. Among them, the DataFrame is a two-dimensional, tabular data structure. As Figure 5 shown, it is a schematic diagram of modification, query, and cancellation provided by an embodiment of the present invention.

[0113] Figure 6 It is a flowchart of a preferred embodiment provided by an embodiment of the present invention. As Figure 6 shown,

[0114] During the conversation with Excel, the natural language processing module will distinguish whether it is a data modification operation or a data query operation according to the user's intention. The specific prompt words are as follows:

[0115] As an SQL expert, the following is the known Schema definition

[0116] CREATE TABLE sales_data (

[0117] id INT PRIMARY KEY AUTO_INCREMENT COMMENT 'Column A, unique identifier',

[0118] country_code VARCHAR(10) COMMENT 'Column B, country code',

[0119] region_code VARCHAR(10) COMMENT 'Column C, region code',

[0120] sales DECIMAL(10, 2) COMMENT 'Column D, sales amount',

[0121] sales_manager_name VARCHAR(100) COMMENT 'Column E, sales manager name',

[0122] FOREIGN KEY (country_code) REFERENCES name_code(code) COMMENT 'Associate country code with name',

[0123] FOREIGN KEY (region_code) REFERENCES name_code(code) COMMENT 'Associate region code with name'

[0124] ) COMMENT='Sheet1, Sales data table, including country code, region code and sales volume information';

[0125] CREATE TABLE name_code (

[0126] code VARCHAR(10) PRIMARY KEY COMMENT 'Column A, country or region code',

[0127] name VARCHAR(100) COMMENT 'Column B, country or region name',

[0128] type VARCHAR(32) COMMENT 'Column C, code type, country or region, country, region'

[0129] ) COMMENT='Sheet2, Name code table, storing the codes of countries and regions and their corresponding names';

[0130] Combined with the user's Q&A

[0131]

[0132] Dialogue context

[0133]

[0134] Dataframe context

[0135]

[0136] Execute specific actions,

[0137] For query operations, generate SQL statements and query data from the Dataframe,

[0138] For modification operations, perform Excel cell operations to change data,

[0139] In addition to the Schema being retained as a long-term record in the prompt, the context of the conversation is also retained in the prompt. For query operations, the natural language processing module mainly generates SQL statements to query data from the current Dataframe, so no Redo and Undo logs are generated. The intent of the operation type is parsed into Redo and Undo logs and saved in the data_context. Therefore, when a situation like "cancel the previous modification operation" occurs, the Dataframe can be quickly rolled back through the Undo log, enabling multi-turn conversations while also allowing for data undo operations.

[0140] Figure 7 FIG. is a schematic structural diagram of an agent-based table processing device provided by an embodiment of the present invention. As Figure 7 shown, the device includes:

[0141] A target Schema definition determination module 410, configured to determine a target Schema definition corresponding to a table processing problem when receiving a table processing problem corresponding to a table to be processed, where the target Schema definition includes a table creation statement corresponding to the table to be processed;

[0142] A first prompt template generation module 420, configured to generate a first prompt template based on the table processing problem and the target Schema definition;

[0143] A table to be processed module 430, configured to process the table to be processed through a first agent according to the first prompt template to obtain a table processing result corresponding to the table processing problem.

[0144] In some embodiments, the agent-based table processing device further includes a Schema definition construction module, and the Schema definition construction module includes:

[0145] A structural integrity judgment sub-module, configured to receive at least one table to be used uploaded by a user and traverse the sheets of the table to be used to judge whether the key data structure in the table to be used is complete before determining the target Schema definition corresponding to the table processing problem, where the key data structure includes at least one of the table header and column definitions of the table to be used;

[0146] A candidate Schema definition generation sub-module, configured to construct a second prompt template in the case of a complete key data structure, and generate a candidate Schema definition corresponding to the table to be used through a second agent according to the second prompt template;

[0147] A storage sub-module, configured to store each candidate Schema definition in a long-term memory storage.

[0148] In some embodiments, the candidate Schema definition generation sub-module is specifically configured to:

[0149] Obtain an example of table data and an example of a table creation statement corresponding to the example of table data;

[0150] Construct a second prompt template based on the example of table data and the example of the table creation statement;

[0151] Through the second prompt template, guide the second intelligent agent to generate table creation statements for each table to be used, and use the table creation statements as candidate Schema definitions.

[0152] In some embodiments, the candidate Schema definition generation sub-module is further configured to:

[0153] Define foreign key associations in the table creation statement, where the foreign key associations are used to associate the same columns or different columns corresponding to the tables to be used.

[0154] In some embodiments, the Schema definition construction module further includes a rhetorical question sub-module, and the rhetorical question sub-module is specifically configured to:

[0155] In the case where the critical data structure is incomplete, determine the missing content corresponding to the critical data structure to generate a rhetorical question;

[0156] Receive the answer result corresponding to the rhetorical question, and supplement the missing content of the critical data structure based on the answer result to make the critical data structure complete.

[0157] In some embodiments, the target Schema definition determination module 410 is specifically configured to:

[0158] Perform intent recognition on the table processing problem through the natural semantic processing module to obtain an intent recognition result;

[0159] According to the intent recognition result, obtain the candidate Schema definition that matches the intent recognition result from the long-term memory storage as the target Schema definition.

[0160] In some embodiments, the table to be processed processing module 430 includes:

[0161] An operation type determination sub-module, configured to determine the processing operation type of the table processing problem, where the processing operation type is a query operation or a modification operation;

[0162] A query operation sub-module, configured to, in the case where the processing operation type is a query operation, guide the first intelligent agent to generate a query statement based on the first prompt template;

[0163] Execute a query operation on the table to be processed based on the query statement, and obtain a query result as the table processing result.

[0164] In some embodiments, the table to be processed processing module 430 further includes a modification operation sub-module, which is used for:

[0165] In the case where the processing operation type is a modification operation, based on the first prompt word template, guide the first agent to perform a modification operation on the table to be processed to obtain a modification result;

[0166] Use the modification result as the table processing result.

[0167] In some embodiments, the table to be processed processing module 430 further includes a context sub-module, which is specifically used for:

[0168] Store the context information corresponding to the table processing problem through the dialogue management module, where the context information includes at least one of the target Schema definition, query statement, query result, modification operation, and modification result corresponding to the table processing problem;

[0169] When receiving the target problem to be processed for the table to be processed, generate a third prompt word template based on the context information and the target problem to be processed;

[0170] Process the table to be processed based on the third prompt word template and the first agent to obtain the table processing result corresponding to the target problem to be processed.

[0171] The agent-based table processing device provided by the embodiments of the present invention can execute the agent-based table processing method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method.

[0172] Figure 8 Schematic diagram of the structure of an electronic device for implementing the agent-based table processing method of the embodiments of the present invention. The electronic device is intended to represent various forms of digital computers, such as, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are only examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0173] As Figure 8As shown, the electronic device 10 includes at least one processor 11 and a memory communicatively connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc. Among them, the memory stores a computer program executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.

[0174] Multiple components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disc, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0175] The processor 11 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include but are not limited to a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the agent-based table processing method.

[0176] In some embodiments, the agent-based table processing method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the agent-based table processing method described above can be executed. Alternatively, in other embodiments, the processor 11 can be configured to execute the agent-based table processing method in any other appropriate manner (e.g., by means of firmware).

[0177] The various embodiments of the systems and techniques described above in this specification can be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems-on-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that receives data and instructions from, and transmits data and instructions to, a storage system, at least one input device, and at least one output device.

[0178] The computer programs for implementing the methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions / operations specified in the flowchart and / or block diagram to be implemented. The computer programs can be executed entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.

[0179] In the context of the present invention, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0180] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the electronic device. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0181] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), blockchain network, and the Internet.

[0182] The computing system can include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system and solves the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services.

[0183] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in the present invention can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is made herein.

[0184] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. An agent-based table processing method, characterized in that, Including: When receiving a table processing problem corresponding to a table to be processed, determine a target Schema definition corresponding to the table processing problem, where the target Schema definition includes a table creation statement corresponding to the table to be processed; Generate a first prompt template based on the table processing problem and the target Schema definition; According to the first prompt template, process the table to be processed through a first agent to obtain a table processing result corresponding to the table processing problem.

2. The method according to claim 1, wherein Before determining the target Schema definition corresponding to the table processing problem, it further includes: Receive at least one table to be used uploaded by the user, traverse the sheets of the table to be used to determine whether the key data structure in the table to be used is complete, where the key data structure includes at least one of the table header and column definition of the table to be used; In the case where the key data structure is complete, construct a second prompt template, and according to the second prompt template, generate a candidate Schema definition corresponding to the table to be used through a second agent; Store each of the candidate Schema definitions in a long-term memory storage.

3. The method according to claim 2, characterized in that The constructing the second prompt template and generating a candidate Schema definition corresponding to the table to be used through the second agent according to the second prompt template includes: Obtain a table data example and a table creation statement example corresponding to the table data example; Construct a second prompt template based on the table data example and the table creation statement example; Through the second prompt template, guide the second agent to generate a table creation statement corresponding to each table to be used, and use the table creation statement as the candidate Schema definition.

4. The method according to claim 3, wherein It further includes: Define a foreign key association in the table creation statement, where the foreign key association is used to associate the same column or different columns corresponding to the table to be used.

5. The method according to claim 2, characterized in that, It further includes: In the case where the key data structure is incomplete, determine the missing content corresponding to the key data structure to generate a rhetorical question; Receive an answer result corresponding to the rhetorical question, and supplement the missing content of the key data structure based on the answer result to make the key data structure complete.

6. The method according to claim 2, characterized in that, The determining the target Schema definition corresponding to the table processing problem includes: Perform intent recognition on the table processing problem through a natural language processing module to obtain an intent recognition result; According to the intent recognition result, obtain a candidate Schema definition that matches the intent recognition result from the long-term memory storage as the target Schema definition.

7. The method according to claim 1, characterized in that The obtaining the table processing result corresponding to the table processing problem by processing the table to be processed through a first agent according to the first prompt template includes: Determine the processing operation type of the table processing problem, where the processing operation type is a query operation or a modification operation; In the case where the processing operation type is a query operation, guide the first agent to generate a query statement based on the first prompt template; Perform a query operation on the to-be-processed table based on the query statement, and obtain a query result as the table processing result.

8. The method according to claim 7, wherein It further includes: In the case where the processing operation type is a modification operation, based on the first prompt word template, guide the first intelligent agent to perform a modification operation on the to-be-processed table to obtain a modification result; Use the modification result as the table processing result.

9. The method according to claim 8, characterized in that, It further includes: Store the context information corresponding to the table processing problem through the dialogue management module, where the context information includes at least one of the target Schema definition corresponding to the table processing problem, the query statement, the query result, the modification operation, and the modification result; When receiving a target to-be-processed problem for the to-be-processed table, generate a third prompt word template based on the context information and the target to-be-processed problem; Based on the third prompt word template and the first intelligent agent, process the to-be-processed table to obtain the table processing result corresponding to the target to-be-processed problem.

10. An agent-based table processing device, characterized in that It includes: A target Schema definition determination module, configured to determine the target Schema definition corresponding to the table processing problem when receiving a table processing problem corresponding to the to-be-processed table, where the target Schema definition includes a table creation statement corresponding to the to-be-processed table; A first prompt word template generation module, configured to generate a first prompt word template based on the table processing problem and the target Schema definition; A to-be-processed table processing module, configured to process the to-be-processed table through a first intelligent agent according to the first prompt word template to obtain the table processing result corresponding to the table processing problem.

11. An electronic device, characterized in that, The electronic device includes: At least one processor; And a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the intelligent agent-based table processing method according to any one of claims 1-9.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions, and the computer instructions are used to cause the processor to implement the intelligent agent-based table processing method according to any one of claims 1-9 when executed.

Citation Information

Patent Citations

  • Intelligent knowledge platform driven by large model

    CN118296107A

  • Table question and answer method, system and equipment based on large model

    CN119046287A

  • Report generation method and device based on large model and electronic equipment

    CN119474108A

  • Data processing method and apparatus, electronic device and storage medium

    WO2025108189A1