Question and answer method, device and equipment based on intelligent agent and medium
Through the agent-based question-and-answer method, the collaboration between the main agent and the response agent is solved, and the problem of low accuracy of question-and-answer dialogue in the prior art is achieved efficient processing and creative response to complex and unknown queries.
Patent Information
- Application Number
- CN202510205303.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-24
- Publication Date
- 2025-06-17
AI Technical Summary
Existing Q&A dialogue systems are less accurate when dealing with unknown or complex queries and are difficult to generate creative responses.
Using the agent-based question and answer method, the user input pending data is obtained through the main agent, and its target intention is determined, and the data is sent to the target response agent based on the correspondence between the pre-saved intention and the response agent. The target response agent processes the data based on the big model and feedbacks the results to the main agent.
Improves the accuracy of Q&A conversations, can handle complex and unknown queries, and generate creative responses.
Smart Images

Figure CN120162404A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular, to a question and answer method, device, equipment and medium based on an agent. Background Art
[0002] Current question and answer dialogue systems mainly include: rule-based question and answer dialogue systems and retrieval-based question and answer dialogue systems.
[0003] Among them, the rule-based question and answer dialogue system mainly relies on predefined rules and templates to generate responses. Its advantage is that it can provide accurate answers for preset questions and scenarios. The disadvantage is that it requires a large amount of manpower to write rules and templates, with low efficiency, and may encounter incorrect answers due to the lack of corresponding rules when dealing with unknown or complex queries.
[0004] The retrieval-based question and answer dialogue system mainly matches the most similar questions based on a question library, usually implemented using information retrieval technology. The advantage is that it performs well in dealing with common queries and can provide relatively accurate answers. The disadvantage is that it may not be able to generate new and creative responses, and has weak processing ability for questions not stored in the question library, and may give incorrect answers.
[0005] Therefore, how to improve the accuracy of question and answer dialogue has become an urgent problem to be solved. Summary of the Invention
[0006] Embodiments of this application provide a question and answer method, device, equipment and medium based on an agent to solve the problem of low accuracy of question and answer dialogue in the prior art.
[0007] In a first aspect, this application provides a question and answer method based on an agent, and the method includes:
[0008] The main agent obtains the data to be processed input by the user for the task to be executed in the first dialogue turn; determines the target intention of the data to be processed, and determines the target response agent corresponding to the target intention according to the pre-saved corresponding relationship between different intentions and response agents, and sends the data to be processed to the target response agent;
[0009] The target response agent processes the data to be processed based on the large model pre-configured by itself, obtains the processing result and feeds it back to the main agent;
[0010] The main agent receives the processing result and outputs it.
[0011] In a second aspect, this application provides a question and answer device based on an agent, and the device includes:
[0012] A determination module, configured to enable a main agent to obtain the data to be processed input by a user for a task to be executed in the first conversation turn; determine the target intent of the data to be processed, and determine the target response agent corresponding to the target intent according to the pre-saved correspondence between different intents and response agents, and send the data to be processed to the target response agent;
[0013] A processing module, configured to enable the target response agent to process the data to be processed based on a large model pre-configured by itself, obtain a processing result and feedback it to the main agent;
[0014] An output module, configured to enable the main agent to receive the processing result and output it.
[0015] In a third aspect, the present application further provides an electronic device, which includes a processor, and the processor is configured to implement the steps of the agent-based question-and-answer method as described in any one of the above when executing a computer program stored in a memory.
[0016] In a fourth aspect, the present application further provides a computer-readable storage medium, which stores a computer program, and the computer program is configured to implement the steps of the agent-based question-and-answer method as described in any one of the above when executed by a processor.
[0017] Since in the embodiment of the present application, the main agent obtains the data to be processed input by the user for the task to be executed in the first conversation turn; determines the target intent of the data to be processed, and determines the target response agent corresponding to the target intent among multiple response agents according to the pre-saved correspondence between different intents and response agents, and sends the data to be processed to the target response agent; the target response agent processes the data to be processed based on a large model pre-configured by itself, obtains a processing result and feedbacks it to the main agent; the main agent receives the processing result and outputs it, and uses the large model to process the data to be processed, improving the accuracy of question and answer. Description of the Drawings
[0018] In order to more clearly illustrate the technical solutions of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0019] Figure 1 It is a flowchart of an agent-based question-and-answer method provided by an embodiment of the present application;
[0020] Figure 2 It is a schematic diagram of the composition of an agent provided by an embodiment of the present application;
[0021] Figure 3 A schematic diagram of a question - answering interaction process based on an agent provided by an embodiment of the present application;
[0022] Figure 4 A schematic diagram of the interaction process between a main agent and a user provided by an embodiment of the present application;
[0023] Figure 5 A schematic diagram of the single - round conversation between a main agent and a response agent provided by an embodiment of the present application;
[0024] Figure 6 A schematic diagram of the multi - round conversation between a main agent and a response agent provided by an embodiment of the present application;
[0025] Figure 7 A schematic diagram of the structure of a question - answering device based on an agent provided by an embodiment of the present application;
[0026] Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0027] In order to make the objectives, technical solutions, and advantages of the present application clearer, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application belong to the scope of protection of the present application.
[0028] An embodiment of the present application provides a question - answering method, device, equipment, and medium based on an agent. In this method, the main agent obtains the data to be processed input by the user for the task to be executed in the first conversation round; determines the target intention of the data to be processed, and determines the target response agent corresponding to the target intention according to the pre - saved corresponding relationship between different intentions and response agents, and sends the data to be processed to the target response agent; the target response agent processes the data to be processed based on the large model pre - configured by itself, obtains the processing result and feeds it back to the main agent; the main agent receives the processing result and outputs it.
[0029] Figure 1 A flowchart of a question - answering method based on an agent provided by an embodiment of the present application, as Figure 1 shown, this question - answering method based on an agent may include the following steps:
[0030] S101: The main agent obtains the data to be processed input by the user for the task to be executed in the first conversation turn; determines the target intention of the data to be processed, and determines the target responding agent corresponding to the target intention according to the pre-saved correspondence between different intentions and responding agents, and sends the data to be processed to the target responding agent.
[0031] The question-answering method based on agents provided in this application is applied to an electronic device, which can be a server, a PC, a mobile terminal, etc.
[0032] In order to improve the accuracy of the Q&A dialogue, in the embodiments of this application, a large language model (LLM) can be used to determine the reply information corresponding to the user's question. For the convenience of description, the large language model will be abbreviated as the large model hereinafter. LLM, such as ChatGPT, etc., is a neural network model trained with a large amount of text data. It has powerful language understanding and generation capabilities and can have a smooth natural language dialogue with humans. Although LLM has strong natural language dialogue capabilities, it cannot execute any actions or instructions by itself. Therefore, in the embodiments of this application, an artificial intelligence agent (AI Agent) can be formed with LLM as the core, combined with a memory module, a planning module, and a tool module. For the convenience of description hereinafter, the artificial intelligence agent will be abbreviated as an agent. Figure 2 It is a schematic diagram of the composition of an agent provided in the embodiments of this application, as Figure 2 shown. The agent takes LLM as the core and uses the memory function, task planning function, and tool invocation function of LLM to complete the processing of tasks. The agent can not only have a dialogue with humans but also complete some instructions or tasks proposed by humans.
[0033] Currently, although agents have the ability to execute tasks, they still have significant limitations in complex scenarios. For example, the number of tasks that a single agent can support is relatively small. In view of this, the embodiments of this application propose a mode of multi-agent collaboration for question and answer, and this method can be similar to the teamwork mode of humans. Multi-Agent is composed of multiple independent agents, and each agent has an independent prompt, large language model, and corresponding tools. Conducting question and answer conversations based on multi-agents can solve the limitations faced by a single agent, provide a flexible and powerful solution for question and answer of complex problems, and has flexibility and maintainability, which is a key strategy for handling complex question and answer dialogue tasks. In the embodiments of this application, multiple agents can be used to process question and answer conversations. The agents used for question and answer conversations can be divided into two categories, namely the main agent and the ability agent. Among them, the main agent is subsequently referred to as the main intelligent agent, and the ability agent is also the response agent, which is subsequently referred to as the response intelligent agent. Among them, only one main intelligent agent needs to exist in the entire question and answer dialogue system. It is the intelligent agent that directly interacts with the user and is responsible for having a natural language conversation with the user. The main intelligent agent can identify the user's intention and call the corresponding response intelligent agent to complete the corresponding task. The response intelligent agent is mainly responsible for completing certain specific tasks or functions, and generally there are multiple in the entire question and answer dialogue system. Each response intelligent agent can independently complete one or a class of tasks. Different intelligent agents can be deployed in the same electronic device or can be deployed in different electronic devices in a distributed manner. In the embodiments of this application, the case where the main intelligent agent and the response intelligent agent are deployed in the same electronic device is taken as an example for illustration, but this does not mean that different intelligent agents cannot be deployed in different electronic devices.
[0034] When conducting a question and answer conversation, the main intelligent agent can obtain the data to be processed input by the user for the task to be executed in the first conversation turn. Since the task to be executed is obtained for the first time, in order to determine which response intelligent agent to use for task execution, in the embodiments of this application, when the main intelligent agent obtains the data to be processed in the first conversation turn, it can determine the target intention of the data to be processed. Among them, the target intention can be booking a train ticket, booking an air ticket, querying the time, querying the weather, etc. When determining the target intention of the data to be processed, the main intelligent agent can determine the target intention of the data to be processed based on a pre-trained model or based on pre-configured intention matching rules. For example, if the data to be processed contains words such as "train ticket", "railway ticket", "high-speed rail ticket", "bullet train ticket", etc., then it can be determined that the target intention of the data to be processed is booking a train ticket.
[0035] In order to determine which response agent is used to process the data to be processed for each intention, in the embodiments of the present application, the corresponding relationship between different intentions and response agents can be pre-saved. After determining the target intention of the data to be processed, the target response agent corresponding to the target intention can be determined according to the pre-saved corresponding relationship between different intentions and response agents. And the data to be processed is sent to the target response agent.
[0036] S102: The target response agent processes the data to be processed based on the large model pre-configured by itself, obtains a processing result and feeds it back to the main agent; the main agent receives the processing result and outputs it.
[0037] After receiving the data to be processed, the target response agent can process the data to be processed based on the large model pre-configured by itself to obtain a processing result. Exemplarily, the target response agent can splice the data to be processed with the pre-saved prompt words to obtain input data, and input the input data into the pre-configured large model. The large model determines the processing result based on the content included in the input data. The pre-saved prompt words can standardize the thinking of the large model when processing data, can also require the format of the output data of the large model, and can also require the tools called by the large model when performing task processing. Those skilled in the art can configure it according to needs.
[0038] After obtaining the processing result, the target response agent can feed back the processing result to the main agent. After receiving the processing result, the main agent can output the processing result. Exemplarily, the processing result can be displayed on the display screen or output in the form of voice broadcast.
[0039] Since in the embodiments of the present application, the main agent obtains the data to be processed input by the user for the task to be executed in the first conversation turn; determines the target intention of the data to be processed, and determines the target response agent corresponding to the target intention among multiple response agents according to the pre-saved corresponding relationship between different intentions and response agents, and sends the data to be processed to the target response agent; the target response agent processes the data to be processed based on the large model pre-configured by itself, obtains a processing result and feeds it back to the main agent; the main agent receives the processing result and outputs it, and uses the large model to process the data to be processed, which improves the accuracy of the question and answer.
[0040] In order to further improve the accuracy of the question and answer, on the basis of the above embodiments, in the embodiments of the present application, after the main agent receives the processing result and before outputting the processing result, the method further includes:
[0041] Determine the target dialogue type corresponding to the target intention according to the pre-saved correspondence between different intentions and dialogue types, where the target dialogue type is a single-round dialogue or a multi-round dialogue;
[0042] If the target dialogue type is a single-round dialogue, continue to execute the step of outputting the processing result.
[0043] Since it may not be possible to input all the data at once when proposing a task to be processed, the main agent needs to interact with the user in multiple rounds. In the embodiment of the present application, the correspondence between different intentions and dialogue types can be saved in advance. For example, the dialogue type corresponding to the intention of time query is a single-round dialogue, the dialogue type corresponding to the intention of date query is a single-round dialogue, and the dialogue type corresponding to the intention of booking tickets is a multi-round dialogue. Those skilled in the art can configure the dialogue types corresponding to different intentions as needed.
[0044] In order to determine whether the processing result currently fed back by the target response agent is the final processing result, in the embodiment of the present application, the target dialogue type corresponding to the target intention can be determined according to the correspondence between different intentions and dialogue types saved in advance. In other words, it is determined whether the target dialogue type corresponding to the target intention is a single-round dialogue or a multi-round dialogue.
[0045] If the target dialogue type is determined to be a single-round dialogue, then it means that the task to be executed can be completed after one processing. In the embodiment of the present application, it can be determined that the processing result fed back by the target response intelligent agent is the final processing result, and the subsequent steps of outputting the processing result can be continued.
[0046] In order to further improve the accuracy of question and answer, based on the above embodiments, in the embodiment of the present application, if the target dialogue type is a multi-round dialogue, the information fed back by the target response agent to the main agent also includes the intermediate data required by the target response agent to process the task to be executed next;
[0047] After the master agent receives the processing result and before outputting the processing result, the method further includes:
[0048] The main agent determines and outputs the intermediate prompt word containing the intermediate data;
[0049] The main intelligent agent sends the intermediate data input by the user and the historical conversation content with the user as data to be processed to the target response intelligent agent, and continues to execute the steps of the target response intelligent agent processing the data to be processed based on its own pre-configured large model, obtaining the processing results and feeding back to the main intelligent agent, until the main intelligent agent determines that the task to be executed has been processed.
[0050] Since the large model deployed in the target response agent can know whether the processing result of the data to be processed is the final result when processing the data to be processed, in order to enable the main agent to also know whether the current processing result is the final result, in the embodiments of the present application, if the target dialogue type is a multi-round dialogue, when the target response agent feeds back information to the main agent, the information fed back not only includes the processing result, but also includes the intermediate data required by the target response agent for the next processing of the task to be executed. That is to say, the target response agent needs to inform the main agent of the intermediate data required next.
[0051] After receiving the processing result, before outputting the processing result, the main agent can obtain the intermediate data fed back by the target response agent, determine the intermediate prompt word containing the intermediate data and output it, so that the user can input the corresponding intermediate data based on the intermediate prompt word. Exemplarily, the received intermediate data can be directly used as the intermediate prompt word for output, or the intermediate prompt word can be concatenated with the prompt word pre-saved for the target intention, and the concatenated text can be determined as the intermediate prompt word, and those skilled in the art can configure it according to needs.
[0052] After receiving the intermediate data input by the user, the main agent can use the intermediate data and the historical dialogue content of the user for the task to be executed as the data to be processed, and send it to the target response agent, and continue to execute the step of the target response agent processing the data to be processed based on the large model pre-configured by itself to obtain the processing result and feed it back to the main agent until the main agent determines that the task to be executed is processed.
[0053] In order to further improve the accuracy of the question and answer, on the basis of the above embodiments, in the embodiments of the present application, the main agent determines that the task to be executed is processed, including:
[0054] If the intermediate data fed back by the target response agent received by the main agent is empty, it is determined that the task to be executed is processed.
[0055] If the processing result currently obtained by the target response agent is the final processing result of the task to be executed, then when the target response agent feeds back information to the main agent, the intermediate data fed back can be set to be empty. When the main agent determines whether the task to be executed is processed, it can judge whether the intermediate data is empty. If so, it can be determined that the task to be executed is processed.
[0056] To further improve the accuracy of question answering, based on the above embodiments, in the embodiments of the present application, if the target response agent is a task-based agent, the target response agent processes the data to be processed based on a pre-configured large model of its own to obtain a processing result, including:
[0057] The target response agent, based on the large model, calls the task processing tool corresponding to the pre-configured target intent;
[0058] The large model processes the data to be processed based on the task processing tool to obtain the processing result.
[0059] Since users may ask various forms of questions during the question-answering process, in the embodiments of the present application, response agents of different forms can be pre-configured. In the embodiments of the present application, the types of response agents can be divided into: task-based agents and knowledge Q&A agents. Among them, task-based agents are used to complete a specific interaction task, such as completing payment, hotel reservation, generating a travel plan, etc. This agent mainly utilizes the tool invocation ability of the LLM, and the LLM interacts with the user in multiple rounds to obtain necessary parameter information and invokes the corresponding tool to complete a specific task. Different from task-based agents, knowledge Q&A agents are only responsible for answering some questions of users without performing actions or completing tasks.
[0060] In the embodiments of the present application, if the target response agent is a task-based agent, then when the target response agent processes the data to be processed, it can call the task processing tool corresponding to the pre-configured target intent based on the large model. The large model then uses the task processing tool to process the data to be processed to obtain the processing result.
[0061] Specifically, task tool invocation prompt words can be pre-saved for each target intent. The task tool invocation prompt words are used to describe the various task processing tools that can be called when performing the task corresponding to the target intent, as well as the situations applicable to each task processing tool. For example, the task tool invocation prompt words can be: if you need to book a train ticket, you can call task processing tool A; if you need to change the train ticket, you can call task processing tool B; if you need to refund the train ticket, you can call task processing tool C, etc. The target response agent can input the task tool invocation prompt words and the received data to be processed into the large model together, and the large model determines the task processing tool corresponding to the target intent of the data to be processed based on the received data.
[0062] To further improve the accuracy of question answering, based on the above embodiments, in the embodiments of the present application, if the target response agent is a knowledge question answering agent, the target response agent processes the data to be processed based on a large model pre-configured by itself, and obtains a processing result, including:
[0063] The target response agent searches for target reference data matching the data to be processed in a preset database;
[0064] The target reference data and the data to be processed are input into the large model, and the large model determines the processing result corresponding to the data to be processed with reference to the content in the target reference data.
[0065] In the embodiments of the present application, if the target response agent is a knowledge question answering agent, then when the target response agent processes the data to be processed, it can search for target reference data matching the data to be processed in a preset database, and input the target reference data and the data to be processed into the large model. When the large model performs corresponding processing, it can refer to the content in the target reference data to determine the processing result corresponding to the data to be processed.
[0066] Specifically, the preset database can store the question-and-answer pairs corresponding to each historical task. When determining the target reference data, the question-and-answer pair with the highest similarity to the data to be processed can be searched in the preset database, and this question-and-answer pair is determined as the target reference data.
[0067] To further improve the accuracy of question answering, based on the above embodiments, in the embodiments of the present application, the searching for target reference data matching the data to be processed in the preset database includes:
[0068] If the target response agent is a domain knowledge question answering agent, then in the domain database configured for the target domain corresponding to the data to be processed, search for target reference data matching the data to be processed;
[0069] If the target response agent is an open-domain knowledge question answering agent, then search for target reference data matching the data to be processed on the Internet.
[0070] Although AI Agents centered around LLMs can not only communicate with humans but also perform some specific actions or tasks. However, the training data of current LLMs mainly comes from various publicly available text data, and they do not possess knowledge in some vertical domains and cannot provide effective answers. Usually, in practical business applications, such as in customer service Q&A dialogue systems, it is often necessary to answer some business-related questions or knowledge in specific domains for users. However, generally speaking, general LLMs do not have this business domain knowledge, that is, general large models cannot answer questions related to specific domain knowledge. In view of this, in the embodiments of this application, relevant contexts can be retrieved to assist in generating more accurate and coherent text. First, the user's question is used as the retrieval condition to retrieve in the private vertical domain knowledge base. Then, the retrieved knowledge is added to the prompt words of the LLM and provided to the LLM together. In this way, when the LLM answers the user's question, it can refer to the relevant knowledge retrieved, improving the dialogue answering effect of the LLM. Therefore, in the embodiments of this application, corresponding domain databases can be pre-configured for different domains, and corresponding domain knowledge Q&A agents can be configured for different domains. When the domain knowledge Q&A agent processes tasks, it searches for matching target reference data in the corresponding domain database. To provide a better experience for users, the Q&A dialogue system not only needs to be able to answer questions related to knowledge within the domain, but preferably also be able to answer questions related to knowledge outside the domain (out of domain), that is, open-domain Q&A. Therefore, in the embodiments of this application, an open-domain knowledge Q&A agent can also be integrated. The key of this agent is to endow the LLM with an Internet search tool. Before answering a question, it can first search the Internet for knowledge related to the data to be processed, and then make the large model refer to the search results to answer the question raised by the user, thereby realizing the open-domain Q&A ability.
[0071] In the embodiments of this application, if the target response agent is a domain knowledge Q&A agent, when the target response agent searches for target reference data matching the data to be processed in the preset database, it can search for target reference data matching the data to be processed in the domain database configured for the target domain corresponding to the data to be processed.
[0072] If the target response agent is an open-domain knowledge Q&A agent, when the target response agent searches for target reference data matching the data to be processed in the preset database, it can search the Internet for target reference data matching the data to be processed. Herein, "matching" can be understood as having a similarity greater than a preset threshold.
[0073] The following uses a specific embodiment to illustrate the Q&A process based on the agent. Figure 3 It is a schematic diagram of an agent-based Q&A interaction process provided by the embodiments of this application, asFigure 3 As shown, during the Q&A dialogue process, the user can interact with the main agent. After the main agent receives the data to be processed input by the user for the task to be executed in the first dialogue turn, it can identify the user's intention, determine the capable agent corresponding to the intention, and then call the determined capable agent to process the task. In the embodiments of the present application, the capable agents can include multiple types, namely: task agents, domain knowledge Q&A agents, and open-domain Q&A agents. Among them, multiple agents of the same type can be included. For example, Figure 3 As shown, there are multiple task agents.
[0074] Next, in combination with Figure 4 the Q&A process based on agents will be described. Figure 4 This is a schematic diagram of the interaction process between the main agent and the user provided by the embodiments of the present application. In the embodiments of the present application, the main agent is responsible for directly conducting natural language dialogue with the user. The response agent does not directly face the user. The main agent is responsible for managing and calling the response agent. In the embodiments of the present application, a mechanism for calling and interacting between the main agent and the response agent is established. Since the execution process of some response agents does not require any communication with the user, they can directly execute and feedback the processing results to the user after completion. However, during the execution process of some response agents, multiple dialogues with the user are required. In view of this, the main agent calls the response agent in two cases:
[0075] 1. Single-round call. The called response agent does not need to communicate with the user, directly execute, and feedback the processing results to the user.
[0076] 2. Multi-round call. The called response agent needs to obtain data provided by the user multiple times during the execution process.
[0077] Such as Figure 4As shown in the figure, the user can input the data to be processed corresponding to the first conversation turn for the task to be executed in the conversation window. The main agent can identify the user's target intention based on the user's input, and send the data to be processed to the target response agent corresponding to the target intention, so that the target response agent processes the data to be processed based on the pre-configured large model and feeds back the processing result to the main agent. The main agent determines the target conversation type corresponding to the target intention according to the pre-saved correspondence between different intentions and conversation types. If the target conversation type is a single-round conversation, that is, a single-round task, the processing result fed back by the target response agent can be directly output as the final execution result. If the target conversation type is a multi-round conversation, the main agent can create an independent session loop, then call the information fed back by the target agent, and determine whether the task is processed completely according to the intermediate data fed back by the target response agent. If it is not processed completely, that is, the execution is not ended, the intermediate prompt word containing the intermediate data can be determined according to the intermediate data and displayed in the conversation window, so that the user can input intermediate data according to the intermediate prompt word. After receiving the user's input, the main agent can send the intermediate data input by the user and the user's historical conversation content as the data to be processed to the target response agent, and continue to execute the steps of the target response agent processing the data to be processed based on its own pre-configured large model, obtaining the processing result and feeding it back to the main agent until the main agent determines that the task to be executed is processed completely.
[0078] Figure 5 This is a schematic diagram of the main agent and the response agent during a single-round conversation provided by an embodiment of the present application. As Figure 5 shown, the main agent can send the data to be processed input by the user for the task to be executed in the first conversation turn to the response agent, and the response agent feeds back the processing result to the main agent.
[0079] Figure 6 This is a schematic diagram of the main agent and the response agent during a multi-round conversation provided by an embodiment of the present application. As Figure 6 shown, the main agent can send the conversation context with the user to the response agent, and the response agent feeds back the processing result and / or the intermediate data required next to the main agent.
[0080] The question-and-answer process based on agents provided by the embodiments of the present application can adapt to diverse conversation needs, and the multi-Agent collaborative conversation system improves the ability to process complex tasks, optimizes the allocation and management of conversation tasks, and improves the conversation efficiency and user satisfaction. In addition, combining the LLM with the retrieval function significantly improves the accuracy and naturalness of knowledge question and answer in the field.
[0081] Figure 7 A schematic structural diagram of a question-and-answer device based on an agent provided by an embodiment of the present application is shown as Figure 7 shown, and the device includes:
[0082] A determination module 701, configured to obtain, by the main agent, the data to be processed input by the user for the task to be executed in the first conversation turn; determine the target intention of the data to be processed, and determine the target response agent corresponding to the target intention according to the pre-saved corresponding relationship between different intentions and response agents, and send the data to be processed to the target response agent;
[0083] A processing module 702, configured to process, by the target response agent, the data to be processed based on a large model pre-configured by itself, obtain a processing result and feedback it to the main agent;
[0084] An output module 703, configured to receive, by the main agent, the processing result and output it.
[0085] In a possible implementation manner, the determination module 701 is further configured to determine the target conversation type corresponding to the target intention according to the pre-saved corresponding relationship between different intentions and conversation types, where the target conversation type is a single-round conversation or a multi-round conversation;
[0086] The output module 703 is further configured to, if the target conversation type is a single-round conversation, continue to execute the step of outputting the processing result.
[0087] In a possible implementation manner, if the target conversation type is a multi-round conversation, the information fed back by the target response agent to the main agent further includes the intermediate data required for the target response agent to process the next task to be executed;
[0088] The determination module 701 is further configured to determine and output, by the main agent, an intermediate prompt word containing the intermediate data; the main agent uses the intermediate data input by the user and the historical conversation content with the user as the data to be processed and sends it to the target response agent, and continues to execute the step of the target response agent processing the data to be processed based on a large model pre-configured by itself, obtaining a processing result and feedbacking it to the main agent until the main agent determines that the task to be executed is processed.
[0089] In a possible implementation manner, the determination module 701 is specifically configured to, if the intermediate data fed back by the target response agent received by the main agent is empty, determine that the task to be executed is processed.
[0090] In a possible implementation, if the target response agent is a task-based agent, the processing module 702 is specifically configured to enable the target response agent to call the task processing tool corresponding to the target intent pre-configured based on a large model; the large model processes the data to be processed based on the task processing tool to obtain the processing result.
[0091] In a possible implementation, if the target response agent is a knowledge Q&A-based agent, the processing module 702 is specifically configured to enable the target response agent to search for target reference data matching the data to be processed in a preset database; input the target reference data and the data to be processed into the large model, and the large model determines the processing result corresponding to the data to be processed with reference to the content in the target reference data.
[0092] In a possible implementation, the processing module 702 is specifically configured to, if the target response agent is a domain knowledge Q&A-based agent, search for target reference data matching the data to be processed in the domain database configured for the target domain corresponding to the data to be processed; if the target response agent is an open-domain knowledge Q&A-based agent, search for target reference data matching the data to be processed on the Internet.
[0093] Based on the above embodiments, an embodiment of the present application further provides an electronic device. Figure 8 The following is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As Figure 8 shown, it includes: a processor 801, a communication interface 802, a memory 803, and a communication bus 804. Among them, the processor 801, the communication interface 802, and the memory 803 communicate with each other through the communication bus 804.
[0094] A computer program is stored in the memory 803. When the program is executed by the processor 801, the processor 801 is caused to execute the following steps:
[0095] The main agent obtains the data to be processed input by the user for the task to be executed in the first conversation turn; determines the target intent of the data to be processed, and determines the target response agent corresponding to the target intent according to the pre-saved correspondence between different intents and response agents, and sends the data to be processed to the target response agent.
[0096] The target response agent processes the data to be processed based on the large model pre-configured by itself to obtain a processing result and feeds it back to the main agent.
[0097] The main agent receives the processing result and outputs it.
[0098] In a possible implementation, after the main agent receives the processing result and before outputting the processing result, the method further includes:
[0099] Determine the target dialogue type corresponding to the target intention according to the pre - saved correspondence between different intentions and dialogue types, where the target dialogue type is a single - round dialogue or a multi - round dialogue;
[0100] If the target dialogue type is a single - round dialogue, continue to execute the step of outputting the processing result.
[0101] In a possible implementation, if the target dialogue type is a multi - round dialogue, the information fed back by the target response agent to the main agent further includes the intermediate data required by the target response agent to process the task to be executed next;
[0102] After the main agent receives the processing result and before outputting the processing result, the method further includes:
[0103] The main agent determines and outputs an intermediate prompt word containing the intermediate data;
[0104] The main agent sends the intermediate data input by the user and the historical conversation content with the user as the data to be processed to the target response agent, and continues to execute the step that the target response agent processes the data to be processed based on the large model pre - configured by itself, obtains the processing result and feeds it back to the main agent until the main agent determines that the task to be executed is processed.
[0105] In a possible implementation, the main agent determines that the task to be executed is processed, including:
[0106] If the intermediate data fed back by the target response agent received by the main agent is empty, the main agent determines that the task to be executed is processed.
[0107] In a possible implementation, if the target response agent is a task - type agent, the target response agent processes the data to be processed based on the large model pre - configured by itself to obtain the processing result, including:
[0108] The target response agent invokes the task processing tool corresponding to the target intention pre - configured based on the large model;
[0109] The large model processes the data to be processed based on the task processing tool to obtain the processing result.
[0110] In a possible implementation, if the target response agent is a knowledge Q&A agent, the target response agent processes the data to be processed based on a large model pre-configured by itself to obtain a processing result, including:
[0111] The target response agent searches for target reference data matching the data to be processed in a preset database;
[0112] The target reference data and the data to be processed are input into the large model, and the large model determines the processing result corresponding to the data to be processed with reference to the content in the target reference data.
[0113] In a possible implementation, the searching for target reference data matching the data to be processed in a preset database includes:
[0114] If the target response agent is a domain knowledge Q&A agent, search for target reference data matching the data to be processed in the domain database configured for the target domain corresponding to the data to be processed;
[0115] If the target response agent is an open-domain knowledge Q&A agent, search for target reference data matching the data to be processed on the Internet.
[0116] The communication bus mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity, only a thick line is shown in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface 802 is used for communication between the above electronic device and other devices. The memory may include a Random Access Memory (RAM), and may also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.
[0117] The above processor may be a general-purpose processor, including a central processing unit, a network processor (NP), etc.; it may also be a Digital Signal Processing (DSP), an application-specific integrated circuit, a field programmable gate array, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0118] Based on the above embodiments, an embodiment of the present invention further provides a computer-readable storage medium, in which a computer program executable by a processor is stored, so that when the processor executes, the following steps are implemented:
[0119] The main intelligent agent obtains the data to be processed input by the user for the task to be executed in the first conversation turn; determines the target intention of the data to be processed, and determines the target response intelligent agent corresponding to the target intention according to the pre-saved corresponding relationship between different intentions and response intelligent agents, and sends the data to be processed to the target response intelligent agent;
[0120] The target response intelligent agent processes the data to be processed based on the large model pre-configured by itself, obtains a processing result and feeds it back to the main intelligent agent;
[0121] The main intelligent agent receives the processing result and outputs it.
[0122] In a possible implementation manner, after the main intelligent agent receives the processing result and before outputting the processing result, the method further includes:
[0123] Determine the target conversation type corresponding to the target intention according to the pre-saved corresponding relationship between different intentions and conversation types, and the target conversation type is a single-round conversation or a multi-round conversation;
[0124] If the target conversation type is a single-round conversation, continue to execute the step of outputting the processing result.
[0125] In a possible implementation manner, if the target conversation type is a multi-round conversation, the information fed back by the target response intelligent agent to the main intelligent agent further includes the intermediate data required by the target response intelligent agent to process the next task to be executed;
[0126] After the main intelligent agent receives the processing result and before outputting the processing result, the method further includes:
[0127] The main intelligent agent determines and outputs an intermediate prompt word containing the intermediate data;
[0128] The main intelligent agent sends the intermediate data input by the user and the historical conversation content with the user as the data to be processed to the target response intelligent agent, and continues to execute the step that the target response intelligent agent processes the data to be processed based on the large model pre-configured by itself, obtains a processing result and feeds it back to the main intelligent agent until the main intelligent agent determines that the task to be executed is processed.
[0129] In a possible implementation, the determination by the main agent that the task to be executed is completed includes:
[0130] If the intermediate data fed back by the target response agent received by the main agent is empty, it is determined that the task to be executed is completed.
[0131] In a possible implementation, if the target response agent is a task-based agent, the target response agent processes the data to be processed based on a large model pre-configured by itself to obtain a processing result, including:
[0132] The target response agent, based on the large model, invokes the task processing tool corresponding to the pre-configured target intent;
[0133] The large model processes the data to be processed based on the task processing tool to obtain the processing result.
[0134] In a possible implementation, if the target response agent is a knowledge Q&A-based agent, the target response agent processes the data to be processed based on a large model pre-configured by itself to obtain a processing result, including:
[0135] The target response agent searches for target reference data matching the data to be processed in a preset database;
[0136] The target reference data and the data to be processed are input into the large model, and the large model determines the processing result corresponding to the data to be processed with reference to the content in the target reference data.
[0137] In a possible implementation, the search for target reference data matching the data to be processed in the preset database includes:
[0138] If the target response agent is a domain knowledge Q&A-based agent, search for target reference data matching the data to be processed in the domain database configured for the target domain corresponding to the data to be processed;
[0139] If the target response agent is an open-domain knowledge Q&A-based agent, search for target reference data matching the data to be processed on the Internet.
[0140] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0141] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one or more of the flows Figure 1 or a combination of flows and / or blocks
[0142] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in Figure 1 one or more of the flows Figure 1 or a combination of flows and / or blocks
[0143] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one or more of the flows Figure 1 or a combination of flows and / or blocks
[0144] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.
Claims
1. An agent-based question-answering method, characterized in that: The method comprises: The main agent obtains the data to be processed input by the user in the first dialogue round for the task to be executed; determines the target intention of the data to be processed, and determines the target response agent corresponding to the target intention according to the correspondence between different intentions and response agents saved in advance, and sends the data to be processed to the target response agent; The target response agent processes the data to be processed based on its own pre-configured large model, obtains the processing result and feeds it back to the main agent; The master agent receives the processing result and outputs it.
2. The method according to claim 1, characterized in that After the master agent receives the processing result and before outputting the processing result, the method further includes: Determine the target dialogue type corresponding to the target intention according to the pre-saved correspondence between different intentions and dialogue types, where the target dialogue type is a single-round dialogue or a multi-round dialogue; If the target dialogue type is a single-round dialogue, continue to execute the step of outputting the processing result.
3. The method according to claim 1, characterized in that If the target dialogue type is a multi-round dialogue, the information fed back by the target response agent to the master agent also includes intermediate data required by the target response agent to process the task to be executed next; After the master agent receives the processing result and before outputting the processing result, the method further includes: The main agent determines and outputs the intermediate prompt word containing the intermediate data; The main intelligent agent sends the intermediate data input by the user and the historical conversation content with the user as data to be processed to the target response intelligent agent, and continues to execute the steps of the target response intelligent agent processing the data to be processed based on its own pre-configured large model, obtaining the processing results and feeding back to the main intelligent agent, until the main intelligent agent determines that the task to be executed has been processed.
4. The method according to claim 3, characterized in that: The master agent determines that the pending task has been processed, including: If the intermediate data received by the master agent and fed back by the target response agent is empty, it is determined that the processing of the task to be executed is completed.
5. The method according to any one of claims 1 to 4, characterized in that: If the target response agent is a task-based agent, the target response agent processes the data to be processed based on its own pre-configured large model to obtain a processing result, including: The target response agent calls a pre-configured task processing tool corresponding to the target intent based on the large model; The large model processes the data to be processed based on the task processing tool to obtain the processing result.
6. The method according to any one of claims 1 to 4, characterized in that: If the target response agent is a knowledge question-answering agent, the target response agent processes the data to be processed based on its own pre-configured large model to obtain a processing result, including: The target response agent searches a preset database for target reference data that matches the data to be processed; The target reference data and the data to be processed are input into the large model, and the large model refers to the content in the target reference data to determine the processing result corresponding to the data to be processed.
7. The method according to claim 6, characterized in that The step of searching a preset database for target reference data matching the data to be processed includes: If the target response agent is a domain knowledge question-answering agent, searching for target reference data matching the data to be processed in a domain database configured for the target domain corresponding to the data to be processed; If the target response agent is an open domain knowledge question-answering agent, target reference data matching the data to be processed is searched on the Internet.
8. An agent-based question-answering device, characterized in that: The device comprises: The determination module is used for the main agent to obtain the data to be processed input by the user in the first dialogue round for the task to be executed; determine the target intention of the data to be processed, and determine the target response agent corresponding to the target intention according to the correspondence between different intentions and response agents saved in advance, and send the data to be processed to the target response agent; A processing module, used for the target response agent to process the data to be processed based on its own pre-configured large model, obtain the processing result and feed it back to the main agent; The output module is used for the main agent to receive and output the processing results.
9. An electronic device, characterized in that: The electronic device comprises a processor, and the processor is used to implement the steps of the agent-based question-answering method as claimed in any one of claims 1 to 7 when executing a computer program stored in a memory.
10. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed by a processor, implements the steps of the agent-based question-answering method as described in any one of claims 1 to 7.
Citation Information
Cited By
Intelligent session task processing method and system based on multi-model collaboration
CN120373469A
Large model task routing method, device and medium
CN120429307A
Large model task routing method, device and medium
CN120429307B
Multi-agent information processing method and device based on large model, electronic equipment, storage medium and program product
CN120763321A
Service request processing method and system, electronic equipment and computer program product
CN120956799A