Policy dsl information generation method and related device

By using a hybrid collaborative architecture that rewrites, retrieves, and generates agents, policy DSL information is automatically generated, solving the problems of low accuracy and efficiency in traditional manual DSL coding, and improving policy coverage and system maintainability.

CN121255166BActive Publication Date: 2026-04-28CHONGQING ANT CONSUMER FINANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHONGQING ANT CONSUMER FINANCE CO LTD
Filing Date
2025-12-05
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

In the development of traditional risk control strategies, manually writing DSL code is difficult to guarantee accuracy, inefficient, and costly to maintain. It is difficult to meet the needs of real-time risk control and the strategy coverage is insufficient in multi-source heterogeneous behavior scenarios.

Method used

By rewriting the agent to parse the initial instruction, multiple recall instructions are generated. The policy DSL information fragments are retrieved using the DSL knowledge base, and then integrated into policy DSL information by generating an agent, thus achieving automated generation.

Benefits of technology

It improves the generation quality and coverage of policy DSL information, ensures the reliability and accuracy of the generated policy DSL information, solves the problem of low efficiency of manual writing, and realizes end-to-end intelligent generation of policy DSL information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121255166B_ABST
    Figure CN121255166B_ABST
Patent Text Reader

Abstract

The embodiment of the specification discloses a policy DSL information generation method and related equipment, and relates to the technical field of computers. The embodiment of the specification provides a hybrid intelligent agent cooperation architecture including a rewriting intelligent agent, a retrieval intelligent agent and a generation intelligent agent, the single initial instruction is parsed through the rewriting intelligent agent, is expanded into multiple recall instructions, and the policy DSL information segments matched with the recall instructions are retrieved in the DSL knowledge base through the retrieval intelligent agent, multiple policy DSL information segments related to the policy DSL information generation task are recalled, and the multiple policy DSL information segments are integrated into a prompt word, the policy DSL information required by the initial instruction and meeting the syntax compliance is generated based on the prompt word through the generation intelligent agent, and the problems of low efficiency and easy error of manually writing the policy DSL information are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer technology, and in particular to a method for generating policy DSL information and related equipment. Background Technology

[0002] In the field of risk control strategy development, traditional methods typically rely on risk control experts or developers manually writing Domain Specific Language (DSL) code to define risk identification and handling rules. However, this manual coding approach has significant limitations. First, the coding process is highly dependent on individual experience, making it difficult to guarantee the accuracy and completeness of the rule logic. It is prone to introducing logical loopholes or misjudgments due to oversights or semantic ambiguities. Second, facing increasingly complex and varied fraud methods and high-frequency iterative transaction scenarios, manual coding is inefficient, resulting in long strategy deployment cycles and failing to meet the requirements of real-time risk control for agile response and rapid deployment. Third, DSL code often lacks unified standards and structural constraints, leading to poor readability, high maintenance costs, and potential version confusion and logical conflicts during team collaboration or strategy reuse. Furthermore, as risk control dimensions expand from single behaviors to multi-source heterogeneous behaviors, manual construction of DSL code becomes increasingly difficult, resulting in insufficient strategy coverage. Summary of the Invention

[0003] This specification provides a method and related equipment for generating policy DSL information, which can solve the above-mentioned problems. The technical solution is as follows:

[0004] In a first aspect, embodiments of this specification provide a method for generating policy DSL information, the method comprising:

[0005] The initial instruction is obtained, and the agent is rewritten to parse the policy information corresponding to the initial instruction based on multiple dimensions to generate at least one recall instruction corresponding to different dimensions; wherein, the multiple dimensions include at least one of the following dimensions: syntax structure, conditional logic, policy semantics, and reference relationship;

[0006] Based on multiple recall instructions, a retrieval agent searches the DSL knowledge base for policy DSL information fragments that match the recall instructions.

[0007] Multiple policy DSL information fragments are integrated into a prompt word, and a generating agent generates policy DSL information corresponding to the initial instruction based on the prompt word.

[0008] Secondly, embodiments of this specification provide a policy DSL information generation apparatus, the apparatus comprising:

[0009] The instruction generation module is used to obtain an initial instruction and, by rewriting the agent, parses the policy information corresponding to the initial instruction based on multiple dimensions to generate at least one recall instruction corresponding to different dimensions; wherein, the multiple dimensions include at least one of the following dimensions: syntax structure, conditional logic, policy semantics, and reference relationship.

[0010] The information retrieval module is used to retrieve, based on multiple recall instructions, a retrieval agent to retrieve policy DSL information fragments that match the recall instructions from the DSL knowledge base;

[0011] The information generation module is used to integrate multiple policy DSL information fragments into prompt words, and generate policy DSL information corresponding to the initial instruction by generating an intelligent agent based on the prompt words.

[0012] Thirdly, embodiments of this specification provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the above-described method steps.

[0013] Fourthly, embodiments of this specification provide a computer program product that stores multiple instructions adapted for loading by a processor and executing the above-described method steps.

[0014] Fifthly, embodiments of this specification provide an electronic device that may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the above-described method steps.

[0015] The beneficial effects of the technical solutions provided in some embodiments of this specification include at least the following:

[0016] This specification addresses the issue of insufficient recall in complex policy scenarios by rewriting the agent's parsing of a single initial instruction, expanding it to include multiple recall instructions covering more dimensions. This improves the breadth and diversity of knowledge retrieval. Furthermore, a pre-built DSL knowledge base containing numerous policy DSL information fragments is constructed. A retrieval agent searches this knowledge base for policy DSL information fragments matching the recall instructions, accurately recalling multiple policy DSL information fragments related to the policy DSL information generation task, ensuring the reliability and accuracy of the generated policy DSL information. Further, multiple policy DSL information fragments are integrated into meaningful prompt words. A generation agent then generates grammatically compliant policy DSL information that meets the requirements of the initial instruction based on these prompt words, solving the problems of low efficiency and error-proneness in manually writing information. This achieves end-to-end intelligent generation from instruction to executable policy DSL information. In other words, this specification utilizes a hybrid agent collaborative architecture including a rewriting agent, a retrieval agent, and a generation agent to automate the generation of policy DSL information, improving the quality of the generated policy DSL information, policy rule coverage, and system maintainability. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram of the architecture of a strategy DSL information generation method provided in the embodiments of this specification;

[0019] Figure 2 This is a flowchart illustrating a method for generating policy DSL information provided in an embodiment of this specification;

[0020] Figure 3 This is a flowchart illustrating a method for generating policy DSL information provided in an embodiment of this specification;

