Practical training scene generation method based on retrieval enhancement and intelligent agent and related equipment

By using retrieval enhancement and intelligent agent-based methods, and leveraging large language models and intelligent agents to generate network training scenarios, this approach solves the problems of complex environment construction and high computational resource consumption in existing technologies. It achieves low-cost, high-efficiency automatic generation of network training scenarios, thereby improving the user experience.

CN121900753APending Publication Date: 2026-04-21BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING UNIV OF POSTS & TELECOMM
Filing Date
2025-12-01
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing online training platforms are complex to build, consume a lot of computing resources, and have a high operating threshold, resulting in a poor user experience.

Method used

We employ a retrieval enhancement and agent-based approach to construct network training scenarios through natural language input. We utilize a large language model and an agent to generate these scenarios, combining local and external knowledge bases for dual-channel retrieval enhancement and dynamic filtering of the final context. Finally, we use an agent to generate and modify the scenarios.

Benefits of technology

It reduces the difficulty of operation, improves the accuracy and efficiency of retrieval, and realizes the automatic generation of low-cost and high-efficiency network training scenarios. It allows users to be freed from tedious and error-prone low-level configuration and focus on understanding network principles and advanced learning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121900753A_ABST
    Figure CN121900753A_ABST
Patent Text Reader

Abstract

The invention provides a practical training scene generation method based on retrieval enhancement and an intelligent agent and related equipment. The method comprises the following steps: retrieving related information from a local vector database and an external internet search engine according to standardized query after semantic rewriting by adopting a'local + external 'dual-channel knowledge fusion mechanism; in a local channel, performing multi-path recall by combining keyword matching and dense vector semantic retrieval, dynamically allocating weights according to the inquired terminology density, and performing preliminary sorting on two paths of results through a reciprocal sorting fusion algorithm; then the fused local retrieval result is sent to a cross encoder for fine-grained correlation reordering, and an optimal context is screened out; and finally, injecting the context and the rewritten standardized query into a preset prompt template together, generating a code script by a large language model, and generating a network practical training scene according to the script. The automation process reduces the practice threshold, and improves the teaching and learning efficiency.
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 in particular to a method and related equipment for generating training scenarios based on retrieval enhancement and intelligent agents. Background Technology

[0002] Network simulation is an indispensable technical tool in computer network teaching and research. Network training scenarios provide rich protocol interaction and visualization functions through graphical interfaces, effectively lowering the learning threshold for beginners. Some high-fidelity simulation platforms can construct complex topologies that closely resemble production environments by running operating system images of real network devices, and are widely used in professional certification and engineering training. However, they consume a lot of computing resources and are complex to configure. It can be seen that network training teaching suffers from problems such as complex environment construction, high operational threshold, and delayed feedback, resulting in a poor user experience. Summary of the Invention

[0003] In view of this, the purpose of this application is to propose a training scenario generation method and related equipment based on retrieval enhancement and intelligent agents, which combines intelligent agents and enhanced retrieval technology to automatically construct a network training scenario that supports interaction and modification based on the user's natural language input.

[0004] To achieve the above objectives, this application provides a method for generating training scenarios based on retrieval enhancement and intelligent agents, including: Obtain the user's natural language input, perform semantic rewriting on the natural language input, and obtain a standardized query; A candidate text set is generated by performing dual-channel retrieval enhancement based on the standardized query and the pre-established local knowledge base; Calculate the fine-grained relevance score between each document in the candidate text set and the standardized query, and determine the preset number of documents with the highest fine-grained relevance scores as the final context; The final context and the standardized query are input into a preset blank prompt template to obtain a prompt template. Then, a large language model is used to generate and clean the code based on the prompt template to obtain the original script of the user intent. Based on the user intent, the original script activates a preset running agent to generate a scene, thus obtaining a network training scene.

[0005] Optionally, the step of performing dual-channel retrieval enhancement generation based on the standardized query and a pre-established local knowledge base to obtain a candidate text set includes: Based on the standardized query, a local search is performed in the local knowledge base to obtain local search results; Perform external network searches based on the standardized queries to obtain external search results; The union of the external search results and the local search results is determined as the candidate text set.

[0006] Optionally, the step of performing a local search in the local knowledge base based on the standardized query to obtain local search results includes: Based on the standardized query, a local retrieval is performed in the local knowledge base to obtain a list of keyword documents and a list of vector documents. The dynamic weight is determined based on the content composition of the standardized query. The keyword document list and the vector document list are sorted and merged in reverse order based on the dynamically calculated weights to obtain the local search results.

[0007] Optionally, determining the dynamic weight based on the content composition of the standardized query includes: The proportion of keywords and the proportion of conceptual descriptions are determined based on the content composition. The difference between the percentage of keywords and the percentage of conceptual descriptions is determined as the difference percentage. In response to the absolute value of the difference ratio being less than or equal to a preset first threshold ratio, the default calculation weight is determined as the dynamic calculation weight; In response to the absolute value of the difference percentage being greater than a preset first threshold percentage, and the difference percentage being a positive number, the first weight corresponding to the keyword document list is increased based on the default calculated weight to obtain the dynamic calculated weight; In response to the absolute value of the difference percentage being greater than a preset first threshold percentage, and the difference percentage being negative, the second weight corresponding to the vector document list is increased based on the default calculated weight to obtain the dynamic calculated weight.

[0008] Optionally, the training scenario generation method based on retrieval enhancement and agents also includes: In response to detecting a user's modification operation on the original user intent script, the original user intent script is updated according to the modification operation to obtain a modified user intent script; According to the user intent, the script is used to activate the running agent to regenerate the scene, resulting in a corrected network training scene. The corrected network training scene is then closed and opened.

[0009] Optionally, the training scenario generation method based on retrieval enhancement and agents further includes, after closing the network training scenario: The network training scenario is structured to obtain a static execution report, which is then visualized in the user interface.

[0010] Optionally, the training scenario generation method based on retrieval enhancement and agents also includes: In response to receiving a user's query request, the context information of the current session is aggregated to obtain the complete context; Based on the query request, a professional database was searched to obtain search assistance information; Based on the overall context and the retrieval assistance information, determine the tutoring prompts for the current online training scenario.

