Power simulation knowledge base question and answer method and system based on large language model

Through the power simulation knowledge base question and answer method based on large language model, the problem of limitations of keyword matching methods in the existing technology is solved, faster and more accurate information reply is achieved, and users' utilization efficiency of power simulation knowledge base is improved.

CN119988537APending Publication Date: 2025-05-13TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411842931.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

There are limitations in the way of keyword matching in the prior art, which makes it impossible for users to effectively utilize the power simulation help manual or knowledge base.

Method used

The power simulation knowledge base question and answer method based on large language models is used to generate corresponding replies by obtaining user input information, intent recognition and knowledge base query. The method includes obtaining user input information, identifying intents, selecting appropriate knowledge bases, and retrieving knowledge based on large language models, and generating knowledge base query responses.

Benefits of technology

It improves the speed and accuracy of replying to user input information, can effectively utilize the power simulation knowledge base, and lowers the threshold for users to find information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988537A_ABST
    Figure CN119988537A_ABST
Patent Text Reader

Abstract

The invention provides an electric power simulation knowledge base question answering method and system based on a large language model. The method comprises the steps of obtaining input information of a user; performing intention recognition on the input information according to a preset intention recognition algorithm to obtain an intention recognition result; when the intention recognition result is the daily chat intention, generating a daily chat reply corresponding to the input information based on a pre-trained large language model; under the condition that the intention recognition result is a knowledge base query intention, selecting a basic knowledge base corresponding to the input information according to a preset power simulation knowledge base selection algorithm, and retrieving knowledge from the basic knowledge base based on a pre-trained large language model to obtain a knowledge base query reply corresponding to the input information; the basic knowledge base comprises an electric power hardware knowledge base, an electric power simulation element knowledge base, a software platform use method knowledge base and an electric power system basic principle knowledge base. According to the invention, the reply speed and accuracy of the input information of the user can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power systems, and in particular to a large language model-based power simulation knowledge base question-answering method and system. Background Art

[0002] As the construction of new power systems advances, intelligent application systems are essential to improving the safety, stability, economic operation and quality services of power systems. Taking CloudPSS, a simulation application software development platform and operating environment for new power systems, as an example, the user help manual or knowledge base of power simulation software is used to introduce software functions and usage methods. Due to the large amount of content in the help manual, users often need to rely on keyword searches to quickly locate specific instruction documents, and then read the documents to obtain the necessary knowledge and master the usage methods. However, this method of keyword matching has certain limitations. If the document does not contain the keywords searched by the user, it may cause matching failure, making it impossible to effectively use the help manual or knowledge base. Summary of the invention

[0003] The present invention provides a large language model-based electric power simulation knowledge base question-answering method and system to solve the defects of the keyword matching method in the prior art that has certain limitations. The present invention can improve the reply speed and accuracy of the user's input information.

[0004] The present invention provides a large language model-based electric power simulation knowledge base question and answer method, comprising: obtaining user input information; performing intent recognition on the input information according to a preset intention recognition algorithm to obtain an intention recognition result; when the intention recognition result is a daily chat intention, generating a daily chat reply corresponding to the input information based on a pre-trained large language model; when the intention recognition result is a knowledge base query intention, selecting a basic knowledge base corresponding to the input information according to a preset electric power simulation knowledge base selection algorithm, and retrieving knowledge from the basic knowledge base based on the pre-trained large language model to obtain a knowledge base query reply corresponding to the input information; the basic knowledge base includes an electric power hardware knowledge base, an electric power simulation component knowledge base, a software platform usage method knowledge base and an electric power system basic principle knowledge base.

[0005] According to a large language model-based electric power simulation knowledge base question and answer method provided by the present invention, after the intention recognition of the input information is performed according to a preset intention recognition algorithm to obtain the intention recognition result, it also includes: when the intention recognition result is an electric power simulation operation intention, selecting an SDK code knowledge base according to a preset electric power simulation knowledge base selection algorithm, and retrieving code from the SDK code knowledge base based on a pre-trained large language model to obtain a code reply for the electric power simulation operation corresponding to the input information.

[0006] According to a large language model-based question-and-answer method for an electric power simulation knowledge base provided by the present invention, before obtaining the user's input information, it also includes: obtaining an electric power simulation knowledge text; segmenting and vectorizing the electric power simulation knowledge text to obtain data to be stored; and storing the data to be stored in a knowledge base corresponding to the type.

[0007] According to a large language model-based question-and-answer method for an electric power simulation knowledge base provided by the present invention, the intention of the input information is identified according to a preset intention recognition algorithm to obtain an intention recognition result, including: extracting semantic and contextual features of the input information to obtain intention features; encoding the intention features to obtain encoded intention features; inputting the encoded intention features into a preset intention classification model, and taking the intention category output by the preset intention classification model as the intention recognition result; wherein the preset intention classification model is a model based on a support vector machine, logistic regression or a neural network, and is used to determine the intention category of the input information.