[0021] Figure 4 This is a flowchart illustrating a method for generating policy DSL information provided in an embodiment of this specification;

[0022] Figure 5 This is a flowchart illustrating a method for generating policy DSL information provided in an embodiment of this specification;

[0023] Figure 6 This is a schematic diagram of the structure of a strategy DSL information generation system provided in the embodiments of this specification;

[0024] Figure 7 This is a schematic diagram of the structure of a strategy DSL information generation device provided in the embodiments of this specification;

[0025] Figure 8 This is a schematic diagram of the structure of an electronic device provided in the embodiments of this specification. Detailed Implementation

[0026] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.

[0027] In the description of this specification, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. In the description of this specification, it should be noted that, unless otherwise expressly specified and limited, "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. Those skilled in the art can understand the specific meaning of the above terms in this specification based on the specific circumstances. Furthermore, in the description of this specification, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.

[0028] The present specification will now be described in detail with reference to specific embodiments.

[0029] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in the embodiments of this specification are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the features, information, and data involved in this specification were all obtained under full authorization.

[0030] like Figure 1 As shown, Figure 1 This is a flowchart illustrating a method for generating strategy DSL information provided in an embodiment of this specification. Figure 1 The system includes at least a server 101 that executes the policy DSL information generation method, and multiple terminals for sending initial instructions to obtain policy DSL information. These multiple terminals include at least a first terminal 1021, a second terminal 1022, and a third terminal 1023. It is understood that... Figure 1 The number of servers and terminals shown is for illustrative purposes only, and the embodiments in this specification do not impose any limitations on this.

[0031] The aforementioned server 101 can be a standalone server device, such as a rack-mount, blade, tower, or cabinet-type server device, or a workstation, mainframe, or other hardware device with strong computing power; it can also be a server cluster composed of multiple servers. The servers in the service cluster can be composed in a symmetrical manner, where each server is functionally and hierarchically equivalent in the transaction chain, and each server can provide services to the outside world independently. Providing services independently can be understood as not requiring the assistance of other servers.

[0032] For example, a server can be multiple physical servers, each with independent hardware. Alternatively, a server can be multiple virtual servers deployed within the same hardware resource pool. Virtual server deployment methods include, but are not limited to, VMware, VirtualBox, and Virtual PC.

[0033] It is understood that server 101 also possesses other service capabilities and functions to complete the tasks described in the following embodiments. For example, server 101 also provides portal services, resource management services, and CI / CD services, etc.

[0034] Terminals include, but are not limited to: wearable devices, handheld devices, personal computers, tablets, in-vehicle devices, smartphones, computing devices, or other processing devices connected to a wireless modem. Terminals may have different names in different networks, such as: user equipment, access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent or user device, cellular phone, cordless phone, personal digital assistant (PDA), and terminals in 5G networks or future evolved networks.

[0035] In the embodiments described in this specification, display devices may also be installed on terminals such as the first terminal 1021, the second terminal 1022, and the third terminal 1023. These display devices can be various devices capable of display functions, such as cathode ray tube displays (CR), light-emitting diode displays (LED), electronic ink screens, liquid crystal displays (LCD), and plasma display panels (PDP). For example, a user can use the display device on the first terminal 1021 to send initial instructions or policy DSL codes to the server 101 to obtain policy DSL information.

[0036] Multiple terminals and multiple servers can communicate through communication links established by communication protocols. For example, the network can be a wireless network or a wired network. Wireless networks include, but are not limited to, cellular networks, wireless LANs, infrared networks, or Bluetooth networks. Wired networks include, but are not limited to, Ethernet, universal serial bus (USB), or controller area networks. In one or more embodiments of the specification, technologies and / or formats including Hyper Text Markup Language (HTML), Extensible Markup Language (XML), etc., are used to represent data exchanged over the network (such as target compressed packets). Furthermore, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), and Internet Protocol Security (IPsec) can be used to encrypt all or some of the links. In other embodiments, customized and / or dedicated data communication technologies can be used to replace or supplement the aforementioned data communication technologies.

[0037] Domain-specific languages ​​(DSLs) are computer languages ​​focused on a specific application domain. Unlike general-purpose languages ​​that are cross-domain, DSLs are used only in certain specific domains and are descriptive languages ​​used to describe the content of a particular domain.

[0038] Policy information refers to the rule elements extracted from the initial user-input instructions that guide the generation of policy DSL information; its specific content depends on the application domain. This illustrative embodiment does not impose any limitations on the application domain of policy information.

[0039] For example, in the financial sector, risk control strategy represents a risk management approach. This involves using a series of strategic rules to screen and classify customers based on different transaction scenarios and target customer groups, identifying risk points, mitigating risk, and achieving goals such as fraud prevention and credit granting. The strategy information for risk control strategies can include triggering conditions (user risk level, transaction frequency), handling actions (such as refusing transactions or limiting amounts), and time windows. For instance, the strategy description text might be "High-risk users are prohibited from making large transfers."

[0040] For example, in the field of cybersecurity, policy information includes threat types (such as DDoS, SQL injection, abnormal logins), response actions (such as blocking IPs, rate limiting), and detection metrics (such as request frequency greater than 1000 / s, number of failed logins ≥ 5). The policy description text could be "Immediately block the source IP upon detection of brute-force attack."

[0041] For example, in the field of operations and maintenance automation, policy information can include detection metrics (such as CPU utilization > 90%, disk space < 10GB), self-healing actions (such as scaling up instances, restarting services, switching to standby nodes), and the scope of impact (such as service A cluster, the primary database). The policy description text could be "Automatically scale up if service response latency exceeds 2 seconds".

[0042] For example, in the field of marketing recommendations, strategy information can include user segmentation criteria (such as VIP users, those who have been inactive for 30 days), recommendation actions (such as issuing coupons, sending push notifications), and triggering timing (after placing an order, after browsing the product page for more than 1 minute). The strategy description text could be "New users get a ¥10 discount on their first order."

[0043] An agent is a software entity with specific functional goals, capable of autonomous decision-making and invoking models or tools to complete sub-tasks. Each agent is responsible for a defined task. This specification provides an architecture for multi-agent collaborative operation, specifically including agent rewriting, agent retrieval, and agent generation. Intermediate results are exchanged between multiple agents through standardized interfaces (such as JSON messages).

