Intelligent agent dialogue generation method and storage medium

By constructing an external memory bank and dialogue memory bank, combined with time semantic retrieval, the problem of outdated information interference in dialogue agents is solved, and the timeliness and accuracy of dialogue reply is improved.

CN120448511AInactive Publication Date: 2025-08-08BEIJING LANZHOU TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510951529.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-08-08
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When existing dialogue agents deal with time-sensitive tasks, it is difficult to rule out the impact of outdated or invalid information, resulting in the dialogue results containing information that is not within the target time period.

Method used

Build an external memory library and a dialogue memory library, and search in these libraries by obtaining the time semantic information in user query instructions, combining time-sensitive filtering strategies and mixed semantic searches to optimize the timeliness and accuracy of the search results.

Benefits of technology

It improves the timeliness and rationality of dialogue responses, reduces computing costs, enhances retrieval efficiency and accuracy, and ensures high sensitivity and efficiency of agent dialogue generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448511A_ABST
    Figure CN120448511A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence, in particular to an agent dialogue generation method and a storage medium, the agent dialogue generation method provided by the invention comprises the following steps: constructing an external memory bank and a dialogue memory bank; obtaining a user query instruction and extracting user time semantics; retrieving in an external memory bank and / or a dialogue memory bank based on the user query instruction and the user time semantics; the retrieval results are recalled and sorted, and the sorted results are added into a context window of the large language model; and inputting a user query instruction in the large language model to obtain a dialogue reply. Time semantics in a user query instruction are dynamically perceived through an intelligent agent, retrieval is performed in an external memory bank and a dialogue memory bank in combination with the time semantics, and the intelligent agent retrieves events highly related to the user query instruction in the time dimension in the memory bank, so that interference of outdated or invalid information on a retrieval result is eliminated, and the retrieval efficiency is improved. The timeliness and rationality of the dialogue reply returned by the intelligent agent are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an intelligent agent dialogue generation method and storage medium. Background Art

[0002] In recent years, with the rapid development of large language model technology, artificial intelligence's ability to handle user dialogue tasks has also been greatly enhanced, greatly broadening the response sensitivity of dialogue generation agents based on large language models.

[0003] However, when processing longer text content or engaging in long-term conversations with users, current mainstream conversational agents have low time sensitivity for task data that requires attention to time information. They find it difficult to eliminate the impact of outdated or invalid information, and there is a possibility that information that is not within the target time period will be output in the returned conversation results. Summary of the Invention

[0004] In order to solve the problem that existing dialogue agents have low time sensitivity to task data that requires attention to time information and find it difficult to eliminate the influence of outdated or invalid information, the present invention provides an agent dialogue generation method and storage medium.

[0005] The solution to the technical problem of the present invention is to provide a method for generating an intelligent agent dialogue, which comprises the following steps: Build external memory and conversational memory; Obtaining a user query instruction, determining whether the content of the user query requires searching the external memory and / or the conversation memory; if so, performing the following steps: extracting time semantic information in the user query instruction to obtain user time semantics; Based on the user query instruction and the user time semantics, searching the external memory and / or the conversation memory to obtain a retrieval event set; Recalling the retrieved event set, sorting the recall results to obtain a sorted event set, and adding the sorted event set to the context window of the large language model to obtain refined sorted context window information; Based on the refined sorted context window information, a dialogue reply is given.

[0006] Preferably, after determining whether the content of the user query needs to be retrieved from the external memory and / or the conversation memory, the method further includes: If not, the user query instruction is input into the large language model to directly obtain the dialogue response of the large language model.

[0007] Preferably, building the external memory bank and the dialogue memory bank specifically includes: Obtaining external document input, parsing the input external document, extracting time semantic information from the external document, obtaining external memory with time semantic information, and storing the obtained data in the external memory bank; The conversation history of the last conversation of the intelligent agent is obtained, and the time semantic information in the conversation history is extracted to obtain the conversation memory with the time semantic information and store it in the conversation memory bank.

[0008] Preferably, the external memory and the dialogue memory are stored in the external memory bank and the dialogue memory bank respectively in the form of standard key-value pairs.

[0009] Preferably, obtaining the conversation history of the last conversation of the agent specifically includes: The user query instructions and the conversation replies are collected and sorted to obtain a conversation history.

