Data processing method and electronic equipment
By extracting the entity and relational keywords of the input data in the artificial intelligence model and using the data repository to obtain relevant data as prompt words, the problem of inappropriate information generation in the prior art is solved, and a faster and more accurate user interaction experience is achieved.
Patent Information
- Application Number
- CN202510422457.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-08-12
AI Technical Summary
When answering questions, existing artificial intelligence models rely on public web information, resulting in inadequate information generation and poor user interaction experience.
By extracting entities and relational keywords in the input data, using the data store to obtain relevant target storage data as prompt words, and provide them to the target model for processing, and generate feedback results.
It improves the computing efficiency of the target model, reduces the calculation amount and power consumption, and improves the user interaction experience and feedback speed.
Smart Images

Figure CN120470101A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to, but is not limited to, the field of computer technology, and in particular to a data processing method and electronic device. Background Art
[0002] Currently, artificial intelligence (AI) models (such as large language models (LLMs)) are trained by their developers by searching for information on the public web. When answering user questions, AI models search for relevant information from publicly available web pages and then organize the language (e.g., summarize or generalize) to answer the question. Summary of the Invention
[0003] In view of this, the present application at least provides a data processing method and an electronic device.
[0004] The technical solution of this application is achieved as follows:
[0005] In one aspect, the present application provides a data processing method, the method comprising:
[0006] Obtaining input data; providing the input data as content of a prompt word to a target model;
[0007] Converting the input data into at least one keyword; the at least one keyword includes at least one of the following: an entity keyword representing an objective thing, a relationship keyword representing an association relationship between different entities;
[0008] Obtaining target storage data matching the at least one keyword based on a data repository;
[0009] Providing the input data and the target storage data as content information of the prompt word to the target model;
[0010] Outputting a feedback result for the input data; the feedback result is a result generated by the target model based on the content information.
[0011] In another aspect, the present application provides a data processing method, comprising:
[0012] In response to a user's designated operation on the first stored data, updating the data repository with the first stored data;
[0013] Determining a third keyword corresponding to the first stored data; the third keyword includes at least one of the following: a third entity representing an objective thing, and a third relationship representing an association relationship between things;
[0014] The third keyword is used to update a relationship repository, where the relationship repository is used to store a plurality of entities and the relationships between the plurality of entities.
[0015] On the other hand, the present application provides an electronic device, comprising a first display and a first processor; wherein,
[0016] A first display, configured to display a first running interface of an output target application;
[0017] The first processor is configured to execute a target application. When the first processor executes the target application, the first processor is configured to:
[0018] Obtaining input data; providing the input data as content of a prompt word to a target model;
[0019] Converting the input data into at least one keyword; the at least one keyword includes at least one of the following: an entity keyword representing an objective thing, a relationship keyword representing an association relationship between different entities;
[0020] Obtaining target storage data matching the at least one keyword based on a data repository;
[0021] Providing the input data and the target storage data as content information of the prompt word to the target model;
[0022] Outputting a feedback result for the input data; the feedback result is a result generated by the target model based on the content information.
[0023] On the other hand, the present application provides an electronic device, including a second display and a second processor; wherein,
[0024] The second display is used to display the running interface of the output target application;
[0025] The second processor is configured to execute the target application. When the second processor executes the target application, the second processor:
[0026] In response to a user's designated operation on the first stored data, updating the data repository with the first stored data;
[0027] Determining a third keyword corresponding to the first stored data; the third keyword includes at least one of the following: a third entity representing an objective thing, and a third relationship representing an association relationship between things;
[0028] The third keyword is used to update a relationship repository, where the relationship repository is used to store a plurality of entities and the relationships between the plurality of entities.
[0029] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and do not limit the technical solutions of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The drawings herein are incorporated into and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and, together with the specification, are used to illustrate the technical solutions of the present application.
[0031] Figure 1 A schematic diagram of the implementation flow of a data processing method provided in this application;
[0032] Figure 2 A schematic diagram of a relational database provided in an embodiment of the present application;
[0033] Figure 3 A schematic diagram of a graph database provided in an embodiment of the present application;
[0034] Figure 4 A schematic diagram of the implementation process of the embodiment provided in this application;
[0035] Figure 5 A schematic diagram of using the modules provided by this application to perform data processing;
[0036] Figure 6 A flowchart of determining keywords using the keyword determination module provided by this application;
[0037] Figure 7 A schematic diagram of the implementation flow of a data processing method provided in this application;
[0038] Figure 8 A schematic diagram of a system menu provided in an embodiment of the present application;
[0039] Figure 9 Schematic diagram of the implementation process of the embodiment provided in this application;
[0040] Figure 10 A schematic diagram of the hardware entity of an electronic device provided in this application;
[0041] Figure 11 A schematic diagram of the hardware entity of an electronic device provided in this application. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions of this application are further elaborated in detail below with reference to the accompanying drawings and embodiments. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0043] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0044] The terms "first / second / third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It is understandable that "first / second / third" can be interchanged with a specific order or sequence where permitted so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing this application only and are not intended to limit this application.
[0046] The target model disclosed in this application is a machine learning model that can recognize natural language and / or other inputs (such as audio, video, images, tables, etc.) input into the target model, and perform comprehensive language processing tasks such as analyzing semantics and answering questions, thereby generating output related to the input and / or responding to the input.
[0047] The target model disclosed in this application learns the characteristics and patterns of natural language by training on large amounts of diverse data, thereby enabling it to understand and generate natural language. It typically has hundreds of millions to hundreds of billions of model parameters (model parameters are variables that control the behavior of the target model) and is able to capture the complex relationships and patterns in natural language.
[0048] The target model disclosed in this application can be a generative model or a generative language model (GLMs). For example, it can include large language models (LLMs), GPT (Generative Pre-trained Transformer) or deepsick, etc. The model involved in the embodiments of this application can be a general large model or an expert large model obtained by fine-tuning based on demand, and the embodiments of this application do not limit this.
[0049] The method provided in this application is an agent that obtains user input data and, following the processing logic of this application, generates prompts for a target model. It also obtains feedback from the target model and outputs it to the user. The processing logic disclosed in this application enables the prompts provided to the target model to include memory information related to the input data, enabling the target model to output feedback based on the input data and memory information. An agent is an application (or program) of artificial intelligence technology that can be implemented based on the aforementioned target model (such as a large language model). The agent's behavior is determined by the target model within the agent based on its current state and external input. The target model provides a basis for decision-making through learning and training with large amounts of data. The agent can also call upon tools, plug-ins, and knowledge bases to provide reasoning, decision-making, and execution capabilities. Simply put, the target model provides decision support, and the agent continuously optimizes the target model by generating prompts to guide the large model's reasoning. The agent disclosed in this application has the ability to work using the target model. The target model is part of the agent, meaning that the agent includes the target model, or it can be relatively independent of the target model but the agent can call upon (or access) the target model.
[0050] The data processing method provided in this application includes the following steps:
[0051] Obtaining input data, where the input data is a portion of the content of the prompt word and is provided to the target model;
[0052] Converting the input data into at least one keyword, wherein the at least one keyword includes at least one of the following: an entity keyword representing an objective thing, and a relationship keyword representing an association relationship between different entities;
[0053] Obtaining target storage data matching the at least one keyword based on a data repository;
[0054] Provide the input data and the target storage data as the content information of the prompt word to the target model;
[0055] Output the feedback result for the input data, which is the result generated by the target model based on the content information.
[0056] Thus, the at least one keyword of the present application is an entity keyword and / or a relationship keyword determined from the user input data, and the at least one keyword is used to express the key information in the user input information and can be used to expand the semantic scope of the user input data; in addition, the at least one keyword of the present application is used to determine the target storage data that matches the at least one keyword in a data repository, and the target storage data and the user input data are used as the content information of the prompt word (prompt word template) to provide the target model for processing, so that the target model uses the target storage data in the process of generating the reply information that matches the input data. The target storage data belongs to memory data, and the data repository is a collection of memory data. Therefore, the present application can quickly determine the memory data related to the input data based on the user input data and use the memory data in the process of generating the reply information that matches the input data by the target model, thereby reducing the computational load of the target application or intelligent agent, reducing the power consumption of the electronic device that implements the target application or intelligent agent, and making the target model more targeted when generating the reply information that matches the input data; in addition, since the computational load of the target application or intelligent agent is reduced, the speed of responding and outputting the reply information is faster, improving the user's interactive experience with the target application or intelligent agent.
[0057] The data processing method provided in this application can be executed by an electronic device, which can be various types of terminals such as laptops, tablet computers, desktop computers, set-top boxes, mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices). In addition, the electronic device can also be implemented as a server. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. In some embodiments, the data processing method provided in this application can be implemented as a target application in an electronic device, such as Lenovo Xiaotian, Lenovo AI Now, etc. In some embodiments, the method provided in this application is an agent. The target model disclosed in this application can be arranged on the terminal side as described above, or on the cloud side (i.e., the server side). Regardless of whether the target model is arranged on the terminal side or the cloud side, the data processing method provided in this application has the ability to work using the target model when it is the above-mentioned target application or the above-mentioned agent. In some embodiments, the target model is a part of the target application or the agent. In some embodiments, the target application or the agent is relatively independent of the target model and can call (or access) the target model.
[0058] Below, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the drawings in the present application.
[0059] Figure 1 A schematic diagram of the implementation flow of a data processing method provided in this application, such as Figure 1 As shown, the method includes the following steps S11 to S15:
[0060] Step S11, obtaining input data; the input data is provided to the target model as the content of the prompt word.
[0061] Here, the input data may be any type of data input during the interaction between the user and the electronic device.
[0062] In some embodiments, the input data may be data input by a user in an operating interface provided by a target application; wherein the target application is an application program that executes the data processing method provided in this application.
[0063] In some implementations, the input data may also be data automatically identified by the target application during user interaction with other applications outside the target application and that needs to be processed using the target model. For example, if a user enters "What kind of country is Austria?" in the WeChat application, the target application may use this input information as user input data and generate corresponding feedback results.
[0064] In some implementations, the input data may be text data, image data, audio data, video data, etc. input by a user.
[0065] The input data is used as the content of the prompt word to provide to the target model, so that the target model can perform model reasoning based on the input data and obtain corresponding feedback results.
[0066] Step S12, converting the input data into at least one keyword; the at least one keyword includes at least one of the following: an entity keyword representing an objective thing, and a relationship keyword representing an association relationship between different entities.
[0067] At least one keyword is key information determined from the input data, and the at least one keyword includes at least one of an entity keyword and a relationship keyword. Among them, an entity keyword is a keyword that characterizes objectively existing things. For example, names of people, places, names of animals and plants, time, currency, product names, work names, language names, etc. Relationship keywords are keywords that characterize the association relationship between different entities. For example, it is used to characterize the management relationship, execution relationship, etc. between different entities. In some embodiments, at least one keyword may also include attribute information related to the user input data (for example, age information, height information, fragrance information, etc.), information expressing emotions (for example, surprise, exclamation, happiness, etc.), etc.
[0068] In some embodiments, any suitable keyword extraction algorithm may be used to determine at least one keyword from the input data. In some embodiments, the keyword extraction algorithm may be a Rapid Automatic Keyword Extraction (RAKE) algorithm, a Term Frequency (TF) and Inverse Document Frequency (IDF) algorithm, a graph-based ranking algorithm (TextRank algorithm), or the like.
[0069] Step S13: obtaining target storage data matching the at least one keyword based on the data storage library.
[0070] Here, the data repository is a database determined based on at least one historical interaction data of the user, in which a plurality of stored data are stored. In some embodiments, the data repository can be implemented as a personal knowledge base (PKB) of the user. In some embodiments, the data repository is a database based on retrieval-augmented generation (RAG) technology, which can record and store memory data. The data repository is a collection of memory data, wherein the retrieval-augmented generation (RAG) technology is used to support the database system of the retrieval process, which can be used to store, index and efficiently retrieve structured or unstructured data related to user queries, so as to assist the target model of this application in generating more accurate feedback information (i.e., response results).
[0071] The target stored data refers to the stored data related to at least one keyword among the multiple stored data stored in the data repository. In some embodiments, the target stored data refers to the stored data containing the at least one keyword. In some embodiments, the target stored data refers to the stored data with the highest semantic similarity to the at least one keyword, or a plurality of stored data with a high semantic similarity to the at least one keyword. In some embodiments, the target stored data refers to the stored data whose summary information has the highest semantic similarity to the at least one keyword, or a plurality of stored data whose summary information has a high semantic similarity to the at least one keyword.
[0072] Step S14: providing the input data and the target stored data as content information of the prompt word to the target model.
[0073] In some embodiments, the content information of the prompt word can be generated based on the input data and the target stored data in any suitable manner. For example, the input data and the target stored data can be concatenated to obtain the content information. For another example, if the target stored data is large in size, the target stored data can be summarized to obtain corresponding summary information, which can then be concatenated with the input data to obtain the content information.
[0074] In some embodiments, the target stored data has corresponding attribute information. In some embodiments, the attribute information of the target stored data may include storage time information, storage location information, source information, etc. corresponding to the target stored data. In some embodiments, the attribute information of the target stored data may be stored as metadata for the target stored data. In some embodiments, content information of the prompt word may be generated based on the input data, the target stored data, and the attribute information of the target stored data. This allows the target model to perform model reasoning based on more dimensional information, making the model reasoning results more consistent with user expectations and improving the user experience of the target application or intelligent agent.
[0075] Step S15: outputting a feedback result corresponding to the user input data; the feedback result is a result generated by the target model based on the content information.
[0076] Here, the target model performs model reasoning based on the content information of the prompt word, generates feedback results, and feeds the feedback results back to the target application executing the method provided by this application; the target application outputs the feedback results in any suitable manner. In some embodiments, the target application can output the feedback results in the form of text, images, audio, or video.
[0077] In this way, at least one keyword of the present application is an entity keyword or / and a relationship keyword determined from the user input data, and the at least one keyword is used to express the key information in the user input information and expand the semantic scope of the user input data; in addition, at least one keyword of the present application is used to determine the target storage data that matches the at least one keyword in a data repository. Because the data repository is implemented based on the retrieval enhancement generation (RAG) technology, it itself supports retrieval. Therefore, in this embodiment, the keyword can be directly compared with the stored data in the data repository for features to determine the target storage data corresponding to the keyword. The target storage data, together with the user's input data, is provided to the target model as the content information of the prompt word (prompt word template) for processing, so that the target model uses the target storage data in the process of generating the reply information that matches the input data. The target storage data belongs to memory data, and the data repository is a collection of memory data. It can be seen that the present application can quickly determine the memory data related to the input data based on the user's input data, and use the memory data in the process of the target model generating response information matching the input data, thereby reducing the computational complexity of the target application or intelligent agent and reducing the power consumption of the electronic device implementing the target application or intelligent agent. At the same time, it makes the target model more targeted when generating response information matching the input data. In other words, it enables the target model to perform model reasoning based on information of more dimensions, so that the model reasoning results are more in line with user expectations, and enhances the user's interactive experience with the target application or intelligent agent.
[0078] In some embodiments, the conversion of the input data into at least one keyword, that is, the above step S11, can be implemented as the following steps S111 to S113:
[0079] Step S111 : determining a first keyword corresponding to the user input data; the first keyword includes at least one of a first entity and a first relationship.
[0080] Here, the first keyword is the key information extracted from the user input data.
[0081] In some embodiments, the first keyword may be obtained by performing keyword extraction on the input data. In some embodiments, keyword extraction may be performed on the input data using any suitable keyword extraction algorithm. In some embodiments, the keyword extraction algorithm may be a RAKE algorithm, a TF-IDF algorithm, a TextRank algorithm, or the like.
[0082] In some embodiments, the first keyword may be a keyword obtained by performing keyword extraction on expanded data of the input data. In some embodiments, first, based on the semantic information of the input data, the input data is expanded using a large language model to obtain expanded data; then, keyword extraction is performed on the expanded data using any appropriate keyword extraction algorithm to obtain the first keyword.
[0083] Here, the first keyword includes at least one of a first entity and a first relationship. In some embodiments, the first keyword may include at least one first entity, at least one first relationship, or at least one first relationship between multiple first entities.
[0084] Step S112: Based on the first keyword, determine a second keyword from a relationship repository; the relationship repository is used to store multiple entity keywords and multiple relationship keywords; the second keyword includes at least one of a second entity and a second relationship.
[0085] Here, the relationship repository is a database used to store multiple entities and the association relationships between multiple entities.
[0086] In some embodiments, the multiple entities and the relationships between them are entities and relationships related to the user. For example, the multiple entities and the relationships between them in the relationship repository are determined based on at least one historical interaction data related to the user, or based on memory data, or are manually updated by the user to the relationship repository.
[0087] In some embodiments, the association relationships between multiple entities can be strong association relationships between multiple entities determined based on an existing personal knowledge base or existing memory data (i.e., data stored in the data repository of this application). For example, the entity "Sun Wukong" determined by the data repository has an association relationship "belongs to" with the entity "Journey to the West."
[0088] In some implementations, the relationship repository may be implemented as a relational database or a graph database. When the relationship repository is implemented as a relational database, entities and relationships are stored in a table format. Figure 2 : A schematic diagram of a relational database is listed in , where each row of the table represents a record and each column represents an attribute, where: the first row 21 is the attribute name of each column, where the attribute name of the first column 24 is "person", the attribute name of the second column 25 is "event", the attribute name of the third column 26 is "time", and the attribute name of the fourth column 27 is "place"; the second row 22 is a record, including the entity "John" and "July 1st", "Barbecue Restaurant", and the relationship is barbecue; the third row 23 is another record, including the entity "John" and "August 1st", "National Concert Hall", and the relationship is attending a concert.
[0089] When the relational database is implemented as a graph database, nodes (or vertices) and edges are used to represent entities and relationships. Figure 2 When storing information in a relational database, it can be stored as Figure 3 The relationship between nodes and edges is shown. Nodes are represented by circles and store entity information. Edges between nodes represent the relationship between them. For example, nodes 31 and 32 represent the entity "John" and the entity "Barbecue Restaurant," respectively. The edge between them represents the relationship between them, namely, "Barbecue."
[0090] In some embodiments, a keyword in the relationship repository whose semantic similarity with the first keyword is greater than a specified threshold can be used as the second keyword. For example, when the first keyword includes the first entity "John", the relationship repository can be searched based on the semantic information of "John", and the expressions of "John" in English, French, German, Japanese and other languages can be used as the second keyword (i.e., the second entity). The nickname expression of "John" can also be used as the second keyword, and so on. For another example, when the first keyword includes the first relationship "dining", the relationship repository can be searched based on the semantic information of "dining", and the relationship with the semantic similarity with "dining" can be determined to be greater than the specified threshold, and the entity corresponding to the relationship can be used as the second keyword (i.e., the second entity).
[0091] Step S113: Use the first keyword and the second keyword as the at least one keyword.
[0092] Here, the first keyword and the second keyword are used as at least one keyword corresponding to the input data, and the stored data corresponding to the input data is determined based on the at least one keyword.
[0093] In the above-mentioned embodiment of the present application, the relationship repository is constructed based on the user's personal knowledge base or the memory in the data repository, so the multiple entities in the relationship repository and the association relationships between the multiple entities are all related to the user, and based on the multiple entities and multiple relationships, historical data related to the user (for example, personal knowledge base data or storage data in the data repository) can also be determined. In this way, by determining the second keyword related to the first keyword in the current input data from the relationship repository, the first keyword can be expanded with entity keywords and / or relationship keywords, that is, keyword-level expansion is achieved; and because the relationship repository is related to the user's historical data (for example, storage data in the data repository), more target storage data related to the input data can be determined from the data repository based on the expanded second keyword, thereby providing more and more comprehensive reference information to the target model, so that the reasoning results of the target model are more in line with user expectations and enhance the user's interactive experience with the target application or intelligent body.
[0094] In some implementations, determining the first keyword corresponding to the input data, i.e., the above step S111, can be implemented as the following steps S1111 to S1112:
[0095] Step S1111: Generate extended input data related to the input data based on the input data.
[0096] Here, the input data is expanded to obtain extended input data corresponding to the input data, wherein the extended input data may be one or more pieces of data.
[0097] In some implementations, input data may be input into the LLM, so that the LLM is used to expand or rewrite the input data to obtain expanded input data.
[0098] In some embodiments, the input data can be input into a transformer model, a sequence-to-sequence (Seq2Seq) model, a deep reinforcement learning model, or a conditional text rewriting model, etc., to rewrite the input data to obtain extended input data.
[0099] In some embodiments, the expanded input data is generated based on the overall semantics of the input data, i.e., the semantics of the expanded input data are similar to those of the original input data. For example, by modifying the sentence structure, keyword expression, etc. of the input data, expanded input data with similar semantics to the original input data is generated.
[0100] In some embodiments, the expanded input data is generated based on at least one key information in the input data. Specifically, a keyword in the input data is first determined, and then the keyword is expanded to generate the corresponding expanded input data. In this way, the expanded input data may have different or identical overall semantics to the input data, but may be relevant to at least one keyword in the input data.
[0101] Step S1112: Determine the first keyword based on the input data and the extended input data.
[0102] After obtaining the expanded input data, keywords are extracted from the input data and the expanded input data, and the extracted keywords are used as the first keywords. In some embodiments, any suitable keyword extraction algorithm can be used to extract the first keyword from the input data and the expanded input data. In some embodiments, the keyword extraction algorithm can be a RAKE algorithm, a TF-IDF algorithm, or a TextRank algorithm.
[0103] In the above-mentioned embodiment of the present application, the input data is expanded or rewritten to obtain extended input data, and the extended input data is similar to the overall semantics of the input data, or is related to at least one keyword of the input data, thereby realizing the expansion of input information from the perspective of overall semantics or at least one keyword, that is, realizing information expansion at the input data level. In this way, based on the input data and the corresponding extended input data, more keywords can be determined, thereby expanding the type or range of the target storage data input to the target model, allowing the target model to reason about the input data from more dimensions or angles, thereby making the reasoning results of the target model more comprehensive and accurate, and improving the user's interactive experience with the target application or intelligent entity.
[0104] In some implementations, determining the second keyword from the relationship repository based on the first keyword, that is, the above step S112, can be implemented as at least one of the following steps S1121 to S1122:
[0105] Step S1121: Determine a second keyword associated with the first entity from the relationship repository.
[0106] Here, when the first keyword includes the first entity, based on multiple entities and association relationships between multiple entities stored in the relationship repository, an entity or relationship associated with the first entity is determined, and the entity or relationship is used as the second keyword.
[0107] In some embodiments, first, the semantic information of the first entity is determined; then, based on the semantic information of the first entity, a relationship repository is retrieved, and it is determined whether there is an entity in the relationship repository whose semantic similarity with the first entity is greater than a specified threshold; if so, an entity or relationship having an associated relationship with the entity is determined as a third entity.
[0108] by Figure 2 Taking the relational database shown in the figure as an example, when the first entity is "John", first, the semantic information of "John" is determined; then, based on the semantic information of "John", the search Figure 2 The relational database shown in FIG5 is used to determine the two records containing “John”; finally, the entities “barbecue restaurant”, “July 1st”, “national concert hall” and “August 1st” in the two determined records and the relationship “barbecue” are used as the second keyword.
[0109] Step S1122: Determine a second keyword associated with the first relationship from the relationship repository.
[0110] Here, in the case where the first keyword includes the first relationship, based on the association relationships between multiple entities stored in the relationship repository, the entity or relationship corresponding to the first relationship is determined, and the entity or relationship is used as the second keyword.
[0111] In some embodiments, first, the semantic information of the first relationship is determined; then, based on the semantic information of the first relationship, a relationship repository is retrieved, and it is determined whether there is a relationship in the relationship repository whose semantic similarity with the first relationship is greater than a specified threshold; if so, the entity or relationship corresponding to the relationship is determined as the second keyword.
[0112] by Figure 2 Taking the relational database shown in the figure as an example, when the first relation is "barbecue", first, the semantic information of "barbecue" is determined; then, based on the semantic information of "barbecue", the search Figure 2 The relational database shown in FIG. 1 is used to determine a record containing the relationship, that is, the record corresponding to the second row 22; finally, the entities "John", "barbecue restaurant" and "July 1" in the second row 22 are determined as the second keywords.
[0113] In the above embodiment provided by the present application, the first entity is used to determine the second keyword from the relationship repository, which realizes the expansion of the keywords in the input data from the entity perspective, thereby obtaining entities and / or relationships that have an associated relationship with the entity in the user's current input data; at the same time, the first relationship is used to determine the second keyword from the relationship repository, which realizes the expansion of the keywords in the input data from the relationship perspective, thereby obtaining entities and / or relationships that have an associated relationship with the relationship in the user's current input data. In this way, the user input data is expanded from the keyword level. Since the multiple entities and multiple relationships in the relationship repository are related to the stored data in the user's personal knowledge base or data repository (i.e., the user's memory), by expanding the entity keywords and / or relationship keywords in the input data, the user's stored data related to the expanded keyword (i.e., the second keyword) can be obtained, and the stored data can be used as the content information of the prompt word input to the target model, providing more reference information for the reasoning process of the target model, making the reasoning result of the target model more comprehensive and accurate, and improving the user's interactive experience with the target application or intelligent body.
[0114] In some embodiments, the data processing method provided in the present application further includes: determining the user's preference data based on the relationship repository; and providing the input data, the target storage data, and the preference data as content information of the prompt word to the target model.
[0115] Here, the relationship repository is analyzed to determine the preference data of at least one entity in the relationship repository. Figure 3 In the illustrated relational repository, the entity "John," represented by node 31, went to a barbecue restaurant for a barbecue on July 1st. If other barbecue events related to "John" exist in the relational repository, "barbecue" can be used as John's preference data. In some embodiments, statistical methods can be used to determine the preference data of at least one entity in the relational repository. These statistical algorithms can include statistical methods based on graph patterns, statistical methods based on database query languages, and deep learning methods based on graph neural networks. In some embodiments, a specified model can be used to analyze at least one entity in the relational repository to determine the preference data of the at least one entity. The specified model can be an LLM, RAG model, a multimodal model, or the like.
[0116] In this way, after determining the user's preference data, the preference data is provided to the target model as the content information of the prompt word for processing, so that the target model can use the preference data to perform more targeted processing on the current input data in the process of generating response information that matches the input data, so that the model's reasoning results are more in line with user preferences, thereby improving the user's interaction experience with the target application or intelligent entity.
[0117] In some embodiments, the data processing method provided in this application further includes: determining the user's pending items based on the relationship repository; and generating reminder information corresponding to the pending items using the item application corresponding to the pending items.
[0118] Here, based on the time-related information in the relationship repository, at least one pending item of the user is determined and corresponding reminder information is generated. Figure 3 If the date "August 1st" corresponding to node 33 shown in the figure has not yet arrived, a pending item "John will attend a concert at the National Concert Hall on August 1st" can be determined based on the entities "John," "National Concert Hall," and the relationship "Concert" associated with node 33. This pending item can then be sent to a calendar app or an alarm clock app to generate a corresponding reminder message. For another example, if the pending item includes information about a related person, it can be sent to an email app to generate a reminder email and send it to the related person.
[0119] In some embodiments, obtaining the target stored data matching the at least one keyword based on the data repository, that is, the above step S13, can be implemented as the following steps S131 to S132:
[0120] Step S1131: performing feature comparison on the at least one keyword and a plurality of vectors stored in a vector repository to obtain at least one target vector corresponding to the at least one keyword; the vector repository is used to store vector information related to the stored data in the data repository;
[0121] Step S1132: Determine the storage data corresponding to the at least one target vector from the data storage library, and use the storage data corresponding to the at least one target vector as the target storage data.
[0122] Here, the vector repository stores multiple vectors, each of which is determined based on the data stored in the data repository. In some embodiments, the vectors stored in the vector repository may be vector representations of keywords obtained by performing keyword extraction on the corresponding data stored in the data repository. In some embodiments, the vectors stored in the vector repository may be vector representations of summaries obtained by performing summarization processing on the corresponding data stored in the data repository.
[0123] In some embodiments, each stored data in the data repository has corresponding index information, so as to use the index information to uniquely identify the corresponding stored data in the data repository. In some embodiments, the primary key information of each stored data in the data repository can be used as the corresponding index information.
[0124] In this way, the index information can be used to establish a correspondence between the vectors in the vector database and the corresponding stored data in the data repository. In some embodiments, the index information corresponding to the stored data can be used as foreign key information, attribute information, or any other type of information of the corresponding vector in the vector repository.
[0125] In some implementations, each vector in the vector storage corresponds to an index information.
[0126] In some embodiments, each vector in the vector repository may correspond to one or more index information. That is, if the vector is associated with only one piece of stored data in the data repository, the vector corresponds to only one piece of index information; if the vector is associated with multiple pieces of stored data in the data repository, the vector corresponds to multiple pieces of index information.
[0127] In this way, after determining at least one keyword corresponding to the input data, vectorization processing is performed on the at least one keyword to obtain corresponding vector data; feature comparison is performed on the vector data of the at least one keyword with multiple vectors in the vector repository to obtain at least one target vector matching the at least one keyword; based on the index information corresponding to each target vector, the storage data corresponding to the at least one target vector can be determined from the data repository, and the storage data corresponding to the at least one target vector is used as the target storage data matching the at least one keyword.
[0128] The target vector may be a vector having the highest similarity to the corresponding keyword, or a vector having a similarity to the corresponding keyword greater than a similarity threshold. In some embodiments, the similarity between the vector data corresponding to the at least one keyword and the multiple vectors stored in the vector repository may be determined by calculating Euclidean distance, cosine similarity, or Manhattan distance.
[0129] In the above-mentioned embodiments provided by the present application, multiple vectors in the vector repository are associated with multiple stored data in the data repository, and the data volume of the corresponding vectors is significantly reduced relative to the stored data. Therefore, compared to the data computation required to search the data repository using at least one keyword in the input data and determine at least one target stored data, the present application significantly reduces the data computation required to determine at least one target vector corresponding to at least one keyword in the input data by searching the vector repository, and then using the association between the vector repository and the data repository to determine at least one target stored data. This can improve data processing speed and reduce power consumption of electronic devices performing the methods provided by the present application. In addition, when the vectors in the vector repository are keywords in the corresponding stored data, the vectors can accurately represent key information or key semantic information of the corresponding stored data. Thus, first determining at least one target vector corresponding to at least one keyword in the input data and then using the target vector to determine the target stored data can improve the relevance of the determined target stored data with the input data, thereby enabling the target model to perform model reasoning based on historical data that is more relevant to or more valuable to the input data, making the model reasoning results more accurate and more personalized for the user, thereby enhancing the user's interactive experience with the target application or intelligent agent.
[0130] As can be seen from the above, in the above embodiments provided by the present application, while using the data repository to store the user's historical memory (i.e., storing data), the vectors corresponding to the keywords in the stored data are stored in the vector repository, and the entity keywords in the stored data and the relationship keywords representing the relationship between the entity keywords are stored in the relationship repository, thereby establishing an association relationship between the relationship repository, the vector repository, and the data repository. In this way, as described above, since the amount of data of the vectors stored in the vector repository is greatly reduced relative to the amount of data of the corresponding stored data, when the data repository is retrieved through the vectors in the vector repository, the retrieval speed of the data repository can be further improved, and the required data calculation amount can be greatly reduced, thereby reducing the power consumption of the electronic device that executes the target application or intelligent body, and increasing the feedback speed of the user input data, thereby improving the user's interactive experience.
[0131] In addition, in some embodiments, the data repository may be implemented as a database not based on RAG technology, for example, as a non-relational database (Not Only SQL, NoSQL), a time series database, etc. In this way, by associating the index information that uniquely identifies the stored data in the data repository with the vector corresponding to the stored data in the vector repository, at least one target stored data corresponding to the at least one target vector can be quickly determined in the data repository based on the index information corresponding to the at least one target vector, thereby still achieving a fast retrieval effect of the data repository, thereby improving the feedback speed of user input data and enhancing the user's interactive experience.
[0132] Next, combine Figure 4 , an embodiment of the data processing method provided by this application is described. Figure 4 As shown, this embodiment includes the following steps S401 to S408:
[0133] Step S401, receiving user input data; then, executing step S402;
[0134] Here, the user input data is "What kind of wine do I like?".
[0135] Step S402, rewrite the user input data to obtain multiple extended input data; then, execute step S403;
[0136] Here, "What kind of wine do I like?" is rewritten to obtain multiple extended input data, such as "What kind of wine have I drunk?", "What are the types of wine?", "What are the tastes of wine?", etc.
[0137] Step S403: performing keyword extraction on the user input data and the multiple extended input data to obtain multiple keywords; then, executing step S404;
[0138] Here, after performing keyword extraction, keywords such as "I", "wine", "type", "taste", "like", and "drank" can be obtained.
[0139] Step S404: Based on the extracted keywords, multiple extended keywords related to the extracted keywords are determined from the relationship repository; thereafter, step S405 is executed;
[0140] Here, the entity keywords and relationship keywords in the keywords are used to extract multiple related entities or relationships from the relationship repository related to the user. For example, for the keyword "wine" extracted above, "ice wine", "red wine", etc. can be expanded from the relationship repository.
[0141] Step S405 , calculating vector data of the extracted keywords and the plurality of extended keywords, and using the vector data to search a vector repository to determine at least one target vector; thereafter, executing step S406 ;
[0142] Here, the vector repository is searched based on the calculated vector data, and at least one target vector having the greatest semantic similarity with the extracted keyword and the plurality of expanded keywords may be determined.
[0143] Step S406, searching the data repository using the foreign key information of the at least one target vector in the vector repository to determine the target storage data corresponding to the at least one target vector; thereafter, executing step S407;
[0144] Here, the index information is implemented as foreign key information in the vector repository and primary key information in the data repository.
[0145] Step S407: Generate prompt information based on the user input data, the target storage data, and the metadata of the target storage data, and input the prompt information into the LLM; then, execute step S408;
[0146] Here, the target model is implemented as an LLM.
[0147] Step S408: receiving feedback results for the prompt information from the LLM, and displaying and outputting the feedback results to the user.
[0148] Here, the feedback result is the inference result obtained by LLM performing model inference based on the prompt information.
[0149] In some embodiments, the data processing method provided in the present application can be implemented using an input and output module, a keyword determination module, a vectorization module, a data retrieval module, a prompt word generation module and an inference module; wherein the input and output module is used to receive input data and output feedback results corresponding to the input data; the keyword determination module is used to determine at least one keyword corresponding to the input data; the vectorization module is used to perform vectorization processing on the determined keyword to obtain vector data; the data retrieval module is used to retrieve the vector repository and the data repository based on the vector data to obtain the target storage data; the prompt word generation module is used to generate content information of the prompt word input to the target model based on the input data and the target storage data; the inference module is used to input the content information of the prompt word into the target model and obtain feedback results from the target model.
[0150] Next, combine Figure 5 , describes the process of performing data processing using the module provided in this application.
[0151] The user inputs question information through the input / output module 510; for example, the query information is "help me find the relevant information of the person who killed Shiji Niangniang".
[0152] The input-output module 510 inputs the user input question into the keyword determination module 520;
[0153] The keyword determination module 520 determines the keywords corresponding to the user input question and inputs the determined keywords into the vectorization module 530;
[0154] Here, the process of the keyword determination module 520 determining the keyword corresponding to the user input question can be as follows: Figure 6 As shown. Figure 6 As shown, the process includes the following steps S601 to S604:
[0155] Step S601, expanding the user input question to obtain at least one expanded question; then, executing step S602;
[0156] For example, here you can get extended questions such as "What are the hobbies of Shiji Niangniang?", "Basic information about killing Shiji Niangniang?", etc.
[0157] Step S602: perform keyword extraction on the user input question and the expanded question to obtain extracted keywords; then, execute step S603;
[0158] For example, here we can extract keywords such as "Shiji Niangniang", "hobby", "information", "kill", etc.
[0159] Step S603: Based on the extracted keywords, query the relationship repository related to the user to determine the expanded keywords; then, execute step S604;
[0160] For example, in a user-related relationship repository, there is a relationship "kill" between the entity "Nezha" and the entity "Shiji Niangniang", then "Nezha" can be used as an extended keyword.
[0161] Step S604: The extracted keywords and the expanded keywords corresponding to the user input question and the expanded question are both used as keywords corresponding to the user input question.
[0162] The vectorization module 530 performs vectorization processing on the received at least one keyword to obtain vector data, and sends the vector data to the data retrieval module 540;
[0163] The data retrieval module 540 retrieves the vector repository 541 and the data repository 544 based on the vector data;
[0164] Here, vector repository 541 stores multiple pieces of vectorized keyword data, such as vector data 542 and index 543 corresponding to vector data 542. Data repository 544 stores multiple pieces of stored data, each piece of stored data having a corresponding index, text, and metadata, such as index 543 and its corresponding text 545 and metadata 546.
[0165] The data retrieval module 540 uses the vector data corresponding to the keyword to retrieve the vector repository 541 and determine the corresponding target vector data, for example, the vector data 542; then, it retrieves the data repository 544 based on the index 543 corresponding to the vector data 542 to obtain the text 545 and metadata 546 corresponding to the index 543.
[0166] The data retrieval module 540 sends the retrieved text and metadata to the prompt word generation module 550;
[0167] The prompt word generation module 550 generates content information of the prompt word based on the user input question, the expanded question, and the text and metadata sent by the data retrieval module 540; then, the prompt word generation module 550 sends the content information to the reasoning module 560;
[0168] The reasoning module 560 sends the content information of the received prompt word to the LLM, so that the LLM performs model reasoning based on the content information to obtain a corresponding reasoning result; the reasoning module 560 receives the reasoning result from the LLM and sends the reasoning result to the input and output module 510;
[0169] The input-output module 510 outputs the received inference result to the user as a feedback result of the user input question.
[0170] It can be seen from the above embodiments that the data processing method provided by the present application, on the one hand, first expands the input data to obtain extended input data, and then expands the keywords corresponding to the user input data and the extended input data to obtain extended keywords, thereby realizing the expansion of the input data level and the keyword level, and enriching the semantic information of the input data; on the other hand, since the information stored in the relational repository, the vector repository, and the data repository is user-related information, therefore, by utilizing the relational repository, the vector repository, and the data repository to expand the input data, the target model can obtain more historical reference information related to the input data, that is, the target model can obtain long-term memory related to the user input data, thereby making the reasoning results of the target model more in line with user expectations and improving the user's interactive experience.
[0171] On the other hand, the present application also provides a data processing method. Figure 7 As shown, the data processing method includes the following steps S71 to S73:
[0172] Step S71 : in response to a user's designated operation on first stored data, updating a data storage library using the first stored data.
[0173] Here, the data repository is a database determined based on at least one historical interaction data of a user, wherein a plurality of stored data is stored. In some embodiments, the data repository can be implemented as a user's personal knowledge base. In some embodiments, the data repository is a database based on RAG technology, which can record and store memory data. The data repository is a collection of memory data, wherein the database system of the retrieval process is supported by the retrieval enhancement generation (RAG) technology, which can be used to store, index, and efficiently retrieve structured or unstructured data related to the user query.
[0174] The first stored data may be any type of data. In some implementations, the first stored data may be text type data, image type data, audio type data, video type data, or the like.
[0175] The user's designated operation on the first storage data refers to the user's designated operation of adding the first storage data to the data repository. Here, the user can designate the first storage data in any appropriate manner.
[0176] In some embodiments, the target application for executing the method of the present application may provide a system menu so that the user can use the system menu to specify the first storage data. The system menu may be in any form, such as a floating window, an icon, etc. Figure 8 As shown, the system menu is implemented as a floating window 810, and the text "Remember this content" is used in the floating window 810 to prompt the user to click the floating window to add the corresponding picture 820 to the data storage library.
[0177] In some embodiments, the system menu is displayed in response to the user executing a shortcut key, a specified gesture, a voice, or any other specified control action. For example, the system menu is displayed in response to the user performing a two-finger pinch gesture on the display screen of the electronic device.
[0178] In some embodiments, first, a user's specified operation on the first data is obtained; then, when the first data is non-text data such as image data, audio data, or video data, features are extracted from the first data and corresponding text data is generated; thereafter, according to a preset number of characters, the text data corresponding to the first data is divided into multiple text segments, and each text segment is used as a first storage data; wherein, each first storage data is a text segment with complete semantic information.
[0179] In some implementations, the first data may be system notification information, short messages, screenshots, screen identification information, etc. of the electronic device.
[0180] In some embodiments, when segmenting the text corresponding to the first data, the segmentation can be performed according to any text length, and each text segment after switching is kept to have complete semantics. In some embodiments, the first data can be segmented according to the paragraph structure of the text corresponding to the first data. In some embodiments, the first data can be segmented in combination with the paragraph structure of the text corresponding to the first data and the preset text length. For example, in the case where the first data is a document, first, the document is segmented into multiple segments according to the paragraphs of the document; then, for paragraphs whose text length is greater than the preset text length, the paragraph is further segmented according to the preset text length, thereby obtaining multiple first stored data.
[0181] In some implementations, the preset text length may be determined based on the amount of data that can be processed at one time by the target model corresponding to the method provided in this application.
[0182] In some embodiments, before storing the first stored data in the data repository, a text vectorization model is used to perform vectorization processing on the first stored data to obtain corresponding vector data.
[0183] In some embodiments, before storing the first storage data in the data repository, encryption processing is performed on the first storage data, and the encrypted first storage data is stored in the data repository.
[0184] After determining the first stored data, the first stored data is stored in a data repository, and corresponding index information is generated for each first stored data. The index information is unique identification information of the first stored data in the data repository. In some embodiments, primary key information of the first stored data in the data repository can be used as the index information.
[0185] Step S72: determining a third keyword corresponding to the first stored data; the third keyword includes at least one of the following: a third entity representing an objective thing, and a third relationship representing an association relationship between things.
[0186] Here, the third keyword refers to at least one of an entity keyword (ie, the third entity) in the first stored data and a relationship keyword (ie, the third relationship) representing an association relationship between multiple entities.
[0187] In some implementations, the third keyword may be determined from the first stored data using at least one of an entity extraction algorithm and a relationship extraction algorithm.
[0188] In some implementations, the third keyword in the first stored data may be determined using an LLM or a natural language understanding (NLU) model.
[0189] Step S73: using the third keyword, updating a relationship repository; wherein the relationship repository is used to store a plurality of entities and the relationships between the plurality of entities.
[0190] Here, the relational repository is a database for storing multiple entities and the relationships between multiple entities. In some embodiments, the relational repository can be a relational database or a graph database. When the relational repository is a relational database, an example of a relational repository is as follows: Figure 2 When the relational repository is a graph database, an example of the relational repository is as follows; Figure 3 shown.
[0191] After determining the third keyword in the first stored data, the third keyword is stored in the relationship repository to update the relationship repository. Thus, if the relationship repository is a relational database, the third keyword is stored as a record in the relational database. If the relationship repository is a graph database, the entity in the third keyword is updated in the graph database as a node in the graph database, and the relationship in the third keyword is updated in the graph database as an edge between related entity nodes.
[0192] In the above-mentioned embodiment provided by the present application, by updating the first storage data specified by the user to the data repository, the first storage data can be stored as the user's long-term memory, so as to be used as reference information and to assist in processing user-related issues. In the case where the data repository is a database implemented based on RAG technology, the RAG database itself supports storage, indexing and retrieval, so storing the first storage data in the RAG database can improve the update speed and retrieval speed of the first storage data. The relational repository is a database for storing entities and relationships, and its storage method for data (i.e., entities and relationships) can improve the retrieval speed of the association relationships between entities. For example, in the case of implementing the relational repository as a relational database or a graph database, since the graph database and the relational database can intuitively express objective things and association relationships, it is easy to understand and analyze, and the graph database and the relational database have efficient query performance and indexing mechanism, so that when the graph database and the relational database are used to expand keywords, the data processing speed can be improved. Therefore, the embodiment provided in the present application can realize the memory of entities or relationships related to the user by updating the relationship repository, so that when processing user input data, the relationship repository can be used to expand the entities and / or relationships in the user input data, thereby expanding the semantic scope of the user input data; at the same time, using the relationship repository to store the entity and / or relationship information in the first storage data can speed up the retrieval speed of the entity and / or relationship information, thereby improving the data processing speed.
[0193] In some embodiments, the method further includes the following steps S74 to S75:
[0194] Step S74: Determine a fourth keyword from the first stored data; the fourth keyword at least includes the third keyword.
[0195] Here, the fourth keyword refers to key information determined from the first stored data, and the fourth keyword includes at least the third keyword, that is, the fourth keyword includes at least one of the third entity and the third relationship in the first stored data.
[0196] In some embodiments, a keyword extraction algorithm may be used to extract the fourth keyword from the first stored data. In some embodiments, the keyword extraction algorithm may be a RAKE algorithm, a TF-IDF algorithm, or a TextRank algorithm. For example, when using the RAKE algorithm to perform keyword extraction, the Jieba word segmentation tool may be used to first perform word segmentation on the first stored data, and then the RAKE algorithm may be used to perform keyword extraction on the segmented first stored data.
[0197] In some implementations, the fourth keyword may be determined from the first stored data using a large model (eg, LLM).
[0198] Step S75: Update the vector storage library using the vector corresponding to the fourth keyword.
[0199] The vector repository is used to store keyword information corresponding to the stored data in the data repository.
[0200] In some embodiments, the vector corresponding to the fourth keyword is updated to the vector repository, and the index information of the first stored data corresponding to the fourth keyword is stored in the vector repository in association with the fourth keyword. In some embodiments, the index information of the first stored data is stored in the vector repository as foreign key information of the fourth keyword.
[0201] In some embodiments, the fourth keyword is stored in the vector repository. If a vector identical to the fourth keyword already exists in the vector repository, the index information of the first stored data is associated with the stored vector. For example, the index information is stored as the foreign key information of the stored vector. This prevents duplicate storage of the same vector in the vector repository. In some embodiments, if semantically identical vectors are from different stored data in the vector repository, each vector is stored separately to store metadata or attribute data corresponding to each vector.
[0202] In the embodiment provided by the present application, by storing the vectors corresponding to the keywords in the storage data specified by the user and the storage data respectively in the data repository and the vector repository, and associating the storage data and the corresponding vector through index information, on the one hand, since the data volume of the vector is smaller than the data volume of the corresponding storage data, the vector in the vector repository can be used to quickly locate the corresponding storage data in the data repository, thereby improving the retrieval efficiency of the data repository; on the other hand, since the vector is a vectorized representation of the keyword in the corresponding storage data, when processing the input data, the storage data with a high correlation with the input data can be determined by searching the vector repository and the data repository, and the storage data can be input into the target model as historical reference information, so that the target model can be based on the correlation with the user input data. The model reasoning is performed based on the user memory data, so that the model reasoning result is more accurate and in line with the user's original intention; on the other hand, since the fourth keyword includes at least the third keyword, the entities and relationships stored in the relationship repository are also stored in the vector repository. In this way, after determining the keywords related to the keywords in the user input data (i.e., related entities and / or relationships) based on the relationship repository, the related keywords can be used to further search the vector repository and the data repository, thereby obtaining more stored data related to the user input data, and inputting the stored data as the content information of the prompt word into the target model, so that the target model can obtain reasoning information from more angles or more dimensions related to the user input data, thereby improving the accuracy and comprehensiveness of the model reasoning results and enhancing the user's interactive experience.
[0203] As can be seen from the above, in the above embodiments provided by the present application, by storing the first storage data in the data repository, storing the vectors corresponding to the keywords in the first storage data in the vector repository, and storing the entity keywords in the first storage data and the relationship keywords representing the relationship between the entity keywords in the relationship repository, an association relationship is established between the relationship repository, the vector repository, and the data repository. In this way, since the data volume of the vectors stored in the vector repository is significantly reduced relative to the data volume of the corresponding storage data, when searching the data repository through the vectors in the vector repository, the retrieval speed of the data repository can be further improved, and the required data calculation amount can be greatly reduced, thereby reducing the power consumption of the electronic device executing the target application or intelligent body, and increasing the feedback speed of the user input data, thereby improving the user's interactive experience.
[0204] In addition, in some embodiments, the data repository may be implemented as a database not based on RAG technology, for example, a NoSQL database, a time series database, etc. In this way, by associating the index information that uniquely identifies the stored data in the data repository with the vector corresponding to the stored data in the vector repository, the corresponding stored data can be quickly determined in the data repository based on the index information corresponding to the vector in the vector repository, thereby still achieving the effect of fast retrieval of the data repository.
[0205] In some embodiments, the data processing method provided in this application further includes the following steps S76 to S78:
[0206] Step S76: Determine at least one fifth vector from the vector repository; the fifth vector represents a vector whose corresponding number of index information is greater than a first threshold, or a second number of vectors in the vector repository having the largest number of corresponding index information; the index information represents unique identification information of the stored data corresponding to the fifth vector in the data repository.
[0207] Here, index information uniquely identifies the corresponding stored data in the data repository. Therefore, the number of index information corresponding to a vector in the vector repository is the same as the number of stored data corresponding to that vector. For example, for the vector "red wine", if there is one stored data containing "red wine", the number of index information corresponding to the vector "red wine" is 1; if there are two stored data containing "red wine", the number of index information corresponding to the vector "red wine" is 2.
[0208] In some embodiments, when determining the fifth vector, first, the number of index information corresponding to each vector in the vector repository can be counted according to a preset statistical period or according to a time point specified by the user; then, the vector whose number of corresponding index information is greater than a first threshold, or the second largest number of vectors with the largest number of corresponding index information in the vector repository, is used as the fifth vector.
[0209] Step S77: for each fifth vector, determine at least one sixth keyword from the second stored data corresponding to the fifth vector; the vector corresponding to the sixth keyword is different from the fifth vector.
[0210] Here, keyword extraction is performed again on the second stored data corresponding to the fifth vector.
[0211] When the first strategy is used to extract the keywords corresponding to the fifth vector from the second stored data and the second strategy is used to extract the sixth keyword, in some embodiments, the second strategy and the first strategy use different keyword extraction algorithms, so that the keywords extracted from the second stored data by the second strategy are different from those of the first strategy; or, the second strategy and the first strategy use the same keyword extraction algorithm, but the number of keyword extractions configured in the second strategy is greater than the number of keyword extractions configured in the first strategy; in some embodiments, the type of keywords extracted based on the second strategy is different from the type of keywords extracted based on the first strategy, for example, the type of keywords extracted based on the second strategy is relationship keywords, while the type of keywords extracted based on the first strategy is entity keywords.
[0212] Step S78: Update the vector storage library using the vector word corresponding to the sixth keyword.
[0213] Here, after re-determining the sixth keyword from the second stored data, vectorization processing is performed on the sixth keyword to obtain a vector corresponding to the sixth keyword; then, the vector corresponding to the sixth keyword is updated to the vector repository. In some embodiments, the index information of the second stored data is associated and stored with the vector corresponding to the sixth keyword in the vector repository. In some embodiments, the index information of the second stored data is stored as foreign key information of the vector corresponding to the sixth keyword.
[0214] The larger the number of index information associated with a vector, the more items of stored data related to the vector in the data repository, that is, the vector is involved and stored by users at different times, in different places, or in different ways. Therefore, the larger the number of index information associated with a vector, the more important the stored data corresponding to the vector is. In the above embodiment of the present application, a fifth vector corresponding to a larger number of index information is determined from the vector repository, and a sixth keyword is re-determined from the second stored data corresponding to the fifth vector, so that more keywords in the second stored data are stored in the vector repository. In this way, when the vector repository and the data repository are searched in sequence based on the keywords in the input data, the probability of the second stored data being retrieved is greater.
[0215] Next, combine Figure 9 , an embodiment of the data processing method provided by this application is described. Figure 9 As shown, this embodiment includes the following steps S901 to S905:
[0216] Step S901, obtaining text information specified by the user; then, executing steps S902 and S903;
[0217] Here, the text information specified by the user is:
[0218] On May 1, 2024, a user browsed the following information on Xiaohongshu: Ice wine, due to its unique combination of varieties, regions, and craftsmanship, boasts a myriad of styles and textures. Produced only in a few regions like Germany, Canada, Austria, China, and Japan, its astonishingly rich aroma is unmatched by any other wine. Its harmonious balance of sweet and sour, lingering fragrance, and long-lasting finish are unforgettable. As the aristocrat of wines, ice wine's inherent nobility and elegance determine its extraordinary status and taste. Because of its stringent requirements for origin and raw materials, and its limited production, ice wine has been called a gift from God.
[0219] Step S902, updating the text information specified by the user to the data storage; thereafter, executing step S905;
[0220] Here, vectorization processing is performed on the text information specified by the user to obtain corresponding vector data; encryption processing is performed on the vector data, and the encrypted vector data is updated to the data repository.
[0221] Step S903: extract at least one keyword from the text information specified by the user; then, execute step S904;
[0222] Here, the RAKE algorithm is used to extract keywords from the specified text information. For example, the keywords extracted are "amazing", "rich and fragrant", "rare production", "ice wine", "wine", "ice wine", "user", and "Little Red Book".
[0223] Step S904: perform vectorization processing on each keyword to obtain corresponding vector data; then, execute step S905;
[0224] Step S905 : updating the vector data corresponding to each keyword to the vector storage library, and using the primary key information of the text information in the data storage library to update the foreign key information of each vector data in the vector storage library.
[0225] This application also provides an electronic device. Figure 10 As shown, the electronic device 1000 includes a first display 1010 and a first processor 1020; wherein,
[0226] The first display 1010 is used to display a first running interface of the output target application;
[0227] The first processor 1020 is configured to execute the target application. When the first processor 1020 executes the target application, the first processor 1020 is configured to:
[0228] Obtaining input data; providing the input data as content of a prompt word to a target model;
[0229] Converting the input data into at least one keyword; the at least one keyword includes at least one of the following: an entity keyword representing an objective thing, a relationship keyword representing an association relationship between different entities;
[0230] Obtaining target storage data matching the at least one keyword based on a data repository;
[0231] Providing the input data and the target storage data as content information of the prompt word to the target model;
[0232] Outputting a feedback result for the input data; the feedback result is a result generated by the target model based on the content information.
[0233] Here, the target application can be an AI intelligent assistant or intelligent agent, such as Lenovo Xiaotian, Lenovo Baiying, Lenovo AINow, etc.
[0234] In some implementations, the first processor 1020 is configured to:
[0235] Determining a first keyword corresponding to the user input data; the first keyword includes at least one of a first entity and a first relationship;
[0236] Based on the first keyword, determining a second keyword from a relationship repository; the relationship repository is used to store a plurality of entity keywords and a plurality of relationship keywords; the second keyword includes at least one of a second entity and a second relationship;
[0237] The first keyword and the second keyword are used as the at least one keyword.
[0238] In some implementations, the first processor 1020 is configured to:
[0239] generating, based on the input data, extended input data related to the input data;
[0240] The first keyword is determined based on the input data and the expanded input data.
[0241] In some implementations, the first processor 1020 is configured to:
[0242] determining, from the relationship repository, a second keyword having an association relationship with the first entity;
[0243] A second keyword associated with the first relationship is determined from the relationship repository.
[0244] In some implementations, the first processor 1020 is configured to:
[0245] performing feature comparison on the at least one keyword with a plurality of vectors stored in a vector repository to obtain at least one target vector corresponding to the at least one keyword; the vector repository is used to store vector information related to the stored data in the data repository;
[0246] Determine storage data corresponding to the at least one target vector from the data storage repository, and use the storage data corresponding to the at least one target vector as the target storage data.
[0247] On the other hand, the present application also provides an electronic device. Figure 11 As shown, the electronic device 1100 includes a second display 1110 and a second processor 1120; wherein,
[0248] The second display 1110 is used to display the running interface of the output target application;
[0249] The second processor 1120 is configured to execute the target application. When the second processor 1120 executes the target application, the second processor 1120 is configured to:
[0250] In response to a user's designated operation on the first stored data, updating the data repository with the first stored data;
[0251] Determining a third keyword corresponding to the first stored data; the third keyword includes at least one of the following: a third entity representing an objective thing, and a third relationship representing an association relationship between things;
[0252] Using the third keyword, a relationship repository is updated; the relationship repository is used to store a plurality of entities and the relationships between the plurality of entities.
[0253] Here, the target application can be an AI intelligent assistant or intelligent agent, such as Lenovo Xiaotian, Lenovo Baiying, Lenovo AINow, etc.
[0254] In some implementations, the second processor 1120 is configured to:
[0255] Determining a fourth keyword from the first stored data; the fourth keyword at least includes the third keyword;
[0256] The vector storage library is updated using the vector corresponding to the fourth keyword.
[0257] In some implementations, the second processor 1120 is configured to:
[0258] Determining at least one fifth vector from the vector repository; the fifth vector represents a vector whose corresponding number of index information is greater than a first threshold, or a second number of vectors with the largest number of corresponding index information in the vector repository; the index information represents unique identification information of the stored data corresponding to the fifth vector in the data repository;
[0259] For each fifth vector, determining at least one sixth keyword from the second stored data corresponding to the fifth vector; the vector corresponding to the sixth keyword is different from the fifth vector;
[0260] The vector storage library is updated using the vector corresponding to the sixth keyword.
[0261] It should be noted that the description of the above device embodiment is similar to the description of the above method embodiment and has similar beneficial effects as the method embodiment. In some embodiments, the functions or components included in the device provided in the embodiments of the present application can be used to perform the methods described in the above method embodiments. For technical details not disclosed in the device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
[0262] If the technical solution of this application involves personal information, the product that applies the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing personal information. If the technical solution of this application involves sensitive personal information, the product that applies the technical solution of this application has obtained the individual's separate consent before processing sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, a clear and prominent sign is set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that they agree to the collection of their personal information; or on the personal information processing device, when the personal information processing rules are notified by obvious signs / information, the individual's authorization is obtained through pop-up information or by asking the individual to upload their personal information; among which, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
[0263] It should be noted that, in the embodiment of the present application, if the above-mentioned data processing method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific hardware, software or firmware, or any combination of hardware, software and firmware.
[0264] An embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, some or all of the steps in the above method are implemented.
[0265] The present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements some or all of the steps in the above method. The computer-readable storage medium may be transient or non-transient.
[0266] An embodiment of the present application provides a computer program, including computer-readable code. When the computer-readable code is run in a computer device, a processor in the computer device executes some or all of the steps for implementing the above method.
[0267] An embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, implements some or all of the steps in the above method. The computer program product can be implemented specifically by hardware, software, or a combination thereof. In some embodiments, the computer program product is embodied as a computer storage medium. In other embodiments, the computer program product is embodied as a software product, such as a software development kit (SDK), etc.
[0268] It should be noted that the descriptions of the various embodiments above tend to emphasize the differences between the various embodiments, and their similarities or similarities can be referenced to each other. The descriptions of the above device, storage medium, computer program, and computer program product embodiments are similar to the descriptions of the above method embodiments and have similar beneficial effects as the method embodiments. For technical details not disclosed in the embodiments of the device, storage medium, computer program, and computer program product of this application, please refer to the description of the method embodiments of this application for understanding.
[0269] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned steps / processes does not mean the order of execution, and the execution order of each step / 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 application. The above-mentioned serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments.
[0270] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0271] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0272] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed across multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0273] In addition, all functional units in the embodiments of the present application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the above-mentioned integrated units can be implemented in the form of hardware or in the form of hardware plus software functional units.
[0274] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, and other media that can store program codes.
[0275] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0276] The above is only an implementation method of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed in this application, which should be covered by the scope of protection of the present application.
Claims
1. A data processing method, comprising: Get input data; The input data is used as the content of the prompt word to provide to the target model; converting the input data into at least one keyword; The at least one keyword includes at least one of the following: an entity keyword representing an objective thing, a relationship keyword representing an association relationship between different entities; Obtaining target storage data matching the at least one keyword based on a data repository; Providing the input data and the target storage data as content information of the prompt word to the target model; Outputting a feedback result for the input data; The feedback result is a result generated by the target model based on the content information.
2. The method according to claim 1, wherein converting the input data into at least one keyword comprises: Determining a first keyword corresponding to the user input data; the first keyword includes at least one of a first entity and a first relationship; Based on the first keyword, determining a second keyword from a relationship repository; the relationship repository is used to store a plurality of entity keywords and a plurality of relationship keywords; the second keyword includes at least one of a second entity and a second relationship; The first keyword and the second keyword are used as the at least one keyword.
3. The method according to claim 2, wherein determining the first keyword corresponding to the input data comprises: generating, based on the input data, extended input data related to the input data; The first keyword is determined based on the input data and the expanded input data.
4. The method according to claim 2, wherein determining the second keyword from the relationship repository based on the first keyword comprises at least one of the following: determining, from the relationship repository, a second keyword having an association relationship with the first entity; A second keyword associated with the first relationship is determined from the relationship repository.
5. The method according to any one of claims 2 to 4, wherein obtaining target storage data matching the at least one keyword based on a data repository comprises: Performing feature comparison on the at least one keyword with a plurality of vectors stored in a vector repository to obtain at least one target vector corresponding to the at least one keyword; The vector repository is used to store vector information related to the stored data in the data repository; Determine storage data corresponding to the at least one target vector from the data storage repository, and use the storage data corresponding to the at least one target vector as the target storage data.
6. A data processing method comprising: In response to a user's designated operation on the first stored data, updating the data repository with the first stored data; Determining a third keyword corresponding to the first stored data; the third keyword includes at least one of the following: a third entity representing an objective thing, and a third relationship representing an association relationship between things; Using the third keyword, updating the relationship repository; The relationship repository is used to store a plurality of entities and the relationships between the plurality of entities.
7. The method according to claim 6, further comprising: Determining a fourth keyword from the first stored data; the fourth keyword at least includes the third keyword; The vector storage library is updated using the vector corresponding to the fourth keyword.
8. The method according to claim 7, further comprising: determining at least one fifth vector from the vector repository; The fifth vector represents a vector whose corresponding number of index information is greater than a first threshold, or a vector having the second largest number of corresponding index information in the vector repository; the index information represents unique identification information of the stored data corresponding to the fifth vector in the data repository; For each fifth vector, determining at least one sixth keyword from the second stored data corresponding to the fifth vector; the vector corresponding to the sixth keyword is different from the fifth vector; The vector storage library is updated using the vector corresponding to the sixth keyword.
9. An electronic device comprising a first display and a first processor; wherein, The first display is used to display a first running interface of the output target application; The first processor is configured to execute the target application. When the first processor executes the target application, the first processor is configured to: Obtaining input data; providing the input data as content of a prompt word to a target model; Converting the input data into at least one keyword; the at least one keyword includes at least one of the following: an entity keyword representing an objective thing, a relationship keyword representing an association relationship between different entities; Obtaining target storage data matching the at least one keyword based on a data repository; Providing the input data and the target storage data as content information of the prompt word to the target model; Outputting a feedback result for the input data; The feedback result is a result generated by the target model based on the content information.
10. An electronic device comprising a second display and a second processor; wherein: The second display is used to display the running interface of the output target application; The second processor is configured to execute the target application; When the second processor executes the target application, the second processor: In response to a user's designated operation on the first stored data, updating the data repository with the first stored data; Determining a third keyword corresponding to the first stored data; the third keyword includes at least one of the following: a third entity representing an objective thing, and a third relationship representing an association relationship between things; Using the third keyword, updating the relationship repository; The relationship repository is used to store a plurality of entities and the relationships between the plurality of entities.
Citation Information
Patent Citations
Medical LLM model reasoning method based on knowledge graph and related equipment
CN118095450A
Question and answer method and device based on large language model and nonvolatile storage medium
CN119168068A
Data center inspection auxiliary question and answer method, device and equipment and storage medium
CN119336879A
Composite symbolic and non-symbolic artificial intelligence system for advanced reasoning and semantic search
US20240386015A1