[0008] According to a large language model-based electric power simulation knowledge base question-answering method provided by the present invention, the basic knowledge base corresponding to the input information is selected according to a preset electric power simulation knowledge base selection algorithm, including: extracting knowledge base related features of the input information to obtain knowledge base features; the knowledge base features include keywords and context information related to the knowledge base; encoding the knowledge base features to obtain encoded knowledge base features; inputting the encoded knowledge base features into a preset knowledge base selection model, and taking the target knowledge base output by the preset knowledge base selection model as the basic knowledge base corresponding to the input information; wherein the preset knowledge base selection model is used to evaluate the correlation scores with the electric power hardware knowledge base, the electric power simulation component knowledge base, the software platform usage method knowledge base and the electric power system basic principle knowledge base according to the encoded knowledge base features, and select the database with the highest correlation score as the target knowledge base.

[0009] According to a large language model-based power simulation knowledge base question and answer method provided by the present invention, the method retrieves knowledge from the basic knowledge base based on a pre-trained large language model to obtain a knowledge base query reply corresponding to the input information, including: vectorizing the input information and the basic knowledge base to obtain vectorized input information and a vectorized basic knowledge base; the vectorized basic knowledge base includes vectorized corpus fragments; performing vector similarity calculation on the vectorized input information and the vectorized corpus fragment based on the pre-trained large language model to retrieve the corpus fragment most similar to the vectorized input information; and generating a knowledge base query reply corresponding to the input information based on the pre-trained large language model according to the input information and the most similar corpus fragment.

[0010] According to a large language model-based electric power simulation knowledge base question and answer method provided by the present invention, after retrieving code from the SDK code knowledge base based on a pre-trained large language model to obtain a code reply for the electric power simulation operation corresponding to the input information, it also includes: calling a Python code interpreter through the code in the code reply to control the Python code interpreter to call the electric power simulation software to perform the electric power simulation operation.

[0011] The present invention also provides an electric power simulation knowledge base question and answer system based on a large language model, comprising: an acquisition module, used to acquire user input information; an intention recognition module, used to perform intention recognition on the input information according to a preset intention recognition algorithm to obtain an intention recognition result; a daily reply module, used to generate a daily chat reply corresponding to the input information based on a pre-trained large language model when the intention recognition result is a daily chat intention; a query reply module, used to select a basic knowledge base corresponding to the input information according to a preset electric power simulation knowledge base selection algorithm when the intention recognition result is a knowledge base query intention, and retrieve knowledge from the basic knowledge base based on the pre-trained large language model to obtain a knowledge base query reply corresponding to the input information; the basic knowledge base includes an electric power hardware knowledge base, an electric power simulation component knowledge base, a software platform usage method knowledge base and an electric power system basic principle knowledge base.

[0012] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for questioning and answering an electric power simulation knowledge base based on a large language model as described above is implemented.

[0013] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described large language model-based electric power simulation knowledge base question-answering methods.

[0014] The present invention provides a method and system for question-answering a power simulation knowledge base based on a large language model, the method comprising: obtaining input information of a user; performing intent recognition on the input information according to a preset intent recognition algorithm to obtain an intent recognition result; when the intent recognition result is a daily chat intent, generating a daily chat reply corresponding to the input information based on a pre-trained large language model; when the intent recognition result is a knowledge base query intent, selecting a basic knowledge base corresponding to the input information according to a preset power simulation knowledge base selection algorithm, and retrieving knowledge from the basic knowledge base based on the pre-trained large language model to obtain a knowledge base query reply corresponding to the input information; the basic knowledge base includes a power hardware knowledge base, a power simulation component knowledge base, a software platform usage method knowledge base, and a power system basic principle knowledge base. The present invention can improve the speed and accuracy of replying to the user's input information. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0016] Figure 1 It is a flow chart of a large language model-based electric power simulation knowledge base question-answering method provided by the present invention.

[0017] Figure 2 It is a specific flow chart of a large language model-based power simulation knowledge base question and answer method provided by the present invention.

[0018] Figure 3 It is a schematic diagram of the process of constructing a power simulation vectorization database provided by the present invention.

[0019] Figure 4 It is a schematic diagram of the principle of the power simulation operation provided by the present invention.

[0020] Figure 5 It is a structural schematic diagram of a power simulation knowledge base question and answer system based on a large language model provided by the present invention.