[0044] In one embodiment, such as Figure 2The diagram shown is a flowchart illustrating a strategy DSL information generation method provided in an embodiment of this specification. This method can be implemented using a computer program and can run on a strategy DSL information generation device based on the von Neumann architecture. This computer program can be integrated into an application or run as a standalone utility application.

[0045] Specifically, the method for generating DSL information under this strategy includes:

[0046] S102. Obtain the initial instruction, and generate multiple recall instructions by rewriting the agent to parse the policy information corresponding to the initial instruction.

[0047] The rewriting agent performs semantic parsing on the initial instruction, combining the application domain to identify implicit or explicit policy information. Specifically, it identifies core intents, key entities (such as "high-risk user" or "large transfer"), and potential dimensions (such as time, frequency, and device) within the policy information. Further, it generates multiple recall instructions based on the policy information. This can be achieved using a pre-defined rewriting template library or prompt engineering, which expands the initial instruction by incorporating the core intents, key entities, or dimensions from the policy information. The retrieval agent can then use these multiple recall instructions to perform parallel searches, retrieving policy DSL information fragments related to the initial instruction from different perspectives.

[0048] In one embodiment, an initial instruction is obtained; by rewriting the agent to parse the policy information corresponding to the initial instruction based on multiple dimensions, at least one recall instruction corresponding to different dimensions is generated; wherein, the multiple dimensions include at least one of the following dimensions: syntax structure, conditional logic, policy semantics, and reference relationship.

[0049] In this embodiment, multiple dimensions refer to the analytical directions for deconstructing the policy information corresponding to the initial instruction from different semantic or structural perspectives. Each dimension focuses on a key aspect of policy DSL information generation. The rewritten agent generates at least one targeted recall instruction based on this dimension to recall policy DSL information fragments corresponding to different dimensions, thereby ensuring that the final generated policy DSL information meets the requirements of different dimensions.

[0050] Specifically, at least one recall instruction is generated based on the syntactic structure dimension. The syntactic structure dimension focuses on the legal syntactic composition of the initial instruction within the DSL language, including keywords, expression types, and statement block organization, ensuring that the generated policy DSL information conforms to the syntactic rules of the DSL code and avoiding syntax errors. For example, the policy information of the initial instruction includes the policy description text "Reject transaction when user risk is high," and the policy DSL information determined from the syntactic structure dimension includes IF statements. <condition>THEN <action>The structure is rewritten to generate recall instructions for the agent to retrieve policy DSL information fragments that conform to the above syntactic structure. For example, the recall instructions are "What is the standard way to write the IF-THEN structure in the risk control DSL?" or "How to express the action statement of 'rejecting the transaction' in the DSL?"

[0051] At least one recall instruction is generated based on the Conditional Logic Dimension. The Conditional Logic Dimension focuses on the judgment conditions triggered in the policy information, including comparison operations, time windows, field dependencies, and other conditional logic. The agent is rewritten to generate recall instructions based on a single condition to recall policy DSL information fragments that meet that single condition. For example, the policy information includes the policy description text "Users who have failed to log in more than 5 times in the last 7 days need manual review." From the Conditional Logic Dimension, the policy information includes the conditions login_fail_count>= 5 and within last 7 days. The rewritten instruction breaks down the above conditional logic, generating recall instructions such as "How to count the number of login failures in the last 7 days in the DSL" and "What are the ways to express multiple conditions (such as time and frequency) in the DSL?".

[0052] At least one recall instruction is generated based on the Policy Semantic Dimension. The Policy Semantic Dimension focuses on the transactional intent and domain of policy information, such as the concretization of abstract semantics like "high risk," "large amount," and "abnormal behavior." The agent is rewritten to map the ambiguous natural language in the policy information to specific, executable rules based on the policy semantics, and then generates at least one recall instruction based on these rules. For example, if the policy description text includes "intercept suspicious transfers," the agent is rewritten to analyze the policy semantics, mapping the natural language "suspicious" to specific indicators: amount > threshold, recipient in black_list, velocity_anomaly == true, and generating recall instructions such as "What judgment rules are typically included in 'suspicious transfers' in the risk control system?" and "Which policy templates are used to handle abnormal fund flows?"

[0053] At least one recall instruction is generated based on the Reference Relationship Dimension. Reference relationships represent the dependencies and invocation relationships between external entities, fields, functions, macros, or existing policies involved in the policy information. The policy DSL information fragment recalled by the at least one recall instruction generated based on the Reference Relationship Dimension is used to ensure that the policy DSL information can correctly reference existing context variables or reuse existing components in the system. For example, the initial instruction includes the policy description text "If the user device is an emulator, reduce the credit limit," including the reference relationship as the field to be referenced: device.is_emulator, and the action function: adjust_credit_limit(factor). The rewritten agent identifies the above reference items and generates a recall instruction for retrieving field definitions, function signatures, or policy fragments. For example, the recall instruction could be "The parameter list and invocation example of the adjust_credit_limit function?"

[0054] In this embodiment, the rewritten agent parses a single initial instruction based on different dimensions, expanding it into multiple recall instructions that can cover more dimensions. This solves the problem of insufficient recall in complex strategy scenarios when querying a single instruction, and improves the breadth and diversity of knowledge retrieval.

[0055] like Figure 3 As shown, Figure 3 This is a flowchart illustrating a method for generating policy DSL information provided in an embodiment of this specification. The agent rewrites the initial instruction 201 into multiple recall instructions based on multiple dimensions, including at least a first recall instruction 2021, a second recall instruction 2022, a third recall instruction 2023, and a fourth recall instruction 2024.

[0056] In one embodiment, user-input data including an initial policy DSL code and / or policy description text is acquired, and the data is analyzed to obtain an initial instruction including policy information.

[0057] The initial policy DSL code is a structured code snippet conforming to the target domain's DSL code. The policy description text is a rule based on natural language expression. For example, the policy description text is "Reject transaction when user risk is high." In other words, this embodiment supports user input of multimodal data to be processed and provides users with policy DSL information that meets their needs, lowering the barrier for users to write policy DSL information.

[0058] When a user inputs data to be processed, including the initial policy DSL code, the data can be analyzed using syntax parsing and semantic extraction methods, and encapsulated into initial instructions containing policy information. When a user inputs data to be processed, including policy description text, the data can be analyzed using semantic understanding, domain alignment, and structured mapping methods.

[0059] S104. Based on multiple recall instructions, the retrieval agent searches the DSL knowledge base for policy DSL information fragments that match the recall instructions.

