Data processing method and device, storage medium and electronic equipment

By using security barriers to perform multi-level checks on user input and then reviewing it again after processing with a natural language model, the problem of low efficiency in manual checks is solved. This enables real-time, automated security checks and compliant output, reducing security risks.

CN120974485APending Publication Date: 2025-11-18TRAVELSKY TECHNOLOGY LIMITED
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511105424.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-07
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

Existing technologies that rely on manual methods for security checks on user input and model output are inefficient, fail to meet real-time processing requirements, and suffer from subjectivity and inconsistency issues in manual review, leading to increased security risks.

Method used

A multi-level security check is performed on user input using a security guardrail, including topic security check, dialogue security check, and attack detection. After ensuring that the input is compliant, it is processed by a natural language model and subjected to security check again to generate the final response information.

Benefits of technology

It enables real-time, automated security checks on user input, reducing delays and error rates in manual review, ensuring the security and compliance of model output, and improving detection efficiency and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120974485A_ABST
    Figure CN120974485A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method and device, a storage medium and electronic equipment. Relates to the technical field of artificial intelligence, and the method comprises the steps: obtaining question information inputted by a target object, and carrying out the safety detection of the question information through a safety guardrail, and obtaining a target detection result; under the condition that the target detection result represents that the security detection is passed, processing the question information through a natural language model to obtain initial reply information; and carrying out safety detection on the initial reply information through the safety guardrail, and obtaining target reply information for replying to the target object according to the initial reply information under the condition that the safety detection is passed. Through the method and the device, the problem of relatively low detection efficiency caused by performing safety detection on input of a user and output of a model based on a manual mode in related technologies is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and more specifically, to a data processing method and apparatus, a storage medium and an electronic device. Background Technology

[0002] In the field of electronic information technology, especially with the rise of large language models, enterprises are increasingly relying on these models for data processing and decision support. However, current human-based security detection mechanisms have revealed significant shortcomings in ensuring information security during the interaction of large language models: On the one hand, in AI-driven business scenarios, the speed of human review of user input and model output cannot match the demands of real-time processing, leading to increased latency and a degraded user experience. Particularly in the civil aviation sector, facing massive real-time inquiry requests and rapidly changing market dynamics, the speed of human review lags far behind the pace of business development, making it difficult to effectively filter non-compliant or potentially dangerous input and output information in a timely manner. On the other hand, the subjectivity and consistency of human review are difficult to guarantee, especially when processing large amounts of data, which can easily lead to oversights. This may expose the model to security risks such as information leakage and ethical violations.

[0003] There is currently no effective solution to the problem of low detection efficiency caused by the manual method of security detection of user input and model output in related technologies. Summary of the Invention

[0004] The main objective of this application is to provide a data processing method and apparatus, storage medium and electronic device to solve the problem of low detection efficiency caused by the manual method of security detection of user input and model output in related technologies.

[0005] To achieve the above objectives, according to one aspect of this application, a data processing method is provided. The method includes: acquiring question information input by a target object, and performing a security check on the question information using a security barrier to obtain a target detection result; if the target detection result indicates that the security check has passed, processing the question information using a natural language model to obtain initial response information; performing a security check on the initial response information using the security barrier, and if the security check passes, obtaining target response information to reply to the target object based on the initial response information.

[0006] Furthermore, the security detection of the question information through the security guardrail to obtain the target detection result includes: performing topic security detection on the question information to obtain a first detection result; if the first detection result indicates that the detection is passed, performing dialogue security detection on the question information to obtain a second detection result; if the second detection result indicates that the detection is passed, performing attack detection on the question information to obtain a third detection result; and obtaining the target detection result based on the third detection result.

[0007] Further, performing topic security detection on the question information to obtain a first detection result includes: performing intent recognition on the question information to obtain a recognition result; matching the recognition result with topics in a preset topic library to obtain a first matching result; if the first matching result indicates that there is a topic in the preset topic library that matches the recognition result, then the first detection result is a successful detection.

[0008] Further, performing dialogue security detection on the question information to obtain a second detection result includes: matching the question information with knowledge in a preset knowledge base to obtain a second matching result; if the second matching result indicates that there is target knowledge in the preset knowledge base that matches the question information, then the second detection result is a successful detection; if the second matching result indicates that there is no knowledge in the preset knowledge base that matches the question information, then the second detection result is a failed detection.

[0009] Furthermore, the attack detection of the problem information to obtain the third detection result includes: obtaining the operation log of the target object; analyzing the attack behavior of the operation log to achieve attack detection of the problem information and obtain the third detection result.

[0010] Furthermore, before processing the question information using a natural language model to obtain initial response information, the method further includes: obtaining a prompt word template that matches the question information, and adding the question information and the target knowledge to the prompt word template to obtain a target prompt word; processing the question information using a natural language model to obtain initial response information includes: processing the target prompt word using the natural language model to obtain the initial response information.

[0011] Furthermore, processing the question information using a natural language model to obtain initial response information includes: reasoning about the question information using the natural language model and determining whether external resources need to be invoked based on the reasoning result; if it is determined that external resources need to be invoked, invoking the external resource interface through the model context protocol to obtain external knowledge information; and processing the external knowledge information using the natural language model to obtain the initial response information.

[0012] Furthermore, after obtaining external knowledge information by calling the external resource interface through the model context protocol, the method further includes: performing sensitive information detection on the external knowledge information through a retrieval guardrail to obtain a fourth detection result; if the fourth detection result indicates the presence of a first type of sensitive word, then the external knowledge information is masked, wherein the natural language model outputs the initial response information based on the masked external knowledge information; if the fourth detection result indicates the presence of a second type of sensitive word, then the external knowledge information is intercepted, and the natural language model is instructed to output a preset response script.