[0021] Figure 6 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0022] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0023] In order to support the realization of the "dual carbon" goal and respond to the country's major strategic layout, the energy and power industry is moving towards building a new power system that is clean, low-carbon, safe, reliable, economical, efficient, coordinated in supply and demand, flexible and intelligent. This transformation will profoundly change the form, characteristics and operation mechanism of the power system, making it more complex, diverse, random and nonlinear. At the same time, the dynamic balance challenges of the system across regions are becoming increasingly prominent, and there is an urgent need to establish an intelligent perception and control system.

[0024] In this process, artificial intelligence (AI) technology plays a cornerstone role in the intelligentization of power. After many rounds of theoretical and technological innovations, AI technology has made significant research progress and has been widely used in many key areas such as perception, prediction, analysis and regulation of power systems. At present, the operation mode of the power system generally presents the characteristics of "human-machine collaboration", that is, human decision-making is the main factor, supplemented by the intelligent processing capabilities of machines, jointly promoting the intelligent transformation of the power system.

[0025] Generative artificial intelligence technology, as the core driving force for the development of intelligent power sector, is rapidly emerging and becoming a key technology for improving the level of artificial intelligence in the power industry. This technology provides a practical and efficient development path for achieving the general artificial intelligence goal of the power industry. General artificial intelligence technology represented by large models has achieved innovation in artificial intelligence technology models in terms of model construction, training and learning, and hardware support. Multimodal large models (hereinafter referred to as "large models") refer to large-scale parameter artificial intelligence models that integrate multimodal information such as text, images, and videos for joint pre-training and fine-tuning. The large-scale parameters of the large model provide a model carrier for multimodal information fusion, and the combination of massive parameter models and pre-training models provides support for "capability emergence".

[0026] Please refer to Figure 1 , Figure 1 A schematic flow chart of a large language model-based electric power simulation knowledge base question-answering method provided by the present invention.

[0027] The present invention provides a large language model-based electric power simulation knowledge base question-answering method, comprising: 101: Get user input information; 102: Performing intent recognition on the input information according to a preset intent recognition algorithm to obtain an intent recognition result; 103: When the intent recognition result is a daily chat intent, a daily chat reply corresponding to the input information is generated based on the pre-trained large language model; 104: When the intent recognition result is a knowledge base query intent, a basic knowledge base corresponding to the input information is selected according to a preset power simulation knowledge base selection algorithm, and knowledge is retrieved from the basic knowledge base based on a pre-trained large language model to obtain a knowledge base query response corresponding to the input information; the basic knowledge base includes a power hardware knowledge base, a power simulation component knowledge base, a software platform usage knowledge base, and a power system basic principle knowledge base.

[0028] The present invention provides a method for question-answering a power simulation knowledge base based on a large language model. The method first obtains the user's input information, which can be a query request submitted by the user through a graphical user interface (GUI) or a command line interface (CLI). For example, the user may enter a question about power system simulation: "How to set the transformer parameters in CloudPSS?". Then, the user's input information is recognized by a preset intention recognition algorithm, and the user's purpose is determined by semantic analysis, and then different processing methods are selected, such as direct reply, query database, execution of operations, etc., to improve the response speed. The preset intention recognition algorithm can be based on a machine learning model, such as a support vector machine (SVM) or a neural network, to analyze the user's input and determine its intention. If the intention recognition result shows that the user's input information is a daily chat intention, then a daily chat reply corresponding to the user's input information is generated based on a pre-trained large language model (such as GPT-3), reducing the time overhead of knowledge base retrieval. For example, if the user enters "What is the weather like today?", the system will generate a daily chat reply about the weather. If the intent recognition result indicates that the user's input information is a knowledge base query intention, and the query is about knowledge issues related to power system simulation, then the user's query content is classified according to the preset power simulation knowledge base selection algorithm, and then different basic knowledge bases are referenced. The preset power simulation knowledge base selection algorithm can select the most appropriate knowledge base based on the match between the user's query keywords and the pre-defined keywords in the knowledge base. Once the corresponding knowledge base is selected, the system will perform RAG enhanced retrieval of the knowledge most relevant to the user's input information from the selected knowledge base based on the pre-trained large language model, which is more lightweight and improves the accuracy of semantic retrieval. For example, if the user asks a question about transformer parameter settings, the system will retrieve relevant information from the power simulation component knowledge base and generate a knowledge base query response to guide the user on how to set the transformer parameters in CloudPSS. The present invention can provide an efficient and accurate power simulation knowledge base question and answer service to meet the diverse query needs of users in the field of power simulation.

[0029] Please refer to Figure 2 , Figure 2 A schematic diagram of a specific process of a large language model-based power simulation knowledge base question and answer method provided by the present invention.

