Code generation method and device based on multi-intelligence collaboration, medium and equipment

By adopting a multi-agent collaborative code generation method in the development of software code in the astronomical field, the problems of cumbersome search, inapplicable tools, and difficult to guarantee code effectiveness in the existing technology are solved, and efficient and stable code generation is achieved.

CN119960742AInactive Publication Date: 2025-05-09ZHEJIANG LAB

Patent Information

Application Number
CN202510444798.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-05-09
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing technology has problems such as cumbersome search, inapplicable tools, and difficult to guarantee code effectiveness in software code development in the field of astronomy, resulting in low development efficiency and poor code stability.

Method used

The code generation method based on multi-agent collaboration is adopted. By obtaining the description information input by the user, the feature vector is extracted using a large language model, decomposed into multiple subtasks and assigned to different agents (retrieval agents, code generation agents, etc.) to finally generate the software code required by the user.

Benefits of technology

The automated code generation process is realized, which improves development efficiency and code stability, and reduces the risk of manual operations and errors of users in code development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119960742A_ABST
    Figure CN119960742A_ABST
Patent Text Reader

Abstract

The invention discloses a code generation method and device based on multi-agent collaboration, a medium and equipment, and the method comprises the steps: obtaining description information input by a user, inputting the description information into a preset large language model to determine a feature vector corresponding to the description information, inputting the feature vector into a task agent, and generating a code corresponding to the task agent; the method comprises the following steps: determining each sub-task for executing a required code generation task, sending task information of a retrieval sub-task in each sub-task to a retrieval agent through a task agent so as to retrieve target knowledge information required by the code generation task, and sending the target knowledge information to the retrieval agent through the task agent so as to retrieve the target knowledge information required by the code generation task. And sending the target knowledge information and task information corresponding to at least one code block generation sub-task contained in each sub-task to a code generation agent, so as to finally generate a software code required by a user. According to the method and the device, the knowledge required for generating the software code can be automatically retrieved, the software code is automatically generated, the generation efficiency of the software code is improved, and the stability of the generated software code is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the fields of astronomical research and artificial intelligence, and in particular to a code generation method, device, medium and equipment based on multi-agent collaboration. Background Art

[0002] Astronomical research requires the collection, calculation and data processing of large amounts of data to promote the gradual improvement and development of astronomical theory. In this process, these tasks need to be performed through software codes specially developed for astronomical research institutes.

[0003] However, there are currently the following difficulties in software development for the astronomical field: 1. The development of software codes in the field of astronomy relies on a large number of academic papers, research results, formulas and calculation methods, but the retrieval of this information is usually very cumbersome, and often requires manual reading of a large number of journals, papers and databases, etc. This is not only time-consuming and labor-intensive, but also difficult to ensure that there will be no omissions in the search, which has an adverse impact on the use of the software code finally developed.

[0004] 2. Existing software code development tools are usually targeted at general fields and lack an understanding of the academic background and calculation formulas in the astronomical field. As a result, when using these tools to develop software codes in the astronomical field, not only is the efficiency low, but the software codes ultimately developed may not conform to the scientific principles of the astronomical field.

[0005] 3. Compared with other fields, astronomy is a relatively niche field, which means that there are fewer professional code packages for astronomy, and fewer learning documents and tutorials that can be used. Therefore, it is difficult for code developers to find suitable development tools when developing software codes in the astronomy field, and the development tools selected based on personal experience may not be suitable for software code development tasks in the astronomy field, making it difficult to ensure the effectiveness of the software code finally developed.

[0006] Therefore, how to solve the above difficulties and efficiently generate stable software codes has become a technical problem that needs to be solved urgently. Summary of the invention

[0007] The embodiments of the present application provide a code generation method, apparatus, medium and device based on multi-agent collaboration to partially solve the above-mentioned problems existing in the prior art.

[0008] This application adopts the following technical solutions: The present application embodiment provides a code generation method based on multi-agent collaboration, including: Acquire description information input by a user, where the description information is used to describe the function of the software code that the user needs to generate; Inputting the description information into a preset large language model so that the large language model performs feature extraction on the description information to obtain a feature vector corresponding to the description information; Input the feature vector into a pre-deployed task agent, so that the task agent determines, based on the feature vector, each subtask required to execute the code generation task corresponding to the description information, wherein each subtask includes at least: a retrieval subtask and at least one code block generation subtask; The task agent sends the task information of the retrieval subtask to a pre-deployed retrieval agent, so that the retrieval agent retrieves the target knowledge information required for the code generation task according to the task information of the retrieval subtask; Through the task agent, the target knowledge information and the task information corresponding to the at least one code block generation subtask are sent to a pre-deployed code generation agent, so that the code generation agent generates the software code required by the user according to the target knowledge information and the task information corresponding to the at least one code block generation subtask.

[0009] Optionally, the feature vector is input into a pre-deployed task agent, so that the task agent determines, according to the feature vector, each subtask required to perform the code generation task corresponding to the description information, specifically including: Inputting the feature vector into a pre-deployed task agent so that the task agent generates task framework information corresponding to the code generation task according to the feature vector; Through the task agent, the task framework information is sent to the pre-deployed framework agent, so that the framework agent generates the code framework information corresponding to the code generation task according to the task framework information, and determines the subtasks required to execute the code generation task based on the code framework information.

[0010] Optionally, based on the code framework information, determining each subtask required to execute the code generation task specifically includes: The code framework information is sent to the pre-deployed subtask agent through the framework agent, so that the subtask agent determines each subtask required to execute the code generation task according to the code framework information.