[0010] Preferably, obtaining the conversation history of the agent's last conversation and extracting temporal semantic information from the conversation history specifically includes: Extracting the conversation occurrence time in the conversation history, and using a sliding window strategy to mark it, obtaining a context time anchor consisting of the window size and time range of the conversation history; The conversation mention time in the conversation history is extracted, and information is extracted through a large language model to obtain a semantic time anchor consisting of the mentioned events in the conversation history and their start and end times.

[0011] Preferably, based on the user query instruction and the user time semantics, searching in the external memory and / or the conversation memory to obtain the retrieval event set specifically includes the following steps: Obtaining the time range involved in the user's time semantics, using a time-sensitive filtering strategy to match events that have an intersection with the time intervals in the external memory and / or the conversation memory to obtain an initial event set; Based on the user query instruction, a hybrid semantic retrieval strategy is used on the initial event set to sort out the retrieval results and obtain a retrieval event set.

[0012] Preferably, recalling the retrieved event set and then sorting the recall results to obtain the sorted event set specifically comprises the following steps: Based on the user query instruction and the user time semantics, comprehensively scoring the retrieved event set; Calculating a recall confidence of the retrieval event set, and automatically narrowing or expanding a retrieval scope in the external memory and / or the conversation memory according to the recall confidence; Based on the comprehensive score, the events in the retrieved event set are sorted to obtain the sorted event set.

[0013] Preferably, sorting the events in the retrieved event set to obtain the sorted event set specifically includes: The retrieval event set combines the events from the external memory and the events from the dialogue memory, and then sorts them together to obtain the sorted event set.

[0014] In order to solve the above technical problems, the present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the intelligent agent dialogue generation method as described in any one of the above items is implemented.

[0015] Compared with the prior art, the agent dialogue generation method and storage medium of the present invention have the following advantages: 1. The intelligent agent dialogue generation method of the present invention dynamically perceives the time semantics in the user query instructions through the intelligent agent, and searches in the external memory and the dialogue memory in combination with the time semantics. This is beneficial for the intelligent agent to retrieve events in the memory that are highly relevant to the user query instructions in the time dimension, thereby eliminating the interference of outdated or invalid information on the retrieval results, ensuring the intelligent agent's high sensitivity to the time information in the user query instructions, and greatly improving the timeliness and rationality of the dialogue replies returned by the intelligent agent.

[0016] 2. The present invention sets a retrieval judgment mechanism when obtaining user query instructions, and judges whether the content of the user query needs to be retrieved in the dual memory library; when the user query instruction does not involve obtaining external knowledge or reviewing historical conversations, the step of searching in the dual memory library is skipped, thereby reducing the computing cost of the intelligent agent and improving the process efficiency and response speed of the intelligent agent in responding to users.

[0017] 3. The present invention obtains external document input and the agent's previous conversation history, analyzes and extracts temporal semantic information, and stores the resulting external and conversation memories in the external and conversation memories, respectively. By identifying events or data appearing in the external document or conversation history and their corresponding times, the agent can quickly locate and retrieve corresponding events in both memories during subsequent searches, combining temporal information. This improves the agent's search efficiency and accuracy.

[0018] 4. The present invention stores external memory and dialogue memory data in the form of standard key-value pairs, thereby achieving standardization of event information in the external memory library and the dialogue memory library, making it easier for intelligent agents to quickly locate corresponding events and time information during retrieval. At the same time, it enhances the correlation between events and their corresponding time semantics, which is beneficial to improving the efficiency of subsequent retrieval in the two memory libraries.

[0019] 5. In the present invention, by simultaneously collecting user query instructions and dialogue replies, the information in the dialogue replies and the original user query instructions are further supplemented and verified with each other, thereby making the information contained in the dialogue history more complete and improving the integrity and accuracy of events subsequently stored in the dialogue memory.

[0020] 6. The present invention extracts the time when the conversation occurred in the conversation history to obtain the contextual time anchor point, extracts the time when the conversation was mentioned in the conversation history to obtain the semantic time anchor point, and through the dual time semantic enhancement strategy of extracting the time when the conversation occurred and the time when the conversation was mentioned, the conversation memory bank connects the time sequence and intervals of different events in series, which is beneficial for the intelligent agent to understand and analyze the overall picture and development context of multiple events, improve the coherence of the conversation, and facilitate the intelligent agent to manage and retrieve the conversation content more accurately.