[0013] To achieve the above objectives, according to another aspect of this application, a data processing apparatus is provided. The apparatus includes: a first acquisition unit, configured to acquire question information input by a target object, and perform a security check on the question information through a security barrier to obtain a target detection result; a first processing unit, configured to process the question information using a natural language model to obtain initial response information if the target detection result indicates that the security check has passed; and a determination unit, configured to perform a security check on the initial response information through the security barrier, and, if the security check has passed, obtain target response information to reply to the target object based on the initial response information.

[0014] Further, the first acquisition unit includes: a first detection subunit, used to perform topic security detection on the question information to obtain a first detection result; a second detection subunit, used to perform dialogue security detection on the question information if the first detection result indicates that the detection has passed, to obtain a second detection result; a third detection subunit, used to perform attack detection on the question information if the second detection result indicates that the detection has passed, to obtain a third detection result; and a determination subunit, used to obtain the target detection result based on the third detection result.

[0015] Further, the first detection subunit includes: an identification module, used to perform intent identification on the question information to obtain an identification result; a first matching module, used to match the identification result with topics in a preset topic library to obtain a first matching result; and a first determination module, used to determine that if the first matching result indicates that there is a topic in the preset topic library that matches the identification result, then the first detection result is a successful detection.

[0016] Furthermore, the second detection subunit includes: a second matching module, used to match the question information with knowledge in a preset knowledge base to obtain a second matching result; a second determining module, used to determine that if the second matching result indicates that there is target knowledge in the preset knowledge base that matches the question information, then the second detection result is a successful detection; and a third determining module, used to determine that if the second matching result indicates that there is no knowledge in the preset knowledge base that matches the question information, then the second detection result is a failed detection.

[0017] Furthermore, the third detection subunit includes: an acquisition module for acquiring the operation log of the target object; and an analysis module for analyzing the operation log to perform attack behavior analysis, thereby achieving attack detection of the problem information and obtaining the third detection result.

[0018] Furthermore, the device further includes: a second acquisition unit, configured to acquire a prompt word template matching the question information before processing the question information through a natural language model to obtain initial response information, and add the question information and the target knowledge to the prompt word template to obtain a target prompt word; and a first processing unit, further configured to process the target prompt word through the natural language model to obtain the initial response information.

[0019] Further, the first processing unit includes: a reasoning subunit, used to reason about the question information through the natural language model and determine whether it is necessary to call external resources based on the reasoning result; a calling subunit, used to call the external resource interface through the model context protocol to obtain external knowledge information when it is determined that the external resources need to be called; and a processing subunit, used to process the external knowledge information through the natural language model to obtain the initial response information.

[0020] Furthermore, the device further includes: a detection unit, configured to perform sensitive information detection on the external knowledge information by means of a retrieval guardrail after obtaining external knowledge information by calling an external resource interface through a model context protocol, and obtain a fourth detection result; a second processing unit, configured to perform occlusion processing on the external knowledge information if the fourth detection result indicates the presence of a first type of sensitive word, wherein the natural language model outputs the initial response information based on the occluded external knowledge information; and an interception unit, configured to intercept the external knowledge information if the fourth detection result indicates the presence of a second type of sensitive word, and instruct the natural language model to output a preset response script.

[0021] According to another aspect of the present invention, an electronic device is also provided, comprising: a memory storing an executable program; and a processor for running the program, wherein the program executes the data processing method described above during runtime.

[0022] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein the storage medium stores a program, and the program controls the device where the storage medium is located to execute the data processing method described above when it is running.

[0023] In this embodiment, the following steps are adopted: obtaining the question information input by the target object, and performing security detection on the question information through a security guardrail to obtain the target detection result; if the target detection result indicates that the security detection has passed, processing the question information through a natural language model to obtain initial response information; performing security detection on the initial response information through a security guardrail, and if the security detection has passed, obtaining the target response information to the target object based on the initial response information. This solves the technical problem in related technologies where security detection of user input and model output based on manual methods results in low detection efficiency.

[0024] In this solution, the security barrier performs real-time, automatic security checks on user-input questions, providing immediate feedback on potential security issues or violations, ensuring input security before model processing. If the security check is passed, a natural language model processes the question information. The initial response generated by the model is also automatically reviewed by the security barrier, enabling immediate identification and correction of security issues in the output, ensuring the final response is safe and compliant. This automated security barrier reduces reliance on manual review, lowering operational delays and error rates caused by human intervention, thereby improving security detection efficiency. Attached Figure Description

[0025] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0026] Figure 1 A hardware structure block diagram of a computer terminal for implementing a data processing method is shown.

[0027] Figure 2 This is a flowchart of a data processing method provided according to an embodiment of this application;

[0028] Figure 3 This is a schematic diagram of the data processing method provided in the embodiments of this application. Figure 1 ;

[0029] Figure 4 This is a schematic diagram of the data processing method provided in the embodiments of this application. Figure 2 ;

[0030] Figure 5 This is a schematic diagram of the data processing method provided in the embodiments of this application. Figure 3 ;

[0031] Figure 6 This is a schematic diagram of the data processing method provided in the embodiments of this application. Figure 4 ;

[0032] Figure 7 This is a schematic diagram of a data processing apparatus provided according to an embodiment of this application;

[0033] Figure 8 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0034] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0035] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0036] It should be noted that the information collected in this application (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of this data all comply with relevant laws, regulations, and standards, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding access points are provided for users to choose to authorize or refuse. For example, interfaces are set up between this system and relevant users or organizations, providing users with corresponding access points to choose to agree to or refuse automated decision-making results; if the user chooses to refuse, the process proceeds to the expert decision-making stage.

[0037] Example 1

[0038] According to an embodiment of this application, a method embodiment for data processing is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0039] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing a data processing method is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0040] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0041] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the data processing method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the aforementioned data processing method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0042] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0043] The display may be a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).

[0044] Under the aforementioned operating environment, this application provides the following: Figure 2 The data processing method shown. Figure 2 This is a flowchart of a data processing method according to Embodiment 1 of this application. The data processing method includes:

[0045] Step S201: Obtain the problem information input by the target object, and perform security detection on the problem information through the security guardrail to obtain the target detection result.