[0060] A Domain-Specific Language (DSL) knowledge base is an external knowledge storage system specifically built for the task of generating policy DSL information. It stores a large number of policy DSL information fragments, serving as the basis for the generating agent to generate policy DSL information. For example, the DSL knowledge base stores the original text of policy DSL information fragments, and the policy DSL code generated by parsing the policy DSL information.

[0061] Policy DSL information fragments are reusable, semantically independent executable units, and policy DSL information can be composed of multiple policy DSL information fragments.

[0062] The retrieval agent retrieves policy DSL information fragments that match recall commands from the DSL knowledge base. For example, if the recall command is in natural language, it is encoded into a vector using an embedding model or other model, and policy DSL information fragments are retrieved through vector matching. Alternatively, if the recall command is structured data (such as {"field": "transaction.amount", "threshold": 50000}), policy DSL information fragments are retrieved through tag matching.

[0063] In the embodiments of this specification, the retrieval agent can retrieve multiple policy DSL information fragments corresponding to multiple recall instructions based on a multi-path recall and fusion ranking strategy. For example, multiple pre-selected policy DSL information fragments corresponding to recall instructions in the DSL knowledge base can be retrieved by vector similarity retrieval or tag matching. Furthermore, the multiple pre-selected policy DSL information fragments are ranked by deduplication and scoring, and the pre-selected policy DSL information fragment with the highest score is selected as the policy DSL information fragment corresponding to the recall instruction.

[0064] like Figure 3 As shown, the retrieval agent matches the first strategy DSL information fragment 2031 for the first recall instruction 2021, the second strategy DSL information fragment 2032 for the recall instruction 2022, the third strategy DSL information fragment 2033 for the third recall instruction 2023, and the fourth strategy DSL information fragment 2034 for the fourth recall instruction 2024 in the DSL knowledge base.

[0065] In one embodiment, the policy DSL information fragment includes a policy DSL code fragment that matches the recall instruction and the syntax rules of the policy DSL code fragment. For example, if the policy information of the initial instruction includes the policy description text "Reject transaction when user risk is high" and the recall instruction is "How to express the action statement of 'reject transaction' in DSL", then the policy DSL code fragment representing the rejection of transaction and the syntax rules of the policy DSL code fragment are retrieved based on the recall instruction.

[0066] S106. Integrate multiple policy DSL information fragments into prompt words, and generate policy DSL information corresponding to the initial instruction based on the prompt words by generating an intelligent agent.

[0067] Multiple policy DSL information fragments are integrated into a clear, context-rich, and task-specific prompt word. For example, multiple policy DSL information fragments can be broken down into policy DSL code fragments and their syntax rules, and then ordered according to their relevance to the initial instruction, thereby integrating them into a prompt word.

[0068] The prompt also includes other information, such as initial instructions, which are embedded as the generation target prompt. For example... Figure 3 As shown, multiple policy DSL information fragments are integrated into a prompt word 204. The agent generates policy DSL information based on prompt word 204.

[0069] In one embodiment, the data to be processed includes an initial policy DSL code. Multiple policy DSL information fragments are integrated into prompt words, and an agent is generated to continue writing the initial policy DSL code based on the prompt words to obtain policy DSL information.

[0070] In this embodiment, when the user inputs the initial policy DSL code, the prompt word represents the code continuation task. The generated agent distinguishes the initial policy DSL code in the prompt word as the continuation target, and based on multiple policy DSL information fragments in the prompt word, it continuates the context policy DSL code of the initial policy DSL code as policy DSL information.

[0071] For example, when the initial policy DSL code is incomplete (e.g., missing actions, unclosed conditions, missing logical branches, etc.), the generating agent fills in the missing parts of the initial policy DSL code based on multiple policy DSL information fragments, forming a complete and executable policy DSL code.

[0072] In this embodiment, the generating agent can also refuse to continue writing the initial policy DSL code. For example, if the user-inputted initial policy DSL code has a serious syntax error and cannot be parsed, or uses a field that does not exist in the system, or inputs a high-risk policy DSL code, or the input policy DSL code contradicts multiple retrieved policy DSL information, the generating agent outputs the corresponding rejection content.

[0073] In one embodiment, the data to be processed includes policy description text. Multiple policy DSL information fragments are integrated into prompt words. A generating agent then generates policy DSL codes corresponding to the policy description text based on these prompt words, along with the syntax rules of the policy DSL codes, as policy DSL information.

[0074] In this embodiment, when a user inputs policy description text, prompt words represent the task of converting the policy description text, which is natural language, into compliant and executable policy DSL code. The syntax rules of the policy DSL code represent the predefined DSL syntax template or structural identifier that the policy DSL code conforms to, improving the interpretability of the policy DSL code. The generating agent generates the policy DSL code corresponding to the policy description text and the syntax rules of the policy DSL code based on prompt words including the policy description text and multiple policy DSL information fragments.

[0075] This specification addresses the issue of insufficient recall in complex policy scenarios by rewriting the agent's parsing of a single initial instruction, expanding it to include multiple recall instructions covering more dimensions. This improves the breadth and diversity of knowledge retrieval. Furthermore, a pre-built DSL knowledge base containing numerous policy DSL information fragments is constructed. A retrieval agent searches this knowledge base for policy DSL information fragments matching the recall instructions, accurately recalling multiple policy DSL information fragments related to the policy DSL information generation task, ensuring the reliability and accuracy of the generated policy DSL information. Further, multiple policy DSL information fragments are integrated into meaningful prompt words. A generation agent then generates grammatically compliant policy DSL information that meets the requirements of the initial instruction based on these prompt words, solving the problems of low efficiency and error-proneness in manually writing information. This achieves end-to-end intelligent generation from instruction to executable policy DSL information. In other words, this specification utilizes a hybrid agent collaborative architecture including a rewriting agent, a retrieval agent, and a generation agent to automate the generation of policy DSL information, improving the quality of the generated policy DSL information, policy rule coverage, and system maintainability.

[0076] In one embodiment, such as Figure 4 The diagram shown is a flowchart illustrating a strategy DSL information generation method provided in an embodiment of this specification. This method can be implemented using a computer program and can run on a strategy DSL information generation device based on the von Neumann architecture. This computer program can be integrated into an application or run as a standalone utility application.

[0077] Specifically, the method for generating DSL information under this strategy includes:

[0078] S202, Construct a DSL knowledge base.

[0079] The DSL knowledge base refers to an external knowledge storage system specifically built for the task of generating policy DSL information. The DSL knowledge base stores structured data, unstructured data, and policy metadata associated with policy DSL information fragments.