[0021] 7. The present invention adopts a time-sensitive filtering strategy for the memory bank to extract the event set in the memory bank that matches the user's time semantics, which is conducive to narrowing the retrieval scope and greatly improving the retrieval accuracy and retrieval efficiency of the intelligent agent.

[0022] 8. This invention comprehensively scores the retrieved event set based on the user's query instruction and user time semantics; calculates the recall confidence of the retrieved event set as an indicator for adjusting the search scope; and, based on the comprehensive score, sorts the events within the retrieved event set to obtain a sorted event set. By recalling the retrieved event set, events that meet the customer's specific needs are prioritized, further filtering out a large amount of irrelevant information with low relevance to the query target, significantly improving the accuracy of the agent's retrieval results and enhancing the agent's computational efficiency.

[0023] 9. In the present invention, the event set is retrieved and combined with the events from the external memory bank and the events from the dialogue memory bank, and then the event set is recalled. The events in the two memory banks complement each other, which is beneficial for the intelligent agent to understand the potential relationship between events and improve the relevance of the recall results with user needs.

[0024] 10. The present invention also provides a computer-readable storage medium, which has the same beneficial effects as the above-mentioned intelligent agent dialogue generation method, which will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0026] Figure 1It is a step flow chart of the intelligent agent dialogue generation method provided by the first embodiment of the present invention.

[0027] Figure 2 This is a flowchart of step S1 of the agent dialogue generation method provided by the first embodiment of the present invention.

[0028] Figure 3 This is a flowchart of step S12 of the agent dialogue generation method provided in the first embodiment of the present invention.

[0029] Figure 4 This is a flowchart of step S3 of the agent dialogue generation method provided in the first embodiment of the present invention.

[0030] Figure 5 This is a flowchart of step S4 of the agent dialogue generation method provided in the first embodiment of the present invention. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and implementation examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0032] See also Figure 1 The first embodiment of the present invention provides a method for generating an intelligent agent dialogue, comprising the following steps: S1: Constructing external memory bank and conversational memory bank.

[0033] It can be understood that the external memory bank stores external memories other than user input and large language models. The external memory supplements the information inside the intelligent agent, thereby ensuring the integrity and reliability of the content subsequently returned by the intelligent agent.

[0034] In the field of artificial intelligence, a word-gram is the smallest unit representing text and is used to segment text. When an intelligent agent performs natural language processing, a piece of text content is decomposed into multiple word-grams that have a mapping relationship with each other, and the intelligent agent analyzes the input text content based on the word-grams.

[0035] Understandably, the dialogue memory integrates the most relevant content of the dialogue and the dialogue context, making it easier for the intelligent agent to record and recall the content of past interactions and exclude repeated historical information, effectively compressing word occupancy while maintaining contextual coherence.

[0036] S2: Obtain the user query instruction and determine whether the content of the user query needs to be retrieved from the external memory and / or the dialogue memory; if so, perform the following steps: extract the time semantic information in the user query instruction to obtain the user time semantics.

[0037] S3: Based on the user query instruction and the user time semantics, search in the external memory and / or the dialogue memory to obtain the retrieval event set.

[0038] S4: Recall the retrieved event set, sort the recall results, obtain the sorted event set, and add the sorted event set to the context window of the large language model to obtain the refined sorted context window information.

[0039] S5: Give a dialogue response based on the refined sorted context window information.

[0040] It can be understood that user time semantic extraction helps the intelligent agent extract time information from user query instructions and sort out the order of events, which facilitates the intelligent agent to further understand the contextual information in long messages or multi-round conversations, and improves the accuracy of the intelligent agent's conversational responses and the efficiency of response generation.

[0041] It can be understood that, combined with the user time semantics obtained by dynamic perception based on user query instructions, the intelligent agent retrieves memory data that matches the user time semantics in the external memory bank and / or dialogue memory bank. The retrieval results obtained are highly time-sensitive, avoiding returning events that do not meet the time constraints, greatly improving the timeliness and rationality of the intelligent agent's dialogue responses.