[0011] Based on the same inventive concept, this application also provides a training scenario generation device based on retrieval enhancement and intelligent agents, comprising: The user intent determination module is configured to: acquire the user's natural language input, perform semantic rewriting on the natural language input, and obtain a standardized query; The retrieval enhancement generation module is configured to perform dual-channel retrieval enhancement generation based on the standardized query and a pre-established local knowledge base to obtain a candidate text set; The text fine-grained filtering module is configured to: calculate the fine-grained relevance score of each document in the candidate text set with the standardized query, and determine the preset number of documents with the highest fine-grained relevance scores as the final context; The intent script generation module is configured to: take the final context and the standardized query input into a preset blank prompt template to obtain a prompt template, and use a large language model to generate and clean the code based on the prompt template to obtain the original user intent script; The training scenario generation module is configured to: activate a preset running agent to generate a scenario based on the user intent original script, thereby obtaining a network training scenario.

[0012] Based on the same inventive concept, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the method described above when executing the computer program.

[0013] Based on the same inventive concept, this application also provides a non-transitory computer-readable storage medium that stores computer instructions for causing a computer to perform the method described above.

[0014] As described above, the training scenario generation method and related equipment based on retrieval enhancement and intelligent agents provided in this application: Obtain the user's natural language input, perform semantic rewriting on the natural language input, and obtain a standardized query. Using natural language as input transforms the tedious manual configuration process into natural language interaction, reducing operational difficulty. The standardized query obtained after semantic rewriting of the natural language input is used for subsequent retrieval processes, improving retrieval accuracy. Dual-channel retrieval enhancement generation is performed based on the standardized query and a pre-established local knowledge base to obtain a candidate text set. A fine-grained relevance score is calculated for each document in the candidate text set relative to the standardized query, and a preset number of documents with the highest fine-grained relevance scores are determined as the final context. The retrieval enhancement generation process adopts a dual-channel knowledge fusion strategy combining local and external knowledge to ensure the accuracy and timeliness of code generation. The candidate text set is dynamically filtered through fine-grained relevance scores to ensure the reliability of the final context. Dual-channel retrieval and dynamic sorting ensure the professionalism and reliability of the final context. The final context and standardized query are input into a preset blank prompt template to obtain the prompt template. A large language model is then used to generate and clean the code based on the prompt template, resulting in the user intent raw script. A preset running agent is activated based on the user intent raw script to generate a scenario, thus obtaining the network training scenario. By creating prompt templates to improve the code generation accuracy of the large language model, and by automatically generating network training scenarios using the user intent raw script, users are freed from tedious and error-prone low-level configurations, allowing them to focus on higher-order learning objectives such as understanding network principles, designing solutions, and exploring problems. This achieves digital empowerment of education and provides a low-cost, high-efficiency solution for network practical teaching. Attached Figure Description

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

[0016] Figure 1a This is a schematic diagram of a training scenario generation system based on retrieval enhancement and intelligent agents, as described in an embodiment of this application. Figure 1b This is a schematic diagram of the multi-agent architecture in an embodiment of this application; Figure 2 This is a schematic diagram of the user interface of an embodiment of this application; Figure 3 This is a flowchart illustrating the training scenario generation method based on retrieval enhancement and intelligent agents according to an embodiment of this application; Figure 4This is a flowchart of a training scenario generated after the user manually modifies the implementation details of this application. Figure 5 This is a flowchart illustrating the user interaction process in an embodiment of this application. Figure 6 This is a schematic diagram of a training scenario generation device based on retrieval enhancement and intelligent agents, as described in an embodiment of this application. Figure 7 This is a schematic diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with specific embodiments and the accompanying drawings.

[0018] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this application should have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms "first," "second," and similar terms used in the embodiments of this application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are only used to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0019] In this article, it is important to understand that any number of elements in the accompanying figures is for illustrative purposes and not for limitation, and any naming is for distinction only and has no limiting meaning.

[0020] Based on the above background description, the following situations also exist in the related technologies: In related technologies, mainstream simulation platforms provide rich protocol interaction and visualization functions through graphical interfaces, effectively reducing the learning threshold for beginners. High-fidelity simulation platforms, by running operating system images of real network devices, can construct complex topologies that closely resemble production environments and are widely used in professional certification and engineering training; however, they consume significant computing resources and have complex configurations. Mininet, on the other hand, is a lightweight network virtualization platform that utilizes Linux kernel namespaces and network virtualization technology to quickly create programmable virtual networks containing hosts, switches, controllers, and links on a single host and provides a powerful Python API. Therefore, it has become a standard tool in the teaching and research of Software-Defined Networking (SDN) and Network Functions Virtualization (NFV).

[0021] Large Language Models (LLMs) represent a significant breakthrough in artificial intelligence in recent years. Through pre-training on massive amounts of text and code corpora, they possess powerful natural language understanding and generation capabilities. Particularly in code generation tasks, LLMs can automatically generate syntactically correct and logically sound program code based on natural language instructions, covering a wide range of scenarios from basic scripts to complex system modules. This capability provides a solid technical foundation for automatically transforming high-level experimental intentions described by users in natural language into executable Mininet and Python scripts, enabling non-expert users to drive underlying technology implementations through semantic interaction.

[0022] Retrieval-Augmented Generation (RAG) is a hybrid architecture combining large language models and external knowledge bases. It aims to address issues such as knowledge obsolescence, factual illusions, and insufficient domain generalization in LLM (Language Modeling) within specialized domains. Before generating a response, RAG retrieves the most relevant information to the user's query from specified knowledge sources (such as technical documents, code repositories, or web pages) and injects this information as contextual clues, guiding the model to generate more accurate and reliable content. This framework significantly improves generation quality in specific vertical domains by combining the generalization capabilities of parametric models with the accuracy of non-parametric knowledge bases, providing a key technological path for building highly reliable AI code generation engines.