[0080] Specifically, unstructured data is raw, unparsed natural language or code text. It can include the raw text of multiple policy DSL code snippets, such as: "IF user.risk_score>0.8 AND transaction.amount>50000 THEN require_manual_review()". It can also include policy description text, such as "Large transactions by high-risk users require manual review", and manual annotations, such as "This policy is used in anti-fraud scenarios and is applicable to the payment process".

[0081] Structured data associated with policy DSL information fragments typically refers to machine-readable representations obtained after parsing structured data. For example, a parser might be built using a predefined DSL grammar (such as an ANTLR grammar file), performing lexical / syntactic analysis on the original DSL code to generate an Abstract Syntax Tree (AST), which is then converted into a standardized structured representation. Structured data supports logical condition comparisons and field dependency analysis, and can also be used for logical fusion and conflict detection during the policy DSL code generation phase, as well as providing precise structured filtering conditions.

[0082] Policy metadata is used to describe auxiliary information such as transaction attributes and usage context of policy DSL information fragments. For example, policy metadata includes domain tags, policy type, applicable objects, risk level, field dependency list, action function whitelist, version, and source.

[0083] In one embodiment, constructing a DSL knowledge base includes: segmenting initial policy DSL information according to a preset segmentation rule to obtain multiple policy DSL information fragments; storing the multiple policy DSL information fragments into the DSL knowledge base respectively, and establishing vector index items associated with the policy DSL information fragments.

[0084] Initial policy DSL information refers to the complete policy unit to be added to the DSL knowledge base, which usually comes from historical policies, policy templates or complete DSL code submitted by users.

[0085] Based on preset segmentation rules, the complete initial policy DSL information is decomposed into smaller, reusable, semantically independent policy DSL information fragments. The preset segmentation rules can be based on syntax structure, segmenting the initial policy DSL information according to the statement boundaries of the DSL language. Alternatively, they can be based on logical structure, segmenting multiple logical conditions included in the policy into independent conditions, thereby segmenting the initial policy DSL information. Finally, preset segmentation rules can also be based on template matching.

[0086] Multiple policy DSL information fragments are stored separately in a DSL knowledge base, existing as independent knowledge blocks. To support semantic retrieval, vector index items associated with the policy DSL information fragments are created in the DSL knowledge base. Specifically, this involves constructing index text based on the content of the policy DSL information fragments, generating index vector items for the index text through an embedding model, and associating and storing the index vector items with the knowledge blocks corresponding to the policy DSL information fragments.

[0087] In this embodiment, the initial strategy DSL information is segmented according to a preset segmentation rule to obtain multiple strategy DSL information fragments. A single strategy DSL information fragment can be reused by multiple strategy DSL information fragments, avoiding redundancy caused by repeatedly storing the entire initial strategy DSL information. Furthermore, multiple strategy DSL information fragments are stored separately in the DSL knowledge base, and vector index items associated with the strategy DSL information fragments are established to improve retrieval efficiency.

[0088] S204. Obtain the initial instruction, and generate multiple recall instructions by rewriting the agent to parse the policy information corresponding to the initial instruction.

[0089] See S102 above, which will not be repeated here.

[0090] S206. Based on multiple recall instructions, the retrieval agent searches the DSL knowledge base for policy DSL information fragments that match the recall instructions.

[0091] See S104 above; it will not be repeated here.

[0092] S208. Integrate multiple policy DSL information fragments into a prompt word, and generate policy DSL information corresponding to the initial instruction based on the prompt word by generating an intelligent agent.

[0093] See S106 above; it will not be repeated here.

[0094] This specification addresses the issue of insufficient recall in complex policy scenarios by rewriting the agent's parsing of a single initial instruction, expanding it to include multiple recall instructions covering more dimensions. This improves the breadth and diversity of knowledge retrieval. Furthermore, a pre-built DSL knowledge base containing numerous policy DSL information fragments is constructed. A retrieval agent searches this knowledge base for policy DSL information fragments matching the recall instructions, accurately recalling multiple policy DSL information fragments related to the policy DSL information generation task, ensuring the reliability and accuracy of the generated policy DSL information. Further, multiple policy DSL information fragments are integrated into meaningful prompt words. A generation agent then generates grammatically compliant policy DSL information that meets the requirements of the initial instruction based on these prompt words, solving the problems of low efficiency and error-proneness in manually writing information. This achieves end-to-end intelligent generation from instruction to executable policy DSL information. In other words, this specification utilizes a hybrid agent collaborative architecture including a rewriting agent, a retrieval agent, and a generation agent to automate the generation of policy DSL information, improving the quality of the generated policy DSL information, policy rule coverage, and system maintainability.

[0095] In one embodiment, such as Figure 5 The diagram shown is a flowchart illustrating a strategy DSL information generation method provided in an embodiment of this specification. This method can be implemented using a computer program and can run on a strategy DSL information generation device based on the von Neumann architecture. This computer program can be integrated into an application or run as a standalone utility application.

[0096] Specifically, the method for generating DSL information under this strategy includes:

[0097] S302. Construct a DSL knowledge base.

[0098] See S202 above, which will not be repeated here.

[0099] S304. Obtain the initial instruction, and generate multiple recall instructions by rewriting the agent to parse the policy information corresponding to the initial instruction.

[0100] See S102 above, which will not be repeated here.

[0101] S306. Based on multiple recall instructions, the retrieval agent uses a vector library and knowledge base pre-built according to the retrieval enhancement RAG technology to retrieve strategy DSL information fragments that match the recall instructions in the DSL knowledge base.

[0102] Retrieval Enhancement Generation (RAG) is an artificial intelligence architecture that integrates information retrieval and text generation. The knowledge base is a searchable subset prepared for the RAG task, typically consisting of semantically retrieval-suitable portions of the DSL knowledge base. The vector library is a vectorized index of unstructured content used for rapid semantic similarity calculation; it serves as the index layer in the RAG-based architecture.

[0103] During retrieval, the retrieval agent generates query vectors for each recall instruction using the same embedding model as in the vector library pre-construction phase. It then performs an ANN search within the vector library to obtain a Top-K list of rag_id entries and merges multiple results. These results are deduplicated and sorted by relevance score to locate multiple candidate policy DSL information fragments related to the recall instruction. Further, the agent loads the complete candidate policy DSL information fragments corresponding to the candidate policy DSL information fragments into the DSL knowledge base and performs a secondary screening to determine the policy DSL information fragment matching the recall instruction.

