Multi-agent-based automatic processing system and PLC automatic programming system
By introducing a multi-agent framework in the field of large-model applications, the distribution and working functions of agents are separated, and the problem of difficulty in scaling single-chain structures is solved, and the system is modularized and efficiently handled complex needs is achieved.
Patent Information
- Application Number
- CN202411706518.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-04-15
AI Technical Summary
In the prior art, with the increase in application demand, single-chain structures are difficult to expand, resulting in increased customization and maintenance costs, and it is impossible to efficiently handle complex and diversified application demands.
An automated processing system and PLC automation programming system based on multi-agents are proposed. By building a multi-agent framework for managing large models, the distribution and work functions of the agent are separated, and the system is modularized and can flexibly respond to various application needs.
Through modular design, the customization and maintenance costs of demand are reduced, the processing efficiency of the automated process is improved, and the ability to quickly identify and select the working agent that is most suitable for answering specific questions is improved, which improves the success rate and professionalism of problem solving.
Smart Images

Figure CN119828579A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of artificial intelligence technology, and in particular, relates to an automated processing system based on multiple agents and a PLC automated programming system. Background Art
[0002] With the birth of Large Language Model (LLM), the traditional natural language processing field has been elevated to a new level with its super semantic understanding and language generation capabilities. Currently, major IT companies are competing to propose their own large models, and various applications based on large models have sprung up and are rapidly iterating.
[0003] In the field of big model applications, one of the technical directions is to develop an application framework that uses big models as the foundation of capabilities by utilizing only the thinking logic and semantic understanding capabilities of big models. In related technologies, the application architecture of big models adopts a single-chain structure, that is, the processing flow of tasks or data is linear, and from one link to the next, each link depends on the output of the previous link.
[0004] However, as application requirements increase, single-chain construction may be difficult to expand, because each new requirement may require modifications to existing processes, resulting in increased customization and maintenance costs. Summary of the invention
[0005] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes an automated processing system and a PLC automated programming system based on multi-agents to reduce the customization and maintenance costs of requirements and improve the processing efficiency of the automated process.
[0006] In a first aspect, the present application provides a multi-agent-based automated processing system, comprising: a distribution agent and a plurality of working agents;
[0007] The distribution agent is used to obtain questions input by users, analyze the questions to determine a target working agent suitable for answering the questions, and route the questions to the target working agent;
[0008] The working agent is used to answer the received question, obtain the answer corresponding to the question, and return the answer to the distribution agent.
[0009] According to the multi-agent based automation processing system of the present application, by building a multi-agent framework for managing large models, the distribution function and work function of the agent are separated. The distribution agent is responsible for receiving and preliminary analysis of problems, while the work agent focuses on answering specific questions, thus realizing the modularity of the system. As new requirements emerge, new work agents can be simply added or existing agents can be updated, allowing the system to flexibly respond to various application requirements without large-scale modifications to the entire process, reducing the customization and maintenance costs of requirements and improving the processing efficiency of the automation process.
[0010] According to one embodiment of the present application, different working agents correspond to different first functional descriptions;
[0011] The step of analyzing the problem to determine a target working agent suitable for answering the problem comprises:
[0012] The problem is compared with the first functional description corresponding to each working agent to determine the target working agent.
[0013] In this embodiment, by making a detailed comparison between the problem content and the functional description of each working agent, the system can quickly identify and select the working agent that is most suitable for answering a specific problem, so that the problem can be handled by a working agent with corresponding expertise and resources, and the success rate of problem solving is improved.
[0014] According to one embodiment of the present application, analyzing the problem to determine a target working agent suitable for answering the problem includes:
[0015] Analyzing the problem to split the problem into a plurality of sub-problems;
[0016] Determine the target working agent suitable for solving each sub-problem respectively.
[0017] In this embodiment, by splitting a complex problem into multiple sub-problems, the system can understand the user's original needs more carefully, and break down broad or multi-dimensional problems into more specific queries, facilitating more accurate matching of professional fields, so that the sub-problems can be answered by the most suitable working agents, thereby improving the professionalism and pertinence of problem handling.
[0018] According to one embodiment of the present application, routing the problem to the target working agent includes:
[0019] When the answer to the previous sub-question is obtained, the next sub-question and the answer to the previous sub-question are routed to the target working agent corresponding to the next sub-question.
[0020] In this embodiment, the answer to the previous sub-problem is used as the information context and routed to the corresponding target working agent together with the next sub-problem. This continuous information flow ensures the coherence of problem solving, so that the solution to the sub-problem can be carried out on the basis of the previous step, constructing a dynamic knowledge accumulation process, making the entire problem-solving process more intelligent and efficient.
[0021] According to one embodiment of the present application, the distribution agent is also used for:
[0022] The answer is analyzed to determine whether the problem is solved; if the problem is solved, the answer is returned to the user.
[0023] In this embodiment, the distribution agent conducts in-depth analysis of the answers and determines whether the problem is solved based on this, thereby achieving strict monitoring and quality control of the problem-solving process. When the problem is satisfactorily answered, the answer will be returned to the user, thereby improving user satisfaction and enhancing the credibility of the system.
[0024] According to one embodiment of the present application, the distribution agent is also used for:
[0025] In the case where the question is not resolved, the question and the answer are analyzed to redetermine a target working agent suitable for answering the question, and the question is routed to the redetermined target working agent.
[0026] In this embodiment, by analyzing the problem and existing answers, the distribution agent is able to identify why the problem is not solved, which may be due to the working agent's professional mismatch or insufficient answer, and thus select a more suitable agent to handle it in a targeted manner, thereby improving the flexibility and accuracy of problem solving.
[0027] According to one embodiment of the present application, the working agent includes at least one functional module;
[0028] The step of answering the received question to obtain an answer corresponding to the question includes:
[0029] The question is sent to the functional module to obtain the answer output by the functional module.
[0030] In this embodiment, by integrating at least one functional module within the working agent, the working agent is allowed to perform specialized processing on specific types of problems, so that the problems can receive in-depth analysis and answers in the required professional fields, thereby improving the accuracy and efficiency of problem solving.
[0031] According to an embodiment of the present application, sending the question to the functional module to obtain the answer output by the functional module includes:
[0032] In the case where the working agent includes multiple functional modules, the question is analyzed to determine a target functional module suitable for answering the question, the question is sent to the target functional module, and the answer output by the target functional module is obtained.
[0033] In this embodiment, by integrating multiple functional modules in the working intelligent body and intelligently selecting the most appropriate functional module for processing according to the characteristics of the problem, the problem can be correctly guided to the module with corresponding professional capabilities, thereby obtaining a more in-depth and accurate answer.
[0034] According to an embodiment of the present application, different functional modules correspond to different second functional descriptions;
[0035] The step of analyzing the problem to determine a target functional module suitable for answering the problem includes:
[0036] The problem is compared with the second functional description corresponding to each functional module to determine the target functional module.
[0037] In this embodiment, the second functional description provides a clear definition of the capabilities of the functional modules. By comparing the problem with the second functional description of each functional module, the working agent can quickly and accurately identify the functional module that is most suitable for answering the problem, so that the problem can be handled by the functional module with corresponding expertise and resources, which significantly improves the professionalism and accuracy of problem handling.
[0038] According to one embodiment of the present application, the problem is related to programming.
[0039] In a second aspect, the present application provides a multi-agent-based PLC automation programming system, comprising: a distribution agent and a plurality of working agents; the plurality of working agents include a PLC code-related working agent, an online search-related working agent, and a file retrieval-related working agent;
[0040] The distribution agent is used to obtain questions input by users, analyze the questions to determine a target working agent suitable for answering the questions, and route the questions to the target working agent;
[0041] The working agent is used to answer the received question, obtain the answer corresponding to the question, and return the answer to the distribution agent.
[0042] According to the multi-agent based PLC automation programming system of the present application, by building a multi-agent framework for managing a large model, the distribution function and work function of the agent are separated. The distribution agent is responsible for receiving and preliminarily analyzing problems. Multiple work agents include PLC code-related work agents, online search-related work agents and file retrieval-related work agents. The work agents focus on answering specific questions, realizing the modularity of the system. As new requirements emerge, new work agents can be simply added or existing agents can be updated, so that the system can flexibly respond to various application requirements without large-scale modifications to the entire process, reducing the customization and maintenance costs of requirements and improving the processing efficiency of PLC automation programming.
[0043] According to one embodiment of the present application, different working agents correspond to different first functional descriptions;
[0044] The step of analyzing the problem to determine a target working agent suitable for answering the problem comprises:
[0045] The problem is compared with the first functional description corresponding to each working agent to determine the target working agent.
[0046] According to one embodiment of the present application, the working agent includes at least one functional module; the functional module of the PLC code-related working agent includes at least one of a PLC code information module, a PLC code generation module, a PLC code verification module and a document retrieval module; the functional module of the online search-related working agent includes an online retrieval module; the functional module of the document retrieval-related working agent includes at least one of a document summary module and a document retrieval module.
[0047] According to one embodiment of the present application, the PLC code generation module includes a RAG model; the RAG model includes a retrieval module and a generation module;
[0048] The retrieval module is used to retrieve target information from relevant sample codes, PLC standard motion libraries and PLC code related documents according to user input;
[0049] The generating module is used to generate PLC code according to the user input and the target information.
[0050] In this embodiment, RAG technology retrieves relevant information from a wide range of document databases, enabling the large model to have more knowledge to handle problems in specific fields without retraining the model, thereby making up for the shortcoming of the large model in terms of insufficient knowledge in professional fields. By supplementing a large amount of question-related information, knowledge is added to the large model, thereby greatly improving the quality of the answers.
[0051] According to an embodiment of the present application, answering the received question to obtain an answer corresponding to the question includes:
[0052] In the case where the working agent includes multiple functional modules, the question is analyzed to determine a target functional module suitable for answering the question, the question is sent to the target functional module, and the answer output by the target functional module is obtained.
[0053] According to an embodiment of the present application, different functional modules correspond to different second functional descriptions;
[0054] The step of analyzing the problem to determine a target functional module suitable for answering the problem includes:
[0055] The problem is compared with the second functional description corresponding to each functional module to determine the target functional module.
[0056] According to one embodiment of the present application, the functional module is also used to receive the question, retrieve target information associated with the question from a pre-built file data set through RAG technology, input the question and the target information into the big model, and obtain the answer output by the big model.
[0057] The above one or more technical solutions in the embodiments of the present application have at least one of the following technical effects:
[0058] According to the multi-agent based automation processing system of the present application, by building a multi-agent framework for managing large models, the distribution function and work function of the agent are separated. The distribution agent is responsible for receiving and preliminary analysis of problems, while the work agent focuses on answering specific questions, thus realizing the modularity of the system. As new requirements emerge, new work agents can be simply added or existing agents can be updated, allowing the system to flexibly respond to various application requirements without large-scale modifications to the entire process, reducing the customization and maintenance costs of requirements and improving the processing efficiency of the automation process.
[0059] Furthermore, in some embodiments, by making a detailed comparison between the problem content and the functional description of each working agent, the system can quickly identify and select the working agent that is most suitable for answering a specific problem, so that the problem can be handled by a working agent with corresponding expertise and resources, thereby improving the success rate of problem solving.
[0060] Furthermore, in some embodiments, by splitting a complex problem into multiple sub-problems, the system can understand the user's original needs more carefully, and refine broad or multi-dimensional problems into more specific queries, so as to facilitate more accurate matching of professional fields, so that the sub-problems can be answered by the most suitable working agent, thereby improving the professionalism and pertinence of problem handling.
[0061] Furthermore, in some embodiments, by using the answer to the previous sub-problem as the information context and routing it together with the next sub-problem to the corresponding target working agent, this continuous information flow ensures the coherence of problem solving, so that the solution to the sub-problem can be carried out on the basis of the previous step, constructing a dynamic knowledge accumulation process, making the entire problem-solving process more intelligent and efficient.
[0062] Furthermore, in some embodiments, by distributing intelligent agents to conduct in-depth analysis of the answers and determine whether the problem has been solved, strict monitoring and quality control of the problem-solving process is achieved. When the problem is satisfactorily answered, the answer will be returned to the user, thereby improving user satisfaction and enhancing the credibility of the system.
[0063] Furthermore, in some embodiments, by analyzing the problem and existing answers, the distribution agent can identify why the problem is not solved, which may be due to the working agent's professional mismatch or insufficient answer, and thus specifically select a more appropriate agent to handle it, thereby improving the flexibility and accuracy of problem solving.
[0064] Furthermore, in some embodiments, by integrating at least one functional module within the working agent, the working agent is allowed to perform specialized processing on specific types of problems, so that the problems can receive in-depth analysis and answers in the required professional fields, thereby improving the accuracy and efficiency of problem solving.
[0065] Furthermore, in some embodiments, by integrating multiple functional modules in the working agent and intelligently selecting the most appropriate functional module for processing according to the characteristics of the problem, the problem can be correctly guided to the module with corresponding professional capabilities, thereby obtaining a more in-depth and accurate answer.
[0066] Furthermore, in some embodiments, the second functional description provides a clear definition of the capabilities of the functional modules, and by comparing the problem with the second functional descriptions of each functional module, the working agent can quickly and accurately identify the functional module that is most suitable for answering the problem, so that the problem can be handled by the functional module with corresponding expertise and resources, which significantly improves the professionalism and accuracy of problem handling.
[0067] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0069] Figure 1 is an architecture diagram of a multi-agent-based automated processing system provided in an embodiment of the present application;
[0070] Figure 2 It is an architecture diagram of a multi-agent based PLC automation programming system provided in an embodiment of the present application;
[0071] Figure 3 It is a schematic diagram of the data processing process of the functional module provided in the embodiment of the present application;
[0072] Figure 4 This is one of the flow charts of the multi-agent based automated processing method provided in the embodiment of the present application;
[0073] Figure 5 This is the second flow chart of the multi-agent-based automated processing method provided in the embodiment of the present application;
[0074] Figure 6 It is one of the structural schematic diagrams of the multi-agent based automated processing device provided in the embodiment of the present application;
[0075] Figure 7 This is the second structural diagram of the multi-agent-based automated processing device provided in the embodiment of the present application;
[0076] Figure 8 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0077] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0078] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0079] Currently, there are two main technical directions in the field of large model applications: 1. Continuously train large models to directly improve model capabilities, and use the model's native capabilities to complete various scenario tasks; 2. Do not train large models, but only use their thinking logic and semantic understanding capabilities to develop an application framework that uses large models as the capability base.
[0080] In the first technical direction, since the number of parameters of large models is in the billions or tens of billions, the high training cost is unaffordable for ordinary companies. In addition, with the iteration of large model capabilities, various mainstream large models have excellent thinking logic and semantic understanding capabilities with little difference. The main ability difference is reflected in the depth and breadth of knowledge, and this difference can be compensated by using external technologies, such as Retrieval-Augmented Generation (RAG), which is technical direction 2.
[0081] In technical direction 2, the current mainstream large model application framework includes the open source langchain framework, which provides a set of simple interfaces for quickly building large model applications, such as chatting with large models, querying information, etc.
[0082] However, the framework has many limitations: it only supports some specific large models, but does not fully support other models, and many interfaces of the framework are customized for the PGT (Prompt-based Generation and Transformation) model and cannot be directly migrated to other models. The main capability of the framework is the simplicity and speed of single-chain construction, but if the single-chain is customized for specific needs, the maintenance and customization costs will increase as the demand increases.
[0083] This application takes into account that if a multi-agent framework for managing large models can be built, the distribution function and work function of the agent can be separated. The distribution agent is responsible for receiving and preliminarily analyzing problems, while the work agent focuses on answering specific questions, thus realizing the modularity of the system. As new needs emerge, new work agents can be simply added or existing agents can be updated, so that the system can flexibly respond to various application needs. This is expected to solve the problem of increased maintenance and customization costs in the prior art as demand increases.
[0084] The following, in conjunction with the accompanying drawings, describes in detail the multi-agent-based automation processing system and PLC automation programming system provided by the embodiments of the present application through specific embodiments and their application scenarios.
[0085] like Figure 1 As shown, the multi-agent based automated processing system may include a distribution agent and multiple working agents.
[0086] In the embodiment of the present application, an agent is a system that can perceive its environment and make decisions based on the perceived information to achieve a specific goal. In the field of artificial intelligence, an agent can be any form of software or hardware.
[0087] In an embodiment of the present application, the distribution agent can be used to obtain questions input by users, analyze the questions to determine a target working agent suitable for answering the questions, and route the questions to the target working agent.
[0088] In some embodiments, the engine behind the distribution agent can be a large model. The role of this large model is not just simple data processing, but through its powerful understanding and analysis capabilities, it conducts in-depth analysis of the questions input by the user. The analysis process involves semantic understanding of the problem, context association, and possible intention recognition. The large model can use its advanced natural language processing capabilities to identify the key elements of the problem and match them with existing knowledge and information bases to determine the most suitable working agent to answer the problem. This process can be viewed as an intelligent routing mechanism, in which the large model, as the "brain" of the distribution agent, is responsible for assigning problems to the most appropriate working agent. This allocation is not only based on the surface text of the problem, but may also take into account the complexity, professionalism, and historical processing data of the problem so that the problem can be handled most effectively.
[0089] For example, if the user's question involves the automation programming of a programmable logic controller (PLC), the big model will identify the terms and concepts related to PLC programming and assign the question to a work agent related to PLC programming. If the question requires obtaining information from the Internet, the big model will transfer the question to a work agent related to online search. For questions that require retrieving specific files or documents, the big model will assign the task to a work agent related to file retrieval.
[0090] In some embodiments, the distribution agent can also classify the questions through keyword recognition, topic modeling or predefined classification rules to classify the questions into one or more related fields or topics; it can also identify key entities in the questions, such as names, places, times, proper nouns, etc.; it can also use natural language processing technology to identify the intention of the question and obtain the goals or needs behind the user's question, such as seeking information, solving problems or performing tasks; it can also analyze the context information in the question to determine the specific context of the question, including the user's historical interactions, current environmental status or other relevant information. Then, according to the analysis results of the problem, it is matched with the capabilities of each working agent. Among them, different working agents can have specific functions or domain expertise, and the analysis results are matched with the capabilities of each working agent to find the working agent that is most suitable for handling the problem. For example, the distribution agent can obtain the functional or domain expertise information corresponding to each working agent, and then by matching the analysis results with the functional or domain expertise information, the working agent with the highest matching degree is determined as the working agent that is most suitable for handling the problem.
[0091] Of course, in some embodiments, the distribution agent may also consider the current load conditions of each agent and select a working agent that can effectively handle the problem without being overloaded.
[0092] In the embodiment of the present application, the multi-agent-based automated processing system includes a plurality of working agents. When receiving a question, the working agent answers the question, obtains the answer corresponding to the question, and returns the answer to the distributing agent.
[0093] In some embodiments, the engine behind the working agent can also be a large model. Each working agent may have a large model optimized for a specific field or task, so that the distributed large model can use the appropriate working agent to handle the problem according to different problem types and complexities, thereby improving the accuracy and efficiency of the answer. For example, if a working agent is responsible for handling scientific problems, the large model behind the working agent can be trained to understand and answer professional questions in the scientific field, including but not limited to physics, chemistry, biology, etc. The large model can contain a large amount of scientific literature, experimental data and theoretical frameworks, so as to provide in-depth and accurate scientific answers.
[0094] If the working agent focuses on solving technical problems, such as those related to programming or software engineering, the big model behind the working agent can be trained to understand and answer questions in the fields of programming languages, software development processes, algorithm optimization, etc. The big model can include a large amount of code bases, technical documents and best practices, enabling it to provide professional technical answers.
[0095] The big models used by the working agent and the distribution agent can be different. The big model of the distribution agent focuses more on understanding and classifying problems, while the big model of the working agent focuses more on in-depth answers in specific fields. The working agent can call the big model behind it to answer the problem and get the corresponding answer. This call can be real-time or based on pre-set rules and logic. In some cases, the distribution agent can split the problem and distribute the split problems to different working agents to integrate knowledge from multiple fields to provide a comprehensive answer. This multi-model collaboration mechanism makes the entire system more flexible and powerful, and can handle more complex and diverse problems.
[0096] In some embodiments, the working agent may include in-depth analysis of the problem in the process of answering the question, such as semantic understanding of the problem, intent recognition, and key information extraction. According to the content of the question, the working agent accesses its built-in knowledge base or external data source to retrieve relevant information. Using the retrieved relevant information and built-in logical reasoning capabilities, such as problem-solving algorithms, decision trees, rule engines, etc., the working agent can generate answers to the questions. After generating the answer, the working agent may need to verify the accuracy and relevance of the answer, for example, through an internal verification mechanism or a consistency check with the knowledge base. Of course, the working agent can also optimize the answer according to the user's needs and context to meet the user's actual needs.
[0097] In some embodiments, the multi-agent-based automated processing system can adapt to different large models, and the engines of the distribution agent and the working agent can be different large models. For example, a customized langchain interface class can be developed to meet the access format of different large models, or the large model interface can be packaged in a call class supported by langchain to achieve the adaptation of various large models. Among them, these large models can be domestic large models, such as Kimi, Wenxin Yiyan, Tongyi Qianwen and other domestic large models, or they can be foreign large models such as GPT (Generative Pre-trained Transformer) and PaLM (PathwaysLanguage Model), which are not limited in the embodiments of the present application.
[0098] In some embodiments, the multi-agent based automation processing system can be applied to any scenario, such as programmable logic controller (PLC) automation programming scenarios, medical consultation and diagnosis assistance scenarios, data analysis and report generation scenarios, traffic and navigation scenarios, etc., or other scenarios. The multi-agent based automation processing system provided in the embodiment of the present application is a general automation process processing system, and the embodiment of the present application does not limit the application scenarios.
[0099] For different application scenarios, the questions input by the user can also be different. For example, in the PLC automation programming scenario, the user's questions are related to programming, such as "generate required code", "query code related information", etc., so as to realize the functions related to automatic generation of PLC code. Of course, for other application scenarios, the questions are also related to these application scenarios.
[0100] According to the multi-agent based automation processing system of the present application, by building a multi-agent framework for managing large models, the distribution function and work function of the agent are separated. The distribution agent is responsible for receiving and preliminary analysis of problems, while the work agent focuses on answering specific questions, thus realizing the modularity of the system. As new requirements emerge, new work agents can be simply added or existing agents can be updated, allowing the system to flexibly respond to various application requirements without large-scale modifications to the entire process, reducing the customization and maintenance costs of requirements and improving the processing efficiency of the automation process.
[0101] In some embodiments, different working agents correspond to different first functional descriptions;
[0102] Analyze the problem to determine the target working agent suitable for solving the problem, including:
[0103] Compare the problem with the first functional description corresponding to each working agent and determine the target working agent.
[0104] In this embodiment, the first function description is a description of the functions or capabilities possessed by the working agent. Different working agents have corresponding first function description information. For example, the description information of the working agent may be "providing real-time weather information and forecasts", "providing multi-language translation services", etc.
[0105] In one example, if Figure 2 As shown, in a programmable logic controller (PLC) automation programming scenario, PLC code-related working agents, online search-related working agents, and file retrieval-related working agents may be included.
[0106] The PLC code-related working agent focuses on answering questions related to PLC programming and code generation. The engine behind the working agent can be a large model, such as ChatGPT, which can be pre-trained to understand and execute the specific syntax and logic of the PLC programming language, so that it can better quickly generate or optimize PLC code according to complex PLC programming requirements described in natural language, which can reduce the possibility of PLC coding errors and speed up development. Accordingly, according to the function of the PLC code-related working agent, the first functional description information corresponding to the PLC code-related working agent can be "an assistant focused on PLC code-related tasks."
[0107] The engine behind the online search-related work agent can be based on the Agentic RAG (Retrieval-Augmented Generation) big model, which can be equipped with a series of tools, which are software components or services associated with specific documents or data sources. These tools can retrieve, process and generate information from their respective data sources, such as language segmentation tools, information synthesis tools, network retrieval tools, etc. The big model can receive user queries and decide on the appropriate course of action, coordinate different tools, and jointly complete an effective task, such as retrieving, processing and generating information from multiple data sources. Accordingly, according to the functions of the online search-related work agent, the first functional description information corresponding to the online search-related work agent can be "an assistant focused on online search tasks."
[0108] The engine behind the document retrieval-related work agent can be a large model similar to the MRKL architecture. The document retrieval-related work agent can integrate the large model with external tools to solve complex problems, including building modules and routers, and routing natural language queries. The work agent is able to store and recall information, simulate human short-term and long-term memory to support multiple rounds of dialogue and task completion, and can quickly access user features and business data stored in the database to achieve efficient document retrieval and information provision. Accordingly, according to the functions of the document retrieval-related work agent, the first functional description information corresponding to the document retrieval-related work agent can be "an assistant focused on document retrieval."
[0109] The first functional description corresponding to the working agent can be pre-associated and stored in a database. After receiving the question input by the user, the distribution agent can call the data in the database to compare the question with the first functional description corresponding to each working agent to determine the target working agent. Alternatively, after receiving the question input by the user, the distribution agent obtains the first functional description corresponding to each working agent.
[0110] In some embodiments, the distribution agent can also input the problem and the first functional description corresponding to each working agent into the big model, and use the big model to analyze the problem to determine the target working agent suitable for answering the problem.
[0111] In some embodiments, the distribution agent can extract keywords of the question, match the keywords with the first functional descriptions corresponding to each working agent, or calculate semantic similarity. For example, the similarity or matching degree between the keyword of the question and each first functional description can be evaluated by cosine similarity or Jaccard similarity. The working agent corresponding to the first functional description with the highest matching degree is used as the target working agent.
[0112] Of course, in the process of calculating similarity or matching, weights can also be assigned to different keywords to reflect the importance of these keywords in determining the target work agent. The weight can be determined based on factors such as the complexity of the problem and the agent's professional field. Based on the matching degree and weight, a comprehensive score is calculated for each work agent to measure its ability to answer the question, and the work agent with the highest comprehensive score is selected as the target work agent.
[0113] In this embodiment, by making a detailed comparison between the problem content and the functional description of each working agent, the system can quickly identify and select the working agent that is most suitable for answering a specific problem, so that the problem can be handled by a working agent with corresponding expertise and resources, and the success rate of problem solving is improved.
[0114] In some embodiments, analyzing a problem to determine a target working agent suitable for answering the problem includes:
[0115] Analyze the problem to break it down into sub-problems;
[0116] Determine the target working agent suitable for solving each sub-problem respectively.
[0117] In this embodiment, for some complex problems, the distribution agent needs to split the problem into multiple sub-problems and then determine a suitable working agent for each sub-problem.
[0118] For example, a user asks a question involving travel planning: "I plan to travel to Italy next month and need to know about visa requirements, local weather, travel budget, and cultural customs." After the distribution agent analyzes this question, it can be divided into four sub-questions: visa requirements, local weather, travel budget, and cultural customs. Then, each sub-question can be compared with the first functional description corresponding to each work agent to determine the target work agent corresponding to each sub-question. For example, for visa requirements, the corresponding target work agent can be determined to be a work agent that provides visa information; for local weather, the corresponding target work agent can be determined to be a work agent that provides real-time and forecast weather information; for travel budget, the corresponding target work agent can be determined to be a work agent that provides financial planning and budget suggestions; for cultural customs, the corresponding target work agent can be determined to be a work agent that provides cultural and customs information.
[0119] In this embodiment, by splitting a complex problem into multiple sub-problems, the system can understand the user's original needs more carefully, and break down broad or multi-dimensional problems into more specific queries, facilitating more accurate matching of professional fields, so that the sub-problems can be answered by the most suitable working agents, thereby improving the professionalism and pertinence of problem handling.
[0120] In some embodiments, routing the question to a target worker agent includes:
[0121] When the answer to the previous sub-question is obtained, the next sub-question and the answer to the previous sub-question are routed to the target working agent corresponding to the next sub-question.
[0122] In this embodiment, for some complex problems, after the problem is split into multiple sub-problems, the answers to some sub-problems need to rely on the answers to other sub-problems. For example, the question raised by the user is "please refer to the relevant code standard documents first, and then generate the required code based on the document content". After the distribution agent analyzes this question, it can split this question into two sub-problems: refer to the relevant code standard documents and generate the required code based on the referenced document content.
[0123] like Figure 2 As shown, it can be determined that the target working agent corresponding to the reference of the relevant code standard document is the file retrieval-related working agent, and the target working agent corresponding to the required code generated by combining the referenced document content is the PLC code-related working agent. The distribution agent can first route the reference of the relevant code standard document to the file retrieval-related working agent, obtain the answer returned by the file retrieval-related working agent, and then route the answer and the required code generated by combining the referenced document content to the PLC code-related working agent, and obtain the final result fed back by the PLC code-related working agent.
[0124] In this embodiment, the answer to the previous sub-problem is used as the information context and routed to the corresponding target working agent together with the next sub-problem. This continuous information flow ensures the coherence of problem solving, so that the solution to the sub-problem can be carried out on the basis of the previous step, constructing a dynamic knowledge accumulation process, making the entire problem-solving process more intelligent and efficient.
[0125] In some embodiments, the distribution agent is also used to:
[0126] Analyze the answer to determine whether the problem is solved; if the problem is solved, return the answer to the user.
[0127] In this embodiment, the distribution agent is not only responsible for routing and coordination in the question answering process, but also plays the role of analyzing and judging the answers to improve the accuracy of the answers to the questions.
[0128] Specifically, the distribution agent can check whether the answer contains all the necessary information required for the question. For example, if a user asks how to use a product, the answer should include every step of using the product. The information in the answer can also be verified to ensure its correctness, for example, by comparing it with a reliable data source, or using a built-in knowledge base for verification. It can also be checked whether the information in the answer is logically consistent and whether it includes any contradictions. Of course, natural language processing technology can also be used to analyze the user's intention in asking questions and determine whether the answer meets this intention; the distribution agent can also input questions and answers into a large model to determine whether the problem is solved through the large model. The embodiment of the present application does not limit how the distribution agent determines whether a problem is solved.
[0129] In this embodiment, the distribution agent conducts in-depth analysis of the answers and determines whether the problem is solved based on this, thereby achieving strict monitoring and quality control of the problem-solving process. When the problem is satisfactorily answered, the answer will be returned to the user, thereby improving user satisfaction and enhancing the credibility of the system.
[0130] In some embodiments, the distribution agent is also used to:
[0131] In the case where the question is not solved, the question and answer are analyzed to redetermine the target working agent suitable for answering the question, and the question is routed to the redetermined target working agent.
[0132] In this embodiment, when the problem is not solved, it may be that the selected target work agent is inappropriate. The distribution agent can analyze the question and the answer, clarify the specific aspects of the problem that are not solved, and then redetermine the target work agent corresponding to the problem based on the analysis results.
[0133] For example, suppose the user's question is: "How do I grow organic tomatoes at home?" The initial answer is: a working agent focused on gardening provides basic planting steps. The distribution agent can evaluate whether the answer is comprehensive and whether it includes steps unique to organic farming, such as using natural fertilizers. If the answer is not comprehensive enough, the distribution agent will consider the question unsolved. For example, the distribution agent analyzes the keyword "organic" in the question and believes that there is no description of "organic" in the initial answer. It can decide to reroute the question to a working agent focused on organic farming.
[0134] In this embodiment, by analyzing the problem and existing answers, the distribution agent is able to identify why the problem is not solved, which may be due to the working agent's professional mismatch or insufficient answer, and thus select a more suitable agent to handle it in a targeted manner, thereby improving the flexibility and accuracy of problem solving.
[0135] In some embodiments, the working agent includes at least one functional module;
[0136] Answer the questions received and get the answers to the questions, including:
[0137] Send the question to the functional module and get the answer output by the functional module.
[0138] In this embodiment, the working agent may include one or more functional modules, and different functional modules are responsible for processing specific types of tasks or problems. When the working agent receives a question, it can send the question to the corresponding functional module for processing according to the type and content of the question.
[0139] like Figure 2 As shown, the functional modules of the PLC code-related working agent may include: a PLC code information module, a PLC code generation module, a PLC code verification module, and a document retrieval module; the functional modules of the online search-related working agent may include: an online retrieval module; the functional modules of the file retrieval-related working agent may include: a document summary module and a document retrieval module.
[0140] In this embodiment, the PLC code information module is responsible for storing and providing information related to PLC programming, such as instruction sets, programming specifications, error codes, etc., so as to provide reference and assistance in the programming process. For example, if a user needs to write a PLC program to control the start and stop of a motor, the PLC code information module can provide the instruction set and programming specifications of a specific PLC model, and how to use a specific input and output module to control the motor after obtaining the user's requirements.
[0141] The PLC code generation module can use a similar Simulink-PLC code generation technology. This module can build a controller model and define input and output interfaces and internal variables, use the PLCcoder toolbox to configure the IDE, code storage location, and variable storage location of the code application, and finally generate PLC code. For example, a user designs a control flow chart and needs to convert it into PLC code. After the PLC code generation module obtains the flow chart and related parameters input by the user, it can generate the corresponding ladder logic and PLC code.
[0142] The PLC code check module is responsible for checking whether the generated PLC code complies with programming specifications and logic to ensure the correctness and security of the code. For example, after a user writes a piece of PLC code, he needs to confirm whether there are syntax errors and logic errors. He submits the code to the PLC code check module, which analyzes the code and points out potential problems, such as undefined tags or logic conflicts.
[0143] The document retrieval module is used to retrieve and access the modules that store PLC project documents and related technical materials, so as to quickly find the required documents during programming and maintenance. For example, during the debugging process, the user encounters an error code, and can use the document retrieval module to query. The document retrieval module can retrieve internal or external document libraries based on the user's query and provide relevant technical documents and solutions.
[0144] The online search module is responsible for retrieving relevant information from the Internet to answer the user's query. The online search module can use the network search engine to collect real-time information and improve the system's ability to handle dynamic queries. For example, if a user needs to understand the latest PLC technology trends, the online search module can collect the latest industry news, technical articles and forum discussions through the network search engine to provide a comprehensive information overview.
[0145] The document summary module can be similar to AI (Artificial Intelligence) PDF summary tools. The document summary module can summarize long PDF, word or other format files, use accurate text recognition functions to provide users with content summaries, and allow users to ask specific questions through chat. For example, a user needs to quickly understand the technical documents of a large project. After uploading the technical documents, the document summary module can analyze the document content, extract key information and summaries, so that users can quickly grasp the core content of the document.
[0146] The document retrieval module can be used to retrieve and access stored project documents and related technical information so that the required documents can be found quickly when needed. For example, if a user needs to review past project cases, the document retrieval module can retrieve relevant documents from the document library based on the keywords or attributes provided by the user and provide them to the user.
[0147] When the working agent receives a question, it can send the question to the functional module and obtain the answer output by the functional module.
[0148] Taking the problem processing of the PLC code information module in the PLC code-related working agent as an example, the question input by the user is "describe the function of the input code", and the PLC code information module can call the big model to process the user's question and get the answer output by the big model. Of course, in the PLC automation programming scenario, since PLC code is highly professional in the industrial field, has a specific application, and has complex syntax, major industrial manufacturers regard the PLC code they develop as privacy, and there is almost no open source visible and reference-worthy code on the market. This also directly leads to the big model's ability in the field of PLC code generation is far inferior to other mainstream programming languages. Therefore, it is far from enough to rely solely on the native capabilities of the big model to generate code that meets industrial scenarios.
[0149] In some embodiments, the PLC code generation module includes a RAG model; the RAG model includes a retrieval module and a generation module;
[0150] A retrieval module, for retrieving target information from relevant sample codes, PLC standard motion libraries and PLC code related documents according to user input;
[0151] A generating module is used to generate a PLC code according to the user input and the target information.
[0152] In this embodiment, if Figure 3 As shown, the target information related to the question can be retrieved from the file dataset constructed by using the Retrieval-Augmented Generation (RAG) technology, such as relevant codes, relevant grammar standards, relevant standard libraries, etc., and then the retrieved target information and the question entered by the user, including the question (prompt), are fed as input to the big model, and the big model generates an answer based on the retrieved relevant information.
[0153] In this embodiment, RAG is a model architecture that combines information retrieval and text generation, aiming to improve the performance of natural language processing tasks. RAG models are usually composed of two main parts: a retrieval module: using information retrieval techniques, such as traditional search algorithms, or modern neural network-based retrieval techniques, etc., to find documents or fragments related to the input query from a large document library; a generation module: based on the retrieved information, a natural language response is generated through a large model.
[0154] like Figure 3 As shown, the user input can be a prompt or question, for example, the user enters a question or requirement about PLC programming. The input can be formatted or preprocessed so that the model can better understand and process it. Figure 3 In the RAG model, the retrieval module may include relevant sample codes, PLC standard motion libraries, and PLC code-related documents. The relevant sample codes may include a pre-built code library or database, from which sample PLC codes related to user input may be retrieved; the PLC standard motion library may store standardized programming modes, function blocks, or logic structures, etc., from which standardized programming modes, function blocks, or logic structures related to user input may be retrieved; the PLC code-related documents may store technical documents or reference materials related to PLC programming, and by retrieving PLC code-related documents, more accurate code generation may be provided. The corresponding PLC code is generated by combining the retrieved relevant information with the user input.
[0155] In this embodiment, RAG technology retrieves relevant information from a wide range of document databases, enabling the large model to have more knowledge to handle problems in specific fields without retraining the model, thereby making up for the shortcoming of the large model in terms of insufficient knowledge in professional fields. By supplementing a large amount of question-related information, knowledge is added to the large model, thereby greatly improving the quality of the answers.
[0156] In this embodiment, by integrating at least one functional module within the working agent, the working agent is allowed to perform specialized processing on specific types of problems, so that the problems can receive in-depth analysis and answers in the required professional fields, thereby improving the accuracy and efficiency of problem solving.
[0157] In some embodiments, sending a question to a functional module and obtaining an answer output by the functional module includes:
[0158] When the working agent includes multiple functional modules, the question is analyzed to determine the target functional module suitable for answering the question, the question is sent to the target functional module, and the answer output by the target functional module is obtained.
[0159] In this embodiment, the working agent can analyze the question input by the user through the large model, and then determine the most suitable functional module to answer the question based on the analysis results.
[0160] In this embodiment, by integrating multiple functional modules in the working intelligent body and intelligently selecting the most appropriate functional module for processing according to the characteristics of the problem, the problem can be correctly guided to the module with corresponding professional capabilities, thereby obtaining a more in-depth and accurate answer.
[0161] In some embodiments, different functional modules correspond to different second functional descriptions;
[0162] Analyze the problem to determine the target functional module suitable for answering the problem, including:
[0163] Compare the problem with the second functional description corresponding to each functional module to determine the target functional module.
[0164] In this embodiment, the second functional description is a description of the functions or capabilities possessed by the functional module. Different functional modules may correspond to different second functional description information. For example, the description information of the functional module may be "module related to PLC code generation", "module for summarizing documents", etc.
[0165] The second functional descriptions corresponding to the functional modules can be pre-associated and stored in a database. After receiving the question, the working agent can call the data in the database to compare the question with the second functional descriptions corresponding to each functional module to determine the target working module. Alternatively, after receiving the question, the working agent can obtain the corresponding second functional descriptions from each functional module.
[0166] In some embodiments, the working agent may also input the problem and the second functional description corresponding to each functional module into the big model, and use the big model to analyze the problem to determine the target functional module suitable for answering the problem.
[0167] In some embodiments, the working agent can extract keywords of the question, match the keywords with the second functional descriptions corresponding to each functional module or calculate semantic similarity. For example, the similarity or matching degree between the keyword of the question and each second functional description can be evaluated by cosine similarity or Jaccard similarity. The functional module corresponding to the second functional description with the highest matching degree is taken as the target functional module.
[0168] Of course, in the process of calculating similarity or matching, weights can also be assigned to different keywords to reflect the importance of these keywords in determining the target functional module. The weight can be determined based on factors such as the complexity of the problem and the professional field of the agent. Based on the matching degree and weight, a comprehensive score is calculated for each functional module to measure its ability to answer questions, and the functional module with the highest comprehensive score is selected as the target functional module.
[0169] In this embodiment, the second functional description provides a clear definition of the capabilities of the functional modules. By comparing the problem with the second functional description of each functional module, the working agent can quickly and accurately identify the functional module that is most suitable for answering the problem, so that the problem can be handled by the functional module with corresponding expertise and resources, which significantly improves the professionalism and accuracy of problem handling.
[0170] The present application also provides a multi-agent based PLC automation programming system, such as Figure 1 and Figure 2 As shown, the multi-agent-based PLC automation programming system may include: a distribution agent and a plurality of working agents; the plurality of working agents include a PLC code-related working agent, an online search-related working agent, and a file retrieval-related working agent;
[0171] A distribution agent is used to obtain questions input by users, analyze the questions to determine a target working agent suitable for answering the questions, and route the questions to the target working agent;
[0172] The working agent is used to answer the received questions, obtain the answers corresponding to the questions, and return the answers to the distribution agent.
[0173] The engine behind the distributed agent can be a large model, which analyzes the question input by the user and then determines the most suitable working agent to answer the question based on the analysis results. For example, if the question input by the user is "generate required code", it can be determined that the most suitable working agent to answer the question is the working agent related to PLC code.
[0174] In some embodiments, the engine behind the working agent can also be a big model, and the big model used by the working agent and the distribution agent can be different big models. The working agent can call the big model to answer the question and get the corresponding answer. If the working agent related to the PLC code receives the question "generate required code" sent by the distribution agent, the big model can be called to generate the PLC code.
[0175] In some embodiments, the multi-agent-based automated processing system can adapt to different large models, and the engines of the distribution agent and the working agent can be different large models. For example, a customized langchain interface class can be developed to meet the access format of different large models, or the large model interface can be packaged in a call class supported by langchain to achieve the adaptation of various large models. Among them, these large models can be domestic large models, such as Kimi, Wenxin Yiyan, Tongyi Qianwen and other domestic large models, or they can be foreign large models such as GPT (Generative Pre-trained Transformer) and PaLM (PathwaysLanguage Model), which are not limited in the embodiments of the present application.
[0176] According to the multi-agent based PLC automation programming system of the present application, by building a multi-agent framework for managing a large model, the distribution function and work function of the agent are separated. The distribution agent is responsible for receiving and preliminarily analyzing problems. Multiple work agents include PLC code-related work agents, online search-related work agents and file retrieval-related work agents. The work agents focus on answering specific questions, realizing the modularity of the system. As new requirements emerge, new work agents can be simply added or existing agents can be updated, so that the system can flexibly respond to various application requirements without large-scale modifications to the entire process, reducing the customization and maintenance costs of requirements and improving the processing efficiency of PLC automation programming.
[0177] In some embodiments, different working agents correspond to different first functional descriptions;
[0178] Analyze the problem to determine the target working agent suitable for solving the problem, including:
[0179] Compare the problem with the first functional description corresponding to each working agent and determine the target working agent.
[0180] In this embodiment, the first functional description is a description of the functions or capabilities of the working agent, and different working agents correspond to different first functional description information. Figure 2 As shown, the first functional description information corresponding to the PLC code-related work agent can be "an assistant focusing on PLC code-related tasks"; the first functional description information corresponding to the online search-related work agent can be "an assistant focusing on online search tasks"; the first functional description information corresponding to the file retrieval-related work agent can be "an assistant focusing on document retrieval-related tasks".
[0181] The first functional description corresponding to the working agent can be pre-associated and stored in a database. After receiving the question input by the user, the distribution agent can call the data in the database to compare the question with the first functional description corresponding to each working agent to determine the target working agent. Alternatively, after receiving the question input by the user, the distribution agent obtains the first functional description corresponding to each working agent.
[0182] In some embodiments, the distribution agent can also input the problem and the first functional description corresponding to each working agent into the big model, and use the big model to analyze the problem to determine the target working agent suitable for answering the problem.
[0183] In this embodiment, by making a detailed comparison between the problem content and the functional description of each working agent, the system can quickly identify and select the working agent that is most suitable for answering a specific problem, so that the problem can be handled by a working agent with corresponding expertise and resources, and the success rate of problem solving is improved.
[0184] In some embodiments, the working agent includes at least one functional module; the functional module of the working agent related to the PLC code includes at least one of a PLC code information module, a PLC code generation module, a PLC code verification module and a document retrieval module; the functional module of the working agent related to the online search includes an online retrieval module; the functional module of the working agent related to the document retrieval includes at least one of a document summary module and a document retrieval module.
[0185] In this embodiment, the working agent may include one or more functional modules, and different functional modules are responsible for processing specific types of tasks or problems. When the working agent receives a question, it can send the question to the corresponding functional module for processing according to the type and content of the question.
[0186] like Figure 2 As shown, the functional modules of the PLC code-related working agent may include: a PLC code information module, a PLC code generation module, a PLC code verification module, and a document retrieval module; the functional modules of the online search-related working agent may include: an online retrieval module; the functional modules of the file retrieval-related working agent may include: a document summary module and a document retrieval module.
[0187] In this embodiment, the PLC code information module is responsible for storing and providing information related to PLC programming, such as instruction sets, programming specifications, error codes, etc., so as to provide reference and assistance in the programming process. For example, if a user needs to write a PLC program to control the start and stop of a motor, the PLC code information module can provide the instruction set and programming specifications of a specific PLC model, and how to use a specific input and output module to control the motor after obtaining the user's requirements.
[0188] The PLC code generation module can use a similar Simulink-PLC code generation technology. This module can build a controller model and define input and output interfaces and internal variables, use the PLCcoder toolbox to configure the IDE, code storage location, and variable storage location of the code application, and finally generate PLC code. For example, a user designs a control flow chart and needs to convert it into PLC code. After the PLC code generation module obtains the flow chart and related parameters input by the user, it can generate the corresponding ladder logic and PLC code.
[0189] The PLC code check module is responsible for checking whether the generated PLC code complies with programming specifications and logic to ensure the correctness and security of the code. For example, after a user writes a piece of PLC code, he needs to confirm whether there are syntax errors and logic errors. He submits the code to the PLC code check module, which analyzes the code and points out potential problems, such as undefined tags or logic conflicts.
[0190] The document retrieval module is used to retrieve and access the modules that store PLC project documents and related technical materials, so as to quickly find the required documents during programming and maintenance. For example, during the debugging process, the user encounters an error code, and can use the document retrieval module to query. The document retrieval module can retrieve internal or external document libraries based on the user's query and provide relevant technical documents and solutions.
[0191] The online search module is responsible for retrieving relevant information from the Internet to answer the user's query. The online search module can use the network search engine to collect real-time information and improve the system's ability to handle dynamic queries. For example, if a user needs to understand the latest PLC technology trends, the online search module can collect the latest industry news, technical articles and forum discussions through the network search engine to provide a comprehensive information overview.
[0192] The document summary module can be similar to AI (Artificial Intelligence) PDF summary tools. The document summary module can summarize long PDF, word or other format files, use accurate text recognition functions to provide users with content summaries, and allow users to ask specific questions through chat. For example, a user needs to quickly understand the technical documents of a large project. After uploading the technical documents, the document summary module can analyze the document content, extract key information and summaries, so that users can quickly grasp the core content of the document.
[0193] The document retrieval module can be used to retrieve and access stored project documents and related technical information so that the required documents can be found quickly when needed. For example, if a user needs to review past project cases, the document retrieval module can retrieve relevant documents from the document library based on the keywords or attributes provided by the user and provide them to the user.
[0194] When the working agent receives a question, it can send the question to the functional module and obtain the answer output by the functional module.
[0195] In this embodiment, by integrating at least one functional module within the working agent, the working agent is allowed to perform specialized processing on specific types of problems, so that the problems can receive in-depth analysis and answers in the required professional fields, thereby improving the accuracy and efficiency of problem solving.
[0196] In some embodiments, answering the received question to obtain an answer to the question includes:
[0197] When the working agent includes multiple functional modules, the question is analyzed to determine the target functional module suitable for answering the question, the question is sent to the target functional module, and the answer output by the target functional module is obtained.
[0198] In this embodiment, the working agent can analyze the question input by the user through the large model, and then determine the most suitable functional module to answer the question based on the analysis results.
[0199] In this embodiment, by integrating multiple functional modules in the working intelligent body and intelligently selecting the most appropriate functional module for processing according to the characteristics of the problem, the problem can be correctly guided to the module with corresponding professional capabilities, thereby obtaining a more in-depth and accurate answer.
[0200] In some embodiments, different functional modules correspond to different second functional descriptions;
[0201] Analyze the problem to determine the target functional module suitable for answering the problem, including:
[0202] Compare the problem with the second functional description corresponding to each functional module to determine the target functional module.
[0203] In this embodiment, the second functional description is a description of the functions or capabilities possessed by the functional module. Different functional modules may correspond to different second functional description information. For example, the description information of the functional module may be "module related to PLC code generation", "module for summarizing documents", etc.
[0204] The second functional descriptions corresponding to the functional modules can be pre-associated and stored in a database. After receiving the question, the working agent can call the data in the database to compare the question with the second functional descriptions corresponding to each functional module to determine the target working module. Alternatively, after receiving the question, the working agent can obtain the corresponding second functional descriptions from each functional module.
[0205] In some embodiments, the working agent may also input the problem and the second functional description corresponding to each functional module into the big model, and use the big model to analyze the problem to determine the target functional module suitable for answering the problem.
[0206] In this embodiment, the second functional description provides a clear definition of the capabilities of the functional modules. By comparing the problem with the second functional description of each functional module, the working agent can quickly and accurately identify the functional module that is most suitable for answering the problem, so that the problem can be handled by the functional module with corresponding expertise and resources, which significantly improves the professionalism and accuracy of problem handling.
[0207] In some embodiments, the functional module is also used to receive a question, retrieve target information associated with the question from a pre-built file data set through RAG technology, input the question and target information into the big model, and obtain an answer output by the big model.
[0208] In some embodiments, the PLC code generation module includes a RAG model; the RAG model includes a retrieval module and a generation module;
[0209] A retrieval module, for retrieving target information from relevant sample codes, PLC standard motion libraries and PLC code related documents according to user input;
[0210] A generating module is used to generate a PLC code according to the user input and the target information.
[0211] In this embodiment, when the working agent receives a question, it can send the question to the functional module and obtain the answer output by the functional module. Figure 3 As shown, the target information related to the question can be retrieved from the file dataset constructed by using the Retrieval-Augmented Generation (RAG) technology, such as relevant codes, relevant grammar standards, relevant standard libraries, etc., and then the retrieved target information and the question entered by the user, including the question (prompt), are fed as input to the big model, and the big model generates an answer based on the retrieved relevant information.
[0212] In this embodiment, RAG is a model architecture that combines information retrieval and text generation, aiming to improve the performance of natural language processing tasks. RAG models are usually composed of two main parts: a retrieval module: using information retrieval techniques, such as traditional search algorithms, or modern neural network-based retrieval techniques, etc., to find documents or fragments related to the input query from a large document library; a generation module: based on the retrieved information, a natural language response is generated through a large model.
[0213] like Figure 3 As shown, the user input can be a prompt or question, for example, the user enters a question or requirement about PLC programming. The input can be formatted or preprocessed so that the model can better understand and process it. Figure 3 In the RAG model, the retrieval module may include relevant sample codes, PLC standard motion libraries, and PLC code-related documents. The relevant sample codes may include a pre-built code library or database, from which sample PLC codes related to user input may be retrieved; the PLC standard motion library may store standardized programming modes, function blocks, or logic structures, etc., from which standardized programming modes, function blocks, or logic structures related to user input may be retrieved; the PLC code-related documents may store technical documents or reference materials related to PLC programming, and by retrieving PLC code-related documents, more accurate code generation may be provided. The corresponding PLC code is generated by combining the retrieved relevant information with the user input.
[0214] In this embodiment, RAG technology retrieves relevant information from a wide range of document databases, enabling the large model to have more knowledge to handle problems in specific fields without retraining the model, thereby making up for the shortcoming of the large model in terms of insufficient knowledge in professional fields. By supplementing a large amount of question-related information, knowledge is added to the large model, thereby greatly improving the quality of the answers.
[0215] The embodiment of the present application also provides a multi-agent based automated processing method, wherein the multi-agent based automated processing method can be applied to a terminal, and can be specifically executed by hardware or software in the terminal.
[0216] The terminal includes, but is not limited to, a portable communication device such as a mobile phone or tablet computer with a touch-sensitive surface (e.g., a touch screen display and / or a touch pad). It should also be understood that in some embodiments, the terminal may not be a portable communication device, but a desktop computer with a touch-sensitive surface (e.g., a touch screen display and / or a touch pad).
[0217] In the following various embodiments, a terminal including a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, a mouse and a joystick.
[0218] The embodiment of the present application provides an automated processing method based on a multi-agent. The execution subject of the automated processing method based on a multi-agent can be an electronic device or a functional module or functional entity in the electronic device that can implement the automated processing method based on a multi-agent. The electronic devices mentioned in the embodiment of the present application include but are not limited to tablet computers, computers, distribution agents, working agents, etc. The automated processing method based on a multi-agent provided in the embodiment of the present application is described below using the distribution agent as an execution subject as an example.
[0219] like Figure 4 As shown, the multi-agent based automated processing method includes: step 410, step 420 and step 430.
[0220] Step 410: Obtain the question input by the user;
[0221] Step 420: Analyze the problem to determine the target working agent that is suitable for answering the problem.
[0222] Step 430: route the question to the target working agent so that the target working agent can answer the question and obtain the answer corresponding to the question.
[0223] According to the multi-agent based automation processing method of the present application, by building a multi-agent framework for managing large models, the distribution function and work function of the agent are separated. The distribution agent is responsible for receiving and preliminary analysis of problems, while the work agent focuses on answering specific questions, thus realizing the modularization of the system. As new requirements emerge, new work agents can be simply added or existing agents can be updated, allowing the system to flexibly respond to various application requirements without large-scale modifications to the entire process, reducing the customization and maintenance costs of requirements and improving the processing efficiency of the automation process.
[0224] The following describes the multi-agent-based automated processing method provided in the embodiment of the present application by taking the working agent as the execution subject as an example.
[0225] like Figure 5 As shown, the multi-agent based automated processing method includes: step 510 and step 520.
[0226] Step 510: answer the received question and obtain the answer corresponding to the question; wherein the working agent is a target working agent determined by the distribution agent to be suitable for answering the question after analyzing the question input by the user;
[0227] Step 520: Return the answer to the distribution agent.
[0228] According to the multi-agent based automation processing method of the present application, by building a multi-agent framework for managing large models, the distribution function and work function of the agent are separated. The distribution agent is responsible for receiving and preliminary analysis of problems, while the work agent focuses on answering specific questions, thus realizing the modularization of the system. As new requirements emerge, new work agents can be simply added or existing agents can be updated, allowing the system to flexibly respond to various application requirements without large-scale modifications to the entire process, reducing the customization and maintenance costs of requirements and improving the processing efficiency of the automation process.
[0229] The multi-agent based automated processing method provided in the embodiment of the present application can be executed by a multi-agent based automated processing device. In the embodiment of the present application, a multi-agent based automated processing device executing the multi-agent based automated processing method is taken as an example to illustrate the multi-agent based automated processing device provided in the embodiment of the present application.
[0230] The embodiment of the present application also provides an automated processing device based on multiple agents.
[0231] like Figure 6 As shown, the multi-agent-based automated processing device includes:
[0232] An acquisition module 610 is used to acquire a question input by a user;
[0233] Determination module 620, used to analyze the problem to determine the target working agent suitable for answering the problem
[0234] The routing module 630 is used to route the question to the target working agent so that the target working agent can answer the question and obtain the answer corresponding to the question.
[0235] According to the multi-agent based automation processing device of the present application, by building a multi-agent framework for managing large models, the distribution function and work function of the agent are separated. The distribution agent is responsible for receiving and preliminarily analyzing problems, while the work agent focuses on answering specific questions, thus realizing the modularization of the system. As new requirements emerge, new work agents can be simply added or existing agents can be updated, allowing the system to flexibly respond to various application requirements without large-scale modifications to the entire process, reducing the customization and maintenance costs of requirements and improving the processing efficiency of the automation process.
[0236] The embodiment of the present application also provides a multi-agent based automated processing device, which is applied to working agents.
[0237] like Figure 7 As shown, the multi-agent-based automated processing device includes:
[0238] The answering module 710 is used to answer the received question and obtain the answer corresponding to the question; wherein the working agent is a target working agent determined by the distributing agent to be suitable for answering the question after analyzing the question input by the user;
[0239] The return module 720 is used to return the answer to the distribution agent.
[0240] According to the multi-agent based automation processing device of the present application, by building a multi-agent framework for managing large models, the distribution function and work function of the agent are separated. The distribution agent is responsible for receiving and preliminarily analyzing problems, while the work agent focuses on answering specific questions, thus realizing the modularization of the system. As new requirements emerge, new work agents can be simply added or existing agents can be updated, allowing the system to flexibly respond to various application requirements without large-scale modifications to the entire process, reducing the customization and maintenance costs of requirements and improving the processing efficiency of the automation process.
[0241] The multi-agent-based automated processing device in the embodiment of the present application can be an electronic device, or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or it can be other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc. It can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and the embodiment of the present application is not specifically limited.
[0242] The multi-agent-based automated processing device in the embodiment of the present application may be a device having an operating system. The operating system may be a Microsoft (Windows) operating system, an Android (Android) operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0243] In some embodiments, Figure 8 As shown, an embodiment of the present application also provides an electronic device 800, including a processor 801, a memory 802, and a computer program stored in the memory 802 and executable on the processor 801. When the program is executed by the processor 801, each process of the above-mentioned multi-agent-based automated processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0244] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0245] An embodiment of the present application also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned multi-agent-based automated processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0246] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0247] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned multi-agent-based automated processing method.
[0248] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0249] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned multi-agent-based automated processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0250] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0251] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0252] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0253] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0254] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0255] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.
Claims
1. A multi-agent based automated processing system, characterized in that: include: Distributed agents and multiple worker agents; The distribution agent is used to obtain questions input by users, analyze the questions to determine a target working agent suitable for answering the questions, and route the questions to the target working agent; The working agent is used to answer the received question, obtain the answer corresponding to the question, and return the answer to the distribution agent.
2. The system according to claim 1, characterized in that Different working agents have different first functional descriptions; The step of analyzing the problem to determine a target working agent suitable for answering the problem comprises: The problem is compared with the first functional description corresponding to each working agent to determine the target working agent.
3. The system according to claim 1, characterized in that The step of analyzing the problem to determine a target working agent suitable for answering the problem comprises: Analyzing the problem to split the problem into a plurality of sub-problems; Determine the target working agent suitable for solving each sub-problem respectively.
4. The system according to claim 3, characterized in that The step of routing the problem to the target working agent comprises: When the answer to the previous sub-question is obtained, the next sub-question and the answer to the previous sub-question are routed to the target working agent corresponding to the next sub-question.
5. The system according to claim 1, characterized in that The distribution agent is also used to: The answer is analyzed to determine whether the problem is solved; if the problem is solved, the answer is returned to the user.
6. The system according to claim 5, characterized in that The distribution agent is also used to: In the case where the question is not resolved, the question and the answer are analyzed to redetermine a target working agent suitable for answering the question, and the question is routed to the redetermined target working agent.
7. The system according to claim 1, characterized in that The working agent includes at least one functional module; The step of answering the received question to obtain an answer corresponding to the question includes: The question is sent to the functional module to obtain the answer output by the functional module.
8. The system according to claim 7, characterized in that The sending of the question to the functional module to obtain the answer output by the functional module includes: In the case where the working agent includes multiple functional modules, the question is analyzed to determine a target functional module suitable for answering the question, the question is sent to the target functional module, and the answer output by the target functional module is obtained.
9. The system according to claim 8, characterized in that Different functional modules have different second functional descriptions; The step of analyzing the problem to determine a target functional module suitable for answering the problem includes: The problem is compared with the second functional description corresponding to each functional module to determine the target functional module.
10. The system according to any one of claims 1 to 9, characterized in that: The problem is related to programming.
11. A multi-agent based PLC automation programming system, characterized in that: include: A distribution agent and a plurality of working agents; the plurality of working agents include a PLC code related working agent, an online search related working agent and a file retrieval related working agent; The distribution agent is used to obtain questions input by users, analyze the questions to determine a target working agent suitable for answering the questions, and route the questions to the target working agent; The working agent is used to answer the received question, obtain the answer corresponding to the question, and return the answer to the distribution agent.
12. The system according to claim 11, characterized in that Different working agents have different first functional descriptions; The step of analyzing the problem to determine a target working agent suitable for answering the problem comprises: The problem is compared with the first functional description corresponding to each working agent to determine the target working agent.
13. The system according to claim 11, characterized in that The working agent includes at least one functional module; the functional module of the PLC code-related working agent includes at least one of a PLC code information module, a PLC code generation module, a PLC code verification module and a document retrieval module; the functional module of the online search-related working agent includes an online retrieval module; the functional module of the document retrieval-related working agent includes at least one of a document summary module and a document retrieval module.
14. The system according to claim 13, characterized in that The PLC code generation module includes a RAG model; the RAG model includes a retrieval module and a generation module; The retrieval module is used to retrieve target information from relevant sample codes, PLC standard motion libraries and PLC code related documents according to user input; The generating module is used to generate PLC code according to the user input and the target information.
15. The system according to claim 13, characterized in that The step of answering the received question to obtain an answer corresponding to the question includes: In the case where the working agent includes multiple functional modules, the question is analyzed to determine a target functional module suitable for answering the question, the question is sent to the target functional module, and the answer output by the target functional module is obtained.
16. The system according to claim 15, characterized in that Different functional modules have different second functional descriptions; The step of analyzing the problem to determine a target functional module suitable for answering the problem includes: The problem is compared with the second functional description corresponding to each functional module to determine the target functional module.
17. The system according to claim 15, characterized in that The functional module is also used to receive the question, retrieve target information associated with the question from a pre-built file data set through RAG technology, input the question and the target information into the big model, and obtain the answer output by the big model.
Citation Information
Cited By
Code generation method based on graph alignment coding large model and multi-agent collaboration
CN120508285A
Code generation method based on graph alignment coding large model and multi-agent collaboration
CN120508285B
Quantitative strategy natural language construction and interpretability auxiliary system based on multi-agent collaborative architecture
CN120524938A
Multi-intelligent-agent search enhancement generation method and system based on various data sources
CN120632171A
Multi-intelligent-agent physical examination enhancement generation system and question answering method, equipment and product thereof
CN120706536A