[0023] An intelligent agent is an intelligent system built upon a large language model, possessing the capabilities of autonomous planning, tool invocation, and environmental interaction. Its core mechanism is the "think-act" cycle, enabling the agent to autonomously decompose a high-level task objective into multiple executable sub-steps and, when necessary, invoke external tools to complete specific operations. This capability allows it to handle complex, multi-step tasks far exceeding simple text generation. In online education scenarios, AI agents can serve as a bridge connecting user intent with underlying technological implementation, achieving end-to-end automated creation from natural language requirements to interactive virtual environments.

[0024] The following describes in detail, with reference to the accompanying drawings, the method for generating training scenarios based on retrieval enhancement and intelligent agents provided by the embodiments of this application.

[0025] In some embodiments, the training scenario generation method based on retrieval enhancement and agents is applied to, for example... Figure 1a The training scenario generation system based on retrieval enhancement and intelligent agents shown here adopts a four-layer architecture, from top to bottom: user presentation layer, backend orchestration layer, function implementation layer, and technical support layer. The intelligent agent architecture of the training scenario generation system based on retrieval enhancement and intelligent agents is as follows: Figure 1b As shown, the execution of functions in each functional layer relies on the cooperation of multiple agents. The system's user interface is as follows: Figure 2 As shown, users can make changes to the generation configuration as needed within the user interface.

[0026] User Presentation Layer: Built on the Grado framework, this web interface integrates five modules: interactive execution, code editing, topology visualization, network analysis, and AI dialogue, providing a unified entry point for users. Users input their experimental intentions via natural language, which are then parsed and standardized by an intent-recognition agent. Backend orchestration layer: As the system's central hub, it coordinates the collaborative work of multiple agents. Upon receiving user intent, it activates the retrieval and generation agent (based on RAG to generate code) and the running agent (managing the environment's lifecycle), while maintaining session state (such as queries, code, and logs).

[0027] Functionality implementation layer: Contains specific business logic, such as code generation, topology visualization, network analysis, etc., and relies on the basic capabilities of the technical support layer.

[0028] Technical support layer: Integrates LLM services, LangChain framework, Mininet virtualization engine, NetworkX library, etc., to provide underlying support for intelligent agents.

[0029] The user presentation layer, built on the Grado framework, integrates five functional modules—interactive execution, code editing, topology visualization, network analysis, and AI dialogue—through tabs, providing users with a unified and intuitive interface. Users input their experimental intent in natural language (e.g., "Build a bottleneck link topology for testing TCP congestion control"). This intent is captured and parsed by an intent recognition agent. This agent performs semantic understanding and standardized rewriting of the user's raw natural language input, outputting a standardized query. It accurately extracts key elements such as topology, device type, link parameters, and protocol behavior, providing a clear and structured task description for subsequent code generation.

[0030] The backend orchestration layer, as the core hub of the system, is responsible for receiving frontend requests and maintaining user session state (including raw queries, generated code, runtime logs, topology data, etc.). Upon receiving a standardized query task output by the intent recognition agent, it activates the retrieval generation agent. This agent, the system's core generation engine, employs a hybrid dual-channel retrieval augmented generation (RAG) pipeline: first, it retrieves Mininet official documentation and high-quality script examples from the local vector database (Chroma database); second, it uses the TavilySearch tool to search the internet in real time for the latest best practices. Subsequently, the system performs multi-path recall using BM25 and vector retrieval, RRF fusion ranking, and deep re-ranking using a bge-reranker cross-encoder to obtain a high-quality final context. This final context is then injected into the large language model as a prompt template to generate a user intent raw script that fully matches the user's intent, such as a Mininet (Python) script.

[0031] After the original user-intended script code is cleaned up, it is handed over to the running agent for processing. The running agent is responsible for the full lifecycle management of the simulation environment and can automatically generate network training scenarios: it creates isolated Mininet subprocesses through the subprocess module, uses asynchronous I / O pipes to achieve real-time command interaction and log feedback, and performs robust environment cleanup operations (such as mn -c) at the end of the session, thereby ensuring complete resource reclamation and system state consistency.

[0032] When a user enters the online editing and re-execution process, the running agent is reactivated, but its behavior pattern is adjusted accordingly. It no longer executes the original user intent script generated by the large language model, but instead loads the user-modified user intent correction script. After cleaning the existing environment, it redeploys the network training scenario. This constitutes a closed-loop exploration mechanism of "generation-modification-verification," demonstrating the running agent's dynamic response capability to user intervention, making it not only an execution agent but also a dynamic collaborative partner supporting iterative experiments.

[0033] Meanwhile, the dialogue agent remains on standby. When a user asks a question in the "Direct Chat with LLM" tab of the user interface, the dialogue agent automatically aggregates the complete context of the current conversation (including the original requirement, generated code, runtime logs, etc.) and retrieves auxiliary information from the professional knowledge base using RAG to construct a context-rich prompt. Based on this, the dialogue agent can provide precise answers to questions, troubleshooting, or code optimization suggestions according to the specific experimental state, acting as a "virtual expert" and providing context-aware intelligent guidance.

[0034] The logic of each of the top three layers is built upon the technical support layer. This layer integrates large language model services (such as DeepSeek / Qwen), the LangChain framework, the Mininet network virtualization engine, the NetworkX visualization library, and subprocess management components, providing stable and efficient foundational capabilities for each agent. Mininet, as the execution environment, receives and executes deployment instructions for the agents; while LangChain and the RAG architecture provide the core technological foundation for knowledge fusion and reasoning generation for retrieval-generating and dialogue-based agents.

[0035] A layered architecture effectively decouples presentation, control, business logic, and support. Through the organic collaboration of four types of intelligent agents—intent recognition, retrieval generation, execution, and contextual dialogue—end-to-end automation and closed-loop control are achieved, from "natural language intent input" to "code generation," "environment deployment," "interactive exploration," and even "intelligent feedback," thus ensuring the system's modularity, scalability, and operational stability. This enables the automatic generation of network training scenarios, freeing users from tedious and error-prone low-level configurations and allowing them to focus on higher-level learning objectives such as understanding network principles, designing solutions, and exploring problems. This empowers digital education and provides a low-cost, high-efficiency solution for network-based practical teaching.