[0030] As a preferred embodiment, after the intent recognition result is obtained by performing intent recognition on the input information according to a preset intent recognition algorithm, it also includes: when the intent recognition result is an electric power simulation operation intention, selecting an SDK code knowledge base according to a preset electric power simulation knowledge base selection algorithm, and retrieving code from the SDK code knowledge base based on a pre-trained large language model to obtain a code response for the electric power simulation operation corresponding to the input information.

[0031] In order to lower the threshold for using power simulation software and assist users in operating power simulation software, in this embodiment, when the user's input information is identified as an intention for power simulation operation, for example, when the user asks "how to automatically calculate short-circuit current in CloudPSS", the SDK (Software Development Kit) code knowledge base is selected according to the preset power simulation knowledge base selection algorithm. The large language model analyzes the input information, retrieves the relevant code of the SDK code knowledge base as the context, integrates the function code of the specific operation as the code reply of the power simulation operation corresponding to the input information, and provides it to the user to perform a specific power simulation operation. The code is executed by the code compiler, and the simulation software is operated to achieve specific tasks, assisting users in developing power system simulation models, performing simulation operations, and analyzing simulation result data. The code compiler uses the SDK (Software Development Kit) unique to the power simulation software, which can call the simulation software operation. This embodiment lowers the threshold for using simulation software, controls simulation operations through natural language, reduces learning costs, and greatly improves the ease of use of power simulation software and the work efficiency of users. The method of the present invention is particularly suitable for complex queries that require specific operation guidance, so that non-professional users can also easily perform power simulation operations.

[0032] Please refer to Figure 3 , Figure 3 A schematic diagram of the process of constructing a power simulation vectorization database provided by the present invention.

[0033] As a preferred embodiment, before obtaining the user's input information, it also includes: obtaining power simulation knowledge text; segmenting and vectorizing the power simulation knowledge text to obtain data to be stored; and storing the data to be stored in a knowledge base corresponding to the type.

[0034] In order to ensure the continuous updating and enrichment of the power simulation knowledge base, so that the knowledge base can contain the latest and structured professional knowledge, in this embodiment, the power simulation knowledge text is first obtained. These texts may come from professional books, technical manuals, online documents or expert experience sharing in the field of power simulation. For example, the system may extract detailed instructions on how to configure specific simulation parameters from the user manual of the power simulation software. The classification of power simulation knowledge text materials includes: hardware, platform service management, quick start, and software. Each class is divided into detailed usage documents. Among them, the software category has the most content, including Xstudio (simustudio, funcstudio, appstudio) use, SDK call, etc. For example, an introduction to power system simulation software, power simulation component principles, simulation methods, SDK call methods, cases, codes, etc. In order to build a database suitable for rapid retrieval, the power simulation knowledge text needs to be segmented, so the text data needs to be organized into regular data suitable for segmentation. Of course, text data (words, sentences, documents) can also be represented in the form of vectors. Word vectorization converts words into binary or high-dimensional real vectors, and sentence and document vectorization converts sentences or documents into numerical vectors to obtain data to be stored. Then, different knowledge bases are constructed according to the data to be stored, and the vectorized text data is stored in the appropriate knowledge base. This method is conducive to more accurate matching of information during retrieval. For example, if the vectorized text is about power hardware, it will be stored in the power hardware knowledge base. This embodiment not only improves the accuracy and response speed of the knowledge base question and answer system, but also provides a powerful knowledge support platform for professionals and non-professionals in the field of power simulation. In this way, the system can handle user queries more effectively and provide more accurate and relevant knowledge and operational guidance.

[0035] It should be noted that: Text segmentation mainly considers two factors: the token limit of the embedding model; the impact of semantic integrity on the overall retrieval effect. For example, sentence segmentation is performed at the granularity of "sentence" to retain the complete semantics of a sentence. Common segmentation characters include: period, exclamation mark, question mark, line break, etc. Fixed-length segmentation can also be used. According to the token length limit of the embedding model, the text is segmented into fixed lengths (for example, 256 / 512 tokens). This segmentation method will lose a lot of semantic information, which is generally alleviated by adding a certain amount of redundancy at the beginning and end.

[0036] Vectorization is a process of converting text data into a vector matrix, which directly affects the results of subsequent retrieval. The models that can be used include ChatGPT-Embedding model, ERNIE-Embedding V1 model, M3E model, and BGE model.

[0037] The process of building an index after data vectorization and writing it into the database can be summarized as the data storage process. Databases suitable for RAG scenarios include: FAISS, Chromadb, ES, milvus, etc. Generally, you can choose a suitable database based on a comprehensive consideration of multiple factors such as business scenarios, hardware, and performance requirements.

