Data query method and device, electronic equipment and readable storage medium
通过对查询数据进行向量化处理和利用大语言模型生成目标数据,解决了现有技术中对查询词语语义理解能力弱的问题,实现了高效、灵活的数据查询,提升了查询结果的精确性和 readability.
Patent Information
- Application Number
- CN202411448087.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-01-21
AI Technical Summary
In the prior art, due to the weak ability to understand the semantic relationships of query words and the slow execution speed of large amounts of data, the query is low, low efficiency and poor flexibility.
By processing the inquiry data, the high -dimensional data is mapped to the low -dimensional vector space, using the preset vector database and large language model to determine the target vector and generate target data, and finally display the target data on the terminal device.
It improves the accuracy of data query, improves query efficiency, expands the flexibility of data query, and improves the practicality and readability of data query results.
Smart Images

Figure CN119336892A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a data query method, device, electronic device and readable storage medium. Background Art
[0002] When processing data queries, precise query methods are usually used for accurate determination. When it is necessary to process retrieval tasks for large amounts of data, the efficiency of precise query methods is relatively reduced. At this time, under normal circumstances, the fuzzy query function of the database is used to perform string matching. In simple string matching, the effect is significant, but when the data being processed is in the form of natural language, there are many restrictions. Since the semantic relationship between the query terms and the data cannot be obtained, the accuracy of the query results is reduced. For large databases, fuzzy queries execute slowly, affecting processing efficiency. They cannot understand diversity and ambiguity in processing natural language query terms, resulting in poor flexibility.
[0003] It can be seen that the existing technology has the problem of low query accuracy, low efficiency and poor flexibility due to the weak ability to understand the semantic relationship of query terms and slow execution speed on large amounts of data. Summary of the invention
[0004] In view of this, the embodiments of the present disclosure provide a data query method, device, electronic device and readable storage medium to solve the problems in the prior art of low query accuracy, low efficiency and poor flexibility due to weak ability to understand the semantic relationship of query terms and slow execution speed on large amounts of data.
[0005] According to a first aspect of an embodiment of the present disclosure, a data query method is provided, including: acquiring query data; performing vectorization processing on the query data to obtain a vector corresponding to the query data; determining a target vector sequence based on a preset vector database and the vector corresponding to the query data; determining a target vector corresponding to the query data from the target vector sequence; performing text generation processing on the target vector corresponding to the query data through a large language model to obtain target data corresponding to the query data; and sending the target data corresponding to the query data to a terminal device so that the target data is displayed on a current graphical user interface of the terminal device.
[0006] According to a second aspect of an embodiment of the present disclosure, a data query device is provided, including: an acquisition module for acquiring query data; a first processing module for performing vectorization processing on the query data to obtain a vector corresponding to the query data; a first determination module for determining a target vector sequence based on a preset vector database and the vector corresponding to the query data; a second determination module for determining the target vector corresponding to the query data from the target vector sequence; a second processing module for performing text generation processing on the target vector corresponding to the query data through a large language model to obtain target data corresponding to the query data; and a third processing module for sending the target data corresponding to the query data to a terminal device so that the target data is displayed on a current graphical user interface of the terminal device.
[0007] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0008] According to a fourth aspect of an embodiment of the present disclosure, a readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0009] Compared with the prior art, the embodiments of the present disclosure have the following beneficial effects: by acquiring query data and performing vectorization processing on the query data, high-dimensional data is mapped into a low-dimensional vector space to obtain a vector corresponding to the query data, a vector set whose vector similarity with the query data meets the requirements is queried from a preset vector database, and the target vector sequence is obtained after the vector set is sorted, and then the corresponding vectors whose similarity meets the preset conditions can be screened to obtain the target vector corresponding to the query data, and the target vector corresponding to the query data is input into a large language model for text generation to obtain the target data corresponding to the query data, and then the target data corresponding to the query data can be sent to the user's terminal device, and the target data can be displayed on the current graphical user interface of the terminal device, thereby improving the accuracy of data query, improving query efficiency, expanding the flexibility of data query, and improving the practicality and readability of data query results. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, 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 disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0011] Figure 1is a schematic diagram of an application scenario of an embodiment of the present disclosure;
[0012] Figure 2 It is a flowchart of a data query method provided by an embodiment of the present disclosure;
[0013] Figure 3 is a structural diagram of a data query device provided by an embodiment of the present disclosure;
[0014] Figure 4 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0015] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present disclosure. However, it should be clear to those skilled in the art that the present disclosure may 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 avoid obstructing the description of the present disclosure with unnecessary details.
[0016] It should be noted that the user information (including but not limited to terminal device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0017] A data query method and device according to an embodiment of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0018] Figure 1 1 is a schematic diagram of an application scenario of an embodiment of the present disclosure. The application scenario may include terminal devices 1, 2 and 3, a server 4 and a network 5.
[0019] Terminal devices 1, 2 and 3 can be hardware or software. When terminal devices 1, 2 and 3 are hardware, they can be various electronic devices with display screens and supporting communication with server 4, including but not limited to smart phones, tablet computers, laptop portable computers and desktop computers, etc.; when terminal devices 1, 2 and 3 are software, they can be installed in the above electronic devices. Terminal devices 1, 2 and 3 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present disclosure are not limited to this. Furthermore, various applications can be installed on terminal devices 1, 2 and 3, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, etc.
[0020] The server 4 may be a server that provides various services, for example, a background server that receives a request sent by a terminal device that establishes a communication connection with the server, and the background server may receive and analyze the request sent by the terminal device, and generate a processing result. The server 4 may be a single server, or a server cluster composed of several servers, or a cloud computing service center, which is not limited in the embodiments of the present disclosure.
[0021] It should be noted that the server 4 can be hardware or software. When the server 4 is hardware, it can be various electronic devices that provide various services for the terminal devices 1, 2, and 3. When the server 4 is software, it can be multiple software or software modules that provide various services for the terminal devices 1, 2, and 3, or it can be a single software or software module that provides various services for the terminal devices 1, 2, and 3, and the embodiments of the present disclosure are not limited to this.
[0022] The network 5 can be a wired network connected by coaxial cable, twisted pair and optical fiber, or it can be a wireless network that can interconnect various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), infrared, etc., which is not limited in the embodiments of the present disclosure.
[0023] The user can establish a communication connection with the server 4 via the terminal devices 1, 2 and 3 via the network 5 to receive or send information, etc. Specifically, the server 4 can obtain the query data via the terminal devices 1, 2 and 3, and perform vectorization processing on the query data, map the high-dimensional data into a low-dimensional vector space, obtain the vector corresponding to the query data, query from the preset vector database to obtain a vector set whose vector similarity with the query data meets the requirements, sort the vector set to obtain a target vector sequence, and then screen the corresponding vectors whose similarity meets the preset conditions to obtain the target vector corresponding to the query data, input the target vector corresponding to the query data into the large language model for text generation, and obtain the target data corresponding to the query data, and then send the target data corresponding to the query data to the user's terminal device, and display the target data on the current graphical user interface of the terminal device.
[0024] It should be noted that the specific types, quantities and combinations of the terminal devices 1, 2 and 3, the server 4 and the network 5 can be adjusted according to the actual needs of the application scenario, and the embodiments of the present disclosure are not limited to this.
[0025] Figure 2 It is a flowchart of a data query method provided by an embodiment of the present disclosure. Figure 2 The data query method can be Figure 1 The server executes. Figure 2 As shown, the data query method includes:
[0026] Step 201, obtaining query data.
[0027] Specifically, the query data can be obtained through user input, interface call, or preset data source access, which is not limited here. The query data can be retrieved and extracted from storage media such as databases, file systems, or network application programming interfaces (Application Programming Interface, API), thereby enhancing the flexibility and accuracy of query data acquisition. By inputting a variety of query conditions, the accuracy of information acquisition is improved, the efficiency of data processing is improved, and the response speed is accelerated.
[0028] Among them, the query data can be a data set retrieved from a data source through user input, interface call, or preset data source access, and through structured query statements (Structured Query Language, SQL), API request parameters and other structures. The query data may include structured data, semi-structured data, or unstructured data, etc., which are not limited here. For example, structured data can be table records in a database, semi-structured data can be JavaScript Object Notation (JavaScript Object Notation, JSON) or extensible markup language (eXtensible Markup Language, XML) files, and unstructured data can be text files or optical character recognition (Optical Character Recognition, OCR) results in images. The query data can be used in various application scenarios such as data analysis, report generation, or business logic processing, which are not limited here.
[0029] For example, in the product search function of an e-commerce platform, you can enter a keyword, such as "sports shoes". After receiving the keyword input, "sports shoes" is converted into a database query statement, and all product information containing "sports shoes" in the title, description, or tag can be retrieved from the database as query data.
[0030] Step 202: vectorize the query data to obtain a vector corresponding to the query data.
[0031] Specifically, the non-numerical information in the query data can be converted into a numerical vector representation in a high-dimensional space through feature extraction and conversion algorithms, wherein the non-numerical information includes but is not limited to text or images, and vectorization processing can be achieved through text processing, image processing, or numerical encoding of structured data, wherein text processing includes but is not limited to word segmentation, stop word removal, or word embedding, image processing can be a convolutional neural network feature extraction method, and numerical encoding can be one-hot encoding or label encoding, etc., which are not limited here. The query data can be converted into a vector corresponding to the query data that is easy to calculate and compare, thereby enhancing the processability and comparability of the data and improving the accuracy and efficiency of data analysis.
[0032] Among them, the vector corresponding to the query data can be a numerical vector obtained by vectorizing the information in the query data. The vector corresponding to the query data can contain the key features and information of the query data. The vector corresponding to the query data can be obtained through feature extraction and conversion algorithms, and can be applied to machine learning, deep learning models, similarity calculation, information retrieval and other scenarios, which are not limited here.
[0033] For example, in the query understanding of the search engine, the query statement can be "recommend a cost-effective mobile phone", and then the query statement entered by the user can be pre-processed by natural language processing (NLP) technology such as word segmentation, part-of-speech tagging, and syntactic analysis. There is no limitation here. Each word can be converted into a high-dimensional vector through a word embedding model, and the vector corresponding to the query statement can be obtained through weighted averaging or attention mechanism.
[0034] Step 203: Determine a target vector sequence according to the preset vector database and the vectors corresponding to the query data.
[0035] Specifically, the similarity value between each vector and the vector corresponding to the query data can be calculated in the preset vector database through a similarity calculation method. The similarity calculation can be implemented through cosine similarity or Euclidean distance, etc., which are not limited here. Multiple vectors similar to the query data vector are obtained, which constitute a target vector sequence. Multiple vectors can be stored in the preset vector database, and each vector can be a feature representation of an entity, concept, or data point, thereby enhancing the intelligence of data processing. Vector-based similarity matching is more precise and faster than traditional text- or keyword-based matching, which improves the accuracy and efficiency of queries. Since the preset vector database can be continuously updated with the addition of new data, it supports dynamically changing query requirements and improves scalability and flexibility.
[0036] Among them, the preset vector database can be a database for storing vector data, and the preset vector database can organize data with efficient index structures such as key-value pairs or graph structures, which are not limited here. The vectors in the preset vector database can be obtained by encoding data such as text or images through a machine learning model. The machine learning model includes but is not limited to a word vector model (Word to Vector, Word2Vec) or a bidirectional encoding representation based on a transformer (Bidirectional Encoder Representations from Transformers, BERT), etc. Each vector can be used to characterize the position of an instance in a feature space; the target vector sequence can be a set of vector sequences that are most similar or related to the query data vector selected from the preset vector database. Each vector in the target vector sequence can be sorted from high to low according to the similarity value, and the target vector sequence can be used in multiple application scenarios, including but not limited to recommendation systems, information retrieval, or anomaly detection.
[0037] For example, in an e-commerce platform, when a user enters a product name or description as query data and searches for the query data, the query data can be converted into a vector corresponding to the query data, and a product vector sequence similar to the vector corresponding to the query data can be searched in a preset product vector database, and the corresponding product information can be displayed to the user based on the similarity sorting.
[0038] Step 204: determine the target vector corresponding to the query data from the target vector sequence.
[0039] Specifically, the target vector corresponding to the query data can be identified and determined in the target vector sequence through a preset similarity threshold. When a vector in the target vector sequence is greater than or equal to the preset similarity threshold, the vector is the target vector, thereby enhancing the accuracy and efficiency of data query, improving the accuracy of information matching, and improving user experience. By accurately matching the target vector, the processing flow is simplified and the response speed is improved.
[0040] The target vector corresponding to the query data may be a vector greater than or equal to a preset similarity threshold in the target vector sequence, and the target vector corresponding to the query data may be used to represent a vector in a preset vector database that meets the requirements for similarity with the query data.
[0041] For example, in the product recommendation system of an e-commerce platform, the query data may be "sports shoes" and the preset similarity threshold may be 80%. Then, according to the preset similarity threshold, the vector corresponding to the similarity value greater than or equal to 80% can be retrieved in the target vector sequence, that is, the target vector corresponding to the query data, and the product that best meets the user's needs can be recommended to the user.
[0042] Step 205 , performing text generation processing on the target vector corresponding to the query data through the large language model to obtain the target data corresponding to the query data.
[0043] Specifically, the large language model can be used to take the target vector corresponding to the query data as input, and the neural network structure and algorithm inside the large language model can be used to generate text data corresponding to the target vector, that is, the target data corresponding to the query data. This enhances the intelligence and personalization level of text generation, improves the accuracy and quality of generated text, and improves the response speed of query tasks. Through the processing of the large language model, the accuracy of understanding user intentions is enhanced.
[0044] Among them, large language models (LLMs) can be deep learning models containing a large number of parameters. In the field of natural language processing, large language models can learn language patterns, grammar, and semantics by processing text data, which is not limited here, and thus can realize the understanding and generation of natural language. Large language models can be based on complex neural network architectures, such as Transformer, and can be pre-trained on ultra-large-scale data sets, so as to obtain rich features and patterns of language; the target data corresponding to the query data can be text data generated after processing the target vector corresponding to the query data through the large language model. The target data corresponding to the query data can be natural language text, including but not limited to sentences answering questions, paragraphs describing products, or generated storylines, etc. The target data corresponding to the query data can be obtained through the decoding and generation algorithm of the large language model.
[0045] For example, in an intelligent customer service system, the query data may be "how to replace a mobile phone battery", and then the target vector most relevant to the user's question can be found through vector retrieval. The target vector is processed for text generation through a large language model to generate a detailed answer, such as "replacing a mobile phone battery usually requires the following steps:...", which is returned to the user as the target data corresponding to the query data.
[0046] Step 206: Send the target data corresponding to the query data to the terminal device, so that the target data is displayed on the current graphical user interface of the terminal device.
[0047] Specifically, the target data corresponding to the query data can be sent to the user's terminal device through a communication protocol and a network transmission method. After the terminal device receives the target data, the target data can be parsed through a graphical user interface framework and displayed in a visual form on a currently displayed graphical user interface. The display form of the target data includes but is not limited to text, pictures, or videos, thereby enhancing the immediacy and interactivity of the data retrieval method, improving the data transmission efficiency and accuracy, and improving the response speed of the terminal device and the friendliness of the user interface.
[0048] Among them, the terminal device can be an electronic device with which the user can directly interact, including but not limited to a smart phone, a tablet computer, a laptop computer, or a smart TV. The terminal device can include components such as a display screen, an input device, and a processor, which are not limited here, wherein the input device includes but is not limited to a keyboard or a touch screen; a graphical user interface (Graphical User Interface, GUI) can be an interface form for interacting with the user through graphical elements, wherein the graphical elements include but are not limited to windows, icons, buttons, or menus. The graphical user interface can simplify computer operations into graphical operations through computer graphics and human-computer interaction methods, and the GUI can be obtained through programming languages and graphical interface design tools.
[0049] For example, in e-commerce applications, a mobile application related to the e-commerce can be installed on the terminal device. Users can search for products through the mobile application. The target data corresponding to the query data can be sent to the user's terminal device through the mobile network in the form of pictures, text descriptions, and prices. When the user opens the application on the terminal device, the corresponding product information can be observed on the graphical user interface.
[0050] According to the technical solution provided by the embodiment of the present disclosure, by acquiring query data and performing vectorization processing on the query data, high-dimensional data is mapped into a low-dimensional vector space to obtain a vector corresponding to the query data, a vector set whose vector similarity meets the requirements with respect to the query data is queried from a preset vector database, and the target vector sequence is obtained after the vector set is sorted, and then the corresponding vectors whose similarity meets the preset conditions are screened to obtain the target vector corresponding to the query data, and the target vector corresponding to the query data is input into a large language model for text generation to obtain the target data corresponding to the query data, and then the target data corresponding to the query data can be sent to a terminal device of the user, and the target data can be displayed on the current graphical user interface of the terminal device, thereby improving the accuracy of data query, improving query efficiency, expanding the flexibility of data query, and improving the practicality and readability of data query results.
[0051] In some embodiments, before obtaining the query data, it also includes: obtaining a preset field data set, the preset field data set includes at least one preset field data; vectorizing each preset field data to obtain a vector corresponding to each preset field data; storing the vector corresponding to each preset field data in a preset vector database.
[0052] Specifically, a preset field data set can be obtained from a preset data source or configuration file, which is not limited here. The preset field data set can include multiple field data for query or analysis, and then each preset field data in the preset field data set can be processed by a vectorization method to convert the preset field data into a vector representation, that is, a vector corresponding to the preset field data, and then the vector corresponding to each preset field data can be stored in a preset vector database for subsequent rapid retrieval and matching.
[0053] Among them, the preset field data set can be a set of pre-defined field data, the preset field data can be user information, product attributes, or article tags, etc., which are not limited here. The preset field data can be a single data item in the preset field data set, and the preset field data can be used to represent identifiable information units. For example, in e-commerce applications, the preset field data can be the name, price, or description of the product, etc.; the vector corresponding to the preset field data can be a vector representation corresponding to the preset field data obtained by vectorizing the preset field data.
[0054] For example, in a search engine, a preset field data set, such as a web page title, content, and keywords, can be obtained during the index building phase, and then each preset field data in the preset field data set can be vectorized, and the vector corresponding to the obtained preset field data can be stored in a preset vector database. When a user enters query data, the query data can be vectorized to obtain a vector corresponding to the query data, and then the preset vector database can be queried to obtain relevant web page data, thereby returning relevant search results.
[0055] According to the technical solution provided by the embodiment of the present disclosure, by obtaining a preset field data set from a preset data source or configuration file, which is not limited here, each preset field data in the preset field data set can be processed by a vectorization method, and the preset field data can be converted into a vector representation, that is, a vector corresponding to the preset field data, and then the vector corresponding to each preset field data can be stored in a preset vector database, thereby enhancing the flexibility and scalability of data processing, improving the efficiency and accuracy of data retrieval, and enhancing the intelligence level of data retrieval.
[0056] In some embodiments, query data is vectorized to obtain a vector corresponding to the query data, including: format conversion processing of the query data to obtain target format data; inputting the target format data into a vector conversion model to encode the target format data to obtain a high-dimensional mapping vector corresponding to the query data; extracting the high-dimensional mapping vector corresponding to the query data to obtain a vector corresponding to the query data.
[0057] Specifically, the query data can be structured and converted into structured data corresponding to the query data, and then the converted structured data can be input into a vector conversion model. The vector conversion model can be a deep learning model, including but not limited to Word2Vec, BERT, etc. The structured data can be encoded through the vector conversion model to generate a high-dimensional mapping vector, and then key information can be extracted from the high-dimensional mapping vector corresponding to the query data or dimensionality reduction processing can be performed, which is not limited here, to obtain the vector corresponding to the query data.
[0058] Among them, the target format data can be data that has been formatted, and the target format data can be an SQL query statement, etc.; the vector conversion model can be a deep learning model, and the vector conversion model can convert the input target format data into a high-dimensional vector. The vector conversion model can map the target format data to a high-dimensional space by understanding the intrinsic characteristics or semantic information of the target format data. The vector conversion model includes but is not limited to Word2Vec or BERT, etc.; the high-dimensional mapping vector corresponding to the query data can be a vector representation obtained after encoding the target format data through the vector conversion model, and each dimension of the high-dimensional mapping vector corresponding to the query data can be used to characterize the strength or existence of the query data in a certain feature or semantic dimension.
[0059] For example, in the product search system of an e-commerce platform, the query data can be "red dress", and the query data can be converted into structured data, and then the structured data can be input into the BERT model to generate the corresponding high-dimensional mapping vector.
[0060] According to the technical solution provided by the embodiment of the present disclosure, the query data is structured and converted into structured data corresponding to the query data. The converted structured data can be input into a vector conversion model, and the structured data can be encoded by the vector conversion model to generate a high-dimensional mapping vector. Key information can be extracted from the high-dimensional mapping vector corresponding to the query data or dimensionality reduction processing can be performed to obtain a vector corresponding to the query data, thereby enhancing the flexibility and accuracy of data processing, improving query efficiency, and enhancing data retrieval performance.
[0061] In some embodiments, the preset vector database includes a vector corresponding to at least one preset field data; based on the preset vector database and the vector corresponding to the query data, a target vector sequence is determined, including: performing similarity calculation processing on the vector corresponding to the query data and the vector corresponding to each preset field data, respectively, to obtain a similarity value corresponding to each preset field data; based on a preset similarity value sorting condition, the similarity values corresponding to each preset field data are sorted to obtain a target vector sequence.
[0062] Specifically, in the preset vector database, each preset field data is associated with a vector representation, and the similarity calculation can be performed between the vector corresponding to the query data and the vector corresponding to each preset field data in the database. The similarity calculation method can be cosine similarity or Euclidean distance, etc., which is not limited here. The similarity value corresponding to each preset field data is obtained, and the preset similarity value sorting condition can be used. The preset similarity value sorting condition includes but is not limited to from high to low or from low to high, and then the similarity value corresponding to each preset field data can be sorted, and the sorted result is the target vector sequence.
[0063] Among them, the vector corresponding to the preset field data can be a vector representation calculated and stored for each preset field data in the preset field database, and the vector corresponding to the preset field data can be used to capture the semantic characteristics of the field data; the similarity value corresponding to the preset field data can be a numerical value calculated by comparing the similarity between the vector corresponding to the query data and the vector corresponding to each preset field data, and the similarity value corresponding to the preset field data can be used to characterize the degree of similarity between the corresponding preset field data and the query data; the preset similarity value sorting condition can be a pre-set rule or standard for sorting the similarity value, and the preset similarity value sorting condition can be used to determine the arrangement order of the target vector sequence.
[0064] For example, in the product search system of an e-commerce platform, the name, description, category, etc. of the product can be used as preset field data, and the vector corresponding to the preset field data can be pre-calculated and stored in a preset vector database. When the user enters the query data and converts it into a vector, similarity calculation and sorting can be performed to obtain a list of products that best matches the user's query intent.
[0065] According to the technical solution provided by the embodiment of the present disclosure, by calculating the similarity between the vector corresponding to the query data and the vector corresponding to each preset field data in the database, the similarity value corresponding to each preset field data is obtained, and the similarity value corresponding to each preset field data can be sorted according to the preset similarity value sorting condition. The sorted result is the target vector sequence. In this way, richer semantic information can be captured by calculating the similarity between vectors rather than simple text matching, thereby enhancing the accuracy of data retrieval and improving query efficiency.
[0066] In some embodiments, a target vector corresponding to the query data is processed for text generation through a large language model to obtain target data corresponding to the query data, including: decoding the target vector corresponding to the query data through a large language model to obtain text elements corresponding to the target vector; and semantically concatenating the text elements corresponding to the target vector to obtain the target data corresponding to the query data.
[0067] Specifically, the target vector corresponding to the query data can be decoded through a large language model, and the numerical information in the target vector can be converted into text elements corresponding to the target vector. The text elements include but are not limited to words, phrases, or sentence fragments. Then, semantic splicing processing can be performed based on the semantic relationship and context information between the text elements corresponding to the target vector to obtain the target data corresponding to the query data.
[0068] Among them, the text element corresponding to the target vector can be a text constituent unit obtained after decoding the target vector corresponding to the query data through a large language model. The text element corresponding to the target vector can be in the form of a word, a phrase, or a sentence fragment, etc., which is not limited here. The text element corresponding to the target vector can be obtained by parsing and mapping the numerical information in the target vector corresponding to the query data. The text element corresponding to the target vector can be used to represent the core content and intent of the query data.
[0069] For example, in an intelligent customer service system, when a user enters a vague query question, the query question can be converted into a vector representation, and the most relevant target vector can be found. The target vector can then be decoded through a large language model to obtain text elements related to the query question. The text elements can be pieced together into a complete answer text based on the semantic relationship between the text elements and returned to the user as the target data corresponding to the query data.
[0070] According to the technical solution provided by the embodiment of the present disclosure, the target vector corresponding to the query data is decoded by a large language model, and the numerical information in the target vector is converted into a text element corresponding to the target vector. Then, semantic splicing processing can be performed according to the semantic relationship and context information between the text elements corresponding to the target vector to obtain the target data corresponding to the query data. In this way, the large language model can generate diversified text outputs based on vector information, enhance the flexibility and creativity of text generation, improve the quality of text generation, and ensure the coherence and accuracy of the generated text through semantic splicing processing.
[0071] In some embodiments, target data corresponding to the query data is sent to a terminal device for displaying the target data on a current graphical user interface of the terminal device, including: format encoding the target data corresponding to the query data to obtain transmittable data corresponding to the target data; encapsulating the transmittable data corresponding to the target data to obtain a data packet corresponding to the target data; and sending the data packet corresponding to the target data to the terminal device.
[0072] Specifically, the target data corresponding to the query data can be format-encoded and converted into a format suitable for network transmission, including but not limited to JSON or XML, to obtain the transmittable data corresponding to the target data, and then the transmittable data corresponding to the target data can be encapsulated. The encapsulation can include adding header information to form a complete data packet, wherein the header information includes but is not limited to the target address or protocol type, etc. The data packet corresponding to the target data can be sent to the terminal device via the network so that it can be displayed on the current graphical user interface of the terminal device.
[0073] Among them, the transmittable data corresponding to the target data can be a data form that has been processed through format encoding and complies with network transmission standards. The transmittable data corresponding to the target data can contain all the information of the target data and be in a format that is easy to transmit and parse; the data packet corresponding to the target data can be a data unit obtained by encapsulating the transmittable data corresponding to the target data. The data packet corresponding to the target data can contain necessary information such as target data, target address, and / or protocol type. The data packet corresponding to the target data can be the basic unit of transmission of the target data in the network, and the data packet can be transmitted through a network protocol.
[0074] For example, in the product search function of an e-commerce platform, the target data corresponding to the query data can be formatted and encoded and converted into transmittable data in JSON format. The transmittable data can be encapsulated into a data packet and sent to the user's mobile phone via the Internet. The product information can then be displayed in the form of a list or grid on the current graphical user interface of the user's mobile phone for the user to browse and select.
[0075] According to the technical solution provided by the embodiments of the present disclosure, the target data corresponding to the query data is format-encoded and converted into a format suitable for network transmission to obtain the transmittable data corresponding to the target data. The transmittable data corresponding to the target data can then be encapsulated to form a complete data packet. The data packet corresponding to the target data can be sent to the terminal device via the network so that it can be displayed on the current graphical user interface of the terminal device, thereby enhancing the reliability and security of data transmission. The integrity and accuracy of the data during transmission are guaranteed through format coding and encapsulation, thereby improving the efficiency of data transmission. The standardized data format and encapsulation method reduce the redundancy of data transmission and speed up the transmission speed.
[0076] In some embodiments, the transmittable data corresponding to the target data is encapsulated to obtain a data packet corresponding to the target data, including: encoding the transmittable data corresponding to the target data to obtain encoded data corresponding to the target data; formatting the encoded data corresponding to the target data to obtain formatted data corresponding to the target data; and performing protocol encapsulation on the formatted data corresponding to the target data to obtain a data packet corresponding to the target data.
[0077] Specifically, the transmittable data corresponding to the target data can be encoded, including but not limited to encoding through Base64 or Uniform Resource Locator (URL) encoding, to obtain the encoded data corresponding to the target data, and the encoded data can be formatted, and the encoded data corresponding to the target data can be organized into a structure that complies with the protocol or standard, such as the JSON or XML format in the HyperText Transfer Protocol (HTTP) request body, which is not limited here, to obtain the formatted data corresponding to the target data, and the formatted data can be encapsulated by protocol, including adding necessary protocol header information, verification, and / or encryption processing, to obtain a data packet corresponding to the target data.
[0078] Among them, the encoded data corresponding to the target data can be data after further encoding processing on the transmittable form of the target data. The encoded data corresponding to the target data can be used for purposes such as secure transmission, avoiding interference from special characters, or reducing data volume, which is not limited here; the formatted data corresponding to the target data can be the result of the process of organizing the encoded data corresponding to the target data into structured data according to a protocol or standard. The formatting process can make the encoded data corresponding to the target data have a clear hierarchical structure and type information.
[0079] For example, in an online payment system, after the user completes the payment operation, the payment platform needs to send a payment result notification to the merchant system. The target data can be the payment result information, so that the payment platform can convert the payment result information into transmittable data in JSON format, and can perform Base64 encoding on the transmittable data to obtain encoded data, which can then be formatted according to the requirements of the HTTP protocol to form an HTTP request message containing a request header, a request body and other parts, i.e., formatted data. The HTTP request message can be encapsulated by protocol, including adding the target merchant's IP address, port number and other information to form a complete data packet, which is sent to the merchant system via the Internet.
[0080] According to the technical solution provided by the embodiments of the present disclosure, by encoding the transmittable data corresponding to the target data, the encoded data corresponding to the target data is obtained, the encoded data can be formatted, the encoded data corresponding to the target data can be organized into a structure that complies with the protocol or standard to obtain formatted data corresponding to the target data, the formatted data can be protocol encapsulated to obtain a data packet corresponding to the target data, thereby enhancing the security of data transmission, protecting the confidentiality and integrity of the data through encoding and encryption, and improving the compatibility of data transmission, formatting and protocol encapsulation ensure that the data can be correctly parsed by the recipient according to predetermined rules, thereby improving the efficiency of data transmission, and reasonable encoding and formatting reduce the redundancy of data transmission, while protocol encapsulation optimizes the data transmission process and resource utilization.
[0081] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.
[0082] The following are embodiments of the device disclosed herein, which can be used to execute the method embodiments disclosed herein. For details not disclosed in the device embodiments disclosed herein, please refer to the method embodiments disclosed herein.
[0083] Figure 3 Schematic diagram of a data query device provided by an embodiment of the present disclosure. Figure 3 As shown, the data query device includes:
[0084] Acquisition module 301, used to acquire query data;
[0085] The first processing module 302 is used to perform vectorization processing on the query data to obtain a vector corresponding to the query data;
[0086] A first determination module 303, configured to determine a target vector sequence according to a preset vector database and vectors corresponding to query data;
[0087] A second determination module 304 is used to determine a target vector corresponding to the query data from the target vector sequence;
[0088] The second processing module 305 is used to perform text generation processing on the target vector corresponding to the query data through the large language model to obtain the target data corresponding to the query data;
[0089] The third processing module 306 is used to send the target data corresponding to the query data to the terminal device, so that the target data is displayed on the current graphical user interface of the terminal device.
[0090] According to the technical solution provided by the embodiment of the present disclosure, by acquiring query data and performing vectorization processing on the query data, high-dimensional data is mapped into a low-dimensional vector space to obtain a vector corresponding to the query data, a vector set whose vector similarity meets the requirements with respect to the query data is queried from a preset vector database, and the target vector sequence is obtained after the vector set is sorted, and then the corresponding vectors whose similarity meets the preset conditions are screened to obtain the target vector corresponding to the query data, and the target vector corresponding to the query data is input into a large language model for text generation to obtain the target data corresponding to the query data, and then the target data corresponding to the query data can be sent to a terminal device of the user, and the target data can be displayed on the current graphical user interface of the terminal device, thereby improving the accuracy of data query, improving query efficiency, expanding the flexibility of data query, and improving the practicality and readability of data query results.
[0091] In some embodiments, the above-mentioned data query device is also used to obtain a preset field data set, the preset field data set includes at least one preset field data; vectorize each preset field data to obtain a vector corresponding to each preset field data; and store the vector corresponding to each preset field data in a preset vector database.
[0092] In some embodiments, the first processing module 302 is specifically used to perform format conversion processing on the query data to obtain target format data; input the target format data into the vector conversion model to encode the target format data to obtain a high-dimensional mapping vector corresponding to the query data; extract the high-dimensional mapping vector corresponding to the query data to obtain a vector corresponding to the query data.
[0093] In some embodiments, the first determination module 303 is specifically used to perform similarity calculation processing on the vector corresponding to the query data and the vector corresponding to each preset field data, respectively, to obtain the similarity value corresponding to each preset field data; based on the preset similarity value sorting condition, the similarity value corresponding to each preset field data is sorted to obtain the target vector sequence.
[0094] In some embodiments, the second processing module 305 is specifically used to decode the target vector corresponding to the query data through the large language model to obtain the text element corresponding to the target vector; and perform semantic splicing processing on the text element corresponding to the target vector to obtain the target data corresponding to the query data.
[0095] In some embodiments, the third processing module 306 is specifically used to perform format encoding processing on the target data corresponding to the query data to obtain transmittable data corresponding to the target data; encapsulate the transmittable data corresponding to the target data to obtain a data packet corresponding to the target data; and send the data packet corresponding to the target data to the terminal device.
[0096] In some embodiments, encapsulation processing is performed on the transmittable data corresponding to the target data to obtain a data packet corresponding to the target data, which is specifically used for encoding processing on the transmittable data corresponding to the target data to obtain encoded data corresponding to the target data; formatting processing is performed on the encoded data corresponding to the target data to obtain formatted data corresponding to the target data; and protocol encapsulation processing is performed on the formatted data corresponding to the target data to obtain a data packet corresponding to the target data.
[0097] It should be understood that the size of the serial numbers of the steps in the above embodiments 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 embodiments of the present disclosure.
[0098] Figure 4 Schematic diagram of an electronic device 4 provided in an embodiment of the present disclosure. Figure 4 As shown, the electronic device 4 of this embodiment includes: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program 403, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 401 executes the computer program 403, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0099] The electronic device 4 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 4 may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that Figure 4 The electronic device 4 is merely an example and does not limit the electronic device 4 , and may include more or less components than those shown in the figure, or different components.
[0100] The processor 401 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.
[0101] The memory 402 may be an internal storage unit of the electronic device 4, for example, a hard disk or memory of the electronic device 4. The memory 402 may also be an external storage device of the electronic device 4, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 4. The memory 402 may also include both an internal storage unit and an external storage device of the electronic device 4. The memory 402 is used to store computer programs and other programs and data required by the electronic device.
[0102] Those skilled in the art 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. In actual applications, the above-mentioned functions can be assigned to 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 embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0103] If the integrated module / 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 readable storage medium (e.g., a computer-readable storage medium). Based on this understanding, the present disclosure implements all or part of the processes in the above-mentioned embodiment method, and can also 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. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0104] The above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be included in the protection scope of the present disclosure.
Claims
1. A data query method, characterized in that: include: Get query data; Performing vectorization processing on the query data to obtain a vector corresponding to the query data; Determine a target vector sequence according to a preset vector database and vectors corresponding to the query data; Determine a target vector corresponding to the query data from the target vector sequence; Performing text generation processing on the target vector corresponding to the query data through a large language model to obtain target data corresponding to the query data; The target data corresponding to the query data is sent to the terminal device, so that the target data is displayed on the current graphical user interface of the terminal device.
2. The data query method according to claim 1, characterized in that: Before obtaining the query data, the method further includes: Acquire a preset field data set, wherein the preset field data set includes at least one preset field data; Performing vectorization processing on each of the preset field data to obtain a vector corresponding to each of the preset field data; The vectors corresponding to the preset field data are stored in the preset vector database.
3. The data query method according to claim 1, characterized in that: The vectorizing the query data to obtain a vector corresponding to the query data includes: Performing format conversion processing on the query data to obtain target format data; Inputting the target format data into a vector conversion model to encode the target format data to obtain a high-dimensional mapping vector corresponding to the query data; The high-dimensional mapping vector corresponding to the query data is extracted to obtain the vector corresponding to the query data.
4. The data query method according to claim 1, characterized in that: The preset vector database includes at least one vector corresponding to preset field data; The step of determining a target vector sequence according to a preset vector database and vectors corresponding to the query data includes: Performing similarity calculation processing on the vector corresponding to the query data and the vector corresponding to each of the preset field data respectively, to obtain a similarity value corresponding to each of the preset field data; Based on the preset similarity value sorting condition, the similarity values corresponding to the preset field data are sorted to obtain the target vector sequence.
5. The data query method according to claim 1, characterized in that: The step of performing text generation processing on the target vector corresponding to the query data by using the large language model to obtain the target data corresponding to the query data includes: Decoding the target vector corresponding to the query data by using the large language model to obtain a text element corresponding to the target vector; The text elements corresponding to the target vector are semantically concatenated to obtain target data corresponding to the query data.
6. The data query method according to claim 1, characterized in that: The sending of the target data corresponding to the query data to the terminal device for displaying the target data on the current graphical user interface of the terminal device includes: Performing format encoding processing on the target data corresponding to the query data to obtain transmittable data corresponding to the target data; Encapsulating the transmittable data corresponding to the target data to obtain a data packet corresponding to the target data; Sending a data packet corresponding to the target data to the terminal device.
7. The data query method according to claim 6, characterized in that: The encapsulating and processing the transmittable data corresponding to the target data to obtain a data packet corresponding to the target data includes: Encoding the transmittable data corresponding to the target data to obtain encoded data corresponding to the target data; Formatting the coded data corresponding to the target data to obtain formatted data corresponding to the target data; The formatted data corresponding to the target data is subjected to protocol encapsulation processing to obtain a data packet corresponding to the target data.
8. A data query device, characterized in that: include: Acquisition module, used to obtain query data; A first processing module, configured to perform vectorization processing on the query data to obtain a vector corresponding to the query data; A first determination module, configured to determine a target vector sequence according to a preset vector database and vectors corresponding to the query data; A second determination module, configured to determine a target vector corresponding to the query data from the target vector sequence; A second processing module is used to perform text generation processing on the target vector corresponding to the query data through a large language model to obtain target data corresponding to the query data; The third processing module is used to send the target data corresponding to the query data to the terminal device, so that the target data is displayed on the current graphical user interface of the terminal device.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.