[0011] Optionally, the code generation agent generates the software code required by the user according to the target knowledge information and the task information corresponding to the at least one code block generation subtask, specifically including: The code generation agent generates each code block required for the code generation task according to the target knowledge information and the task information corresponding to the at least one code block generation subtask; Through the task agent, the code blocks are sent to a pre-deployed code merging agent, so that the code merging agent merges the code blocks to obtain the software code required by the user.

[0012] Optionally, the code generation agent generates each code block required for the code generation task according to the target knowledge information and the task information corresponding to the at least one code block generation subtask, specifically including: For each code generation subtask in the at least one code block generation subtask, the code generation agent determines the sub-knowledge information corresponding to the code generation subtask from the target knowledge information, generates a code block corresponding to the code generation subtask based on the sub-knowledge information corresponding to the code generation subtask, and determines the sub-knowledge information corresponding to the next code generation subtask from the target knowledge information according to the task execution order of each code generation subtask, until the code blocks corresponding to all code generation subtasks are determined.

[0013] Optionally, the retrieval agent retrieves the target knowledge information required for the code generation task according to the task information of the retrieval subtask, specifically including: The retrieval agent retrieves the initial knowledge information required for the code generation task according to the task information of the retrieval subtask; The initial knowledge information is sent to the pre-deployed filtering agent through the retrieval agent, so that the filtering agent filters the initial knowledge information to obtain the target knowledge information.

[0014] Optionally, the method further comprises: For each agent involved in executing the code generation task, display the result generated by the agent to the user; Receive feedback information input by the user regarding the displayed results, and send the feedback information to the task agent so that the task agent generates adjustment information based on the feedback information, and send the adjustment information to the agent so that the agent regenerates the results based on the adjustment information.

[0015] The embodiment of the present application provides a code generation device based on multi-agent collaboration, comprising: An acquisition module, used for acquiring description information input by a user, where the description information is used for describing the function of the software code that the user needs to generate; A feature generation module, used for inputting the description information into a preset large language model, so that the large language model performs feature extraction on the description information to obtain a feature vector corresponding to the description information; A subtask generation module is used to input the feature vector into a pre-deployed task agent, so that the task agent determines, based on the feature vector, each subtask required to perform the code generation task corresponding to the description information, wherein each subtask includes at least: a retrieval subtask and at least one code block generation subtask; A retrieval module, used to send the task information of the retrieval subtask to a pre-deployed retrieval agent through the task agent, so that the retrieval agent retrieves the target knowledge information required for the code generation task according to the task information of the retrieval subtask; The code generation module is used to send the target knowledge information and the task information corresponding to the at least one code block generation subtask to a pre-deployed code generation agent through the task agent, so that the code generation agent generates the software code required by the user according to the target knowledge information and the task information corresponding to the at least one code block generation subtask.

[0016] An embodiment of the present application provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned code vulnerability detection method is implemented.

[0017] An embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned code generation method based on multi-agent collaboration when executing the program.

[0018] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: The embodiment of the present application provides a code generation method based on multi-intelligent collaboration, wherein description information input by a user for describing a software code function required to be generated by the user is first obtained, and then the description information is input into a preset large language model to determine a feature vector corresponding to the description information, and then the feature vector is input into a pre-deployed task agent to determine each subtask for executing the required code generation task, and through the task agent, the task information of the retrieval subtask in each subtask is sent to the pre-deployed retrieval agent to retrieve the target knowledge information required for the code generation task, and then, through the task agent, the target knowledge information and the task information corresponding to at least one code block generation subtask contained in each subtask are sent to the pre-deployed code generation agent to finally generate the software code required by the user.

[0019] It can be seen from the above method that through the collaborative operation of multiple intelligent agents, the user only needs to input descriptive information describing the required software code function to automatically complete the retrieval of the knowledge information required to generate the software code, and automatically generate the corresponding software code. The user does not need to understand the background and calculation formulas required for developing the software code, nor does the user need to retrieve the academic papers and other materials required for developing the software code. While greatly improving the convenience, it also significantly improves the efficiency of software code generation and can effectively ensure the stability of the generated software code. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings described herein are used to provide a further understanding of the present specification and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present specification and do not constitute an improper limitation on the present application. In the drawings: Figure 1 A schematic diagram of a flow chart of code generation based on multi-agent collaboration provided in an embodiment of the present application; Figure 2 A schematic diagram of each detailed step in the entire software code process provided by an embodiment of the present application; Figure 3 A schematic diagram of a code generation device based on multi-agent collaboration provided in an embodiment of the present application; Figure 4 A method corresponding to the embodiment of the present application is provided Figure 1 Schematic diagram of the structure of an electronic device. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0022] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0023] Figure 1 A flowchart of a code generation method based on multi-agent collaboration provided in an embodiment of the present application includes the following steps: S101: Acquire description information input by a user, where the description information is used to describe the function of the software code that the user needs to generate.

[0024] In the embodiment of the present application, if the user needs to generate the required software code, the user can input description information through the terminal device used, and this description information is mainly used to describe the function of the software code to be generated. Subsequently, this description information can be parsed through the collaboration of a large language model and multiple agents to realize the generation of software code.

[0025] There may be multiple execution entities for executing the method provided in the embodiments of the present application, which may be terminal devices such as desktop computers, laptop computers, etc., or clients installed in the terminal devices, or servers. For the sake of ease of description, the following only takes the terminal device as the execution entity as an example to illustrate the code generation method based on multi-agent collaboration provided in the embodiments of the present application.