[0036] Furthermore, this embodiment deeply integrates professional network analysis tools into the system, supporting users to perform real-time traffic capture and analysis in a virtual environment. Users can enter the `tshark` or `tcpdump` command in the "Network Analysis" tab, and the system will launch a new packet capture subprocess with sudo privileges via `subprocess.Popen`. To avoid UI lag, the system creates a daemon thread to continuously read the subprocess output and place it in a queue. The main program asynchronously consumes the queue content and updates the UI in real time. When the user clicks "stop," the system sends a SIGINT signal to the subprocess to ensure its graceful exit. In addition, to ensure system stability, all Mininet and packet capture processes run in independent sessions. When stopping, the entire process group is terminated via `os.killpg`, and the `sudo mn -c` command is automatically executed to clean up residual virtual interfaces and configurations, ensuring that each experiment starts in a clean and consistent environment, effectively preventing resource leaks and state pollution.

[0037] In the training scenario generation system based on retrieval enhancement and intelligent agents, the process of multi-agent collaboration to construct a network training scenario is shown in the following embodiment.

[0038] In some embodiments, such as Figure 3As shown, a training scenario generation method based on retrieval enhancement and intelligent agents includes: Step 301: Obtain the user's natural language input, perform semantic rewriting on the natural language input, and obtain a standardized query.

[0039] In practical implementation, the core of this application's embodiments lies in automatically converting the user's high-level network experiment intentions, described in natural language, into executable Mininet (Python) scripts, and launching interactive simulations in a secure and isolated environment. This process is driven by an intelligent engine based on retrieval-enhanced generation.

[0040] To ensure the accuracy of subsequent retrieval processes, it is necessary to standardize the natural language input obtained from users. For example, a large language model can be used to semantically rewrite the original query (natural language input) to generate a standardized query that is more conducive to retrieval.

[0041] User natural language input is often brief, vague, or contains expressions reflecting personal habits. Directly using such queries for vector similarity retrieval is likely to miss the most relevant information in the knowledge base. Query rewriting technology leverages the powerful semantic understanding and generation capabilities of LLM to transform the original query into a more semantically aligned expression with the backend document library. For example, rewriting "What does topological relationship mean?" as "Definition and main uses of topological relationships." can more accurately match relevant knowledge documents, improving the accuracy of subsequent retrieval processes.

[0042] Step 302: Perform dual-channel retrieval enhancement generation based on standardized queries and a pre-established local knowledge base to obtain a candidate text set.

[0043] In practice, after obtaining the standardized query, two channels are launched in parallel: a local knowledge base search and an external network search. The local channel, based on the vector database (Chroma), combines BM25 keyword matching and dense vector retrieval to retrieve relevant content from professional materials such as Mininet official documentation and sample scripts. The external channel obtains the latest community solutions through the web search tool Tavily. The dual-channel retrieval enhancement generation process is shown in the following embodiment.

[0044] In some embodiments, a candidate text set is generated by dual-channel retrieval enhancement based on standardized queries and a pre-established local knowledge base, including: Based on standardized queries, a local search is performed in the local knowledge base to obtain local search results; External network searches are performed based on standardized queries to obtain external search results; The union of external search results and local search results is used to determine the candidate text set.

[0045] In practical implementation, since the retrieval channels include local and external channels, the retrieval of both channels needs to be performed in parallel. This means that a local search is conducted in the local knowledge base based on the standardized query to obtain local search results; simultaneously, an external network search is conducted based on the standardized query to obtain external search results. Dual-channel retrieval avoids the inherent limitations of a single data source, achieving a balance between information breadth, depth, and timeliness through dual-channel collaboration. Dual-channel parallel retrieval improves retrieval efficiency and coverage. After receiving a standardized query, the system simultaneously initiates search requests to both the local knowledge base and the external network. This avoids the serial delay caused by waiting for results from one channel before starting the other, significantly reducing the overall response time. More importantly, it ensures simultaneous coverage of both "internal, authoritative knowledge" and "externally flowing, fresh information" in the first instance, greatly enhancing the breadth of information coverage.

[0046] After obtaining internal and external search results, they need to be merged to achieve a balance between "authoritativeness" and "freshness." Results retrieved in parallel are merged. For example, when a user asks "How to implement link bandwidth limiting in Mininet": the local channel might retrieve classic configuration methods based on the `tc` command from the official manual, ensuring the accuracy and authority of the answer. The external channel might find simpler solutions using the latest Mininet API or helper scripts from the latest technical blogs. These two types of information are integrated, deduplicated, and sorted to generate a comprehensive answer that includes both reliable underlying principles and convenient, up-to-date practices. This fusion effectively solves the "information cocoon" problem that can occur with single-channel retrieval.

[0047] The local retrieval process is illustrated in the following example.

[0048] In some embodiments, a local retrieval is performed in the local knowledge base based on a standardized query to obtain local retrieval results, including: Based on standardized queries, a local search is performed in the local knowledge base to obtain a list of keyword documents and a list of vector documents. The dynamic weight is determined based on the content composition of the standardized query. The keyword document list and the vector document list are sorted and merged in reverse order based on dynamically calculated weights to obtain local search results.

[0049] In practice, a hybrid retrieval strategy combining keyword retrieval (e.g., BM25) and vector retrieval is employed during local searches. Keyword retrieval is used to precisely find specific terms, product models, code keywords, etc., resulting in accurate and highly interpretable results. It is efficient for specific literal queries but lacks semantic understanding and is insensitive to synonyms and variations in expression. Vector retrieval, on the other hand, can understand user intent, synonyms, near-synonyms, and contextual relationships. It possesses semantic generalization capabilities and can handle ambiguous expressions and lexical mismatches, but may overlook crucial specific details or precise identifiers. Combining the two approaches balances accuracy and intelligence, resulting in higher recall and precision, and more reliable search results.