[0104] In this embodiment, the strategy DSL information fragments that match the recall instructions are retrieved using the retrieval enhancement RAG technology, which can improve the accuracy of the retrieval. Furthermore, subsequent updates only require updating the DSL knowledge base and synchronizing the vector library, without needing to reconstruct the retrieval logic, thus improving system maintainability.

[0105] In one embodiment, the policy DSL information fragment includes a policy DSL code fragment that matches the recall instruction and the syntax rules of the policy DSL code fragment. For example, if the policy information of the initial instruction includes the policy description text "Reject transaction when user risk is high" and the recall instruction is "How to express the action statement of 'reject transaction' in DSL", then the policy DSL code fragment representing the rejection of transaction and the syntax rules of the policy DSL code fragment are retrieved based on the recall instruction.

[0106] S308. Integrate multiple policy DSL information fragments into a prompt word, and generate policy DSL information corresponding to the initial instruction based on the prompt word by generating an intelligent agent.

[0107] See S104 above; it will not be repeated here.

[0108] like Figure 6 As shown, Figure 6 This is a schematic diagram of a strategy DSL information generation system provided in an embodiment of this specification. In the strategy DSL information generation system 300 provided in this embodiment, the access layer 301 allows users to input initial instructions via a web page or by calling a software app. For example, a user can input the strategy description text "Reject transaction when user risk is high" in a designated input box on the web page, which represents an initial instruction to generate the strategy DSL information corresponding to the strategy description text.

[0109] In the core layer 302, multiple recall instructions are generated by rewriting the policy information corresponding to the initial instruction parsing of the agent.

[0110] Storage layer 303 stores a DSL knowledge base, which includes structured data, unstructured data, and policy metadata associated with policy DSL information fragments.

[0111] The retrieval agent in core layer 302 uses a vector library and knowledge base pre-built based on retrieval enhancement RAG technology to retrieve strategy DSL information fragments that match the recall instruction in the DSL knowledge base.

[0112] The prompt word agent integrates multiple policy DSL information fragments into a prompt word.

[0113] The generating agent in the core layer 302 generates policy DSL information corresponding to the initial instruction based on the prompt words and the DSL knowledge base in the storage layer 303, and outputs it to the user for viewing.

[0114] This specification addresses the issue of insufficient recall in complex policy scenarios by rewriting the agent's parsing of a single initial instruction, expanding it to include multiple recall instructions covering more dimensions. This improves the breadth and diversity of knowledge retrieval. Furthermore, a pre-built DSL knowledge base containing numerous policy DSL information fragments is constructed. A retrieval agent searches this knowledge base for policy DSL information fragments matching the recall instructions, accurately recalling multiple policy DSL information fragments related to the policy DSL information generation task, ensuring the reliability and accuracy of the generated policy DSL information. Further, multiple policy DSL information fragments are integrated into meaningful prompt words. A generation agent then generates grammatically compliant policy DSL information that meets the requirements of the initial instruction based on these prompt words, solving the problems of low efficiency and error-proneness in manually writing information. This achieves end-to-end intelligent generation from instruction to executable policy DSL information. In other words, this specification utilizes a hybrid agent collaborative architecture including a rewriting agent, a retrieval agent, and a generation agent to automate the generation of policy DSL information, improving the quality of the generated policy DSL information, policy rule coverage, and system maintainability.

[0115] The following are embodiments of the apparatus described in this specification, which can be used to execute the embodiments of the methods described in this specification. For details not disclosed in the apparatus embodiments of this specification, please refer to the embodiments of the methods described in this specification.

[0116] Please see Figure 7 This diagram illustrates the structure of a policy DSL information generation apparatus provided in an exemplary embodiment of this specification. The policy DSL information generation apparatus can be implemented as all or part of an apparatus through software, hardware, or a combination of both. The policy DSL information generation apparatus includes an instruction generation module 401, an information retrieval module 402, and an information generation module 403.

[0117] The instruction generation module 401 is used to generate at least one recall instruction corresponding to different dimensions by rewriting the agent to parse the policy information corresponding to the initial instruction based on multiple dimensions; wherein, the multiple dimensions include at least one of the following dimensions: syntax structure, conditional logic, policy semantics, and reference relationship.

[0118] Information retrieval module 402 is used to retrieve, based on multiple recall instructions, a retrieval agent to retrieve policy DSL information fragments that match the recall instructions from the DSL knowledge base;

[0119] The information generation module 403 is used to integrate multiple policy DSL information fragments into a prompt word, and generate policy DSL information corresponding to the initial instruction by generating an intelligent agent based on the prompt word.

[0120] In one embodiment, the information retrieval module 402 includes:

[0121] The information retrieval unit is used to retrieve strategy DSL information fragments that match the recall instructions from the DSL knowledge base by a retrieval agent using a vector library and knowledge base pre-built according to the Retrieval-Augmented Generation (RAG) technology, based on multiple recall instructions.

[0122] In one embodiment, the policy DSL information generation apparatus further includes:

[0123] A knowledge base construction module is used to construct a DSL knowledge base; wherein, the DSL knowledge base stores structured data, unstructured data, and policy metadata associated with policy DSL information fragments.

[0124] In one embodiment, the knowledge base building module includes:

[0125] The information segmentation unit is used to segment the initial policy DSL information according to the preset segmentation rules to obtain multiple policy DSL information fragments;

[0126] An information storage unit is used to store multiple policy DSL information fragments into a DSL knowledge base and to establish vector index items associated with the policy DSL information fragments.

[0127] In one embodiment, the policy DSL information generation apparatus further includes:

[0128] The data acquisition module is used to acquire user-input data including the initial policy DSL code and / or policy description text, and analyze the data to obtain initial instructions including policy information.

[0129] In one embodiment, the data to be processed includes an initial policy DSL code, and the information generation module 403 includes:

[0130] The first generation unit is used to integrate multiple policy DSL information fragments into prompt words, and generate an agent to continue writing the initial policy DSL code based on the prompt words to obtain policy DSL information.

[0131] In one embodiment, the data to be processed includes the strategy description text, and the information generation module 403 includes:

[0132] The second generation unit is used to integrate multiple policy DSL information fragments into prompt words, and generate policy DSL code corresponding to the policy description text and the syntax rules of the policy DSL code as policy DSL information based on the prompt words by a generating agent.

[0133] In one embodiment, the policy DSL information fragment includes a policy DSL code fragment that matches the recall instruction and the syntax rules of the policy DSL code fragment.