[0046] Optionally, the model gateway can receive user (i.e., the target object mentioned above) question information through its access layer. This question information is typically submitted in text format and can be a specific inquiry about products, services, rules, etc. For example, a user might want to inquire about the lowest ticket price from Beijing to Shanghai a week from now. After receiving the information, the model gateway will perform preliminary parsing of the input information, identifying basic semantics and intent, and then pass it to the security barrier for further analysis and detection.

[0047] The security guard will perform a series of security checks on the parsed question information, including but not limited to: Format validation: Checking whether the input information conforms to the prescribed format requirements, such as length and grammatical structure, to prevent system anomalies caused by malicious input or format incompatibility. Sensitive word filtering: Using a pre-defined list of sensitive words and regular expressions, filtering out potentially inappropriate words or phrases to prevent user abuse or misuse of the platform. Malicious intent identification: Using deep learning models, such as BERT, to perform semantic analysis on the input information to identify whether there is an intent to induce the model to generate illegal or unethical content. Topic limitation verification: Confirming whether the question is within the preset topic or domain scope to prevent the model from processing questions beyond its expertise, leading to incorrect output or misleading results.

[0048] After the safety barrier completes all checks, a target detection result is generated, clearly indicating whether the input information has passed the security checks. If the detection result shows a security or compliance issue, the input will be marked as non-compliant, and appropriate measures will be taken, such as refusing to process it, returning an error message, or requiring correction before processing. If all checks pass, the target detection result is considered safe, and the problematic information will be considered compliant, allowing the process to proceed to the next step.

[0049] In an optional embodiment, the user sends a question to the unified access layer of the model gateway via an HTTP request, such as "Query the lowest ticket price for a flight to Shanghai next week." The model gateway first parses the parameters in the HTTP request to understand the user's need, namely, to query ticket information. A security guard performs a security check to ensure that the request does not contain malicious content or words that violate security rules, obtaining the corresponding target detection results.

[0050] Step S202: If the target detection result indicates that the security detection has passed, the question information is processed by a natural language model to obtain the initial response information.

[0051] Optionally, if the object detection result indicates that the security check has passed, the natural language model will first perform a deep understanding of the question information, extracting key information and intent. It will analyze the semantics of the text to understand the questioner's needs and background. If the question involves domain-specific expertise or requires real-time data support, the model can use the MCP protocol (Model Context Protocol, a protocol specifically designed for communication between large models (especially large language models, LLMs) and their related applications and services) to call external knowledge bases, databases, or API services, retrieve relevant information, and integrate it into the model's processing. The natural language model can generate more accurate and practical answers based on a more comprehensive knowledge system. After understanding the question and retrieving the necessary knowledge, the natural language model will generate initial response information based on its internal logic and training experience. After the model processing is complete, the generated initial response information will be transmitted back to the model gateway.

[0052] Step S203: Perform a security check on the initial response information through the security barrier, and if the security check passes, obtain the target response information for the target object based on the initial response information.

[0053] Optionally, the model gateway receives initial response information generated based on the user's question from the natural language model. The security barrier performs in-depth analysis of the initial response information to check for any content that violates security standards or compliance requirements. Specific security checks include, but are not limited to: Content review: Using technologies such as keyword matching and semantic understanding, ensuring that the response does not contain sensitive information, illegal content, ethical violations, or potentially misleading information. Quality check: Evaluating the accuracy and completeness of the responses to ensure they conform to expected business logic and user needs. Security policy verification: Confirming whether the response information violates preset security policies, for example, whether it contains information or code that can be maliciously exploited.

[0054] Information that passes security checks can be further optimized, such as by adjusting its format to better suit specific business or user interface requirements. The model gateway then encapsulates this optimized response information, preparing it for transmission to the user. Finally, the security-checked and optimized response information is returned to the target object via the model gateway as the intended response.

[0055] In summary, the security barrier performs real-time, automated security checks on user-input questions, providing immediate feedback on potential security issues or violations, ensuring input security before model processing. Once the security check is passed, a natural language model processes the question information. The initial response generated by the model is also automatically reviewed by the security barrier, enabling immediate identification and correction of security issues in the output, ensuring the final response is safe and compliant. The automated security barrier reduces reliance on manual review, lowering operational delays and error rates caused by human intervention, thereby improving security detection efficiency.

[0056] Optionally, in the data processing method provided in this application embodiment, the security detection of the problem information through the security guardrail to obtain the target detection result includes: performing topic security detection on the problem information to obtain a first detection result; if the first detection result indicates that the detection is passed, performing dialogue security detection on the problem information to obtain a second detection result; if the second detection result indicates that the detection is passed, performing attack detection on the problem information to obtain a third detection result; and obtaining the target detection result based on the third detection result.

[0057] In an optional embodiment, the security check on the question information includes the following: topic security check of the question information. The purpose of topic security check is to confirm whether the question information entered by the user belongs to a preset topic or business domain. For example, it can be compared with a knowledge graph or keyword database of a specific domain to ensure that the model only generates content within the authorized domain, avoiding processing questions outside its expertise, thereby improving the accuracy and relevance of the response. By limiting the topic, it can effectively prevent the model from generating responses that are irrelevant to the business, of low quality, or potentially misleading content, ensuring the professionalism and accuracy of the model's output, and improving the user experience and the company's service quality.

[0058] Then, if the first detection result indicates that the detection is successful, a dialogue security detection is performed on the question information. For example, semantic analysis is performed to check whether it contains misleading, biased, discriminatory language or other potentially harmful information to obtain a second detection result.

[0059] If the second detection result indicates that the detection is successful, attack detection is performed, including but not limited to malicious code injection, malicious hint engineering, or attempts to bypass security policies. Deep semantic analysis and pattern matching can be used to ensure that the model cannot be exploited to perform harmful operations. Implementing attack detection can significantly enhance platform security, prevent malicious users from exploiting the model for attacks or abuse, and protect the integrity of the system and the security of user data. Simultaneously, it can maintain the normal operation of the model, avoiding service interruptions or performance degradation due to security vulnerabilities.