[0026] In actual applications, the terminal device can display an interface for inputting description information to the user, and the user can input description information in the input box of the interface according to actual needs. The terminal device executes subsequent steps based on the received description information.

[0027] In addition, the method provided in the embodiment of the present application can be used for codes in the field of astronomy. In this scenario, the knowledge information acquired in subsequent steps belongs to the knowledge in the field of astronomy, and the software code finally generated is used to perform specified tasks in the field of astronomy.

[0028] Of course, the method provided in the embodiment of the present application is actually a general method, which can be applied not only to code generation in the field of astronomy, but also to other fields, such as intelligent driving, fluid mechanics, nuclear physics, etc.

[0029] S102: Input the description information into a preset large language model, so that the large language model performs feature extraction on the description information to obtain a feature vector corresponding to the description information.

[0030] In an embodiment of the present application, the user can complete the generation of the required software code through the collaboration of a large language model and multiple agents.

[0031] Among them, for the subsequent use of intelligent agents, they have exclusive uses and are complex software programs that can provide specific functions. They can perceive information, make decisions and perform corresponding operations in a dynamic environment based on preset rules or learned knowledge. Intelligent agents can work independently or collaborate with other intelligent agents or human users to complete complex tasks.

[0032] In fact, the intelligent agent can be regarded as a smaller-scale intelligent model that can be obtained through sample training. However, it has significant differences from the large language model in terms of the number of network layers and the number of parameters.

[0033] The agent can embed or call the above-mentioned large language model, and its purpose is to use the powerful natural language processing capabilities of the large language model to enhance the function of the agent. In other words, after analyzing and processing the information input by the user, the large language model can provide the agent with input information that is easy for the agent to understand. Correspondingly, the agent can output output results that meet the actual needs of the user based on the input information given by the large language model.

[0034] Therefore, in an embodiment of the present application, the user can input the descriptive information into the large language model through the terminal device. The large language model, through its natural language processing capabilities, embeds the descriptive information into text, thereby obtaining a feature vector that is easy for the subsequent intelligent agent to understand, and then in the subsequent process, sends the feature vector to the intelligent agent for processing.

[0035] From the contents of the above steps, it can be seen that the user can input the descriptive information in the interface on the terminal device, so the interface of the terminal device can actually display the input interface of the large language model, and the input interface is provided with an input box for inputting information. The user can input the above descriptive information in the input box, thereby obtaining the feature vector of the descriptive information through the large language model.

[0036] S103: Input the feature vector into a pre-deployed task agent, so that the task agent determines, based on the feature vector, each subtask required to execute the code generation task corresponding to the description information.

[0037] In the embodiment of the present application, three kinds of agents are mainly involved, among which the core agent is the task agent, which is mainly used to parse the received feature vectors, so as to determine the subtasks required to generate the software code in the subsequent process. In addition, the task agent can forward the results generated by other agents to other agents, or further process the results output by other agents.

[0038] In addition, the embodiment of the present application also involves a retrieval agent, which is mainly used to retrieve various knowledge required for generating software code. It can retrieve the required knowledge information from an external knowledge base or website, and can also retrieve the required knowledge information from a pre-built knowledge base.

[0039] The embodiment of the present application also involves a code generation agent, whose main function is to generate the software code required by the user based on the knowledge information retrieved by the retrieval agent and the task information of each subtask generated by the task agent.

[0040] It should be pointed out that the various agents involved in the embodiments of the present application can be pre-constructed and obtained through sample training. The specific sample to be used and how to construct the loss function can be determined by the corresponding function of the agent. Taking the code generation agent as an example, the sample used can be the pre-acquired knowledge information and the constructed task information, and the corresponding label information can be the software code that has been constructed. After the sample is input into the code generation agent, the software code generated by it needs to be as close to the label information as possible, so as to realize the training of the code generation agent. The training of other agents will not be illustrated one by one here.

[0041] Therefore, after obtaining the feature vector corresponding to the above description information through the above large language model, the feature vector can be input into the above task agent by the large language model, and the task agent can parse the feature vector to determine the subtasks required to execute the code generation task.

[0042] Since the embodiments of the present application also involve a retrieval agent and a code generation agent, the subtasks determined by the task agent include at least a retrieval subtask required by the retrieval agent and at least one code block generation subtask required by the code generation agent.

[0043] In an embodiment of the present application, a framework agent can also be pre-deployed. Its main function is to design the code framework based on the received information, clarify the task objectives of the software code generation task required by the user, and determine the knowledge information and algorithm structure required to generate the software code, so as to obtain code framework information that can represent these data.

[0044] Therefore, after the above feature vector is input into the pre-deployed task agent, the task agent can determine the task framework information corresponding to the above code generation task based on the feature vector. Among them, the task framework information here is mainly used to reflect the various subtasks that may be involved in executing the code generation task. The determination process of this task framework information can be that after the task agent parses the acquired feature vector, it can generate a thought chain for this code generation task.

[0045] Among them, the thought chain can reflect the multiple task steps broken down by the task agent when thinking about how to perform the code generation task. These task steps can actually correspond to at least some subtasks.

[0046] Therefore, the task agent can determine the task framework information based on the above thought chain, and then the task agent can send the task framework information to the framework agent. The framework agent can generate the above code framework information based on the acquired task framework information, and then in the subsequent process, it can determine the subtasks required to execute the code generation task based on the code framework information.

