Data analysis method and device, electronic equipment and computer program product
Through the multi-agent collaborative working mechanism, the problem that existing language models are difficult to understand the poor context and logical correlation in complex data analysis is solved, and efficient and accurate results generation of data analysis is achieved.
Patent Information
- Application Number
- CN202411658213.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2024-12-24
AI Technical Summary
Existing language models have difficulty accurately understanding the context in complex data analysis scenarios, resulting in deviations from the expected targets, poor logical correlation, and difficult to meet the user's requirements for complex data analysis.
Adopt the multi-agent collaborative working mechanism to obtain natural language requirements through proxying agents, analyze the agent's dismantling requirements as subtasks, retrieve the agent's reference code, debug the agent's debugging code, and the agent manager coordinates the tasks to ensure the generated The analysis results meet user needs.
It significantly improves the automation and intelligence level of data analysis process, ensures the accuracy and efficiency of results, and improves the effectiveness of data analysis.
Smart Images

Figure CN119179866A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more particularly to a method, device, electronic device and computer program product for data analysis. Background Art
[0002] In recent years, language models have played an increasingly important role in various fields. Not only have they demonstrated outstanding capabilities in natural language processing tasks, but they have also promoted changes in the way humans interact with machines. With the continuous advancement of technology, language models are gradually becoming a key driving force for the digital transformation of various industries.
[0003] In the field of data analysis, the use of language models has become increasingly common. With its powerful natural language processing capabilities, large language models help users quickly understand the deep meaning behind the data. With the improvement of model performance and the expansion of application scenarios, the application of language models in data analysis will become more in-depth and diversified. Summary of the invention
[0004] Embodiments of the present disclosure provide a method, apparatus, electronic device, and computer program product for data analysis.
[0005] According to the first aspect of the present disclosure, a method for data analysis is provided. The method includes obtaining analysis requirements in natural language form by an agent in a data analysis assistant, and the data analysis assistant also includes an agent manager, an analysis agent, a retrieval agent, and a debugging agent. The method also includes generating a subtask set by the analysis agent by disassembling the analysis requirements. The method also includes retrieving a reference code set related to the subtask set by the retrieval agent based on the subtask set. The method also includes generating a first code set corresponding to the subtask set by the analysis agent based on the subtask set and the reference code set. The method also includes generating a second code set by the debugging agent by debugging the first code set. In addition, the method also includes outputting the execution result by the agent in response to the agent manager determining that the execution result of the second code set meets the analysis requirements.
[0006] According to a second aspect of the present disclosure, a device for data analysis is provided. The device includes an analysis requirement acquisition module, which is configured to acquire the analysis requirement in natural language form by an agent in a data analysis assistant, and the data analysis assistant also includes an agent manager, an analysis agent, a retrieval agent, and a debugging agent. The device also includes a task set generation module, which is configured to generate a subtask set by the analysis agent by disassembling the analysis requirement. The device also includes a reference code retrieval module, which is configured to retrieve a reference code set related to the subtask set by the retrieval agent based on the subtask set. The device also includes a first code generation module, which is configured to generate a first code set corresponding to the subtask set by the analysis agent based on the subtask set and the reference code set. The device also includes a second code generation module, which is configured to generate a second code set by the debugging agent by debugging the first code set. In addition, the device also includes an execution result output module, which is configured to output the execution result by the agent in response to the agent manager determining that the execution result of the second code set meets the analysis requirement.
[0007] According to a third aspect of the present disclosure, an electronic device is provided, comprising a processor and a memory coupled to the processor, wherein the memory has instructions stored therein, and when the instructions are executed by the processor, the electronic device executes the method according to the first aspect.
[0008] In a fourth aspect of the present disclosure, a computer program product is provided. The computer program product is tangibly stored on a non-transitory computer readable medium and comprises computer executable instructions, which when executed cause a computer to perform the steps of the method of the first aspect of the present disclosure.
[0009] The purpose of this Summary is to introduce a selection of concepts in a simplified form that are further described in the Detailed Description below. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein: Figure 1 A schematic diagram showing an example environment in which devices and / or methods according to embodiments of the present disclosure may be implemented; Figure 2 A flow chart showing a method for data analysis according to an embodiment of the present disclosure is shown; Figure 3AA schematic diagram showing the workflow of a data analysis assistant according to an embodiment of the present disclosure; Figure 3B-Figure 3E A schematic diagram showing an example prompt word according to an embodiment of the present disclosure; Figure 4 A schematic diagram showing a process of retrieving a reference code according to an embodiment of the present disclosure; Figure 5 A block diagram showing a device for data analysis according to an embodiment of the present disclosure; and Figure 6 A block diagram of an electronic device according to an embodiment of the present disclosure is shown.
[0011] Throughout the drawings, the same or similar reference numbers denote the same or similar elements. DETAILED DESCRIPTION
[0012] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the type, scope of use, usage scenarios, etc. of the personal information (such as voice) involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0013] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0014] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. may refer to different or the same objects, unless explicitly stated. Other explicit and implicit definitions may also be included below.
[0015] As mentioned above, the use of language models to assist data analysis has become increasingly widespread. However, in related technologies, analysis code is usually generated by relying on a single language model. Although this has lowered the technical threshold for data analysis to a certain extent, it still has obvious shortcomings when dealing with complex data analysis scenarios. For example, the code generated by existing language models often makes it difficult to accurately understand the context of data analysis, resulting in deviations between the generated code and the expected goals. At the same time, the logical correlation in multi-step analysis tasks is poor and the error rate is high, making it difficult to meet the accuracy and reliability requirements of users for complex data analysis needs.
[0016] To this end, the embodiment of the present disclosure provides a data analysis solution, which is based on the collaborative work of multiple agents in the data analysis assistant. First, the user's natural language needs are obtained through the agent agent, and the analysis agent breaks down the needs into subtasks. Subsequently, the retrieval agent provides reference codes related to the subtasks, the analysis agent generates a corresponding code set, and the debugging agent executes the code and generates analysis results. The agent manager is responsible for coordinating the tasks of each agent to ensure that the generated analysis results meet the user's needs, and finally the agent agent displays the results to the user.
[0017] Therefore, according to the embodiments of the present disclosure, by introducing a multi-agent collaborative working mechanism, the automation and intelligence level of the data analysis process is significantly improved. The collaboration of multiple agents can effectively divide the work, so that each agent can dynamically adjust the task according to the demand, ensuring the efficient operation of the entire data analysis process and the accurate generation of results, thereby improving the effect of data analysis.
[0018] Figure 1 Schematic diagram of an example environment in which the device and / or method according to an embodiment of the present disclosure may be implemented. Figure 1 As shown, the example environment 100 may include a data analysis assistant 110, which may be deployed on a computing device, which may be a user terminal, a mobile device, a computer, etc., or a computing system, a single server, a distributed server, or a cloud-based server. The data analysis assistant 110 may include an agent manager 130, an agent agent 140, an analysis agent 150, a retrieval agent 160, and a debugging agent 170. An agent is an artificial intelligence system built on a language model. Through the training of deep learning technology, it can simulate human decision-making and actions and perform complex data analysis tasks. An agent usually includes three main parts: the control end is responsible for task planning and strategy formulation; the perception end is used to receive and parse external input information; and the action end performs specific operations according to the decision of the control end. As the core component of the agent, the language model provides the agent with understanding, reasoning and generation capabilities.
[0019] The data analysis assistant 110 can receive the analysis requirement 120 through the proxy agent 140. For example, the analysis requirement 120 can be an analysis requirement in the form of natural language input by the user. After receiving the analysis requirement, the data analysis assistant 110 can decompose the analysis requirement 120 through the analysis agent 150 to generate a set of subtasks. For example, the analysis agent 150 can split the analysis requirement 120 into several subtasks and formulate a preliminary task execution plan for each subtask. The task execution plan may include multiple steps, such as data collection, preprocessing, data analysis and result generation, to ultimately achieve the overall data analysis goal.
[0020] The data analysis assistant 110 can retrieve the reference code set related to each subtask based on the subtask set through the retrieval agent 160. For example, the retrieval agent 160 can search for code snippets that match or are similar to each subtask description from a preset database based on the task description in the subtask set to form a reference code set. The reference code set can be used as prompt content for subsequent code generation, thereby improving the efficiency and accuracy of code generation. The data analysis assistant 110 can generate a first code set corresponding to the subtask set based on the subtask set and the reference code set through the analysis agent 150. For example, the analysis agent 150 can input the task description in the subtask set and the code snippet in the reference code set as prompt words into the language model, and generate a corresponding code set based on these prompt words. The generated code may include SQL code for data query, Python code for data processing and visualization, etc.
[0021] The data analysis assistant 110 can debug the first code set through the debugging agent 170 to generate the second code set. For example, the debugging agent 170 can execute each code segment in the first code set in sequence, and correct the syntax errors, logic problems or parts that do not meet expectations in the code based on the execution results to generate an optimized second code set. The debugging process may include automated error detection and repair to ensure that the second code set can be executed correctly and meet the analysis requirements.
[0022] The data analysis assistant 110 can determine whether the execution result of the second code set meets the analysis requirement 120 through the agent manager 130, and if so, output the execution result 180 to the user through the agent agent 140. For example, the agent manager 130 can use a language model to analyze and judge the execution result of the second code set to determine whether it meets the user's analysis requirement. If the conditions are met, the agent agent 140 can present the analysis result to the user in a natural language form, thereby completing the entire data analysis process.
[0023] It should be understood that the architecture and functions in the example environment 100 are described for exemplary purposes only and do not imply any limitation on the scope of the present disclosure. Embodiments of the present disclosure may also be applied to other environments with different structures and / or functions.
[0024] The following will combine Figures 2 to 6 The process according to the embodiment of the present disclosure is described in detail. For ease of understanding, the specific data mentioned in the following description are exemplary and are not intended to limit the scope of protection of the present disclosure. It is understood that the embodiments described below may also include additional actions not shown and / or the actions shown may be omitted, and the scope of the present disclosure is not limited in this respect.
[0025] Figure 2 A flowchart of a method 200 for data analysis according to an embodiment of the present disclosure is shown. The method can be executed by a data analysis assistant deployed on a computing device, which can be a user terminal, a mobile device, a computer, etc., or a computing system, a single server, a distributed server, or a cloud-based server. At box 202, an analysis requirement in a natural language form can be obtained by an agent agent in the data analysis assistant, which also includes an agent manager, an analysis agent, a retrieval agent, and a debugging agent. For example, refer to Figure 1 The data analysis assistant 110 can obtain the analysis requirement 120 in natural language form through the agent agent 140. The data analysis assistant 110 also includes an agent manager 130, an analysis agent 150, a retrieval agent 160, and a debugging agent 170. At block 204, the analysis agent can generate a subtask set by disassembling the analysis requirement. For example, referring to Figure 1 The data analysis assistant 110 can generate a set of subtasks by decomposing the analysis requirements 120 through the analysis agent 150.
[0026] At block 206, a retrieval agent may retrieve a reference code set related to the subtask set based on the subtask set. Figure 1 , the data analysis assistant 110 can retrieve the reference code set related to the subtask set based on the subtask set through the retrieval agent 160. At block 208, the analysis agent can generate a first code set corresponding to the subtask set based on the subtask set and the reference code set. Figure 1 The data analysis assistant 110 can generate a first code set corresponding to the subtask set based on the subtask set and the reference code set through the analysis agent 150.
[0027] At block 210, a debugging agent may generate a second code set by debugging the first code set. Figure 1 , the data analysis assistant 110 can generate a second code set by debugging the first code set by the debugging agent 170. At block 212, in response to the agent manager determining that the execution result of the second code set meets the analysis requirements, the agent agent can output the execution result. Figure 1 The data analysis assistant 110 can determine through the agent manager 130 that the execution result of the second code set meets the analysis requirements, thereby outputting the execution result 180 through the proxy agent 140.
[0028] Therefore, according to the method 200 of the embodiment of the present disclosure, the automation and intelligence level of the data analysis process is significantly improved by introducing a multi-agent collaborative working mechanism. The collaboration of multiple agents can effectively divide the work, so that each agent can dynamically adjust the task according to the demand, ensuring the efficient operation of the entire data analysis process and the accurate generation of results, thereby improving the effect of data analysis.
[0029] Figure 3A FIG. 3 is a schematic diagram showing a workflow 300 of a data analysis assistant according to an embodiment of the present disclosure. Figure 3A As shown, the data analysis assistant 302 may include an agent manager 304, an agent 306, an analysis agent 308, a retrieval agent 310, and a debugging agent 312. The workflow of the data analysis assistant 302 can be divided into the following three stages: the first stage is the agent selection stage, in which the agent manager 304 selects a suitable agent to respond based on the input content and context information; the second stage is the agent response stage, in which the selected agent receives instructions and performs corresponding tasks, such as the agent receives the natural language requirements input by the user, the analysis agent decomposes the requirements into subtasks, the retrieval agent finds reference codes, and the debugging agent debugs and optimizes the generated code; the third stage is the broadcast message stage, in which the agent manager 304 broadcasts the output results of the selected agent to all agents to synchronize the system status and coordinate task execution.
[0030] In the whole process, multiple agents can interact dynamically based on task requirements, and the response order is intelligently specified by the agent manager 304 according to the context, rather than relying on a fixed order of calling. Through the above three-stage workflow, the data analysis assistant 302 can effectively improve the processing capability and execution efficiency of complex tasks. When the agent manager 304 determines that all tasks have been completed, the final result is returned to the user, ending the entire data analysis process, thereby achieving efficient collaboration between agents and intelligent processing of data analysis tasks.
[0031] refer to Figure 3AIn the first stage, the agent manager 304 can select an appropriate agent to respond to the user's analysis needs. For example, when the user inputs "analyze the correlation between the sales_amount field and the price field", the proxy agent 306 can pass the analysis requirement in natural language to the agent manager 304. The proxy agent 306 is mainly used to interact with the data analysis assistant 302 on behalf of the user. It can receive the user's input and send it to the agent manager 304 for further processing. In addition, the proxy agent 306 can also receive the analysis results on behalf of the user when the agent manager 304 selects it as the response agent, and restart the data analysis process when the user raises a new analysis requirement. The proxy agent 306 can include a language model, which can set its role through system prompts, such as "representing users who raise data-related issues and does not participate in problem analysis and code implementation."
[0032] When the agent manager 304 receives the user's analysis requirements, it can select a suitable agent to respond according to the requirements. For example, the agent manager 304 can convert the received analysis requirements into prompt words of the language model, and select the most suitable agent to perform the task based on the prompt words. In this example, the agent manager 304 can select the analysis agent 308 as the response agent, and the analysis agent 308 will parse the analysis requirements and break them down into multiple subtasks, thereby promoting the execution of the data analysis task.
[0033] In the first stage, when the agent manager 304 selects the analysis agent 308, the data analysis process enters the second stage. At this time, the analysis agent 308 can decompose the task according to the user analysis requirements transmitted by the proxy agent 306. To achieve task decomposition and code generation, the language model in the analysis agent 308 can be guided based on multiple prompt words to ensure that the generated tasks and codes can meet the expected requirements.
[0034] The language model prompt words in the analysis agent 308 may include the following multiple parts, which together constitute the prompt content of the analysis agent. The decomposition prompt words are used to instruct the language model to decompose the user's analysis requirements into multiple subtasks. For example, when the user inputs "analyze the correlation between the sales_amount field and the price field", the analysis agent 308 can decompose it into subtasks such as data acquisition, data preprocessing, correlation analysis and result visualization. Figure 3B An example of a decomposition prompt word 322 is shown, prompting the language model to decompose the user's request into 7 to 10 specific subtasks. Role prompt words are used to set the role positioning of the analysis agent, so that it can carry out tasks based on its role identity in the field of data analysis. Figure 3CAn example of a role-cue word 324 is shown, indicating that the language model acts as an experienced data scientist and is adept at handling various data analysis tasks.
[0035] Contextual prompts are used to indicate variables or context information that the analysis agent can call when generating code, to ensure that the generated code can accurately use the necessary context data and avoid code errors caused by missing variables. Figure 3D An example 326 of a contextual prompt word is shown, which instructs the language model to write code with reference to the returned variable list. In addition, the output prompt word is used to instruct the analysis agent to generate code in a predetermined format, so that the generated code meets specific grammar and format requirements. Figure 3E An example 328 of outputting a prompt word is shown, indicating that the language model should output code results in Markdown format.
[0036] In the second stage, after the analysis agent 308 generates a subtask set, the subtask set can be sent to the agent manager 304. Subsequently, the data analysis process enters the third stage. After receiving the subtask set, the agent manager 304 can broadcast the message to other agents to ensure that all agents have a consistent understanding of the current task. For example, when the subtask set generated by the analysis agent 308 is sent to the agent manager 304, the agent manager 304 can broadcast the subtask set to the proxy agent 306, the retrieval agent 310 and the debugging agent 312, so that each agent can perform subsequent processing and execution based on consistent task information. By broadcasting messages in the third stage, the agent manager 304 can coordinate the working status between the agents and achieve synchronization and collaboration of system tasks.
[0037] In some embodiments, when the agent manager determines that the execution result does not meet the analysis requirements, the analysis agent can be selected to re-disassemble the analysis requirements and / or regenerate the code. In some embodiments, the proxy agent can receive and attach new analysis requirements, and based on the execution results corresponding to the previous analysis requirements, further analyze the additional analysis requirements through multiple agents in the data analysis assistant. For example, after the execution results are returned to the user, the user can input new analysis requirements through the proxy agent, such as "analyze the fluctuation trend of the sales_amount field and the price field in different time periods", and the data analysis assistant can re-analyze the data based on the new analysis requirements and generate corresponding results.
[0038] The debugging agent 312 is located downstream of the data analysis assistant 302, and is mainly responsible for detecting, debugging and executing the code generated by the analysis agent 308. After the analysis agent 308 generates preliminary code (i.e., the first code set) based on user needs, the debugging agent 312 receives the code and detects it. If syntax errors or logic problems are found in the code during the detection process, the debugging agent 312 can correct the code and call the code execution interface to run the corrected code after the correction is completed. If errors still occur during the actual operation of the code, the language model in the debugging agent 312 can use its programming ability to analyze the root cause of the problem and further repair the code based on the error repair examples provided in the execution log and prompt words, thereby generating an optimized second code set. By detecting and debugging the code, the debugging agent 312 can significantly improve the executability and stability of the code, thereby ensuring that the generated code can be accurately executed and meet the expected analysis needs.
[0039] Figure 4 FIG. 4 is a schematic diagram showing a process 400 of retrieving a reference code according to an embodiment of the present disclosure. Figure 4 As shown, the process is initiated by the agent manager 402. For example, after the analysis agent sends the generated subtask set to the agent manager 402, the agent manager 402 can select the retrieval agent 404 to respond, and pass the text description corresponding to the subtask set to the retrieval agent 404 for processing. The user's analysis requirement may be "analyze the correlation between the sales_amount field and the price field", and the analysis agent will decompose it into multiple subtasks after parsing the requirement. The decomposed subtask set may include specific task descriptions such as "obtaining historical data of sales_amount and price", "calculating the correlation coefficient of sales_amount and price", and "generating a scatter plot reflecting the relationship between the two fields". The agent manager 402 passes the text description corresponding to the above subtasks to the retrieval agent 404, and the retrieval agent 404 searches for reference code snippets related to each subtask in the preset database based on these descriptions, thereby providing guidance and support for subsequent code generation.
[0040] After receiving the instruction from the agent manager 402, the retrieval agent 404 can send a request containing the text description of the subtask set to the vectorization interface 406. The vectorization interface 406 can process the received text and convert it into a corresponding vector representation. The vectorization interface 406 can map the semantic information in the text into the vector space based on the pre-trained vectorization model, thereby generating a task vector set representing the subtask set. For example, for the text descriptions in the aforementioned subtask set "obtaining historical data of sales_amount and price", "calculating the correlation coefficient of sales_amount and price", and "generating a scatter plot reflecting the relationship between the two fields", the vectorization interface 406 can generate three task vectors corresponding to these text descriptions respectively, thereby forming a task vector set.
[0041] After the vectorization interface 406 generates the task vector set, the set can be returned to the retrieval agent 404. The retrieval agent 404 receives the task vector set and matches it with the sample vector stored in the database 408. After the match is successful, the retrieval agent 404 can obtain the reference code corresponding to the matching sample vector from the database 408 and send the reference code to the agent manager 402. For example, for the subtask "obtaining historical data of sales_amount and price", the retrieval agent 404 can find historical task records similar to the subtask in the database and provide the corresponding executable code as a reference code to the agent manager 402. After receiving the reference code, the agent manager 402 can pass it to the analysis agent 308 to assist the analysis agent 308 in referring to and optimizing code snippets in the subsequent code generation process. It should be understood that the aforementioned examples of subtask sets and code matching are for illustrative purposes only and should not be regarded as limitations of the present disclosure.
[0042] Figure 5 FIG. 5 is a block diagram of a data analysis apparatus 500 according to some embodiments of the present disclosure. Figure 5 As shown, the device 500 includes an analysis requirement acquisition module 502, which is configured to acquire the analysis requirement in natural language form by the agent agent in the data analysis assistant, and the data analysis assistant also includes an agent manager, an analysis agent, a retrieval agent, and a debugging agent. The device 500 also includes a task set generation module 504, which is configured to generate a subtask set by the analysis agent by disassembling the analysis requirement. The device 500 also includes a reference code retrieval module 506, which is configured to retrieve a reference code set related to the subtask set by the retrieval agent based on the subtask set.
[0043] The apparatus 500 further includes a first code generation module 508, which is configured to generate a first code set corresponding to the subtask set based on the subtask set and the reference code set by the analysis agent. The apparatus 500 further includes a second code generation module 510, which is configured to generate a second code set by the debugging agent by debugging the first code set. In addition, the apparatus 500 further includes an execution result output module 512, which is configured to output the execution result by the proxy agent in response to the agent manager determining that the execution result of the second code set meets the analysis requirement.
[0044] Figure 6 A block diagram of an electronic device 600 is shown in accordance with certain embodiments of the present disclosure. Figure 6 1 shows a block diagram of an electronic device 600 according to some embodiments of the present disclosure, and the device 600 may be a device or apparatus described in an embodiment of the present disclosure. Figure 6 As shown, the device 600 includes a central processing unit (CPU) and / or a graphics processing unit (GPU) 601, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 602 or loaded from a storage unit 608 to a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The CPU / GPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604. Although not shown in FIG. Figure 6 As shown in FIG. 6 , device 600 may also include a co-processor.
[0045] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0046] The various methods or processes described above may be performed by the CPU / GPU 601. For example, in some embodiments, the methods may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the CPU / GPU 601, one or more steps or actions in the methods or processes described above may be performed.
[0047] In some embodiments, the methods and processes described above may be implemented as a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present disclosure.
[0048] Computer readable storage medium can be a tangible device that can hold and store instructions used by an instruction execution device. Computer readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive list) of computer readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a convex structure in a groove on which instructions are stored, and any suitable combination thereof. The computer readable storage medium used here is not interpreted as a transient signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated by a waveguide or other transmission medium (for example, a light pulse by an optical fiber cable), or an electrical signal transmitted by a wire.
[0049] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0050] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, and conventional procedural programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as a separate software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby implementing various aspects of the present disclosure.
[0051] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0052] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0053] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the equipment, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each frame in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the frame can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous frames can actually be executed substantially in parallel, and they can also be executed in the opposite order sometimes, depending on the functions involved. It should also be noted that each frame in the block diagram and / or flow chart, and the combination of frames in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0054] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
[0055] Some example implementations of the present disclosure are listed below.
[0056] Example 1. A method of data analysis, comprising: The agent agent in the data analysis assistant obtains the analysis requirements in the form of natural language, and the data analysis assistant also includes an agent manager, an analysis agent, a retrieval agent, and a debugging agent; The analysis agent generates a subtask set by decomposing the analysis requirement; The retrieval agent retrieves a reference code set related to the subtask set based on the subtask set; The analysis agent generates a first code set corresponding to the subtask set based on the subtask set and the reference code set; The debugging agent generates a second code set by debugging the first code set; and In response to the agent manager determining that the execution result of the second code set meets the analysis requirement, the proxy agent outputs the execution result.
[0057] Example 2. The method according to Example 1 further includes: In response to determining that the execution result does not meet the analysis requirement, the analysis agent re-disassembles the analysis requirement and / or regenerates a code set.
[0058] Example 3. The method according to any one of Examples 1-2, further comprising: The agent agent obtains additional analysis requirements in natural language; and Based on the execution results corresponding to the analysis requirements, the data analysis assistant analyzes the additional analysis requirements through multiple agents.
[0059] Example 4. The method of any one of Examples 1-3, wherein generating the second set of codes comprises: The debugging agent modifies the first code set by detecting the first code set; The first code set is executed by the debugging agent through a code execution interface; and The second set of codes is generated by the debugging agent based on an execution log of the execution.
[0060] Example 5. A method according to any one of Examples 1-4, wherein the debugging agent includes a language model, and the prompt words of the language model include error repair examples.
[0061] Example 6. The method according to any one of Examples 1-5, wherein retrieving the reference code set related to the subtask set comprises: Based on the subtask set, generating a subtask vector set by a vectorization model; and Based on the subtask vector set, the reference code set is retrieved from a database by vector matching.
[0062] Example 7. The method according to any one of Examples 1-6, wherein the analysis agent includes a language model, and the system prompt words of the language model include one or more of the following: A role prompt word indicating that the role setting of the analysis agent is related to data analysis; Context hints indicating variables that the analysis agent can call when generating code; A disassembly prompt word instructs the analysis agent to disassemble the analysis requirement into multiple subtasks; or Output prompt words to instruct the analysis agent to generate code according to a predetermined format.
[0063] Example 8. A method according to any one of Examples 1-7, wherein the agent manager includes a language model and is configured to use the language model to specify an agent.
[0064] Example 9. A data analysis device, comprising: An analysis requirement acquisition module is configured to acquire analysis requirements in natural language form by an agent in a data analysis assistant, wherein the data analysis assistant further includes an agent manager, an analysis agent, a retrieval agent, and a debugging agent; A task set generation module, configured to generate a subtask set by the analysis agent by decomposing the analysis requirements; A reference code retrieval module, configured to retrieve a reference code set related to the subtask set based on the subtask set by the retrieval agent; A first code generation module is configured to generate, by the analysis agent, a first code set corresponding to the subtask set based on the subtask set and the reference code set; A second code generation module is configured to generate a second code set by debugging the first code set by the debugging agent; and The execution result output module is configured to output the execution result by the proxy agent in response to the agent manager determining that the execution result of the second code set meets the analysis requirement.
[0065] Example 10. The apparatus according to Example 9 further includes: The re-analysis module is configured to, in response to determining that the execution result does not meet the analysis requirement, cause the analysis agent to re-disassemble the analysis requirement and / or regenerate a code set.
[0066] Example 11. The apparatus according to any one of Examples 9-10, further comprising: an additional requirement acquisition module, configured to acquire additional analysis requirements in natural language form from the agent; and The additional requirement analysis module is configured to analyze the additional analysis requirements by the data analysis assistant through multiple agents based on the execution results corresponding to the analysis requirements.
[0067] Example 12. The apparatus of any one of Examples 9-11, wherein the second code generation module comprises: A first code modification module is configured to modify the first code set by the debugging agent by detecting the first code set; A first code execution module, configured to execute the first code set by the debugging agent through a code execution interface; and The second code second generating module is configured to generate the second code set based on the execution log of the execution by the debugging agent.
[0068] Example 13. The apparatus according to any one of Examples 9-12, wherein the debugging agent includes a language model, and the prompt words of the language model include error repair examples.
[0069] Example 14. The apparatus of any one of Examples 9-13, wherein the reference code retrieval module comprises: A task vector generation module, configured to generate a subtask vector set from a vectorized model based on the subtask set; and The second reference code retrieval module is configured to retrieve the reference code set from the database through vector matching based on the subtask vector set.
[0070] Example 15. The apparatus according to any one of Examples 9-14, wherein the analysis agent comprises a language model, and the system prompt words of the language model comprise one or more of the following: A role prompt word indicating that the role setting of the analysis agent is related to data analysis; Context hints indicating variables that the analysis agent can call when generating code; A disassembly prompt word instructs the analysis agent to disassemble the analysis requirement into multiple subtasks; or Output prompt words to instruct the analysis agent to generate code according to a predetermined format.
[0071] Example 16. An apparatus according to any of Examples 9-15, wherein the agent manager includes a language model and is configured to use the language model to specify an agent.
[0072] Example 17. An electronic device comprising: Processor; and A memory coupled to the processor, the memory having instructions stored therein, wherein when the instructions are executed by the processor, the electronic device performs actions, the actions comprising: The agent agent in the data analysis assistant obtains the analysis requirements in the form of natural language, and the data analysis assistant also includes an agent manager, an analysis agent, a retrieval agent, and a debugging agent; The analysis agent generates a subtask set by decomposing the analysis requirement; The retrieval agent retrieves a reference code set related to the subtask set based on the subtask set; The analysis agent generates a first code set corresponding to the subtask set based on the subtask set and the reference code set; The debugging agent generates a second code set by debugging the first code set; and In response to the agent manager determining that the execution result of the second code set meets the analysis requirement, the proxy agent outputs the execution result.
[0073] Example 18. The electronic device according to Example 17, further comprising: In response to determining that the execution result does not meet the analysis requirement, the analysis agent re-disassembles the analysis requirement and / or regenerates a code set.
[0074] Example 19. The electronic device of any one of Examples 17-18 further comprising: The agent agent obtains additional analysis requirements in natural language; and Based on the execution results corresponding to the analysis requirements, the data analysis assistant analyzes the additional analysis requirements through multiple agents.
[0075] Example 20. The electronic device of any of Examples 17-19, wherein generating the second set of codes comprises: The debugging agent modifies the first code set by detecting the first code set; The first code set is executed by the debugging agent through a code execution interface; and The second set of codes is generated by the debugging agent based on an execution log of the execution.
[0076] Example 21. An electronic device according to any one of Examples 17-20, wherein the debugging agent includes a language model, and the prompt words of the language model include error repair examples.
[0077] Example 22. The electronic device of any of Examples 17-21, wherein retrieving the set of reference codes related to the set of subtasks comprises: Based on the subtask set, generating a subtask vector set by a vectorization model; and Based on the subtask vector set, the reference code set is retrieved from a database by vector matching.
[0078] Example 23. An electronic device according to any one of Examples 17-22, wherein the analysis agent includes a language model, and the system prompt words of the language model include one or more of the following: A role prompt word indicating that the role setting of the analysis agent is related to data analysis; Context hints indicating variables that the analysis agent can call when generating code; A disassembly prompt word instructs the analysis agent to disassemble the analysis requirement into multiple subtasks; or Output prompt words to instruct the analysis agent to generate code according to a predetermined format.
[0079] Example 24. An electronic device according to any of Examples 17-23, wherein the agent manager includes a language model and is configured to specify an agent using the language model.
[0080] Example 25. A computer-readable storage medium having one or more computer instructions stored thereon, wherein the one or more computer instructions are executed by a processor to implement the method according to any one of Examples 1 to 8.
[0081] Example 26. A computer program product tangibly stored on a computer-readable medium and comprising computer-executable instructions that, when executed by a device, cause the device to perform the method according to any one of Examples 1 to 8.
[0082] Although the disclosure has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Instead, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A method for data analysis, comprising: The agent agent in the data analysis assistant obtains the analysis requirements in the form of natural language, and the data analysis assistant also includes an agent manager, an analysis agent, a retrieval agent, and a debugging agent; The analysis agent generates a subtask set by decomposing the analysis requirement; The retrieval agent retrieves a reference code set related to the subtask set based on the subtask set; The analysis agent generates a first code set corresponding to the subtask set based on the subtask set and the reference code set; The debugging agent generates a second code set by debugging the first code set; as well as In response to the agent manager determining that the execution result of the second code set meets the analysis requirement, the proxy agent outputs the execution result.
2. The method according to claim 1, further comprising: In response to determining that the execution result does not meet the analysis requirement, the analysis agent re-disassembles the analysis requirement and / or regenerates a code set.
3. The method according to claim 1, further comprising: The agent agent obtains additional analysis requirements in natural language form; as well as Based on the execution results corresponding to the analysis requirements, the data analysis assistant analyzes the additional analysis requirements through multiple agents.
4. The method of claim 1 , wherein generating the second set of codes comprises: The debugging agent modifies the first code set by detecting the first code set; The debugging agent executes the first code set through a code execution interface; as well as The second set of codes is generated by the debugging agent based on an execution log of the execution. 5 . The method according to claim 4 , wherein the debugging agent comprises a language model, and the prompt words of the language model comprise error repair examples.
6. The method of claim 1, wherein retrieving the reference code set associated with the subtask set comprises: Based on the subtask set, a subtask vector set is generated by a vectorization model; as well as Based on the subtask vector set, the reference code set is retrieved from a database by vector matching.
7. The method according to claim 1, wherein the analysis agent comprises a language model, and the system prompt words of the language model comprise one or more of the following: A role prompt word indicating that the role setting of the analysis agent is related to data analysis; Context hints indicating variables that the analysis agent can call when generating code; A disassembly prompt word instructs the analysis agent to disassemble the analysis requirement into multiple subtasks; or Output prompt words to instruct the analysis agent to generate code according to a predetermined format.
8. The method of claim 1, wherein the agent manager includes a language model and is configured to utilize the language model to specify an agent.
9. A data analysis device, comprising: An analysis requirement acquisition module is configured to acquire analysis requirements in natural language form by an agent in a data analysis assistant, wherein the data analysis assistant further includes an agent manager, an analysis agent, a retrieval agent, and a debugging agent; A task set generation module, configured to generate a subtask set by the analysis agent by decomposing the analysis requirements; A reference code retrieval module, configured to retrieve a reference code set related to the subtask set based on the subtask set by the retrieval agent; A first code generation module is configured to generate, by the analysis agent, a first code set corresponding to the subtask set based on the subtask set and the reference code set; A second code generation module is configured to generate a second code set by debugging the first code set by the debugging agent; as well as The execution result output module is configured to output the execution result by the proxy agent in response to the agent manager determining that the execution result of the second code set meets the analysis requirement.
10. An electronic device comprising: processor; as well as A memory coupled to the processor, the memory having instructions stored therein, wherein when the instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 8.
11. A computer program product tangibly stored on a non-transitory computer readable medium and comprising computer executable instructions for performing the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Intelligent data analysis system and method based on intelligent agent
CN116975042A
Natural language intelligent query method and device based on multi-agent interaction
CN118012900A
Data analysis system based on multi-agent cooperation
CN118210828A
Method and device for evaluation, electronic equipment and computer program product
CN118708921A
Rule base updating method and equipment based on large model and intelligent agent
CN118839001A
Cited By
Method and system for intelligent computing center cloud platform to realize agent self-evolution through computing power
CN120276712A
Method and system for realizing self-evolution of intelligent agents through computing power on the intelligent computing center cloud platform
CN120276712B
Computing device and method for synthesizing code to generate training data
CN120524999A
Multi-agent collaborative data visualization analysis method, equipment and medium
CN120744000A
Data analysis method and device based on multi-agent cooperation and storage medium
CN121073371A