[0038] As a preferred embodiment, intent recognition is performed on input information according to a preset intent recognition algorithm to obtain an intent recognition result, including: extracting semantic and contextual features of the input information to obtain intent features; encoding the intent features to obtain encoded intent features; inputting the encoded intent features into a preset intent classification model, and taking the intent category output by the preset intent classification model as the intent recognition result; wherein the preset intent classification model is a model based on support vector machines, logistic regression or neural networks, and is used to determine the intent category of the input information.

[0039] In order to understand and identify the intention or purpose expressed by the user in the input text or voice, in this embodiment, the understanding and analysis of natural language by a large language model is relied on. The large language model is the basis of intent recognition. It learns the grammar, semantics and contextual information of the language by training a large amount of text data. For example, the Transformer and BERT language models can be selected. By performing operations such as word segmentation and part-of-speech tagging on the input information, the semantic and contextual features in the text are extracted to obtain the intent features. The extracted intent features are then encoded to obtain the encoded intent features. The encoding process involves converting text features into numerical vectors, which can be achieved by using a pre-trained word embedding model (such as Word2Vec or BERT). Finally, the encoded intent features are input into a preset intent classification model, which is based on a machine learning algorithm such as a support vector machine (SVM), logistic regression or neural network, and is used to determine the intent category of the input information. The preset intent classification model is a training and optimization process, and this embodiment is not particularly limited here. Context information is crucial for the preset intent classification model to perform intent recognition. By analyzing the context of the user input, the user's intention can be understood more accurately. For example, in a dialogue system, context information can be the content of previous dialogues; in a search engine, context information can be keywords and web page content entered by the user. This embodiment can accurately identify which intent category the user's input information belongs to, such as daily chat, knowledge query, or power simulation operation. This precise intent recognition provides a solid foundation for subsequent knowledge retrieval and response generation, ensuring the efficiency and accuracy of the power simulation knowledge base question-and-answer system.

[0040] As a preferred embodiment, a basic knowledge base corresponding to the input information is selected according to a preset power simulation knowledge base selection algorithm, including: extracting knowledge base related features of the input information to obtain knowledge base features; the knowledge base features include keywords and context information related to the knowledge base; encoding the knowledge base features to obtain encoded knowledge base features; inputting the encoded knowledge base features into a preset knowledge base selection model, and using the target knowledge base output by the preset knowledge base selection model as the basic knowledge base corresponding to the input information; wherein the preset knowledge base selection model is used to evaluate the correlation scores with the power hardware knowledge base, the power simulation component knowledge base, the software platform usage method knowledge base and the power system basic principle knowledge base according to the encoded knowledge base features, and select the database with the highest correlation score as the target knowledge base.

[0041] In order to determine the basic knowledge base corresponding to the user's input content, in this embodiment, the input information is firstly subjected to knowledge base related feature extraction to obtain knowledge base features. Specifically, it involves identifying keywords and context information in the input information, and the knowledge base related features are associated with various knowledge bases of power simulation. Then, the extracted knowledge base features are encoded to obtain the encoded knowledge base features. The encoding process involves converting text features into numerical vectors. The encoded knowledge base features are input into a preset knowledge base selection model, which is based on a machine learning algorithm and is used to evaluate the relevance scores with the power hardware knowledge base, the power simulation component knowledge base, the software platform usage method knowledge base, and the power system basic principle knowledge base, and select the database with the highest relevance score as the target knowledge base. This embodiment analyzes and determines the knowledge base path for storing the knowledge to be retrieved based on the user's input content. Targeted selection of a specific knowledge base is more lightweight and can accurately select the knowledge base most relevant to the user's input information, thereby improving the accuracy and efficiency of knowledge retrieval.

[0042] As a preferred embodiment, knowledge is retrieved from a basic knowledge base based on a pre-trained large language model to obtain a knowledge base query response corresponding to the input information, including: vectorizing the input information and the basic knowledge base to obtain vectorized input information and a vectorized basic knowledge base; the vectorized basic knowledge base includes vectorized corpus fragments; performing vector similarity calculation on the vectorized input information and the vectorized corpus fragments based on the pre-trained large language model to retrieve the corpus fragment most similar to the vectorized input information; and generating a knowledge base query response corresponding to the input information based on the pre-trained large language model according to the input information and the most similar corpus fragment.

[0043] In order to accurately retrieve the knowledge most relevant to the user input information from the power simulation knowledge base and generate an accurate response, in this embodiment, after the user inputs the information, it is vectorized to obtain the vectorized input information. The basic knowledge base is vectorized to obtain the vectorized basic knowledge base. The corpus fragments in the vectorized basic knowledge base are stored in vectorized form. Based on the pre-trained large language model, the similarity between the vectorized input information and the vectorized corpus fragments is calculated, and the corpus fragments most similar to the vectorized input information are retrieved. Through the RAG retrieval algorithm, the most similar corpus fragments are obtained by retrieval and integrated into the prompt words, so that the large language model can refer to the corresponding knowledge to give a reasonable answer and generate a knowledge base query response corresponding to the input information. The core understanding of RAG is "retrieval + generation". The former mainly uses the efficient storage and retrieval capabilities of the vector database to recall the target knowledge; the latter uses the large language model and prompt engineering to reasonably use the recalled knowledge to generate the target answer.