[0047] In an embodiment of the present application, a subtask agent can also be pre-deployed. The subtask agent is used to clarify the subtasks required for the code generation task, and then in the subsequent process, the task information of each subtask is returned to the task agent. The task agent coordinates other whole agents based on the task information of each subtask to realize the generation of software code.

[0048] To this end, after determining the above-mentioned code framework information, the framework agent can send the code framework information to the above-mentioned subtask agent. The subtask agent determines the various subtasks involved in executing the entire software code generation process based on the acquired code framework information, and returns the task information of these subtasks to the task agent.

[0049] Among them, the various subtasks involved in the embodiment of the present application include a retrieval subtask and at least one code block generation subtask. The retrieval subtask is used to enable the subsequent retrieval agent to retrieve various knowledge information required for generating software code, and the code block subtask is used to enable the code generation agent to generate a code block. Since the software code to be generated can be regarded as consisting of at least one code block, what is generated here is at least one code block generation subtask.

[0050] In the embodiment of the present application, the mutual calls between the agents can be realized through the interfaces corresponding to the agents, that is, when the result generated by one agent needs to be given to another agent, the result generated by the agent is transmitted through the interface of the other agent. It should be pointed out that the interface information of the interface corresponding to each agent can be pre-deployed in the system where the agent is located, so that the mutual coordination between the agents can be realized in the process of generating the software code.

[0051] In addition, in the above process, the above framework agent and / or subtask agent may not be used, that is, the functions of the framework agent and the subtask agent may be realized by the above task agent. In other words, after obtaining the above feature vector, the task agent can directly complete the above thought chain construction, task framework information generation, code framework information generation and various subtask determination steps, without the participation of other agents.

[0052] S104: Sending the task information of the retrieval subtask to the pre-deployed retrieval agent through the task agent, so that the retrieval agent retrieves the target knowledge information required for the code generation task according to the task information of the retrieval subtask.

[0053] After determining the above subtasks, the task agent can send the task information of the retrieval subtasks contained in these subtasks to the pre-deployed retrieval agent. The retrieval agent can perform corresponding retrieval operations based on the task information of the retrieval subtask to obtain the required target knowledge information.

[0054] In this process, the task information of the retrieval subtask includes retrieval keywords and retrieval conditions, which can be determined by the above-mentioned subtask agent or task agent. To this end, the retrieval agent can convert the retrieval keywords and retrieval conditions contained in the task information into an embedding vector by text embedding, and obtain academic literature, formula materials, algorithm papers and other information with high similarity to the embedding vector from the preset knowledge base by vector matching, so as to obtain the target knowledge information required to generate software code.

[0055] Of course, if the required knowledge information cannot be retrieved from the above knowledge base (such as the similarity between the generated embedding vector and the corresponding vector of each knowledge information in the knowledge base is less than the preset similarity threshold), or the knowledge base is not pre-deployed, the retrieval agent can also generate retrieval instructions through the preset retrieval engine API based on the retrieval keywords and retrieval conditions contained in the task information to retrieve the required knowledge information from an external database or website.

[0056] In practical applications, the content of the above-mentioned preset knowledge base can be continuously updated and expanded to ensure that the latest knowledge can be included in the knowledge base. In the process of collecting knowledge, if the retrieval agent retrieves the required knowledge information from an external database or website by generating a retrieval instruction, the retrieved knowledge information can be added to the knowledge base. Among them, for the knowledge information to be added, the knowledge category corresponding to the knowledge information can be determined by performing semantic analysis on the knowledge information, and then stored in the position corresponding to the knowledge category in the knowledge base according to the determined knowledge category.

[0057] In practical applications, the knowledge information retrieved by the retrieval agent may not be all the knowledge information required to generate software code. Therefore, it is necessary to filter the knowledge information retrieved by the retrieval agent to accurately obtain the knowledge information actually required.

[0058] Therefore, in the embodiment of the present application, a filtering agent can be pre-deployed, and the filtering agent can filter the knowledge information retrieved by the retrieval agent. Specifically, the retrieval agent can first retrieve the initial knowledge information required for generating the software code through the task information of the above-mentioned retrieval subtask, and then send the initial knowledge information to the filtering agent. In addition to receiving the initial knowledge information, the filtering agent also needs to receive the task information of the above-mentioned retrieval subtask or the above-mentioned code framework information, so as to verify whether the various information contained in the initial knowledge information is the knowledge required for generating the software code based on the task information of the retrieval subtask or the code framework information.

[0059] After completing the filtering of knowledge information, the filtering agent can send the final target knowledge information to the above-mentioned task agent, which then sends the target knowledge information to the code generation agent, and the code generation agent completes the generation of software code.

[0060] Of course, in actual applications, the above-mentioned filtering agent may not be used. The retrieval agent may have the functions of the above-mentioned filtering agent, that is, after retrieving the initial knowledge information required to generate the software code, it can filter the initial knowledge information according to the previously learned "knowledge" to obtain the final target knowledge information.

[0061] S105: The target knowledge information and the task information corresponding to the at least one code block generation subtask are sent to a pre-deployed code generation agent through the task agent, so that the code generation agent generates the software code required by the user according to the target knowledge information and the task information corresponding to the at least one code block generation subtask.

[0062] The task agent can send the above-mentioned target knowledge information and the task information corresponding to at least one determined code block generation subtask to the pre-deployed code generation agent. The code generation agent will first determine the knowledge information required for the code block generation subtask from the target knowledge information according to each code block generation subtask, and then generate the corresponding code block according to the knowledge information required for the code block generation subtask. After completing all code block generation subtasks, all code blocks will be obtained, and then the final software code will be obtained through these code blocks.

