Power knowledge question-answering method and device, electronic equipment and readable storage medium
By obtaining the power knowledge question statements in the power knowledge question and splicing with the power knowledge base text, and using a large language model to generate answer text, the problem of low accuracy and correlation in the power industry is solved, and high-quality Solution output.
Patent Information
- Application Number
- CN202411132478.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-12-20
AI Technical Summary
Existing large language models have low text accuracy and correlation to the answers to questions in the power industry, making it difficult to provide high-quality answers.
By obtaining power knowledge question statements, combining preset classification prompt words and answer prompt words, splicing with relevant texts in the power knowledge base, inputting large language models to generate answer text, and improving through confidence detection and rhetorical statement generation mechanisms The accuracy and relevance of the answer.
It significantly improves the accuracy and relevance of answer texts in the power knowledge question and answer system, ensures that the output is highly correlated with user queries, and solves the problem of low quality of answer texts in the prior art.
Smart Images

Figure CN119166765A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent question-answering technology, and in particular to an electric power knowledge question-answering method, device, electronic device and readable storage medium. Background Art
[0002] Large Language Model (LLM) is usually used in intelligent question answering to answer questions input by users. LLM model is popular among the public due to its powerful natural language processing ability. However, the current LLM model does not perform well in the power industry. For questions in the power industry, the text accuracy and relevance of the answers given by the LLM model are low. Summary of the invention
[0003] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes an electric power knowledge question-answering method, device, electronic device and readable storage medium, which can obtain an answer text based on an electric power knowledge question sentence, and can provide the accuracy of the answer text and the relevance of the answer text to the electric power knowledge question sentence.
[0004] To achieve the above objectives, the first embodiment of the present application provides an electric power knowledge question-answering method, comprising:
[0005] Get electricity knowledge question sentences;
[0006] Splicing the preset classification prompt words with the power knowledge question sentence to obtain a first spliced text;
[0007] Inputting the first concatenated text into a preset large language model to obtain the target power subdivision field type corresponding to the power knowledge question sentence; the classification prompt word is used to instruct the large language model to classify the power knowledge question sentence;
[0008] Concatenate the electric power knowledge question sentence with the target electric power subdivision field type to obtain a second concatenated text;
[0009] Based on the second concatenated text, determining a target electric power knowledge text related to the electric power knowledge question sentence from a preset electric power knowledge base;
[0010] splicing the preset answer prompt words, the power knowledge question sentence and the target power knowledge text to obtain a third spliced text;
[0011] The third concatenated text is input into the large language model to obtain an answer text; the answer prompt word is used to instruct the large language model to answer the power knowledge question sentence.
[0012] According to some embodiments of the first aspect of the present application, the step of inputting the third concatenated text into the large language model to obtain an answer text includes:
[0013] Inputting the third concatenated text into the large language model, and generating a prediction token based on the third concatenated text by the large language model;
[0014] Detecting the confidence of the prediction token, and if the confidence of the prediction token is lower than a preset confidence threshold, displaying a rhetorical question statement to the user;
[0015] Obtaining a response statement, wherein the response statement is a response statement input by the user based on the rhetorical question statement;
[0016] The power knowledge question statement is updated based on the response statement to obtain an updated question statement, and the answer text is obtained based on the updated question statement.
[0017] According to some embodiments of the first aspect of the present application, the step of generating the rhetorical question sentence includes:
[0018] splicing the preset rhetorical question prompt word with the power knowledge question sentence to obtain a fourth spliced text;
[0019] The fourth concatenated text is input into the large language model to obtain the rhetorical question sentence; the rhetorical question prompt word is used to instruct the large language model to output the rhetorical question sentence based on the power knowledge question sentence.
[0020] According to some embodiments of the first aspect of the present application, determining a target power knowledge text related to the power knowledge question statement from a preset power knowledge base based on the second concatenated text includes:
[0021] Convert the second concatenated text into a vector to obtain a question vector;
[0022] Based on the question vector, determining a target power knowledge vector similar to the question vector from a preset power knowledge vector library;
[0023] Based on the target power knowledge vector, a target power knowledge text corresponding to the power knowledge vector is determined from the power knowledge base; wherein the power knowledge vectors in the power knowledge vector base correspond one-to-one to the power knowledge text in the power knowledge base.
[0024] According to some embodiments of the first aspect of the present application, before determining, based on the question vector, a power knowledge vector similar to the question vector from a preset power knowledge vector library, the method further includes:
[0025] Obtain original documents on electricity knowledge;
[0026] Cutting the original power knowledge file to obtain a plurality of power knowledge texts;
[0027] Converting the electric power knowledge text into a vector to obtain the electric power knowledge vector;
[0028] The electric power knowledge text is stored in the electric power knowledge base, the electric power knowledge vector is stored in the electric power knowledge vector base, and a mapping relationship between the electric power knowledge text and the electric power knowledge vector is established.
[0029] According to some embodiments of the first aspect of the present application, the cutting of the original power knowledge file to obtain a plurality of the power knowledge texts includes:
[0030] Detecting and processing the type of the original power knowledge file;
[0031] If it is detected that the type of the original power knowledge file is a text document, the original power knowledge file is divided into a plurality of first paragraphs based on formatting marks in the original power knowledge file, and each of the first paragraphs serves as an power knowledge text.
[0032] According to some embodiments of the first aspect of the present application, after the type of the original power knowledge file is detected and processed, the method further includes:
[0033] If it is detected that the type of the original power knowledge file is an image document, optical character recognition processing is performed on the original power knowledge file to obtain recognized text;
[0034] The recognized text is divided into a plurality of second paragraphs, and each of the second paragraphs serves as an electric power knowledge text.
[0035] To achieve the above-mentioned purpose, the second aspect of the present application provides an electric power knowledge question-answering device, including:
[0036] An acquisition module is used to acquire power knowledge question sentences;
[0037] A first splicing module, used for splicing the preset classification prompt words with the power knowledge question sentence to obtain a first splicing text;
[0038] A first input module is used to input the first concatenated text into a preset large language model to obtain the target power subdivision field type corresponding to the power knowledge question sentence; the classification prompt word is used to instruct the large language model to classify the power knowledge question sentence;
[0039] A second splicing module is used to splice the power knowledge question sentence with the target power subdivision field type to obtain a second splicing text;
[0040] A determination module, configured to determine, based on the second concatenated text, a target electric power knowledge text related to the electric power knowledge question sentence from a preset electric power knowledge base;
[0041] A third splicing module is used to splice the preset answer prompt words, the power knowledge question sentence and the target power knowledge text to obtain a third spliced text;
[0042] The second input module is used to input the third concatenated text into the large language model to obtain an answer text; the answer prompt word is used to instruct the large language model to answer the power knowledge question sentence.
[0043] To achieve the above-mentioned purpose, an embodiment of the third aspect of the present application provides an electronic device, which includes a memory and a processor, and the memory stores a computer program. When the processor executes the computer program, it implements the power knowledge question and answer method described in any one of the embodiments of the first aspect of the present application.
[0044] To achieve the above objectives, the fourth embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the power knowledge question and answer method described in any one of the embodiments of the first aspect of the present application.
[0045] The electric power knowledge question-answering method, device, electronic device and readable storage medium of the embodiment of the present application, based on the second spliced text, determine the target electric power knowledge text related to the electric power knowledge question sentence from the preset electric power knowledge base; splice the preset answer prompt words, the electric power knowledge question sentence and the target electric power knowledge text to obtain the third spliced text; input the third spliced text into the large language model to obtain the answer text. Since the target electric power knowledge text is obtained based on the second spliced text, and the second spliced text is obtained by splicing the electric power knowledge question sentence and the target electric power subdivision field type, the target electric power knowledge text has a strong correlation with the electric power knowledge question sentence. Since the answer text is obtained by the large language model based on the third spliced text, and the third spliced text is obtained by splicing the preset answer prompt words, the electric power knowledge question sentence and the target electric power knowledge text, therefore, in the large language model processing process, the target electric power knowledge text is used as prior knowledge, so that the answer text output by the large language model has a high correlation with the electric power knowledge question sentence, and the answer text has a high accuracy.
[0046] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The present application is further described below with reference to the accompanying drawings and embodiments, wherein:
[0048] Figure 1 A schematic diagram of the steps of the electric power knowledge question-answering method according to an embodiment of the present application;
[0049] Figure 2 for Figure 1 A specific flow chart of step S170;
[0050] Figure 3 It is a flowchart of the steps for generating rhetorical question sentences;
[0051] Figure 4 for Figure 1 A specific flow chart of step S150;
[0052] Figure 5 This is a schematic diagram of the steps before step S420 of the method of the embodiment of the present application;
[0053] Figure 6 for Figure 5 A specific flow chart of step S520;
[0054] Figure 7 The method of the embodiment of the present application is Figure 6 A schematic diagram of a flow chart after step S610;
[0055] Figure 8 A schematic diagram of the structure of the electric power knowledge question-answering device according to an embodiment of the present application;
[0056] Fig. 9 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0057] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.
[0058] In the description of the present application, it should be understood that descriptions involving orientation, such as up, down, front, back, left, right, etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.
[0059] In the description of this application, "several" means more than one, "more" means more than two, "greater than", "less than", "exceed", etc. are understood to exclude the number itself, and "above", "below", "within", etc. are understood to include the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0060] In the description of this application, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in this application based on the specific content of the technical solution.
[0061] In the description of the present application, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0062] First, some nouns involved in this application are analyzed:
[0063] Large Language Model (LLM): is a natural language processing (NLP) model based on deep learning. This model is able to learn the grammar and semantics of natural language to generate human-readable text. The working principle of LLM is mainly based on the transformer model, which is a special neural network structure. The transformer model works through encoder and decoder components, where the encoder is responsible for converting the input text into vector representations, and the decoder is responsible for generating output text based on these vector representations.
[0064] Token: Text is input into a large language model, and the input is encoded into a format that the model can understand, which usually involves converting the text into a series of tokens. Each token can be a word, a character, or a subword unit. For the tokens generated by the input text, in LLM, the model uses the parameters and knowledge learned during its training to predict the next most likely token. This prediction process usually involves the calculation of multiple network layers, including embedding layers, attention mechanism layers, feedforward network layers, etc. Based on the above predictions, LLM generates and outputs the next token. This token can then be added to the output sequence and become the context for subsequent predictions. Finally, LLM generates a series of tokens as output based on the input text and the knowledge learned during training.
[0065] Natural Language Processing (NLP): is an artificial intelligence technology designed to enable computers to understand and process human language. It enables natural language interaction between humans and computers by analyzing, understanding, and generating human language text. The core tasks of NLP can be roughly divided into two categories: natural language understanding (NLU) and natural language generation (NLG). Natural language understanding aims to convert human language into a machine-readable format for artificial intelligence analysis and applications, such as automatic translation, sentiment analysis, question-answering systems, etc. Natural language generation, on the other hand, converts machine-generated language into a human-readable format, such as intelligent customer service, speech synthesis, etc.
[0066] Optical Character Recognition (OCR): refers to the process of converting printed or handwritten text into machine-encoded text. It uses optical scanning and character recognition methods to recognize text in documents, pictures or any other form of visual presentation and convert it into a computer-editable and searchable format such as TXT, DOC or PDF.
[0067] Prior knowledge: Prior knowledge plays a vital role in neural network models. It refers to the information about data, tasks, or the model itself that is already known or assumed to exist before neural network training. This information can help the neural network better understand and learn tasks, and improve the performance and generalization ability of the model.
[0068] Temperature parameter: Temperature is an important parameter in models such as GPT, which is used to control the randomness of the model's output text. By adjusting the value of Temperature, the diversity and consistency of the text generated by the model can be affected. Specifically, a higher Temperature value will cause the model to generate more diverse and unpredictable text, while a lower Temperature value will cause the model to tend to generate more certain and consistent text.
[0069] Although LLM has the ability to answer questions for general tasks and the pre-trained model contains extensive prior knowledge of pre-trained corpus, it still has defects in hallucination constraints and instruction following in the power vertical field. Existing LLM lacks prior knowledge in the power vertical field, which plays a core role in constraining hallucinations and further applications. General LLM is prone to hallucinations when dealing with questions and instructions in professional fields, resulting in low accuracy and relevance of the answer text given by the LLM model for questions in the power industry.
[0070] Based on this, the embodiments of the present application provide an electricity knowledge question and answer method, device, electronic device and readable storage medium, which can obtain an answer text based on an electricity knowledge question statement, and can provide the accuracy of the answer text and the relevance of the answer text to the electricity knowledge question statement.
[0071] The power knowledge question and answer method of the embodiment of the present application can be applied to a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a router, a programmable switch, a network card, etc.; the server can be configured as an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the power knowledge question and answer method, etc., but is not limited to the above forms.
[0072] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific services or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which services are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0073] Reference Figure 1 The first aspect of the present application provides a method for answering questions about electricity knowledge. The method for answering questions about electricity knowledge in the embodiment of the present application includes but is not limited to steps S110 to S170.
[0074] Step S110, obtaining a power knowledge question statement;
[0075] It is worth noting that the power knowledge question sentence refers to the question asked by the user. In one embodiment, the power knowledge question answering method of the embodiment of the present application is applied to a terminal, and a text input box is displayed on the terminal. The user can input the power knowledge question sentence in the text input box through the keyboard or touch screen of the terminal, so that the terminal can obtain the power knowledge question sentence.
[0076] Step S120, concatenating the preset classification prompt words with the power knowledge question sentence to obtain a first concatenated text;
[0077] Step S130, inputting the first concatenated text into a preset large language model to obtain the target power subdivision field type corresponding to the power knowledge question sentence; the classification prompt word is used to instruct the large language model to classify the power knowledge question sentence;
[0078] In one embodiment, the preset classification prompt word is "Please determine the type of power subdivision field of the following text:"; the power knowledge question sentence is "How to deal with a transformer failure", then the first spliced text is "Please determine the type of power subdivision field of the following text: How to deal with a transformer failure". The first spliced text is input into the preset large language model to obtain the target power subdivision field type. In this embodiment, the target power subdivision field type is power equipment. It should be noted that the present application does not limit the specific words and phrases of the classification prompt words, and those skilled in the art can set the classification prompt words according to actual needs.
[0079] In one embodiment, the electric power knowledge question-answering method of the embodiment of the present application presets 6 electric power subdivision field types, namely power generation technology, transmission and distribution, electric power equipment, electric power market, electric power safety, and energy. The large language model determines one electric power subdivision field type from the preset 6 electric power subdivision field types as the target electric power subdivision field type based on the first concatenated text.
[0080] In one embodiment, the large language model adopts Qwen1.5-14B-Chat, which is a dialogue model obtained by further fine-tuning the 14 billion parameter (14B) model in the Qwen1.5 large language model series through supervised fine tuning (SFT). "14B" refers to the number of parameters in the model, that is, the model has approximately 14 billion parameters, which enables it to handle complex language tasks, including generating coherent and accurate dialogue content. The Qwen1.5 large language model is a decoder-only transformer model that uses advanced model architecture and technologies, such as SwiGLU activation function, RoPE position encoding, etc., to improve the performance and efficiency of the model. Based on Qwen1.5, the Qwen-14B-Chat dialogue model is obtained by fine-tuning the specific data set for the dialogue task. Decoder-only is a neural network model architecture specifically used for natural language processing (NLP) tasks.
[0081] Step S140, concatenating the electric power knowledge question sentence with the target electric power subdivision field type to obtain a second concatenated text;
[0082] Step S150, based on the second concatenated text, determining a target power knowledge text related to the power knowledge question sentence from a preset power knowledge base;
[0083] It is worth noting that the electric power knowledge question-answering method of the embodiment of the present application is preset with an electric power knowledge base, which stores multiple electric power knowledge texts, and the electric power knowledge texts record relevant knowledge in the electric power field. In step S150, the second concatenated text is matched and retrieved with the electric power knowledge text in the circuit knowledge base to determine the target electric power knowledge text. When performing matching retrieval, since the second concatenated text is obtained by concatenating the electric power knowledge question statement with the target electric power subdivision field type, the target electric power subdivision field type can narrow the matching range, can improve the relevance of the target electric power knowledge text and the electric power knowledge question statement, and is helpful for subsequent answering through a large language model.
[0084] Step S160, splicing the preset answer prompt words, the power knowledge question sentence and the target power knowledge text to obtain a third spliced text;
[0085] Step S170, input the third concatenated text into the large language model to obtain an answer text; the answer prompt word is used to instruct the large language model to answer the power knowledge question sentence.
[0086] In one embodiment, the power knowledge question sentence is "How to deal with a transformer failure"; the target power knowledge text is "The working principle of the transformer is: the transformer is a stationary electrical appliance made using the principle of electromagnetic induction, and its core function is to convert a certain level of AC voltage and current into another level of voltage and current with the same frequency"; the answer prompt is "Please answer the following questions based on the auxiliary answer information:; The auxiliary answer information is". Then the third spliced text is: "Please answer the following questions based on the auxiliary answer information: How to deal with a transformer failure; The auxiliary answer information is The working principle of the transformer is: The transformer is a stationary electrical appliance made using the principle of electromagnetic induction, and its core function is to convert a certain level of AC voltage and current into another level of voltage and current with the same frequency". The third spliced text is input into the large language model to obtain a text answer, and because the target power knowledge text is used as prior knowledge, the answer text output by the large language model can have a high correlation with the power knowledge question sentence, and the answer text has a high accuracy. It should be noted that the answer prompt words in the above example are only an example and cannot be understood as a limitation of this application. This application does not make specific limitations on the answer prompt words, and those skilled in the art can set the answer prompt words according to actual needs. In addition, although the above example only illustrates one target power knowledge text, it cannot be understood as a limitation on the present application. The present application does not limit the number of target power knowledge texts.
[0087] The electric power knowledge question-and-answer method of the embodiment of the present application, through the above steps S110 to S170, determines the target electric power knowledge text related to the electric power knowledge question sentence from the preset electric power knowledge base based on the second spliced text; splices the preset answer prompt words, the electric power knowledge question sentence and the target electric power knowledge text to obtain a third spliced text; inputs the third spliced text into the large language model to obtain the answer text. Since the target electric power knowledge text is obtained based on the second spliced text, and the second spliced text is obtained by splicing the electric power knowledge question sentence with the target electric power subdivision field type, the target electric power knowledge text has a strong correlation with the electric power knowledge question sentence. Since the answer text is obtained by the large language model based on the third spliced text, and the third spliced text is obtained by splicing the preset answer prompt words, the electric power knowledge question sentence and the target electric power knowledge text, therefore, in the large language model processing process, the target electric power knowledge text is used as prior knowledge, so that the answer text output by the large language model has a high correlation with the electric power knowledge question sentence, and the answer text has a high accuracy.
[0088] In one embodiment, when using a preset large language model, first obtain a pre-trained large language model, and then fine-tune the pre-trained large language model to obtain the preset large language model. The fine-tuning process is: first construct an electric power question training sentence, and the answer (i.e., the true label) corresponding to the electric power question training sentence. Input the electric power question training sentence into the pre-trained large language model, and the pre-trained large language model outputs the answer training sample. Calculate the loss value based on the objective function, and fine-tune the pre-trained large language model based on the loss value, and the goal of fine-tuning is to minimize the loss value. The objective function is:
[0089] L fine-tune =-Σ i y i log(p i );
[0090] Among them, L fine-tune is the loss value, y i is the i-th element in the one-hot encoding vector of the true label. If the sample belongs to the i-th category, then y i =1, if the sample does not belong to the i-th category, then y i =0; p iThe predicted probability of the answer training sample corresponding to the true label is obtained by outputting the probability distribution vector for the next token prediction from the output layer of the large language model. The output layer of the large language model outputs a 151936-dimensional probability distribution vector (151936 is the size of the vocabulary that the model can predict), and i represents the probability value of the i-th dimension of the vector. The fine-tuning process is the process of fitting the probability distribution at the model level based on the knowledge in the power field and for power field problems.
[0091] In one embodiment, after step S170, the following steps are further included:
[0092] Input the answer text into the preset scoring model to obtain the scoring value;
[0093] If the score is lower than the preset score, the temperature parameter of the large language model is reduced to obtain an updated language model;
[0094] Input the third concatenated text into the updated language model to obtain an updated answer;
[0095] Repeat the above steps using the updated answer as the answer text until the score value is higher than the preset score, and use the answer text higher than the preset score as the target answer.
[0096] It is worth noting that the scoring model uses Qwen1.5-32B-Chat-GPTQ-Int4, which reduces the number of parameters to 32B while maintaining a similar model architecture to the Qwen1.5 series. It is also optimized and quantized specifically for the chat scenario, and the GPTQ-Int4 quantization method is introduced. The GPTQ-Int4 quantization method is a low-bit quantization method for large language models, and is particularly suitable for converting model parameters (such as weights and biases) from floating point numbers to 4-bit integers (INT4) with precision. This quantization technology can significantly reduce the storage space and computing resources required for the model while maintaining the performance of the model as much as possible.
[0097] In one embodiment, when the answer text is input into the scoring model, it is necessary to combine it with the corresponding scoring prompt words, for example, the scoring prompt word is "Please rate the fluency of the following answer text, the answer text is: ". The scoring prompt word is spliced with the answer text and input into the scoring model to obtain a scoring value. If the scoring value is lower than the preset score, it means that the fluency of the answer text is poor, so the temperature parameter of the large language model is lowered to obtain an updated language model, and then the third spliced text is input into the updated language model to obtain an updated answer, and then the updated answer is input into the scoring model to obtain a scoring value, and this is repeated until the scoring value is higher than the preset score, and the answer text higher than the preset score is used as the target answer. Since the scoring value of the target answer is higher than the preset score, the fluency of the target answer is higher.
[0098] In one embodiment, referring to Figure 2 , Figure 2 yes Figure 1 A specific flow chart of step S170 in FIG. 1 . Step S170 may include but is not limited to steps S210 to S240.
[0099] Step S210, inputting the third concatenated text into a large language model, and generating a prediction token based on the third concatenated text by the large language model;
[0100] Step S220, detecting the confidence of the prediction token, and if the confidence of the prediction token is lower than a preset confidence threshold, displaying a rhetorical question statement to the user;
[0101] It is worth noting that confidence is a statistical term used to quantify the credibility or reliability of an estimate or measurement result. In statistics, machine learning, natural language processing (NLP) and other fields, confidence is often used to evaluate the accuracy of model predictions or the reliability of data analysis results.
[0102] Step S230, obtaining a response statement, where the response statement is a response statement input by the user based on the rhetorical question statement;
[0103] In one embodiment, a rhetorical question is presented to the user via a terminal, and a text box is displayed on the terminal, so that the user can input a response statement in the text box based on a keyboard or touch screen of the terminal, thereby obtaining the response statement.
[0104] Step S240, updating the electric power knowledge question statement based on the response statement to obtain an updated question statement, and obtaining an answer text based on the updated question statement.
[0105] It is worth noting that after the third concatenated text is input into the large language model, the third concatenated text is first converted into a token sequence, the token sequence includes multiple tokens, and the token can be a word, a term or a punctuation mark. Then prediction is performed based on the token to generate a prediction token. Each prediction token is obtained based on the token and the prediction token that has been generated. The confidence of each prediction token is calculated. The confidence of the current prediction token is calculated by calculating the similarity between the current prediction token and the prediction token generated before the current prediction token.
[0106] When the confidence of at least one prediction token is lower than the preset threshold, it indicates that the prediction accuracy is low, and a rhetorical question needs to be displayed to the user. This allows the user to supplement the answer statement based on the rhetorical question statement, and the answer statement is a supplement to the power knowledge question statement. Then, the power knowledge question statement is updated based on the answer statement to obtain an updated question statement, and the updated question statement is used as a new power knowledge question statement, and steps S110 to S170 are re-executed. In this way, the prediction accuracy of the answer text can be guaranteed to be high.
[0107] In one embodiment, referring to Figure 3 , Figure 3 The figure is a flow chart of steps for generating a rhetorical question statement. The steps for generating a rhetorical question statement include but are not limited to steps S310 to S320.
[0108] Step S310, splicing the preset rhetorical question prompt word with the power knowledge question sentence to obtain a fourth spliced text;
[0109] Step S320, input the fourth concatenated text into the large language model to obtain a rhetorical question sentence; the rhetorical question prompt word is used to instruct the large language model to output a rhetorical question sentence based on the power knowledge question sentence.
[0110] For example, the rhetorical question prompt words are "please ask" or "ask the user more detailed questions". The power knowledge question sentence is "how to deal with a transformer failure". Then the fourth spliced text is "please ask the user more detailed questions about 'how to deal with a transformer failure'". The fourth spliced text is input into the large language model to obtain a rhetorical question sentence, which is "please describe the transformer failure phenomenon in detail".
[0111] In one embodiment, referring to Figure 4 , Figure 4 for Figure 1 A specific flow chart of step S150 is shown below. Step S150 may include but is not limited to steps S410 to S430.
[0112] Step S410, converting the second concatenated text into a vector to obtain a question vector;
[0113] In one embodiment, the second concatenated text is input into the bge Chinese text embedding model to obtain a question vector. BGE (BAAI General Embedding) is a new Chinese text embedding model proposed by Beijing Zhiyuan Artificial Intelligence Research Institute. The model has a significant performance in the field of Chinese natural language processing (NLP) and provides powerful semantic representation capabilities for various NLP tasks. It can convert text into points in a high-dimensional vector space, thereby capturing the semantic information of the text, thereby realizing the conversion of text into a vector.
[0114] Step S420, based on the question vector, determining a target power knowledge vector similar to the question vector from a preset power knowledge vector library;
[0115] In one embodiment, the power knowledge vectors in the power knowledge vector library are traversed to calculate the similarity between each power knowledge vector and the question vector. The similarity calculation formula is:
[0116]
[0117] in, and are the power knowledge vector and the question vector, · represents the inner product between the vectors, and || represents the Euclidean norm of the vector. Similarity represents the similarity. When the similarity is greater than the preset similarity threshold, it is determined that the power knowledge vector is similar to the question vector, and the power knowledge vector is the target power knowledge vector.
[0118] Step S430, based on the target power knowledge vector, determine the target power knowledge text corresponding to the target power knowledge vector from the power knowledge base; wherein the power knowledge vectors in the power knowledge vector base correspond one-to-one to the power knowledge texts in the power knowledge base.
[0119] In one embodiment, referring to Figure 5 , Figure 5 This is a flow chart of the steps before step S420 of the method of the embodiment of the present application. Before step S420, it also includes but is not limited to the following steps:
[0120] Step S510, obtaining the original file of power knowledge;
[0121] Step S520, cutting the original power knowledge file to obtain multiple power knowledge texts;
[0122] Step S530, converting the electric power knowledge text into a vector to obtain an electric power knowledge vector;
[0123] In one embodiment, the electric power knowledge text is input into the BERT (Bidirectional Encoder Representations from Transformers) model, and the BERT model converts the circuit knowledge text into an electric power knowledge vector. BERT can convert text into vectors. More precisely, BERT can convert each word in the text into a high-dimensional vector representation, which captures the semantic information and contextual relationships of the words. The output of BERT is a sequence of vectors, where each vector corresponds to a token in the input text. These vectors are calculated through a multi-layer self-attention mechanism in the Transformer encoder layer of BERT, so they contain not only the information of the word itself, but also the contextual information of the word in the sentence. When training the BERT model, the objective function of the BERT model is based on the Masked Language Model (MLM) and Next Sentence Prediction (NSP), and the objective function of the BERT model is:
[0124] L=L MLM +L NSP ;
[0125] Among them, L MLM is the masked language model loss, L NSP is the next sentence prediction loss.
[0126] Step S540: store the power knowledge text in the power knowledge base, store the power knowledge vector in the power knowledge vector base, and establish a mapping relationship between the power knowledge text and the power knowledge vector.
[0127] It is worth noting that the embodiment of the present application stores the power knowledge text in the power knowledge base, stores the power knowledge vector in the power knowledge vector library, and establishes a mapping relationship between the power knowledge text and the power knowledge vector through steps S510 to S540, so that in step S420, the question vector can be asked to determine the target power knowledge vector similar to the question vector from the preset power knowledge vector library. Moreover, based on the mapping relationship, the power knowledge text corresponding to the power knowledge vector can be determined, so that the target power knowledge text corresponding to the target power knowledge vector can be determined from the power knowledge library in step S430.
[0128] In one embodiment, referring to Figure 6 , Figure 6 for Figure 5 A specific flow chart of step S520 in FIG. 5 . Step S520 may include but is not limited to steps S610 to S620.
[0129] Step S610, detecting and processing the type of the original file of power knowledge;
[0130] Step S620: if it is detected that the type of the original power knowledge file is a text document, the original power knowledge file is divided into a plurality of first paragraphs based on the formatting mark in the original power knowledge file, and each first paragraph is a power knowledge text.
[0131] It is worth noting that the original file of power knowledge refers to a data file that records power knowledge. For example, if the type of the original file of power knowledge is a text document, for example, the latter of the original file of power knowledge is dox or docx, the NLP (Natural Language Processing) tool is used to analyze the formatting marks of the original file of power knowledge and perform segmentation. Formatting marks refer to paragraph marks, paragraph titles, and line breaks. For example, the content of an original file of power knowledge is: "
[0132] … 3.32
[0134] Total time of voltage changes beyond thresholdTmax
[0135] Within a voltage variation characteristic, the accumulated time that the voltage variation exceeds the limit. 3.33
[0137] Fluctuating load
[0138] The load that periodically or non-periodically draws variable power from the power grid during the production (or operation) process. For example: steelmaking arc furnace, rolling mill, arc welding machine, etc.
[0139] Then "3.32" and "3.33" in the original power knowledge file are paragraph titles, and the original power knowledge file can be segmented according to the paragraph titles. The content after each paragraph title is regarded as a first paragraph, and each first paragraph is regarded as a power knowledge text.
[0140] In one embodiment, referring to Figure 7 , Figure 7 for Figure 6 A schematic diagram of a flow chart after step S610 in FIG. Figure 7 The illustrated step flow includes step S710 and step S720.
[0141] Step S710: if it is detected that the type of the original power knowledge file is an image document, optical character recognition is performed on the original power knowledge file to obtain recognized text;
[0142] Step S720, segmenting the recognized text into a plurality of second paragraphs, each second paragraph being a power knowledge text.
[0143] Exemplarily, if the original power knowledge file is an image document in PDF or jpg format, optical character recognition (OCR) is performed on the original power knowledge file to obtain recognized text, and then the characters recognized by OCR are segmented into multiple second paragraphs based on line breaks using Python, and each second paragraph serves as a power knowledge text.
[0144] In one embodiment, if it is detected that the type of the original power knowledge file is an image document, and the number of characters obtained through OCR processing is too small; or the original power knowledge file is a table document. Then the original power knowledge file is input into the ResNet model, and features are extracted through the ResNet model to obtain a key information vector, which is used as the power knowledge vector. At the same time, the original power knowledge file is input into the LLaVA (Large Language and Vision Assistant) model to generate a text summary as the power knowledge text.
[0145] It is worth noting that the LLaVA model uses a linear layer to align the visual encoding to the language domain of the LLM for summary generation. Retrieval through image summaries can maintain the original image information while using the generated text summaries for efficient semantic retrieval. The ResNet model solves the gradient vanishing problem in deep neural networks by introducing skip connections. The objective function used in training is:
[0146]
[0147] Among them, L image Represents the loss value of the ResNet model. is the class probability predicted by the ResNet model, y i One-hot encoding representing the true category of the image.
[0148] Reference Figure 8 The second aspect of the present application provides an electric power knowledge question-answering device, including:
[0149] An acquisition module 810 is used to acquire a power knowledge question statement;
[0150] A first splicing module 820 is used to splice the preset classification prompt words with the power knowledge question sentence to obtain a first spliced text;
[0151] The first input module 830 is used to input the first concatenated text into a preset large language model to obtain the target power subdivision field type corresponding to the power knowledge question sentence; the classification prompt word is used to instruct the large language model to classify the power knowledge question sentence;
[0152] A second splicing module 840 is used to splice the power knowledge question sentence with the target power subdivision field type to obtain a second spliced text;
[0153] A determination module 850 is used to determine a target power knowledge text related to the power knowledge question sentence from a preset power knowledge base based on the second concatenated text;
[0154] A third splicing module 860 is used to splice the preset answer prompt words, the power knowledge question sentence and the target power knowledge text to obtain a third spliced text;
[0155] The second input module 870 is used to input the third concatenated text into the large language model to obtain an answer text; the answer prompt word is used to instruct the large language model to answer the power knowledge question sentence.
[0156] The electric power knowledge question-and-answer device is used to execute the electric power knowledge question-and-answer method of the first embodiment of the present application. When executing the method, based on the second spliced text, a target electric power knowledge text related to the electric power knowledge question sentence is determined from a preset electric power knowledge base; the preset answer prompt words, the electric power knowledge question sentence and the target electric power knowledge text are spliced to obtain a third spliced text; the third spliced text is input into a large language model to obtain an answer text. Since the target electric power knowledge text is obtained based on the second spliced text, and the second spliced text is obtained by splicing the electric power knowledge question sentence with the target electric power subdivision field type, the target electric power knowledge text has a strong correlation with the electric power knowledge question sentence. Since the answer text is obtained by the large language model based on the third spliced text, and the third spliced text is obtained by splicing the preset answer prompt words, the electric power knowledge question sentence and the target electric power knowledge text, therefore, in the large language model processing process, the target electric power knowledge text is used as prior knowledge, so that the answer text output by the large language model has a high correlation with the electric power knowledge question sentence, and the answer text has a high accuracy.
[0157] In one embodiment, the second input module 870 includes a first input unit, a first detection unit, a first acquisition unit, and an update unit.
[0158] The first input unit is used to input the third concatenated text into the large language model, and the large language model generates a prediction token based on the third concatenated text;
[0159] The first detection unit is used to detect the confidence of the prediction token, and if the confidence of the prediction token is lower than a preset confidence threshold, a rhetorical question statement is displayed to the user;
[0160] The first acquisition unit is used to acquire a response sentence, where the response sentence is a response sentence input by the user based on the rhetorical question sentence;
[0161] The updating unit is used to update the electric power knowledge question statement based on the response statement to obtain an updated question statement, and obtain an answer text based on the updated question statement.
[0162] In one embodiment, the electric power knowledge question and answer device further includes a fourth splicing module and a third input module.
[0163] The fourth splicing module is used to splice the preset rhetorical question prompt word with the power knowledge question sentence to obtain a fourth spliced text;
[0164] The third input module is used to input the fourth concatenated text into the large language model to obtain a rhetorical question sentence; the rhetorical question prompt word is used to instruct the large language model to output a rhetorical question sentence based on the power knowledge question sentence.
[0165] In one embodiment, the determination module 850 includes a conversion unit, a first determination unit, and a second determination unit.
[0166] The conversion unit is used for converting the second concatenated text into a vector to obtain a question vector;
[0167] A first determining unit is used to determine a target power knowledge vector similar to the question vector from a preset power knowledge vector library based on the question vector;
[0168] The second determination unit is used to determine the target power knowledge text corresponding to the power knowledge vector from the power knowledge base based on the target power knowledge vector; wherein the power knowledge vectors in the power knowledge vector base correspond one-to-one to the power knowledge texts in the power knowledge base.
[0169] In one embodiment, the electric power knowledge question and answer device further includes an original file acquisition module, a cutting module, a vector conversion module and a storage module.
[0170] The original file acquisition module is used to acquire the original files of power knowledge;
[0171] The cutting module is used to cut the original power knowledge file to obtain multiple power knowledge texts;
[0172] The vector conversion module is used to convert the electric power knowledge text into a vector to obtain an electric power knowledge vector;
[0173] The storage module is used to store the electric power knowledge text in the electric power knowledge base, store the electric power knowledge vector in the electric power knowledge vector base, and establish a mapping relationship between the electric power knowledge text and the electric power knowledge vector.
[0174] In one embodiment, the cutting module includes a second detection unit and a first cutting unit.
[0175] The second detection unit is used to detect and process the type of the original file of power knowledge;
[0176] The first cutting unit is used to cut the original power knowledge file into a plurality of first paragraphs based on formatting marks in the original power knowledge file if it is detected that the type of the original power knowledge file is a text document, and each first paragraph serves as a power knowledge text.
[0177] In one embodiment, the cutting module further includes an identification unit and a second cutting unit.
[0178] The recognition unit is used to perform optical character recognition processing on the original power knowledge file to obtain recognized text if it is detected that the type of the original power knowledge file is an image document;
[0179] The second cutting unit is used to divide the recognized text into a plurality of second paragraphs, each second paragraph being an electric power knowledge text.
[0180] Reference Fig. 9 , Fig. 9 This is a schematic diagram of the structure of an electronic device according to an embodiment of the third aspect of the present application. The electronic device includes:
[0181] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (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 the present application;
[0182] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the power knowledge question and answer method of the embodiment of this application;
[0183] Input / output interface 903, used to implement information input and output;
[0184] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);
[0185] A bus 905 that transmits information between various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);
[0186] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0187] The fourth aspect of the present application is a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the power knowledge question and answer method of any one of the first aspect embodiments is implemented.
[0188] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0189] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0190] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0191] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0192] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0193] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0194] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the mapping relationship of the mapping objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next mapping objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0195] In the several embodiments provided in the present application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0196] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0197] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0198] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0199] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A method for answering questions about electric power knowledge, characterized in that: include: Get electricity knowledge question sentences; Splicing the preset classification prompt words with the power knowledge question sentence to obtain a first spliced text; Inputting the first concatenated text into a preset large language model to obtain the target power subdivision field type corresponding to the power knowledge question sentence; The classification prompt words are used to instruct the large language model to classify the power knowledge question sentences; Concatenate the electric power knowledge question sentence with the target electric power subdivision field type to obtain a second concatenated text; Based on the second concatenated text, determining a target electric power knowledge text related to the electric power knowledge question sentence from a preset electric power knowledge base; splicing the preset answer prompt words, the power knowledge question sentence and the target power knowledge text to obtain a third spliced text; Inputting the third concatenated text into the large language model to obtain an answer text; The answer prompt word is used to instruct the large language model to answer the power knowledge question sentence.
2. The electric power knowledge question-answering method according to claim 1, characterized in that: The step of inputting the third concatenated text into the large language model to obtain an answer text comprises: Inputting the third concatenated text into the large language model, and generating a prediction token based on the third concatenated text by the large language model; Detecting the confidence of the prediction token, and if the confidence of the prediction token is lower than a preset confidence threshold, displaying a rhetorical question statement to the user; Obtaining a response statement, wherein the response statement is a response statement input by the user based on the rhetorical question statement; The power knowledge question statement is updated based on the response statement to obtain an updated question statement, and the answer text is obtained based on the updated question statement.
3. The electric power knowledge question-answering method according to claim 2, characterized in that: The step of generating the rhetorical question sentence comprises: splicing the preset rhetorical question prompt word with the power knowledge question sentence to obtain a fourth spliced text; The fourth concatenated text is input into the large language model to obtain the rhetorical question sentence; the rhetorical question prompt word is used to instruct the large language model to output the rhetorical question sentence based on the power knowledge question sentence.
4. The electric power knowledge question-answering method according to claim 1, characterized in that: The step of determining a target electric power knowledge text related to the electric power knowledge question sentence from a preset electric power knowledge base based on the second concatenated text includes: Convert the second concatenated text into a vector to obtain a question vector; Based on the question vector, determining a target power knowledge vector similar to the question vector from a preset power knowledge vector library; Based on the target power knowledge vector, a target power knowledge text corresponding to the power knowledge vector is determined from the power knowledge base; wherein the power knowledge vectors in the power knowledge vector base correspond one-to-one to the power knowledge texts in the power knowledge base.
5. The electric power knowledge question-answering method according to claim 4, characterized in that: Before determining, based on the question vector, an electric power knowledge vector similar to the question vector from a preset electric power knowledge vector library, the method further includes: Obtain original documents on electricity knowledge; Cutting the original power knowledge file to obtain a plurality of power knowledge texts; Converting the electric power knowledge text into a vector to obtain the electric power knowledge vector; The electric power knowledge text is stored in the electric power knowledge base, the electric power knowledge vector is stored in the electric power knowledge vector base, and a mapping relationship between the electric power knowledge text and the electric power knowledge vector is established.
6. The electric power knowledge question-answering method according to claim 5, characterized in that: The power knowledge original file is cut to obtain a plurality of power knowledge texts, including: Detecting and processing the type of the original power knowledge file; If it is detected that the type of the original power knowledge file is a text document, the original power knowledge file is divided into a plurality of first paragraphs based on formatting marks in the original power knowledge file, and each of the first paragraphs serves as an power knowledge text.
7. The electric power knowledge question-answering method according to claim 6, characterized in that: After the type of the original power knowledge file is detected and processed, the method further includes: If it is detected that the type of the original power knowledge file is an image document, optical character recognition processing is performed on the original power knowledge file to obtain recognized text; The recognized text is divided into a plurality of second paragraphs, and each of the second paragraphs serves as an electric power knowledge text.
8. An electric power knowledge question-answering device, characterized in that: include: An acquisition module is used to acquire power knowledge question sentences; A first splicing module, used for splicing the preset classification prompt words with the power knowledge question sentence to obtain a first splicing text; A first input module, used for inputting the first concatenated text into a preset large language model to obtain a target electric power subdivision field type corresponding to the electric power knowledge question sentence; The classification prompt words are used to instruct the large language model to classify the power knowledge question sentences; A second splicing module is used to splice the power knowledge question sentence with the target power subdivision field type to obtain a second splicing text; A determination module, configured to determine, based on the second concatenated text, a target electric power knowledge text related to the electric power knowledge question sentence from a preset electric power knowledge base; A third splicing module is used to splice the preset answer prompt words, the power knowledge question sentence and the target power knowledge text to obtain a third spliced text; A second input module, used for inputting the third concatenated text into the large language model to obtain an answer text; The answer prompt word is used to instruct the large language model to answer the power knowledge question sentence.
9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the power knowledge question and answer method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the electric power knowledge question and answer method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Power field question and answer method and device based on local text embedding retrieval
CN118278521A
Vector knowledge base-based large-model question-answer dialogue method and system and storage medium
CN118484526A