[0050] Hybrid search can solve the problem of "semantic matching but detail deviation". For example, when a user searches for "phone series released in 2024", simple vector search may recall documents with similar semantics such as "phone series released in 2023". However, the keyword search component in hybrid search can effectively correct the results and avoid detail errors by accurately matching the key information "2024".

[0051] Hybrid retrieval can also solve the problem of "literal matching but semantic irrelevance". For example, for the query "how to reset password", keyword retrieval may fail because the document uses "forgot password". Vector retrieval, on the other hand, can understand the semantic relationship between "reset" and "forgot", ensuring that relevant content is recalled, and the keyword part ensures the accuracy of the core concept of "password".

[0052] Hybrid retrieval can meet the precision requirements of specialized fields. In scenarios such as law, medicine, and scientific and technological documents (e.g., Mininet simulations), queries often contain descriptions that require semantic understanding and terms that must be precisely matched (e.g., legal clause numbers, specific model names). Hybrid retrieval can address both aspects, ensuring the accuracy and reliability of the results.

[0053] After hybrid retrieval, the two recall results from the local knowledge base need to be dynamically merged. Let the list of keyword documents returned by the BM25 keyword retrieval be... The vector search returns a list of vector documents. When merging search results, a weighted calculation method is usually used, which requires determining the dynamic calculation weights based on the composition of the standardized query content. The dynamic weight calculation is determined based on the content composition of the standardized query, including: The proportion of keywords and the proportion of conceptual descriptions are determined based on the content composition; The difference between the percentage of keywords and the percentage of conceptual descriptions is defined as the difference percentage. In response to the absolute value of the difference percentage being less than or equal to a preset first threshold percentage, the default calculation weight is determined as the dynamic calculation weight; In response to the absolute value of the difference percentage being greater than the preset first threshold percentage, and the difference percentage being positive, the first weight corresponding to the keyword document list is increased on the basis of the default calculated weight to obtain the dynamic calculated weight; In response to the absolute value of the difference percentage being greater than the preset first threshold percentage, and the difference percentage being negative, the second weight corresponding to the vector document list is increased on the basis of the default calculated weight to obtain the dynamically calculated weight.

[0054] In practice, when merging search results, it is necessary to dynamically calculate the first weight corresponding to the keyword document list. The second weight corresponding to the list of vector documents. The values ​​of the first and second weights are related to the proportion of keywords and conceptual descriptions in the content. When a standardized query contains a large number of specific technical terms, it indicates that the user needs an exact match of official documentation or code. Increasing the first weight... This ensures that the results accurately target these key entities. When the query is a conceptual description such as "simulating a bottleneck link," the focus is on understanding the semantics. Second weight. This helps find documents related to "bottleneck" and "link simulation" but that may not contain these specific terms. This dynamic approach cleverly balances the precision of keyword retrieval with the semantic understanding capabilities of vector retrieval, which is key to the superior performance of hybrid retrieval compared to single methods.

[0055] Therefore, the difference between the proportion of keywords and the proportion of conceptual descriptions is defined as the difference proportion, and the difference proportion is used to measure the fusion preference.

[0056] When the absolute value of the difference ratio is less than or equal to the preset first threshold ratio, it indicates that the preference for keyword retrieval and vector retrieval is similar. There is no need to change the weights, and the default calculated weights can be used directly for fusion calculation. In this case, the default calculated weights are determined as dynamic calculated weights.

[0057] When the absolute value of the difference percentage is greater than the preset first threshold percentage, it indicates that there is a significant difference in preference between keyword retrieval and vector retrieval. If the difference percentage is positive, it indicates a greater preference for keyword retrieval. Based on the default calculated weight, the first weight corresponding to the keyword document list is increased, and the second weight is decreased by the same amount to obtain the dynamically calculated weight. If the absolute value of the difference percentage is greater than the preset first threshold percentage, it indicates a significant difference in preference between keyword retrieval and vector retrieval. If the difference percentage is negative, it indicates a greater preference for vector retrieval. Based on the default calculated weight, the second weight corresponding to the vector document list is increased, and the first weight is decreased by the same amount to obtain the dynamically calculated weight.

[0058] When merging the keyword document list and the vector document list, Reciprocal Rank Fusion (RRF) is employed. The advantage of the RRF algorithm is that it doesn't concern itself with the original scores of the keyword and vector document lists (these scores are usually not directly comparable), but only with the ranking of each document in its respective result list. By processing rankings rather than raw scores, RRF avoids the difficulty of designing complex normalization rules for the scores of different retrieval algorithms, providing a fair fusion platform. Even if a retrieval algorithm performs poorly, as long as another retrieval algorithm ranks the relevant document highly, the document's overall ranking after RRF will still be high, ensuring system stability.

[0059] The process of merging the keyword document list and the vector document list by inverse sorting based on dynamically calculated weights to obtain the local search results is as follows: The initial document pool is determined by the union of the keyword document list and the vector document list, and the local document score for each document is calculated based on its ranking in its respective document list. :

[0060] in, This indicates the ranking of the keyword document within the keyword document list. This indicates the rank of the vector document within the list of vector documents. This is the smoothing constant (default is 60). This represents the first weight after dynamic calculation; This represents the second weight after dynamic calculation, and d represents the d-th document in the initial document pool. When calculating the local document score, if the same document appears in the document lists of multiple retrievals, the algorithm automatically accumulates the scores based on its ranking in each list. Therefore, each document will only appear once in the final ranked list.

[0061] Finally, the documents in the initial document pool are sorted in reverse order based on their local document scores to obtain the fused local search results. The merged local search results Compared with external search results Merge into candidate text set .

[0062] Step 303: Calculate the fine-grained relevance score of each document in the candidate text set to the standardized query, and determine the preset number of documents with the highest fine-grained relevance scores as the final context.

[0063] In practice, the candidate text set is fed into a BGE-Reranker-based cross-encoder for final fine-grained ranking. During fine-grained ranking, a fine-grained relevance score Si=Reranker(qrewritten,di) is calculated for each document and the normalized query pair (qrewritten,di), and the documents are sorted in descending order according to the fine-grained relevance score. Finally, the top 4 documents with the highest scores are selected to form the final context C={d1,d2,d3,d4}.