[0063] In the embodiment of the present application, a code merging agent may also be pre-deployed, which is mainly used to merge the various code blocks generated by the code generating agent into a whole software code and output it. In this process, the code generating agent can send the generated code blocks to the code merging agent, and the code merging agent will merge the code blocks according to the splicing order of the code blocks to obtain the final software code.

[0064] Among them, the splicing order of each code block can be determined by the above-mentioned sub-task intelligent agent, and the task information of at least one code generation subtask determined by the sub-task intelligent agent can include information used to represent the execution order of each code generation subtask, and this information will also reflect the position of each code block in the overall software code (such as line number).

[0065] Therefore, in practical applications, for each code generation subtask, the code generation agent can determine the sub-knowledge information corresponding to the code generation subtask from the target knowledge information, and then generate the code block corresponding to the code generation subtask according to the sub-knowledge information corresponding to the code generation subtask. Afterwards, according to the task execution order of each code generation subtask, the sub-knowledge information corresponding to the next code generation subtask is determined from the target knowledge information, and the code block corresponding to the next code generation subtask is generated according to the sub-knowledge information corresponding to the next code generation subtask.

[0066] By executing the above process in a loop in sequence, the code blocks corresponding to each code block generation subtask can be generated, and then in the subsequent process, these code blocks can be spliced ​​in a certain order through the code merging agent to obtain the overall software code.

[0067] It should be noted that, in the process of splicing the code blocks, the code merging agent can generate the connecting code between the code blocks based on the previous and next code blocks, thereby realizing the splicing of the previous and next code blocks.

[0068] In addition, in practical applications, the above-mentioned code merging agent may not be used. That is to say, the above-mentioned code generating agent may also have the function of a code merging agent. After generating each code block, these code blocks may be spliced ​​in a certain splicing order to obtain the software code required by the end user.

[0069] The code generation agent can return the final software code to the task agent, which will display it to the user through the interface displayed by the terminal device. A copy control can be provided in this interface, and the user can copy the software code generated by the above agents by touching the copy control to deploy it in the software environment required by the user.

[0070] From the above content, it can be seen that through the collaborative operation of multiple intelligent agents, the user can input only the descriptive information describing the required software code function to automatically complete the retrieval of the knowledge information required to generate the software code, and automatically generate the corresponding software code. The user does not need to understand the background and calculation formulas required to develop the software code, nor does the user need to retrieve the academic papers and other materials required to develop the software code. While greatly improving the convenience, it also significantly improves the efficiency of software code generation and can effectively ensure the stability of the generated software code.

[0071] Moreover, in the process of the above-mentioned software code, the retrieved knowledge information can also be filtered to ensure the accuracy of the retrieved knowledge information, and further ensure the reliability of the software code finally generated. In addition, in order to ensure the correctness of the software code finally generated, the various task steps required to execute the software code generation task can also be determined based on the generated thought chain. By disassembling these task steps, more refined subtasks can be determined, and then by executing these subtasks, the various information required to generate the software code can be determined in turn. This can effectively ensure that there will be no omissions in the process of generating software code, so that the functions of the final software code can meet user expectations.

[0072] In actual applications, the above-mentioned task agent can also feed back the results output by the task agent itself or the results output by other agents to the user, and the user can check whether the results output by these agents are accurate. If there are inaccuracies, the user can input modification information through the terminal device, and then adjust the results output by the agent based on the modification information.

[0073] Specifically, in an embodiment of the present application, for each agent involved in executing the above-mentioned code generation task, the result generated by the agent can be displayed to the user through the interface displayed by the terminal device. After viewing the result displayed by the terminal device, the user can enter feedback information in the terminal device, which is then sent to the task agent via the terminal device. After receiving the feedback information, the task agent can generate adjustment information based on the feedback information, and send the adjustment information to the agent that generates the result, so that the agent can regenerate the result based on the adjustment information.

[0074] In the above implementation process, since the terminal device can display the interface of the large language model to the user, the results generated by the agent can also be displayed to the user through the interface. Correspondingly, the user can input feedback information through the input box in the interface for inputting information to the large language model.

[0075] The large language model can convert the feedback information input by the user into a feature vector to obtain the feature vector corresponding to the feedback information, and then send the feature vector corresponding to the feedback information to the task agent for recognition. The task agent then uses the received feature vector to recognize the user's intention, and the recognized intention may include the following situations: 1. Modify the task description, that is, the user re-submits the description information according to the results displayed by the terminal device, or adjusts the previously entered description information; 2. Modify the code framework. That is, if the user believes that the code framework information output by the task agent or the framework agent is missing or erroneous, the user can point out the correct code framework information. The correct code framework information pointed out by the user can be regarded as the above-mentioned feedback information; 3. Re-search, that is, if the user determines that the search results output by the search agent are inaccurate, he can propose new search keywords or search conditions. At this time, the new search words or search conditions proposed by the user are the feedback information input by the user; 4. Knowledge retention, that is, if the user needs to actively select a piece of knowledge information as the target knowledge information from the search results retrieved by the retrieval agent according to actual needs, the subsequent task agent can generate the software code required by the user through the code generation agent (or the code merging agent combined with the above-mentioned code merging agent) based on the target knowledge information actively selected by the user; 5. Modify the code. That is, if the user needs to modify the software code finally returned by the task agent according to actual needs, the user can enter the modification information in the interface displayed by the terminal device. The task agent can modify the software code based on the modification information to obtain a software code that meets the user's actual needs.