[0060] The above-described detection process ensures that the issue information not only meets business requirements but also receives comprehensive protection in terms of dialogue security and prevention of malicious attacks. Only when the issue information passes all three stages of detection—topic security detection, dialogue security detection, and attack detection—is it considered safe and compliant, allowing the model to process it. This multi-layered and comprehensive security detection mechanism improves the overall security of the model gateway and provides multifaceted guarantees for the quality of the model's output, avoiding potential risks and losses.

[0061] Optionally, in the data processing method provided in this application embodiment, performing topic security detection on the problem information to obtain a first detection result includes: performing intent recognition on the problem information to obtain a recognition result; matching the recognition result with topics in a preset topic library to obtain a first matching result; if the first matching result indicates that there is a topic in the preset topic library that matches the recognition result, then the first detection result is a successful detection.

[0062] In an optional embodiment, deep semantic analysis is performed on the question information to identify the user's true intent or the topic of the inquiry. The aforementioned identification result can be obtained through natural language processing techniques, such as semantic representation models, for intent recognition.

[0063] A pre-defined topic library is established, containing all permitted discussion topics along with related keywords and topic boundaries. This library may cover various business areas of interest to the enterprise, such as product consultation and customer service. Based on the identification results obtained from intent recognition, matching topics are searched within the pre-defined topic library. This can be achieved through keyword search, semantic similarity calculation, or other matching algorithms. If the identification result matches a topic in the pre-defined topic library—that is, if the keywords or topic in the identification result match a topic in the library—then the first matching result is "a topic matches the identification result," and the corresponding first detection result is "detection passed."

[0064] In an optional embodiment, intent recognition is performed on user input, followed by topic matching checks. This involves searching a keyword database and knowledge graph. If a match is found, a response is allowed to be generated. If a match fails, a guidance rule is triggered, and a preset prompt is output, such as "Currently, only discussions of issues in the XX domain are supported."

[0065] By effectively limiting the output range of the model and avoiding processing issues beyond the preset boundaries, the security, compliance, and professionalism of platform information are ensured, providing users with a safer, more reliable, and focused communication environment.

[0066] Optionally, in the data processing method provided in this application embodiment, performing dialogue security detection on the question information to obtain a second detection result includes: matching the question information with knowledge in a preset knowledge base to obtain a second matching result; if the second matching result indicates that there is target knowledge in the preset knowledge base that matches the question information, then the second detection result is a successful detection; if the second matching result indicates that there is no knowledge in the preset knowledge base that matches the question information, then the second detection result is a failed detection.

[0067] In an optional embodiment, a preset knowledge base can be built based on the currently relevant and responsive knowledge topics, such as authoritative documents, historical data, expert-reviewed content, etc., covering various knowledge points and best practices required by the business.

[0068] The system compares the question information with a pre-defined knowledge base to find the most relevant or answerable entry. For example, it uses techniques such as keyword search and semantic similarity calculation to find the closest knowledge match to the question information. If the pre-defined knowledge base finds target knowledge that matches or is relevant to the user's question, the second matching result indicates that knowledge exists that matches the question information, meaning the detection passes. Conversely, if no relevant entry is found in the pre-defined knowledge base, the second matching result indicates that the detection fails.

[0069] Dialogue security checks ensure that the model's output is consistent with the knowledge in the pre-set knowledge base, providing users with accurate, reliable, and compliant information services. At the same time, it effectively avoids misinformation, misleading content, and compliance risks, improving the overall performance of the model and user satisfaction.

[0070] Optionally, in the data processing method provided in this application embodiment, attack detection of problem information to obtain a third detection result includes: obtaining the operation log of the target object; performing attack behavior analysis on the operation log to achieve attack detection of problem information and obtain a third detection result.

[0071] In an optional embodiment, attack detection is a crucial security measure when processing issue information submitted through the model gateway. It aims to prevent any form of malicious behavior, such as tooltip injection, code execution, and identity impersonation. This not only protects the integrity of the system but also safeguards user data security and privacy. First, the operation logs of the target object are obtained. Operation logs are records of the system's activity history, containing all details of user interactions with the system. During the attack detection phase, the model gateway needs to collect the activity records of the target object (typically a user or application) within the system.

[0072] After obtaining the operation logs, attack behavior analysis is performed. For example, it identifies operational patterns inconsistent with normal user behavior, such as a large number of requests within a short period or attempts to access restricted resources. The historical context of user requests is analyzed to detect continuous, purposeful attempts, such as gradually guiding the model to expose sensitive information. Natural language processing techniques are used to analyze the language structure and intent of the problem information, identifying whether it contains offensive words, commands, or code snippets. Based on the combined analysis results, it is determined whether the problem information carries offensive characteristics. If the analysis shows no obvious attack behavior, the third detection result is considered a pass. Conversely, if attack behavior is detected, the third detection result is considered a fail, and corresponding measures will be taken, such as warning the user, rejecting requests, and logging the attack event.

[0073] By detecting and analyzing user behavior in real time, potential attacks can be detected and blocked in a timely manner, preventing malicious actors from using the model gateway to steal, tamper with, or destroy data.

[0074] Optionally, in the data processing method provided in this application embodiment, before processing the question information through a natural language model to obtain initial response information, the method further includes: obtaining a prompt word template that matches the question information, and adding the question information and target knowledge to the prompt word template to obtain target prompt words; processing the question information through a natural language model to obtain initial response information includes: processing the target prompt words through a natural language model to obtain initial response information.

[0075] In an optional embodiment, if the target detection result indicates that the security detection has passed, the template that best matches the topic or type of the question is found from a preset prompt template library. This template can be a structured framework containing instructions, keywords, or example statements for a specific task, designed to guide the model to provide a targeted answer to the question.