[0134] This specification addresses the issue of insufficient recall in complex policy scenarios by rewriting the agent's parsing of a single initial instruction, expanding it to include multiple recall instructions covering more dimensions. This improves the breadth and diversity of knowledge retrieval. Furthermore, a pre-built DSL knowledge base containing numerous policy DSL information fragments is constructed. A retrieval agent searches this knowledge base for policy DSL information fragments matching the recall instructions, accurately recalling multiple policy DSL information fragments related to the policy DSL information generation task, ensuring the reliability and accuracy of the generated policy DSL information. Further, multiple policy DSL information fragments are integrated into meaningful prompt words. A generation agent then generates grammatically compliant policy DSL information that meets the requirements of the initial instruction based on these prompt words, solving the problems of low efficiency and error-proneness in manually writing information. This achieves end-to-end intelligent generation from instruction to executable policy DSL information. In other words, this specification utilizes a hybrid agent collaborative architecture including a rewriting agent, a retrieval agent, and a generation agent to automate the generation of policy DSL information, improving the quality of the generated policy DSL information, policy rule coverage, and system maintainability.

[0135] It should be noted that the strategy DSL information generation device provided in the above embodiments is only illustrated by the division of the above functional modules when executing the strategy DSL information generation method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the strategy DSL information generation device and the strategy DSL information generation method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.

[0136] The example numbers in this specification are for descriptive purposes only and do not represent the superiority or inferiority of the examples.

[0137] This specification also provides a computer storage medium that can store multiple instructions adapted to be loaded and executed by a processor as described above. Figure 1 - Figure 6 The strategy DSL information generation method of the illustrated embodiment can be found in the following document for details of its execution. Figure 1 - Figure 6 The specific details of the illustrated embodiments will not be elaborated here.

[0138] This specification also provides a computer program product that stores at least one instruction, which is loaded and executed by a processor as described above. Figure 1 - Figure 6 The strategy DSL information generation method of the illustrated embodiment can be found in the following document for details of its execution. Figure 1 - Figure 6 The specific details of the illustrated embodiments will not be elaborated here.

[0139] Please see Figure 8 This document provides a schematic diagram of the structure of an electronic device as an embodiment of the present specification. Figure 8 As shown, the electronic device 500 may include: at least one processor 501, at least one network interface 504, user interface 503, memory 505, and at least one communication bus 502.

[0140] The communication bus 502 is used to enable communication between these components.

[0141] The user interface 503 may include a display screen and a camera. Optionally, the user interface 503 may also include a standard wired interface and a wireless interface.

[0142] The network interface 504 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0143] The processor 501 may include one or more processing cores. The processor 501 connects to various parts within the electronic device 500 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 505, and by calling data stored in the memory 505. Optionally, the processor 501 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 501 may integrate one or a combination of several of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 501 and may be implemented as a separate chip.

[0144] The memory 505 may include random access memory (RAM) or read-only memory. Optionally, the memory 505 may include a non-transitory computer-readable storage medium. The memory 505 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 505 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 505 may also be at least one storage device located remotely from the aforementioned processor 501. Figure 8 As shown, the memory 505, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a policy DSL information generation application.

[0145] exist Figure 8 In the illustrated electronic device 500, the user interface 503 is mainly used to provide an input interface for the user and to obtain the user's input data; while the processor 501 can be used to call the policy DSL information generation application stored in the memory 505 and specifically perform the following operations:

[0146] The initial instruction is obtained, and the agent is rewritten to parse the policy information corresponding to the initial instruction based on multiple dimensions to generate at least one recall instruction corresponding to different dimensions; wherein, the multiple dimensions include at least one of the following dimensions: syntax structure, conditional logic, policy semantics, and reference relationship;

[0147] Based on multiple recall instructions, a retrieval agent searches the DSL knowledge base for policy DSL information fragments that match the recall instructions.

[0148] Multiple policy DSL information fragments are integrated into a prompt word, and a generating agent generates policy DSL information corresponding to the initial instruction based on the prompt word.

[0149] In one embodiment, the processor 501 executes the method based on multiple recall instructions, and retrieves a policy DSL information fragment matching the recall instructions from the DSL knowledge base by a retrieval agent, specifically:

[0150] Based on multiple recall instructions, the retrieval agent uses a vector library and knowledge base pre-built according to Retrieval-Augmented Generation (RAG) technology to retrieve policy DSL information fragments that match the recall instructions from the DSL knowledge base.

[0151] In one embodiment, before the processor 501 executes the retrieval of a policy DSL information fragment matching the recall instruction in the DSL knowledge base by the retrieval agent based on the plurality of recall instructions, it also performs the following:

[0152] Construct a DSL knowledge base; wherein the DSL knowledge base stores structured data, unstructured data, and policy metadata associated with policy DSL information fragments.

[0153] In one embodiment, processor 501 executes the construction of the DSL knowledge base, specifically by performing:

[0154] The initial policy DSL information is segmented according to the preset segmentation rules to obtain multiple policy DSL information fragments;

[0155] Multiple policy DSL information fragments are stored in the DSL knowledge base, and vector index items associated with the policy DSL information fragments are established.

[0156] In one embodiment, before the processor 501 executes the initial instruction and generates multiple recall instructions by rewriting the agent to parse the policy information corresponding to the initial instruction, it also executes:

[0157] Obtain user-input data including the initial policy DSL code and / or policy description text, and analyze the data to obtain initial instructions including policy information.

[0158] In one embodiment, the data to be processed includes an initial policy DSL code. The processor 501 executes the step of integrating multiple policy DSL information fragments into a prompt word, and generating an agent to generate policy DSL information corresponding to the initial instruction based on the prompt word. Specifically, the following steps are performed:

[0159] Multiple policy DSL information fragments are integrated into a prompt word, and an agent is generated to continue writing the initial policy DSL code based on the prompt word to obtain policy DSL information.

[0160] In one embodiment, the data to be processed includes the policy description text. The processor 501 performs the step of integrating multiple policy DSL information fragments into a prompt word, and generating a policy DSL information corresponding to the initial instruction based on the prompt word by a generating agent. Specifically, the following steps are performed:

[0161] Multiple policy DSL information fragments are integrated into a prompt word. A generating agent then generates the policy DSL code corresponding to the policy description text and the syntax rules of the policy DSL code based on the prompt word, which serve as policy DSL information.

[0162] In one embodiment, the policy DSL information fragment includes a policy DSL code fragment that matches the recall instruction and the syntax rules of the policy DSL code fragment.