[0076] From the above content, it can be seen that the task agent's recognition of the user's intention includes the code framework generation stage, the retrieval stage, and the code generation stage, etc. Therefore, in actual applications, after the task agent completes the intention recognition, it can determine the agent that needs to adjust the output result based on the intention recognition result, and then send the above adjustment information to the determined agent to adjust the output result.

[0077] It should be pointed out that the task agent may determine that there may be multiple agents whose output results need to be adjusted based on the intention recognition results. For example, assuming that the user believes that the search results output by the retrieval agent are inaccurate, then adjustments may need to be made from the very beginning, that is, first based on the adjustment information, the task agent or subtask agent adjusts the task information corresponding to the retrieval subtask, and then adjusts the search results (i.e., target knowledge information) searched by the retrieval agent based on the readjusted task information of the retrieval subtask.

[0078] In addition, in actual applications, users may have multiple rounds of conversations with the large language model, and these multiple rounds of conversations may all be conducted for the software code required by the user. Therefore, in the process of determining the user's intention, in addition to the feedback information entered by the user in the terminal device, the historical conversation records between the user and the large language model can also be combined to ensure that the final adjustment result meets the user's needs.

[0079] In this process, the large language model can generate a feature vector for the above feedback information and historical conversation records, and input the feature vector into the task agent. The task agent can analyze the feature vector, comprehensively analyze the feedback information and historical conversation records, and thus determine the adjustment information that meets the actual needs of the user, and send the obtained adjustment information to the involved agents.

[0080] After obtaining the results output by the agent, the user can also provide other feedback information besides the above intentions. If the task agent determines that the user is satisfied with the final generated software code based on the feedback information input by the user, the entire code generation process can be terminated.

[0081] If it is determined that the input feedback information is not relevant to the currently generated software code, the user may be prompted to input feedback information relevant to the currently generated software code, or it may be determined whether the user has other requirements, and so on.

[0082] For ease of understanding, the following describes each step involved in the entire software code process one by one, such as Figure 2 shown.

[0083] Figure 2 A schematic diagram of the detailed steps in the entire software code process provided in an embodiment of the present application.

[0084] Before starting the code generation task, each agent needs to be deployed and initialized.

[0085] Step S201: receiving description information input by a user.

[0086] The user can input description information for describing the required software code function in the interface of the large language model through the terminal device used. The large language model can convert the description information to obtain the corresponding feature vector and send the feature vector to the task agent. The task agent outputs the task framework information.

[0087] Step S202: Determine the task framework.

[0088] The task agent determines the task framework for generating the software code required by the user through the acquired feature vectors, and generates the corresponding task framework information.

[0089] Step S203: code framework design.

[0090] The task agent sends the task framework information to the framework agent, which designs the code framework and outputs the code framework information.

[0091] Step S204: Generate each subtask.

[0092] The framework agent sends the output code framework information to the subtask agent, which parses the code framework information to determine the subtasks involved in the entire process of generating software code and returns the task information of each subtask to the task agent.

[0093] Step S205: Knowledge retrieval.

[0094] The task agent can send the task information of the retrieval subtask contained in each subtask to the retrieval agent, and the retrieval agent completes the knowledge retrieval to obtain the initial knowledge information.

[0095] Step S206: Knowledge filtering.

[0096] The retrieval agent sends the initial knowledge information to the filtering agent, which filters the initial knowledge information to obtain accurate target knowledge information and returns it to the task agent.

[0097] Step S207: code block generation.

[0098] The task agent can send the acquired target knowledge information and the task information of at least one code block generation subtask contained in each subtask to the code generation agent. The code generation agent will determine the sub-knowledge information required for each code block generation subtask from the target knowledge information, and then generate the code block corresponding to the code block generation subtask based on the sub-knowledge information and the task information of the code block generation subtask.

[0099] Step S208: Repeat until all code blocks are generated.

[0100] The code generation agent executes each code block generation subtask in sequence in the above manner to obtain all required code blocks.

[0101] Step S209: code merging.

[0102] Afterwards, the code generation agent can send all the generated code blocks to the code merging agent, which will merge these code blocks to obtain the complete software code and return it to the task agent.

[0103] Step S210: Feedback the result to the user.

[0104] The task agent can present the final generated software code to the user through a large language model.

[0105] Step S211: The user inputs feedback information.

[0106] The terminal device can input the user's feedback information on the output results of the intelligent agent through the interface of the displayed large language model. Figure 2 In fact, the results output by each agent can be displayed to the user through the interface of the large language model.

[0107] Step S212: Identify user intention.

[0108] The task agent can recognize the intent of the feedback information input by the user and perform different adjustments based on different intent recognition results.

[0109] If it is determined that the user needs to modify the description information, then jump to the above step S202, that is, the task agent can redetermine the task framework information based on the description information modified by the user, or adjust the original task framework information. The modified description information mentioned here can be parsed from the feedback information input by the user.

[0110] If it is determined that the user needs to modify the code framework, the process may jump to the above step S203, that is, the framework agent redetermines the code framework information based on the user's feedback information, or adjusts the original code framework information.

[0111] If it is determined that the user needs to re-search, the process may jump to the above step S205, that is, the search agent re-searches according to the new search keywords and / or new search conditions contained in the feedback information, thereby obtaining new initial knowledge information.