[0042] Furthermore, after step S2, the following steps are further included: If not, the user query instruction is input into the large language model to directly obtain the dialogue response of the large language model.

[0043] As an optional implementation method, the intelligent agent combines prompt engineering to provide judgment reference standards and judgment results that can be understood and learned by the large model as examples in the prompts input to the large language model. The large language model is set to focus on judging whether user questions require retrieval of external memory banks and / or dialogue memory banks, which effectively improves the intelligent agent's processing effect on natural language tasks input by users, and helps the intelligent agent adapt to different application scenarios and task requirements.

[0044] It can be understood that the intelligent agent performs retrieval judgment on the user's query instructions, and uses whether the instruction requires the acquisition of external knowledge or the review of historical conversations as the judgment standard to determine whether the instruction requires further retrieval. When the instruction does not involve the acquisition of external knowledge or the review of historical conversations, the step of searching in the dual memory bank is skipped, which greatly simplifies the process of the intelligent agent responding to the user, avoids consuming additional computing costs, and effectively improves the computing efficiency of the intelligent agent.

[0045] For example, when the question entered by the user involves keywords such as "what", "why", "where", and "when" that inquire about factual content, the intelligent agent can determine that the query content requires the acquisition of external knowledge; when the question entered by the user includes time-related words such as "before", "just now", and "above", or demonstrative pronouns such as "this", "there", and "these", the intelligent agent can determine that the query content requires a review of historical conversations.

[0046] See also Figure 2 , further, step S1 specifically includes: S11: Obtain external document input, parse the input external document, extract time semantic information from the external document, obtain external memory with time semantic information, and store it in the external memory bank.

[0047] As an optional implementation, the external memory database adopts a storage system based on ES (Elasticsearch).

[0048] ES is a distributed search and data analysis engine that has the ability to quickly perform full-text retrieval on large amounts of data and supports queries on long or complex statements. The ES-based storage system has a distributed storage architecture, which helps intelligent agents quickly retrieve stored information with target indexes.

[0049] It can be understood that after the agent extracts the time semantic information, it writes the field and its corresponding event or data into ES as structured information and establishes an index of the time range.

[0050] S12: Obtain the conversation history of the last conversation of the intelligent agent, extract the temporal semantic information in the conversation history, obtain the conversation memory with temporal semantic information, and store it in the conversation memory bank.

[0051] As an optional implementation method, the intelligent agent introduces a dynamic modeling module for users and tasks; the dynamic modeling module automatically records the user's historical preferences, task stages and context status based on the conversation history obtained each time, tracks changes in user preferences and tasks, and realizes the personalization of the intelligent agent's response and task continuity through a weight mechanism.

[0052] As an optional implementation, the agent uses a large language model that has been specifically trained to process the input external documents and conversation history text data.

[0053] As an optional implementation, the large language model is fine-tuned based on domain data and supervised learning is performed using a dataset with time range annotated labels; wherein the dataset training samples include text paragraphs and their corresponding events.

[0054] It can be understood that the large language model extracts event descriptions, start time and end time related fields from external documents or conversation histories, organizes the events or data that appear therein and their corresponding time ranges, and annotates each event with corresponding time semantic information and stores it in the corresponding external memory bank or conversation memory bank. This is beneficial for the intelligent agent to quickly locate the time semantic information index annotations in the memory bank that fall within the target time range through time information during the subsequent retrieval process, accurately find events that meet the time constraints, and greatly improve the retrieval efficiency and retrieval accuracy of the intelligent agent.

[0055] Furthermore, the external memory and the dialogue memory are stored in the external memory bank and the dialogue memory bank respectively in the form of standard key-value pairs.

[0056] A key-value pair is a data structure for storing data, consisting of a key and an associated value. When storing new data, you only need to add a new key-value pair without modifying the existing key-value pairs. This means that the existing data structure and stored information will not be affected, making it easier to expand the storage system.

[0057] As an optional implementation, the standard key-value pair is stored in the format of {'event', 'start time', 'end time'}.