[0064] After merging local and web search results, fine-tuning using a cross-encoder like BGE-Reranker is a crucial step in improving the quality of the final context. Unlike the fast but relatively coarse retrieval stage, the re-ranking model deeply understands the subtle semantic relationships between standardized queries and each document, performing more refined, fine-grained relevance scoring. It effectively identifies and lowers the ranking of documents that only match keywords but are actually irrelevant, while handling duplicate results from different sources, ensuring that the final context C input to the large model is highly relevant and redundant. The combination of dynamic weighting and re-ranking ensures that the system can flexibly respond to diverse standardized query intentions, whether it's finding specific terms or exploring abstract concepts, recalling the most relevant information as the final context.

[0065] Step 304: Input the final context and standardized query into the preset blank prompt template to obtain the prompt template, and use the large language model to generate and clean the code based on the prompt template to obtain the original script of user intent.

[0066] In practice, the pre-defined blank prompt template is a structured framework, which may include sections such as "System Instructions," "Background Knowledge," "User Queries," and "Output Format Requirements." Its purpose is to standardize the input format, ensuring that each request to the Large Language Model (LLM) is clearly structured and complete, thereby guiding the LLM to generate high-quality, expected code. After the filled-in prompt template is input into the LLM, the LLM, based on its vast amount of learned code data, understands the user's intent and generates the original script that implements that intent. For example, if the goal is to create a Mininet network, it might generate a Python script containing elements such as topology definitions and host configurations.

[0067] The code directly generated by LLM may contain unnecessary comments, explanatory text, minor syntax errors, or use of deprecated libraries. Code cleaning, similar to code review and polishing, automatically removes this irrelevant content through a series of rules or simple models, and attempts to correct obvious errors, ensuring that the output "user-intended raw script" is concise, readable, and executable clean code.

[0068] Step 305: Activate the preset running agent according to the user's intention original script to generate the scene and obtain the network training scene.

[0069] In practice, the cleaned user intent script is passed to the running agent. The agent parses the instructions in the script and dynamically allocates computing resources and loads necessary components or images accordingly, preparing the underlying infrastructure for scenario generation. Following the script logic, the agent progressively instantiates network devices (such as switches and routers) and host nodes, configuring their connectivity and network policies. The final result is a complete and isolated network training scenario. For example, based on a script describing a data center topology, the agent can quickly create a complex Fat-Tree network structure containing multiple Pods, Spine, and Leaf switches, allowing users to immediately begin experimenting and learning.

[0070] In some embodiments, such as Figure 4 As shown, the training scenario generation method based on retrieval enhancement and intelligent agents also includes: Step 401: In response to detecting a user's modification operation on the original user intent script, update the original user intent script according to the modification operation to obtain the modified user intent script.

[0071] In specific implementation, this application embodiment also features an online editing and re-execution mechanism. To support deep user intervention and immediate verification of the generated user intent original script, a closed-loop "generation-modification-execution-feedback" interactive development environment is constructed. The front-end integrates an editable Gradio code component in the "Generated Code" tab, allowing users to directly modify the Mininet script (user intent original script) in the browser, including adjusting the topology, link parameters, or inserting custom test logic; after editing, a user intent correction script is obtained.

[0072] Step 402: Based on the user's intent, modify the script to activate and run the intelligent agent to regenerate the scene, obtain the modified network training scene, close the network training scene, and open the modified network training scene.

[0073] In practice, when a user enters the re-execution process, the running agent is reactivated, but its behavior is adjusted accordingly: it no longer executes the original script with the user's intent, but instead loads the modified script with the user's intent, and redeploys it after cleaning up the existing environment. This design constructs a closed-loop exploration mechanism of "generation-modification-verification," demonstrating the running agent's dynamic response capability to user intervention, making it not only an execution agent but also a dynamic collaborative partner that supports iterative experiments. For example, a user can trigger the backend execution process by clicking the "Run This Modified Script" control in the user interface. The backend first cleans up the runtime environment to ensure consistency, then writes the modified script with the user's intent to a temporary file, and executes the script synchronously and blockingly via `subprocess.run`, fully capturing its standard output and error information.

[0074] In some embodiments, the training scenario generation method based on retrieval enhancement and agents further includes, after closing the network training scenario: The network training scenario is structured to obtain a static execution report, which is then visualized in the user interface.

[0075] In practice, after shutting down the network training scenario, the original output of the network training scenario is structured to generate a static execution report containing key test results, execution status, and timestamps. This static execution report is then sent back to the front end for display. This mechanism allows users to complete code refinement and effect verification within the platform without switching to external tools, significantly improving teaching and experimental efficiency. Students can quickly try different network configurations based on the user-intended original script and intuitively understand the impact of parameter changes on network behavior through real-time feedback. Teachers can also use this to guide students in progressive exploration, forming an efficient learning loop of "generation—debugging—verification," thereby deepening their understanding of network principles and SDN technology.

[0076] To visually represent the network structure, a topology visualization mechanism combining static parsing and dynamic updates is introduced. Before script execution, the definitions of hosts, switches, and links in the Python code are parsed using regular expressions. A graph model is built using NetworkX, and an initial topology diagram is generated by rendering with Matplotlib and Graphviz. During interactive execution, the system automatically injects a session helper function (export_topology) into the generated script. This function iterates through the real-time status of the current Mininet network objects and serializes the host, switch, and link information into JSON format, encapsulating it within special tags before outputting it. The backend asynchronous I / O pipeline continuously monitors the child process output. Once the tag is detected, the JSON data is parsed, the graph model is reconstructed, and an updated topology image is rendered. Users can trigger this dynamic update process simply by clicking the corresponding generation control in the UI, allowing the topology diagram to reflect the current state of the network in real time, achieving a seamless transition from static preview to dynamic visualization.