[0112] If it is determined that the user needs to retain part of the initial knowledge information, the process may jump to the above step S207, that is, the filtering agent retains the knowledge information selected by the user as the final target knowledge information based on the user's feedback information.

[0113] If it is determined that the user needs to modify the code, the process can jump to the above step S208, and the code generation agent can regenerate each code block based on the user's feedback information, or adjust part or all of the code blocks that have been generated.

[0114] If it is determined that the feedback information input by the user is not relevant to the software code currently to be generated, the process may jump to the above step S211 to redetermine the feedback information input by the user. During this process, the user may be given appropriate prompts.

[0115] If it is determined that the user is satisfied with the finally generated software code, the whole process is completed, and then the process can jump to the above step S201 to determine the description information of the next software code that the user needs to generate.

[0116] In addition, in an embodiment of the present application, the terminal device may be provided with a log module, through which the historical conversation records between the user and the large language model or the intelligent agent can be recorded, so as to achieve the purpose of resuming the task in the middle of the task.

[0117] In addition to saving historical dialogue records, the log module can also record the description information input by the user, feedback information, and the results output by each agent. By recording this information through the log module, it is possible to avoid re-executing the steps that have been completed.

[0118] The above-mentioned log module also supports breakpoint management, which can record the status of the current task when the user enters feedback information, and re-execute it from the breakpoint to ensure the continuity of the code generation task. It also avoids re-executing the code generation task from the beginning every time the user enters feedback information, thereby further ensuring the execution efficiency of the code generation task.

[0119] In addition, users or system administrators can query and trace back the historical logs recorded by the log module at any time to perform tasks, troubleshoot problems, and analyze data, thereby further ensuring the smooth execution of code generation tasks and the efficiency of task execution in subsequent tasks.

[0120] The above is a code generation method based on multi-agent collaboration provided by one or more embodiments of the present application. Based on the same idea, the present application also provides a corresponding code generation device based on multi-agent collaboration, such as Figure 3 shown.

[0121] Figure 3 A schematic diagram of a code generation device based on multi-agent collaboration provided in an embodiment of the present application specifically includes: The acquisition module 301 is used to acquire description information input by a user, where the description information is used to describe the function of the software code that the user needs to generate; A feature generation module 302 is used to input the description information into a preset large language model so that the large language model performs feature extraction on the description information to obtain a feature vector corresponding to the description information; The subtask generation module 303 is used to input the feature vector into a pre-deployed task agent, so that the task agent determines, based on the feature vector, each subtask required to perform the code generation task corresponding to the description information, wherein each subtask includes at least: a retrieval subtask and at least one code block generation subtask; A retrieval module 304 is used to send the task information of the retrieval subtask to a pre-deployed retrieval agent through the task agent, so that the retrieval agent retrieves the target knowledge information required for the code generation task according to the task information of the retrieval subtask; The code generation module 305 is used to send the target knowledge information and the task information corresponding to the at least one code block generation subtask to a pre-deployed code generation agent through the task agent, so that the code generation agent generates the software code required by the user according to the target knowledge information and the task information corresponding to the at least one code block generation subtask.

[0122] Optionally, the subtask generation module 303 is specifically used to input the feature vector into a pre-deployed task agent so that the task agent generates task framework information corresponding to the code generation task based on the feature vector; and send the task framework information to a pre-deployed framework agent through the task agent so that the framework agent generates code framework information corresponding to the code generation task based on the task framework information, so as to determine the subtasks required to execute the code generation task based on the code framework information.

[0123] Optionally, the subtask generation module 303 is specifically used to send the code framework information to a pre-deployed subtask agent through the framework agent, so that the subtask agent determines each subtask required to execute the code generation task according to the code framework information.

[0124] Optionally, the code generation module 305 is specifically used for the code generation agent to generate the code blocks required for the code generation task according to the target knowledge information and the task information corresponding to the at least one code block generation subtask; and to send the code blocks to a pre-deployed code merging agent through the task agent, so that the code merging agent merges the code blocks to obtain the software code required by the user.

[0125] Optionally, the code generation module 305 is specifically used to, for each code generation subtask in the at least one code block generation subtask, the code generation agent determines the sub-knowledge information corresponding to the code generation subtask from the target knowledge information, generates a code block corresponding to the code generation subtask based on the sub-knowledge information corresponding to the code generation subtask, and determines the sub-knowledge information corresponding to the next code generation subtask from the target knowledge information according to the task execution order of each code generation subtask, until the code blocks corresponding to all code generation subtasks are determined.

[0126] Optionally, the retrieval module 304 is specifically used for the retrieval agent to retrieve the initial knowledge information required for the code generation task according to the task information of the retrieval subtask; and to send the initial knowledge information to a pre-deployed filtering agent through the retrieval agent so that the filtering agent filters the initial knowledge information to obtain the target knowledge information.

[0127] Optionally, the device further comprises: The feedback module 306 is used to display the results generated by each agent involved in executing the code generation task to the user; receive feedback information input by the user for the displayed results, and send the feedback information to the task agent so that the task agent generates adjustment information based on the feedback information, and send the adjustment information to the agent so that the agent regenerates the results based on the adjustment information.

[0128] The present application also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 A code generation method based on multi-agent collaboration is provided.

[0129] The present application also provides Figure 4 The schematic structure diagram of the electronic device shown in FIG. Figure 4 As shown, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 The described coding method based on multi-agent collaboration.

