Prompt word template release access method and device, equipment and medium
Patent Information
- Application Number
- CN202611162624.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-03
- Publication Date
- 2026-09-01
AI Technical Summary
[0003]鉴于以上内容,有必要提供一种提示词模板发布门禁方法、装置、设备及介质,旨在解决提示词模板缺乏统一维护,且缺乏发布前的质量控制的问题
[0008] As can be seen from the above technical solutions, this invention can perform structured parsing of target prompt word templates to extract target constraint contracts, transforming the quality specifications in the templates into deterministic objects that can be verified item by item by the machine, facilitating the unified maintenance of prompt word templates; it performs placeholder declaration integrity verification, logical verification between output format and examples, constraint satisfiability verification, and template lexical design compliance verification to achieve quality control before release; and it generates release decisions based on structured verification results according to hierarchical processing rules, preventing templates that fail verification from entering the callable released state, thereby establishing a quality gate before release.
Smart Images

Figure CN122673333A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, apparatus, equipment and medium for issuing prompt word templates for access control. Background Technology
[0002] Currently, to better provide services and target large-scale enterprise gateways for large-scale models, enterprises are deploying large-scale language model applications, making prompt templates a core production asset driving model behavior. However, the management of prompt templates by enterprises is generally out of control, mainly due to the following systemic problems: (i) Scattered templates and lack of a unified and managed library. Prompt templates are usually hard-coded as strings in application code, scattered in various configuration files or scattered in operational documents, without a unified and managed template library; templates for the same business function may have multiple inconsistent copies, making it difficult to maintain and audit them in a unified manner. (ii) Changes are not traceable. Template modifications often directly overwrite the original content, lack standardized version records, make it difficult to trace historical versions, identify the reasons for changes and the person making the changes, and make rollbacks difficult. This is in stark contrast to the version governance practices that enterprises have long been accustomed to using source code. (iii) Lack of pre-deployment quality gates. Enterprises have generally established static checks, continuous integration and quality gates for source code before submission, but there is almost no pre-deployment quality control for Prompt templates, resulting in defective templates being directly released to the production environment; (iv) Delayed exposure and difficulty in locating defects. Due to the lack of pre-launch verification, template defects are often exposed to downstream businesses in the form of abnormal model output after launch. At this time, tracing the root cause (whether it is a template defect, a problem with the data being called, or a problem with the model) is costly. Enterprises are often forced to replace quality control that could have been completed at low cost before release with expensive post-launch troubleshooting. Summary of the Invention
[0003] In view of the above, it is necessary to provide a method, device, equipment and medium for publishing prompt word templates for access control, in order to solve the problems of lack of unified maintenance of prompt word templates and lack of quality control before publication.
[0004] A method for publishing access control information using prompt word templates, the method comprising: In response to an access control command on a target prompt word template, the target prompt word template is structured and parsed to extract the target constraint contract; Read the placeholder declaration set from the target constraint contract, and perform a placeholder declaration integrity check based on the placeholder declaration set to obtain a first check result; The output format declaration and example set are read from the target constraint contract, and the logical verification between the output format and the example is performed according to the output format declaration and example set to obtain the second verification result; Read the constraint set from the target constraint contract, and perform constraint satisfiability verification based on the constraint set to obtain the third verification result; Read the lexical design parameters from the target constraint contract, and perform template lexical design compliance verification based on the lexical design parameters to obtain the fourth verification result; The first verification result, the second verification result, the third verification result, and the fourth verification result are subjected to structured fusion processing to obtain a structured verification result; The decision to release the structured verification results is generated according to the hierarchical processing rules.
[0005] A prompt word template publishing access control device, the prompt word template publishing access control device comprising: The parsing unit is used to perform structured parsing of the target prompt word template in response to an access control command for the target prompt word template in order to extract the target constraint contract; The verification unit is used to read the placeholder declaration set from the target constraint contract, and perform a placeholder declaration integrity verification based on the placeholder declaration set to obtain a first verification result; The verification unit is further configured to read the output format declaration and example set from the target constraint contract, and perform logical verification between the output format and the example according to the output format declaration and example set to obtain a second verification result; The verification unit is further configured to read the constraint set from the target constraint contract, and perform constraint satisfiability verification based on the constraint set to obtain a third verification result; The verification unit is further configured to read lexical design parameters from the target constraint contract and perform template lexical design compliance verification according to the lexical design parameters to obtain a fourth verification result; The structured unit is used to perform structured fusion processing on the first verification result, the second verification result, the third verification result, and the fourth verification result to obtain a structured verification result; The generation unit is used to generate a decision on the release of the structured verification results according to the hierarchical processing rules.
[0006] A computer device, the computer device comprising: A memory that stores at least one instruction; and a processor that executes the instructions stored in the memory to implement the access control method for issuing the prompt word template.
[0007] A computer-readable storage medium storing at least one instruction, which is executed by a processor in a computer device to implement the prompt word template access control method.
[0008] As can be seen from the above technical solutions, this invention can perform structured parsing of target prompt word templates to extract target constraint contracts, transforming the quality specifications in the templates into deterministic objects that can be verified item by item by the machine, facilitating the unified maintenance of prompt word templates; it performs placeholder declaration integrity verification, logical verification between output format and examples, constraint satisfiability verification, and template lexical design compliance verification to achieve quality control before release; and it generates release decisions based on structured verification results according to hierarchical processing rules, preventing templates that fail verification from entering the callable released state, thereby establishing a quality gate before release. Attached Figure Description
[0009] Figure 1 This is a flowchart of a preferred embodiment of the access control method for issuing prompt word templates according to the present invention; Figure 2 This is a functional block diagram of a preferred embodiment of the access control device for issuing prompt word templates according to the present invention; Figure 3 This is a schematic diagram of the structure of a computer device that implements the access control method for publishing prompt word templates according to the present invention. Detailed Implementation
[0010] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0011] like Figure 1 The diagram shown is a flowchart of a preferred embodiment of the access control method for issuing prompt word templates according to the present invention. The order of the steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements.
[0012] The access control method for issuing prompt word templates is applied to one or more computer devices. The computer device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0013] The computer device can be any electronic product that can interact with the user, such as a personal computer, tablet computer, smartphone, personal digital assistant (PDA), interactive network television (IPTV), smart wearable device, etc.
[0014] The computer equipment may also include network equipment and / or user equipment. The network equipment includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of hosts or network servers.
[0015] The server can be a standalone server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0016] Artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0017] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0018] The network in which the computer device is located includes, but is not limited to, the Internet, wide area network, metropolitan area network, local area network, and virtual private network (VPN).
[0019] S10, in response to the access control command on the target prompt template (Prompt template), the target prompt template is structured and parsed to extract the target constraint contract.
[0020] In this embodiment, the access control command can be triggered by relevant staff based on actual publishing needs. For example, when the creation or modification of the target prompt word template is detected, the access control command is determined to be triggered.
[0021] In this embodiment, the step of performing structured parsing of the target prompt word template to extract the target constraint contract includes: The segment structure of the target prompt word template is analyzed to obtain the analysis results; Identify the structural elements of each segment based on the analysis results; The target constraint contract is constructed based on the structuring elements.
[0022] The segment structure may include, but is not limited to: System commands, User commands, dialogue history placeholders, few-shot example areas, etc.
[0023] The target constraint contract may include a set of placeholder declarations, a set of output format declarations and examples, a set of constraints, and lexical design parameters, specifically: (1) Placeholder declaration set: Scan the variable placeholders (such as {user_input}, {context}) in the target prompt word template to form a set of declared placeholders and their reference relationships in the instructions; (2) Output format declaration and example set: Identify the output format declarations (such as JSON (JavaScript Object Notation), XML (eXtensible Markup Language), tables, plain text) and their structural definitions in the target prompt word template, and extract the actual output format of the few-shot examples; (3) Constraint set: Identify various constraint declarations in the target prompt word template, including length constraints (such as the number of characters, the maximum number of entries), format constraints, content constraints, and the dependencies between the constraints; (4) Lexical design parameters: Calculate the baseline number of lexical units in the target prompt word template itself (excluding dynamic filling), and extract the upper limit of the lexical budget declared in the template and the target model context window parameters.
[0024] The above extraction results are transformed into structured constraint contract objects to obtain the target constraint contract.
[0025] Among them, the constraint contract is a structured quality specification for the prompt word template, which is stored and versioned separately from the prompt word template text.
[0026] In the above embodiments, through structured constraint contracts and versioned contract storage, the Prompt template is transformed from a scattered and untraceable string into a first-class production asset with quality specifications, verifiability, traceability, and accessibility. This bridges the gap between the Prompt template and the maturity of source code governance, enabling the quality specifications implicit in the template, such as placeholder declarations, output format declarations, constraints, and lexical designs, to become deterministic objects that can be verified item by item by the machine.
[0027] S11, read the placeholder declaration set from the target constraint contract, and perform a placeholder declaration integrity check based on the placeholder declaration set to obtain a first check result.
[0028] In this embodiment, the step of performing a placeholder declaration integrity check based on the placeholder declaration set to obtain a first check result includes: Obtain each instruction in the target prompt word template and check whether the placeholder referenced in each instruction exists in the placeholder declaration set to obtain the declaration-reference consistency sub-verification result; Based on the reference relationships stored in the placeholder declaration set, it is detected whether each placeholder in the placeholder declaration set has been referenced in the target prompt word template, and the dangling declaration sub-verification result is obtained; Extract the text from the target prompt word template, and detect whether there are residual non-compliant placeholder structures in the text according to the placeholder structure in the placeholder declaration set, and obtain the residual non-compliant placeholder structure sub-verification result; For each instruction, when the behavior of the instruction depends on the content of any placeholder in the target prompt word template, check whether the arbitrary placeholder has been declared to obtain the placeholder-instruction dependency consistency sub-verification result; The first verification result is generated based on the declaration-reference consistency sub-verification result, the dangling declaration sub-verification result, the residual non-compliant placeholder structure sub-verification result, and the placeholder-instruction dependency consistency sub-verification result.
[0029] In this context, each placeholder referenced by each instruction in the prompt template must exist in the placeholder declaration set. Therefore, if all placeholders referenced by each instruction exist in the placeholder declaration set, it indicates that there is no "reference to an undeclared placeholder," and the declaration-reference consistency sub-verification result is determined to be a pass. Conversely, if a placeholder referenced by an instruction does not exist in the placeholder declaration set, it indicates that there is a "reference to an undeclared placeholder," and the declaration-reference consistency sub-verification result is determined to be a fail.
[0030] The placeholders declared should be actually referenced in the template. Therefore, when it is detected that each placeholder in the placeholder declaration set has been referenced in the target prompt word template, it indicates that there are no dangling declarations that are never referenced, and the dangling declaration sub-validation result is determined to be valid. When it is detected that there are placeholders in the placeholder declaration set that are not referenced in the target prompt word template, it indicates that there are dangling declarations that are never referenced, and the dangling declaration sub-validation result is determined to be invalid.
[0031] This involves detecting non-compliant structures in the static text of the template that might be mistakenly parsed as placeholders. Therefore, if no residual non-compliant placeholder structures exist in the text, the sub-validation result for the residual non-compliant placeholder structure is determined to be valid; if residual non-compliant placeholder structures exist in the text, the sub-validation result for the residual non-compliant placeholder structure is determined to be invalid.
[0032] For example, the residual non-compliant placeholder structure could be a curly brace fragment that might be mistaken for a placeholder but does not belong to the compliant placeholder declaration set. The core detection method is: first, remove compliant placeholders, and then check the remaining text by combining curly brace pairing scanning with a comparison with valid grammar to detect non-compliant residues. Specifically, this includes the following steps: Step 1: Define the compliance placeholder grammar. A compliance placeholder is in the form of {variable_name}, where the variable name is a compliance identifier (e.g., letters, numbers, underscores, periods, not empty, no spaces), i.e., \{[a-zA-Z_][a-zA-Z0-9_.]*\}. This is the sole criterion for determining compliance and is also the grammar used when extracting the placeholder declaration set; Step 2: Remove compliant placeholders and escape sequences. Mark all placeholders in the template text that conform to the above compliant grammar (i.e., the identified declarations in the placeholder declaration set) and remove them from the template text. Simultaneously, identify and remove escape sequences defined in the template specification (such as literal curly braces represented by "{{" or "\{", i.e., curly braces that need to be output as is) to prevent false alarms. What remains after removal is pure static text and possible non-compliant remnants; Step 3: Perform a curly brace pairing scan in the remaining text to detect residual structures. Specifically, scan the remaining text character by character for the curly brace pairing status. If any of the following conditions are met, it is determined to be a residual non-compliant placeholder structure, and its position and non-compliance type in the target prompt word template are recorded: 1) Unclosed or redundant delimiters: The presence of "{" without a matching "}", such as "{user_input"; or the presence of redundant "}", such as "user_input}. In these cases, the delimiters are not matched. 2) Empty placeholder: Matched successfully but the inside is empty or only blank, such as "{}" or "{}"; 3) Non-compliant variable names: Matched successfully but the internal identifiers do not conform to the compliant identifier grammar, such as containing spaces (e.g., "{username}"), containing non-compliant symbols, or starting with a number, etc. 4) Nested delimiters: A pair of "{}" containing another "{", such as "{ {x}}"; 5) Residual delimiters (optional): If placeholder styles that are not part of this system appear in the remaining text (such as “{{x}}”, “${x}”, “%(x)s”), it indicates that the remnants are suspected of being remnants of the wrong delimiter system and have not been treated as compliant placeholders.
[0033] Since compliant placeholders have been removed in the second step, any remaining curly braces or suspected non-compliant placeholders in the remaining text must fall under one of the aforementioned non-compliant situations.
[0034] Step 4: Output the detection results. For each residual non-compliant placeholder structure detected, record its location, original text fragment, non-compliance type (such as unclosed, redundant closure, empty placeholder, non-compliant variable name, nesting, heterogeneous residue, etc.), and include it in the breach of the target constraint contract.
[0035] Specifically, if the behavior of a command depends on the content of a placeholder (e.g., "adjust tone according to {role}"), then the corresponding placeholder must be declared. Therefore, when the behavior of a command depends on the content of any placeholder in the target prompt template, if that placeholder has been declared, the placeholder-command dependency consistency sub-verification result is determined to be a pass; if that placeholder has not been declared, the placeholder-command dependency consistency sub-verification result is determined to be a fail.
[0036] If any one of the following sub-verification results fails the verification: the declaration-reference consistency sub-verification result, the dangling declaration sub-verification result, the residual non-compliant placeholder structure sub-verification result, or the placeholder-instruction dependency consistency sub-verification result, it is recorded as a placeholder contract breach.
[0037] Through the above embodiments, the integrity of placeholder declarations in constraint contracts can be deterministically verified to detect defects such as inconsistencies between placeholder declarations and usage, undeclared placeholder residues, and inconsistencies between placeholders and instruction dependencies.
[0038] S12, read the output format declaration and example set from the target constraint contract, and perform logical verification between the output format and the examples according to the output format declaration and example set to obtain the second verification result.
[0039] In this embodiment, the step of performing logical verification between the output format and the examples based on the output format declaration and the example set to obtain the second verification result includes: The complete structure definition of the output format declaration is checked against the declared output structure format in the example set to obtain the format declaration integrity sub-verification result; The output format declaration is checked against the example set to determine if there are any contradictory output format declarations, and the format declaration logic sub-verification result is obtained. The actual output format of the output format declaration and the examples in the example set are consistent with the declared output structure format, and the example-declaration consistency sub-verification result is obtained. The second verification result is generated based on the format declaration integrity sub-verification result, the format declaration logic sub-verification result, and the example-declaration consistency sub-verification result.
[0040] Specifically, if the template declares an output structured format (such as JSON), its structure definition (such as fields and types) should be complete, and there should be no situation where "JSON is declared but no structure is given". Therefore, if the output format declaration and the output structured formats declared in the example set have complete structure definitions, the format declaration integrity sub-validation result is determined to be valid; if the output format declaration and the output structured formats declared in the example set do not have complete structure definitions, the format declaration integrity sub-validation result is determined to be invalid.
[0041] The prompt template should not contain contradictory format declarations (e.g., one requiring plain text while another requires JSON). Therefore, if the output format declaration does not contradict the example set, the format declaration logic sub-validation result is determined to be valid; if the output format declaration contradicts the example set, the format declaration logic sub-validation result is determined to be invalid.
[0042] Specifically, the actual output format of the few-shot example must be consistent with the output format declared in the template to detect inconsistencies such as "the example is JSON but the instruction requires plain text". Therefore, if the actual output format of the examples in the example set is consistent with the declared output structured format, the example-declaration consistency sub-validation result is determined to be valid; if the actual output format of the examples in the example set is inconsistent with the declared output structured format, the example-declaration consistency sub-validation result is determined to be invalid.
[0043] If any one of the following sub-verification results fails the verification: the format declaration integrity sub-verification result, the format declaration logic sub-verification result, or the example-declaration consistency sub-verification result, it is recorded as a format contract breach.
[0044] Through the above embodiments, the logic between the output format declaration and the few-shot examples can be verified to detect defects such as missing format declarations, self-contradictions, or example formats that violate the declared format.
[0045] S13, read the constraint set from the target constraint contract, and perform constraint satisfiability verification based on the constraint set to obtain the third verification result.
[0046] In this embodiment, the step of performing constraint satisfiability verification based on the constraint set to obtain a third verification result includes: Detect whether there are logical conflicts among the constraints in the constraint set, and obtain the logical conflict sub-verification result between constraints; The length constraint and format constraint in the constraint set are checked to see if they are physically incompatible, and the length-format satisfiability check result is obtained. The constraint-placeholder dependency consistency sub-verification result is obtained by checking whether the placeholders referenced by each constraint in the constraint set have been declared. The third verification result is generated based on the logical conflict sub-verification result between constraints, the length-format satisfiability sub-verification result, and the constraint-placeholder dependency consistency sub-verification result.
[0047] This process requires detecting logical conflicts that can be formally determined (e.g., the coexistence of "answer with only one word" and "detailed explanation," or the coexistence of "must include a certain element" and "prohibition of mentioning the element"). Therefore, if there are no logical conflicts between constraints, the result of the logical conflict sub-verification between constraints is determined to be a pass; if there are logical conflicts between constraints, the result of the logical conflict sub-verification between constraints is determined to be a fail.
[0048] This involves detecting whether length constraints and format constraints are physically incompatible (e.g., "limited to 50 characters" and "output JSON containing 5 fields" cannot both be met simultaneously). Therefore, if length constraints and format constraints are physically compatible, the length-format compatibility check result is determined to be a pass; if they are physically incompatible, the length-format compatibility check result is determined to be a fail.
[0049] Placeholders referenced by constraints must be declared. Therefore, if all placeholders referenced by constraints in the constraint set have been declared, the constraint-placeholder dependency consistency sub-validation result is determined to be a pass; if not all placeholders referenced by constraints in the constraint set have been declared, the constraint-placeholder dependency consistency sub-validation result is determined to be a fail.
[0050] If any one of the following sub-verification results fails the verification: the logical conflict between constraints, the length-format satisfiability sub-verification result, or the constraint-placeholder dependency consistency sub-verification result, it is recorded as a constraint contract breach.
[0051] Through the above embodiments, the satisfiability of multiple constraints within a template can be verified to detect defects such as logical conflicts and physical incompatibility between length constraints and format constraints.
[0052] S14, read the lexical design parameters from the target constraint contract, and perform template lexical design compliance verification according to the lexical design parameters to obtain the fourth verification result.
[0053] In this embodiment, the step of performing template lexical design compliance verification based on the lexical design parameters to obtain the fourth verification result includes: The target model's word segmenter is used to calculate the baseline number of lexical units in the target prompt word template, and a baseline threshold is obtained from the lexical unit design parameters. The baseline number of lexical units is then checked to see if it is greater than the baseline threshold, and the baseline lexical unit threshold sub-verification result is obtained. Obtain the maximum total word element capacity of the target model context window, the minimum reserved margin for dynamic filling content, and the word element budget limit from the word element design parameters. Detect whether the word element budget limit is less than the maximum total word element capacity, and whether the difference between the maximum total word element capacity and the word element budget limit is greater than or equal to the minimum reserved margin for dynamic filling content, and obtain the budget limit rationality sub-verification result. Detect whether there is lexical redundancy in the target prompt word template, and obtain the redundancy sub-check result; The fourth verification result is generated based on the baseline lexical threshold sub-verification result, the budget upper limit reasonableness sub-verification result, and the redundancy sub-verification result.
[0054] Specifically, the word segmenter of the target model (i.e., the large language model on which the target prompt word template operates) calculates the baseline number of lexical units in the target prompt word template itself (excluding dynamic padding) and verifies whether it exceeds the baseline threshold configured for this scenario. Specifically, if the baseline number of lexical units is less than or equal to the baseline threshold, the baseline lexical unit threshold sub-verification result is determined to be a pass; if the baseline number of lexical units is greater than or equal to the baseline threshold, the baseline lexical unit threshold sub-verification result is determined to be a fail.
[0055] The method for verifying the reasonableness of the term budget limit declared in the template is as follows: it should not exceed the target model context window, and a minimum reserved margin should be provided for dynamically filled content (such as user input, search content, and dialogue history). Therefore, if the term budget limit is less than the maximum total term capacity, and the difference between the maximum total term capacity and the term budget limit is greater than or equal to the minimum reserved margin for dynamically filled content, then the reasonableness sub-verification result of the budget limit is determined to be passed; if the term budget limit is greater than or equal to the maximum total term capacity, or the difference between the maximum total term capacity and the term budget limit is less than the minimum reserved margin for dynamically filled content, then the reasonableness sub-verification result of the budget limit is determined to be failed.
[0056] This process involves detecting objectively identifiable lexical redundancy in the template (such as completely repeated instruction sentences or duplicated declarations of the same constraint) and marking items that can be simplified. Therefore, if there is no lexical redundancy in the target prompt word template, the redundancy sub-verification result is determined to be a pass; if there is lexical redundancy in the target prompt word template, the redundancy sub-verification result is determined to be a fail.
[0057] If any one of the following sub-verification results fails the verification: the baseline lexical threshold sub-verification result, the budget upper limit reasonableness sub-verification result, or the redundancy sub-verification result, it is recorded as a breach of the lexical design contract.
[0058] It should be noted that the object of validation here is the static attribute of the prompt word template itself, which is unrelated to whether the full load carried by the actual request at runtime (template plus dynamically filled content) exceeds the budget. The latter is the responsibility of the runtime link's resource control mechanism.
[0059] The above embodiments can verify the compliance of template lexical design, and detect defects such as template baseline lexical exceeding the threshold, unreasonable declared budget upper limit (such as exceeding the target model context window or not leaving a margin for dynamic filling), and redundant and repetitive instructions.
[0060] Furthermore, by verifying the compliance of template baseline lexical units with the budget limit, templates with unreasonable lexical unit designs (such as exceeding the context window, not reserving fill margin, or containing redundant instructions) are intercepted before release. This controls lexical unit efficiency from the design source and forms a complementary relationship between design-state control and runtime resource control, achieving pre-emptive control of lexical unit design compliance.
[0061] S15, perform structured fusion processing on the first verification result, the second verification result, the third verification result, and the fourth verification result to obtain a structured verification result.
[0062] In this embodiment, the structured verification result may include the type of contract breach, its position in the target prompt word template, the description of the breach, the severity level, etc.
[0063] This embodiment establishes a quality gate before the prompt word template goes live, so that defects such as inconsistent placeholders, contradictory formats and examples, conflicting constraints, and unreasonable word design are deterministically intercepted before release, rather than being exposed in the downstream business after launch.
[0064] This embodiment shifts the exposure point of template defects from "abnormal downstream model output after launch" to "contract verification before release," and uses structured verification results to accurately point out the type and location of breached contracts, significantly reducing the troubleshooting and maintenance costs for enterprises in the application of large language models, and achieving forward defect location and reduced troubleshooting costs.
[0065] In this embodiment, all four contract verifications are deterministic static analyses. The verification results are objective and reproducible, and do not rely on statistical inference or subjective judgment, thus providing clear and verifiable evidence for access control decisions.
[0066] S16, Decision on the release of the structured verification results is generated according to the hierarchical processing rules.
[0067] In this embodiment, the decision to release the structured verification result according to the hierarchical processing rules includes: Obtain the attribute data of each sub-validation result in the structured validation result to obtain the mandatory sub-validation result and the suggested sub-validation result; When all the required options pass the validation, the target prompt word template is set to the published state. When the verification results of the required options are not all passed, the target prompt word template is set to the rejection state, and the structured verification result is fed back to the triggerer of the access control command. Among them, the sub-validation results of the suggested items that failed the validation are marked.
[0068] Specifically, the target prompt word template is set to the published state, making it available for runtime invocation, if and only if the target prompt word template passes all required contract validation items.
[0069] When a mandatory contract validation item is breached, the system is set to a rejected state, disallowed from entering the published state, and the structured validation result is returned.
[0070] For suggestions that fail the verification, they will only be marked but not prevented from being published.
[0071] Among them, only the prompt word templates in the published state are visible to the runtime: the runtime caller can only reference the prompt word templates in the published state, and the templates in the rejected and draft states are not included in the callable set.
[0072] Through the above embodiments, the release status of prompt word templates can be deterministically controlled based on the contract verification results, so that prompt word templates that fail verification cannot enter the available released status, thereby establishing a quality gate before release.
[0073] In this embodiment, the strictness of the access control can be adjusted according to the actual scenario to configure mandatory and recommended options.
[0074] For example, required and recommended options can be configured according to the following principles: Principle 1 (Decisive): Determine whether the consequence is "functional failure" or "poor quality".
[0075] Specifically, if a breach of contract causes the template to malfunction during runtime, produce incorrect results, or trigger call exceptions, it is considered a functional, deterministic hard fault and should be configured as a mandatory option. Such defects will inevitably cause problems when brought online, and access control must intercept them.
[0076] Specifically, if the breach only results in a suboptimal, inefficient, or poorly styled prompt template, but the system still functions correctly and produces usable results, it is a soft issue of quality or degree and should be configured as a suggestion. These are optimization items; simply labeling them as reminders is sufficient, and there is no need to block their release through access control.
[0077] Principle Two (Auxiliary): Consider the objective certainty of the judgment.
[0078] Specifically, if the default determination is completely objective, unambiguous, and deterministic (e.g., a placeholder references an undeclared variable, a JSON declaration lacks structure, or the length and format cannot be physically satisfied simultaneously), then it should be configured as a mandatory option (low risk of false blocking).
[0079] Specifically, if the breach determination involves a threshold or subjective element, or if there are reasonable exceptions (such as the baseline terminology exceeding a certain "suggested threshold" or the detection of "redundant terms that can be simplified"), it should be configured as a suggested item (to avoid mistakenly deleting a publishable template due to an inaccurate threshold setting).
[0080] Principle 3 (Governance): Adjusted by the enterprise according to the risk appetite of the scenario, but with "bottom-line mandatory items". That is to say, there should be a set of bottom-line mandatory items (functional defects that should not be overlooked in any scenario) and a set of default recommended items (optimization items), and on this basis, tightening or loosening according to the scenario: tightening for cost-sensitive or highly compliant scenarios (such as finance), and setting more items as mandatory items; loosening for rapid iteration or experimental scenarios, and setting more items as recommended items.
[0081] Based on the above principles, the following classification tendencies can be derived: 1. Defaults to mandatory options (failure to comply will result in rejection), representing functional and objectively verifiable defects: 1) Declaration-reference consistency: If an undeclared placeholder is referenced, the variable will not be able to retrieve a value at runtime, the filling will fail, or a hole will be left. This is a functional hard fault and should be configured as a mandatory option. 2) Residual non-compliant placeholder structure: Malformed curly braces will be mis-parsed by the engine, causing rendering errors or throwing exceptions. This is a functional hard fault and should be configured as a mandatory option. 3) Placeholder-Instruction Dependency Consistency: If a placeholder for an instruction's dependency is not declared, the instruction's behavior cannot be implemented, which is a functional defect and should be configured as a mandatory option. 4) Completeness of format declaration: If a JSON is declared but no structure is given, the model will be confused and the output will be uncontrollable, which is a functional defect and should be configured as a required option; 5) Format declaration logic: One place requires plain text, and another requires JSON, which is contradictory and makes the model behavior uncertain. Therefore, this configuration should be a required option. 6) Example-Declaration Consistency: The example format contradicts the declaration, few-shots mislead the model, and the output format is disordered. This configuration is mandatory. 7) Logical conflicts between constraints: If "use only one word" and "detailed explanation" coexist, the constraints cannot be satisfied at the same time, the model behavior will be contradictory, and the configuration should be a mandatory option; 8) Length-format satisfiability: If "within 50 characters" and "5-field JSON" cannot be physically true at the same time, and one of them must be violated, then it is configured as a required option; 9) Constraint-Placeholder Dependency Consistency: If a placeholder referenced by a constraint is not declared, the constraint will not take effect; therefore, this configuration is required. 10) The section on "Template budget exceeds target model context window" in the budget limit reasonableness section: It will inevitably be truncated or cause an error at runtime, and is a functional hard constraint, so it should be configured as a required option.
[0082] II. Default items are suggestions (only labeled but not preventing publication), categorized as quality, cost, optimization, or with thresholds and subjective criteria: 1) Dangling declarations: Placeholders that are declared but not referenced do not affect operation (they are just redundant declarations) and are a matter of cleanliness, so they should be configured as a recommended option; 2) Baseline lexical threshold: If the baseline lexical exceeds the "suggested threshold configured according to the actual scenario", the template is too long and wasteful, but it can still work normally, and the threshold is set manually and there are reasonable exceptions, then it is configured as a suggested item (in cost-sensitive scenarios, it can be tightened to a mandatory item). 3) Redundancy: If "repetitive instructions that can be simplified" are detected, they are simply optimization items. Whether or not they are simplified does not affect the function. Moreover, the determination of "redundancy" is somewhat subjective, so they are configured as a recommended item. 4) In the section on the reasonableness of the budget limit, the "minimum margin for dynamic content" section: Insufficient margin is a risk warning rather than a hard error (depending on the actual request size), and should be configured as a suggestion (it can be tightened to a mandatory option in high concurrency and large input scenarios).
[0083] In the above embodiments, contract items can be configured as mandatory or recommended items according to the scenario, so that the same subsystem can impose strict access control for high compliance scenarios and lenient access control for rapid iteration scenarios, thus balancing quality and iteration efficiency.
[0084] In this embodiment, after generating the release decision of the structured verification result according to the hierarchical processing rules, the method further includes: When a new version of the target prompt word template is detected, the new version template is structured and parsed to extract the new constraint contract; Perform a difference detection on the new constraint contract and the target constraint contract to obtain a structured contract difference.
[0085] It can compare the changes between the old and new versions in terms of placeholder set, format declaration, constraint set, and lexical design parameters, and output structured contract differences (such as the addition or removal of placeholders, changes in budget limit, addition or removal of constraints, changes in unmet risk, etc.).
[0086] The contract differences can be recorded along with the version to support change tracking and rollback decisions.
[0087] It should be noted that there are dependencies between contract terms, and partial changes may cause breaches in the unmodified parts (e.g., deleting a declaration leaves the unmodified instruction blank, adding constraints conflicts with existing constraints, or changing the budget cannot satisfy existing formats). Therefore, issuing a ruling requires a complete re-verification of the entire new version of the contract. The results of the difference detection serve at most as prompts for change review, not as the basis for a ruling of "release based solely on differences." Therefore, the new version template also needs to undergo the complete full-partition violation verification of this embodiment before release, rather than just verifying contract differences.
[0088] In the above embodiments, version difference detection at the contract level makes the structural impact of each prompt template change (such as the addition or removal of placeholders, budgets, and constraints) clearly visible, supports change review and rollback decisions, and improves the controllability of prompt template changes.
[0089] The processing steps in this embodiment can be integrated into the various functional units of the access control subsystem. This subsystem has an interface and configuration independent of the runtime gateway components (such as routing, resource control, and compression components) and can be upgraded independently.
[0090] In this way, the business caller can reference the published template through the logical template identifier without being aware of the contract verification process.
[0091] The subsystem operates in template management mode and does not intervene in the runtime large language model call chain. Its release status adjudication does not participate in runtime model selection or resource control decisions.
[0092] Through the above embodiments, the verification and access control can operate in template management mode, without intervening in the runtime large language model call chain, and can be decoupled from other gateway components at runtime as an independent subsystem.
[0093] Furthermore, the subsystem operates in management mode and does not intervene in the runtime call chain, resulting in zero latency and zero intrusion on online requests. It can be deployed and upgraded independently as an independent subsystem alongside the runtime gateway component, and does not overlap with the runtime's routing, resource control, and other mechanisms, thus achieving decoupling from the runtime chain and zero runtime impact.
[0094] As can be seen from the above technical solutions, this invention can perform structured parsing of target prompt word templates to extract target constraint contracts, transforming the quality specifications in the templates into deterministic objects that can be verified item by item by the machine, facilitating the unified maintenance of prompt word templates; it performs placeholder declaration integrity verification, logical verification between output format and examples, constraint satisfiability verification, and template lexical design compliance verification to achieve quality control before release; and it generates release decisions based on structured verification results according to hierarchical processing rules, preventing templates that fail verification from entering the callable released state, thereby establishing a quality gate before release.
[0095] like Figure 2 The diagram shown is a functional block diagram of a preferred embodiment of the prompt word template publishing access control device of the present invention. The prompt word template publishing access control device 11 includes a parsing unit 110, a verification unit 111, a structuring unit 112, and a generation unit 113. The module / unit referred to in this invention refers to a series of computer program segments that can be executed by a processor and perform a fixed function, and are stored in memory. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0096] The parsing unit 110 is used to perform structured parsing of the target prompt word template in response to an access control command for the target prompt word template in order to extract the target constraint contract; The verification unit 111 is used to read the placeholder declaration set from the target constraint contract, and perform a placeholder declaration integrity verification based on the placeholder declaration set to obtain a first verification result; The verification unit 111 is further configured to read the output format declaration and example set from the target constraint contract, and perform logical verification between the output format and the example according to the output format declaration and example set to obtain a second verification result; The verification unit 111 is further configured to read the constraint set from the target constraint contract, and perform constraint satisfiability verification based on the constraint set to obtain a third verification result; The verification unit 111 is further configured to read lexical design parameters from the target constraint contract and perform template lexical design compliance verification according to the lexical design parameters to obtain a fourth verification result; The structuring unit 112 is used to perform structured fusion processing on the first verification result, the second verification result, the third verification result, and the fourth verification result to obtain a structured verification result; The generation unit 113 is used to generate a decision on the release of the structured verification result according to the hierarchical processing rules.
[0097] As can be seen from the above technical solutions, this invention can perform structured parsing of target prompt word templates to extract target constraint contracts, transforming the quality specifications in the templates into deterministic objects that can be verified item by item by the machine, facilitating the unified maintenance of prompt word templates; it performs placeholder declaration integrity verification, logical verification between output format and examples, constraint satisfiability verification, and template lexical design compliance verification to achieve quality control before release; and it generates release decisions based on structured verification results according to hierarchical processing rules, preventing templates that fail verification from entering the callable released state, thereby establishing a quality gate before release.
[0098] like Figure 3 The diagram shown is a structural schematic of a computer device that implements the access control method for publishing prompt word templates according to a preferred embodiment of the present invention.
[0099] The computer device 1 may include a memory 12, a processor 13, and a bus (the arrow in the figure represents the bus), and may also include a computer program stored in the memory 12 and executable on the processor 13, such as a prompt word template access control program.
[0100] Those skilled in the art will understand that the schematic diagram is merely an example of computer device 1 and does not constitute a limitation on computer device 1. Computer device 1 can be either a bus topology or a star topology. Computer device 1 may also include more or fewer other hardware or software than shown in the diagram, or different component arrangements. For example, computer device 1 may also include input / output devices, network access devices, etc.
[0101] It should be noted that the computer device 1 described is merely an example. Other existing or future electronic products that are adaptable to this invention should also be included within the scope of protection of this invention and are incorporated herein by reference.
[0102] The memory 12 includes at least one type of readable storage medium, such as flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 12 can be an internal storage unit of the computer device 1, such as a portable hard drive of the computer device 1. In other embodiments, the memory 12 can be an external storage device of the computer device 1, such as a plug-in portable hard drive, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the computer device 1. Furthermore, the memory 12 can include both internal and external storage units of the computer device 1. The memory 12 can be used not only to store application software and various types of data installed on the computer device 1, such as code for issuing access control programs using prompt word templates, but also to temporarily store data that has been output or will be output.
[0103] In some embodiments, the processor 13 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits packaged with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 13 is the control unit of the computer device 1, connecting various components of the computer device 1 via various interfaces and lines. It executes programs or modules stored in the memory 12 (e.g., executing prompt word templates to issue access control programs), and calls data stored in the memory 12 to perform various functions of the computer device 1 and process data.
[0104] The processor 13 executes the operating system of the computer device 1 and various installed applications. The processor 13 executes these applications to implement the steps in the above-described embodiments of the access control method for issuing prompt word templates, for example... Figure 1 The steps are shown.
[0105] For example, the computer program may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules / units may be a series of computer-readable instruction segments capable of performing a specific function, which describe the execution process of the computer program in the computer device 1. For example, the computer program may be divided into a parsing unit 110, a verification unit 111, a structuring unit 112, and a generation unit 113.
[0106] The integrated unit implemented as a software functional module described above can be stored in a computer-readable storage medium. This software functional module, stored in a storage medium, includes several instructions to cause a computer device (which may be a personal computer, computer equipment, or network device, etc.) or processor to execute portions of the access control method for issuing prompt word templates as described in various embodiments of the present invention.
[0107] If the modules / units integrated in the computer device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware devices. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above.
[0108] The computer program includes computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory, etc.
[0109] Furthermore, the computer-readable storage medium may primarily include a stored program area and a stored data area, wherein the stored program area may store the operating system, an application program required for at least one function, etc.; and the stored data area may store data created based on the use of blockchain nodes, etc.
[0110] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0111] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, in... Figure 3 The bus is represented by only one straight line, but this does not mean that there is only one bus or one type of bus. The bus is configured to enable communication between the memory 12 and at least one processor 13, etc.
[0112] Although not shown, the computer device 1 may also include a power supply (such as a battery) to power various components. Preferably, the power supply can be logically connected to the at least one processor 13 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The computer device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0113] Furthermore, the computer device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), which is typically used to establish communication connections between the computer device 1 and other computer devices.
[0114] Optionally, the computer device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the computer device 1 and to display a visual user interface.
[0115] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.
[0116] It will be understood by those skilled in the art that Figure 3 The structure shown does not constitute a limitation on the computer device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0117] Combination Figure 1 The memory 12 in the computer device 1 stores multiple instructions to implement a method for issuing access control based on prompt word templates, and the processor 13 can execute the multiple instructions to achieve the following: In response to an access control command on a target prompt word template, the target prompt word template is structured and parsed to extract the target constraint contract; Read the placeholder declaration set from the target constraint contract, and perform a placeholder declaration integrity check based on the placeholder declaration set to obtain a first check result; The output format declaration and example set are read from the target constraint contract, and the logical verification between the output format and the example is performed according to the output format declaration and example set to obtain the second verification result; Read the constraint set from the target constraint contract, and perform constraint satisfiability verification based on the constraint set to obtain the third verification result; Read the lexical design parameters from the target constraint contract, and perform template lexical design compliance verification based on the lexical design parameters to obtain the fourth verification result; The first verification result, the second verification result, the third verification result, and the fourth verification result are subjected to structured fusion processing to obtain a structured verification result; The decision to release the structured verification results is generated according to the hierarchical processing rules.
[0118] Specifically, the processor 13's implementation method for the above instructions can be found in [reference needed].Figure 1 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.
[0119] It should be noted that all data involved in this case was obtained in compliance with regulations.
[0120] If any AI models, software tools, or components not belonging to this company appear in the embodiments of this invention, they are merely illustrative examples and do not represent actual use. All user personal information involved in the embodiments of this invention is obtained by compliant entities through various means with the authorization (knowledge and consent) of the relevant parties or with full authorization from all parties. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with relevant laws and regulations and do not violate public order and good morals.
[0121] In the several embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0122] This invention can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This invention can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This invention can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0123] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0124] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0125] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0126] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0127] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices described in this invention can also be implemented by a single unit or device through software or hardware. Terms such as "first," "second," etc., are used to indicate names and do not indicate any specific order.
[0128] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for publishing access control information using prompt word templates, characterized in that, The method for publishing access control using the prompt word template includes: In response to an access control command on a target prompt word template, the target prompt word template is structured and parsed to extract the target constraint contract; Read the placeholder declaration set from the target constraint contract, and perform a placeholder declaration integrity check based on the placeholder declaration set to obtain a first check result; The output format declaration and example set are read from the target constraint contract, and the logical verification between the output format and the example is performed according to the output format declaration and example set to obtain the second verification result; Read the constraint set from the target constraint contract, and perform constraint satisfiability verification based on the constraint set to obtain the third verification result; Read the lexical design parameters from the target constraint contract, and perform template lexical design compliance verification based on the lexical design parameters to obtain the fourth verification result; The first verification result, the second verification result, the third verification result, and the fourth verification result are subjected to structured fusion processing to obtain a structured verification result; The decision to release the structured verification results is generated according to the hierarchical processing rules.
2. The access control method using prompt word templates as described in claim 1, characterized in that, The step of performing a placeholder declaration integrity check based on the placeholder declaration set to obtain a first check result includes: Obtain each instruction in the target prompt word template and check whether the placeholder referenced in each instruction exists in the placeholder declaration set to obtain the declaration-reference consistency sub-verification result; Based on the reference relationships stored in the placeholder declaration set, it is detected whether each placeholder in the placeholder declaration set has been referenced in the target prompt word template, and the dangling declaration sub-verification result is obtained; Extract the text from the target prompt word template, and detect whether there are residual non-compliant placeholder structures in the text according to the placeholder structure in the placeholder declaration set, and obtain the residual non-compliant placeholder structure sub-verification result; For each instruction, when the behavior of the instruction depends on the content of any placeholder in the target prompt word template, check whether the arbitrary placeholder has been declared to obtain the placeholder-instruction dependency consistency sub-verification result; The first verification result is generated based on the declaration-reference consistency sub-verification result, the dangling declaration sub-verification result, the residual non-compliant placeholder structure sub-verification result, and the placeholder-instruction dependency consistency sub-verification result.
3. The access control method for issuing prompt word templates as described in claim 1, characterized in that, The step of performing logical verification between the output format and the examples based on the output format declaration and the example set to obtain the second verification result includes: The complete structure definition of the output format declaration is checked against the declared output structure format in the example set to obtain the format declaration integrity sub-verification result; The output format declaration is checked against the example set to determine if there are any contradictory output format declarations, and the format declaration logic sub-verification result is obtained. The actual output format of the output format declaration and the examples in the example set are consistent with the declared output structure format, and the example-declaration consistency sub-verification result is obtained. The second verification result is generated based on the format declaration integrity sub-verification result, the format declaration logic sub-verification result, and the example-declaration consistency sub-verification result.
4. The access control method using prompt word templates as described in claim 1, characterized in that, The step of performing constraint satisfiability verification based on the constraint set to obtain the third verification result includes: Detect whether there are logical conflicts among the constraints in the constraint set, and obtain the logical conflict sub-verification result between constraints; The length constraint and format constraint in the constraint set are checked to see if they are physically incompatible, and the length-format satisfiability check result is obtained. The constraint-placeholder dependency consistency sub-verification result is obtained by checking whether the placeholders referenced by each constraint in the constraint set have been declared. The third verification result is generated based on the logical conflict sub-verification result between constraints, the length-format satisfiability sub-verification result, and the constraint-placeholder dependency consistency sub-verification result.
5. The access control method for issuing prompt word templates as described in claim 1, characterized in that, The step of performing template lexical design compliance verification based on the lexical design parameters to obtain the fourth verification result includes: The target model's word segmenter is used to calculate the baseline number of lexical units in the target prompt word template, and a baseline threshold is obtained from the lexical unit design parameters. The baseline number of lexical units is then checked to see if it is greater than the baseline threshold, and the baseline lexical unit threshold sub-verification result is obtained. Obtain the maximum total word element capacity of the target model context window, the minimum reserved margin for dynamic filling content, and the word element budget limit from the word element design parameters. Detect whether the word element budget limit is less than the maximum total word element capacity, and whether the difference between the maximum total word element capacity and the word element budget limit is greater than or equal to the minimum reserved margin for dynamic filling content, and obtain the budget limit rationality sub-verification result. Detect whether there is lexical redundancy in the target prompt word template, and obtain the redundancy sub-check result; The fourth verification result is generated based on the baseline lexical threshold sub-verification result, the budget upper limit reasonableness sub-verification result, and the redundancy sub-verification result.
6. The access control method for issuing prompt word templates as described in claim 1, characterized in that, The decision to release the structured verification results according to the hierarchical processing rules includes: Obtain the attribute data of each sub-validation result in the structured validation result to obtain the mandatory sub-validation result and the suggested sub-validation result; When all the required options pass the validation, the target prompt word template is set to the published state. When the verification results of the required options are not all passed, the target prompt word template is set to the rejection state, and the structured verification result is fed back to the triggerer of the access control command. Among them, the sub-validation results of the suggested items that failed the validation are marked.
7. The access control method for issuing prompt word templates as described in claim 1, characterized in that, After generating the release decision of the structured verification result according to the hierarchical processing rules, the method further includes: When a new version of the target prompt word template is detected, the new version template is structured and parsed to extract the new constraint contract; Perform a difference detection on the new constraint contract and the target constraint contract to obtain a structured contract difference.
8. A prompt word template-based access control device, characterized in that, Used to execute the access control method for issuing prompt word templates as described in any one of claims 1 to 7.
9. A computer device, characterized in that, The computer device includes: A memory for storing at least one instruction; and a processor for executing the instructions stored in the memory to implement the access control method for issuing prompt word templates as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, which is executed by a processor in a computer device to implement the access control method for issuing prompt word templates as described in any one of claims 1 to 7.