[0076] The user's specific question information and target knowledge (knowledge matching the question information in a pre-defined knowledge base) are populated into the prompt word template to form a complete target prompt word. This process ensures that the model can fully consider the details and context of the question when generating an answer, thereby producing a higher quality response.

[0077] The target prompt is submitted to a natural language model for processing. Based on the question information and additional knowledge in the target prompt, the natural language model utilizes its inherent semantic understanding and generation capabilities to generate initial response information.

[0078] By introducing prompt word templates that match the question information and integrating the question information and target knowledge into them, the response quality and efficiency of natural language models can be significantly improved.

[0079] Optionally, in the data processing method provided in this application embodiment, processing the question information through a natural language model to obtain initial response information includes: reasoning about the question information through a natural language model and determining whether external resources need to be called based on the reasoning result; if it is determined that external resources need to be called, calling the external resource interface through the model context protocol to obtain external knowledge information; and processing the external knowledge information through a natural language model to obtain initial response information.

[0080] In an optional embodiment, the natural language model first performs deep reasoning on the question information to determine whether external resources need to be invoked to supplement or verify its internal knowledge base. For example, when the model finds that the question involves the latest data updates, domain-specific expertise, or information that needs to be queried in real time, it will decide to invoke external resources.

[0081] If external resources are determined to be needed, the corresponding external resource interface is invoked via the MCP protocol to obtain external knowledge information. After acquiring the external knowledge information, the natural language model combines the external knowledge with the question information to generate initial response information. It should be noted that the natural language model can also invoke other models via the MCP protocol for multi-model collaborative processing to obtain more accurate initial response information.

[0082] By calling external resources, we can obtain the latest, domain-specific, or real-time data, making the generated response information more accurate and comprehensive, and able to cover a wider range of business scenarios.

[0083] Optionally, in the data processing method provided in this application embodiment, after obtaining external knowledge information by calling the external resource interface through the model context protocol, the method further includes: performing sensitive information detection on the external knowledge information through the retrieval guardrail to obtain a fourth detection result; if the fourth detection result indicates the presence of a first type of sensitive word, then the external knowledge information is masked, wherein the natural language model outputs initial response information based on the masked external knowledge information; if the fourth detection result indicates the presence of a second type of sensitive word, then the external knowledge information is intercepted, and the natural language model is instructed to output a preset response script.

[0084] In an optional embodiment, after obtaining external knowledge information by calling an external resource interface via the Model Context Protocol, a retrieval guard performs sensitive information detection. The retrieval guard is designed to prevent any potentially sensitive information from being accessed. The detection process includes: First-type sensitive word detection: checking for highly sensitive words such as personal information, health data, and banking information. Second-type sensitive word detection: focusing on content that may cause discomfort or controversy, such as sensitive topics of speech.

[0085] If the detection results identify Category I sensitive words, the external knowledge information is masked, meaning the sensitive parts are replaced with specific symbols or text. The masked information is then submitted to the natural language model for processing. The natural language model generates an initial response based on this processed information, ensuring the security and privacy of the information.

[0086] If a second type of sensitive word is detected, the search guard will directly block the external knowledge information to prevent it from entering the subsequent processing flow. In this case, the natural language model is instructed to output a preset, safe response to the user's question, such as, "Regarding the topic you mentioned, we are currently unable to provide relevant information. Please try asking other questions."

[0087] By differentiating between different types of sensitive words and adopting different strategies, the search guardrail can more precisely control the flow of information and effectively filter out potentially high-risk content.

[0088] In an optional embodiment, the data processing method provided in this application can be implemented through an integrated model gateway. The model gateway provides a unified interface and security protection functions, thereby enabling security detection of user input and model output, and thus achieving the technical effect of improving security detection efficiency.

[0089] In an alternative embodiment, it can be achieved through, as follows: Figure 3 The diagram illustrates the data processing for business applications, including the access layer, MCP protocol matching layer, service invocation layer, response optimization layer, and security barrier layer. After MCP protocol adaptation, it can interact with large models and support all resources, tool calls, and API service calls required by the large models. The security barrier layer provides message security filtering throughout the entire gateway lifecycle, including input filtering at the access layer, dynamic security policies during intermediate calls, and final output auditing of response information.

[0090] In an alternative embodiment, it can also be achieved through methods such as Figure 4 The diagram shown illustrates the processing of business data. The access layer connects to the model gateway via the HTTP protocol. Upon receiving a request, it performs parameter parsing, input filtering, and routing to find the target system to be accessed.

[0091] MCP Protocol Adaptation Layer: To unify the access methods for all resources, this layer provides a universal way for LLM applications to connect to external resources via a unified protocol. This protocol uses the MCP protocol and adds an intermediate layer, the MCP Server, and an MCP Client for connecting to this intermediate layer. The MCP Server here is not a centralized server in the traditional sense; it can be understood as a service plugin that can be deployed on the local machine where the LLM gateway resides or remotely. The MCP Server provides the following functions: Tool Invocation Capability: Provides various tools for LLM applications, especially Agents. For example, querying online API services. Model Invocation Capability: Can interface with various LLM models to collaboratively complete the entire business chain. Resource Loading Capability: Provides supporting data for inference required by LLM applications. Prompt Template Capability: Provides Prompt templates for LLM applications. For example, providing a template required for a business dialogue model. The MCP Client is a session created and maintained by the adaptation layer with the server. Here, a client can establish sessions with different servers, ensuring load balancing and avoiding single points of failure.

[0092] Response Optimization Layer: After the protocol adaptation layer, service scheduling yields a response result. For system security reasons, this response result cannot be directly returned to the caller; it must be optimized by the output review engine before being returned to the caller. The response optimization layer completes the final content review, optimization, and result encapsulation.

[0093] In an optional embodiment, a schematic diagram of the safety barrier layer is shown below. Figure 5 As shown, safety barriers are a key technology for ensuring the safe and stable operation of large models. They aim to validate and clean user input, preventing large models from producing unsafe, unethical, or unexpected outputs. Safety barriers provide comprehensive protection throughout the entire interaction process.