[0044] Of course, the knowledge base search can also be performed in a full-text search mode. When data is stored, an inverted index is constructed by keywords; when searching, a full-text search is performed by keywords to find the corresponding records. The present invention does not make any special limitations here.

[0045] As the direct input of the large language model, the prompt word is one of the key factors affecting the accuracy of the model output. In the RAG scenario, the prompt word generally includes task description, background knowledge (retrieved), task instructions (generally user questions), etc. According to the task scenario and the performance of the large language model, other instructions can also be appropriately added to the prompt to optimize the output of the large language model. In actual application, it is often necessary to perform targeted prompt word tuning based on the actual output of the large language model.

[0046] By configuring the large language model interface, the large language model call and configuration prompt words are realized, and the present invention does not make any special limitation here.

[0047] As a preferred embodiment, after retrieving the code from the SDK code knowledge base based on the pre-trained large language model and obtaining the code response of the power simulation operation corresponding to the input information, it also includes: calling the Python code interpreter through the code in the code response to control the Python code interpreter to call the power simulation software to perform the power simulation operation.

[0048] Please refer to Figure 4 , Figure 4 A schematic diagram of the principle of the power simulation operation provided by the present invention.

[0049] In this embodiment, taking CloudPSS simulation software as an example, the front-end user inputs information. If the intention recognition determines that power simulation operation is required, the SDK code knowledge base is retrieved and the code is generated by the large language model as the context. The code calls the Python code interpreter, starts the function to execute the power simulation operation task according to the SDK specification of the simulation software, defines the function and task ID through FuncStudio, and returns the execution result to the front-end interface of APPStudio.

[0050] For example, the user input information is: use getComponentsByRid(rid) to obtain all components of the model with rid=model / CloudPSS / _newBreaker_3p.

[0051] The response from the large language model is: To get all three-phase circuit breaker components in the model with rid model / CloudPSS / _newBreaker_3p, we need to call the getComponentsByRid function. Since you have already initialized cloudpss_substation_Model, we can directly use this model to perform the query. The following code will achieve this goal: Python #Define the component type to be queried Component_type='model / CloudPSS / _newBreaker_3p' #Use the getComponentsLabel function to get the component label and ID of the specified type def get_components_by_type(model,component_type): components=model.getComponentsByRid(component_type) labels=[component[comp]['label']for comp in components] ids = list(components.keys()) return labels,ids #Get the label and ID of the three-phase circuit breaker breaker_labels,breaker_ids=get_components_by_type(cloudpss_substation_Model,component_type) #Print the label and ID of the circuit breaker print("Circuit breaker label:") for label in breaker_labels: print(label) print("\nBy circuit breaker ID:") for id in breaker_ids: print(id) This code first defines the type of circuit breaker to be queried, then calls the get_components_by_type function, which accepts the model and component type as parameters and returns a list of labels and IDs of the corresponding components. Finally, it prints out the labels and IDs of all found circuit breakers. Please make sure that your environment has been correctly configured with cloudpss_substation_Model before executing this code.

[0052] The user's input information is: Code output: Output truncated. Showing the last 2000 characters. You should try again and use compute.ai.summarize(ouput) over theoutput, or break it down into smaller steps. Component_new_breaker_3_p_193 component_new_breaker_3_p_194 component_new_breaker_3_p_195 component_new_breaker_3_p_197 component_new_breaker_3_p_2 component_new_breaker_3_p_20 component_new_breaker_3_p_209 component_new_breaker_3_p_21 component_new_breaker_3_p_210 component_new_breaker_3_p_211 component_new_breaker_3_p_212 component_new_breaker_3_p_213 component_new_breaker_3_p_9 What does the output mean / what are the next steps (if any, or are we done)? The response from the large language model is: The output shows the labels of all three-phase circuit breakers in the model with rid model / CloudPSS / _newBreaker_3p. Each label, such as component_new_breaker_3_p_193, represents a specific circuit breaker component in the model.

[0053] According to the output, we have successfully obtained all the specified types of circuit breakers. If you need further operations, such as analyzing the properties of these circuit breakers, modifying parameters, or performing simulations, you should clarify the specific needs of the next step.