[0058] It can be understood that due to the correspondence between the key and the value of the key-value pair, during the retrieval process of the intelligent agent, the corresponding value can be quickly obtained by searching the key, which enhances the correlation between the event and its corresponding time semantics, effectively improves the efficiency of data access, and facilitates the intelligent agent to quickly and frequently retrieve the external memory and dialogue memory.

[0059] It can be understood that standard key-value pairs realize the standardization of information stored in external memory and dialogue memory, and the unified format of annotation makes the index construction more accurate, improving the efficiency of subsequent retrieval while avoiding retrieval result deviations or errors caused by inconsistent information formats stored in memory, thereby improving the credibility of the intelligent agent's retrieval results.

[0060] It can be understood that the time range is entered into the database with a unified time granularity in the standard key-value pair; as an optional implementation, the standardized form of the start time is "year-month-day start time", and the standardized form of the end time is "year-month-day end time".

[0061] Furthermore, in step S12, user query instructions and dialogue replies are collected and sorted to obtain a dialogue history.

[0062] It can be understood that the user query instruction is the original user input content that has not been processed by the intelligent agent, and the dialogue response is the output content obtained by the intelligent agent after calculation based on the user query instruction; when the dialogue history collects user query instructions and dialogue responses at the same time, the user query instruction supplements the user's initial needs and goals in the dialogue response, and the dialogue response supplements the multi-round dialogue information hidden in the user query instruction, verifies the coherence in the context, and thus makes the information in the dialogue history more complete and reliable, effectively improving the integrity and accuracy of events subsequently stored in the dialogue memory.

[0063] See also Figure 2 and Figure 3 , further, step S12 specifically includes: S121: Extract the conversation occurrence time in the conversation history, and obtain the context time anchor consisting of the window size and time range of the conversation history through sliding window strategy marking.

[0064] Sliding window is an algorithm strategy for processing data. The algorithm maintains a fixed or variable-sized window and slides the window over a series of data to perform operations or calculations on the data within the sliding window.

[0065] Understandably, the sliding window strategy processes the newly collected information in the conversation history in a timely manner with real-time and continuous characteristics through the sliding of the window, without the need to recalculate the entire conversation history data set, thereby greatly improving the data processing efficiency of the conversation history and further improving the efficiency of recording conversation memories into the conversation memory bank.

[0066] As an optional implementation, the window size of the sliding window represents the number of conversation turns in each conversation segment.

[0067] It can be understood that the conversation occurrence time refers to the time range in which each conversation between the user and the agent actually occurs, which is used to represent the timeliness or time background of the conversation in the context; since the size of the sliding window records the number of conversation rounds in each conversation, the conversation occurrence time can be represented by the start time of the first round of the window to the end time of the last round.

[0068] S122: Extract the conversation mention time in the conversation history, extract information through the large language model, and obtain semantic time anchor points consisting of the events mentioned in the conversation history and their start and end times.

[0069] It can be understood that the conversation mention time is the time of the event explicitly mentioned in the conversation content, which is used to supplement the time background of other events involved in the conversation.

[0070] Anchors are markers used for navigation or reference in a dataset, which facilitate users to quickly locate the target event or data corresponding to the anchor, help agents quickly locate and query specific time ranges, and reduce the time required for agents to browse the memory library during subsequent retrieval.

[0071] Understandably, the dialogue memory adopts a dual temporal semantic enhancement strategy of extracting the time when the dialogue occurred and the time when the dialogue was mentioned. This is conducive to the association between different events stored in series in the dialogue memory, and identifying the time sequence and intervals between multiple events. It is convenient for subsequent intelligent agents to sort out and understand the overall picture and development context of multiple event combinations when searching in the dialogue memory, improving the coherence of dialogue memory retrieval results and greatly improving the efficiency and accuracy of intelligent agents in managing and retrieving dialogue content.