[0077] In some embodiments, such as Figure 5 As shown, the training scenario generation method based on retrieval enhancement and intelligent agents also includes: Step 501: In response to receiving a user's query request, aggregate the context information of the current session to obtain the complete context.

[0078] In practice, the dialogue agent remains in a standby state. When a user asks a question in the "Direct Chat with LLM" tab, the dialogue agent automatically aggregates the context information of the current session to obtain a complete context (including the original requirement, generated code, runtime logs, etc.), and combines it with relevant information retrieved from the professional knowledge base by RAG to construct a context-rich prompt. Based on this, the dialogue agent can provide precise answers to questions, troubleshooting, or code optimization suggestions according to the specific experimental state, acting as a "virtual expert" and providing context-aware intelligent guidance.

[0079] To provide intelligent Q&A that is highly relevant to the current experiment, a state object is maintained for each user session, recording the original query, generated code, real-time logs, and historical dialogues. When a user asks a question, the backend automatically formats this key information into text and dynamically injects it into the prompt word prefixes of the large language model, enabling the model to reason based on the complete experimental context and obtain a complete understanding of the situation.

[0080] Step 502: Search professional databases based on the query request to obtain search assistance information.

[0081] Step 503: Determine the tutoring prompts for the current network training scenario based on the overall context and retrieve auxiliary information.

[0082] In practice, it is also necessary to retrieve the most relevant technical document fragments from the local knowledge base to the user's question request, and feed them into the model as supplementary information (contextual aids). This dual context injection mechanism ensures that the guidance prompts provided by the system not only fit the specific details of the current experiment, but also combine professional domain knowledge, thereby providing accurate fault diagnosis, code explanation, or exploration suggestions, upgrading the platform from a simple execution tool to an intelligent learning partner with "virtual expert" capabilities.

[0083] In summary, the training scenario generation method based on retrieval enhancement and intelligent agents automatically transforms the network experiment intent described in natural language into a structured Mininet Python script. It employs a dual-channel knowledge fusion mechanism of "local + external": First, the user's natural language input is semantically rewritten to improve retrieval accuracy. Then, relevant information is retrieved in parallel from a local vector database (storing Mininet official documentation and example scripts) and an external internet search engine (such as Tavily). Within the local channel, multi-path recall is performed by combining BM25 keyword matching and dense vector semantic retrieval, with weights dynamically allocated based on the density of professional terms in the query. The inverse ranking fusion (RRF) algorithm is used to initially rank the two results. Subsequently, the fused local and external retrieval results are merged and fed into a BGE-Reranker-based cross-encoder for fine-grained relevance reordering to select the optimal context. Finally, this context, along with the rewritten user query, is injected into a preset prompt template. A large language model generates the code script, and regular expressions are used to clean the output code script, ensuring that the output is a clean and executable original script of the user intent. This significantly improves the accuracy, reliability, and timeliness of code generation in professional network domains.

[0084] By deeply integrating and optimizing Retrieval Enhanced Generation (RAG) technology with the network virtualization platform Mininet, an automatic creation system for network training scenarios driven by intelligent agents has been constructed. This significantly reduces the operational threshold and cognitive load for teachers and students in setting up experimental environments, and revolutionizes the traditional "instruction-driven" interaction mode into an "intent-driven" natural language interaction paradigm. A dual-channel retrieval mechanism combining local knowledge bases and external network searches is adopted, along with dynamic fusion and cross-encoder ranking strategies, effectively ensuring the professionalism, accuracy, and reliability of the generated code. Simultaneously, the platform integrates five core functions: interactive execution, dynamic topology visualization, online code editing, network traffic analysis, and context-aware dialogue. This forms a complete closed loop from requirement input, environment generation, real-time interaction to intelligent assistance. It not only supports one-click automated deployment but also empowers students to conduct low-cost, high-efficiency exploratory and personalized experiments, greatly improving the flexibility, depth, and intelligence of network practical teaching, and providing a practical technical path and innovative teaching paradigm for the digital transformation of education.

[0085] It should be noted that the method in this embodiment can be executed by a single device, such as a computer or server. The method can also be applied in a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method in this embodiment, and the multiple devices will interact with each other to complete the method described.

[0086] It should be noted that the above description describes some embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in a different order than that shown in the above embodiments and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0087] Based on the same inventive concept, and corresponding to any of the above embodiments, this application also provides a training scenario generation device based on retrieval enhancement and intelligent agents.

[0088] refer to Figure 6 The training scenario generation device based on retrieval enhancement and intelligent agents includes: The user intent determination module 10 is configured to: obtain the user's natural language input, perform semantic rewriting on the natural language input, and obtain a standardized query; The retrieval enhancement generation module 20 is configured to perform dual-channel retrieval enhancement generation based on standardized queries and a pre-established local knowledge base to obtain a candidate text set; The text fine-grained filtering module 30 is configured to: calculate the fine-grained relevance score of each document in the candidate text set with the standardized query, and determine the preset number of documents with the highest fine-grained relevance scores as the final context; The intent script generation module 40 is configured to: input the final context and standardized query into a preset blank prompt template to obtain the prompt template, and use a large language model to generate and clean the code based on the prompt template to obtain the original user intent script; The training scenario generation module 50 is configured to: activate a preset running intelligent agent to generate a scenario based on the user's original script, thereby obtaining a network training scenario.

[0089] For ease of description, the above devices are described in terms of function, divided into various modules. Of course, in implementing this application, the functions of each module can be implemented in one or more software and / or hardware.

[0090] The apparatus described above is used to implement the corresponding training scenario generation method based on retrieval enhancement and intelligent agents in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0091] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the training scenario generation method based on retrieval enhancement and intelligent agents as described in any of the above embodiments.

[0092] Figure 7 This embodiment illustrates a more specific hardware structure of an electronic device. The device may include a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, memory 1020, input / output interface 1030, and communication interface 1040 are interconnected internally via the bus 1050.

[0093] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0094] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.

[0095] The input / output interface 1030 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.

[0096] The communication interface 1040 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0097] Bus 1050 includes a pathway for transmitting information between various components of the device, such as processor 1010, memory 1020, input / output interface 1030, and communication interface 1040.

