Question-answering method, device, equipment, medium and program product based on blockchain
By obtaining real-time off-chain industry data of blockchain and using large language models to match semantic content, the problem of poor answer timeliness in question-and-answer in the blockchain industry is solved, real-time updates and efficient question-and-answer services are achieved.
Patent Information
- Application Number
- CN202411666598.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-04-01
AI Technical Summary
When providing Q&A services, the existing large-language model of the blockchain industry is poorly timely and cannot understand the latest technical details of the blockchain industry in a timely manner.
By obtaining real-time off-chain industry data of blockchain, using a large language model to obtain the semantic content of the user input text content, and matching the target off-chain industry data corresponding to the semantic content from the real-time off-chain industry data, generating and outputting the answer content.
It realizes the real-time data update capability of the large language model, so that it can keep up with current hot topics, provide timely Q&A services, and improves the timeliness of answers.
Smart Images

Figure CN119739818A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of blockchain technology, and in particular to blockchain-based question-answering methods, devices, equipment, media, and program products. Background Art
[0002] Blockchain technology is a decentralized distributed ledger that is tamper-proof, secure and transparent. It is widely used in finance, supply chain or e-government to ensure the authenticity and security of data. Large Language Model (LLM) is a neural network that can understand and generate natural language through a large amount of data training. It can provide intelligent question-answering or data analysis services to improve processing efficiency and intelligence.
[0003] The large language models currently providing services to the blockchain industry are all trained using data stored in historical time periods, and the timeliness of their answers when providing question-and-answer services is poor.
[0004] Therefore, how to improve the timeliness of answers when answering questions with large language models in the blockchain industry has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] The embodiments of the present application provide a blockchain-based question-and-answer method, apparatus, device, medium, and program product, which can solve the problem of how to enable a blockchain large language model to achieve real-time data updates and concurrently perform question-and-answer functions.
[0006] In a first aspect, an embodiment of the present application provides a question-answering method based on blockchain, the method comprising:
[0007] Obtaining real-time off-chain industry data of the blockchain, where the real-time off-chain industry data is used to indicate industry dynamic information of the industry in which the first object is located;
[0008] When receiving text content input by a user, obtaining semantic content of the text content through a large language model, where the text content is related to the first object;
[0009] Use the big language model to match the target off-chain industry data corresponding to the semantic content from the real-time off-chain industry data;
[0010] When there is corresponding target off-chain industry data for the semantic content, the answer content corresponding to the text content is generated and output through the large language model based on the semantic content and the target off-chain industry data.
[0011] In some embodiments, the semantic content includes at least one sub-semantic content, the at least one sub-semantic content includes a first sub-semantic content, and the method further includes:
[0012] Acquire real-time on-chain data of the blockchain, where the real-time on-chain data includes data associated with the first object stored on the blockchain;
[0013] When there is no corresponding off-chain industry data for the first sub-semantic content, the target on-chain data corresponding to the first sub-semantic content is matched from the real-time on-chain data through the large language model;
[0014] When there is corresponding target on-chain data for the first sub-semantic content, the large language model is used to generate and output the answer content corresponding to the text content based on the target on-chain data, semantic content, and off-chain industry data corresponding to other sub-semantic contents except the first sub-semantic content.
[0015] In some embodiments, before obtaining the semantic content of the text content through the large language model, the method further includes:
[0016] Performing a security audit operation on the text content, the security audit operation including at least one of malicious content detection or privacy content filtering on the text content;
[0017] When the text content passes the security review, a content prompt corresponding to the text content is generated based on the preset prompt. The content prompt is used to assist the large language model in understanding the text content.
[0018] The semantic content of the text is obtained through a large language model, including:
[0019] Determine semantic content from content cues via a large language model.
[0020] In some embodiments, obtaining real-time on-chain data of a blockchain includes:
[0021] Obtain at least one original real-time on-chain data of the blockchain, where the original real-time on-chain data is unprocessed real-time on-chain data;
[0022] Performing a data preprocessing operation on each original real-time on-chain data to obtain processed original real-time on-chain data, wherein the data preprocessing operation at least includes a data cleaning operation and a data format conversion operation, wherein the data cleaning operation includes removing duplicate data and correcting abnormal data, and the data format conversion operation is used to convert the data format of the original real-time on-chain data into a preset first data format;
[0023] An index is created for the processed original real-time on-chain data, and the processed original real-time on-chain data with the index is used as the real-time on-chain data.
[0024] In some embodiments, obtaining real-time off-chain industry data of the blockchain includes:
[0025] Obtain at least one original real-time off-chain industry data of the blockchain, where the original real-time off-chain industry data is unprocessed real-time off-chain industry data;
[0026] Performing data preprocessing operations on the original real-time off-chain industry data to obtain processed real-time off-chain industry data, wherein the data preprocessing operations at least include data cleaning operations and data format conversion operations, wherein the data cleaning operations include removing duplicate data and correcting abnormal data, and the data format conversion operations are used to convert the data format of the original real-time off-chain industry data into a preset second data format;
[0027] The processed off-chain industry data is indexed, and the processed off-chain industry data with the index is used as the real-time off-chain industry data.
[0028] In some embodiments, the method further comprises:
[0029] Back up real-time off-chain industry data and real-time on-chain data;
[0030] In the event that damage is detected in either the real-time off-chain industry data or the real-time on-chain data, the damaged data is restored based on the corresponding data backup.
[0031] In a second aspect, the embodiment of the present application provides a question-and-answer device for blockchain, including:
[0032] The first acquisition module is used to obtain real-time off-chain industry data of the blockchain;
[0033] A second acquisition module is used to acquire semantic content of the text content through a large language model when receiving text content input by a user, wherein the text content is related to the first object, and the real-time off-chain industry data is used to indicate industry dynamic information of the industry in which the first object is located;
[0034] The matching module is used to match the target off-chain industry data corresponding to the semantic content from the real-time off-chain industry data through a large language model;
[0035] The generation and output module is used to use the large language model to generate and output the answer content corresponding to the text content based on the semantic content and the target off-chain industry data when there is corresponding off-chain industry data for the semantic content.
[0036] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the blockchain-based method as described in any embodiment of the first aspect.
[0037] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the blockchain-based method described in any embodiment of the first aspect is implemented.
[0038] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the blockchain-based question-and-answer method described in any embodiment of the first aspect above.
[0039] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0040] When the answer content corresponding to the text content input by the user is generated and output through the large language model, it is based on the semantic content of the text content, and the target off-chain industry data corresponding to the semantic content is matched from the acquired real-time off-chain industry data to generate the corresponding answer content. Due to the real-time nature of the real-time off-chain industry data, the target off-chain industry data found by the large language model is timely. By searching the real-time off-chain industry data, the large language model has the ability to update blockchain industry-related data in real time. In the question-and-answer scenario, the large language model generates the answer content based on the acquired semantic content and the target off-chain industry data with timeliness, rather than generating answers based on its own learning results of historical data. This allows the large language model to keep up with current hot topics, keep abreast of industry data, and improve the timeliness of the answers.
[0041] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0043] Figure 1 This is a flowchart of a blockchain-based question-and-answer method provided in an embodiment of the present application;
[0044] Figure 2 This is a workflow diagram of a blockchain-based question-and-answer method in an application scenario of an embodiment of the present application;
[0045] Figure 3 This is a flowchart of another blockchain-based question-and-answer method provided in an embodiment of the present application;
[0046] Figure 4 This is a workflow diagram for obtaining real-time on-chain data in an application scenario of an embodiment of the present application;
[0047] Figure 5 This is a flow chart of processing text content input by a user provided by an embodiment of the present application;
[0048] Figure 6 This is a structural block diagram of a blockchain question-and-answer device provided in an embodiment of the present application;
[0049] Figure 7 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0051] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0052] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0053] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0054] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0055] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0056] The current large language models in the blockchain industry are trained based on blockchain industry data (off-chain industry data) up to a certain point in time. However, as time goes by, blockchain industry data will be constantly updated, and the models trained based on historical blockchain industry data up to a certain point in time cannot obtain updated data in a timely manner. They do not have the latest timeliness and cannot understand the latest technical details of the blockchain industry in a timely manner, which limits the question-answering function of the model. In addition, since blockchain data includes (off-chain industry data and on-chain data) as non-text data with a special format and structure for blockchain data, it has poor adaptability to the model, and the trained large language model still has the problem of being unable to effectively use blockchain data to provide services such as question-answering.
[0057] Although there are methods that combine artificial intelligence (AI) with blockchain data to achieve data analysis, the data analysis capabilities of the models they target still do not have the ability to perform general question-and-answer operations. Currently, there is still a lack of blockchain-friendly large language models on the market that can update data in real time and also provide question-and-answer functions.
[0058] In view of the above problems, the embodiments of the present application provide a question-and-answer method, device, equipment, medium and program product based on blockchain, which can obtain real-time off-chain industry data of the block chain in time. When it is necessary to ask and answer, the semantic content of the text content input by the user is obtained through the large language model, and the data corresponding to the semantic content is matched from the real-time off-chain industry data to generate the answer content corresponding to the text content. In this way, the real-time off-chain industry data is connected to the large language model in the form of a blockchain knowledge base with real-time data update, so that the large language model has the ability to update data in real time through the knowledge base, and determines the data and generates answers by matching the real-time off-chain industry data, taking into account the question-and-answer function, so that the large language model takes into account the question-and-answer function while updating the data in real time. In addition, the scheme of determining the corresponding data of the semantic content and then generating the answer content in the form of data matching (search) avoids the long-term training of the large language model based on the real-time off-chain industry data, improves the application friendliness of the large language model in the blockchain industry and reduces the training cost.
[0059] The technical solution of the present application is described below through specific embodiments. Figure 1 : is a flowchart of a blockchain-based question-answering method in an embodiment of the present application, and the method may include the following steps:
[0060] Step S101, obtaining real-time off-chain industry data of the blockchain.
[0061] The execution subject of the embodiments of the present application may be an electronic device. The present application does not limit the specific type of the electronic device, which may be a server, a computer, an ultra-mobile personal computer (UMPC), a personal digital assistant (PDA), or other device with data processing capabilities.
[0062] The embodiments of the present application do not specifically limit the field (also referred to as industry) to which the blockchain is applied, which may be the financial industry, manufacturing industry, e-government, logistics industry or public service, etc. The real-time off-chain industry data is used to indicate the industry dynamic information of the industry in which the first object is located, which may include at least one of news information, project information, information about well-known industry figures, discussion information, technological progress, application cases or academic research in the industry in which the first object is located. The data format of the real-time off-chain industry data is a format that can be processed by a large language model, for example, a vector format. The first object may be any object in any industry that applies blockchain technology, for example, A-shares, securities, insurance or drugs in drug supply, etc.
[0063] The electronic device can obtain at least one original real-time off-chain industry data (the data can be unprocessed real-time off-chain industry data such as text, pictures, audio or video) of different blockchains in different fields (including the industry in which the first object is located) from the Internet through a specific application programming interface (Application Programming Interface, API) or a data acquisition tool (for example, a crawler tool). The data format of these original real-time off-chain industry data is processed into a format that can be processed by a large language model, and these data are indexed to obtain real-time off-chain industry data. It can be understood that the index can facilitate the subsequent large language model to search for real-time off-chain industry data. The Internet includes at least one of a web page, a news media, a blockchain forum, a blockchain open source code library, a blockchain project document storage platform, or a blockchain community.
[0064] Exemplarily, the electronic device stores the acquired real-time off-chain industry data in a first database (e.g., Figure 2 The subsequent large language model can access the first database to match the required data from the real-time off-chain industry data.
[0065] Step S102: upon receiving text content input by the user, obtaining semantic content of the text content through a large language model.
[0066] In the embodiment of the present application, the text content is related to the first object; the large language model is a general large language model fine-tuned based on historical off-chain industry data, for example, the Large Language Model Meta AI (LLaMA) or the Chat Generative Pre-training Transformer (ChatGPT). Fine-tuning the existing pre-trained general language model can quickly and reliably adapt the general language model to the blockchain field with a small amount of data. Avoiding setting appropriate prompts to train the model through repeated learning processes, and thus avoiding the use of more calculation steps and tokens (also called tags) to complete learning tasks, can significantly reduce the number of tokens and improve the response efficiency of the large language model.
[0067] The electronic device inputs the text content into the large language model, which performs word segmentation and part-of-speech tagging on the text content, and uses the natural language processing (NLP) algorithm to perform semantic analysis on the text content based on the results of word segmentation and part-of-speech tagging to obtain the semantic content of the text content. The semantic content can assist the large language model in finding the answer to the text content, and the semantic analysis operation can include syntactic analysis and semantic understanding.
[0068] Among them, word segmentation is used to decompose the text content into individual words; part-of-speech tagging is used to tag words with parts of speech (verbs, names or adjectives, etc.); syntactic analysis is used to analyze the grammatical relationship between words and determine the structure of the sentence, such as subject-predicate-object structure, attributive-predicate structure, etc. For example, if the text content is "What is the impact of the development of blockchain technology on the financial industry", the large language model will clarify that "the development of blockchain technology" is the subject part, "to" is the preposition, and "financial industry" is the object part, thus determining that the question is asking about the causal relationship and impact between the two. Semantic understanding includes lexical semantic understanding, clarifying the meaning of words, and is used to integrate the semantics, part of speech, and their position and grammatical relationship in the sentence to infer the semantic meaning of the text content.
[0069] For example, the text content is "How much did A-shares increase from the 5th to the 15th?" The segmentation results of the large language model can be "5th", "to", "15th", "A-shares" and "increase". The part-of-speech tagging results are "5th": noun, specifically referring to the date, "to": preposition, connecting two time points, "15th": noun, date, "A-shares": noun, a specific stock market abbreviation, "increase": noun, referring to the extent of the stock price increase. The syntactic analysis result is that "5th to 15th" is a statement of a time range, acting as an adverbial, modifying "the increase in A-shares", "the increase in A-shares" is the core subject part of the entire sentence, "the increase" is the central word, and "A-shares" plays a limiting role. Based on the above results, the semantic content is the overall price increase of A-shares in the time period from the 5th to the 15th.
[0070] It can be understood that the specific process of fine-tuning the general large language model can be to mark the fields, business categories, themes or market sentiment tendencies of historical off-chain industry data through manual or automatic machine marking. For example, the content of a news message is that the A-share index rose on a certain day. The field of the news information is marked as finance, the business category is marked as stock investment, the theme is marked as stock market dynamics, and the market sentiment tendency is marked as positive.
[0071] The electronic device divides the labeled historical off-chain industry data into a training set, a validation set, and a test set. The training set is used for training the large language model, the validation set is used to monitor the performance of the large language model and adjust hyperparameters during the training process, and the test set is used to evaluate the final performance of the large language model after training.
[0072] The electronic device inputs the training set into the general large language model to fine-tune it. During the training process, the electronic device can adjust the parameters of the model according to the preset fine-tuning method, so that the model gradually learns the knowledge and patterns in the blockchain field. The preset fine-tuning method can be a full amount of fine-tuning (Fine-tuning), which updates all layers and parameters of the general large language model to adapt it to specific tasks in the blockchain field. This method can make full use of the general characteristics of the general large language model, but requires a lot of computing resources and a long training time. The preset fine-tuning method can also be parameter-efficient fine-tuning (Parameter-Efficien t Fine-Tuning, PEFT), which aims to quickly improve the performance of the general large language on new tasks by minimizing the number of fine-tuning parameters and computational complexity. The specific preset fine-tuning method can be set by itself, and the embodiments of the present application are not specifically limited.
[0073] For example, taking the Low-Rank Adaptation of Large Language Models (LORA) method in PEFT as an example, during the training process, the electronic device will focus on adjusting the parameters of the added low-rank matrix to minimize the error between the model's prediction results and the labels.
[0074] During the training process, the electronic device will periodically input the verification set into the currently trained general large language model, and calculate the performance indicators of the model on the verification set (for example, accuracy, recall rate or F1 value, etc.); when the performance indicators do not meet the preset conditions (for example, the performance indicators are greater than or equal to the threshold), according to the performance indicators, adjust the hyperparameters of the general large language model (for example, the learning rate or the number of training rounds, etc.) until the performance indicators meet the preset conditions, and obtain the large language model to be tested.
[0075] The electronic device inputs the test set into the large language model to be tested, and calculates the performance index of the model on the test set; when the performance index meets the preset conditions, the large language model in the embodiment of the present application is obtained, and when the performance index does not meet the preset conditions, a prompt message is sent to the preset user terminal to prompt the user to take countermeasures (for example, modify the model structure or retrain the model, etc.). After fine-tuning, the obtained large language model can be put into use, and there is no need to repeatedly train the large language model based on real-time off-chain industry data, which greatly reduces the training cost of the large language model and the difficulty of application in the blockchain industry, and improves the application friendliness of the large language model in the blockchain industry.
[0076] Step S103, matching the target off-chain industry data corresponding to the semantic content from the real-time off-chain industry data through the large language model.
[0077] Electronic devices can use a large language model to search for data that matches the semantic content from real-time off-chain industry data (the specific search method can be index search or vector similarity matching, the higher the similarity, the closer it matches the semantic content). The data searched is the target off-chain industry data corresponding to the semantic content.
[0078] For example, taking the text content "How much did A-shares increase from the 5th to the 15th?" as an example, the electronic device searches for specific data related to "the increase in A-shares from the 5th to the 15th" in the real-time off-chain industry data through the large language model, and then searches for news information such as "favorable strategies were released for a certain industry on the 3rd" and "A-shares in a certain industry increased significantly from the 5th to the 15th", as well as the daily increase data of A-shares in a certain industry from the 5th to the 15th. These data are the target off-chain industry data corresponding to the semantic content.
[0079] Step S104, when there is corresponding target off-chain industry data for the semantic content, the answer content corresponding to the text content is generated and outputted through the large language model according to the semantic content and the target off-chain industry data.
[0080] When there is corresponding target off-chain industry data for the semantic content, the electronic device uses a large language model to perform data analysis and integrated reasoning on the searched off-chain industry data, so that the results of the analysis and reasoning correspond to the semantic content and text content, thereby obtaining the answer content corresponding to the text content.
[0081] For example, still taking the text content of "Did A-shares increase much from the 5th to the 15th?" as an example, the big language module will analyze the daily increase data of a certain industry of A-shares from the 5th to the 15th based on the semantic content (the overall price increase of A-shares in the time period from the 5th to the 15th), and obtain the result that the increase of A-shares in this industry continued to rise from the 5th to the 15th, and associate the news information of "a favorable strategy was released for a certain industry on the 3rd" and "A-shares in a certain industry increased significantly from the 5th to the 15th" with the analysis results, and infer that "since a favorable strategy was released for a certain industry on the 3rd, and the increase of A-shares in this industry continued to rise from the 5th to the 15th, it can be preliminarily judged that the increase of A-shares in this industry was large from the 5th to the 15th" is the answer content corresponding to the semantic content and the text content.
[0082] Exemplarily, when the electronic device fails to search for target off-chain industry data that matches the semantic content through the large language model, it is determined that the semantic content does not have corresponding target off-chain industry data. In this case, the electronic device will obtain the real-time on-chain data of the blockchain and search for data that matches the semantic content from the real-time on-chain data. If relevant data is found, the searched data is analyzed and integrated through the large language model to obtain the answer content.
[0083] For example, the text content is "What is the total amount deposited into a certain account on the 18th?", the large language model did not find the corresponding target off-chain industry data in the real-time off-chain industry data, but instead searched the real-time on-chain data and found that the account deposited xx yuan on the 18th, so it will use "The total amount deposited into a certain account on the 18th is xx yuan" as the answer content.
[0084] When the electronic device fails to search for data matching the semantic content in the real-time off-chain industry data through the large language model, nor does it search for data matching the semantic content in the real-time chain data, the electronic device will also generate and output answer content corresponding to the text content through the large language model itself.
[0085] For example, the text content is "What does block mean in blockchain", and the large language model does not search for the corresponding target off-chain industry data in the real-time off-chain industry data, nor does it search for data matching the semantic content in the real-time chain data. In this case, the large language model generates the answer content "block is the English representation of block, which is the basic unit in blockchain technology. It is stored in a public database and contains a set of digital information. This digital information mainly records data related to resource exchange, such as date, time, participants, and unique identifiers of transactions" based on the acquired semantic content "explain the meaning of block in blockchain technology" and the blockchain knowledge learned during training.
[0086] In this way, by prioritizing the search for real-time off-chain industry data, secondarily searching for real-time on-chain data, and finally relying on the order of the large language model itself, we can ensure that the large language model will search for the latest real-time data when implementing the question-and-answer function, so that the question-and-answer function of the large language model is timely, and can provide question-and-answer services for timely questions, avoiding relying solely on the large language model itself for question-and-answer, thereby improving the accuracy of the large language model's question-and-answer and reducing its limitations.
[0087] In one application scenario, such as Figure 2 As shown, in order to make the large language model take into account both real-time data update and question-and-answer functions, first of all, it is necessary to collect a large amount of historical information of the blockchain industry (that is, historical off-chain industry data, including but not limited to news information, project information, information about well-known industry figures, widely discussed information, etc.), and use the collected historical off-chain industry data to fine-tune the existing general large language model (such as Llama, chatGPT, etc.) to obtain a fine-tuned model (that is, the large language model of the embodiment of the present application). Since the fine-tuned model uses the knowledge and optimized parameter structure that have been learned from the pre-trained general large language model to further optimize the parameters, this makes the fine-tuned model (that is, the large language model) more quickly and accurately locate information related to the question (text content) compared to using prompt to train the model for question-and-answer services, and perform efficient reasoning and generate accurate answers (answer content), reducing the complexity of calculations and redundant operations, significantly reducing the number of tokens and improving the reaction efficiency of the model.
[0088] At the same time, the blockchain data off the chain is collected in real time (that is, the real-time off-chain industry data is collected) and stored in the Vector database for query by the large language model. When providing question-and-answer services, the large language model will give priority to searching the Vector database for answers to the text content entered by the user (the target off-chain industry data corresponding to the semantic content). If there is a relevant answer, the information in the database will be used first to answer. This method can ensure that the large language model keeps up with current hot topics and understands industry data in a timely manner.
[0089] In the embodiment of the present application, when the large language model generates and outputs the corresponding answer content of the text content input by the user, the target off-chain industry data corresponding to the semantic content is matched from the acquired real-time off-chain industry data based on the semantic content of the text content. Due to the real-time nature of the real-time off-chain industry data, the target off-chain industry data found by the large language model has timeliness. By searching the real-time off-chain industry data, the large language model has the ability to update blockchain industry-related data in real time. In the question-and-answer scenario, the large language model generates the answer content based on the acquired semantic content and the target off-chain industry data with timeliness, rather than generating answers based on its own learning results of historical data, so that the answers of the large language model keep up with current hot topics, keep abreast of industry data, and improve the timeliness of the answers.
[0090] Figure 3 is a flowchart of another blockchain-based question-answering method provided in an embodiment of the present application, which is executed by an electronic device, such as Figure 3 The method shown comprises the following steps:
[0091] For details of steps S201 to S204, please refer to Figure 1 Steps S101 to S104 in the illustrated embodiment are not described in detail here. It is just that after the electronic device inputs the text content into the large language model, the semantic content obtained by the large language model includes at least one sub-semantic content. The electronic device uses the large language model to match each sub-semantic content from the real-time off-chain industry data to obtain the off-chain industry data corresponding to the sub-semantic content.
[0092] In some embodiments, obtaining real-time off-chain industry data of a blockchain includes the following steps:
[0093] Step (1), obtaining at least one original real-time off-chain industry data of the blockchain.
[0094] Among them, the original real-time on-chain data is the unprocessed real-time on-chain data. The electronic device can obtain at least one original real-time off-chain industry data of different blockchains in different fields from the Internet through a specific API or data collection tool.
[0095] Step (2), performing data preprocessing operations on the original real-time off-chain industry data to obtain processed original real-time off-chain industry data.
[0096] Among them, the data preprocessing operation at least includes a data cleaning operation and a data format conversion operation. The data cleaning operation includes removing duplicate data and correcting abnormal data. The data format conversion operation is used to convert the data format of the original real-time off-chain industry data into a preset second data format (that is, a data format that can be processed by the large voice model, for example, a vector format). The electronic device will perform a data preprocessing operation on each original real-time off-chain industry data to obtain the processed original real-time off-chain industry data in a unified data format.
[0097] Step (3), indexing the processed original real-time off-chain industry data, and using the processed original real-time off-chain industry data with the index as the real-time off-chain industry data.
[0098] When obtaining original real-time off-chain industry data, the electronic device will record the source of the data and the keywords in the data (for example, keywords declared in the title or data, etc.), and index the processed original real-time off-chain industry data based on the source of the data and the keywords.
[0099] Exemplarily, the real-time off-chain industry data also includes market sentiment labels, such as positive and negative. The market sentiment labels are used to assist the large language model in generating answer content based on the target off-chain industry data corresponding to the semantic content.
[0100] In the above technical solution, the acquired original real-time off-chain industry data is subjected to data preprocessing operations, which can reduce the redundancy or errors in the original real-time on-chain data and improve the reliability of the data, thereby improving the accuracy of the subsequent answer content. Indexing the processed original real-time off-chain industry data can facilitate the subsequent large language model to quickly find the required real-time off-chain industry data, thereby improving the efficiency of question and answer.
[0101] Step S205, obtaining real-time on-chain data of the blockchain.
[0102] The real-time on-chain data includes data associated with the first object stored on the blockchain, and the data associated with the first object may include resource exchange data and project information in the industry in which the first object is located. For example, the real-time on-chain data of A shares may include stock price data and market indexes, etc. The data format of the real-time on-chain data is a format that can be processed by a large language model, for example, a structured data format.
[0103] The electronic device pulls at least one original real-time on-chain data from different blockchains in different fields through the blockchain adapter. In this way, the electronic device can obtain the original real-time on-chain data in different data storage formats of different blockchains through the adapter. The electronic device classifies and organizes the obtained original real-time on-chain data through the data extraction-transformation-loading (ETL) component to obtain real-time on-chain data that can be processed by the large language model.
[0104] In some embodiments, the blockchain-based question-and-answer method also includes: backing up real-time off-chain industry data and real-time on-chain data; and when it is detected that one of the real-time off-chain industry data or the real-time on-chain data is damaged, restoring the damaged data based on the corresponding data backup.
[0105] In the above technical solution, the electronic device can back up the real-time off-chain industry data and the real-time on-chain data, so that when one of the real-time off-chain industry data or the real-time on-chain data is damaged, the data can be quickly restored based on the corresponding data backup to ensure the integrity of the data when the question-and-answer service is provided through the large language model later.
[0106] In some embodiments, the blockchain-based question-and-answer method also includes: encrypting and storing real-time off-chain industry data and real-time on-chain data to improve data security.
[0107] In some embodiments, obtaining real-time on-chain data of a blockchain includes the following steps:
[0108] Step (1), obtaining at least one original real-time on-chain data of the blockchain.
[0109] The original real-time on-chain data is unprocessed real-time on-chain data. The electronic device pulls at least one original real-time on-chain data from different blockchains in different fields through the blockchain adapter, and then records the category of the original real-time on-chain data according to the key fields of the table to which the original real-time on-chain data belongs. For example, if the key fields of a table are project name and project scope, the category of the original real-time on-chain data in the table is determined to be project information, and the key fields of another table are stock prices and stock buyer and seller information, the category of the original real-time on-chain data in the table is determined to be resource exchange data.
[0110] Step (2), performing data preprocessing operations on each original real-time on-chain data to obtain processed original real-time on-chain data.
[0111] The data preprocessing operation includes at least a data cleaning operation and a data format conversion operation. The data cleaning operation includes removing duplicate data and correcting abnormal data. The data format conversion operation is used to convert the data format of the original real-time chain data into a preset first data format, such as a structured data format. The electronic device can perform a data preprocessing operation on each original real-time chain data through the ETL component to obtain the processed original real-time chain data.
[0112] In some embodiments, the data preprocessing operation may also include data statistics. For example, the electronic device may use the ETL component to count the daily stock prices of A-shares in a unified format to obtain the price changes compared with the previous year. This can reduce the statistical analysis steps of the large language model on real-time chain data in the question-and-answer scenario and improve the efficiency of question-and-answer.
[0113] Step (3), index the processed original real-time on-chain data, and use the processed original real-time on-chain data with the index as the real-time on-chain data.
[0114] When processing each category of original real-time on-chain data through the ETL component, the electronic device will record the values of the key fields of the original real-time on-chain data. For example, when processing transaction data, the values of key fields such as transaction hash value or transaction timestamp will be recorded at the same time. The processed real-time on-chain data is loaded into a specific database, such as a structured database, through the ETL component. And the ETL component uses the index creation statement of the specific database to create an index for the key field, thereby obtaining the real-time on-chain data stored in the specific database.
[0115] It can be understood that electronic devices store different types of real-time on-chain data in a specific database through ETL components. When the large language model accesses a structured database (an example of a specific database), the data definition language (DDL) of the database will be received by the large language model, so that the large language model can query the real-time on-chain data through DDL.
[0116] In the above technical solution, the acquired original real-time on-chain data is subjected to data preprocessing operations including data cleaning and data format conversion, which can reduce the redundancy or erroneous content in the original real-time on-chain data and improve the reliability of the data, thereby improving the accuracy of the subsequent answer content. Unifying the format of the data can avoid the subsequent large language model's conversion and analysis operations on the data format, which can improve the efficiency of question and answer. Indexing the processed real-time on-chain data can further facilitate the subsequent large language model's access to the real-time on-chain data and speed up the generation of answer content during question and answer.
[0117] Step S206, when there is no corresponding off-chain industry data for the first sub-semantic content, the target on-chain data corresponding to the first sub-semantic content is matched from the real-time on-chain data through a large language model.
[0118] The semantic content includes at least one sub-semantic content, and the at least one sub-semantic content includes the first sub-semantic content. When the electronic device fails to match the off-chain industry data corresponding to the first sub-semantic content from the real-time off-chain industry data through the large language model, the electronic device will use the large language model to search for data related to the sub-semantic content from the real-time on-chain data, and the data found is the target on-chain data corresponding to the sub-semantic content.
[0119] It can be understood that when the electronic device matches the off-chain industry data corresponding to each sub-semantic content from the real-time off-chain industry data through the large language model, for each sub-semantic content (an example of the first sub-semantic content) that is not matched with the corresponding off-chain industry data, the on-chain industry data corresponding to the sub-semantic content will be matched in the real-time on-chain data.
[0120] For example, the text content entered by the user is what expenses and incomes have been incurred since the 1st of last month, and the semantic content obtained by the electronic device through the large language model is the user's expenses from the 1st of last month to today, and the user's income from the 1st of last month to today. The two sub-semantic contents in the semantic content are not matched with the corresponding off-chain industry data in the real-time off-chain industry data, and the query is performed on the on-chain data, and it is found that there are 4 expenses and 7 incomes in the user's recorded financial accounts from the 1st of last month to today.
[0121] Step S207, when there is corresponding target on-chain data for the first sub-semantic content, a large language model is used to generate and output answer content corresponding to the text content based on the target on-chain data, semantic content, and off-chain industry data corresponding to other sub-semantic contents except the first sub-semantic content.
[0122] When the electronic device obtains the target on-chain data corresponding to the first sub-semantic content through the large language model, the large language model is used to perform data analysis and integrated reasoning on the target on-chain data and the off-chain industry data corresponding to the sub-semantic contents except the first sub-semantic content according to the semantic content, so that the results of the analysis and reasoning correspond to the semantic content and the text content, thereby obtaining the answer content corresponding to the text content.
[0123] It can be understood that if each sub-semantic content (an example of the first sub-semantic content) does not have corresponding off-chain industry data, the electronic device generates and outputs the answer content corresponding to the text content based on the voice content and the on-chain data corresponding to each sub-semantic content through a large language model.
[0124] Continuing to refer to the above example, the electronic device calculates the total expenditures and total income based on 4 expenditures and 7 incomes respectively through a large language model, and calculates the difference between expenditures and incomes, and then uses the total expenditures, total incomes, the difference between the two, and each expenditure and income as the answers corresponding to the text content and semantic content. The input answer content can be "From the 1st of last month to today, the total expenditures are [total expenditures], specifically [4 expenditures]; the total income is [total income], specifically [7 incomes]; the profit from the 1st of last month to today (the calculated difference is greater than or equal to zero, otherwise it is a loss) is [difference]".
[0125] In some embodiments, the method also includes, when generating answer content according to semantic content and target off-chain industry data through a large language model, continuing to match the on-chain data of the semantic content from the real-time on-chain data; when there is corresponding on-chain data for the semantic content, correcting and outputting the answer content based on the on-chain data.
[0126] In the above technical solution, after the electronic device matches the off-chain industry data corresponding to each sub-semantic content in the semantic content from the real-time off-chain industry data through the large language model, in addition to generating the answer content based on each off-chain industry data, it also matches the on-chain data corresponding to each sub-semantic content from the real-time on-chain data. In the case where there is corresponding on-chain data for at least one sub-semantic content, the electronic device determines the previously generated answer content based on the on-chain data through the large language model, corrects it, and outputs the corrected answer content. The correction of on-chain data improves the reliability of the answer content in the question-and-answer scenario.
[0127] For example, taking the text content of "How has the average stock price of A-shares changed in 2017 compared with the previous year?" as an example, the electronic device generates the answer "The average stock price of A-shares in 2017 has dropped compared with the average stock price in 2017-1" through the big language model based on the real-time off-chain data corresponding to the semantic content of the text content. The electronic device matches the average stock price Y of A-shares in 2017 and the average stock price X of A-shares in 2017-1 in the real-time on-chain data through the big language model, and then modifies the generated answer content to "The average stock price of A-shares in 2017 has dropped compared with the average stock price in 2017-1, specifically by XY".
[0128] Continue to combine Figure 2 The application scenarios shown are as follows: Figure 4As shown, while obtaining real-time off-chain industry data, it is also necessary to obtain and store real-time on-chain data. An on-chain information index service can be established in an electronic device, and when the service is executed, the real-time on-chain data can be stored locally. Since the data on the blockchain is structured, a structured database (an example of a specific database) can be used to store real-time on-chain data.
[0129] Taking obtaining real-time on-chain data from Chain A and Chain B as an example, the electronic device pulls the original real-time on-chain data from Chain A and Blockchain B respectively through the adapter of Chain A and the adapter of Chain B. Then, the pulled original real-time on-chain data is classified and sorted (including classification, data preprocessing and indexing) through the ETL component to obtain the real-time on-chain data. The real-time on-chain data is stored in a structured database ( Figure 2 The DDL of the structured database will be received by the big language model. When the big language model finds the answer to the text content entered by the user in the real-time off-chain industry data in the Vector database, it will query the corresponding answer (the on-chain data corresponding to the semantic content) from the real-time on-chain data in the structured database based on the DDL to generate the answer content.
[0130] In the embodiment of the present application, in addition to obtaining real-time off-chain industry data, real-time on-chain data will also be obtained, so that the subsequent large language model can access the real-time off-chain industry data and real-time on-chain data, so that the large language model has the ability to update the off-chain industry data and on-chain data in real time. By first matching relevant data from the real-time off-chain industry data and then matching relevant data from the real-time on-chain data, and then obtaining answers based on the matched on-chain data and off-chain industry data, it is achieved when the blockchain Q&A is performed through the large language model. The comprehensive use of real-time off-chain industry data and real-time on-chain data improves the reliability of Q&A. It can also avoid the early association operation between real-time off-chain industry data and real-time on-chain data, which can reduce the difficulty and cost of implementing blockchain-based Q&A, and ensure that the large language model will give priority to searching for real-time off-chain industry data when answering questions, so that the large language model can keep up with current hot topics.
[0131] Figure 5 is a flow chart of processing text content input by a user provided by an embodiment of the present application, such as Figure 5 As shown, before obtaining the semantic content of the text content through the large language model, the blockchain-based question-answering method in the embodiment of the present application also includes the following steps S301 to S302:
[0132] Step S301, upon receiving text content input by a user, a security audit operation is performed on the text content.
[0133] The security audit operation includes at least one of malicious content detection or privacy content filtering of the text content. Malicious content detection is used to check whether the input text content contains malicious scripts, and privacy content filtering is used to identify and filter the user's privacy information contained in the text content, such as the user's name, ID number, telephone number or address. The electronic device can perform a security audit operation on the text content through a filter. If the text content fails the security audit, the text content is discarded and a prompt message is displayed. The prompt message is used to prompt the user to re-enter the text content. When the large language model is used by a large number of users, only text content that has passed the security audit can be input into the large language model, which can reduce the amount of text content actually input into the large language model and reduce the load pressure of the model during peak hours.
[0134] It should be noted that security audit operations can also include specific keyword filtering, such as filtering for keywords such as violence and terrorism, and compliance checks, such as filtering advertisements, spam, and illegal speech. The text content input into the large language model can meet the standards of different places, expanding the application scope of the large language model that can provide blockchain question-and-answer services.
[0135] Step S302: When the text content passes the security review, a content prompt corresponding to the text content is generated based on a preset prompt, and the content prompt is used to assist the large language model in understanding the text content.
[0136] If the text content passes the security review, the electronic device can add the text content to the corresponding position in the preset prompt to obtain the content prompt. For example, the text content is "The fund increase of a certain bank this week", and the preset prompt is to query and analyze the relevant data based on [text content] and output the analysis results. Then the content prompt is to query and analyze the relevant data based on the fund increase of a certain bank this week, and output the analysis results. In the embodiment of this application, there is no specific limitation on the preset prompt, which can be set by yourself.
[0137] Acquiring semantic content of text content through a large language model includes the following step S303:
[0138] Step S303: Determine semantic content from the content prompt using a large language model.
[0139] The electronic device inputs the content prompt into the large language model, which performs word segmentation and part-of-speech tagging on the content prompt, and uses the NLP algorithm to perform semantic analysis on the content prompt based on the word segmentation results and part-of-speech tagging results to obtain semantic content, which is the semantic content of the text content.
[0140] Continue to see Figure 2 In the application scenario shown, when receiving a conversation input by the user (an example of text content), the electronic device will first pass the text content to the filter for security review operations to prevent some malicious or unsafe information from being transmitted to the large language model, and can also reduce the load pressure of the model during peak hours, local guidelines. The filtered conversation (an example of text content that has passed the security review) will be sent to the large language model in combination with the prompt, which can be a prompt that has been adjusted to make the fine-tuned general large language model closer to the real needs of the blockchain industry. The large language model can then generate answers based on the conversation combined with the prompt (an example of content prompt) and prioritize the search for real-time off-chain industry data in the Vector database.
[0141] In an embodiment of the present application, when receiving text content input by a user, security review operations are performed on the text content first, and only the text content that has passed the security review is subsequently processed to provide question-and-answer services. In this way, text content that has not passed the security review is excluded, and malicious or private information can be prevented from being transmitted to the large language model.
[0142] It should be understood that the size of the sequence number of each step in the above embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. It should be noted that the information collection process (such as the real-time off-chain industry and the real-time on-chain data collection process, etc.) / feature extraction process involved in this application is performed with the knowledge and permission of the user, that is, the information collection process / feature extraction process complies with the relevant standard requirements and does not constitute an act that harms the public interest.
[0143] Corresponding to the blockchain-based question-answering method described in the above embodiment, Figure 6 A structural block diagram of a blockchain question-and-answer device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0144] Reference Figure 6 , the device comprises:
[0145] A first acquisition module 610 is used to acquire real-time off-chain industry data of the blockchain, where the real-time off-chain industry data is used to indicate industry dynamic information of the industry in which the first object is located;
[0146] A second acquisition module 620 is used to acquire semantic content of the text content through a large language model when receiving text content input by a user, where the text content is related to the first object;
[0147] Matching module 630, used to match the target off-chain industry data corresponding to the semantic content from the real-time off-chain industry data through a large language model;
[0148] The generation and output module 640 is used to generate and output answer content corresponding to the text content based on the semantic content and the target off-chain industry data using a large language model when there is corresponding target off-chain industry data for the semantic content.
[0149] In some embodiments, the semantic content includes at least one sub-semantic content, the at least one sub-semantic content includes a first sub-semantic content, and the first acquisition module is further used to acquire real-time on-chain data of the blockchain, the real-time on-chain data includes data associated with the first object stored on the blockchain;
[0150] The matching module is also used to match the target on-chain data corresponding to the first sub-semantic content from the real-time on-chain data through the large language model when there is no corresponding off-chain industry data for the first sub-semantic content;
[0151] The generation and output module is also used to generate and output answer content corresponding to the text content through a large language model based on the target chain data, semantic content, and off-chain industry data corresponding to other sub-semantic contents except the first sub-semantic content, when there is corresponding target chain data for the first sub-semantic content.
[0152] In some embodiments, the device further includes, before the second acquisition module acquires the semantic content of the text content through the large language model, an audit module for performing a security audit operation on the text content, the security audit operation including at least one of malicious content detection or privacy content filtering on the text content;
[0153] A generation module is used to generate content prompts corresponding to the text content based on preset prompts when the text content passes the security review. The content prompts are used to assist the large language model in understanding the text content.
[0154] The second acquisition module is specifically used to determine the semantic content of the text content according to the content prompt through the large language model.
[0155] In some embodiments, the first acquisition module is further used to:
[0156] Obtain at least one original real-time on-chain data of the blockchain, where the original real-time on-chain data is unprocessed real-time on-chain data;
[0157] Performing a data preprocessing operation on each original real-time on-chain data to obtain processed original real-time on-chain data, wherein the data preprocessing operation at least includes a data cleaning operation and a data format conversion operation, wherein the data cleaning operation includes removing duplicate data and correcting abnormal data, and the data format conversion operation is used to convert the data format of the original real-time on-chain data into a preset first data format;
[0158] An index is created for the processed original real-time on-chain data, and the processed original real-time on-chain data with the index is used as the real-time on-chain data.
[0159] In some embodiments, the first acquisition module is further used to:
[0160] Obtain at least one original real-time off-chain industry data of the blockchain, where the original real-time off-chain industry data is unprocessed real-time off-chain industry data;
[0161] Performing data preprocessing operations on the original real-time off-chain industry data to obtain processed real-time off-chain industry data, wherein the data preprocessing operations at least include data cleaning operations and data format conversion operations, wherein the data cleaning operations include removing duplicate data and correcting abnormal data, and the data format conversion operations are used to convert the data format of the original real-time off-chain industry data into a preset second data format;
[0162] The processed off-chain industry data is indexed, and the processed off-chain industry data with the index is used as the real-time off-chain industry data.
[0163] In some embodiments, the apparatus further comprises:
[0164] Backup module, used to back up real-time off-chain industry data and real-time on-chain data;
[0165] The recovery module is used to restore the damaged data based on the corresponding data backup when it is detected that one of the real-time off-chain industry data or the real-time on-chain data is damaged.
[0166] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0167] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0168] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 7 As shown, the electronic device 6 of this embodiment includes: at least one processor 60 ( Figure 6 Only one is shown in the figure) a processor, a memory 61, and a computer program 62 stored in the memory 61 and executable on the at least one processor 60, and when the processor 60 executes the computer program 62, the steps in any of the above-mentioned blockchain-based question-and-answer method embodiments are implemented.
[0169] The electronic device 6 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The electronic device may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art will appreciate that Figure 6 It is only an example of the electronic device 6 and does not constitute a limitation on the electronic device 6. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0170] The processor 60 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0171] In some embodiments, the memory 61 may be an internal storage unit of the electronic device 6, such as a hard disk or memory of the electronic device 6. In other embodiments, the memory 61 may also be an external storage device of the electronic device 6, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 6. Further, the memory 61 may also include both an internal storage unit of the electronic device 6 and an external storage device. The memory 61 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory 61 may also be used to temporarily store data that has been output or is to be output.
[0172] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0173] An embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0174] 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 present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0175] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0176] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0177] In the embodiments provided in the present application, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely schematic. For example, the division of the modules or 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 through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0178] The units described 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.
[0179] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such 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 application, and should all be included in the protection scope of the present application.
Claims
1. A question-answering method based on blockchain, characterized in that: The method comprises: Acquire real-time off-chain industry data of the blockchain, where the real-time off-chain industry data is used to indicate industry dynamic information of the industry in which the first object is located; When receiving text content input by a user, obtaining semantic content of the text content through a large language model, wherein the text content is related to the first object; Matching the target off-chain industry data corresponding to the semantic content from the real-time off-chain industry data through the large language model; In the case where the semantic content has corresponding target off-chain industry data, the large language model generates and outputs answer content corresponding to the text content based on the semantic content and the target off-chain industry data.
2. The method according to claim 1, characterized in that The semantic content includes at least one sub-semantic content, and the at least one sub-semantic content includes a first sub-semantic content; The method further comprises: Acquire real-time on-chain data of the blockchain, where the real-time on-chain data includes data associated with the first object and stored on the blockchain; In the case where there is no corresponding off-chain industry data for the first sub-semantic content, matching the target on-chain data corresponding to the first sub-semantic content from the real-time on-chain data by using the large language model; In the case that the first sub-semantic content has corresponding target on-chain data, the large language model generates and outputs answer content corresponding to the text content based on the target on-chain data, the semantic content, and the off-chain industry data corresponding to other sub-semantic contents except the first sub-semantic content.
3. The method according to claim 1 or 2, characterized in that Before acquiring the semantic content of the text content through the large language model, the method further includes: Performing a security audit operation on the text content, wherein the security audit operation includes performing at least one of malicious content detection or privacy content filtering on the text content; If the text content passes the security review, generating a content prompt corresponding to the text content based on a preset prompt, wherein the content prompt is used to assist the large language model in understanding the text content; The obtaining the semantic content of the text content by using the large language model includes: The semantic content is determined from the content prompt by the large language model.
4. The method according to claim 2, characterized in that The obtaining of real-time on-chain data of the blockchain includes: Obtain at least one original real-time on-chain data of the blockchain, where the original real-time on-chain data is unprocessed real-time on-chain data; Performing a data preprocessing operation on each of the original real-time on-chain data to obtain processed original real-time on-chain data, wherein the data preprocessing operation at least includes a data cleaning operation and a data format conversion operation, wherein the data cleaning operation includes removing duplicate data and correcting abnormal data, and the data format conversion operation is used to convert the data format of the original real-time on-chain data into a preset first data format; An index is created for the processed original real-time on-chain data, and the processed original real-time on-chain data with the index is used as the real-time on-chain data.
5. The method according to claim 1 or 2, characterized in that: The acquisition of real-time off-chain industry data of the blockchain includes: Acquire at least one original real-time off-chain industry data of the blockchain, where the original real-time off-chain industry data is unprocessed real-time off-chain industry data; Performing a data preprocessing operation on the original real-time off-chain industry data to obtain processed original real-time off-chain industry data, wherein the data preprocessing operation at least includes a data cleaning operation and a data format conversion operation, wherein the data cleaning operation includes removing duplicate data and correcting abnormal data, and the data format conversion operation is used to convert the data format of the original real-time off-chain industry data into a preset second data format; An index is created for the processed original real-time off-chain industry data, and the processed original real-time off-chain industry data with the index is used as the real-time off-chain industry data.
6. The method according to claim 2, characterized in that The method further comprises: Backing up the real-time off-chain industry data and the real-time on-chain data; In the event that damage is detected in one of the real-time off-chain industry data or the real-time on-chain data, the damaged data is restored based on the corresponding data backup.
7. A question-answering device based on blockchain, characterized in that: include: A first acquisition module is used to acquire real-time off-chain industry data of the blockchain, where the real-time off-chain industry data is used to indicate industry dynamic information of the industry in which the first object is located; A second acquisition module is used to acquire semantic content of the text content through a large language model when receiving text content input by a user, wherein the text content is related to the first object; A matching module, used for matching the target off-chain industry data corresponding to the semantic content from the real-time off-chain industry data through the large language model; A generation and output module is used to generate and output answer content corresponding to the question text based on the semantic content and the target off-chain industry data using the large language model when there is corresponding target off-chain industry data for the semantic content.
8. An electronic device, characterized in that: The electronic device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the method as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that The invention comprises a computer program, which, when being executed, enables the method according to any one of claims 1 to 6 to be performed.