Data query method and device, electronic equipment, storage medium and program product
By updating the content of the memory pool and building a new query prompt word in the smart body, the problem of the intelligent body in the data query task is low, and the more accurate query results are achieved.
Patent Information
- Application Number
- CN202411355247.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-01-21
AI Technical Summary
The agent has the problem of low query accuracy when performing data query tasks, mainly due to the inaccurate output results of the large language model and the illusion.
By using the intelligent body to inquire the first prompt, the first query result is obtained, and it is used as a memory feedback to update the content of the memory pool. Then, based on the updated memory pool and the first prompt, build a second prompt, and inquire about it to generate more accurate query results.
By increasing the number of high -quality memory, the intelligent body can generate more accurate query results, improve the accuracy of data query, and then solve the problem of low accuracy in the data query task.
Smart Images

Figure CN119336802A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of intelligent body technology, and in particular relates to a data query method, device, electronic device, storage medium and program product. Background Art
[0002] In related technologies, the intelligent agent uses a large language model (LLM) as its brain, collects environmental information through the perception module, changes the environmental state through the action module, and can achieve effective interaction with the environment. It integrates multiple links such as perception, decision-making, and action, and shows advantages in autonomy, decision-making, and collaborative interaction. It has the ability to transform the capabilities of the large language model into practical problem-solving capabilities, can meet the needs of improving business quality and efficiency, and is an important application model of the large language model.
[0003] However, large language models have problems such as inaccurate output results and hallucinations, which lead to low query accuracy when intelligent agents perform tasks such as data query. Summary of the invention
[0004] In order to solve the problem of low accuracy of intelligent agent query existing in the related art, the embodiments of the present application provide a data query method, device, electronic device, storage medium and program product.
[0005] The present invention provides a data query method, which includes:
[0006] Using the agent to query the first prompt word to obtain a first query result;
[0007] Update the content in the memory pool of the agent according to the first query result;
[0008] constructing a second prompt word according to the first prompt word and the query result;
[0009] Based on the updated content in the memory pool, the second prompt word is queried by the agent to obtain a second query result.
[0010] In some embodiments, constructing the second prompt word based on the first prompt word and the first query result includes: constructing the second prompt word based on the first prompt word, the first query result and historical query information, wherein the historical query information includes historical information of query input and historical information of query results.
[0011] In some embodiments, the first query result includes at least one element; updating the content in the memory pool of the agent according to the first query result includes: updating the content in the memory pool of the agent according to the correlation between the first prompt word and the target element in the first query result, and the target element represents any element in the first query result.
[0012] In some embodiments, before updating the content in the memory pool of the agent based on the correlation between the first prompt word and the target element in the first query result, the method also includes: determining adjacent elements of the target element in the first query result; when the adjacent elements are not in the first query result, adding the adjacent elements to the first query result to obtain an updated first query result.
[0013] In some embodiments, determining the adjacent elements of the target element in the first query result includes: retrieving the adjacent elements of the target element in the knowledge graph based on a graph nearest neighbor search method.
[0014] In some embodiments, updating the content in the memory pool of the agent based on the correlation between the first prompt word and the target element in the first query result includes: adding the target element to the memory pool when the correlation between the first prompt word and each element in the memory pool is less than the correlation between the first prompt word and the target element in the first query result.
[0015] In some embodiments, the method further includes: when the correlation between the first prompt word and the target element in the first query result is less than or equal to the correlation between the first prompt word and any element in the memory pool, discarding the target element.
[0016] The present application also provides a data query device, the device comprising:
[0017] A query module, used to query the first prompt word using an agent to obtain a first query result;
[0018] A processing module is used to update the content in the memory pool of the agent according to the first query result; construct a second prompt word according to the first prompt word and the query result; based on the updated content in the memory pool, and using the agent to query the second prompt word, obtain a second query result.
[0019] An embodiment of the present application also provides an electronic device, comprising a processor and a memory for storing a computer program that can be run on the processor; wherein the processor is used to run the computer program to execute any one of the above-mentioned data query methods.
[0020] An embodiment of the present application further provides a computer storage medium on which a computer program is stored. When the computer program is executed by a processor, any one of the above-mentioned data query methods is implemented.
[0021] An embodiment of the present application also provides a computer program product, including a computer program, which implements any of the above-mentioned data query methods when executed by a processor.
[0022] It can be seen that the embodiment of the present application can use the intelligent agent to query the first prompt word and obtain the first query result, then feed the first query result back to the prompt word as memory and update the content in the memory pool, thereby increasing the number of high-quality memories, so that the intelligent agent based on the large language model can generate a more accurate query result for the second prompt word constructed by combining the first prompt word and the query result, which can solve the problem of low query accuracy when the intelligent agent performs tasks such as data query to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A flowchart of a data query method according to an embodiment of the present application;
[0024] Figure 2 A working topology diagram of an intelligent agent in an embodiment of the present application;
[0025] Figure 3 A schematic diagram of the hierarchical structure of the knowledge graph of an embodiment of the present application;
[0026] Figure 4 This is a schematic diagram of the structure of a data query device according to an embodiment of the present application;
[0027] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] The agent has the following four core components: LLM, planning, memory, and tool use. Among them, the memory component is divided into short-term memory component and long-term memory component. All information input into the encoder (transformer) as context is classified as short-term memory. Short-term memory is mainly implemented based on prompt words (Prompt) and depends on the context of LLM. Therefore, it is affected by the encoder and has a maximum number of tokens, which leads to limited capacity of short-term memory. The short-term memory scheme can be based on context learning scheme or historical query record scheme.
[0029] Long-term memory is a condensed insight into past behaviors and thoughts. Long-term memory components can provide agents with the ability to store and recall information for a long time. Long-term memory solutions are usually implemented using vector storage and knowledge base retrieval. Agents use large language models for memory retrieval, decision reasoning, and determining the order of actions, which can enhance the ability of large model thinking and decision-making. By implementing long-term memory solutions, agents can summarize and abstract high-level information from raw observations and write them into the memory pool. They can write reference plans that summarize successful prior trajectories into the memory pool, record the results of the agent's tool calls into the memory pool, and use external knowledge bases to obtain information and record it in the knowledge base as long-term memory.
[0030] In related technologies, large language models have problems such as inaccurate output results and hallucinations. Usually, thought chains, reasoning and acting (ReAct), reflection, etc. are used to review the output results to reduce the hallucinations of large language models. The thought chain method uses the autoregressive nature of large language models to guide the model to generate a reasoning path by giving a series of prompts to solve the problem. The disadvantages are that the results are returned by sampling, hallucinations and error propagation are prone to occur, and it is difficult to control the quality and length of reasoning. ReAct is also a prompt engineering method that uses small sample learning to teach the model how to solve problems. It contains reasoning elements, allows agent text operations, and can interact with its environment, but this method is prone to reasoning errors. In addition to the above prompt engineering methods, there are also methods including retrieval-augmented generation (RAG), knowledge retrieval, model fine-tuning, etc., which are used to reduce hallucination problems. It is an important direction to provide comprehensive defense against hallucinations by seamlessly integrating multiple methods (result feedback, feedback from other agents, historical memory feedback, self-evolution, dynamic iteration, etc.).
[0031] In the related art, when an agent performs tasks such as data query, there is a problem of low query accuracy. To address the above problem, the embodiments of the present application propose a data query method, device, electronic device, storage medium and program product. In the embodiments of the present application, for open queries, the results generated by the agent are fed back to the prompt word as memory, forming a new knowledge base that is dynamically expanded to the memory pool, increasing the number of high-quality memories, and enabling the agent based on the large language model to generate more appropriate response results.
[0032] The following is a further detailed description of the embodiments of the present application in conjunction with the accompanying drawings and examples. It should be understood that the embodiments provided herein are only used to explain the embodiments of the present application and are not intended to limit the embodiments of the present application. In addition, the embodiments provided below are partial embodiments for implementing the present application, rather than providing all embodiments for implementing the present application. In the absence of conflict, the technical solutions recorded in the embodiments of the present application can be implemented in any combination.
[0033] It should be noted that, in the embodiments of the present application, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a method or device including a series of elements includes not only the elements explicitly recorded, but also includes other elements not explicitly listed, or also includes elements inherent to the implementation of the method or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other related elements (such as steps in a method or units in a device, for example, a unit may be a part of a circuit, a part of a processor, a part of a program or software, etc.) in the method or device including the element.
[0034] The data query method provided in the embodiment of the present application includes a series of steps, but the data query method provided in the embodiment of the present application is not limited to the recorded steps. Similarly, the data query device provided in the embodiment of the present application includes a series of modules, but the device provided in the embodiment of the present application is not limited to including the modules explicitly recorded, and may also include modules required to obtain relevant information or perform processing based on the information.
[0035] Figure 1 Flow chart of the data query method of the embodiment of the present application, such as Figure 1 As shown, the process may include:
[0036] Step 101: Use an agent to query a first prompt word to obtain a first query result.
[0037] Reference Figure 2The agent uses the large language model as its brain. It can collect environmental information through the perception module and change the environmental state through the action module. The large language model can make decisions or plans based on the contents of the memory pool and knowledge base. In practical applications, you can set the agent role, initialize the memory module, and create a memory stream object and an entity knowledge base object to manage the memory stream and entity knowledge base respectively. The memory stream object is Figure 2 The memory pool in , the entity knowledge base object is Figure 2 The knowledge base in .
[0038] Reference Figure 2 ,Combined with the output of the large language model, the action module can use tools or perform text generation tasks.,By using tools, the action module can call the Application Programming,Interface (API), perform data search, execute code interpreter, etc.
[0039] In some embodiments, reference Figure 2 , use the agent to query the first prompt word input by the user to obtain a first query result; illustratively, the agent can execute the query through a suitable tool and store the first query result in a knowledge base.
[0040] Step 102: Update the content in the agent's memory pool according to the first query result.
[0041] In some embodiments, the first query result includes at least one knowledge vector element, and at least part of the elements in the first query result can be added to the memory pool of the agent, thereby updating the content in the memory pool of the agent.
[0042] Step 103: construct a second prompt word according to the first prompt word and the first query result.
[0043] In some embodiments, the second prompt word includes the first prompt word and the first query result; illustratively, the second prompt word can be a vector (q, W), where q represents the first prompt word and W represents the first query result.
[0044] Step 104: Based on the updated content in the memory pool, the second prompt word is queried by the agent to obtain a second query result.
[0045] Here, the second prompt word can be passed to the large language model of the agent, and by initiating a session again and using the large language model to query, the large language model can query the second prompt word based on the updated content in the memory pool to obtain a second query result. In the embodiment of the present application, the second prompt word and memory can be passed to the large language model for reasoning, and finally a response (second query result) is generated.
[0046] The embodiment of the present application proposes an intelligent agent processing method based on a memory-enhanced evolutionary mechanism. By writing the intelligent agent results into a memory pool to construct new query prompt words, the performance of the intelligent agent task processing can be improved and the user experience can be improved.
[0047] In practical applications, steps 101 to 104 can be implemented based on a processor, and the processor can be at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, and a microprocessor.
[0048] It can be seen that the embodiment of the present application can use the intelligent agent to query the first prompt word and obtain the first query result, then feed the first query result back to the prompt word as memory and update the content in the memory pool, thereby increasing the number of high-quality memories, so that the intelligent agent based on the large language model can generate a more accurate query result for the second prompt word constructed by combining the first prompt word and the query result, which can solve the problem of low query accuracy when the intelligent agent performs tasks such as data query to a certain extent.
[0049] In some embodiments of the present application, the first query result includes at least one element.
[0050] Accordingly, the process of updating the content in the memory pool of the agent according to the first query result includes:
[0051] According to the correlation between the first prompt word and the target element in the first query result, the content in the memory pool of the agent is updated, and the target element represents any element in the first query result.
[0052] Here, the target element in the first query result can be recorded as m, and the correlation between the first prompt word and the target element in the first query result can be recorded as S rel (q,m), exemplarily, S rel(q,m) can be calculated based on the Hierarchical Navigable Small World graphs (HNSW) vector similarity algorithm.
[0053] For example, to enhance the accuracy of the query task result, the evaluation result m of the first query result can be calculated according to formula (1): * .
[0054]
[0055] Where q represents the first prompt word, which can be the context of the agent; M is the set of all memories (including short-term memory and long-term memory) in the agent, and S rec (q,m) represents the recency evaluation function of q and m, S rel (q,m) represents the correlation evaluation function between q and m, S imp (m) represents the importance evaluation function of m, α, β and γ are three balance parameters, and different values of the balance parameters represent different memory reading strategies. For example, the parameters α=γ=0 and β=1 can be set.
[0056] The results output by the agent can be evaluated based on the above evaluation function. If the correlation is not high, the query results can be discarded and the next round of query search can be performed. The relevant results are added to the memory stream object.
[0057] It can be seen that the embodiment of the present application can reasonably update the content in the memory pool of the intelligent agent according to the correlation between the first prompt word and the target element in the first query result, thereby facilitating increasing the number of high-quality memories by updating the content in the memory pool.
[0058] In some embodiments of the present application, before updating the content in the memory pool of the agent according to the correlation between the first prompt word and the target element in the first query result, the method further includes:
[0059] Determine adjacent elements of the target element in the first query result; if the adjacent elements are not in the first query result, add the adjacent elements to the first query result to obtain an updated first query result.
[0060] In some embodiments of the present application, adjacent elements of the target element in the knowledge graph may be retrieved based on a nearest neighbor search method of the graph.
[0061] It can be seen that the embodiment of the present application can expand the first query result according to the adjacent elements of the target element in the first query result, so as to facilitate the construction of a second prompt word that is conducive to querying through an intelligent agent based on the first prompt word and the first query result, thereby facilitating improving the accuracy of the query result.
[0062] In some embodiments of the present application, the process of updating the content in the memory pool of the agent according to the relevance between the first prompt word and the target element in the first query result includes:
[0063] When the correlation between the first prompt word and each element in the memory pool is less than the correlation between the first prompt word and the target element in the first query result, the target element is added to the memory pool.
[0064] It can be understood that if the correlation between the first prompt word and each element in the memory pool is less than the correlation between the first prompt word and the target element in the first query result, by adding the target element to the memory pool, the correlation between the elements in the memory pool and the query prompt word can be enhanced, which is beneficial to improve the accuracy of the intelligent agent in executing the query task according to the updated content in the memory pool.
[0065] In some embodiments of the present application, the method also includes: when the correlation between the first prompt word and the target element in the first query result is less than or equal to the correlation between the first prompt word and any element in the memory pool, discarding the target element. This is helpful to exclude results with less correlation between the first query result and the query task, and is helpful to improve the efficiency of subsequent queries by the intelligent agent.
[0066] Exemplarily, R, prompt words and query history can be initialized, where R represents the memory pool of the agent. W can also be used to represent the first query result, and Wd can be used to represent the storage of discarded elements.
[0067] In the embodiment of the present application, the elements in the first query result that are closer to the first prompt word can be stored in the memory pool R, and the elements in the first query result that are irrelevant to the first prompt word can also be discarded. Figure 3 For example, refer to Figure 3 , the adjacent relationship of elements can be presented through the knowledge graph, where L2, L1 and L0 represent the three layers of the knowledge graph, L2 is the entry layer, and the target element in the first query result can be a query node located at any layer of the knowledge graph. For each element e in W, the adjacent elements e of the hierarchical result e of the knowledge graph can be adj If e adj If not in W, add e to W adjThen, extract the element closest to q (that is, extract the element with the highest correlation with q) e' from W. If e' is closer to q than any element in R (that is, the correlation between e' and q is greater than the correlation between each element in R and q), then add e' to R, otherwise, add e to Wd, so that the content in R can be updated.
[0068] In some embodiments of the present application, the process of constructing a second prompt word based on the first prompt word and the first query result includes: constructing a second prompt word based on the first prompt word, the first query result and historical query information, wherein the historical query information includes historical information of query input and historical information of query results.
[0069] For example, when the first query result includes multiple knowledge vector elements, the multiple knowledge vector elements can be sorted according to importance, and after constructing a directed acyclic graph (DAG) path, they are combined with the saved prompt words and historical query information to form a second prompt word. That is, the embodiment of the present application proposes a method for constructing a new prompt word based on the importance of the query result using the DAG path.
[0070] It can be seen that the embodiment of the present application can more accurately construct the second prompt word for querying based on the first prompt word, the first query result and the historical query information.
[0071] In summary. Different from the evaluation method based only on the similarity of information encoding, and different from the evaluation method based on indicators such as the time to complete the task, the winning rate, resource consumption, and the error rate, and the evaluation method that rewards or gives high scores for successful tasks, the embodiment of the present application proposes an intelligent agent processing method based on a memory improvement mechanism, which saves the query results output by the intelligent agent as memory to the memory module, generates new real-time memory by superimposing prompt words, and uses real-time memory enhancement to improve the performance of the intelligent agent's query task processing.
[0072] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0073] Figure 4 Schematic diagram of the structure of the data query device of the embodiment of the present application. Figure 4 As shown, the device comprises:
[0074] A query module 401 is used to query the first prompt word using an agent to obtain a first query result;
[0075] Processing module 402 is used to update the content in the memory pool of the agent according to the first query result; construct a second prompt word according to the first prompt word and the query result; based on the updated content in the memory pool, and using the agent to query the second prompt word, obtain a second query result.
[0076] In some embodiments, the processing module 402 is used to construct a second prompt word according to the first prompt word and the first query result, including:
[0077] The second prompt word is constructed according to the first prompt word, the first query result and historical query information, wherein the historical query information includes historical information of query input and historical information of query results.
[0078] In some embodiments, the first query result includes at least one element; the processing module 402, used to update the content in the memory pool of the agent according to the first query result, includes:
[0079] The content in the memory pool of the agent is updated according to the correlation between the first prompt word and the target element in the first query result, and the target element represents any element in the first query result.
[0080] In some embodiments, the processing module 402 is also used to determine the adjacent elements of the target element in the first query result before updating the content in the memory pool of the agent according to the correlation between the first prompt word and the target element in the first query result; when the adjacent elements are not in the first query result, add the adjacent elements to the first query result to obtain an updated first query result.
[0081] In some embodiments, the processing module 402 is used to determine the adjacent elements of the target element in the first query result, including: retrieving the adjacent elements of the target element in the knowledge graph based on a graph nearest neighbor search method.
[0082] In some embodiments, the processing module 402 is used to update the content in the memory pool of the agent according to the correlation between the first prompt word and the target element in the first query result, including:
[0083] When the correlation between the first prompt word and each element in the memory pool is less than the correlation between the first prompt word and the target element in the first query result, the target element is added to the memory pool.
[0084] In some embodiments, the processing module 402 is further configured to discard the target element when the correlation between the first prompt word and the target element in the first query result is less than or equal to the correlation between the first prompt word and any element in the memory pool.
[0085] In practical applications, the query module 401 and the processing module 402 can be implemented based on a processor and a communication device.
[0086] 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. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0087] It should be noted that in the embodiments of the present application, if the above 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 such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium, including a number of instructions to enable a computer device (which can be a terminal, a server, 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 disk or an optical disk. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0088] Correspondingly, an embodiment of the present application further provides a computer program product, which includes computer executable instructions, and the computer executable instructions are used to implement any data query method provided in the embodiment of the present application.
[0089] Accordingly, an embodiment of the present application further provides a computer storage medium, on which computer executable instructions are stored, and the computer executable instructions are used to implement any one of the data query methods provided in the above embodiments.
[0090] An embodiment of the present application also provides an electronic device. Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the electronic device 50 may include:
[0091] Memory 501, used for storing executable instructions;
[0092] The processor 502 is used to implement any one of the above-mentioned data query methods when executing the executable instructions stored in the memory 501.
[0093] The processor 502 may be at least one of an ASIC, a DSP, a DSPD, a PLD, a FPGA, a CPU, a controller, a microcontroller, and a microprocessor.
[0094] The above-mentioned computer-readable storage medium and memory 502 can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory (Flash Memory), a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and other memories; it can also be various terminals including one or any combination of the above-mentioned memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc.
[0095] In some embodiments, the functions or modules included in the device provided in the embodiments of the present application can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.
[0096] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0097] The methods disclosed in the various method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0098] The features disclosed in the various product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0099] The features disclosed in the various method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0100] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0101] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A data query method, characterized in that: The method comprises: Using the agent to query the first prompt word to obtain a first query result; Update the content in the memory pool of the agent according to the first query result; constructing a second prompt word according to the first prompt word and the first query result; Based on the updated content in the memory pool, the second prompt word is queried by the agent to obtain a second query result.
2. The method according to claim 1, characterized in that The step of constructing a second prompt word according to the first prompt word and the first query result includes: The second prompt word is constructed according to the first prompt word, the first query result and historical query information, wherein the historical query information includes historical information of query input and historical information of query results.
3. The method according to claim 1 or 2, characterized in that: The first query result includes at least one element; The updating of the content in the memory pool of the agent according to the first query result includes: The content in the memory pool of the agent is updated according to the correlation between the first prompt word and the target element in the first query result, and the target element represents any element in the first query result.
4. The method according to claim 3, characterized in that Before updating the content in the memory pool of the agent according to the correlation between the first prompt word and the target element in the first query result, the method further includes: Determine adjacent elements of the target element in the first query result; When the adjacent element is not in the first query result, the adjacent element is added to the first query result to obtain an updated first query result.
5. The method according to claim 4, characterized in that The determining the adjacent elements of the target element in the first query result includes: Based on the graph nearest neighbor search method, the adjacent elements of the target element in the knowledge graph are retrieved.
6. The method according to claim 3, characterized in that: The updating of the content in the memory pool of the agent according to the correlation between the first prompt word and the target element in the first query result includes: When the correlation between the first prompt word and each element in the memory pool is less than the correlation between the first prompt word and the target element in the first query result, the target element is added to the memory pool.
7. The method according to claim 3, characterized in that The method further comprises: When the correlation between the first prompt word and the target element in the first query result is less than or equal to the correlation between the first prompt word and any element in the memory pool, the target element is discarded.
8. A data query device, characterized in that: The device comprises: A query module, used to query the first prompt word using an agent to obtain a first query result; A processing module is used to update the content in the memory pool of the agent according to the first query result; construct a second prompt word according to the first prompt word and the query result; based on the updated content in the memory pool, and using the agent to query the second prompt word, obtain a second query result.
9. An electronic device, characterized in that: The electronic device comprises a processor and a memory for storing a computer program that can be run on the processor; wherein, The processor is used to run the computer program to execute the data query method according to any one of claims 1 to 7.
10. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data query method according to any one of claims 1 to 7 is implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the data query method according to any one of claims 1 to 7.