[0163] This specification addresses the issue of insufficient recall in complex policy scenarios by rewriting the agent's parsing of a single initial instruction, expanding it to include multiple recall instructions covering more dimensions. This improves the breadth and diversity of knowledge retrieval. Furthermore, a pre-built DSL knowledge base containing numerous policy DSL information fragments is constructed. A retrieval agent searches this knowledge base for policy DSL information fragments matching the recall instructions, accurately recalling multiple policy DSL information fragments related to the policy DSL information generation task, ensuring the reliability and accuracy of the generated policy DSL information. Further, multiple policy DSL information fragments are integrated into meaningful prompt words. A generation agent then generates grammatically compliant policy DSL information that meets the requirements of the initial instruction based on these prompt words, solving the problems of low efficiency and error-proneness in manually writing information. This achieves end-to-end intelligent generation from instruction to executable policy DSL information. In other words, this specification utilizes a hybrid agent collaborative architecture including a rewriting agent, a retrieval agent, and a generation agent to automate the generation of policy DSL information, improving the quality of the generated policy DSL information, policy rule coverage, and system maintainability.

[0164] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented. Each of the above methods can be executed by a computer program instructing related hardware. The program corresponding to the above methods can be stored in a computer-readable storage medium. When executed, the program can include the processes of the embodiments of the above methods. The storage medium of the electronic device 500 can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.

[0165] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0166] The above-disclosed embodiments are merely preferred embodiments of this specification and should not be construed as limiting the scope of this specification. Therefore, any equivalent variations made in accordance with the claims of this specification shall still fall within the scope of this specification.< / action> < / condition>

Claims

1. A method for generating strategy DSL information, characterized in that, The method includes: The initial instruction is obtained, and the agent is rewritten to parse the policy information corresponding to the initial instruction based on multiple dimensions to generate at least one recall instruction corresponding to different dimensions; wherein, the multiple dimensions include at least one of the following dimensions: syntax structure, conditional logic, policy semantics, and reference relationship; Based on multiple recall instructions, a retrieval agent searches the DSL knowledge base for policy DSL information fragments that match the recall instructions. Multiple policy DSL information fragments are integrated into a prompt word, and a generating agent generates policy DSL information corresponding to the initial instruction based on the prompt word; The step of retrieving a policy DSL information fragment matching the recall instruction from the DSL knowledge base based on multiple recall instructions by a retrieval agent includes: Based on multiple recall instructions, the retrieval agent uses a vector library and knowledge base pre-built according to retrieval enhancement technology to retrieve strategy DSL information fragments that match the recall instructions in the DSL knowledge base. The method further includes, prior to retrieving a policy DSL information fragment matching the recall instruction from the DSL knowledge base by a retrieval agent based on multiple recall instructions: Construct a DSL knowledge base; wherein, the DSL knowledge base stores structured data, unstructured data, and policy metadata associated with policy DSL information fragments; The construction of the DSL knowledge base includes: The initial policy DSL information is segmented according to the preset segmentation rules to obtain multiple policy DSL information fragments; Multiple policy DSL information fragments are stored in the DSL knowledge base, and vector index items associated with the policy DSL information fragments are established.

2. The method for generating strategy DSL information according to claim 1, characterized in that, Before obtaining the initial instruction and generating multiple recall instructions by rewriting the agent to parse the policy information corresponding to the initial instruction, the process further includes: Obtain user-input data including the initial policy DSL code and / or policy description text, and analyze the data to obtain initial instructions including policy information.

3. The strategy DSL information generation method according to claim 2, characterized in that, The data to be processed includes an initial policy DSL code. The step of integrating multiple policy DSL information fragments into a prompt word, and generating policy DSL information corresponding to the initial instruction based on the prompt word by a generating agent, includes: Multiple policy DSL information fragments are integrated into a prompt word, and an agent is generated to continue writing the initial policy DSL code based on the prompt word to obtain policy DSL information.

4. The method for generating strategy DSL information according to claim 2, characterized in that, The data to be processed includes the policy description text. The process of integrating multiple policy DSL information fragments into prompt words, and generating policy DSL information corresponding to the initial instruction based on the prompt words by a generating agent, includes: Multiple policy DSL information fragments are integrated into a prompt word. A generating agent then generates the policy DSL code corresponding to the policy description text and the syntax rules of the policy DSL code based on the prompt word, which serve as policy DSL information.

5. The method for generating strategy DSL information according to claim 1, characterized in that, The policy DSL information fragment includes a policy DSL code fragment that matches the recall instruction and the syntax rules of the policy DSL code fragment.

6. A strategy DSL information generation device, characterized in that, The device includes: The instruction generation module is used to obtain an initial instruction and, by rewriting the agent, parses the policy information corresponding to the initial instruction based on multiple dimensions to generate at least one recall instruction corresponding to different dimensions; wherein, the multiple dimensions include at least one of the following dimensions: syntax structure, conditional logic, policy semantics, and reference relationship; The information retrieval module is used to retrieve, based on multiple recall instructions, a retrieval agent to retrieve policy DSL information fragments that match the recall instructions from the DSL knowledge base; The information generation module is used to integrate multiple policy DSL information fragments into prompt words, and generate policy DSL information corresponding to the initial instruction by generating an intelligent agent based on the prompt words; The information retrieval module includes: The information retrieval unit is used to retrieve strategy DSL information fragments that match the recall instructions in the DSL knowledge base by a retrieval agent using a vector library and knowledge base pre-constructed according to retrieval enhancement technology, based on multiple recall instructions. The policy DSL information generation device further includes: A knowledge base construction module is used to construct a DSL knowledge base; wherein, the DSL knowledge base stores structured data, unstructured data, and policy metadata associated with policy DSL information fragments; The knowledge base construction module includes: The information segmentation unit is used to segment the initial policy DSL information according to the preset segmentation rules to obtain multiple policy DSL information fragments; An information storage unit is used to store multiple policy DSL information fragments into a DSL knowledge base and to establish vector index items associated with the policy DSL information fragments.

7. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions, which are adapted to be loaded by a processor and executed as the method steps of any one of claims 1 to 5.

8. A computer program product, characterized in that, The computer program product stores multiple instructions, which are adapted to be loaded by a processor and executed as the method steps of any one of claims 1 to 5.

9. An electronic device, characterized in that, include: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed the method steps as claimed in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Multi-strategy intelligent question and answer method, system and equipment and medium

    CN119918646A

  • Enterprise-level schedule planning and knowledge base oriented intelligent collaborative question-answering system and method

    CN120296140A