[0054] If you just want to confirm the existence of these circuit breakers, then this task is complete. If you need to perform detailed analysis or operation on these circuit breakers, please provide specific operation instructions. For example, you need the parameters of a circuit breaker, modify the parameters, or add these circuit breakers to a specific simulation scenario.

[0055] The following describes the electric power simulation knowledge base question and answer system based on a large language model provided by the present invention. The electric power simulation knowledge base question and answer system based on a large language model described below and the electric power simulation knowledge base question and answer method based on a large language model described above can refer to each other.

[0056] Please refer to Figure 5 , Figure 5 A structural schematic diagram of a large language model-based electric power simulation knowledge base question-answering system provided by the present invention.

[0057] The present invention also provides an electric power simulation knowledge base question and answer system based on a large language model, comprising: an acquisition module 501, used to acquire user input information; an intention recognition module 502, used to perform intention recognition on the input information according to a preset intention recognition algorithm to obtain an intention recognition result; a daily reply module 503, used to generate a daily chat reply corresponding to the input information based on a pre-trained large language model when the intention recognition result is a daily chat intention; a query reply module 504, used to select a basic knowledge base corresponding to the input information according to a preset electric power simulation knowledge base selection algorithm when the intention recognition result is a knowledge base query intention, and retrieve knowledge from the basic knowledge base based on the pre-trained large language model to obtain a knowledge base query reply corresponding to the input information; the basic knowledge base includes an electric power hardware knowledge base, an electric power simulation component knowledge base, a software platform usage method knowledge base and an electric power system basic principle knowledge base.

[0058] As a preferred embodiment, it also includes a code reply module, which is used to select the SDK code knowledge base according to a preset power simulation knowledge base selection algorithm when the intention recognition result is an electric power simulation operation intention, and retrieve the code from the SDK code knowledge base based on a pre-trained large language model to obtain a code reply for the electric power simulation operation corresponding to the input information.

[0059] As a preferred embodiment, it also includes a simulation operation module, which is used to call the Python code interpreter through the code in the code reply to control the Python code interpreter to call the power simulation software to perform power simulation operations.

[0060] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the power simulation knowledge base question and answer method based on the large language model, the method comprising: obtaining the user's input information; performing intent recognition on the input information according to a preset intent recognition algorithm to obtain an intent recognition result; when the intent recognition result is a daily chat intent, generating a daily chat reply corresponding to the input information based on a pre-trained large language model; when the intent recognition result is a knowledge base query intent, selecting a basic knowledge base corresponding to the input information according to a preset power simulation knowledge base selection algorithm, and retrieving knowledge from the basic knowledge base based on the pre-trained large language model to obtain a knowledge base query reply corresponding to the input information; the basic knowledge base includes a power hardware knowledge base, a power simulation component knowledge base, a software platform usage method knowledge base and a power system basic principle knowledge base.

[0061] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0062] On the other hand, the present invention also provides a computer program product, which includes a computer program, and the computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the power simulation knowledge base question and answer method based on the large language model provided by the above methods, and the method includes: obtaining user input information; performing intent recognition on the input information according to a preset intention recognition algorithm to obtain an intention recognition result; when the intention recognition result is a daily chat intention, generating a daily chat reply corresponding to the input information based on a pre-trained large language model; when the intention recognition result is a knowledge base query intention, selecting a basic knowledge base corresponding to the input information according to a preset power simulation knowledge base selection algorithm, and retrieving knowledge from the basic knowledge base based on the pre-trained large language model to obtain a knowledge base query reply corresponding to the input information; the basic knowledge base includes a power hardware knowledge base, a power simulation component knowledge base, a software platform usage method knowledge base, and a power system basic principle knowledge base.

[0063] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the power simulation knowledge base question and answer method based on a large language model provided by the above-mentioned methods, the method comprising: obtaining user input information; performing intent recognition on the input information according to a preset intention recognition algorithm to obtain an intention recognition result; when the intention recognition result is a daily chat intention, generating a daily chat reply corresponding to the input information based on a pre-trained large language model; when the intention recognition result is a knowledge base query intention, selecting a basic knowledge base corresponding to the input information according to a preset power simulation knowledge base selection algorithm, and retrieving knowledge from the basic knowledge base based on the pre-trained large language model to obtain a knowledge base query reply corresponding to the input information; the basic knowledge base includes a power hardware knowledge base, a power simulation component knowledge base, a software platform usage method knowledge base, and a power system basic principle knowledge base.