[0130] Of course, in addition to software implementation, this application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the executor of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0131] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with hardware entity modules. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0132] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.

[0133] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0134] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0135] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0136] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0137] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0138] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0139] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0140] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0141] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0142] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0143] It should be understood by those skilled in the art that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0144] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0145] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0146] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.

Claims

1. A code generation method based on multi-agent collaboration, characterized in that: include: Acquire description information input by a user, where the description information is used to describe the function of the software code that the user needs to generate; Inputting the description information into a preset large language model so that the large language model performs feature extraction on the description information to obtain a feature vector corresponding to the description information; Input the feature vector into a pre-deployed task agent, so that the task agent determines, based on the feature vector, each subtask required to execute the code generation task corresponding to the description information, wherein each subtask includes at least: a retrieval subtask and at least one code block generation subtask; The task agent sends the task information of the retrieval subtask to a pre-deployed retrieval agent, so that the retrieval agent retrieves the target knowledge information required for the code generation task according to the task information of the retrieval subtask; Through the task agent, the target knowledge information and the task information corresponding to the at least one code block generation subtask are sent to a pre-deployed code generation agent, so that the code generation agent generates the software code required by the user according to the target knowledge information and the task information corresponding to the at least one code block generation subtask.

2. The method according to claim 1, characterized in that The feature vector is input into a pre-deployed task agent, so that the task agent determines, based on the feature vector, the subtasks required to perform the code generation task corresponding to the description information, specifically including: Inputting the feature vector into a pre-deployed task agent so that the task agent generates task framework information corresponding to the code generation task according to the feature vector; Through the task agent, the task framework information is sent to the pre-deployed framework agent, so that the framework agent generates the code framework information corresponding to the code generation task according to the task framework information, and determines the subtasks required to execute the code generation task based on the code framework information.

3. The method according to claim 2, characterized in that Based on the code framework information, each subtask required to execute the code generation task is determined, specifically including: The code framework information is sent to the pre-deployed subtask agent through the framework agent, so that the subtask agent determines the subtasks required to execute the code generation task according to the code framework information.

4. The method according to claim 1, characterized in that The code generation agent generates the software code required by the user according to the target knowledge information and the task information corresponding to the at least one code block generation subtask, specifically including: The code generation agent generates each code block required for the code generation task according to the target knowledge information and the task information corresponding to the at least one code block generation subtask; Through the task agent, the code blocks are sent to a pre-deployed code merging agent, so that the code merging agent merges the code blocks to obtain the software code required by the user.

5. The method according to claim 4, characterized in that The code generation agent generates each code block required for the code generation task according to the target knowledge information and the task information corresponding to the at least one code block generation subtask, specifically including: For each code generation subtask in the at least one code block generation subtask, the code generation agent determines the sub-knowledge information corresponding to the code generation subtask from the target knowledge information, generates a code block corresponding to the code generation subtask based on the sub-knowledge information corresponding to the code generation subtask, and determines the sub-knowledge information corresponding to the next code generation subtask from the target knowledge information according to the task execution order of each code generation subtask, until the code blocks corresponding to all code generation subtasks are determined.

6. The method according to claim 1, characterized in that The retrieval agent retrieves the target knowledge information required for the code generation task according to the task information of the retrieval subtask, specifically including: The retrieval agent retrieves the initial knowledge information required for the code generation task according to the task information of the retrieval subtask; The initial knowledge information is sent to the pre-deployed filtering agent through the retrieval agent, so that the filtering agent filters the initial knowledge information to obtain the target knowledge information.

7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: For each agent involved in executing the code generation task, display the result generated by the agent to the user; Receive feedback information input by the user regarding the displayed results, and send the feedback information to the task agent so that the task agent generates adjustment information based on the feedback information, and send the adjustment information to the agent so that the agent regenerates the results based on the adjustment information.

8. A code generation device based on multi-agent collaboration, characterized in that: include: An acquisition module, used for acquiring description information input by a user, where the description information is used for describing the function of the software code that the user needs to generate; A feature generation module, used for inputting the description information into a preset large language model, so that the large language model performs feature extraction on the description information to obtain a feature vector corresponding to the description information; A subtask generation module is used to input the feature vector into a pre-deployed task agent, so that the task agent determines, based on the feature vector, each subtask required to perform the code generation task corresponding to the description information, wherein each subtask includes at least: a retrieval subtask and at least one code block generation subtask; A retrieval module, used to send the task information of the retrieval subtask to a pre-deployed retrieval agent through the task agent, so that the retrieval agent retrieves the target knowledge information required for the code generation task according to the task information of the retrieval subtask; The code generation module is used to send the target knowledge information and the task information corresponding to the at least one code block generation subtask to a pre-deployed code generation agent through the task agent, so that the code generation agent generates the software code required by the user according to the target knowledge information and the task information corresponding to the at least one code block generation subtask.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1 to 7 is implemented.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Academic conference question-answering system based on large language model

    CN118377867A

  • Navigation process code generation method based on artificial intelligence

    CN118409742A

  • Code generation method, device and equipment based on multi-agent language system

    CN119065650A

  • Task processing method and device based on multi-agent system, equipment and medium

    CN119622103A

  • Design code generation method, knowledge graph construction method and related equipment

    CN119668577A

Cited By

  • Intelligent agent-based applet code automatic generation system and control method thereof

    CN120653231A

  • Code generation method and system based on large model

    CN120763072A

  • Task model generation method and computer equipment

    CN121029140A

  • Task model generation method and computer device

    CN121029140B