[0094] Input Barriers: Input barriers are primarily used to manage user input. They offer multiple functions, including directly rejecting certain inputs to terminate any subsequent processing, and modifying input content, such as masking potentially sensitive data or reorganizing sentence structure. Key technologies used include: using regular expressions to block high-risk input; and using a semantic deviation detection model to calculate the cosine similarity between the input and the intended compliance, blocking and issuing warnings for inputs that do not meet the criteria.

[0095] Retrieval Guardrail: Applicable to the processing of retrieved text blocks in retrieval-enhanced generation scenarios. It can filter text blocks, rejecting those that do not meet the requirements to prevent them from being used for prompting LLM; it can also modify related text blocks, such as masking potentially sensitive data. Execution Guardrail: Primarily controls the input and output of custom actions (also known as tools) that need to be invoked by the large language model. Topic Limitation Guardrail: Ensures that the large model only generates content within specific functional areas through preset rules and intent recognition, avoiding deviation from the core task scenario. Dialogue Security Guardrail: Prevents the large model from generating content containing factual errors, ethical violations, or harmful information through a multi-dimensional content review mechanism. Attack Defense Guardrail: Prevents malicious users from compromising system security through two-way input and output protection, such as prompt injection and code execution attacks.

[0096] Output guardrails: Used to process the output generated by large language models. They can review the output, rejecting inappropriate output and preventing it from being returned to the user; they can also modify the output content, such as deleting sensitive data.

[0097] In an alternative embodiment, it can also be achieved through methods such as Figure 6 The diagram illustrates business data processing, specifically including: a user submitting a question and accessing the model gateway's access layer via HTTP protocol; parameter parsing of the user's question to identify the user's intent.

[0098] After parameter recognition, parameter filtering is performed. First, an input guardrail check is initiated, employing multi-level filtering: a protocol validation layer (validating the format of input parameters), a sensitive word filtering layer (regular expression matching and dynamic blacklisting), and a semantic analysis layer (BERT detection of malicious intent, such as inducing the generation of illegal code). Second, a topic limitation guardrail check is performed using rule engine technology. Intent is recognized from user input, followed by topic matching. This involves searching a keyword database and knowledge graph; if a match is found, response generation is allowed. If the match fails, a guidance rule is triggered, outputting a preset prompt, such as "Currently, only discussions of issues in the XX domain are supported." A dialogue security guardrail check is then performed, employing a three-layer defense architecture: a first layer of sensitive word filtering, a second layer of knowledge base alignment (vector database retrieval based on dialogue content), and an attack defense guardrail check using a source tracing mechanism. The session ID is bound to the user's device fingerprint, and full audit logs are recorded. Statistical analysis identifies API call anomalies and abnormal guided calls. After the above inspection mechanism is completed, routing can be performed, that is, to determine which external resources need to be accessed. After finding the external resources, the MCP protocol is adapted, and the corresponding MCP server is called through the MCP client to complete the interactive operation.

[0099] The MCP service includes four general services: First, tool invocation: providing the ability to execute specific operations using functions or external service interfaces that can be called by the LLM. Second, resource loading: exposing content and information from different data sources to the LLM for reading and analysis, such as local file content, JSON data returned by remote APIs, and database query results. Third, matching prompt templates: supporting the creation of reusable prompt templates and workflows to help developers design standardized interaction patterns. This feature is particularly suitable for task scenarios requiring efficient iteration or batch processing, such as automated customer service or content generation processes. Fourth, calling LLM capabilities: the model gateway has the ability to call other models for multi-model collaborative processing.

[0100] During the execution of the MCP service, security enhancements are required for both retrieval and execution guardrails. In scenarios involving enhanced retrieval generation, security filtering is performed on retrieved text blocks, integrating keyword matching and authoritative literature retrieval from vector databases. After execution, the output results undergo output guardrail checks, filtering keyword matches and triggering blocking of prohibited keywords. Data authenticity is verified using a knowledge graph. An ethical rules engine assesses compliance with ethical standards. Finally, the assembled result is returned to the user.

[0101] The data processing method provided in this application embodiment obtains the question information input by the target object, performs security checks on the question information through a security guardrail, and obtains the target detection result; if the target detection result indicates that the security check has passed, the question information is processed through a natural language model to obtain initial response information; the initial response information is then subjected to security checks through a security guardrail, and if the security check passes, the target response information for replying to the target object is obtained based on the initial response information. This solves the technical problem in related technologies where security checks on user input and model output are performed manually, resulting in low detection efficiency.

[0102] In this solution, the security barrier performs real-time, automatic security checks on user-input questions, providing immediate feedback on potential security issues or violations, ensuring input security before model processing. If the security check is passed, a natural language model processes the question information. The initial response generated by the model is also automatically reviewed by the security barrier, enabling immediate identification and correction of security issues in the output, ensuring the final response is safe and compliant. This automated security barrier reduces reliance on manual review, lowering operational delays and error rates caused by human intervention, thereby improving security detection efficiency.

[0103] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0104] Example 2

[0105] This application also provides a data processing apparatus. It should be noted that the data processing apparatus of this application can be used to execute the data processing method provided in this application. The data processing apparatus provided in this application will be described below.

[0106] According to an embodiment of this application, an apparatus for implementing the above-described data processing method is also provided, such as... Figure 7 As shown, the device includes: a first acquisition unit 701, a first processing unit 702, and a determination unit 703.

[0107] The first acquisition unit 701 is used to acquire the question information input by the target object, and to perform security detection on the question information through the security guardrail to obtain the target detection result;

[0108] The first processing unit 702 is used to process the question information through a natural language model to obtain initial response information when the target detection result indicates that the security detection has passed.

[0109] The determining unit 703 is used to perform security checks on the initial response information through the security barrier, and if the security check passes, to obtain the target response information for the target object based on the initial response information.