[0064] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0065] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0066] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A question-answering method for power simulation knowledge base based on a large language model, characterized in that: include: Get user input information; Performing intent recognition on the input information according to a preset intent recognition algorithm to obtain an intent recognition result; When the intention recognition result is a daily chat intention, generating a daily chat reply corresponding to the input information based on a pre-trained large language model; In the case where the intention recognition result is a knowledge base query intention, a basic knowledge base corresponding to the input information is selected according to a preset power simulation knowledge base selection algorithm, and knowledge is retrieved from the basic knowledge base based on a pre-trained large language model to obtain a knowledge base query response corresponding to the input information; The basic knowledge base includes an electric power hardware knowledge base, an electric power simulation component knowledge base, a software platform usage method knowledge base and an electric power system basic principle knowledge base.

2. The power simulation knowledge base question-answering method based on a large language model according to claim 1, characterized in that: After performing intent recognition on the input information according to a preset intent recognition algorithm and obtaining an intent recognition result, the method further includes: When the intention recognition result is an electric power simulation operation intention, the SDK code knowledge base is selected according to a preset electric power simulation knowledge base selection algorithm, and the code is retrieved from the SDK code knowledge base based on a pre-trained large language model to obtain a code response for the electric power simulation operation corresponding to the input information.

3. The power simulation knowledge base question-answering method based on a large language model according to claim 1, characterized in that: Before obtaining the user's input information, the method further includes: Obtain power simulation knowledge text; Segmenting and vectorizing the electric power simulation knowledge text to obtain data to be stored; The data to be stored is stored in a knowledge base corresponding to the type.

4. The power simulation knowledge base question-answering method based on a large language model according to claim 1, characterized in that: The performing intent recognition on the input information according to a preset intent recognition algorithm to obtain an intent recognition result includes: Extracting semantic and contextual features from the input information to obtain intention features; Encoding the intention feature to obtain an encoded intention feature; Inputting the encoded intention feature into a preset intention classification model, and taking the intention category output by the preset intention classification model as the intention recognition result; Among them, the preset intention classification model is a model based on support vector machine, logistic regression or neural network, which is used to determine the intention category of the input information.

5. The power simulation knowledge base question-answering method based on a large language model according to claim 1, characterized in that: The selecting a basic knowledge base corresponding to the input information according to a preset power simulation knowledge base selection algorithm includes: Extracting knowledge base related features from the input information to obtain knowledge base features; the knowledge base features include keywords and context information related to the knowledge base; Encoding the knowledge base features to obtain encoded knowledge base features; Inputting the encoded knowledge base features into a preset knowledge base selection model, and using the target knowledge base output by the preset knowledge base selection model as a basic knowledge base corresponding to the input information; Among them, the preset knowledge base selection model is used to evaluate the correlation scores with the power hardware knowledge base, the power simulation component knowledge base, the software platform usage method knowledge base and the power system basic principles knowledge base according to the encoded knowledge base characteristics, and select the database with the highest correlation score as the target knowledge base.

6. The power simulation knowledge base question-answering method based on a large language model according to claim 1, characterized in that: The retrieving knowledge from the basic knowledge base based on the pre-trained large language model to obtain a knowledge base query response corresponding to the input information includes: Performing vectorization processing on the input information and the basic knowledge base to obtain vectorized input information and a vectorized basic knowledge base; the vectorized basic knowledge base includes vectorized corpus fragments; Performing vector similarity calculation on the vectorized input information and the vectorized corpus segment based on the pre-trained large language model, and retrieving the corpus segment that is most similar to the vectorized input information; According to the input information and the most similar corpus segment, a knowledge base query response corresponding to the input information is generated based on the pre-trained large language model.

7. The large language model-based power simulation knowledge base question-answering method according to claim 2, characterized in that: After retrieving the code from the SDK code knowledge base based on the pre-trained large language model to obtain the code response of the power simulation operation corresponding to the input information, the method further includes: The Python code interpreter is called through the code in the code reply to control the Python code interpreter to call the power simulation software to perform power simulation operations.

8. A power simulation knowledge base question-answering system based on a large language model, characterized in that: include: The acquisition module is used to obtain the user's input information; An intention recognition module is used to perform intention recognition on the input information according to a preset intention recognition algorithm to obtain an intention recognition result; A daily reply module, used for generating a daily chat reply corresponding to the input information based on a pre-trained large language model when the intention recognition result is a daily chat intention; A query reply module, configured to select a basic knowledge base corresponding to the input information according to a preset power simulation knowledge base selection algorithm when the intention recognition result is a knowledge base query intention, and retrieve knowledge from the basic knowledge base based on a pre-trained large language model to obtain a knowledge base query reply corresponding to the input information; The basic knowledge base includes an electric power hardware knowledge base, an electric power simulation component knowledge base, a software platform usage method knowledge base and an electric power system basic principle knowledge base.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the power simulation knowledge base question and answer method based on the large language model is implemented as described in any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the power simulation knowledge base question and answer method based on a large language model as described in any one of claims 1 to 7 is implemented.