A cloud function configuration detection method based on a large language model
By using a cloud function configuration detection method based on a large language model and generating a target prompt instruction set using a preset prompt template, efficient and accurate detection of application cloud function configuration files that are invisible to the server is achieved. This solves the problem of poor detection effect in existing technologies and improves the reliability and security of configuration files.
Patent Information
- Application Number
- CN202510966160.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-14
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2045-07-14
AI Technical Summary
Existing technologies suffer from poor detection performance, high false alarm rates, and difficulty in effectively identifying potential errors in cloud function configuration files of server-insensitive applications, especially due to the fine-grained structure of these configurations, which contain domain-specific languages, complex dependencies, and nested objects.
A cloud function configuration detection method based on a large language model is adopted. By obtaining the configuration file to be detected, a target prompt instruction set is generated based on a preset prompt template, including role task instructions, step-by-step constraint task instructions and output requirement instructions. The large language model is used for detection, and a multi-level constraint guidance strategy is used to ensure the comprehensiveness and accuracy of the detection.
It improves the accuracy of cloud function configuration file error detection, ensures the comprehensiveness and accuracy of detection, reduces the false alarm rate, and improves the reliability and security of configuration files.
Smart Images

Figure CN120822615B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic equipment technology, and more specifically, to a cloud function configuration detection method, apparatus, and electronic equipment based on a large language model. Background Technology
[0002] With the continuous development of internet technology, cloud computing has become the core infrastructure for modern application development. Among these, serverless computing, as an emerging cloud computing paradigm, abstracts infrastructure management, allowing developers to focus on function-level application building, significantly improving development efficiency and agility. Furthermore, the AWS SAM template (AWS Serverless Application Model), with its standardized and convenient features, has become the most widely adopted configuration pattern for defining and deploying serverless applications.
[0003] Since the correct operation of cloud functions in server-insensitive applications highly depends on the accuracy of their configuration files, relevant methods typically employ data-driven approaches to detect these configuration files (e.g., detecting errors by learning patterns or rules from historical configuration data). However, these methods suffer from poor detection performance, high false alarm rates, and difficulty in effectively identifying potential errors in the configuration due to the characteristics of cloud function configuration files, such as domain-specific languages, complex dependencies, and fine-grained structures of nested objects across multiple specializations and cloud resource types. Summary of the Invention
[0004] In view of the above problems, this application proposes a cloud function configuration detection method, device and electronic device based on a large language model to improve the above problems.
[0005] Firstly, this application provides a cloud function configuration detection method based on a large language model, the method comprising:
[0006] Obtain the configuration file to be tested, which is the configuration file of the cloud function running in the server-invisible application;
[0007] Based on the configuration file to be detected and the preset prompt template, a target prompt instruction set is obtained. The preset prompt template includes a role task instruction template, a step-by-step constraint task instruction template, and an output requirement instruction template. The target prompt instruction set includes role task instructions, step-by-step constraint task instructions, and output requirement instructions.
[0008] The target prompt instruction set is input into the large language model, which then performs detection on the configuration file to be detected based on the role task instruction and the step constraint task instruction, and outputs a detection result file in a preset format based on the output requirement instruction. The detection result file indicates whether the configuration file to be detected has a configuration error.
[0009] Optionally, obtaining the target prompt instruction set based on the configuration file to be detected and the preset prompt template includes:
[0010] Based on the configuration file to be detected, multiple constraint tasks in the step-by-step constraint task instruction template are determined. The constraint tasks include resource type constraints, configuration entry constraints, configuration entry value constraints, entry dependency constraints, and value dependency constraints.
[0011] The constraint content of the multiple constraint tasks is determined based on the configuration file to be detected, and the execution order of the multiple constraint tasks is determined based on the configuration file to be detected.
[0012] Based on the constraint content and execution order of the multiple constraint tasks, the step-by-step constraint task instructions in the target prompt instruction set are determined to obtain the target prompt instruction set.
[0013] Optionally, determining the constraint content of the multiple constraint tasks based on the configuration file to be detected includes:
[0014] When the multiple constraint tasks include resource type constraints, the constraint content of the resource type constraints includes determining whether the resource configured in the configuration file to be detected is a preset resource type;
[0015] When the multiple constraint tasks include configuration entry constraints, the constraint content of the configuration entry constraints includes determining whether the configuration entry of the configuration file to be detected is a configuration entry declared for the corresponding resource type and determining whether the configuration entry is complete.
[0016] When the multiple constraint tasks include configuration entry value constraints, the constraint content of the configuration entry value constraints includes determining whether the assignment corresponding to the configuration entry meets the preset assignment conditions.
[0017] When the multiple constraint tasks include item dependency constraints, the constraint content of the item dependency constraints includes determining whether there is an item dependency relationship between the configuration items and determining whether the item dependency relationship is executed normally.
[0018] When the multiple constraint tasks include value dependency constraints, the constraint content of the value dependency constraints includes determining whether there is a value dependency relationship between the assignments corresponding to the configuration entries and determining whether the value dependency relationship is correct.
[0019] Optionally, obtaining the target prompt instruction set based on the configuration file to be detected and the preset prompt template includes:
[0020] Based on the configuration file to be detected, the role instructions and target task instructions in the role task instruction template are set. The role instructions are used to determine the knowledge call of the large language model, and the target task instructions are used to determine the target task framework of the large language model.
[0021] Based on the configuration file to be detected, the role instructions in the role task instruction template, and the target task instructions, the role task instructions in the target prompt instruction set are determined to obtain the target prompt instruction set.
[0022] Optionally, obtaining the target prompt instruction set based on the configuration file to be detected and the preset prompt template includes:
[0023] Based on the configuration file to be detected, the content requirements and format requirements in the output requirement instruction template are set. The content requirements are to only filter the constraint tasks that reach the preset threshold.
[0024] Based on the configuration file to be detected, the content requirements and format requirements in the output requirement instruction template, the output requirement instructions in the target prompt instruction set are determined to obtain the target prompt instruction set.
[0025] Optionally, the method further includes: after outputting the detection result file in a preset format based on the output requirement instruction, the method further includes:
[0026] Extract a pre-formatted detection description from the detection result file based on regular expressions;
[0027] If the detection description includes error descriptions, the error descriptions in the preset format are categorized to obtain an error description list.
[0028] Secondly, this application provides a cloud function configuration detection system based on a large language model, the system comprising:
[0029] The input module is used to obtain the configuration file to be detected, which is the configuration file of the cloud function running in the server-invisible application;
[0030] The target prompt instruction set generation module is used to obtain a target prompt instruction set based on the configuration file to be detected and the preset prompt template. The preset prompt template includes a role task instruction template, a step-by-step constraint task instruction template, and an output requirement instruction template. The target prompt instruction set includes role task instructions, step-by-step constraint task instructions, and output requirement instructions.
[0031] The large language model processing module is used to input the target prompt instruction set into the large language model, so that the large language model can detect the configuration file to be detected based on the role task instruction and the step constraint task instruction, and output a detection result file in a preset format based on the output requirement instruction. The detection result file indicates whether the configuration file to be detected has a configuration error.
[0032] The output module is used to extract a preset-formatted detection description from the detection result file based on regular expressions; when the detection description includes error descriptions, the preset-formatted error descriptions are classified to obtain an error description list, the error description list including errors; when the detection description does not include error descriptions, a correct description list is obtained.
[0033] Thirdly, this application provides an electronic device including one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs being configured to perform the methods described above.
[0034] Fourthly, this application provides a computer-readable storage medium storing program code, wherein the above-described method is executed when the program code is run.
[0035] This application provides a cloud function configuration detection method, device, electronic device, and storage medium based on a large language model. After obtaining the configuration file to be detected, a target prompt instruction set is obtained based on the configuration file and a preset prompt template. The preset prompt template includes a role task instruction template, a step-by-step constraint task instruction template, and an output requirement instruction template. The target prompt instruction set includes role task instructions, step-by-step constraint task instructions, and output requirement instructions. The target prompt instruction set is input into a large language model, which detects the configuration file to be detected based on the role task instructions and the step-by-step constraint task instructions, and outputs a detection result file in a preset format based on the output requirement instructions. The detection result file indicates whether the configuration file to be detected has a configuration error.
[0036] In this application, the above-described method enables the configuration of corresponding target prompt templates (including obtaining role task instructions based on the configuration file to be detected and the role task instruction template, obtaining step-by-step constraint task instructions based on the configuration file to be detected and the step-by-step constraint task instruction template, and obtaining output requirement task instructions based on the configuration file to be detected and the output requirement task instruction template) through an adaptive prompt generation mechanism based on the configuration file to be detected. This achieves customization of the detection logic and leverages its powerful reasoning capabilities. The target prompt instruction set fully stimulates and guides the large language model to detect the configuration file to be detected. Furthermore, a multi-level constraint guidance strategy is adopted to ensure the comprehensiveness and accuracy of the detection, thereby improving the accuracy of error detection in the configuration file to be detected. Attached Figure Description
[0037] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0038] Figure 1 A flowchart of a cloud function configuration detection method based on a large language model, as proposed in an embodiment of this application, is shown.
[0039] Figure 2 This illustration shows a schematic diagram of a configuration file in a cloud function configuration detection method based on a large language model proposed in an embodiment of this application;
[0040] Figure 3 This illustration shows a schematic diagram of generating a target prompt instruction set in a cloud function configuration detection method based on a large language model proposed in an embodiment of this application;
[0041] Figure 4 A flowchart of a preferred cloud function configuration detection method based on a large language model, as proposed in an embodiment of this application, is shown.
[0042] Figure 5 This paper presents a structural block diagram of a cloud function configuration detection method system based on a large language model, as proposed in an embodiment of this application.
[0043] Figure 6 A structural block diagram of an electronic device proposed in this application is shown. Detailed Implementation
[0044] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0045] In the accompanying drawings, the size of constituent elements, the thickness of layers, or areas may sometimes be exaggerated for clarity. Therefore, any implementation of this disclosure is not necessarily limited to the dimensions shown in the drawings, and the shapes and sizes of the components in the drawings do not reflect true proportions. Furthermore, the drawings schematically illustrate ideal examples, and any implementation of this disclosure is not limited to the shapes or values shown in the drawings.
[0046] In related technologies, academia and industry have conducted extensive research and exploration into error detection for configuration files. Data-driven white-box and black-box methods can be employed for error detection. Specifically, white-box methods can infer configuration constraints or detect dependency conflicts between code and configuration through static code analysis, primarily targeting logical design errors in the program. However, since critical configuration errors in cloud functions of server-agnostic applications mostly reside in declarative YAML configuration files (such as AWS SAM templates) rather than traditional program source code, this approach is ineffective in error detection scenarios for cloud functions of server-agnostic applications, struggling to effectively parse and understand the specific syntax, semantics, and complex structure of cloud function configuration files.
[0047] Black-box methods can detect errors by learning patterns or rules from a large number of configuration instances. For example, EnCore leverages a large number of configurations to learn and customize rule templates, ConfigC builds a language model to detect errors in new configurations, and DRIVE identifies violations in Dockerfiles through sequence pattern mining. However, because they heavily rely on historical data, their effectiveness depends directly on the quantity, quality, and representativeness of the training data. They struggle to identify rare or newly supported combinations of configuration items, and the learned patterns may be overly generalized or strict, leading to misjudgments. Therefore, this approach is not ideal in terms of detection performance and lacks flexibility and adaptability. Cloud function services and their configuration options, which are server-agnostic applications, are constantly being updated and evolved. Static models trained on historical data struggle to adapt quickly to these changes, leading to model aging and a decline in the ability to detect newly emerging configuration patterns or error types.
[0048] Furthermore, due to the characteristics of server-insensitive application cloud function configuration files, such as containing domain-specific languages, complex dependencies, and fine-grained structures of nested objects across multiple special characteristics and cloud resource types, there are still problems such as poor detection performance, high false alarm rate, and difficulty in effectively identifying potential errors in the configuration.
[0049] Therefore, in this embodiment, after obtaining the configuration file to be detected, a target prompt instruction set is obtained based on the configuration file to be detected and a preset prompt template. The preset prompt template includes a role task instruction template, a step-by-step constraint task instruction template, and an output requirement instruction template. The target prompt instruction set includes role task instructions, step-by-step constraint task instructions, and output requirement instructions. The target prompt instruction set is input into a large language model, which detects the configuration file to be detected based on the role task instructions and the step-by-step constraint task instructions, and outputs a detection result file in a preset format based on the output requirement instructions. The detection result file indicates whether the configuration file to be detected has a configuration error. The above method enables the configuration of corresponding target prompt templates (including obtaining role task instructions based on the configuration file to be detected and the role task instruction template, obtaining step-by-step constraint task instructions based on the configuration file to be detected and the step-by-step constraint task instruction template, and obtaining output requirement task instructions based on the configuration file to be detected and the output requirement task instruction template) through an adaptive prompt generation mechanism based on the configuration file to be detected. This achieves customization of the detection logic and leverages its powerful reasoning capabilities. The target prompt instruction set fully stimulates and guides the large language model to detect the configuration file to be detected. Furthermore, a multi-level constraint guidance strategy is adopted to ensure the comprehensiveness and accuracy of the detection, thereby improving the accuracy of configuration file error detection.
[0050] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0051] Large Language Model (LLM): This is an artificial intelligence model with powerful natural language processing capabilities, capable of understanding and generating natural language text. It can be used to analyze, understand, and generate text data, playing an important role in tasks such as text validation, natural language understanding, and text generation.
[0052] AWS Serverless Application Model (SAM) configuration files: These are cloud function configuration files used to define and deploy AWS Serverless Application Model (SAM) applications. They are typically AWS SAM templates in YAML format. These configuration files specify in detail key settings such as application resources, permissions, event triggers, and execution environment.
[0053] Chain of Thought (CoT) is a technique that guides artificial intelligence models through step-by-step reasoning and analysis. By breaking down complex tasks into a series of progressive thought steps, it helps models understand and solve problems more systematically, improving their reasoning ability and problem-solving accuracy.
[0054] The embodiments of this application will now be described with reference to the accompanying drawings.
[0055] To better understand the solutions of the embodiments of this application, the following describes a cloud function configuration detection system 600 based on a large language model. The system 600 includes: an input module 610, a target prompt instruction set generation module 620, a large language model processing module 630, and an output module 640.
[0056] The input module 610 can be used to obtain the configuration file to be detected; the target prompt instruction set generation module 620 can be used to obtain the target prompt instruction set based on the configuration file to be detected and the preset prompt template; the large language model processing module 630 can be used to input the target prompt instruction set into the large language model, so that the large language model can detect the configuration file to be detected based on the target prompt instruction set and output a detection result file in a preset format; the output module 640 can be used to extract the detection description in a preset format from the detection result file based on regular expressions; when the detection description includes error descriptions, the error descriptions in the preset format are classified to obtain an error description list.
[0057] Please see Figure 1 This application provides a cloud function configuration detection method based on a large language model, the method comprising:
[0058] S110: Obtain the configuration file to be tested, which is the configuration file of the cloud function running in the server-invisible application.
[0059] The configuration file to be tested can be a cloud function configuration file for AWS serverless applications, specifically a YAML format configuration file, such as the AWS SAM template (Serverless Application Model).
[0060] In this application, the configuration file to be tested can cover configuration elements such as resource type, configuration entries, configuration entry values, entry dependencies, and value dependencies. Specifically, the execution configuration required by the cloud function can be defined by the resource type, while entry dependencies and value dependencies are two ways to specify dependencies in the configuration file to be tested. As an example, such as... Figure 2 As shown, the required execution configuration can be defined by resource type. For example, the resource of the configuration file to be tested can be SomeBucker, and its type definition can be AWS::S3::Bucket, which indicates that the resource is a bucket in AWS S3. The configuration entries include BucketName (bucket name), and the configuration entry values are specific names, such as some-bucket-somewhere. Entry dependencies and value dependencies are two ways to specify dependencies in the configuration file to be tested. For example, ... Figure 2 As shown, the specified function type resource ( Figure 2 Line 17 in the document can be AWS::Serverless:Function, whose configuration entries can include property values. These configuration entries are nested and include configuration entries for Handler, Runtime, CodeUri, and Events. The Events configuration entry specifies the event that triggers the function call; it is also nested, for example... Figure 2 Line 23, CreateMetaEvent, indicates the name of the event. Figure 2 Line 25 in the code has a type of S3, indicating that events stored in S3 will trigger the execution of this function. Figure 2 In line 27, `!Ref SomeBucket` passes. `!Ref` applies value dependency, indicating a dependency on information related to the `SomeBucket` bucket mentioned above. Figure 2 Line 28 explicitly states the event type as "s3:ObjectCreate:*", meaning a new object was created in s3. Furthermore... Figure 2 Lines 32-33 in the text clearly state that the event that triggers this function call is the creation of an object with the suffix name (Name: suffix) named meta.json (the value specified by the Value entry) in the SomeBucker s3 bucket. Therefore, the Name and Value entries need to appear together.
[0061] In one optional implementation, the input module can obtain the configuration file to be tested and transmit it to the target prompt instruction set generation module, so that the target prompt instruction set generation module can generate a corresponding target prompt instruction set based on the configuration file to be tested. The configuration file to be tested is the raw data for configuration testing of the cloud function. This configuration file includes configuration elements such as resource type, configuration entries, configuration entry values, entry dependencies, and value dependencies. Error detection in this configuration file can effectively identify potential problems, thereby improving the reliability and security of cloud function deployment and operation.
[0062] S120: Based on the configuration file to be detected and the preset prompt template, a target prompt instruction set is obtained. The preset prompt template includes a role task instruction template, a step-by-step constraint task instruction template, and an output requirement instruction template. The target prompt instruction set includes role task instructions, step-by-step constraint task instructions, and output requirement instructions.
[0063] The role-task instruction template serves as a guiding text framework, defining a specific role and task for the large language model, enabling it to execute the assigned task with appropriate expertise and mindset. For example, a role-task instruction template could be, "You are an expert in writing cloud function configuration files for AWS SAM server-aware applications. Please check the above configuration file for any configuration errors?" This template guides the large language model's behavior and knowledge retrieval, providing a clear task or problem to specify the concrete analysis task it needs to complete. The step-by-step constraint task instruction template is a structured text framework, breaking down the task into a series of specific steps and constraints. This guides the large language model to meticulously examine the configuration file according to a predetermined logic and sequence. Constraints can include resource type constraints, configuration entry constraints, configuration entry value constraints, entry dependency constraints, and value dependency constraints. For example, a step-by-step constraint task instruction template could be, "Please check the configuration file according to the following steps: 1) Check if the resource type is correct; 2) Check if the configuration entries are correct....." The output requirement instruction template is a normative text framework, specifying the output format and content requirements for the processing results, ensuring the structure and consistency of the results. For example, the output requirement template could be "Please output the validation results in JSON format, including the location, type, and repair suggestions of the errors".
[0064] In one optional implementation, the target prompt instruction set generation module can generate a corresponding target prompt instruction set based on the received configuration file to be detected. Specifically, this can include: obtaining role task instructions based on the configuration file to be detected and the role task instruction template; obtaining step constraint task instructions based on the configuration file to be detected and the step constraint task instruction template; and obtaining output requirement task instructions based on the configuration file to be detected and the output requirement task instruction template. This allows the role task instructions, step constraint task instructions, and output requirement instructions to be integrated into a target prompt instruction set. After obtaining the target prompt instruction set, the target prompt instruction set generation module inputs it into the large language model processing module so that the large language model processes the configuration file to be detected based on the target prompt instruction set.
[0065] In this application, the target prompt instruction set generation module can directly include the complete content of the received configuration file to be detected in the target prompt instruction set as the main context for large language model processing and analysis.
[0066] S130: Input the target prompt instruction set into the large language model, so that the large language model can detect the configuration file to be detected based on the role task instruction and the step-by-step constraint task instruction, and output a detection result file in a preset format based on the output requirement instruction. The detection result file indicates whether the configuration file to be detected has a configuration error.
[0067] The target-to-instruction set may include the configuration file to be detected, role-based task instructions, progressive constraint task instructions, and output requirement instructions. In this application, the large language model may employ models such as ChatGPT-4.0, Llama 3.1, Gemini 1.5Pro, and DeepSeek V3.
[0068] In this application, the large language model processing module can perform detection on the configuration file to be detected based on the received target prompt instruction set, the role task instruction, and the step-by-step constraint task instruction, and output the detection result file in a preset format based on the output requirement instruction.
[0069] In this embodiment, the large language model employs a zero-shot prompting method for error detection of the configuration file to be tested. This means that the large language model can directly perform the detection task on the configuration file based on its extensive knowledge and the detailed instructions and constraints provided in the target prompt instruction set, without requiring additional supervised fine-tuning or providing examples for this specific detection task. Furthermore, the large language model can perform comprehensive reasoning and analysis of the configuration file to be tested based on the progressive constraints in the prompts (including resource type constraints, configuration entry constraints, configuration entry value constraints, entry dependency constraints, and value dependency constraints), ensuring the comprehensiveness and accuracy of the detection, thereby improving the precision of error detection in the configuration file to be tested.
[0070] Based on this, an embodiment of this application also provides a cloud function configuration detection method based on a large language model. In this method, the target prompt instruction set generation module may include a step-by-step constraint task instruction generation unit. The above-mentioned step S120 "obtaining the target prompt instruction set based on the configuration file to be detected and the preset prompt template" can be specifically executed in the step-by-step constraint task instruction generation unit, including the following steps S210~S212:
[0071] Step S210: Based on the configuration file to be detected, determine multiple constraint tasks in the step-by-step constraint task instruction template. The constraint tasks include resource type constraints, configuration entry constraints, configuration entry value constraints, entry dependency constraints, and value dependency constraints.
[0072] The step-by-step constraint task instructions can include prompts corresponding to resource type constraints, configuration entry constraints, configuration entry value constraints, entry dependency constraints, and value dependency constraints. Resource type constraints can be constraints corresponding to resources within the configuration file to be tested; configuration entry constraints can be constraints corresponding to configuration entries within the configuration file to be tested; configuration entry value constraints can be constraints corresponding to the values of configuration entries within the configuration file to be tested; entry dependency constraints can be constraints on the dependencies of entries within the configuration file to be tested; and value dependency constraints can be constraints on the values of values within the configuration file to be tested.
[0073] In this application, the stepwise constraint task instruction generation unit can determine multiple constraint tasks based on the configuration file to be detected, including resource type constraints, configuration entry constraints, configuration entry value constraints, entry dependency constraints, and value dependency constraints. This enables the large language model to detect the resource type, configuration entry, configuration entry value, entry dependency, and value dependency in the configuration file to be detected based on these multiple constraint contents.
[0074] Step S211: Determine the constraint content of the multiple constraint tasks based on the configuration file to be detected, and determine the execution order of the multiple constraint tasks based on the configuration file to be detected.
[0075] In this application, the step-by-step constraint task instruction generation unit can determine the constraint content and corresponding execution order of multiple constraint tasks based on the configuration file to be detected.
[0076] In one alternative implementation, when multiple constraint tasks include resource type constraints, the constraint content of the resource type constraints may include determining whether the resource configured in the configuration file to be detected is a preset resource type.
[0077] The configuration file to be tested may include multiple resources; each resource has a corresponding resource type and resource name; each resource has multiple configuration entries; in this application, the resource type may include, but is not limited to, Serverless: Function, AWS::S3::Bucket, and PackageType. The default resource type can be a resource type officially supported by AWS SAM.
[0078] In this application, when multiple constraint tasks include resource type constraints, and when resource type constraints are set in the step-by-step constraint task instructions, the large language model can be guided to check whether the resource type corresponding to the resource in the configuration file to be tested is officially supported by AWS SAM, and it is also necessary to check the capitalization of the resource name (since AWS SAM is case-sensitive, incorrect capitalization of the resource name may lead to configuration errors). Furthermore, the corresponding prompt instruction can include a link to the official documentation for the large language model to refer to, thereby obtaining the prompt instruction corresponding to the resource type constraint.
[0079] For example, the prompt for resource type constraints could be: Please check whether the resource type in the current configuration file is officially supported by AWS SAM. Search the following URL to compare all the listed supported AWS resources, and note the capitalization of the letters.
[0080] In another alternative implementation, when multiple constraint tasks include configuration entry constraints, the constraint content of the configuration entry constraints may include determining whether the configuration entry of the configuration file to be detected is a configuration entry declared for the corresponding resource type, and determining whether the configuration entry is complete.
[0081] In this application, when multiple constraint tasks include configuration entry constraints, and when configuration entry constraints are set in the step-by-step constraint task instructions, the large language model can be guided to validate configuration entries under each resource type. Specifically, this can include checking whether an entry exists under its declared resource type, whether the entry name is accurate (including capitalization and singular / plural), the completeness of a specific entry (such as a sub-entry under Events), and whether the indentation in the YAML format is correct (incorrect indentation will cause configuration items to fail to be parsed correctly), thereby obtaining the corresponding prompt instructions for the configuration entry constraints. For specific entries, in addition to checking whether the specific entry exists under its declared resource type (such as Events) and whether the entry name is accurate, completeness also needs to be considered.
[0082] For example, the prompt instruction corresponding to the configuration entry constraint can be: Please perform the following step-by-step checks: Sub-step 1: Check whether each configuration entry under each resource type actually exists, and pay attention to the accuracy of each configuration entry name, including capitalization and singular / plural forms; Sub-step 2: If "Events" exists, you also need to further check whether there is a corresponding specific entry under each event source type, and please point out any incomplete specific entries; Sub-step 3: Check whether the hierarchy of all specific entries is correct, and pay attention to indentation issues.
[0083] In one alternative implementation, when multiple constraint tasks include configuration entry value constraints, the constraint content of the configuration entry value constraints may include determining whether the assignment corresponding to the configuration entry meets the preset assignment conditions.
[0084] In this application, when multiple constraint tasks include configuration entry value constraints, and when configuration entry value constraints are set in the step-by-step constraint task instructions, the large language model can be guided to check whether the assignment of each configuration entry meets the preset assignment conditions. The preset assignment conditions can specifically include whether the data type of the assigned value conforms to the specification, whether the assigned value belongs to a predefined valid set (such as an enumeration value), whether the representation of the assigned value is accurate, and whether the assigned value should not be null. As an example, taking the "Runtime" entry as an example, its reasonable value should be limited to a predefined set such as "python3.6" or "nodejs16x", rather than other arbitrarily written values; for the "Bucket" configuration entry, only references to other AWS objects or resources are supported during configuration, and its value representation should follow a specific format such as "!Ref" to ensure correct reference to related resources.
[0085] For example, the prompt instruction corresponding to the configuration entry value constraint can be: Please check whether the configuration entry value assignment meets the preset assignment conditions. The preset assignment conditions may specifically include whether the data type of the assignment conforms to the specification, whether the assignment belongs to a predefined valid set, whether the representation of the assignment is accurate, and whether the assignment should not be empty (null).
[0086] In another alternative implementation, when multiple constraint tasks include item dependency constraints, the constraint content of the item dependency constraints includes determining whether there is an item dependency relationship between configuration items and determining whether the item dependency relationship is executed normally.
[0087] In this application, when multiple constraint tasks include item dependency constraints, and when item dependency constraints are set in the step-by-step constraint task instructions, the large language model can be guided to check whether there are mutual dependencies between configuration items and verify whether these dependencies are satisfied and whether the task can be executed normally. For example, some configuration items may need to appear together with other items to take effect, or whether other resource types referenced are correctly defined.
[0088] For example, the prompt instruction corresponding to the item dependency constraint can be: Please check whether there are dependencies between configuration items, and verify whether their usage is correct, whether the referenced resource type is correct, and whether the relevant required reference definitions are provided, and further check which configuration items are required / not required under the PackageType.
[0089] In another alternative implementation, when the multiple constraint tasks include value dependency constraints, the constraint content of the value dependency constraints includes determining whether there is a value dependency relationship between the assignments corresponding to the configuration entries and determining whether the value dependency relationship is correct.
[0090] In this application, when multiple constraint tasks include value dependency constraints, and when value dependency constraints are set in the step-by-step constraint task instructions, the large language model can be guided to check whether there are dependencies (including implicit dependencies) between the assignments of different configuration items, and to verify the correctness of these dependencies. For example, the timeout value of a cloud function needs to be less than the timeout value of its event source (such as an API Gateway) (although function configuration detection mainly performs static checks, its constraint design concept can cover this type of logic).
[0091] For example, the prompt for a value dependency constraint could be: Please check whether there is a dependency relationship (possibly an implicit dependency) between the values of the configuration entries, and verify whether the usage is correct and whether the relevant necessary reference definitions are provided.
[0092] Step S212: Based on the constraint content and execution order of the multiple constraint tasks, determine the step-by-step constraint task instructions in the target prompt instruction set to obtain the target prompt instruction set.
[0093] In this embodiment, because YAML format configuration files possess unique domain-specific language characteristics, deeply nested object structures (involving many resource types and configuration entries, with nesting and dependency relationships between configuration entries), and complex dependencies spanning multiple resources (each configuration file involves multiple resource types and configuration entries, with entry dependencies or value dependencies between configuration entries), step-by-step constraint task instructions can be obtained by setting the execution order of constraint tasks corresponding to each of the resource type constraints, configuration entry constraints, configuration entry value constraints, entry dependency constraints, and value dependency constraints. By incorporating multi-dimensional constraints (covering multiple levels such as resource type, configuration entry, configuration entry value, entry dependency, and value dependency) and a thought chain guidance strategy when setting step-by-step constraint task instructions, it is possible to drive the large language model to systematically and step-by-step complete the error detection task of cloud function configuration files for server-insensitive applications without directly modifying the large language model or relying on training data of a specific format. Instead, by providing the large language model with a highly structured and domain-knowledge-enhanced set of target prompt instructions, the large language model can be driven to systematically and step-by-step complete the complex error detection task of cloud function configuration files for server-insensitive applications according to the instruction content. This allows for the effective utilization of the reasoning capabilities of large language models, while multi-dimensional constraints ensure the accuracy and coverage of detection. This addresses the shortcomings in handling complex server configurations without awareness and ensures the comprehensiveness and accuracy of detection, thereby improving the precision of error detection in the configuration files to be detected.
[0094] Based on this, one embodiment of this application also provides another cloud function configuration detection method based on a large language model. In this method, the target prompt instruction set generation module may include a role task instruction generation unit. The above-mentioned step S120, "obtaining the target prompt instruction set based on the configuration file to be detected and the preset prompt template," may specifically include the following steps S220~S221:
[0095] Step S220: Based on the configuration file to be detected, set the role instructions and target task instructions in the role task instruction template. The role instructions are used to determine the knowledge call of the large language model, and the target task instructions are used to determine the target task framework of the large language model.
[0096] In this application, by setting role task instructions, a large language model can be guided to guide its behavior and knowledge retrieval, and a clear task or problem can be used to specify the specific analysis task that the large language model needs to complete.
[0097] For example, the role instruction could be: You are an expert in writing cloud function configuration files for AWS SAM server-aware applications; the target task instruction could be: Please check the above configuration file for any configuration errors.
[0098] Step S221: Based on the configuration file to be detected, the role instructions in the role task instruction template, and the target task instructions, determine the role task instructions in the target prompt instruction set to obtain the target prompt instruction set.
[0099] In this embodiment, by setting role-based task instructions, the behavior and knowledge retrieval of the large language model can be precisely guided, enabling it to analyze and judge as an expert in a specific domain. Simultaneously, by setting clear target task instructions, the specific analytical tasks that the large language model needs to complete can be clearly indicated, thereby improving the model's response accuracy and task execution efficiency. Furthermore, by combining the configuration file to be detected with the role instructions and target task instructions in the preset role-based task instruction template, highly targeted and adaptable target prompt instruction sets of role-based task instructions can be generated. This ensures that the role-based task instructions contain guidance information, improving the accuracy and efficiency of the large language model when processing specific configuration files, enabling it to more effectively identify potential errors in the configuration files, and improving the accuracy of error detection in the configuration files.
[0100] For example, a role task instruction could be: You are an expert in writing cloud function configuration files for AWS SAM server-aware applications. Please check the above configuration file for any configuration errors.
[0101] Based on this, an embodiment of this application also provides another cloud function configuration detection method based on a large language model. In this method, the target prompt instruction set generation module may include an output requirement instruction generation unit. The above-mentioned step S120 "obtaining the target prompt instruction set based on the configuration file to be detected and the preset prompt template" may specifically include the following steps S230~S231:
[0102] Step S230: Based on the configuration file to be detected, set the content requirements and format requirements in the output requirement instruction template. The content requirements are to only filter constraint tasks that reach a preset threshold.
[0103] In this application, the content requirement is to filter only constraint tasks that reach a preset threshold. Specifically, it can instruct the large language model to only report absolutely certain errors (i.e., constraint tasks that reach the preset threshold) and classify them (e.g., resource type error, entry error, value error, entry dependency error, value dependency error); the format requirement is to require the large language model to include the detected error information in a specific start tag.<start>and end marker <end>This allows for automatic extraction later.
[0104] Step S231: Based on the configuration file to be detected, the content requirements and format requirements in the output requirement instruction template, determine the output requirement instructions in the target prompt instruction set to obtain the target prompt instruction set.
[0105] In this embodiment, by combining the specific content of the configuration file to be detected with the content and format requirements in the preset output requirement instruction template, highly targeted and adaptable output requirement instructions can be generated. The generated output requirement instructions provide detailed output specifications for the large language model and require it to output definite and interpretable error results in a structured manner, thereby improving the error detection quality of the configuration file.
[0106] For example, the output requirement instruction could be: Please summarize the absolutely certain configuration errors and categorize them as follows: resource type error, configuration entry error, configuration item value error, entry dependency error, value dependency error (if any); Response format (must be followed): Please write the detected errors in... <start>and <end>In the middle of the label.
[0107] As an example, such as Figure 3 As shown, the target prompt instruction set generation module in this application can specifically be:
[0108] In this application, after obtaining the configuration file to be tested, the target prompt instruction set generation module can directly use the complete content of the received configuration file as the main context for large language model processing and analysis, and include it in the target prompt instruction set. Then, based on the role task instruction generation unit in the target prompt instruction set generation module, the module can set the role instructions and target task instructions in the role task instruction template to obtain the role task instructions. Next, based on the step-by-step constraint task instruction generation unit in the target prompt instruction set generation module, the module can determine the constraint content and execution order of multiple constraint tasks (resource type constraints, configuration item constraints, configuration item value constraints, item dependency constraints, and value dependency constraints) in the step-by-step constraint task instruction template. Finally, based on the output requirement instruction generation unit in the target prompt instruction set generation module, the module can set the content requirements and format requirements in the output requirement instruction template to determine the output requirement instructions in the target prompt instruction set, thereby obtaining the target prompt instruction set.
[0109] Specifically, the target hint instruction set can be:
[0110] "You are an expert in writing cloud function configuration files for AWS SAM server-aware applications. Please check the above configuration file for any configuration errors. The attached file is the cloud function configuration file for server-aware applications. Please check for configuration errors in the following order:"
[0111] 1. [Resource Type Constraints] Please check that the resource types in the current configuration file are all supported by AWS SAM. Search the following URLs to compare all the listed supported AWS resources, and pay attention to capitalization.
[0112] 2. [Configuration Entry Constraints] Please check step by step according to the following steps: Sub-step 1: Check whether each configuration entry under each resource type actually exists, and pay attention to the accuracy of each configuration entry name, including capitalization and singular / plural forms; Sub-step 2: If "Events" exists, you also need to further check whether there is a corresponding specific entry under each event source type, and please point out any incomplete specific entries; Sub-step 3: Check whether the hierarchy of all specific entries is correct, and pay attention to indentation issues;
[0113] 3. [Configuration Entry Value Constraints] Please check whether the configuration entry value assignment meets the preset assignment conditions. The preset assignment conditions may specifically include whether the data type of the assignment conforms to the specification, whether the assignment belongs to a predefined valid set, whether the representation of the assignment is accurate, and whether the assignment should not be empty (null).
[0114] 4. [Item Dependency Constraints] Please check whether there are dependencies between configuration items, and verify whether their usage is correct, whether the referenced resource types are correct, and whether the relevant necessary reference definitions are provided. Further check which configuration items are required / not required under PackageType.
[0115] 5. [Value Dependency Constraints] Checks whether there are dependencies (possibly implicit dependencies) between the values of configuration entries, verifies that their usage is correct, and confirms that the necessary reference definitions are provided.
[0116] Based on this, an embodiment of this application also provides another cloud function configuration detection method based on a large language model. In this method, after step S130, "inputting the target prompt instruction set into the large language model, so that the large language model detects the configuration file to be detected based on the role task instruction and the stepwise constraint task instruction, and outputting a detection result file in a preset format based on the output requirement instruction", the following steps S310~S320 may also be included:
[0117] Step S310: Extract a detection description in a preset format from the detection result file based on regular expressions.
[0118] In this application, after the large language model generates the detection result file, the output module can output the data according to the preset format defined in the preset format. <start>and <end>The tag extracts structured error descriptions from the detection result file using techniques such as regular expressions.
[0119] Step S320: If the detection description includes error descriptions, classify the error descriptions in the preset format to obtain an error description list.
[0120] In this application, the output module can output a list of error descriptions containing all detected configuration errors and their detailed explanations. These errors are organized according to predefined categories (resource type error, configuration entry error, configuration entry value error, entry dependency error, value dependency error) to facilitate user understanding and repair.
[0121] Specifically, the list of error descriptions can be:
[0122] 1. [Resource Type] Passed;
[0123] 2. [Configuration Entry] Passed;
[0124] 3. [Configuration entry value] Error: The value assigned is null;
[0125] 4. [Entry Dependency Constraint] Error: Is the referenced resource type incorrect, etc.?
[0126] 5. [Value Dependency Constraint] Error: The dependency relationship is used incorrectly.
[0127] In this embodiment, a method for statically identifying and interpreting configuration errors in cloud function configuration files (especially those based on AWS SAM) of server-agnostic applications can be utilized as the core analysis engine. The target hint instruction set generation mechanism specifically includes: a. providing the large language model with explicit role and task instructions, including expert roles set for the large language model and specific configuration error detection instructions; b. integrating a set of multi-dimensional, structured constraints specifically designed for cloud function configuration files of server-agnostic applications (e.g., resource type constraints, configuration entry constraints, configuration entry value constraints, entry dependency constraints, value dependency constraints, etc.) into the target hint instruction set; c. applying a thought chain or similar step-by-step reasoning guidance strategy to enable the large language model to systematically analyze and judge according to the aforementioned multi-dimensional constraints; d. requiring the large language model to output its confirmed configuration errors in a structured and categorizable manner (e.g., distinguishing between resource type errors, configuration entry errors, configuration item value errors, entry dependency errors, value dependency errors, etc.) and providing explanations. This allows large language models to perform systematic and step-by-step analysis according to the target prompt instruction set, and requires them to output deterministic and interpretable error results in a structured manner. Consequently, it can significantly improve the accuracy, recall, and F1 score of error detection in cloud function configuration files for server-insensitive applications, while ensuring the comprehensiveness and accuracy of detection.
[0128] This embodiment provides a cloud function configuration detection method based on a large language model. It configures corresponding target prompt templates (including obtaining role task instructions based on the configuration file to be detected and the role task instruction template, obtaining step-by-step constraint task instructions based on the configuration file to be detected and the step-by-step constraint task instruction template, and obtaining output requirement task instructions based on the configuration file to be detected and the output requirement task instruction template) using an adaptive prompt generation mechanism based on the configuration file to be detected. Leveraging its powerful reasoning capabilities, the target prompt instruction set fully stimulates and guides the large language model to detect the configuration file. Furthermore, a multi-level constraint guidance strategy is employed to ensure the comprehensiveness and accuracy of the detection, thereby improving the precision of error detection in the configuration file to be detected.
[0129] To better understand the solutions of all embodiments of this application, the basic business process of a cloud function configuration detection method based on a large language model is introduced below.
[0130] Please see Figure 4 The input module can obtain the configuration file to be detected based on step S1 and transmit it to the target prompt instruction set generation module. Then, the target prompt instruction set generation module can determine the role task instruction, the step-by-step constraint task instruction (including the prompt instruction corresponding to each of the resource type constraint, configuration item constraint, configuration item value constraint, item dependency constraint, and value dependency constraint) and the output requirement instruction based on the configuration file to be detected based on step S2, so as to obtain the target prompt instruction set. The target prompt instruction set can be transmitted to the large language model processing module, so that the large language model processing module can detect the configuration file to be detected based on the role task instruction and the step-by-step constraint task instruction based on step S3, and output the detection result file in a preset format based on the output requirement instruction, so as to transmit it to the output module. The output module can extract the detection description in a preset format based on regular expressions based on step S4, classify the error description in the preset format, and obtain the error description list.
[0131] Please see Figure 5 This application provides a cloud function configuration detection system 600 based on a large language model, the system 600 comprising:
[0132] Input module 610 is used to obtain the configuration file to be detected, which is the configuration file of the cloud function running in the server-invisible application.
[0133] The target prompt instruction set generation module 620 is used to obtain a target prompt instruction set based on the configuration file to be detected and a preset prompt template. The preset prompt template includes a role task instruction template, a step-by-step constraint task instruction template, and an output requirement instruction template. The target prompt instruction set includes role task instructions, step-by-step constraint task instructions, and output requirement instructions.
[0134] The large language model processing module 630 is used to input the target prompt instruction set into the large language model, so that the large language model can detect the configuration file to be detected based on the role task instruction and the step constraint task instruction, and output a detection result file in a preset format based on the output requirement instruction. The detection result file indicates whether the configuration file to be detected has a configuration error.
[0135] The output module 640 is used to extract a preset format of detection description from the detection result file based on regular expressions; when the detection description includes error descriptions, the preset format error descriptions are classified to obtain an error description list.
[0136] The target prompt instruction set generation module 620 further includes:
[0137] The role task instruction generation unit 6211 is used to set role instructions and target task instructions in the role task instruction template based on the configuration file to be detected. The role instructions are used to determine the knowledge call of the large language model, and the target task instructions are used to determine the target task framework of the large language model. Based on the configuration file to be detected, the role instructions in the role task instruction template, and the target task instructions, the unit determines the role task instructions in the target prompt instruction set to obtain the target prompt instruction set.
[0138] The step-by-step constraint task instruction generation unit 6212 is used to determine any number of constraint tasks in the step-by-step constraint task instruction template based on the configuration file to be detected. The constraint tasks include resource type constraints, configuration entry constraints, configuration entry value constraints, entry dependency constraints, and value dependency constraints. Based on the configuration file to be detected, the unit determines the constraint content of the multiple constraint tasks and the execution order of the multiple constraint tasks. Based on the constraint content and execution order of the multiple constraint tasks, the unit determines the step-by-step constraint task instructions in the target prompt instruction set to obtain the target prompt instruction set.
[0139] The output requirement instruction generation unit 6213 is used to set the content requirements and format requirements in the output requirement instruction template based on the configuration file to be detected, wherein the content requirements are to only filter constraint tasks that reach the error threshold; and to determine the output requirement instructions in the target prompt instruction set based on the configuration file to be detected, the content requirements and format requirements in the output requirement instruction template, so as to obtain the target prompt instruction set.
[0140] As one approach, the stepwise constraint task instruction generation unit 6212 is specifically configured to, when the multiple constraint tasks include resource type constraints, include determining whether the resource configured in the configuration file to be tested is a preset resource type; when the multiple constraint tasks include configuration entry constraints, include determining whether the configuration entry in the configuration file to be tested is a configuration entry declared for the corresponding resource type and determining whether the configuration entry is complete; when the multiple constraint tasks include configuration entry value constraints, include determining whether the assignment corresponding to the configuration entry meets a preset assignment condition; when the multiple constraint tasks include entry dependency constraints, include determining whether there is an entry dependency relationship between the configuration entries and determining whether the entry dependency relationship is executed normally; when the multiple constraint tasks include value dependency constraints, include determining whether there is a value dependency relationship between the assignments corresponding to the configuration entries and determining whether the value dependency relationship is correct.
[0141] The following will combine Figure 6 This application describes an electronic device.
[0142] Please see Figure 6 Based on the aforementioned cloud function configuration detection method and apparatus based on a large language model, this application also provides another electronic device 100 capable of executing the aforementioned cloud function configuration detection method based on a large language model. The electronic device 100 includes a processor 102, a memory 104, and a communication module 106. The memory 104 stores a program capable of executing the contents of the aforementioned embodiments, and the processor 102 can execute the program stored in the memory 104.
[0143] The processor 102 may include one or more processing cores. The processor 102 connects to various parts within the electronic device 100 using various interfaces and lines, and performs various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets, or instruction sets stored in the memory 104, and by calling data stored in the memory 104. Optionally, the processor 102 may be implemented using at least one of the following hardware forms: a Neural Network Processing Unit (NPU), a Digital Signal Processing Unit (DSP), a Field-Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA). The processor 102 may integrate one or more of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a Neural Network Processing Unit (NPU), and a modem. Specifically, the CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; the NPU handles multimedia data such as video and images; and the modem handles wireless communication. It is understandable that the aforementioned modem may not be integrated into the processor 102, but may be implemented using a separate communication chip.
[0144] The memory 104 may include random access memory (RAM), read-only memory (ROM), and double data rate synchronous dynamic random access memory (DDR). The memory 104 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 104 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described below. The data storage area may also store data created by the electronic device 100 during use (such as phonebook data, audio and video data, chat log data, etc.).
[0145] The communication module 106 can be used to realize information interaction between the electronic device 100 and other devices, such as transmitting device control commands, manipulation request commands, and status information acquisition commands. When the other devices are different devices, their corresponding communication modules 106 may be different.
[0146] This application provides a computer-readable storage medium. The computer-readable storage medium stores program code that can be called by a processor to execute the methods described in the above method embodiments.
[0147] Computer-readable storage media can be electronic storage devices such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, computer-readable storage media include non-transitory computer-readable storage media. The computer-readable storage medium has storage space for program code that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code can be compressed, for example, in a suitable form.
[0148] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0149] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0150] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0151] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.
[0152] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only 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 terminal device 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 terminal device. 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 terminal device that includes said element.
[0153] The above provides a detailed description of the cloud function configuration detection method, apparatus, and electronic device based on a large language model provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.< / end> < / start> < / end> < / start> < / end> < / start>
Claims
1. A method for detecting cloud function configuration based on a large language model, characterized in that, The method comprises: obtaining a to-be-detected configuration file, the to-be-detected configuration file being a configuration file for running a cloud function in a server-unaware application; obtaining a target prompt instruction set based on the to-be-detected configuration file and a preset prompt template, the preset prompt template comprising a role task instruction template, a step-by-step constraint task instruction template, and an output requirement instruction template, and the target prompt instruction set comprising a role task instruction, a step-by-step constraint task instruction, and an output requirement instruction; inputting the target prompt instruction set into a large language model, so that the large language model detects the to-be-detected configuration file based on the role task instruction and the step-by-step constraint task instruction, and outputs a detection result file in a preset format based on the output requirement instruction, the detection result file representing whether the to-be-detected configuration file has a configuration error; the obtaining of the target prompt instruction set based on the to-be-detected configuration file and the preset prompt template comprises: determining, based on the to-be-detected configuration file, a plurality of constraint tasks in the step-by-step constraint task instruction template, the constraint tasks comprising resource type constraints, configuration item constraints, configuration item value constraints, item dependency constraints, and value dependency constraints; determining constraint contents of the plurality of constraint tasks based on the to-be-detected configuration file, and determining an execution order of the plurality of constraint tasks based on the to-be-detected configuration file; determining a step-by-step constraint task instruction in the target prompt instruction set based on the constraint contents and the execution order of the plurality of constraint tasks, so as to obtain the target prompt instruction set; setting a role instruction in the role task instruction template and a target task instruction based on the to-be-detected configuration file, the role instruction being used to determine knowledge calling of the large language model, and the target task instruction being used to determine a target task framework of the large language model; determining a role task instruction in the target prompt instruction set based on the to-be-detected configuration file, the role instruction in the role task instruction template, and the target task instruction, so as to obtain the target prompt instruction set; setting a content requirement and a format requirement in the output requirement instruction template based on the to-be-detected configuration file, the content requirement being a requirement of screening only constraint tasks that meet a preset threshold; determining an output requirement instruction in the target prompt instruction set based on the to-be-detected configuration file, the content requirement in the output requirement instruction template, and the format requirement, so as to obtain the target prompt instruction set.
2. The method of claim 1, wherein, the determining of the constraint contents of the plurality of constraint tasks based on the to-be-detected configuration file comprises: in a case where the plurality of constraint tasks comprise resource type constraints, the constraint contents of the resource type constraints comprise determining whether resources configured in the to-be-detected configuration file are preset resource types; in a case where the plurality of constraint tasks comprise configuration item constraints, the constraint contents of the configuration item constraints comprise determining whether configuration items of the to-be-detected configuration file are configuration items declared for corresponding resource types, and determining whether the configuration items are complete; in a case where the plurality of constraint tasks comprise configuration item value constraints, the constraint contents of the configuration item value constraints comprise determining whether assignment corresponding to the configuration items meets a preset assignment condition. In a case where the multiple constraint tasks include an entry dependency constraint, constraint content of the entry dependency constraint includes determining whether there is an entry dependency relationship between the configuration entries, and determining whether the entry dependency relationship is normally executed; In a case where the multiple constraint tasks include a value dependency constraint, constraint content of the value dependency constraint includes determining whether there is a value dependency relationship between assignments corresponding to the configuration entries, and determining whether the value dependency relationship is correct.
3. The method of claim 1, wherein, After outputting the detection result file in the preset format based on the output requirement instruction, the method further includes: extracting a detection description in a preset format from the detection result file based on a regular expression; in a case where the detection description includes an error description, classifying the error description in the preset format to obtain an error description list. 4.A cloud function configuration detection system based on a large language model, characterized in that, The system includes: an input module configured to obtain a to-be-detected configuration file, the to-be-detected configuration file being a configuration file for running a cloud function in a server without awareness of an application; a target prompt instruction set generation module configured to obtain a target prompt instruction set based on the to-be-detected configuration file and a preset prompt template, the preset prompt template including a role task instruction template, a step-by-step constraint task instruction template, and an output requirement instruction template, and the target prompt instruction set including a role task instruction, a step-by-step constraint task instruction, and an output requirement instruction; a large language model processing module configured to input the target prompt instruction set into a large language model, cause the large language model to detect the to-be-detected configuration file based on the role task instruction and the step-by-step constraint task instruction, and output a detection result file in a preset format based on the output requirement instruction, the detection result file representing whether a configuration error occurs in the to-be-detected configuration file; an output module configured to extract a detection description in a preset format from the detection result file based on a regular expression, and in a case where the detection description includes an error description, classify the error description in the preset format to obtain an error description list; The target prompt instruction set generation module is specifically configured to: determine, based on the to-be-detected configuration file, multiple constraint tasks in the step-by-step constraint task instruction template, the constraint tasks including resource type constraints, configuration entry constraints, configuration entry value constraints, entry dependency constraints, and value dependency constraints; determine constraint content of the multiple constraint tasks based on the to-be-detected configuration file, and determine an execution order of the multiple constraint tasks based on the to-be-detected configuration file; determine, based on the constraint content and the execution order of the multiple constraint tasks, a step-by-step constraint task instruction in the target prompt instruction set, to obtain the target prompt instruction set; based on the to-be-detected configuration file, set a role instruction in the role task instruction template and a target task instruction, the role instruction being used to determine knowledge calling of the large language model, and the target task instruction being used to determine a target task framework of the large language model; based on the to-be-detected configuration file, the role instruction in the role task instruction template, and the target task instruction, determine a role task instruction in the target prompt instruction set, to obtain the target prompt instruction set; The content requirement and the format requirement in the output requirement instruction template are set based on the to-be-detected configuration file, the content requirement is a constraint task that only filters tasks reaching a preset threshold; An output requirement instruction in the target prompt instruction set is determined based on the to-be-detected configuration file, the content requirement and the format requirement in the output requirement instruction template, so as to obtain the target prompt instruction set.
5. The system of claim 4, wherein, The target prompt instruction set generation module further includes: A role task instruction generation unit is configured to set a role instruction and a target task instruction in a role task instruction template based on the to-be-detected configuration file, the role instruction is used to determine knowledge calling of a large language model, and the target task instruction is used to determine a target task framework of the large language model; a role task instruction in the target prompt instruction set is determined based on the to-be-detected configuration file, the role instruction and the target task instruction in the role task instruction template, so as to obtain the target prompt instruction set; A step-by-step constraint task instruction generation unit is configured to determine any multiple constraint tasks in a step-by-step constraint task instruction template based on the to-be-detected configuration file, the constraint tasks including resource type constraint, configuration entry constraint, configuration entry value constraint, entry dependency constraint and value dependency constraint; constraint content of the multiple constraint tasks is determined based on the to-be-detected configuration file, an execution order of the multiple constraint tasks is determined based on the to-be-detected configuration file; a step-by-step constraint task instruction in the target prompt instruction set is determined based on the constraint content and the execution order of the multiple constraint tasks, so as to obtain the target prompt instruction set; An output requirement instruction generation unit is configured to set a content requirement and a format requirement in the output requirement instruction template based on the to-be-detected configuration file, the content requirement being a constraint task that only filters tasks reaching an error threshold; an output requirement instruction in the target prompt instruction set is determined based on the to-be-detected configuration file, the content requirement and the format requirement in the output requirement instruction template, so as to obtain the target prompt instruction set.
6. An electronic device, comprising: one or more processors and memory; one or more programs stored in the memory and configured to be executed by the one or more processors, the one or more programs being configured to perform the method of any one of claims 1-3.
7. A computer readable storage medium characterized in that, The computer readable storage medium stores program code, wherein the program code performs the method of any one of claims 1-3 when running.
Citation Information
Patent Citations
Interactive task knowledge base construction method and device based on large language model
CN119513228A
Task processing method and device
CN119647487A