[0110] The data processing apparatus provided in this application embodiment acquires question information input by a target object through a first acquisition unit 701, and performs security detection on the question information through a security barrier to obtain a target detection result; if the target detection result indicates that the security detection has passed, the first processing unit 702 processes the question information through a natural language model to obtain initial response information; the determination unit 703 performs security detection on the initial response information through a security barrier, and if the security detection passes, obtains the target response information to the target object based on the initial response information. This solves the technical problem in related technologies where security detection of user input and model output based on manual methods results in low detection efficiency.

[0111] In this solution, the security barrier performs real-time, automatic security checks on user-input questions, providing immediate feedback on potential security issues or violations, ensuring input security before model processing. If the security check is passed, a natural language model processes the question information. The initial response generated by the model is also automatically reviewed by the security barrier, enabling immediate identification and correction of security issues in the output, ensuring the final response is safe and compliant. This automated security barrier reduces reliance on manual review, lowering operational delays and error rates caused by human intervention, thereby improving security detection efficiency.

[0112] Optionally, in the data processing apparatus provided in this application embodiment, the first acquisition unit includes: a first detection subunit, configured to perform topic security detection on the question information to obtain a first detection result; a second detection subunit, configured to perform dialogue security detection on the question information if the first detection result indicates that the detection has passed, to obtain a second detection result; a third detection subunit, configured to perform attack detection on the question information if the second detection result indicates that the detection has passed, to obtain a third detection result; and a determination subunit, configured to obtain a target detection result based on the third detection result.

[0113] Optionally, in the data processing apparatus provided in this application embodiment, the first detection subunit includes: an identification module, used to identify the intent of the question information and obtain an identification result; a first matching module, used to match the identification result with topics in a preset topic library and obtain a first matching result; and a first determination module, used to determine that if the first matching result indicates that there is a topic in the preset topic library that matches the identification result, then the first detection result is a successful detection.

[0114] Optionally, in the data processing apparatus provided in this application embodiment, the second detection subunit includes: a second matching module, used to match the problem information with knowledge in a preset knowledge base to obtain a second matching result; a second determining module, used to determine the second detection result as passing if the second matching result indicates that there is target knowledge in the preset knowledge base that matches the problem information; and a third determining module, used to determine the second detection result as failing if the second matching result indicates that there is no knowledge in the preset knowledge base that matches the problem information.

[0115] Optionally, in the data processing apparatus provided in this application embodiment, the third detection subunit includes: an acquisition module for acquiring the operation log of the target object; and an analysis module for analyzing the operation log for attack behavior, so as to achieve attack detection of problem information and obtain a third detection result.

[0116] Optionally, in the data processing apparatus provided in the embodiments of this application, the apparatus further includes: a second acquisition unit, configured to acquire a prompt word template that matches the question information before processing the question information through a natural language model to obtain initial response information, and add the question information and target knowledge to the prompt word template to obtain target prompt words; and a first processing unit, configured to process the target prompt words through a natural language model to obtain initial response information.

[0117] Optionally, in the data processing apparatus provided in this application embodiment, the first processing unit includes: a reasoning subunit, used to reason about the question information through a natural language model and determine whether it is necessary to call external resources based on the reasoning result; a calling subunit, used to call the external resource interface through the model context protocol to obtain external knowledge information when it is determined that external resources need to be called; and a processing subunit, used to process the external knowledge information through a natural language model to obtain initial response information.

[0118] Optionally, in the data processing apparatus provided in this application embodiment, the apparatus further includes: a detection unit, configured to call an external resource interface through a model context protocol to obtain external knowledge information, and then perform sensitive information detection on the external knowledge information through a retrieval guardrail to obtain a fourth detection result; a second processing unit, configured to perform occlusion processing on the external knowledge information if the fourth detection result indicates the presence of a first type of sensitive word, wherein the natural language model outputs initial response information based on the occluded external knowledge information; and an interception unit, configured to intercept the external knowledge information if the fourth detection result indicates the presence of a second type of sensitive word, and instruct the natural language model to output a preset response script.

[0119] It should be noted that the first acquisition unit 701, the first processing unit 702, and the determination unit 703 mentioned above correspond to steps S201 to S203 in Embodiment 1. The three units and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules or units can be hardware or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above units can also be part of a device and run in the computer terminal 10 provided in Embodiment 1.

[0120] Example 3

[0121] Embodiments of this application may provide an electronic device. Figure 8 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 8 As shown, the electronic device may include: one or more ( Figure 8Only one of the components is shown: processor 802, memory 804, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module, and display.

[0122] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0123] The processor can access the information and application programs stored in the memory via the transmission device to perform the following steps: obtain the question information input by the target object, and perform a security check on the question information through a security barrier to obtain the target detection result; if the target detection result indicates that the security check has passed, process the question information through a natural language model to obtain the initial response information; perform a security check on the initial response information through a security barrier, and if the security check has passed, obtain the target response information to reply to the target object based on the initial response information.

[0124] The processor can access information and applications stored in memory via a transmission device to perform the following steps: performing security checks on the problem information through a security barrier to obtain target detection results, including: performing topic security checks on the problem information to obtain a first detection result; if the first detection result indicates that the detection has passed, performing dialogue security checks on the problem information to obtain a second detection result; if the second detection result indicates that the detection has passed, performing attack detection on the problem information to obtain a third detection result; and obtaining a target detection result based on the third detection result.

[0125] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: perform topic security detection on the problem information to obtain a first detection result, including: perform intent recognition on the problem information to obtain a recognition result; match the recognition result with topics in the preset topic library to obtain a first matching result; if the first matching result indicates that there is a topic in the preset topic library that matches the recognition result, then the first detection result is a successful detection.

[0126] The processor can access information and applications stored in the memory via a transmission device to perform the following steps: performing dialogue security checks on the question information to obtain a second detection result, including: matching the question information with knowledge in a preset knowledge base to obtain a second matching result; if the second matching result indicates that there is target knowledge in the preset knowledge base that matches the question information, then the second detection result is a successful detection; if the second matching result indicates that there is no knowledge in the preset knowledge base that matches the question information, then the second detection result is a failed detection.

