Shipping process code generation method based on artificial intelligence
By using artificial intelligence-based large language models and agent technology to generate shipping process codes in the shipping field, it solves the problems of high cost, unstructured data processing and insufficient adaptability to business needs of RPA in the shipping field, and achieves low maintenance costs. and flexible and adaptable code generation capabilities.
Patent Information
- Application Number
- CN202410875974.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-07-02
AI Technical Summary
The application of RPA in the shipping field has the challenges of high cost, inability to handle unstructured data and complex logic, and inability to flexibly adapt to business needs.
Using large language models and agent technology based on artificial intelligence, shipping process codes are collaboratively generated through agents such as business experts, task planning, and technical management experts, and the business knowledge base and task planning knowledge base are used to achieve complex logic task decomposition and code generation. , and optimize tool selection and code evaluation through tool selection and review expert agents.
It achieves code generation with low maintenance costs, can flexibly adapt to business changes, can handle complex logic and unstructured data, and improves the efficiency of tool selection and the self-evolution ability of the code.
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of electronic digital data processing, and in particular relates to a code generation method for a shipping process. Background Art
[0002] In the application of supply chain automation technology in the shipping industry, RPA (Robotic Process Automation) as a major digital technology solution can realize functions such as automated form entry, automated email receiving and OCR (Optical Character Recognition) by simulating manual operations, which is crucial to improving efficiency and reducing human errors.
[0003] Although the application of RPA technology in the shipping field has achieved certain results in improving operational efficiency and reducing labor costs, it also faces some challenges in specific business implementation:
[0004] 1. Cost limitation: The high cost of RPA implementation is a major obstacle to its promotion in the shipping field. Although RPA can improve business efficiency in the short term, the cost of purchasing, customizing and maintaining RPA software, as well as the fees for professionals or consultants that may be required, increase the overall implementation cost.
[0005] 2. Unable to implement complex logic based on unstructured data: RPA has limited adaptability to unstructured data and complex decision-making processes in the shipping field. Since shipping business involves a large number of specifications and documents, the RPA system cannot complete complex logical judgments based on these specification documents when processing non-standard tasks.
[0006] 3. Inability to flexibly adapt to new business needs: Traditional RPA systems usually perform tasks according to predefined rules and lack the ability to quickly respond to changes in the shipping business. When facing shipping market fluctuations or business process adjustments, RPA may require manual intervention to adapt to new business needs. Summary of the invention
[0007] The present invention proposes a shipping process code generation method based on artificial intelligence, the purpose of which is to solve the problems of high maintenance cost, inability to implement complex logic based on unstructured data and inability to adapt to new needs in traditional RPA solutions.
[0008] The technical solution of the present invention is as follows:
[0009] A method for generating shipping process codes based on artificial intelligence, comprising the following steps:
[0010] Step 1: Submit the business requirements to the business expert agent based on the large language model, and the business expert agent returns the knowledge data related to the business requirements;
[0011] Step 2: Send the business requirements and knowledge data to a task planning agent based on a large language model. The task planning agent decomposes the business requirements according to the business requirements, knowledge data and task planning knowledge base to obtain a business process corresponding to the business requirements.
[0012] Step 3: Send the business process to the technical management expert agent based on the large language model, and the technical management expert agent coordination tool selects the expert agent, the technical implementation expert agent and the technical review expert agent to generate the process code;
[0013] Step 4: Run the process code in the shipping logistics supply chain system to meet business requirements; if the process code does not meet business requirements after running, manually modify the process code until the modified process code meets business requirements, and then update the task planning knowledge base based on the modified process code.
[0014] As a further improvement of the shipping process code generation method based on artificial intelligence: the business expert agent is provided with a business knowledge base, which stores the business knowledge of the shipping logistics supply chain and the operational specification knowledge of the shipping logistics supply chain system; after receiving the business demand, the business expert agent searches for relevant knowledge in the business knowledge base through vector search, and then returns the searched relevant knowledge as knowledge data.
[0015] As a further improvement of the shipping process code generation method based on artificial intelligence: the task planning knowledge base stores descriptions of multiple process schemes, the construction relationship between each process scheme and the task, and the correspondence between the task and the function label in the process scheme;
[0016] The description of the process solution is used to guide the large language model to locate an adapted process solution according to business requirements and knowledge data;
[0017] The construction relationship is the tasks included in the process plan and the execution order of the tasks;
[0018] The corresponding relationship means that when a task requires the use of a business service tool, a function label should be assigned to the task to describe the service function of the business service tool;
[0019] There is a many-to-many relationship between business service tools and function labels. A business service tool can be labeled with multiple different function labels, and a function label can be used to label multiple business service tools. However, only one function label can be assigned to a task in a process plan.
[0020] As a further improvement of the shipping process code generation method based on artificial intelligence: the business process includes task information of multiple tasks to be performed in sequence; each task information includes the attributes required to perform the task, and if a task needs to call a business service tool to be implemented, the function label of the business service tool needs to be specified;
[0021] The processing method of the technical management expert agent is:
[0022] Traverse the tasks in the business process one by one, generate code for each task separately, and then integrate them into a complete process code.
[0023] As a further improvement of the shipping process code generation method based on artificial intelligence: when the technical management expert agent generates code for a task, if the task has no assigned function label, the technical management expert agent sends the task information of the task to the technical implementation expert agent to generate the code corresponding to the task, and then the technical review expert agent evaluates the code. If the evaluation is qualified, the code is retained, otherwise the evaluation opinion is sent to the technical implementation expert agent to regenerate the code;
[0024] The technical review expert agent is based on a large language model and is mainly used to evaluate whether the code currently provided for a task meets business requirements.
[0025] As a further improvement of the shipping process code generation method based on artificial intelligence: when the technical management expert agent generates code for a certain task, if the task is assigned a function tag, indicating that the task needs to call a business service tool, the task information and function tag of the task are sent to the tool selection expert agent, and then the tool selection expert agent selects a suitable business service tool, the technical implementation expert agent generates code according to the business service tool, and the technical review expert agent evaluates the code to obtain the code of the task;
[0026] The technical review expert agent is based on a large language model and is mainly used to evaluate whether the code currently provided for a task meets business requirements.
[0027] As a further improvement of the shipping process code generation method based on artificial intelligence: when the technical management expert agent generates a code for a task, if the task is assigned a function label, the following steps are specifically performed:
[0028] Step B-1: The tool selection expert agent sorts all business service tools related to the functional tags of the current task according to the weights in the tool weight database to obtain a tool queue;
[0029] Each record in the tool weight database represents a business service tool, and each field represents a function label. If a business service tool is not related to a function label, the corresponding table value is recorded as None, otherwise the table value includes a hit count weight and a competition ratio weight; the hit count weight represents the number of times the business service tool corresponding to the row is selected when the function label corresponding to the field is specified; the competition ratio weight is a percentage, and the sum of all competition ratio weights corresponding to each function label is 1;
[0030] When sorting, the business service tools are sorted by total weight: total weight = hit count weight * (1 + competition ratio weight);
[0031] Step B-2: Start traversing the tool queue and try to generate code and evaluate each business service tool read.
[0032] As a further improvement of the shipping process code generation method based on artificial intelligence, the attempt to generate the code and evaluate it refers to processing according to step B-3 to step B-4:
[0033] Step B-3: Send the current business service tool to the technical implementation expert agent, and the technical implementation expert agent generates a code based on the tool knowledge base and sends it to the technical review expert agent; the tool knowledge base records the parameter information and code examples of all business service tools;
[0034] Step B-4: The technical review expert agent evaluates the code and informs the tool selection expert agent whether the current code meets business requirements.
[0035] As a further improvement of the shipping process code generation method based on artificial intelligence: in step B-4, if it meets the business requirements, the code is retained, and the current business service tool is used as the selected business service tool, the hit count weight of the business service tool in the current function tag is increased by 1, and at the same time, 0.1% of the competition ratio weight of the business service tool before the business service tool in the tool queue in the current function tag is deducted and added to the competition ratio weight of the selected business service tool, and the currently generated code is the code of the current task; if it does not meet the business requirements, the tool selection expert agent continues to read the next business service tool from the tool queue.
[0036] As a further improvement of the shipping process code generation method based on artificial intelligence: in step 4, updating the task planning knowledge base according to the modified process code means: running the modified process code, and obtaining process information through a process mining tool, and then inputting the business requirements, process information and the modified process code into a planning update agent based on a large language model, and the planning update agent generates a process plan corresponding to the business requirements, the construction relationship between the process plan and the task, and the correspondence between the task and the function label in the process plan by analyzing the process information and the modified process code, and writes the generated content into the task planning knowledge base.
[0037] Compared with the prior art, the present invention has the following positive effects:
[0038] 1. The present invention generates process codes based on large language models and intelligent agent technology. The intelligent agent can plan complex process tasks according to the unstructured data (business knowledge base, etc.) set up, automatically generate codes with reference to examples, and complete code evaluation and self-checking. Moreover, when business requirements change, the intelligent agent can automatically adapt and generate new codes without redevelopment, which has the advantages of low maintenance cost and good flexibility.
[0039] 2. The present invention selects business service tools based on historical weights. The weights include both hit count weights that reflect the number of historical hits and competition ratio weights that reflect the probability of the tool winning in certain situations. This allows the tool sequence generated by sorting to take into account both common scenarios and special scenarios, thereby improving the efficiency of tool selection.
[0040] 3. The present invention also uses process mining tools to mine and analyze the processes initiated by the codes adjusted by human participation, obtain process information, and further add the emerging new business requirements and verified process solutions to the task planning knowledge base through planning and updating agents to achieve self-evolution. When the same business requirement is proposed next time, the optimal process solution can be directly obtained from the task planning knowledge base, thereby quickly generating the required process code. DETAILED DESCRIPTION
[0041] The technical solution of the present invention is described in detail below. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments.
[0042] A shipping process code generation method based on artificial intelligence, the steps are as follows:
[0043] Step 1: Submit the business requirements to a business expert agent based on a large language model, and the business expert agent returns knowledge data related to the business requirements.
[0044] The business expert agent is equipped with a business knowledge base, which stores the business knowledge of the shipping logistics supply chain and the operational specification knowledge of the shipping logistics supply chain system. After receiving the business requirements, the business expert agent searches for the top 5 (top 5 relevance) related knowledge in the business knowledge base through vector search, and then returns the searched related knowledge as knowledge data.
[0045] Step 2: Send the business requirements and knowledge data to a task planning agent based on a large language model. The task planning agent decomposes the business requirements according to the business requirements, knowledge data and task planning knowledge base to obtain a business process corresponding to the business requirements.
[0046] The task planning knowledge base stores descriptions of multiple process plans, the construction relationship between each process plan and the task, and the correspondence between the task and the function label in the process plan. The description of the process plan is used to guide the large language model to locate the adapted process plan according to business needs and knowledge data. The construction relationship is the tasks included in the process plan and the execution order of the tasks. The correspondence means that when a task requires the use of a business service tool, a function label should be assigned to the task to describe the service function of the business service tool. The relationship between business service tools and function labels is many-to-many. A business service tool can be labeled with multiple different function labels, and a function label can be used to label multiple business service tools, but only one function label can be assigned to a task in a process plan.
[0047] The business process includes task information of multiple tasks to be executed in sequence. Each task information includes the attributes required to execute the task. If a task needs to call a business service tool to be implemented, the function label of the business service tool needs to be specified.
[0048] Furthermore, the task planning agent describes the business process according to the process template. The business template is in XML format, and the template example is as follows:
[0049] <?xml version="1.0" encoding="UTF-8"?>
[0050] <routes xmlns="http: / / ag.soft.org / ag / spring">
[0051] <route errorhandlerref="testErrorHandler" id="113001">
[0052] <from uri="direct:hello113" / >
[0053] <bean method="LogProcess" ref="flowProcess" / >
[0054] <bean method="LogRecordProcess(IC,path:timer: / / ded023cc-896a-4c91-a95e-df3129453478?delay=10s)" ref="flowProcess" / >
[0055] <bean method="popprocess(567,568,ad099f69-8f63-4f25-8332-7ec630f4fa31,XML)" ref="flowProcess" / >
[0056] < / route>
[0057] < / routes>
[0058] The completed business process example is as follows:
[0059] <routes xmlns="http: / / ag.soft.org / schema / spring">
[0060] <route errorhandlerref="testErrorHandler" id="113001">
[0061] <from uri="pop3: / / your-email-server?username=your-username&password=your-password&delete=true" / >
[0062] <bean method="ackprocess" ref="flowprocess" / >
[0063] <tod uri="file: / path / to / local / folder?fileName=${header.agfilename}" / >
[0064] < / route>
[0065] < / routes>
[0066] Among them, the label from represents obtaining the email content from the mailbox, the label bean represents the need to call the "Get Bill of Lading Receipt" in the business service tool to process the email content, and the "Get Bill of Lading Receipt" is the "Function Label" of the business service tool to be used for this task. The label toD means saving the email attachment to a local folder.
[0067] Step 3: Send the business process to the technical management expert agent based on the large language model, and the technical management expert agent coordination tool selects the expert agent, technical implementation expert agent and technical review expert agent to generate the process code.
[0068] The processing method of the technical management expert agent is: traverse the tasks in the business process in sequence, generate codes for each task respectively, and then integrate them into a complete process code. Specifically:
[0069] Case A: If a task is not assigned a functional label, the technical management expert agent sends the task information of the task to the technical implementation expert agent to generate the code corresponding to the task. The technical review expert agent then evaluates the code. If the evaluation is qualified, the code is retained. Otherwise, the evaluation opinion is sent to the technical implementation expert agent to regenerate the code.
[0070] The technical review expert agent is based on a large language model and is mainly used to evaluate whether the code currently provided for a task meets business requirements.
[0071] Case B: If a task is assigned a function label, indicating that the task needs to call a business service tool, the task information and function label of the task are sent to the tool selection expert agent, and then the tool selection expert agent selects the appropriate business service tool, the technical implementation expert agent generates code according to the business service tool, and the technical review expert agent evaluates the code to obtain the code for the task.
[0072] The specific processing process of situation B is as follows:
[0073] Step B-1: The tool selection expert agent sorts all business service tools related to the functional tags of the current task according to the weights in the tool weight database to obtain a tool queue.
[0074] Each record in the tool weight database represents a business service tool, and each field represents a function label. If a business service tool is not related to a function label, the corresponding table value is recorded as None, otherwise the table value contains a hit count weight and a competition ratio weight. The hit count weight represents the number of times the business service tool corresponding to the row is selected when the function label corresponding to the field is specified. The competition ratio weight is a percentage, and the sum of all competition ratio weights corresponding to each function label is 1.
[0075] When sorting, the business service tools are sorted by total weight: total weight = hit count weight * (1 + competition ratio weight). For a certain function tag, a total weight can be calculated for each related business service tool.
[0076] Step B-2, start traversing the tool queue, and process each read business service tool according to steps B-3 to B-4.
[0077] Step B-3: Send the current business service tool to the technical implementation expert agent, and the technical implementation expert agent generates a code based on the tool knowledge base and sends it to the technical review expert agent. The tool knowledge base records the parameter information and code examples of all business service tools.
[0078] Step B-4, the technical review expert agent evaluates the code and notifies the tool selection expert agent whether the current code meets the business requirements: if it meets the business requirements, the code is retained, and the current business service tool is selected as the business service tool, and the hit count weight of the business service tool in the current function label is increased by 1. At the same time, the competition ratio weight of the business service tool before the business service tool in the tool queue in the current function label is deducted by 0.1% and added to the competition ratio weight of the selected business service tool (for example, if there are 3 other tools in the queue, each of them will be deducted by 0.1%, and then the competition ratio weight of the selected tool in the current function label column is +0.3%). The currently generated code is the code for the current task; if it does not meet the business requirements, the tool selection expert agent continues to read the next business service tool from the tool queue.
[0079] Step 4: Run the process code in the shipping logistics supply chain system to implement business requirements.
[0080] Furthermore, if the process code does not meet the business requirements after running, the process code is manually modified until the modified process code meets the business requirements. Then the modified process code is run, and the process information (i.e. the content of each step task) is obtained through the process mining tool, and then the business requirements, process information and modified process code are input into the planning update agent based on the large language model. The planning update agent generates a process plan corresponding to the business requirements, the construction relationship between the process plan and the task, and the correspondence between the task and the function label in the process plan by analyzing the process information and the modified process code, and writes the generated content into the task planning knowledge base.
[0081] The process code generated initially does not meet the business requirements, which means that the process solution in the task planning knowledge base does not completely match the current business requirements. Therefore, manual intervention is required to modify the code, and then a new process solution is re-determined based on the final qualified code, and the new process solution is added to the task planning knowledge base. When the same business requirement is raised next time, the optimal process solution can be directly obtained from the task planning knowledge base, so as to quickly generate the required process code.
[0082] The intelligent agent is also called Agent. It is an intelligent agent based on the large language model (LLM). It can preset prompt words, configure knowledge base and tool library, and make inferences based on the input of users (or other programs). If necessary, it can search for knowledge or execute tools from the knowledge base and tool library (access to files, databases, and networks can also be achieved through the execution of tools), and finally give a reply. At present, open source frameworks such as Langchain and AutoGen have intelligent agent functions, and large language models such as Wenxin Yiyan and Zhipu Qingyan also support user-oriented intelligent agent development. The solution of the present invention preferably implements intelligent agents based on large language models such as GPT-4.0, Claude3.0, and GLM4.
[0083] It should be noted that it is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the present invention. The scope of the present invention is defined by the claims rather than the above description.
Claims
1. A method for generating shipping process codes based on artificial intelligence, characterized by the following steps: include: Step 1: Submit the business requirements to the business expert agent based on the large language model, and the business expert agent returns the knowledge data related to the business requirements; The business expert agent is provided with a business knowledge base, which stores the business knowledge of the shipping logistics supply chain and the operational specification knowledge of the shipping logistics supply chain system; after receiving the business demand, the business expert agent searches for the relevant knowledge in the business knowledge base through vector search, and then returns the searched relevant knowledge as knowledge data; Step 2: Send the business requirements and knowledge data to a task planning agent based on a large language model. The task planning agent decomposes the business requirements according to the business requirements, knowledge data and task planning knowledge base to obtain a business process corresponding to the business requirements. Step 3: Send the business process to the technical management expert agent based on the large language model, and the technical management expert agent coordination tool selects the expert agent, the technical implementation expert agent and the technical review expert agent to generate the process code; Step 4: Run the process code in the shipping logistics supply chain system to realize the business requirements; if the process code does not meet the business requirements after running, manually modify the process code until the modified process code meets the business requirements, and then update the task planning knowledge base according to the modified process code; The task planning knowledge base stores descriptions of multiple process plans, the construction relationship between each process plan and the task, and the correspondence between the task and the function label in the process plan; The description of the process solution is used to guide the large language model to locate an adapted process solution according to business requirements and knowledge data; The construction relationship is the tasks included in the process plan and the execution order of the tasks; The corresponding relationship means that when a task requires the use of a business service tool, a function label should be assigned to the task to describe the service function of the business service tool; There is a many-to-many relationship between business service tools and function labels. A business service tool can be labeled with multiple different function labels, and a function label can be used to label multiple business service tools. However, only one function label can be assigned to a task in a process solution. The business process includes task information of multiple tasks to be executed in sequence; each task information includes the attributes required to execute the task. If a task needs to call a business service tool to be implemented, the function label of the business service tool needs to be specified; The processing method of the technical management expert agent is: Traverse the tasks in the business process one by one, generate code for each task, and then integrate them into a complete process code; When the technical management expert agent generates code for a task, if the task has no assigned function label, the technical management expert agent sends the task information of the task to the technical implementation expert agent to generate the code corresponding to the task, and then the technical review expert agent evaluates the code. If the evaluation is qualified, the code is retained, otherwise the evaluation opinion is sent to the technical implementation expert agent to regenerate the code; The technical review expert agent is based on a large language model and is mainly used to evaluate whether the code of a certain task currently provided meets business requirements; When the technical management expert agent generates code for a task, if the task is assigned a function tag, indicating that the task needs to call a business service tool, the task information and function tag of the task are sent to the tool selection expert agent, and then the tool selection expert agent selects a suitable business service tool, the technical implementation expert agent generates code according to the business service tool, and the technical review expert agent evaluates the code to obtain the code for the task; The technical review expert agent is based on a large language model and is mainly used to evaluate whether the code of a certain task currently provided meets business requirements; When the technical management expert agent generates code for a task, if the task is assigned a function label, it performs the following steps: Step B-1, the tool selection expert agent sorts all business service tools related to the functional tags of the current task according to the weights in the tool weight database to obtain a tool queue; Each record in the tool weight database represents a business service tool, and each field represents a function label. If a business service tool is not related to a function label, the corresponding table value is recorded as None, otherwise the table value includes a hit count weight and a competition ratio weight; the hit count weight represents the number of times the business service tool corresponding to the row is selected when the function label corresponding to the field is specified; the competition ratio weight is a percentage, and the sum of all competition ratio weights corresponding to each function label is 1; When sorting, the business service tools are sorted by total weight: total weight = hit count weight * (1 + competition ratio weight); Step B-2: Start traversing the tool queue and try to generate code and evaluate each business service tool read; The attempt to generate code and evaluate it refers to processing from step B-3 to step B-4: Step B-3: Send the current business service tool to the technical implementation expert agent, and the technical implementation expert agent generates a code based on the tool knowledge base and sends it to the technical review expert agent; the tool knowledge base records the parameter information and code examples of all business service tools; Step B-4: The technical review expert agent evaluates the code and notifies the tool selection expert agent whether the current code meets the business requirements; In step B-4, if it meets the business requirements, the code is retained, and the current business service tool is selected as the business service tool. The hit count weight of the business service tool in the current function tag is increased by 1, and at the same time, the competition ratio weights of the business service tools before the business service tool in the tool queue in the current function tag are deducted by 0.1% and added to the competition ratio weight of the selected business service tool. The currently generated code is the code of the current task; if it does not meet the business requirements, the tool selection expert agent continues to read the next business service tool from the tool queue; In step 4, updating the task planning knowledge base according to the modified process code means: running the modified process code, obtaining process information through a process mining tool, and then inputting the business requirements, process information and the modified process code into a planning update agent based on a large language model. The planning update agent generates a process plan corresponding to the business requirements, the construction relationship between the process plan and the task, and the correspondence between the task and the function label in the process plan by analyzing the process information and the modified process code, and writes the generated content into the task planning knowledge base.
