An AI programming-oriented declarative workflow generation method and system, and an execution method and system
The declarative workflow generation method using AI programming automates the process of generating workflows from task description statements, solving the problems of cumbersome workflow configuration and low efficiency in existing technologies, and achieving efficient and accurate workflow generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- KEDA ZHILING (BEIJING) TECHNOLOGY CO LTD
- Filing Date
- 2025-12-31
- Publication Date
- 2026-05-29
AI Technical Summary
Existing workflow generation methods rely on imperative programming, resulting in cumbersome and inefficient workflow configuration processes and high generation costs.
We adopt a declarative workflow generation method for AI programming. By receiving task description statements, we perform intent understanding, node matching, dependency analysis, and parameter configuration to generate and optimize workflows. We use artificial intelligence models to automatically generate workflows from task description statements.
It enables intelligent workflow generation without relying on human experience, reducing generation costs and improving the efficiency, accuracy, and stability of workflow generation.
Smart Images

Figure CN122111395A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a declarative workflow generation method and system, and execution method and system for AI programming. Background Technology
[0002] Workflow automation is a method of automatically executing business processes, tasks, and workflows through software. It is a core requirement in modern software development, where developers need to automate repetitive tasks such as code quality checks, test execution, and deployment into reusable workflows.
[0003] In the workflow generation methods of related technologies, the imperative programming approach is used to generate workflows. Developers must use code to define the Directed Acyclic Graph (DAG) structure, create task nodes, and manually set dependencies. Even a simple workflow often requires writing a lot of template code. Workflow configuration relies on human experience, making the workflow configuration process cumbersome, inefficient, and costly to generate.
[0004] Therefore, the existing workflow generation methods have obvious shortcomings and need to be improved. Summary of the Invention
[0005] To address the problems existing in the aforementioned related technologies, this disclosure provides a declarative workflow generation method and system, and an execution method and system for AI programming.
[0006] The first aspect of this disclosure provides a declarative workflow generation method for AI programming, including: Receive the task description statement; Perform intent understanding on the task description statement to obtain the task intent of the task description statement; Retrieve a set of nodes that match the task intent from the node registry. The set of nodes includes at least one target node, which is used to execute the subtask in the task intent. Perform dependency analysis on each target node to obtain the node dependency relationships corresponding to the node set; Parameter configuration inference is performed on each target node to obtain the configuration parameters of each target node; Based on task intent, node set, node dependencies, and configuration parameters, generate the initial workflow corresponding to the task description statement; The initial workflow is validated and optimized multiple times to generate the target workflow corresponding to the task description statement.
[0007] Optionally, the above-mentioned intent understanding of the task description statement to obtain the task intent of the task description statement includes: Obtain the context information corresponding to the task description statement; Extract intent data from the task description statement and context information in a structured manner; The task intent is generated by creating a task description statement based on intent data.
[0008] Optionally, the above-mentioned set of nodes that match the task intent and are retrieved from the node registry includes: Extract multiple subtasks from the task intent; For each subtask, retrieve the target node that matches the subtask from the node registry; A set of nodes matching the task intent is constructed based on each target node.
[0009] Optionally, retrieving the target node matching the subtask from the node registry includes: Obtain the node capabilities required for the subtask and the historical execution nodes of the subtask; Retrieve the first target node with node capabilities and the second target node corresponding to the historical execution node from the node registry; The first and second target nodes are deduplicated to obtain the target nodes that match the subtasks.
[0010] Optionally, the above dependency analysis of each target node yields the node dependencies corresponding to the node set, including: For each target node, perform logical dependency analysis and data flow dependency analysis to obtain the dependency relationships of the target node; The dependencies of each target node are processed by minimum closure and acyclic constraint processing to generate the node dependencies corresponding to the node set.
[0011] Optionally, the above parameter configuration inference for each target node yields the configuration parameters for each target node, including: Obtain the context information corresponding to the preset node specifications and task description statements; Based on the preset node specifications and context information, parameters are inferred for each target node to obtain the configuration parameters of each target node. The configuration parameters meet the requirements of the preset node specifications and context information.
[0012] Optionally, the above-mentioned multiple validations and optimizations of the initial workflow generate the target workflow corresponding to the task description statement, including: The initial workflow is subjected to multiple checks based on preset rules to obtain the check results. If a first abnormal problem exists in the verification result, the first abnormal problem is repaired based on the repair solution corresponding to the first abnormal problem, and the repaired workflow is obtained. The first abnormal problem is a problem that does not meet the requirements of the preset rules. Use the repaired workflow as the initial workflow, and re-validate the initial workflow based on the preset rule requirements; If all verification results are normal, the initial workflow is optimized multiple times to obtain the target workflow corresponding to the task description statement.
[0013] Optionally, the initial workflow is subjected to multiple checks based on preset rules to obtain the check results, including: Based on the preset rules, the initial workflow is subjected to syntax validation, pattern validation, and dependency validation, and the validation results are obtained. If the syntax of the initial workflow does not meet the preset syntax requirements in the preset rules, a syntax error is identified in the validation results; if the pattern of the initial workflow does not meet the preset pattern requirements in the preset rules, a pattern error is identified in the validation results; if the node dependencies in the initial workflow do not meet the preset dependency requirements in the preset rules, a dependency error is identified in the validation results. Syntax errors, pattern errors, and dependency errors are identified as the first type of error. If the syntax of the initial workflow meets the preset syntax requirements of the preset rules, the pattern of the initial workflow meets the preset pattern requirements of the preset rules, and the node dependencies in the initial workflow meet the preset dependency requirements of the preset rules, then the verification results are considered normal.
[0014] Optionally, the above-mentioned multiple validations and optimizations of the initial workflow generate the target workflow corresponding to the task description statement, including: According to the preset verification order of multiple verification items, the initial workflow is sequentially verified for multiple verification items based on preset rule requirements; If a second anomaly is found in the verification result of any verification item, stop verifying the remaining verification items of the initial workflow, and repair the second anomaly based on the repair solution corresponding to the second anomaly to obtain the repaired workflow; The repaired workflow is used as the initial workflow. The initial workflow is then re-verified according to the preset verification order of multiple verification items and based on the preset rule requirements. When the verification results of each verification item are normal, the initial workflow is optimized multiple times to obtain the target workflow corresponding to the task description statement. Among them, multiple validation items include at least syntax validation items, pattern validation items, and dependency validation items.
[0015] Optionally, the above-mentioned multiple optimizations of the initial workflow yield the target workflow corresponding to the task description statement, including: Perform parallelization analysis on the initial workflow to identify the nodes that can be executed in parallel within the initial workflow; Redundancy detection is performed on the initial workflow to identify redundant nodes in the initial workflow; Based on the preset parameter specifications, the initial workflow is parameter identified to determine abnormal parameters in the initial workflow. Abnormal parameters are those that do not meet the preset parameter specifications. The parallelizable nodes in the initial workflow are identified as parallel nodes, redundant nodes in the initial workflow are merged, and abnormal parameters in the initial workflow are adjusted to normal parameters that meet the preset parameter specifications, thus obtaining the target workflow corresponding to the task description statement.
[0016] A second aspect of this disclosure provides a declarative workflow execution method for AI programming, comprising: Receive the target workflow, wherein the target workflow is obtained based on the declarative workflow generation method for AI programming described in any of the first aspects above; The target workflow is parsed in a structured manner to obtain the workflow to be executed; Expand multiple target nodes in the workflow to be executed into multiple node instances, and rewrite the target dependencies between the node instances; Based on the target dependency relationship, multiple node instances are topologically sorted to obtain the target execution order of multiple node instances; According to the target execution order, the node adapters corresponding to each node instance are called sequentially to execute the subtasks corresponding to each node instance in the workflow to be executed, and the execution results of each node instance are obtained. The execution results of each node instance are summarized according to the preset result expression template to obtain the target execution result of the target workflow.
[0017] Optionally, the above process, following the target execution order, sequentially calls the node adapters corresponding to each node instance to execute the subtasks corresponding to each node instance in the workflow to be executed, obtaining the execution results of each node instance, including: According to the target execution order, multiple node instances are divided into at least one execution level. The execution order of at least one execution level is the same as the target execution order. There are no dependencies between node instances in each execution level, and they can be executed in parallel. Following the hierarchical execution order, the node adapters corresponding to the node instances in each execution level are called sequentially to execute the subtasks corresponding to each node instance in the workflow to be executed, and the execution results of each node instance are obtained.
[0018] Optionally, the above-mentioned sequential invocation of the node adapters corresponding to each node instance to execute the subtasks corresponding to each node instance in the workflow to be executed includes: If the current execution conditions of a node instance do not meet the preset execution conditions, stop calling the node instance to execute subtasks; When an error occurs during the execution of a subtask by a node instance, the subsequent behavior of the node instance is controlled based on the preset error policy corresponding to the node instance. The preset error policy includes one or more of the following: stop executing the subtask, ignore the error, and continue executing the subtask. When a node instance fails to execute a subtask, the retry interval of the node instance is determined based on a preset exponential backoff strategy, and the node instance is re-controlled to execute the subtask according to the retry interval.
[0019] Optionally, before the above method sequentially calls the node adapters corresponding to each node instance to execute the subtasks corresponding to each node instance in the workflow to be executed, according to the target execution order, the method further includes: For each node instance, perform interface analysis to determine the interface mode of the node instance; Based on the node instance interface pattern, generate the initial adapter code for the node instance; The initial adapter code is validated and repaired in multiple layers to obtain the target adapter code corresponding to the node instance; Register the target adapter code into the node registry to obtain the node adapter corresponding to the node instance.
[0020] Optionally, the above-mentioned multi-layered verification and repair of the initial adapter code yields the target adapter code corresponding to the node instance, including: The initial adapter code is subjected to syntax validation, function existence verification, and dry run test to obtain the syntax validation results, function validation results, and dry run test results. When there are target abnormal results in the syntax check results, function check results, and dry run test results, the data area corresponding to the target abnormal result in the initial adapter code is repaired based on the repair scheme corresponding to the target abnormal result, and the repaired adapter code is obtained. The repaired adapter code was used as the initial adapter code, and the initial adapter code was re-tested for syntax validation, function existence verification, and dry running tests. If the syntax check results, function check results, and dry run test results are all normal, the initial adapter code will be determined as the target adapter code.
[0021] A third aspect of this disclosure provides a declarative workflow generation system for AI programming, comprising: The task receiving module is used to receive task description statements; The intent understanding module is used to understand the intent of the task description statement and obtain the task intent of the task description statement. The node matching module is used to retrieve a set of nodes that match the task intent from the node registry. The set of nodes includes at least one target node, which is used to execute the subtask in the task intent. The dependency analysis module is used to perform dependency analysis on each target node and obtain the node dependency relationships corresponding to the node set. The parameter inference module is used to infer the parameter configuration of each target node and obtain the configuration parameters of each target node. The workflow generation module is used to generate the initial workflow corresponding to the task description statement based on the task intent, node set, node dependency relationship and configuration parameters; The validation and optimization module is used to perform multiple validations and optimizations on the initial workflow and generate the target workflow corresponding to the task description statement.
[0022] The fourth aspect of this disclosure provides a declarative workflow execution system for AI programming, comprising: A workflow receiving module is used to receive a target workflow, wherein the target workflow is obtained based on the declarative workflow generation method for AI programming described in any of the first aspects above; The parsing module is used to perform structured parsing of the target workflow to obtain the workflow to be executed; The expand module is used to expand multiple target nodes in the workflow to be executed into multiple node instances and rewrite the target dependencies between the node instances; The execution order determination module is used to perform topological sorting on multiple node instances based on target dependencies to obtain the target execution order of multiple node instances; The execution module is used to sequentially call the node adapters corresponding to each node instance in the workflow to be executed, according to the target execution order, to execute the subtasks corresponding to each node instance and obtain the execution results of each node instance. The execution result generation module is used to summarize the execution results of each node instance according to a preset result expression template to obtain the target execution result of the target workflow.
[0023] The fifth aspect of this disclosure provides a computer device comprising: The memory and processor, wherein the memory stores a computer program that, when executed by the processor, implements the declarative workflow generation method for AI programming of the first aspect or the declarative workflow execution method for AI programming of the second aspect.
[0024] The sixth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the AI-oriented declarative workflow generation method of the first aspect or the AI-oriented declarative workflow execution method of the second aspect.
[0025] The technical solution provided in this disclosure has the following advantages compared with the prior art: In this embodiment, the process involves receiving a task description statement; understanding the intent of the task description statement to obtain its task intent; retrieving a set of nodes matching the task intent from a node registry, where the node set includes at least one target node used to execute subtasks within the task intent; performing dependency analysis on each target node to obtain node dependencies corresponding to the node set; inferring parameter configurations for each target node to obtain its configuration parameters; generating an initial workflow corresponding to the task description statement based on the task intent, node set, node dependencies, and configuration parameters; and performing multiple checks and optimizations on the initial workflow to generate a target workflow corresponding to the task description statement. This intelligently and automatically completes the intent understanding, node matching, dependency analysis, parameter configuration generation, multiple checks, and optimization of the task description statement. The output at any stage must meet structured constraints, and cross-stage backtracking correction is triggered when checks fail, allowing for early detection and timely correction of errors in the workflow. This achieves end-to-end automatic generation of workflows from natural language task description statements, eliminating reliance on human experience, significantly reducing the workload of manual workflow configuration, lowering workflow generation costs, and improving the efficiency, accuracy, and stability of workflow generation.
[0026] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0027] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0028] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 This is a flowchart of a declarative workflow generation method for AI programming provided in an embodiment of this disclosure; Figure 2This is a flowchart of a declarative workflow generation method for AI programming provided in an embodiment of this disclosure; Figure 3 This is a flowchart of a declarative workflow execution method for AI programming provided in an embodiment of this disclosure; Figure 4 This is a flowchart of a declarative workflow execution method for AI programming provided in an embodiment of this disclosure; Figure 5 This is a flowchart of a declarative workflow execution method for AI programming provided in an embodiment of this disclosure; Figure 6 This is a flowchart of a declarative workflow execution method for AI programming provided in an embodiment of this disclosure; Figure 7 This is a flowchart of a declarative workflow execution method for AI programming provided in an embodiment of this disclosure; Figure 8 This is a schematic diagram of the structure of a declarative workflow generation system for AI programming provided in an embodiment of this disclosure; Figure 9 This is a schematic diagram of the structure of a declarative workflow execution system for AI programming provided in an embodiment of this disclosure; Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of this disclosure. Detailed Implementation
[0030] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0031] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0032] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0033] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0034] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0035] To better understand the inventive concept of the embodiments of this disclosure, the technical solutions of the embodiments of this disclosure will be described below in conjunction with exemplary embodiments.
[0036] The declarative workflow generation method for AI programming provided in this disclosure can be executed by a declarative workflow generation system for AI programming. This workflow generation system can be installed in a computer device, which can be understood as any device with processing and computing capabilities.
[0037] AI (Artificial Intelligence) refers to artificial intelligence.
[0038] Figure 1 This is a flowchart illustrating a declarative workflow generation method for AI programming, provided in an embodiment of this disclosure. This method can be executed by a declarative workflow generation system for AI programming, such as... Figure 1 As shown, the declarative workflow generation method for AI programming provided in this embodiment includes the following steps: Step 110: Receive the task description statement.
[0039] In this embodiment of the disclosure, the declarative workflow generation system for AI programming can receive task description statements.
[0040] Task description statements can be understood as task statements based on natural language descriptions.
[0041] For example, the task description statement could be "Check code quality".
[0042] Step 120: Perform intent understanding on the task description statement to obtain the task intent of the task description statement.
[0043] In this embodiment of the disclosure, the workflow generation system can understand the intent of the task description statement based on a preset artificial intelligence model to obtain the task intent of the task description statement.
[0044] Preset AI models can be configured as needed. For example, preset AI models may include Large Language Model (LLM), Generative Pre-trained Transformer (GPT), etc. There are no restrictions here.
[0045] Large language models can be understood as natural language processing models trained on a large amount of text data based on deep learning. Large language models can generate natural language text or understand the semantics of language text.
[0046] Generative pre-trained transformers can be understood as a language model based on artificial intelligence technology. They are widely used in the field of natural language processing. Through pre-training on a large-scale corpus, they learn the statistical patterns of language and can generate coherent and natural text.
[0047] In some embodiments, the above-described intent understanding of the task description statement to obtain the task intent of the task description statement may include steps 1201-1203: Step 1201: Obtain the context information corresponding to the task description statement.
[0048] In this embodiment of the disclosure, the workflow generation system can obtain the context information corresponding to the task description statement.
[0049] The context information corresponding to the task description statement can be understood as the associated information of the task description statement.
[0050] For example, when the task description statement is "check code quality", the context information corresponding to "check code quality" may include, but is not limited to, the programming language used in the code, the code framework, the available node directory, and repository metadata.
[0051] Step 1202: Extract the intent data from the task description statement and the context information corresponding to the task description statement in a structured manner.
[0052] In this embodiment of the disclosure, the workflow generation system can extract intent data from the task description statement and the context information corresponding to the task description statement in a structured manner based on a preset artificial intelligence model.
[0053] Intent data can include task objectives, subtasks, input sources, constraints, etc.
[0054] For example, when the task description is "check code quality", the task objective can be code quality checking; subtasks can include code style checking, code type checking, code complexity checking, code testing, etc.; the input source can be code change files; constraints can be that the coverage of the target programming language is greater than a preset threshold, etc. The preset threshold can be set as needed, for example, 80%, and is not limited here.
[0055] Step 1203: Generate the task intent based on the intent data to describe the task.
[0056] In other words, the task intent includes intent data.
[0057] Step 130: Retrieve a set of nodes that match the task intent in the node registry. The set of nodes includes at least one target node, which is used to execute the subtask in the task intent.
[0058] In this embodiment of the disclosure, the workflow generation system can retrieve a set of nodes matching the task intent in the node registry based on a preset artificial intelligence model. The set of nodes may include at least one target node, which can be used to execute subtasks in the task intent.
[0059] The set of nodes that match the task intent can be understood as the set of target nodes that can execute the subtasks in the task intent.
[0060] For example, a target node can be represented by its node identifier.
[0061] In some embodiments, the above-described retrieval of a set of nodes matching the task intent in the node registry may include steps 1301-1303: Step 1301: Extract multiple subtasks from the task intent.
[0062] Step 1302: For each subtask, retrieve the target node that matches the subtask in the node registry.
[0063] In this embodiment of the disclosure, for each subtask, the workflow generation system can retrieve the target node matching the subtask from the node registry based on a preset artificial intelligence model.
[0064] The target node that matches the subtask can be understood as the target node that can execute the subtask.
[0065] In one example embodiment, the above-described retrieval of the target node matching the subtask in the node registry may include S11-S12: S11. Obtain the node capabilities required for the subtask and the historical execution nodes of the subtask.
[0066] The historical execution nodes of a subtask can be understood as nodes where a subtask has been executed previously.
[0067] S12. Retrieve the first target node with node capabilities and the second target node corresponding to the historical execution node from the node registry.
[0068] S13. Deduplicate the first target node and the second target node to obtain the target node that matches the subtask.
[0069] Step 1303: Construct a set of nodes that match the task intent based on each target node.
[0070] Step 140: Perform dependency analysis on each target node to obtain the node dependency relationships corresponding to the node set.
[0071] In this embodiment of the disclosure, the workflow generation system can perform dependency analysis on each target node in the node set based on a preset artificial intelligence model to obtain the node dependency relationship corresponding to the node set.
[0072] In some embodiments, the above-described dependency analysis of each target node to obtain the node dependency relationship corresponding to the node set may include steps 1401-1402: Step 1401: For each target node, perform logical dependency analysis and data flow dependency analysis to obtain the dependency relationship of the target node.
[0073] In this embodiment of the disclosure, for each target node, the workflow generation system can perform logical dependency analysis and data flow dependency analysis on the target node through semantic analysis to obtain the dependency relationship of the target node. Thus, the workflow generation system can identify the real data dependency relationship between nodes based on semantic analysis.
[0074] Step 1402: Perform minimum closure processing and acyclic constraint processing on the dependencies of each target node to generate the node dependencies corresponding to the node set.
[0075] The minimal closure can be understood as not omitting any necessary dependencies.
[0076] Acyclic constraints can be understood as not introducing unnecessary dependencies.
[0077] In this embodiment of the disclosure, the workflow generation system can perform minimum closure processing and acyclic constraint processing on the dependency relationships of each target node through semantic analysis and rule engine collaboration. That is, without introducing any redundant dependencies, it fills in all the "inevitable dependencies" and ensures that these dependencies do not form cycles, thereby generating the node dependency relationships corresponding to the node set.
[0078] Step 150: Perform parameter configuration inference on each target node to obtain the configuration parameters of each target node.
[0079] In this embodiment of the disclosure, the workflow generation system can infer the parameter configuration of each target node based on a preset artificial intelligence model to obtain the configuration parameters of each target node.
[0080] Configuration parameters may include key-value sets, parameter type descriptions (including default values and value ranges), etc.
[0081] For example, in parameter configuration inference, the target path, configuration file location, and ignore rules can be inferred for the code style check node; and the coverage options and thresholds can be inferred for the test execution node.
[0082] In some embodiments, the above-described parameter configuration inference for each target node to obtain the configuration parameters of each target node may include steps 1501-1502: Step 1501: Obtain the context information corresponding to the preset node specifications and task description statements.
[0083] Preset node specifications can be understood as pre-defined, detailed standards, structures, and rules that nodes should follow.
[0084] Step 1502: Based on the preset node specifications and context information, perform parameter inference on each target node to obtain the configuration parameters of each target node. The configuration parameters meet the requirements of the preset node specifications and context information.
[0085] Step 160: Based on the task intent, node set, node dependencies, and configuration parameters, generate the initial workflow corresponding to the task description statement.
[0086] In this embodiment of the disclosure, the workflow generation system can synthesize task intent, node set, node dependency relationship and configuration parameters into an initial workflow corresponding to the task description statement.
[0087] For example, the initial workflow may include, but is not limited to, sections such as version, name, description, inputs, variables, nodes, and outputs; the node area may include fields such as node identifier, node type, keywords, and dependencies, and be arranged in an orderly manner according to the dependency topology.
[0088] Step 170: Perform multiple checks and optimizations on the initial workflow to generate the target workflow corresponding to the task description statement.
[0089] In this embodiment of the disclosure, the workflow generation system can perform multiple verifications and optimizations on the initial workflow to generate the target workflow corresponding to the task description statement.
[0090] The workflow in this embodiment can be understood as a workflow configuration file in a declarative workflow configuration format.
[0091] In one embodiment, the declarative workflow configuration format can be implemented using YAML.
[0092] YAML (YAML Ain't a Markup Language) is a data description and configuration language with readability as its core. YAML can describe structured data in a concise and intuitive way.
[0093] Therefore, it can intelligently and automatically complete the intent understanding, node matching, dependency analysis, parameter configuration generation, multi-validation and optimization of task description statements. The output of each stage must meet the structured constraints, and cross-stage backtracking correction will be triggered when the validation fails. Errors in the workflow can be detected in advance and corrected in time. It realizes end-to-end automatic generation of workflow from natural language task description statements, without relying on human experience, which greatly reduces the workload of manual workflow configuration, lowers the workflow generation cost, and improves the efficiency, accuracy and stability of workflow generation.
[0094] In some embodiments of this disclosure, the initial workflow undergoes multiple checks and optimizations to generate the target workflow corresponding to the task description statement. The declarative workflow generation system for AI programming can then execute this process. Figure 2 A flowchart of a declarative workflow generation method for AI programming is provided, such as... Figure 2 As shown, the declarative workflow generation method for AI programming provided in this embodiment includes the following steps: Step 210: Perform multiple checks on the initial workflow based on preset rule requirements to obtain the check results.
[0095] In this embodiment of the disclosure, after generating the initial workflow corresponding to the task description statement, the declarative workflow generation system for AI programming can perform multiple verifications on the initial workflow based on preset rule requirements to obtain the verification results.
[0096] Preset rule requirements can be understood as the rule requirements that a workflow must meet in advance. They can be set as needed, and there are no restrictions here.
[0097] In some embodiments, the above-mentioned multiple verifications of the initial workflow based on preset rules to obtain verification results may include steps 2101-2103: Step 2101: Based on the preset rule requirements, perform syntax verification, pattern verification, and dependency verification on the initial workflow to obtain the verification results.
[0098] In this embodiment of the disclosure, the workflow generation system can perform syntax verification, pattern verification, and dependency verification on the initial workflow based on preset rule requirements to obtain the verification results.
[0099] Syntax validation can be understood as verifying whether the syntax of the initial workflow conforms to the preset syntax requirements in the preset rules.
[0100] Schema validation can be understood as a data verification mechanism used to check whether data conforms to predefined structures and rules. It ensures data integrity and accuracy by defining data formats, types, and constraints (such as length, range, and format).
[0101] Pattern validation can be understood as verifying whether the pattern of the initial workflow conforms to the preset pattern requirements in the preset rules.
[0102] Dependency validation can be understood as verifying whether the node dependencies in the initial workflow meet the preset dependency requirements in the preset rules.
[0103] Step 2102: When the syntax of the initial workflow does not meet the preset syntax requirements in the preset rules, determine that there is a syntax error in the verification results; when the pattern of the initial workflow does not meet the preset pattern requirements in the preset rules, determine that there is a pattern error in the verification results; when the node dependencies in the initial workflow do not meet the preset dependency requirements in the preset rules, determine that there is a dependency error in the verification results. The syntax error, pattern error, and dependency error are identified as the first error.
[0104] Step 2103: If the syntax of the initial workflow meets the preset syntax requirements in the preset rules, the pattern of the initial workflow meets the preset pattern requirements in the preset rules, and the node dependencies in the initial workflow meet the preset dependency requirements in the preset rules, then the verification results are confirmed to be normal.
[0105] Step 220: When a first abnormal problem exists in the verification result, the first abnormal problem is repaired based on the repair solution corresponding to the first abnormal problem to obtain the repaired workflow. The first abnormal problem is a problem that does not meet the requirements of the preset rules.
[0106] In this embodiment of the disclosure, when a first abnormal problem exists in the verification result, the workflow generation system can repair the first abnormal problem based on the repair scheme corresponding to the first abnormal problem to obtain a repaired workflow. The first abnormal problem is a problem that does not meet the requirements of the preset rules.
[0107] For example, when the first exception is a syntax exception, the workflow generation system can fix the syntax exception based on the corresponding fix. When the first anomaly is a pattern anomaly, the workflow generation system can fix the pattern anomaly based on the corresponding repair solution. When the first anomaly is a dependency anomaly, the workflow generation system can fix the dependency anomaly based on the corresponding repair solution.
[0108] Dependency verification can validate explicit dependencies based on node functional semantics and data flow relationships. When an inconsistency is detected between explicit and semantic dependencies, the system generates dependency correction suggestions or automatically adjusts the dependency relationships to avoid unnecessary sequential execution. Thus, the system can identify the true data dependencies between nodes based on semantic analysis and verify and correct user-declared dependencies.
[0109] Step 230: Use the repaired workflow as the initial workflow and re-validate the initial workflow based on the preset rule requirements.
[0110] Step 240: When all verification results are normal, perform multiple optimizations on the initial workflow to obtain the target workflow corresponding to the task description statement.
[0111] In this embodiment of the disclosure, when all verification results are normal, the workflow generation system can perform multiple optimizations on the initial workflow to obtain the target workflow corresponding to the task description statement.
[0112] Therefore, by completing syntax verification, pattern verification, and dependency verification during the workflow loading phase, the system can detect all configuration errors before execution, moving errors that would normally occur during runtime to the loading phase. This significantly improves the determinism and predictability of the execution path and reduces the consumption of ineffective computing resources, thereby increasing the accuracy of workflow generation.
[0113] In some embodiments of this disclosure, the initial workflow undergoes multiple checks and optimizations to generate the target workflow corresponding to the task description statement. The declarative workflow generation system for AI programming can then execute this process. Figure 3 A flowchart of a declarative workflow generation method for AI programming is provided, such as... Figure 3As shown, the declarative workflow generation method for AI programming provided in this embodiment includes the following steps: Step 310: According to the preset verification order of multiple verification items, the initial workflow is sequentially verified based on the preset rule requirements. Among them, the multiple verification items include at least syntax verification items, pattern verification items and dependency verification items.
[0114] In this embodiment of the disclosure, the workflow generation system can sequentially verify multiple verification items of the initial workflow according to a preset verification order and based on preset rule requirements.
[0115] Among them, multiple validation items include at least syntax validation items, pattern validation items, and dependency validation items.
[0116] The preset verification order can be set as needed; there is no limitation here.
[0117] For example, if the preset verification order is syntax verification items, pattern verification items, and dependency verification items, the workflow generation system can perform syntax verification, pattern verification, and dependency verification on the initial workflow in sequence based on preset rule requirements.
[0118] Step 320: If a second anomaly is found in the verification result of any verification item, stop verifying the remaining verification items of the initial workflow, and repair the second anomaly based on the repair solution corresponding to the second anomaly to obtain the repaired workflow.
[0119] In this embodiment of the disclosure, when a second anomaly exists in the validation result of the syntax validation item, the workflow generation system can stop validating the remaining validation items (including pattern validation items and dependency validation items) of the initial workflow, and fix the second anomaly based on the fixation scheme corresponding to the second anomaly to obtain the fixed workflow.
[0120] For example, if multiple validation items include syntax validation, pattern validation, and dependency validation, and a second anomaly is found in the validation result of the syntax validation item, the validation of the pattern validation and dependency validation items in the initial workflow is stopped. The second anomaly is then fixed based on the corresponding fix, resulting in a fixed workflow.
[0121] Step 330: Using the repaired workflow as the initial workflow, re-verify the initial workflow according to the preset verification order of multiple verification items and based on the preset rule requirements.
[0122] Step 340: When the verification results of each verification item are normal, perform multiple optimizations on the initial workflow to obtain the target workflow corresponding to the task description statement.
[0123] Therefore, in the multiple verifications of the initial workflow, the output of each verification stage must meet the corresponding structural constraints or rule verification conditions. When the output of any verification stage fails verification, the system does not proceed to the next stage, but instead returns to the previous stage to regenerate or correct the corresponding content based on the reason for the failure, until the constraints are met or the preset termination condition is reached. In other words, the output of any verification stage must meet the corresponding structural constraints or rule verification conditions; when the output of any verification stage fails verification, the control logic blocks the execution of subsequent verification stages and triggers the regeneration or correction of the previous stage based on the reason for the verification failure, thus forming a constrained and traceable progressive generation mechanism. This enables multiple verifications, repairs, and optimizations of the generated initial workflow to obtain the target workflow corresponding to the task description statement, thereby improving the accuracy of workflow generation.
[0124] In some embodiments, after the first abnormal problem is repaired, the workflow generation system can count the number of repairs corresponding to the first abnormal problem; when the number of repairs corresponding to the first abnormal problem is equal to a first preset threshold, the repair of the first abnormal problem is stopped, and a workflow repair failure prompt message is generated to remind the user that the workflow repair has failed, thereby avoiding infinite repair loops and ensuring the controllability and security of system execution.
[0125] In some embodiments, after the second abnormal problem is repaired as described above, the workflow generation system can count the number of repairs corresponding to the second abnormal problem; when the number of repairs corresponding to the second abnormal problem is equal to a first preset threshold, the repair of the second abnormal problem is stopped, and a workflow repair failure prompt message is generated to remind the user that the workflow repair has failed, thereby avoiding infinite repair loops and ensuring the controllability and security of system execution.
[0126] In some embodiments, the above-described multiple optimizations of the initial workflow yield the target workflow corresponding to the task description statement, which can then be executed by the declarative workflow generation system for AI programming. Figure 4 A flowchart of a declarative workflow generation method for AI programming is provided, such as... Figure 4 As shown, the declarative workflow generation method for AI programming provided in this embodiment includes the following steps: Step 410: Perform parallelization analysis on the initial workflow to determine the nodes that can be executed in parallel within the initial workflow.
[0127] In this embodiment of the disclosure, the workflow generation system can understand the semantic relationships between target nodes in the initial workflow based on a preset artificial intelligence model, and identify parallel executable nodes in the initial workflow.
[0128] For example, when both the test node and the code inspection node depend on the same input but the user has mistakenly set the dependency relationship, the workflow generation system can remove the redundant dependency and identify the test node and the code inspection node as nodes that can be executed in parallel. In this way, the system can identify the user's incorrectly declared dependency relationship and perform correction or optimization based on semantic judgment, thereby forming an error-correctable dependency model.
[0129] Step 420: Perform redundancy detection on the initial workflow to identify redundant nodes in the initial workflow.
[0130] In this embodiment of the disclosure, the workflow generation system can perform redundancy detection on the initial workflow to identify redundant nodes in the initial workflow.
[0131] Redundant nodes can be understood as nodes that perform duplicate operations or act on the same data.
[0132] Step 430: Based on the preset parameter specifications, perform parameter identification on the initial workflow to determine abnormal parameters in the initial workflow. Abnormal parameters are parameters that do not meet the preset parameter specifications.
[0133] In this embodiment of the disclosure, the workflow generation system can identify parameters in the initial workflow based on preset parameter specifications to determine abnormal parameters in the initial workflow.
[0134] Abnormal parameters can be understood as parameters that do not meet the preset parameter specifications.
[0135] Preset parameter specifications can be understood as the parameter specifications that the parameters in the pre-set workflow must meet. They can be set as needed, and there are no restrictions here.
[0136] For example, abnormal parameters may include timeout thresholds for nodes that have been running for a long time, retry policy parameters, and node error stop policy parameters.
[0137] Step 440: Determine the parallel executable nodes in the initial workflow as parallel nodes, merge the redundant nodes in the initial workflow, adjust the abnormal parameters in the initial workflow to normal parameters that meet the preset parameter specifications, and obtain the target workflow corresponding to the task description statement.
[0138] In this embodiment of the disclosure, the workflow generation system can identify parallel executable nodes in the initial workflow as parallel nodes, enabling the parallel nodes to execute in parallel, thereby shortening the workflow runtime. Redundant nodes in the initial workflow are merged to avoid duplicate calculations; abnormal parameters in the initial workflow are adjusted to normal parameters that meet the preset parameter specifications to ensure that the parameters in the workflow are normal, thus obtaining the target workflow corresponding to the task description statement.
[0139] Therefore, the generated initial workflow can be self-verified and self-optimized multiple times to obtain the target workflow corresponding to the task description statement, which can improve the accuracy of workflow generation.
[0140] In some embodiments, after performing multiple optimizations on the initial workflow to obtain the target workflow corresponding to the task description statement, the workflow generation system can also generate optimization reasons, expected benefits of optimization, and risk assessment.
[0141] This improves the interpretability of the initial workflow optimization process.
[0142] Figure 5 This is a flowchart illustrating a declarative workflow execution method for AI programming, provided in an embodiment of this disclosure. This method can be executed by a declarative workflow execution system for AI programming, such as... Figure 5 As shown, the declarative workflow execution method for AI programming provided in this embodiment includes the following steps: Step 510: Receive the target workflow, wherein the target workflow is obtained based on the declarative workflow generation method for AI programming of any of the above embodiments.
[0143] In this embodiment of the disclosure, the declarative workflow execution system for AI programming can receive a target workflow.
[0144] Step 520: Perform structured parsing on the target workflow to obtain the workflow to be executed.
[0145] In this embodiment of the disclosure, the workflow execution system can perform structured parsing of the target workflow using a YAML loader, converting the target workflow into structured data to obtain the workflow to be executed.
[0146] Specifically, the YAML loader can perform syntax parsing on the target workflow and convert it into structured data to obtain the workflow to be executed.
[0147] Therefore, the target workflow can be transformed into a data structure that the system can process, eliminating the uncertainty caused by YAML expression details such as indentation and hierarchy, and providing a unified data input format for subsequent steps.
[0148] Step 530: Expand the multiple target nodes in the workflow to be executed into multiple node instances, and rewrite the target dependencies between the node instances.
[0149] In this embodiment of the disclosure, the workflow execution system can expand multiple target nodes in the workflow to be executed into multiple node instances and rewrite the target dependencies between the node instances.
[0150] Therefore, the original nested node structure can be transformed into a flattened set of nodes, eliminating the implicit control structure in the configuration, transforming the dynamic structure into explicit node instances, and generating a flat node graph that can be directly used for dependency analysis.
[0151] Step 540: Based on the target dependency relationship, perform topological sorting on multiple node instances to obtain the target execution order of multiple node instances.
[0152] In this embodiment of the disclosure, the workflow execution system can perform topological sorting on multiple node instances based on target dependencies to obtain the target execution order of multiple node instances.
[0153] Topological sorting can be understood as a sorting algorithm for directed acyclic graphs, ensuring that each node in the sorted result precedes its successor. This invention uses topological sorting to parse workflow node dependencies and generate hierarchical execution plans, allowing nodes at the same level to execute in parallel.
[0154] Step 550: In accordance with the target execution order, call the node adapters corresponding to each node instance in turn to execute the subtasks corresponding to each node instance in the workflow to be executed, and obtain the execution results of each node instance.
[0155] In this embodiment of the disclosure, the workflow execution system can sequentially call the node adapters corresponding to each node instance to execute the subtasks corresponding to each node instance in the workflow to be executed, in accordance with the target execution order, and obtain the execution results of each node instance.
[0156] A node adapter can be understood as a code layer that encapsulates node tools or commands, standardizing the node's input and output into a unified interface.
[0157] In some embodiments, the workflow execution system can divide multiple node instances into at least one execution level according to the target execution order. The execution order of the at least one execution level is the same as the target execution order. There are no dependencies between the node instances in each execution level, and they can be executed in parallel. According to the execution order, the node adapters corresponding to the node instances in each execution level are called in sequence to execute the subtasks corresponding to each node instance in the workflow to be executed, so as to obtain the execution results of each node instance.
[0158] This can improve the execution efficiency of node instances in the workflow, thereby improving the overall workflow execution efficiency.
[0159] In some embodiments, the node adapters corresponding to each node instance are called sequentially to execute subtasks in the workflow to be executed. The workflow execution system can stop calling the node instance to execute subtasks when the current execution conditions of the node instance do not meet the preset execution conditions. When an error occurs during the execution of a subtask by a node instance, the subsequent behavior of the node instance can be controlled based on the preset error policy corresponding to the node instance. The preset error policy may include one or more of the following: stop executing the subtask, ignore the error, and continue executing the subtask. When a node instance fails to execute a subtask, the retry interval of the node instance can be determined based on a preset exponential backoff strategy, and the node instance can be re-controlled to execute the subtask according to the retry interval.
[0160] The preset exponential backoff strategy can be understood as the retry interval increasing exponentially with each retry (for example, starting from 1 second, doubling to 2 seconds, 4 seconds, 8 seconds, etc.), thereby avoiding resource waste or system overload caused by frequent retries in a short period of time.
[0161] Step 560: Summarize the execution results of each node instance according to the preset result expression template to obtain the target execution result of the target workflow.
[0162] This enables automated execution of workflows, improving their efficiency and accuracy.
[0163] In some embodiments of this disclosure, before the above-described execution of subtasks corresponding to each node instance in the workflow to be executed by sequentially calling the node adapters corresponding to each node instance according to the target execution order, the declarative workflow execution system for AI programming can execute... Figure 6 This provides a declarative workflow execution method for AI programming, such as... Figure 6 As shown, the declarative workflow execution method for AI programming may include the following steps: Step 610: For each node instance, perform interface analysis to determine the interface mode of the node instance.
[0164] In this embodiment of the disclosure, for each node instance, the workflow execution system can perform interface analysis on the node instance based on a preset artificial intelligence model to determine the interface mode of the node instance.
[0165] For example, a workflow execution system can execute command-line help instructions and example task instructions for node instances, collect parameter descriptions and typical outputs of node instances, and input the help information and example outputs into a preset artificial intelligence model. The preset artificial intelligence model extracts the parameter structure of the node instance (parameter name, type, default value, whether required) and the output format (JSON, XML, or plain text). When the output is in a structured format, the system further parses the field names, types, and example values of the output to form the interface schema of the node instance.
[0166] Step 620: Based on the node instance interface pattern, generate the initial adapter code for the node instance.
[0167] In this embodiment of the disclosure, for each node instance, the workflow execution system can generate the initial adapter code of the node instance based on the interface pattern of the node instance by using a preset artificial intelligence model.
[0168] For example, the generated initial adapter code is encapsulated as a function, with the function name corresponding to a node instance, and it receives a standardized set of input parameters. The code automatically constructs command-line invocation statements, mapping the input parameters to command parameters that the tool can recognize; after execution, it automatically parses the output and converts it into a system-uniform format, with the output including fields such as a list of detection items and execution status.
[0169] Step 630: Perform multi-layer verification and repair on the initial adapter code to obtain the target adapter code corresponding to the node instance.
[0170] In this embodiment of the disclosure, for each initial adapter code, the workflow execution system can perform multi-level verification and repair on the initial adapter code to obtain the target adapter code corresponding to the node instance.
[0171] In some embodiments of this disclosure, the initial adapter code undergoes multi-layer verification and repair to obtain the target adapter code corresponding to the node instance, enabling the declarative workflow execution system for AI programming to execute. Figure 7 This provides a declarative workflow execution method for AI programming, such as... Figure 7 As shown, the declarative workflow execution method for AI programming may include the following steps: Step 710: Perform syntax verification, function existence verification, and dry run test on the initial adapter code to obtain the syntax verification results, function verification results, and dry run test results.
[0172] In this embodiment of the disclosure, the workflow execution system can perform syntax verification on the initial adapter code to verify whether the syntax structure of the initial adapter code conforms to the target syntax specification and obtain the syntax verification result; perform function existence verification on the initial adapter code to verify whether the node functions in the initial adapter code exist and obtain the function verification result; and perform dry running test on the initial adapter code to obtain the dry running test result.
[0173] The target syntax specification can be set as needed, and is not limited here.
[0174] If the syntax structure of the initial adapter code conforms to the target syntax specification, the syntax check result is determined to be a normal result; if the syntax structure of the initial adapter code does not conform to the target syntax specification, the syntax check result is determined to be an abnormal result.
[0175] If the node function exists in the initial adapter code, it means that the node function can be loaded correctly in the runtime environment, and the function verification result can be determined to be normal. If the node function does not exist in the initial adapter code, it means that the node function cannot be loaded correctly in the runtime environment, and the function verification result can be determined to be abnormal.
[0176] If the dry run test of the initial adapter code passes, the dry run test result can be determined to be a normal result; if the dry run test of the initial adapter code fails, the dry run test result can be determined to be an abnormal result.
[0177] Dry run testing can be understood as a method that simulates the actual execution process but does not actually run the operation. It aims to verify the correctness of the process logic, discover potential errors, and optimize the execution path in advance without consuming actual resources or causing system impact.
[0178] Step 720: When there is a target abnormal result in the syntax check result, function check result, and dry run test result, repair the data area corresponding to the target abnormal result in the initial adapter code based on the repair scheme corresponding to the target abnormal result, and obtain the repaired adapter code.
[0179] The repair plan for the abnormal target result can be set in advance.
[0180] Step 730: Use the repaired adapter code as the initial adapter code, and re-perform syntax verification, function existence verification, and dry run test on the initial adapter code.
[0181] Step 740: If the syntax check result, function check result, and dry run test result are all normal, the initial adapter code is determined as the target adapter code.
[0182] Therefore, the initial adapter code can be verified and repaired in multiple layers to obtain the target adapter code corresponding to the node instance. High-quality node adapters can be generated in a very short time, which can improve the scalability and ecosystem compatibility of the workflow execution system.
[0183] In some embodiments, after the above-described repair scheme based on the target abnormal result repairs the data area corresponding to the target abnormal result in the initial adapter code, the workflow execution system can count the number of repairs corresponding to the target abnormal result. When the number of repairs corresponding to the target abnormal result is equal to the second preset threshold, the repair of the target abnormal result is stopped, and a prompt message indicating that the adapter code repair has failed is generated to remind the user that the adapter code repair has failed, thereby avoiding infinite repair loops and ensuring the controllability and security of system execution.
[0184] Figure 8 This is a schematic diagram of the structure of a declarative workflow generation system for AI programming provided in an embodiment of this disclosure, such as... Figure 8 As shown, the declarative workflow generation system 800 for AI programming includes: The task receiving module 810 is used to receive task description statements; The intent understanding module 820 is used to understand the intent of the task description statement and obtain the task intent of the task description statement. The node matching module 830 is used to retrieve a set of nodes that match the task intent from the node registry. The set of nodes includes at least one target node, which is used to execute a subtask in the task intent. The dependency analysis module 840 is used to perform dependency analysis on each target node and obtain the node dependency relationship corresponding to the node set. The parameter inference module 850 is used to infer the parameter configuration of each target node and obtain the configuration parameters of each target node. The workflow generation module 860 is used to generate an initial workflow corresponding to a task description statement based on task intent, node set, node dependency relationship and configuration parameters. The verification and optimization module 870 is used to perform multiple verifications and optimizations on the initial workflow and generate the target workflow corresponding to the task description statement.
[0185] Optionally, the above intent understanding module includes: The context information acquisition submodule is used to acquire the context information corresponding to the task description statement; The structured extraction submodule is used to extract intent data from task description statements and contextual information in a structured manner. The Task Intent Generation submodule is used to generate task intents based on intent data to create task description statements.
[0186] Optionally, the above node matching module includes: The extraction submodule is used to extract multiple subtasks from the task intent; The retrieval submodule is used to retrieve the target node that matches the subtask from the node registry for each subtask; The construction submodule is used to build a set of nodes that match the task intent based on each target node.
[0187] Optionally, the above retrieval submodule includes: The acquisition unit is used to acquire the node capabilities required by the subtask and the historical execution nodes of the subtask. The retrieval unit is used to retrieve the first target node with node capabilities and the second target node corresponding to the historical execution node from the node registry. The deduplication unit is used to deduplicatize the first target node and the second target node to obtain the target node that matches the subtask.
[0188] Optionally, the above dependency analysis module includes: The dependency analysis submodule is used to perform logical dependency analysis and data flow dependency analysis on each target node to obtain the dependency relationship of the target node; The processing submodule is used to perform minimum closure processing and acyclic constraint processing on the dependencies of each target node, and generate the node dependencies corresponding to the node set.
[0189] Optionally, the above parameter inference module includes: The data acquisition submodule is used to acquire the context information corresponding to the preset node specifications and task description statements; The parameter inference submodule is used to infer the parameters of each target node based on the preset node specifications and context information, so as to obtain the configuration parameters of each target node. The configuration parameters meet the requirements of the preset node specifications and context information.
[0190] Optionally, the above verification optimization module includes: The first multi-validation submodule is used to perform multiple validations on the initial workflow based on preset rule requirements and obtain the validation results. The first repair submodule is used to repair the first abnormal problem based on the repair scheme corresponding to the first abnormal problem when there is a first abnormal problem in the verification result, and obtain the repaired workflow. The first abnormal problem is the problem that does not meet the preset rule requirements. The first re-verification submodule is used to take the repaired workflow as the initial workflow and re-verify the initial workflow based on preset rule requirements. The first multi-optimization submodule is used to perform multiple optimizations on the initial workflow when all verification results are normal, so as to obtain the target workflow corresponding to the task description statement.
[0191] Optionally, the above-mentioned multi-verification module includes: The multi-validation unit is used to perform syntax validation, pattern validation, and dependency validation on the initial workflow based on preset rule requirements, and obtain the validation results. The first determining unit is used to determine that there is a syntax error in the verification result when the syntax of the initial workflow does not meet the preset syntax requirements in the preset rules; to determine that there is a pattern error in the verification result when the pattern of the initial workflow does not meet the preset pattern requirements in the preset rules; and to determine that there is a dependency error in the verification result when the node dependencies in the initial workflow do not meet the preset dependency requirements in the preset rules. The syntax error, pattern error, and dependency error are determined as the first error. The second determining unit is used to determine that the verification results are all normal when the syntax of the initial workflow meets the preset syntax requirements in the preset rules, the pattern of the initial workflow meets the preset pattern requirements in the preset rules, and the node dependencies in the initial workflow meet the preset dependency requirements in the preset rules.
[0192] Optionally, the above verification optimization module includes: The second multi-verification submodule is used to perform multiple verification items on the initial workflow in a preset verification order based on preset rule requirements. The second repair submodule is used to stop the verification of the remaining verification items of the initial workflow when a second abnormal problem exists in the verification result of any verification item, and to repair the second abnormal problem based on the repair solution corresponding to the second abnormal problem, so as to obtain the repaired workflow. The second re-verification submodule is used to take the repaired workflow as the initial workflow and re-verify the initial workflow according to the preset verification order of multiple verification items and based on the preset rule requirements. The second multi-optimization submodule is used to perform multiple optimizations on the initial workflow when the verification results of each verification item are normal, so as to obtain the target workflow corresponding to the task description statement. Among them, multiple validation items include at least syntax validation items, pattern validation items, and dependency validation items.
[0193] Optionally, the above-mentioned multiple optimization sub-modules include: The parallelization analysis unit is used to perform parallelization analysis on the initial workflow and determine the parallelizable execution nodes in the initial workflow; The redundancy detection unit is used to perform redundancy detection on the initial workflow and identify redundant nodes in the initial workflow. The parameter identification unit is used to identify parameters in the initial workflow based on preset parameter specifications and determine abnormal parameters in the initial workflow. Abnormal parameters are parameters that do not meet the preset parameter specifications. The optimization unit is used to identify parallel executable nodes in the initial workflow as parallel nodes, merge redundant nodes in the initial workflow, and adjust abnormal parameters in the initial workflow to normal parameters that meet the preset parameter specifications, thereby obtaining the target workflow corresponding to the task description statement.
[0194] The declarative workflow generation system for AI programming provided in this disclosure can implement the declarative workflow generation method for AI programming in any of the above embodiments. Its execution method and beneficial effects are similar, and will not be described again here.
[0195] Figure 8This is a schematic diagram of the structure of a declarative workflow execution system for AI programming provided in an embodiment of this disclosure, such as... Figure 8 As shown, the declarative workflow execution system 800 for AI programming includes: Workflow receiving module 810 is used to receive a target workflow, wherein the target workflow is obtained based on the declarative workflow generation method for AI programming in any of the above embodiments; The parsing module 820 is used to perform structured parsing on the target workflow to obtain the workflow to be executed; The expansion module 830 is used to expand multiple target nodes in the workflow to be executed into multiple node instances and rewrite the target dependencies between the node instances. The execution order determination module 840 is used to perform topological sorting on multiple node instances based on target dependencies to obtain the target execution order of multiple node instances; The execution module 850 is used to sequentially call the node adapters corresponding to each node instance in the workflow to be executed, according to the target execution order, to execute the subtasks corresponding to each node instance and obtain the execution results of each node instance. The execution result generation module 860 is used to summarize the execution results of each node instance according to the preset result expression template to obtain the target execution result of the target workflow.
[0196] Optionally, the above execution module includes: The hierarchical partitioning submodule is used to divide multiple node instances into at least one execution level according to the target execution order. The hierarchical execution order of at least one execution level is the same as the target execution order. There are no dependencies between node instances in each execution level and they can be executed in parallel. The execution submodule is used to sequentially call the node adapters corresponding to the node instances in each execution level to execute the subtasks corresponding to each node instance in the workflow to be executed, in accordance with the hierarchical execution order, and obtain the execution results of each node instance.
[0197] Optionally, the above execution module includes: The Stop submodule is used to stop the execution of subtasks by calling the node instance when the current execution conditions of the node instance do not meet the preset execution conditions; The error control submodule is used to control the subsequent behavior of a node instance when an error occurs during the execution of a subtask, based on the preset error policy corresponding to the node instance. The preset error policy includes one or more of the following: stop executing the subtask, ignore the error, and continue executing the subtask. The failure control submodule is used to determine the retry interval of a node instance based on a preset exponential backoff strategy when the node instance fails to execute a subtask, and to re-control the node instance to execute the subtask according to the retry interval.
[0198] Optionally, the aforementioned declarative workflow execution system for AI programming includes: The interface analysis module is used to perform interface analysis on each node instance to determine the interface mode of the node instance. The adapter code generation module is used to generate the initial adapter code for node instances based on the node instance interface pattern. The adapter code verification and repair module is used to perform multi-level verification and repair on the initial adapter code to obtain the target adapter code corresponding to the node instance; The registration module is used to register the target adapter code into the node registry, thereby obtaining the node adapter corresponding to the node instance.
[0199] Optionally, the above adapter code verification and repair module includes: The adapter multi-validation submodule is used to perform syntax validation, function existence verification, and dry run test on the initial adapter code, and obtain the syntax validation results, function validation results, and dry run test results. The adapter code repair submodule is used to repair the data area corresponding to the target abnormal result in the initial adapter code based on the repair scheme corresponding to the target abnormal result when there is a target abnormal result in the syntax check result, function check result and dry run test result, so as to obtain the repaired adapter code; The adapter re-validation submodule is used to take the repaired adapter code as the initial adapter code and re-perform syntax validation, function existence verification, and dry run tests on the initial adapter code; The result determination submodule is used to determine the initial adapter code as the target adapter code when the syntax check result, function check result, and dry run test result are all normal.
[0200] The declarative workflow execution system for AI programming provided in this disclosure can implement the declarative workflow execution method for AI programming in any of the above embodiments. Its execution method and beneficial effects are similar, and will not be described again here.
[0201] This disclosure also provides a computer device, which includes a processor and a memory, wherein the memory stores a computer program. When the computer program is executed by the processor, it can implement the methods of any of the above embodiments. The execution method and beneficial effects are similar, and will not be described again here.
[0202] The computer device in this disclosure can be understood as any device with processing and computing capabilities. This device may include, but is not limited to, mobile terminals such as smartphones, laptops, personal digital assistants (PDAs), tablet computers (PADs), portable multimedia players (PMPs), in-vehicle terminals (e.g., in-vehicle navigation terminals), and wearable devices, as well as fixed electronic devices such as digital TVs, desktop computers, and smart home devices.
[0203] Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of this disclosure, such as... Figure 10 As shown, the computer device 1000 may include a processor 1010 and a memory 1020. The memory 1020 stores a computer program 1021. When the computer program 1021 is executed by the processor 1010, it can implement the method provided in any of the above embodiments. Its execution mode and beneficial effects are similar and will not be described again here.
[0204] Of course, for the sake of simplicity, Figure 10 Only some of the components of the computer device 1000 relevant to the present invention are shown in this illustration; components such as buses, input / output interfaces, input devices, and output devices are omitted. In addition, the computer device 1000 may include any other suitable components depending on the specific application.
[0205] This disclosure provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it can implement the methods of any of the above embodiments. The execution method and beneficial effects are similar, and will not be described again here.
[0206] The aforementioned computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0207] The computer program described above can be written in any combination of one or more programming languages to perform the operations of the embodiments of this disclosure. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer device, partially on the user's device, as a standalone software package, partially on the user's computer device and partially on a remote computer device, or entirely on a remote computer device or server.
[0208] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0209] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0210] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A declarative workflow generation method for AI programming, characterized in that, include: Receive the task description statement; The task description statement is subjected to intent understanding to obtain the task intent of the task description statement; Retrieve a set of nodes that match the task intent from the node registry, the set of nodes including at least one target node, the target node being used to execute a subtask in the task intent; Perform dependency analysis on each of the target nodes to obtain the node dependency relationships corresponding to the node set; Parameter configuration inference is performed on each of the target nodes to obtain the configuration parameters of each target node; Based on the task intent, the node set, the node dependencies, and the configuration parameters, an initial workflow corresponding to the task description statement is generated. The initial workflow is subjected to multiple checks and optimizations to generate the target workflow corresponding to the task description statement.
2. The method according to claim 1, characterized in that, The process of understanding the intent of the task description statement to obtain the task intent of the task description statement includes: Obtain the context information corresponding to the task description statement; The intent data is extracted from the task description statement and the context information in a structured manner. The task intent is generated based on the intent data to create the task description statement.
3. The method according to claim 1, characterized in that, The step of retrieving a set of nodes in the node registry that match the task intent includes: Extract multiple subtasks from the stated task intent; For each subtask, retrieve the target node that matches the subtask from the node registry; Based on each target node, construct a set of nodes that match the task intent.
4. The method according to claim 3, characterized in that, The step of retrieving the target node matching the subtask from the node registry includes: Obtain the node capabilities required for the subtask and the historical execution nodes of the subtask; Retrieve the first target node with the capabilities of the node and the second target node corresponding to the historical execution node from the node registry; The first target node and the second target node are deduplicated to obtain the target node that matches the subtask.
5. The method according to claim 1, characterized in that, The step of performing dependency analysis on each of the target nodes to obtain the node dependency relationships corresponding to the node set includes: For each target node, logical dependency analysis and data flow dependency analysis are performed to obtain the dependency relationship of the target node; The dependencies of each target node are processed by minimum closure and acyclic constraint to generate the node dependencies corresponding to the node set.
6. The method according to claim 1, characterized in that, The step of inferring the parameter configuration of each target node to obtain the configuration parameters of each target node includes: Obtain the context information corresponding to the preset node specifications and the task description statement; Based on the preset node specifications and the context information, parameter inference is performed on each target node to obtain the configuration parameters of each target node, and the configuration parameters satisfy the requirements of the preset node specifications and the context information.
7. The method according to claim 1, characterized in that, The step of performing multiple validations and optimizations on the initial workflow to generate the target workflow corresponding to the task description statement includes: The initial workflow is subjected to multiple verifications based on preset rules to obtain verification results. When a first abnormal problem exists in the verification result, the first abnormal problem is repaired based on the repair scheme corresponding to the first abnormal problem to obtain the repaired workflow. The first abnormal problem is a problem that does not meet the requirements of the preset rule. The repaired workflow is used as the initial workflow, and multiple verifications are performed on the initial workflow again based on preset rule requirements. When all the verification results are normal, the initial workflow is optimized multiple times to obtain the target workflow corresponding to the task description statement.
8. The method according to claim 7, characterized in that, The initial workflow is subjected to multiple verifications based on preset rules to obtain verification results, including: Based on preset rules, the initial workflow is subjected to syntax validation, pattern validation, and dependency validation respectively, and the validation results are obtained. When the syntax of the initial workflow does not conform to the preset syntax requirements in the preset rules, it is determined that there is a syntax error in the verification result; when the pattern of the initial workflow does not conform to the preset pattern requirements in the preset rules, it is determined that there is a pattern error in the verification result; when the node dependencies in the initial workflow do not conform to the preset dependency requirements in the preset rules, it is determined that there is a dependency error in the verification result, and the syntax error, the pattern error, and the dependency error are identified as the first error. When the syntax of the initial workflow conforms to the preset syntax requirements in the preset rules, the pattern of the initial workflow conforms to the preset pattern requirements in the preset rules, and the node dependencies in the initial workflow conform to the preset dependency requirements in the preset rules, the verification results are determined to be normal.
9. The method according to claim 1, characterized in that, The step of performing multiple validations and optimizations on the initial workflow to generate the target workflow corresponding to the task description statement includes: According to the preset verification order of multiple verification items, the initial workflow is sequentially verified for multiple verification items based on preset rule requirements; If a second anomaly is found in the verification result of any of the verification items, the verification of the remaining verification items of the initial workflow is stopped, and the second anomaly is repaired based on the repair scheme corresponding to the second anomaly to obtain the repaired workflow; The repaired workflow is used as the initial workflow, and the initial workflow is re-verified according to the preset verification order of multiple verification items and based on the preset rule requirements. When the verification results of each of the verification items are normal, the initial workflow is optimized multiple times to obtain the target workflow corresponding to the task description statement; The plurality of validation items include at least syntax validation items, pattern validation items, and dependency validation items.
10. The method according to claim 7 or 9, characterized in that, The process of performing multiple optimizations on the initial workflow to obtain the target workflow corresponding to the task description statement includes: Perform parallelization analysis on the initial workflow to determine the parallelizable execution nodes in the initial workflow; Redundancy detection is performed on the initial workflow to identify redundant nodes in the initial workflow; Based on preset parameter specifications, the initial workflow is parameter identified to determine abnormal parameters in the initial workflow. The abnormal parameters are those that do not meet the preset parameter specifications. The parallelizable nodes in the initial workflow are identified as parallel nodes, redundant nodes in the initial workflow are merged, and abnormal parameters in the initial workflow are adjusted to normal parameters that meet the preset parameter specifications to obtain the target workflow corresponding to the task description statement.
11. A declarative workflow execution method for AI programming, characterized in that, include: Receive a target workflow, wherein the target workflow is obtained based on the declarative workflow generation method for AI programming as described in any one of claims 1-10; The target workflow is structured and parsed to obtain the workflow to be executed; Expand the multiple target nodes in the workflow to be executed into multiple node instances, and rewrite the target dependencies between the node instances; Based on the target dependency relationship, the multiple node instances are topologically sorted to obtain the target execution order of the multiple node instances; According to the target execution order, the node adapters corresponding to each node instance are called sequentially to execute the subtasks corresponding to each node instance in the workflow to be executed, and the execution results of each node instance are obtained. The execution results of each node instance are summarized according to a preset result expression template to obtain the target execution result of the target workflow.
12. The method according to claim 11, characterized in that, The step of sequentially calling the node adapters corresponding to each node instance in the workflow to be executed, according to the target execution order, to execute the subtasks corresponding to each node instance in the workflow to be executed, and obtaining the execution results of each node instance, includes: According to the target execution order, the multiple node instances are divided into at least one execution level. The execution order of the at least one execution level is the same as the target execution order. There is no dependency between the node instances in each execution level, and they can be executed in parallel. According to the execution order of the hierarchy, the node adapters corresponding to the node instances in each execution hierarchy are called sequentially to execute the subtasks corresponding to each node instance in the workflow to be executed, so as to obtain the execution results of each node instance.
13. The method according to claim 11, characterized in that, The step of sequentially calling the node adapters corresponding to each of the node instances to execute the subtasks corresponding to each of the node instances in the workflow to be executed includes: When the current execution conditions of the node instance do not meet the preset execution conditions, the execution of the subtask by the node instance is stopped. When an error occurs during the execution of a subtask by the node instance, the subsequent behavior of the node instance is controlled based on a preset error policy corresponding to the node instance. The preset error policy includes one or more of the following: stopping the execution of the subtask, ignoring the error, and continuing to execute the subtask. When the node instance fails to execute a subtask, the retry interval of the node instance is determined based on a preset exponential backoff strategy, and the node instance is re-controlled to execute the subtask according to the retry interval.
14. The method according to claim 11, characterized in that, Before sequentially calling the node adapters corresponding to each node instance in the workflow to be executed according to the target execution order, the method further includes: For each node instance, perform interface analysis on the node instance to determine the interface mode of the node instance; Based on the interface pattern of the node instance, generate the initial adapter code for the node instance; The initial adapter code is subjected to multi-level verification and repair to obtain the target adapter code corresponding to the node instance; The target adapter code is registered in the node registry to obtain the node adapter corresponding to the node instance.
15. The method according to claim 14, characterized in that, The step of performing multi-level verification and repair on the initial adapter code to obtain the target adapter code corresponding to the node instance includes: The initial adapter code is subjected to syntax verification, function existence verification, and dry run test to obtain syntax verification results, function verification results, and dry run test results. When a target anomaly is found in the syntax verification result, the function verification result, and the dry run test result, the data area corresponding to the target anomaly in the initial adapter code is repaired based on the repair scheme corresponding to the target anomaly, and the repaired adapter code is obtained. The repaired adapter code is used as the initial adapter code, and the initial adapter code is re-tested for syntax validation, function existence verification, and dry running tests. When the syntax verification result, the function verification result, and the dry run test result are all normal, the initial adapter code is determined as the target adapter code.
16. A declarative workflow generation system for AI programming, characterized in that, include: The task receiving module is used to receive task description statements; The intent understanding module is used to understand the intent of the task description statement and obtain the task intent of the task description statement. A node matching module is used to retrieve a set of nodes that match the task intent from a node registry, the set of nodes including at least one target node, the target node being used to execute a subtask in the task intent; The dependency analysis module is used to perform dependency analysis on each of the target nodes to obtain the node dependency relationships corresponding to the node set. The parameter inference module is used to infer the parameter configuration of each target node and obtain the configuration parameters of each target node. The workflow generation module is used to generate an initial workflow corresponding to the task description statement based on the task intent, the node set, the node dependencies, and the configuration parameters. The verification and optimization module is used to perform multiple verifications and optimizations on the initial workflow to generate the target workflow corresponding to the task description statement.
17. A declarative workflow execution system for AI programming, characterized in that, include: A workflow receiving module is used to receive a target workflow, wherein the target workflow is obtained based on the declarative workflow generation method for AI programming according to any one of claims 1-10; The parsing module is used to perform structured parsing on the target workflow to obtain the workflow to be executed; The expansion module is used to expand multiple target nodes in the workflow to be executed into multiple node instances, and rewrite the target dependencies between the node instances. The execution order determination module is used to perform topological sorting on multiple node instances based on the target dependency relationship to obtain the target execution order of the multiple node instances; The execution module is used to sequentially call the node adapters corresponding to each node instance in the workflow to be executed, according to the target execution order, to execute the subtasks corresponding to each node instance in the workflow to be executed, and to obtain the execution results of each node instance; The execution result generation module is used to summarize the execution results of each node instance according to a preset result expression template to obtain the target execution result of the target workflow.
18. A computer device, characterized in that, include: A memory and a processor, wherein the memory stores a computer program that, when executed by the processor, implements the declarative workflow generation method for AI programming as described in any one of claims 1-10 or the declarative workflow execution method for AI programming as described in any one of claims 11-15.
19. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the declarative workflow generation method for AI programming as described in any one of claims 1-10 or the declarative workflow execution method for AI programming as described in any one of claims 11-15.