[0127] The processor can access information and applications stored in memory via a transmission device to perform the following steps: attack detection of problem information to obtain a third detection result, including: obtaining the operation log of the target object; analyzing the attack behavior of the operation log to achieve attack detection of problem information and obtain a third detection result.

[0128] The processor can invoke information and applications stored in the memory via a transmission device to perform the following steps: Before processing the question information through a natural language model to obtain initial response information, the method further includes: obtaining a prompt word template that matches the question information, and adding the question information and target knowledge to the prompt word template to obtain target prompt words; processing the question information through a natural language model to obtain initial response information includes: processing the target prompt words through a natural language model to obtain initial response information.

[0129] The processor can access information and applications stored in memory via a transmission device to perform the following steps: processing the question information using a natural language model to obtain initial response information, including: reasoning about the question information using a natural language model and determining whether external resources need to be called based on the reasoning results; if it is determined that external resources need to be called, calling the external resource interface through the model context protocol to obtain external knowledge information; and processing the external knowledge information using a natural language model to obtain initial response information.

[0130] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: After obtaining external knowledge information by calling the external resource interface through the model context protocol, the method further includes: performing sensitive information detection on the external knowledge information through the retrieval guardrail to obtain a fourth detection result; if the fourth detection result indicates the presence of a first type of sensitive word, then the external knowledge information is masked, wherein the natural language model outputs initial response information based on the masked external knowledge information; if the fourth detection result indicates the presence of a second type of sensitive word, then the external knowledge information is intercepted, and the natural language model is instructed to output a preset response script.

[0131] Those skilled in the art will understand that Figure 8The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 8 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 8 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 7 The different configurations shown.

[0132] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0133] Example 4

[0134] Embodiments of this application also provide a computer-readable storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the data processing method provided in Embodiment 1.

[0135] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.

[0136] This application also provides a computer program product, which, when executed on a data processing device, is a program adapted to perform data processing method steps.

[0137] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0138] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0139] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0140] The units described as separate components may or may not be physically separate. The components shown as units 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 units can be selected to achieve the purpose of this embodiment according to actual needs.

[0141] Furthermore, the functional units in the various embodiments of this application 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 as a software functional unit.

[0142] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0143] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A data processing method, characterized in that, include: Obtain the question information input by the target object, and perform security checks on the question information through the security guardrail to obtain the target detection result; If the target detection result indicates that the security detection has passed, the question information is processed using a natural language model to obtain initial response information; The initial response information is subjected to security checks through the security barrier, and if the security check passes, the target response information is obtained based on the initial response information to the target object.

2. The method according to claim 1, characterized in that, The security detection results obtained by performing security checks on the aforementioned problem information through security barriers include: The issue information is subjected to topic security detection, and a first detection result is obtained; If the first detection result indicates that the detection has passed, a dialogue security detection is performed on the question information to obtain a second detection result; If the second detection result indicates that the detection has passed, an attack detection is performed on the problem information to obtain a third detection result; Based on the third detection result, the target detection result is obtained.

3. The method according to claim 2, characterized in that, The topic security check on the aforementioned issue information yields the following first detection results: The intent of the question information is identified to obtain the identification result; The identification results are matched with topics in a preset topic library to obtain a first matching result; If the first matching result indicates that there is a topic in the preset topic library that matches the recognition result, then the first detection result is a successful detection.

4. The method according to claim 2, characterized in that, The dialogue security check performed on the aforementioned question information yields the following second detection results: The problem information is matched with knowledge in a preset knowledge base to obtain a second matching result; If the second matching result indicates that there is target knowledge in the preset knowledge base that matches the question information, then the second detection result is a successful detection; If the second matching result indicates that there is no knowledge in the preset knowledge base that matches the question information, then the second detection result is a failure to detect.

5. The method according to claim 2, characterized in that, Attack detection is performed on the aforementioned problem information, and the third detection result includes: Obtain the operation log of the target object; Attack behavior analysis is performed on the operation logs to detect attacks on the problem information and obtain the third detection result.

6. The method according to claim 4, characterized in that, Before processing the question information using a natural language model to obtain initial response information, the method further includes: Obtain a prompt word template that matches the question information, and add the question information and the target knowledge to the prompt word template to obtain the target prompt word; The question information is processed using a natural language model to obtain initial response information, including: The target prompt word is processed by the natural language model to obtain the initial response information.

7. The method according to claim 1, characterized in that, The question information is processed using a natural language model to obtain initial response information, including: The problem information is reasoned through the natural language model, and the result of the reasoning is used to determine whether external resources need to be called. If it is determined that the external resource needs to be called, the external resource interface is called through the model context protocol to obtain the external knowledge information; The initial response information is obtained by processing the external knowledge information using the natural language model.

8. The method according to claim 7, characterized in that, After obtaining external knowledge information by calling the external resource interface through the model context protocol, the method further includes: The external knowledge information is subjected to sensitive information detection by searching the guardrail, and a fourth detection result is obtained; If the fourth detection result indicates the presence of a first type of sensitive word, then the external knowledge information is masked, wherein the natural language model outputs the initial response information based on the masked external knowledge information; If the fourth detection result indicates the presence of a second type of sensitive word, the external knowledge information is intercepted, and the natural language model is instructed to output a preset response.

9. A data processing apparatus, characterized in that, include: The first acquisition unit is used to acquire the question information input by the target object, and to perform security detection on the question information through a security guardrail to obtain the target detection result. The first processing unit is used to process the question information using a natural language model to obtain initial response information when the target detection result indicates that the security detection has passed. The determining unit is used to perform a security check on the initial response information through the security barrier, and if the security check passes, to obtain the target response information to the target object based on the initial response information.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein, when the executable program is executed, it controls the device on which the computer-readable storage medium is located to perform the data processing method according to any one of claims 1 to 8.

11. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, performs the data processing method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Intelligent agent cue word deduction method and system and storage medium

    CN121562835A