[0072] For example, a conversation occurs between a user and an agent, and the conversation history is as follows: { "event":"""User: Hello, I want to find a place to travel, do you have any recommendations? Agent: Hello! Of course. Do you prefer nature, city life, or a beach vacation? That way I can better recommend it to you.

[0073] User: I prefer natural scenery and want to go hiking, see lakes, etc.

[0074] Agent: Then you might consider Daocheng Yading in Sichuan or Meili Snow Mountain in Yunnan. These places offer stunning mountain scenery and plateau lakes. If you want to go abroad, New Zealand's South Island is also a great choice for nature lovers.

[0075] User: Daocheng Yading sounds great. When is the best time to go? Agent: The best time to travel to Daocheng Yading is from September to October. The weather is stable and the autumn scenery is charming, especially the golden grasslands and snow-capped mountains, which are a perfect contrast for taking photos and hiking. "start_date": "2025-03-10 09:00", "end_time": "2025-03-10 09:10" } It can be understood that the sliding window size of this conversation history is 3, that is, this conversation segment contains 3 rounds of conversation; the time range of the conversation occurrence time is from the start time of the first round of the window to the end time of the third round of the window, that is, "2025-03-10 09:00-9:10".

[0076] Understandably, the conversation in this conversation history mentioned the time period as "September to October every year".

[0077] See also Figure 4 , further, step S3 specifically includes the following steps: S31: Obtain the time range involved in the user's time semantics, adopt a time-sensitive filtering strategy, match events that have an intersection with the time interval in the external memory library and / or the conversation memory library, and obtain an initial event set.

[0078] It can be understood that the time-sensitive filtering strategy extracts event sets that match the user's time semantics from the external memory library and / or the dialogue memory library. On the one hand, it is helpful to reduce the retrieval scope of the intelligent agent in the memory library, greatly improving the retrieval efficiency of the intelligent agent; on the other hand, the time-sensitive filtering strategy filters out events that do not fall within the time constraint, avoiding outdated events from entering the retrieval results, thereby improving the retrieval accuracy of the intelligent agent.

[0079] For example, the agent's external memory and dialogue memory contain the following records: [ { "event": "Company's revenue in Q1 2024 will be 2 billion yuan", "start_date": "2024-01-01", "end_date": "2024-03-31", }, { "event": "Company's revenue in Q2 2024 will be RMB 2.5 billion", "start_date": "2024-04-01", "end_date": "2024-06-30", }, { "event": "The company's Q3 2024 revenue is 2.8 billion yuan", "start_date": "2024-07-01", "end_date": "2024-09-30", }, { "event": "The company's Q4 2024 revenue is 2.7 billion yuan", "start_date": "2024-10-01", "end_date": "2024-12-31", } ] When the user query is "What is the company's total revenue in the first half of 2024?": The intelligent agent identifies and obtains the time range involved in the user's time semantics from 2024-01-01 to 2024-06-30 through the content of the user's question.

[0080] Understandably, based on this time range, the agent extracts events Q1 (January-March) and Q2 (April-June) from the external memory and dialogue memory, whose time intervals overlap with the query range, and filters out events Q3 (July-September) and Q4 (October-December) whose time intervals do not overlap with the query range. Finally, the data of events Q1 and Q2 are returned as the initial event set.

[0081] S32: Based on the user query instruction, a hybrid semantic retrieval strategy is used on the initial event set to organize the retrieval results and obtain the retrieval event set.

[0082] Hybrid semantic retrieval is a retrieval strategy that combines two or more semantic retrieval technologies into the same algorithm. Since different semantic retrieval methods have different focuses or preferences when capturing semantic features, the retrieval results based on a single semantic retrieval method may have misunderstandings, which may lead to omissions in the retrieved information.

[0083] It can be understood that hybrid semantic retrieval integrates retrieval results from different retrieval directions by combining multiple semantic retrieval technologies, making it easier for the intelligent agent to adapt to retrieval in different semantic scenarios, greatly enhancing the intelligent agent's ability to understand user query instructions, and improving the comprehensiveness and accuracy of the retrieval results returned by the intelligent agent.

[0084] As an optional implementation, hybrid semantic retrieval combines the two semantic retrieval technologies of BM25 and Embedding to retrieve the initial event set, effectively combining the accuracy of BM25 retrieval and the fuzzy semantic understanding ability of Embedding retrieval in the retrieval.

[0085] See also Figure 5 , further, step S4 specifically includes the following steps: S41: Based on the user query instruction and the user time semantics, the retrieved event set is comprehensively scored.

[0086] It can be understood that the comprehensive score is based on the semantic relevance of each retrieval result to the user's query instruction, the time constraint of the user's time semantics, and the contextual intention relevance of the user's conversation, and further analyzes the user's specific needs and makes a comprehensive score based on the specific needs.

[0087] For example, when the user's retrieval target is a time-sensitive task, the agent uses time constraints as the main scoring criterion and gives higher scores to event information that meets the timeliness requirements.

[0088] S42: Calculate the recall confidence of the retrieval event set, and automatically narrow or expand the retrieval scope in the external memory bank and / or the dialogue memory bank according to the recall confidence.

[0089] It can be understood that when the recall confidence of the retrieval event set is concentrated in a few events, the intelligent agent automatically narrows the retrieval scope in the external memory library and / or the dialogue memory library to improve the retrieval accuracy; when the recall confidence is dispersed in most events, the intelligent agent automatically expands the retrieval scope in the external memory library and / or the dialogue memory library to enhance the recall coverage and avoid missing relevant retrieval results.

[0090] S43: Based on the comprehensive score, the events in the retrieved event set are sorted to obtain a sorted event set.

[0091] As an optional implementation, the agent uses a rerank algorithm to sort the retrieval event set and sets an upper limit value to obtain the events with the highest scores as the retrieval event set, and the number of events contained in the retrieval event set is equal to the upper limit value.

[0092] For example, if a user enters the query command: "What is the revenue in the first half of 2024?", the agent first determines whether the query content needs to be retrieved. If the query content requires searching the external memory bank and the dialogue memory bank, it performs the following steps: Extract the time semantic information in the user query command to obtain the user time semantics: {"2024 first half year revenue", "2024-01-01", "2024-06-30"}; Search the conversation memory and external memory separately, retain events with overlapping time intervals after filtering based on temporal semantics, and obtain the most relevant retrieval event set based on two semantic retrieval technologies: BM25 and Embedding. The retrieved event set is recalled and the recall results are re-ranked to obtain the five records with the highest comprehensive scores as the ranked event set. Understandably, since the user's retrieval goal is a time-sensitive task, in this scenario, the agent uses time constraints as the main scoring criterion and gives higher scores to event information that meets timeliness. The sorted event set is added to the context window of the large language model to obtain refined sorted context window information, and then the dialogue reply is obtained and responded to the user based on the refined sorted context window information.

[0093] It can be understood that after analyzing the specific needs of the user, the intelligent agent selects events that are more relevant to the needs for recall and obtains a retrieval event set, effectively filtering out a large amount of irrelevant information that has low relevance to the user's needs, thereby improving the accuracy and computational efficiency of the intelligent agent's retrieval results.

[0094] Understandably, the sorting information in the sorted event set also provides the logical order and coherence between events, which helps the intelligent agent understand and think about the relationship between events and user needs, thereby enhancing the logic and accuracy of the intelligent agent's subsequent dialogue responses.

[0095] Furthermore, in step S43, the retrieved event set merges the events from the external memory and the events from the dialog memory, and then sorts them together to obtain a sorted event set.

[0096] It is understandable that, on the one hand, merging the events in the two memory banks before recalling them helps improve recall efficiency, reduce computing resource consumption, and improve the real-time performance of the intelligent agent; on the other hand, the merged recall covers a wider range of data information, and the event sets from the external memory bank and the dialogue memory bank complement each other, making it easier for the intelligent agent to find potential connections between the two, thereby effectively enhancing the relevance of the recall results to the specific needs of users.

[0097] A second embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When executed by a processor, the computer program implements any of the agent dialogue generation methods described in the first embodiment. This method has the same beneficial effects as the agent dialogue generation method described in the first embodiment and is not further described here.

[0098] In the embodiments provided herein, it should be understood that "B corresponding to A" means that B is associated with A and B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B based solely on A; B can also be determined based on A and / or other information.

[0099] It should be understood that references to "one embodiment" or "an embodiment" throughout this specification mean that specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present invention. Therefore, the phrases "in one embodiment" or "in an embodiment" appearing throughout this specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. Those skilled in the art should also be aware that the embodiments described in this specification are all optional embodiments, and the actions and modules involved are not necessarily required for the present invention.

[0100] In various embodiments of the present invention, it should be understood that the size of the serial numbers of the above-mentioned processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0101] The flow charts and block diagrams in the accompanying drawings of the present invention illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementation schemes, the functions marked in the box can also occur in a different order than those marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which is determined based on the functions involved. It should be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.

[0102] The above is a detailed introduction to the intelligent agent dialogue generation method and storage medium disclosed in the embodiment of the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. At the same time, for general technical personnel in this field, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention. Any modifications, equivalent replacements and improvements made within the principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for generating intelligent agent dialogue, characterized in that: The following steps are involved: Build external memory and conversational memory; Obtaining a user query instruction, and determining whether the user query content requires searching the external memory bank and / or the conversation memory bank; If so, perform the following steps: extract the time semantic information in the user query instruction to obtain the user time semantics; Based on the user query instruction and the user time semantics, searching the external memory and / or the conversation memory to obtain a retrieval event set; Recalling the retrieved event set, sorting the recall results to obtain a sorted event set, and adding the sorted event set to the context window of the large language model to obtain refined sorted context window information; Based on the refined sorted context window information, a dialogue reply is given.

2. The agent dialogue generation method according to claim 1, wherein: After determining whether the content of the user query requires searching the external memory and / or the conversation memory, the method further includes: If not, the user query instruction is input into the large language model to directly obtain the dialogue response of the large language model.

3. The agent dialogue generation method according to claim 1, wherein: Constructing external memory and dialogue memory specifically includes: Obtaining external document input, parsing the input external document, extracting time semantic information from the external document, obtaining external memory with time semantic information, and storing the obtained data in the external memory bank; The conversation history of the last conversation of the intelligent agent is obtained, and the time semantic information in the conversation history is extracted to obtain the conversation memory with the time semantic information and store it in the conversation memory bank.

4. The agent dialogue generation method according to claim 3, wherein: The external memory and the dialogue memory are stored in the external memory bank and the dialogue memory bank respectively in the form of standard key-value pairs.

5. The agent dialogue generation method according to claim 3, wherein: Obtaining the conversation history of the agent's last conversation specifically includes: The user query instructions and dialogue replies are collected and sorted to obtain a dialogue history.

6. The agent dialogue generation method according to claim 3, wherein: Obtain the conversation history of the agent's last conversation and extract the temporal semantic information from the conversation history, specifically including: Extracting the conversation occurrence time in the conversation history, and using a sliding window strategy to mark it, obtaining a context time anchor consisting of the window size and time range of the conversation history; The conversation mention time in the conversation history is extracted, and information is extracted through a large language model to obtain a semantic time anchor consisting of the mentioned events in the conversation history and their start and end times.

7. The agent dialogue generation method according to claim 1, wherein: Based on the user query instruction and the user time semantics, searching the external memory and / or the conversation memory to obtain a retrieval event set specifically includes the following steps: Obtaining the time range involved in the user's time semantics, using a time-sensitive filtering strategy to match events that have an intersection with the time intervals in the external memory and / or the conversation memory to obtain an initial event set; Based on the user query instruction, a hybrid semantic retrieval strategy is used on the initial event set to sort out the retrieval results and obtain a retrieval event set.

8. The agent dialogue generation method according to claim 1, wherein: Recalling the retrieved event set and then sorting the recall results to obtain the sorted event set specifically includes the following steps: Based on the user query instruction and the user time semantics, comprehensively scoring the retrieved event set; Calculating a recall confidence of the retrieval event set, and automatically narrowing or expanding a retrieval scope in the external memory and / or the conversation memory according to the recall confidence; Based on the comprehensive score, the events in the retrieved event set are sorted to obtain the sorted event set.

9. The agent dialogue generation method according to claim 8, wherein: Sorting the events in the retrieved event set to obtain the sorted event set specifically includes: The retrieval event set combines the events from the external memory and the events from the dialogue memory, and then sorts them together to obtain the sorted event set.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the agent dialogue generation method as described in any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Generative dialog system and method

    CN118964564A

  • Memory recall method based on large language model and related device

    CN119202180A

  • Intelligent retrieval and question answering method and device

    CN119293207A

  • Information retrieval method, device and equipment, readable storage medium and program product

    CN119557462A

  • Information retrieval enhancement method and system based on multi-path recall mode

    CN119597862A