[0098] It should be noted that although the above-described device only shows the processor 1010, memory 1020, input / output interface 1030, communication interface 1040, and bus 1050, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.

[0099] The electronic devices described above are used to implement the corresponding training scenario generation methods based on retrieval enhancement and agents in any of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0100] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the training scenario generation method based on retrieval enhancement and intelligent agents as described in any of the above embodiments.

[0101] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.

[0102] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the training scenario generation method based on retrieval enhancement and intelligent agents as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0103] Based on the same concept, corresponding to the methods of any of the above embodiments, this application also provides a computer program product, including computer program instructions. When the computer program instructions are run on a computer, the computer causes the computer to execute the training scenario generation method based on retrieval enhancement and intelligent agents as described in any of the above embodiments, which has the beneficial effects of the corresponding method embodiments, and will not be repeated here.

[0104] It is understood that before using the technical solutions of the various embodiments in this application, users will be informed of the type, scope of use, and usage scenarios of the personal information involved in an appropriate manner, and user authorization will be obtained.

[0105] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose, based on the prompt message, whether to provide personal information to the software or hardware such as electronic devices, applications, servers, or storage media performing the operations described in this application.

[0106] As an optional but not limited implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0107] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this application. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this application.

[0108] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this application is limited to these examples; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of this application as described above, which are not provided in detail for the sake of brevity.

[0109] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this application, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this application, and this also takes into account the fact that the details of the implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this application will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of this application, it will be apparent to those skilled in the art that the embodiments of this application can be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0110] Although this application has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.

[0111] The embodiments of this application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the claims of this application. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of this application should be included within the protection scope of this application.

Claims

1. A method for generating training scenarios based on retrieval enhancement and intelligent agents, characterized in that, include: Obtain the user's natural language input, perform semantic rewriting on the natural language input, and obtain a standardized query; A candidate text set is generated by performing dual-channel retrieval enhancement based on the standardized query and the pre-established local knowledge base; Calculate the fine-grained relevance score between each document in the candidate text set and the standardized query, and determine the preset number of documents with the highest fine-grained relevance scores as the final context; The final context and the standardized query are input into a preset blank prompt template to obtain a prompt template. Then, a large language model is used to generate and clean the code based on the prompt template to obtain the original script of the user intent. Based on the user intent, the original script activates a preset running agent to generate a scene, thus obtaining a network training scene.

2. The training scenario generation method based on retrieval enhancement and intelligent agents according to claim 1, characterized in that, The process of enhancing the generation through dual-channel retrieval based on the standardized query and a pre-established local knowledge base yields a candidate text set, including: Based on the standardized query, a local search is performed in the local knowledge base to obtain local search results; Perform external network searches based on the standardized queries to obtain external search results; The union of the external search results and the local search results is determined as the candidate text set.

3. The training scenario generation method based on retrieval enhancement and intelligent agents according to claim 2, characterized in that, The step of performing a local search in the local knowledge base based on the standardized query to obtain local search results includes: Based on the standardized query, a local retrieval is performed in the local knowledge base to obtain a list of keyword documents and a list of vector documents. The dynamic weight is determined based on the content composition of the standardized query. The keyword document list and the vector document list are sorted and merged in reverse order based on the dynamically calculated weights to obtain the local search results.

4. The training scenario generation method based on retrieval enhancement and intelligent agents according to claim 3, characterized in that, The step of determining the dynamic weight based on the content composition of the standardized query includes: The proportion of keywords and the proportion of conceptual descriptions are determined based on the content composition. The difference between the percentage of keywords and the percentage of conceptual descriptions is determined as the difference percentage. In response to the absolute value of the difference ratio being less than or equal to a preset first threshold ratio, the default calculation weight is determined as the dynamic calculation weight; In response to the absolute value of the difference percentage being greater than a preset first threshold percentage, and the difference percentage being a positive number, the first weight corresponding to the keyword document list is increased based on the default calculated weight to obtain the dynamic calculated weight; In response to the absolute value of the difference percentage being greater than a preset first threshold percentage, and the difference percentage being negative, the second weight corresponding to the vector document list is increased based on the default calculated weight to obtain the dynamic calculated weight.

5. The training scenario generation method based on retrieval enhancement and intelligent agents according to claim 1, characterized in that, Also includes: In response to detecting a user's modification operation on the original user intent script, the original user intent script is updated according to the modification operation to obtain a modified user intent script; According to the user intent, the script is used to activate the running agent to regenerate the scene, resulting in a corrected network training scene. The corrected network training scene is then closed and opened.

6. The training scenario generation method based on retrieval enhancement and intelligent agents according to claim 5, characterized in that, After shutting down the network training scenario, the following is also included: The network training scenario is structured to obtain a static execution report, which is then visualized in the user interface.

7. The training scenario generation method based on retrieval enhancement and intelligent agents according to claim 1, characterized in that, Also includes: In response to receiving a user's query request, the context information of the current session is aggregated to obtain the complete context; Based on the query request, a professional database was searched to obtain search assistance information; Based on the overall context and the retrieval assistance information, determine the tutoring prompts for the current online training scenario.

8. A training scenario generation device based on retrieval enhancement and intelligent agents, characterized in that, include: The user intent determination module is configured to: acquire the user's natural language input, perform semantic rewriting on the natural language input, and obtain a standardized query; The retrieval enhancement generation module is configured to perform dual-channel retrieval enhancement generation based on the standardized query and a pre-established local knowledge base to obtain a candidate text set; The text fine-grained filtering module is configured to: calculate the fine-grained relevance score of each document in the candidate text set with the standardized query, and determine the preset number of documents with the highest fine-grained relevance scores as the final context; The intent script generation module is configured to: take the final context and the standardized query input into a preset blank prompt template to obtain a prompt template, and use a large language model to generate and clean the code based on the prompt template to obtain the original user intent script; The training scenario generation module is configured to: activate a preset running agent to generate a scenario based on the user intent original script, thereby obtaining a network training scenario.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 7.