Method, apparatus, device, and medium for generating workflow for production machines
The method uses a large language model with optimized prompts and simulation evaluation to generate and adapt workflows for production machines, addressing flexibility and efficiency challenges in dynamic manufacturing environments.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- SIEMENS AG
- Filing Date
- 2025-01-16
- Publication Date
- 2026-07-23
AI Technical Summary
Existing workflow generation methods for production machines are inflexible and prone to errors, particularly in industries with changing product specifications and short production runs, as they lack automated and intelligent approaches for optimizing and evaluating workflows across multiple types of production machines.
A method leveraging a large language model (LLM) with in-context learning capabilities, utilizing prompts optimized by replacing examples and skill APIs, and evaluated through simulation environments to determine optimal workflows, enabling continuous performance improvements.
The approach allows for adaptable and efficient workflow generation, responsive to evolving production requirements, with continuous learning and adaptation, ensuring high performance and flexibility in dynamic manufacturing environments.
Smart Images

Figure CN2025072793_23072026_PF_FP_ABST
Abstract
Description
Method, apparatus, device, and medium for generating workflow for production machinesFIELD
[0001] The present disclosure relates to the technical field of industry digitalization, in particular to a method, apparatus, device, and medium for generating workflow for production machines.BACKGROUND
[0002] Production machines are widely used in manufacturing industries to automate various processes and increase efficiency. These machines often require complex workflows to perform specific tasks, such as assembly, packaging, or quality control. Traditionally, workflows for production machines have been designed and programmed manually by skilled engineers, which can be time-consuming and prone to errors.
[0003] As manufacturing processes become more flexible and customizable, there is an increasing need for adaptable workflow generation methods. Small batch production presents challenges as workflows may need to be frequently modified to accommodate different product specifications or production requirements. This demand for flexibility has led to the exploration of more automated and intelligent approaches to workflow generation.
[0004] In prior art, large language models-based method is used to generate robot programs The system uses text-only prompts generated from predefined templates to produce robot instructions. However, this approach is limited in its flexibility and does not address the optimization of prompts or the evaluation of generated workflows across multiple types of production machines. Others describe methods for training or guiding an artificial intelligence agent using visual and / or text data as input to generate prompts for an ultra-large language model. While this patent introduces the use of multimodal inputs, it primarily focuses on video game control applications and does not specifically address the challenges of generating and evaluating workflows for industrial production machines.SUMMARY
[0005] Embodiments of the present disclosure propose a method, apparatus, device, and medium for generating workflow for production machines.
[0006] In a first aspect, there is provided a method for generating workflow for production machines, comprising:
[0007] generating a prompt for a large language model (LLM) , wherein the prompt comprises at least one workflow example and skill API description for skill API involved in the at least one workflow example;
[0008] providing the prompt and a user instruction to the LLM to generate a workflow corresponding to the prompt and the user instruction;
[0009] optimizing the prompt by replacing the example and / or skill API under the same category to generate a workflow for each optimized prompt;
[0010] evaluating the generated workflows using a simulation environment to determine the optimal workflow; and
[0011] executing the optimal workflow on the production machines.
[0012] Therefore, the present disclosure provides leverages an LLM with in-context learning capabilities, allowing for automatic prompt engineering, and enables easy adaptation to changing user instructions and prompts, making it highly responsive to evolving production requirements. This flexibility is particularly valuable in industries where product customization and short production runs are becoming increasingly common. Besides, the prompt is optimized based on simulation evaluation of the generated workflows, leading to continuous performance improvements, allows LLM learn and adapt over time, resulting in increasingly efficient and effective workflows for controlling production machines.
[0013] In an example, wherein generating a prompt for the LLM comprises:
[0014] selecting at least one workflow example from a workflow example repository;
[0015] determining skill API involved in the at least one workflow example; and
[0016] retrieving at least one skill API and skill API description from a skill repository.
[0017] In an example, wherein evaluating the generated workflows using a simulation environment to determine the optimal workflow comprises:
[0018] calculating performance scores based on performance metrics for each generated workflow;
[0019] determining the generated workflow with the highest performance score as the optimal workflow.
[0020] In an example, wherein the method further comprises:
[0021] converting the generated workflow into workflow example format;
[0022] adding the generated workflow and performance scores of the generated workflow into the workflow example repository.
[0023] In an example, wherein generating a prompt for a large language model comprises: sampling at least one workflow example using categorical distribution sampling method based on performance scores of the workflow examples.
[0024] In an example, wherein optimizing the prompt by replacing the example and / or skill API under the same category to generate a workflow for each optimized prompt comprises: evaluating replacement of skill API using beam search.
[0025] In an example, wherein the performance metrics comprise at least one of executability, feasibility, execution time, energy efficiency, and accuracy.
[0026] In a second aspect, there is provided a n apparatus for generating workflow for production machines, comprising:
[0027] a generating module, configured to generate a prompt for a large language model (LLM) , wherein the prompt comprises at least one workflow example and skill API description for skill API involved in the at least one workflow example;
[0028] a providing module, configured to provide the prompt and a user instruction to the LLM to generate a workflow corresponding to the prompt and the user instruction;
[0029] an optimizing module, configured to optimize the prompt by replacing the example and / or skill API under the same category to generate a workflow for each optimized prompt;
[0030] an evaluating module, configured to evaluate the generated workflows using a simulation environment to determine the optimal workflow; and
[0031] an executing module, configured to execute the optimal workflow on the production machines.
[0032] In a third aspect, there is provided an electronic device comprising a processor and a memory, wherein an application program executable by the processor is stored in the memory for causing the processor to execute a method for identifying building block as described in any of the above.
[0033] In a fourth aspect, there is provided a computer-readable medium comprising computer-readable instructions stored thereon is provided, wherein the computer-readable instructions for executing a method for identifying building block as described in any of the above.
[0034] In a fifth aspect, there is provided a computer program product comprising a computer program, when the computer program is executed by a processor for executing a method for identifying building block as described in any of the above.BRIEF DESCRIPTION OF THE DRAWINGS
[0035] To make technical solutions of examples of the present disclosure clearer, accompanying drawings to be used in description of the examples will be simply introduced hereinafter. Obviously, the accompanying drawings to be described hereinafter are only some examples of the present disclosure. Those skilled in the art may obtain other drawings according to these accompanying drawings without creative labor.
[0036] Fig. 1 is an exemplary flowchart of a method for generating workflow for production machines according to an embodiment of the present disclosure.
[0037] Fig. 2 is an exemplary schematic diagram of a system architecture according to an embodiment of the present disclosure.
[0038] Fig. 3 is an exemplary schematic diagram of optimizing the prompt by replacing skill API according to an embodiment of the present disclosure.
[0039] Fig. 4 is an exemplary schematic diagram of an apparatus for generating workflow for production machines according to an embodiment of the present disclosure.
[0040] Fig. 5 is an exemplary structural diagram of an electronic device according to an embodiment of the present disclosure.
[0041] List of reference numbers:
[0042] 100 method
[0043] 110-150 step
[0044] 20 system architecture
[0045] 21 large language model (LLM)
[0046] 22 production machines
[0047] 22A robot adaptor
[0048] 22B camera adaptor
[0049] 22C conveyer adaptor
[0050] 22D gripper adaptor
[0051] 201 prompt engineering unit
[0052] 202 user input unit
[0053] 203 workflow execution unit
[0054] 204 simulation environment
[0055] 205 workflow evaluation unit
[0056] 206 workflow example repository
[0057] 207 skill repository
[0058] 208 skill registration unit
[0059] 311, 312, 321, 322, 323, 324 branch
[0060] 400 apparatus
[0061] 410 generating module
[0062] 420 providing module
[0063] 430 optimizing module
[0064] 440 evaluating module
[0065] 450 executing module
[0066] 500 electronic device
[0067] 510 processor
[0068] 520 memoryDETAILED DESCRIPTION
[0069] To make the purpose, technical scheme, and advantages of the disclosure clearer, the following examples are given to further explain the disclosure in detail. Nouns and pronouns related to people in this patent application are not limited to specific gender.
[0070] To be concise and intuitive in description, the scheme of the disclosure is described below by describing several representative embodiments. Many details in the embodiments are only used to help understand the scheme of the disclosure. However, it is obvious that the technical scheme of the disclosure can be realized without being limited to these details. To avoid unnecessarily blurring the scheme of the disclosure, some embodiments are not described in detail, but only the framework is given. Hereinafter, "including" refers to "including but not limited to" , "according to. . . " refers to "at least according to. . ., but not limited to. . . " . When the number of an element is not specifically indicated below, it means that the element can be one or more, or can be understood as at least one.
[0071] The present disclosure provides a method for generating workflow for production machines. Fig. 1 is an exemplary flowchart of a method 100 for generating workflow for production machines according to an embodiment of the present disclosure. Workflow refers to a sequence of operations or tasks to be performed by production machines for a specific application scenario. Workflows can include steps for material handling, assembly, quality control, packaging, and other production processes. Production machines refer to equipment used in manufacturing processes. Production machines can include machine tools, assembly lines, robotic systems, and various automated equipment. As shown in Fig. 1, method 100 comprises:
[0072] step 110, generating a prompt for a large language model (LLM) , wherein the prompt comprises at least one workflow example and skill API description for skill API involved in the at least one workflow example;
[0073] large language model (LLM) refers to artificial intelligence system trained on vast amounts of text data to understand and generate human-like language. In the present disclosure, LLM is trained or adapted to understand prompt and generate workflows for production machines. Prompt is the input provided to the LLM, and LLM will generate workflows based on the prompt and user instruction.
[0074] Prompt comprises at least one workflow example and skill API description for skill API involved in the at least one workflow example. Workflow example consists of a sequential call of skill APIs. Skills encapsulate specific functionalities such as robotic movements, sensor readings, or control actions. Skill API (Application Programming Interfaces) defines how to interact with skills of production machines. Skill API description provides description of the skill API, which can help LLM to better understand the skill and prompt.
[0075] step 120, providing the prompt and a user instruction to the LLM to generate a workflow corresponding to the prompt and the user instruction;
[0076] User instruction is used to clarify user requirements for specific production scenarios. The user instruction can be in various formats, including text, images, or a combination of both. User instruction can be input from a user by input device such as keyboard, touching panel or speaker. For example, user can input user instruction “pick the black workpiece and place it at green tray” or “rotate {workpiece image} 100 degrees” . Wherein user instruction “pick the black workpiece and place it at green tray” is pure text and user instruction “rotate {workpiece image} 100 degrees” is the combination of text, images.
[0077] step 130, optimizing the prompt by replacing the example and / or skill API under the same category to generate a workflow for each optimized prompt;
[0078] In one case, examples in the prompt can be replaced. Example with higher performance scores is provided to the prompt. In some other cases, examples in the prompt keep unchanged and skill API in the examples can be replaced by other skill API under the same category. In some other cases, some examples in the prompt can be replaced, some examples in the prompt keep unchanged and skill API in the examples can be replaced by other skill API under the same category. This dynamic prompt optimization approach allows the system to adapt and improve over time, discovering optimal workflow.
[0079] Skill can be separated into different categories according to their functionalities. For example, perception category skill can include Capture2DImage, Capture3DImage, RetriveObject, ObjectIdentification, ObjectLocalization. MotionPlan category skill can include MoveJoint (joint waypoints) , MoveTCP (cartesian waypoints) , MoveSpline (waypoints) . ActuatorControl category skill can include OpenGripper (distance) , CloseGripper (force) . For each Skill under certain category, there may be different versions (e.g., motion planning with different algorithms) , different candidates. For example, In the process of skill replacement, Capture2DImage can be replaced with Capture3DImage, RetriveObject can be replaced with ObjectIdentification or ObjectLocalization
[0080] step 140, evaluating the generated workflows using a simulation environment to determine the optimal workflow;
[0081] Simulation environment is a virtual representation of the production machines and their operating conditions. It allows for testing and evaluation of generated workflows without physical execution. Evaluating the generated workflows using a simulation environment enables comprehensive assessment of workflow performance without risking physical equipment or disrupting ongoing production.
[0082] step 150, executing the optimal workflow on the production machines.
[0083] The optimal workflow is executed in the physical production environment, allowing for real-world validation and performance measurement. The execution process can include monitoring and feedback mechanisms to compare actual performance with simulated results.
[0084] Therefore, the present disclosure provides method to leverage an LLM with in-context learning capabilities, allowing for automatic prompt engineering, and enables easy adaptation to change user instructions and prompts, making it highly responsive to evolving production requirements. This flexibility is particularly valuable in industries where product customization and short production runs are becoming increasingly common. Besides, the prompt is optimized based on simulation evaluation of the generated workflows, leading to continuous performance improvements, allows LLM to learn and adapt over time, resulting in increasingly efficient and effective workflows for controlling production machines.
[0085] In one embodiment of the present disclosure, wherein generating a prompt for the LLM comprises: selecting at least one workflow example from a workflow example repository; determining skill API involved in the at least one workflow example; and retrieving at least one skill API and skill API description from a skill repository.
[0086] In detail, the workflow example repository can contain a diverse set of previously successful workflows to be selected. The skill repository, on the other hand, serves as a centralized database of available skills and their descriptions, ensuring that the generated prompt includes relevant and up-to-date information about the capabilities of the production machines. Therefore, it allows for dynamic prompt generation, leveraging existing knowledge and capabilities stored in the repositories.
[0087] In one embodiment of the present disclosure, wherein evaluating the generated workflows using a simulation environment to determine the optimal workflow comprises: calculating performance scores based on performance metrics for each generated workflow; determining the generated workflow with the highest performance score as the optimal workflow.
[0088] In detail, the performance metrics can be customized to reflect the specific requirements and priorities of the production environment, such as efficiency, accuracy, or resource utilization. Therefore, evaluation process allows for objective and quantitative assessment of the generated workflows, ensuring that the selected workflow is the optimal for the given task.
[0089] In one embodiment of the present disclosure, wherein the method further comprises: converting the generated workflow into workflow example format; adding the generated workflow and performance scores of the generated workflow into the workflow example repository.
[0090] In detail, this feedback enables continuous improvement of the system by incorporating successful workflows back into the repository. By storing the performance scores along with the workflows, the system can prioritize high-performing examples in future prompt generations. This allows the system to learn from its successes and adapt to changing requirements over time.
[0091] In one embodiment of the present disclosure, wherein generating a prompt for a large language model comprises: sampling at least one workflow example using categorical distribution sampling method based on performance scores of the workflow examples.
[0092] In detail, this sampling approach ensures that high-performing workflows have a higher probability of being selected for prompt generation, while still maintaining some diversity in the selection process. The use of categorical distribution allows for a balance between exploitation of known good solutions and exploration of potentially novel approaches.
[0093] In one embodiment of the present disclosure, wherein optimizing the prompt by replacing the example and / or skill API under the same category to generate a workflow for each optimized prompt comprises: evaluating replacement of skill API using beam search.
[0094] In detail, this approach allows for systematic exploration of different skill combinations within the workflow, potentially uncovering more efficient or effective sequences of actions. Beam search provides a balance between exhaustive search and greedy selection, allowing the system to consider multiple promising paths simultaneously.
[0095] In one embodiment of the present disclosure, wherein the performance metrics comprise at least one of executability, feasibility, execution time, energy efficiency, and accuracy. This comprehensive set of metrics allows for a holistic evaluation of the generated workflows, considering both practical constraints and optimization goals. Executability and feasibility ensure that the workflows can be implemented in the real-world production environment, while execution time, energy efficiency, and accuracy focus on optimizing the performance and quality of the production process.
[0096] Following is detailed description of the above method.
[0097] Below provides the skill API description for skill API Capture2DImage () . Through the skill API description, LLM can understand that the skill API is used to Capture 2D image via 2D Camera Adaptor.
[0098] def Capture2DImage () ->Image:
[0099] """Capture 2D image via 2D Camera Adaptor.
[0100] Examples:
[0101] image = Capture2DImage ()
[0102] """
[0103] Below provides an instance of workflow example. The workflow consists of a sequential call of skill APIs Capture2DImage () , RetrieveObj () , RerievePos () , OpenGripper () , MoveJoint () and CloseGripper () .
[0104] ##Example 1
[0105] #Instruction: Pick the black workpiece and place it at green tray.
[0106] def main_1 () :
[0107] image = Capture2DImage ()
[0108] obj_0 = RetrieveObj (image=image, query= ‘the black workpiece')
[0109] loc_0 = RerievePos (image=image, obj=obj_0)
[0110] obj_1 = RetrieveObj (image=image, query= ‘green tray')
[0111] loc_1 = RerievePos (image=image, obj=obj_1)
[0112] action = OpenGripper (distance=10)
[0113] action = MoveJoint (waypoints=loc_0)
[0114] action = CloseGripper (force=1)
[0115] action = MoveJoint (waypoints=loc_1)
[0116] action = OpenGripper (distance=10)
[0117] Below provides another instance of workflow example. The workflow consists of a sequential call of skill APIs
[0118] SegmentImage () , Capture2DImage () , RetrieveObjinImage () , RerievePos () , RotateObj () , OpenGripper () , MoveJoint () , CloseGripper () , MoveJoint () and OpenGripper () .
[0119] ##Example 2
[0120] #Instruction: Rotate {workpiece image} 100 degrees.
[0121] def main_2 () :
[0122] workpiece_image = SegmentImage ( {workpiece image} )
[0123] image = Capture2DImage ()
[0124] obj_0 = RetrieveObjinImage (image=image, query= workpiece_image)
[0125] loc_0 = RerievePos (image=image, obj=obj_0)
[0126] loc_1 = RotateObj (location= loc_0, rotation=100)
[0127] action = OpenGripper (distance=10)
[0128] action = MoveJoint (waypoints=loc_0)
[0129] action = CloseGripper (force=1)
[0130] action = MoveJoint (waypoints=loc_1)
[0131] action = OpenGripper (distance=10)
[0132] Fig. 2 is an exemplary schematic diagram of a system architecture 20 according to an embodiment of the present disclosure.
[0133] As shown in Fig. 2, system architecture 20 includes large language model 21, production machines 22, prompt engineering unit 201, user input unit 202, workflow execution unit 203, simulation environment 204, workflow evaluation unit 205, workflow example repository 206, skill repository 207 and skill registration unit 208.
[0134] In the stage of initial configuration, initial skills are developed and registered into the skill repository 207 by skill registration unit 208. Skill APIs can be searched and retrieved. Skills can be executed in the Simulation Environment 204 and on Production Machine 22. Initial workflow examples are prepared and registered into workflow example repository 206 with default performance scores. The example is composed of a sequential call of Skill APIs (e.g., object identification, robot movement, conveyer control, etc. ) to perform given tasks in the application scenario. Initial prompt with workflow examples and Skill API description is prepared for certain application scenario. Example user instructions are prepared for typical application scenarios. Adaptors with corresponding hardware are ready to use. Simulation Environment is ready to use.
[0135] In the stage of operation stage, user instruction provided by user input unit 202 and prompt provided by prompt engineering unit 201 are input into LLM 21. LLM 21 generate a workflow based on the user instruction and prompt. The generated workflow is sent to workflow execution unit 203. Workflow execution unit 203 calls skill APIs from skill repository 207 and schedule the execution of workflow and interact with simulation environment 204. Simulation environment 204 simulates the execution of the generated workflow. Workflow evaluation unit 205 evaluates the generated workflow by calling APIs provided by corresponding skills executed in simulation environment 204. The evaluated workflow will be added into workflow example repository 206. Then prompt engineering unit 201 optimizes the prompt by replacing the example and / or skill API under the same category, and the optimized prompt is sent to LLM 21. The generated workflow corresponding to the prompt and the user instruction will be executed in simulation environment 204 and evaluated in workflow evaluation unit 205. The iteration is stopped until stop criteria is satisfied. Stop criteria can be certain iteration is completed, or successful ratio of the generated workflow is above threshold. The optimized prompt and optimal workflow will be executed in production machines 22. Robot adaptor 22A, camera adaptor 22B, conveyer adaptor 22C and gripper adaptor 22D will execute corresponding control command.
[0136] Fig. 3 is an exemplary schematic diagram of optimizing the prompt by replacing skill API according to an embodiment of the present disclosure.
[0137] As shown in Fig. 3, skill RetrieveObj is replaced with skill RetriveObjV2, RetriveObjV3, RetriveObjV4 and RetriveObjV5. By evaluation skill RetriveObjV2 and RetriveObjV4 is the top two replacement. There are two branches after replacement of RetrieveObj (brach 311 start with RetriveObjV2 , branch 312 start with RetriveObjV4) . Then for each new branch, the next skill API MoveJoint is also replaced by MoveSpline, MovePTP, MovePTPV2, separately. After evaluation and keep the top two replacements, there are four branches (branch 321 RetriveObjV2-MoveSpline, branch 322 RetriveObjV2-MovePTP, branch 323 RetriveObjV4-MoveSPline, branch 324, RetriveObjV4-MovePTPV2) . This procedure is repeated for certain steps (randomly select some skill APIs for replacement) , and all the branches will be evaluated and scored.
[0138] The present disclosure provides an apparatus for generating workflow for production machines. Fig. 4 is an exemplary schematic diagram of an apparatus 400 for generating workflow for production machines according to an embodiment of the present disclosure. As shown in Fig. 4, apparatus 400 comprises:
[0139] a generating module 410, configured to generate a prompt for a large language model (LLM) , wherein the prompt comprises at least one workflow example and skill API description for skill API involved in the at least one workflow example;
[0140] a providing module 420, configured to provide the prompt and a user instruction to the LLM to generate a workflow corresponding to the prompt and the user instruction;
[0141] an optimizing module 430, configured to optimize the prompt by replacing the example and / or skill API under the same category to generate a workflow for each optimized prompt;
[0142] an evaluating module 440, configured to evaluate the generated workflows using a simulation environment to determine the optimal workflow; and
[0143] an executing module 450, configured to execute the optimal workflow on the production machines.
[0144] Embodiments of the present disclosure also propose an electronic device with a processor memory architecture. Fig. 5 is an exemplary structural diagram of an electronic device according to an embodiment of the present disclosure. As shown in Figure 5, electronic device 500 includes a processor 510, a memory 520, and a computer program stored on memory 520 that can run on processor 510. When the computer program is executed by processor 510, the method for identifying building block as described in either of the above is implemented. Among them, memory 520 can be implemented as various storage media such as electrically erasable programmable read-only memory (EEPROM) , flash memory, programmable program read-only memory (PROM) , etc. Processor 510 can be implemented to include one or more central processors or one or more field programmable gate arrays, wherein the field programmable gate array integrates one or more central processor cores. Specifically, the central processing unit or core can be implemented as a CPU, MCU, DSP, and so on.
[0145] It should be noted that not all steps and modules in the above processes and structural diagrams are necessary, and some steps or modules can be ignored according to actual needs. The execution sequence of each step is not fixed and can be adjusted as needed. The division of each module is only for the convenience of describing the functional division used. In actual implementation, a module can be divided into multiple modules, and the functions of multiple modules can also be implemented by the same module. These modules can be in the same device or different devices.
[0146] The hardware modules in each implementation can be implemented mechanically or electronically. For example, a hardware module can include specially designed permanent circuits or logic devices (such as dedicated processors, such as FPGA or ASIC) to complete specific operations. Hardware modules can also include programmable logic devices or circuits temporarily configured by software (such as general-purpose processors or other programmable processors) for performing specific operations. As for the specific use of mechanical methods, either dedicated permanent circuits or temporarily configured circuits (such as software configuration) to implement hardware modules, it can be determined based on cost and time considerations.
[0147] The above is only a preferred embodiment of the present disclosure and is not intended to limit the scope of protection of the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.
[0148] Independent of the grammatical term usage, individuals with male, female or other gender identities are included within the term.
Claims
1.A method (100) for generating workflow for production machines, comprising:generating (110) a prompt for a large language model (LLM) , wherein the prompt comprises at least one workflow example and skill API description for skill API involved in the at least one workflow example;providing (120) the prompt and a user instruction to the LLM to generate a workflow corresponding to the prompt and the user instruction;optimizing (130) the prompt by replacing the example and / or skill API under the same category to generate a workflow for each optimized prompt;evaluating (140) the generated workflows using a simulation environment to determine the optimal workflow; andexecuting (150) the optimal workflow on the production machines.2.The method (100) of claim 1, wherein generating a prompt for the LLM comprises:selecting at least one workflow example from a workflow example repository;determining skill API involved in the at least one workflow example; andretrieving at least one skill API and skill API description from a skill repository.3.The method (100) of claim 2, wherein evaluating the generated workflows using a simulation environment to determine the optimal workflow comprises:calculating performance scores based on performance metrics for each generated workflow;determining the generated workflow with the highest performance score as the optimal workflow.4.The method (100) of claim 3, wherein the method (100) further comprises:converting the generated workflow into workflow example format;adding the generated workflow and performance scores of the generated workflow into the workflow example repository.5.The method (100) of claims 1, wherein generating a prompt for a large language model comprises: sampling at least one workflow example using categorical distribution sampling method (100) based on performance scores of the workflow examples.6.The method (100) of claims 1, wherein optimizing the prompt by replacing the example and / or skill API under the same category to generate a workflow for each optimized prompt comprises: evaluating replacement of skill API using beam search.7.The method (100) of claim 3, wherein the performance metrics comprise at least one of executability, feasibility, execution time, energy efficiency, and accuracy.8.An apparatus (400) for generating workflow for production machines, comprising:a generating module (410) , configured to generate a prompt for a large language model (LLM) , wherein the prompt comprises at least one workflow example and skill API description for skill API involved in the at least one workflow example;a providing module (420) , configured to provide the prompt and a user instruction to the LLM to generate a workflow corresponding to the prompt and the user instruction;an optimizing module (430) , configured to optimize the prompt by replacing the example and / or skill API under the same category to generate a workflow for each optimized prompt;an evaluating module (440) , configured to evaluate the generated workflows using a simulation environment to determine the optimal workflow; andan executing module (450) , configured to execute the optimal workflow on the production machines.9.An electronic device, comprising a processor (510) and a memory (520) , wherein an application program executable by the processor (510) is stored in the memory (520) for causing the processor (510) to execute a method for identifying building block according to any one of claims 1-7.10.A computer-readable medium comprising computer-readable instructions stored thereon, wherein the computer-readable instructions for executing a method for identifying building block according to any one of claims 1-7.11.A computer program product comprising a computer program, upon the computer program is executed by a processor for executing a method for identifying building block according to any one of claims 1-7.