Intelligent agent processing method and device, equipment and storage medium
By obtaining target sample problem and interface feature data, fine-tuning the agent and generating API call programs, the agent solves the agent's difficulties in understanding and generating API call code, and improves task processing capabilities and user experience.
Patent Information
- Application Number
- CN202411826138.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-12-11
AI Technical Summary
Existing agents have difficulties in understanding and generating API call code, especially for complex APIs or APIs that require specific parameters, and require more data when adapting to different tasks and environments, which have security and reliability issues.
By obtaining multiple target sample problems and interface feature data of target interfaces belonging to the target intention category, fine-tuning the adjustable parameters in the preset agent to generate an interface call program that can call the target interface.
It improves the agent's understanding and task processing capabilities of tasks, improves the user experience, and effectively avoids environmental mismatch and security problems caused by autonomous generation of API calls.
Smart Images

Figure CN119808940A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to technical fields such as deep learning and large models. Background Art
[0002] Large Language Model (LLM) has made remarkable progress in the field of natural language processing, demonstrating powerful learning and generation capabilities.
[0003] In existing solutions, in order to meet the different reasoning needs of users, intelligent agent technology has emerged. For example, in practical applications, large models with different reasoning capabilities (or different functions) can be encapsulated into different intelligent agents and presented to end users in the form of intelligent agents to improve user experience. Although existing intelligent agents can perform user tasks to a certain extent, they are still challenging. Summary of the invention
[0004] The present invention provides a method, device, equipment and storage medium for processing an intelligent agent.
[0005] According to one aspect of the present disclosure, there is provided a method for processing an intelligent agent, comprising:
[0006] Obtain multiple target sample questions belonging to the target intent category;
[0007] Obtain interface feature data of a target interface that needs to be called to answer questions belonging to the target intent category;
[0008] Based on the multiple target sample questions and the interface feature data of the target interface, at least some of the adjustable parameters in the preset agent are fine-tuned to obtain a target agent that can call the target interface to answer questions belonging to the target intent category.
[0009] According to another aspect of the present disclosure, there is provided a processing device for an intelligent agent, comprising:
[0010] A sample processing unit, used to obtain a plurality of target sample questions belonging to a target intent category; and to obtain interface feature data of a target interface required to be called to answer questions belonging to the target intent category;
[0011] An agent training unit is used to fine-tune at least some of the adjustable parameters in the preset agent based on the multiple target sample questions and the interface feature data of the target interface, so as to obtain a target agent that can call the target interface to answer questions belonging to the target intention category.
[0012] According to another aspect of the present disclosure, there is provided an electronic device, comprising:
[0013] at least one processor; and
[0014] a memory communicatively connected to the at least one processor; wherein,
[0015] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute any method in the embodiments of the present disclosure.
[0016] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any method according to the embodiments of the present disclosure.
[0017] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, which implements any method according to the embodiments of the present disclosure when executed by a processor.
[0018] In this way, the disclosed solution can utilize multiple target sample questions belonging to the target intent category and the interface feature data of the target interface to fine-tune the preset intelligent agent. In this way, the target intelligent agent obtained after fine-tuning can have the ability to call the target interface. In other words, it can automatically generate an interface calling program for calling the target interface, thereby effectively improving the intelligent agent's ability to understand the task. At the same time, it also further improves the task processing capability of the intelligent agent, thereby further improving the user experience.
[0019] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0021] Figure 1 This is a schematic flow chart of a processing method of an intelligent agent according to an embodiment of the present application. Figure 1 ;
[0022] Figure 2 This is a schematic flow chart of a processing method of an intelligent agent according to an embodiment of the present application. Figure 2 ;
[0023] Figure 3 is a flowchart of a processing method of an intelligent agent in a specific example according to an embodiment of the present application;
[0024] Figure 4 is a schematic diagram of the structure of a processing device of an intelligent agent according to an embodiment of the present application;
[0025] Figure 5 It is a block diagram of an electronic device used to implement the processing method of the intelligent agent of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0027] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The term "at least one" in this article means any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C. The terms "first" and "second" in this article refer to multiple similar technical terms and distinguish them. They do not mean to limit the order or to limit them to only two. For example, the first feature and the second feature refer to two types / two features. The first feature can be one or more, and the second feature can also be one or more.
[0028] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the specific embodiments below. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the main purpose of the present disclosure.
[0029] The following is a description of the related technologies of the embodiments of the present disclosure. The following related technologies are optional solutions that can be arbitrarily combined with the technical solutions of the embodiments of the present disclosure, and they all belong to the protection scope of the embodiments of the present disclosure.
[0030] In order to perform the tasks required by the user, LLM needs to interact with external tools or application programming interfaces (APIs) to combine external capabilities to complete the tasks required by the user. For example, in the map's artificial intelligence (AI) wizard system, LLM may need to call the weather API to obtain weather information, or LLM may also call the Point of Interest (POI) query API to obtain information about places of interest to the user.
[0031] Although LLM has made some progress in generating API call code and creating tools, there are still some challenges. For example, LLM still has difficulties in understanding and generating API call code, especially for complex APIs or APIs that require specific parameters. In addition, in order to enable LLM to adapt to different tasks and environments, LLM also needs more data in creating and customizing tools. In addition, LLM may also have security and reliability issues when generating API call code or creating tools.
[0032] Based on this, the disclosed solution proposes a method for processing an intelligent agent, which can use the data pair of "multiple sample questions belonging to the new intent category - interface feature data of the new API" to fine-tune the intelligent agent so that the adjusted intelligent agent has the ability to call the new API. In other words, when the fine-tuned intelligent agent needs to call the new API, it can define parameters based on the interface feature data of the new API and generate API call code, thereby borrowing external capabilities to complete the tasks required by the user. In this way, on the one hand, the task processing capability of the intelligent agent is improved, and on the other hand, the user experience is also improved.
[0033] Specifically, Figure 1 This is a schematic flow chart of a processing method of an intelligent agent according to an embodiment of the present application. Figure 1 The method may be optionally applied to electronic devices, such as personal computers, servers, server clusters, and other electronic devices.
[0034] Further, the method includes at least part of the following contents. Figure 1 As shown, including:
[0035] Step S101: Obtain multiple target sample questions belonging to the target intent category.
[0036] Step S102: Obtain interface feature data of the target interface required to be called to answer questions belonging to the target intent category.
[0037] Here, the interface characteristic data of the target interface may specifically include interface parameter data of the target interface, for example, function definition and function parameters of the target interface.
[0038] It should be noted that the "interface" (such as the target interface) described in the disclosed solution may be an application programming interface (API) for providing specified functional services, such as a weather API for obtaining weather information, a POI query API for obtaining information about places of interest, etc. Further, the disclosed solution does not impose specific restrictions on the specific functional services to be implemented by the target interface.
[0039] Step S103: Based on the multiple target sample questions and the interface feature data of the target interface, fine-tune at least some of the adjustable parameters in the preset agent to obtain a target agent that can call the target interface to answer questions belonging to the target intent category.
[0040] For instance, in one example, after obtaining the target intelligent agent, the target intelligent agent can automatically generate interface parameter data of the target interface, such as generating function definitions and function parameters, when it is determined that the target interface needs to be called based on the question-and-answer task input by the user, so as to automatically generate an interface calling program for calling the target interface using the generated function definitions and function parameters, and then use the generated interface calling program to call the target interface, thereby using the capabilities of the called target interface to complete the question-and-answer task and generate and output the target question-and-answer result.
[0041] Here, the preset agent may be specifically a virtual agent or a software agent, for example, an intelligent system that can perform reasoning based on a specified task input by a user using a built-in knowledge base and reasoning mechanism to achieve a specific goal.
[0042] Furthermore, the preset agent may be encapsulated with a large model having a specified reasoning capability, where the large model may include a large language model LLM, a generative model, etc. The disclosed solution does not limit the specific large model encapsulated by the preset agent. Furthermore, the disclosed solution does not limit the number of large models encapsulated by the preset agent, for example, one or more may be encapsulated based on the specific functions to be implemented.
[0043] In this way, the disclosed solution can utilize multiple target sample questions belonging to the target intent category and the interface feature data of the target interface to fine-tune the preset intelligent agent. In this way, the target intelligent agent obtained after fine-tuning can have the ability to call the target interface. In other words, it can automatically generate an interface calling program for calling the target interface, thereby effectively improving the intelligent agent's ability to understand the task. At the same time, it also further improves the task processing capability of the intelligent agent, thereby further improving the user experience.
[0044] Furthermore, since the new API discovery capability of the intelligent agent in the disclosed scheme is trained based on the data pairs of "multiple target sample questions belonging to the target intent category - interface feature data of the target interface", compared to the existing intelligent agent scheme that autonomously generates new API call programs based on task understanding, the disclosed scheme effectively increases the new API discovery capability of the intelligent agent, while effectively avoiding the problems of environmental incompatibility, unsafe and unreliable APIs called, etc. caused by autonomous generation. At the same time, it also effectively avoids the problems of inability to respond to user questions and answers, or unreasonable answers, due to unreasonable APIs called.
[0045] For example, in the map application business scenario, since the disclosed solution can utilize the data pairs of "multiple target sample questions belonging to the target intent category - interface feature data of the target interface" to fine-tune the online map business intelligent entity, thereby enabling it to have the ability to discover new APIs. This can significantly improve the intelligence level of map services, thereby providing users with richer and more personalized map services. At the same time, it effectively enhances the adaptive ability of the map business intelligent entity, enabling it to better adapt to various complex scenarios, thereby further improving the user experience.
[0046] In a specific example, the interface feature data of the target interface can be obtained in the following manner; specifically, the above-mentioned acquisition of the interface feature data of the target interface required to answer the question belonging to the target intent category (for example, step S102) can specifically include: based on multiple questions (queries) belonging to the target intent category, construct a target prompt word template (Prompt); the target prompt word template can guide the large model to generate the interface feature data of the target interface required to answer "multiple questions (queries) belonging to the target intent category"; further, the target prompt word template can also include prompt examples, such as examples of interface feature data of a preset interface, so as to facilitate guiding the large model to generate the required data. Further, after obtaining the target prompt word template, the large language model and the target prompt word template can be used to obtain the interface feature data of the target interface required to answer the question belonging to the target intent category.
[0047] For example, in one example, the target prompt word template may be specifically:
[0048] Prompt:
[0049] I am an engineer and researcher in AI map business of a high-tech enterprise.
[0050] The model can determine the intent based on the user's query and call the appropriate API (function) to help
[0051] To solve the problem, we now have two functions: search_for_poi() and
[0052] search_for_navi(). search_for_poi() can retrieve the existence of the given name.
[0053] Location, so as to facilitate various subsequent queries or distance calculations based on the location;
[0054] search_for_navi() is an API function used to search for routes, including driving, bus, subway, and cycling.
[0055] However, as the number of query types increases, when a new set of similar queries comes in,
[0056] I may need a new API (function) to customize the user's needs. Please follow my
[0057] A set of queries is provided, giving suggestions: new functions that I might need to construct and their requirements
[0058] What is the required input information and what the output information may be.
[0059] Queries:
[0060] 1. The restaurant between subway station A1, subway station A2 and residential area B?
[0061] 2. Is there a hotel with a rooftop swimming pool that is very convenient to attractions C1, C2 and C3?
[0062] 3. Help me find a tourist attraction that is close to Building D1, Airport E1 and Airport E2?
[0063] 4. My child and I came out of attraction C4, and my mother came to have dinner with us after shopping in F1. It would be best if we could find a restaurant where we can all arrive at the same time?
[0064] 5. Which scenic spot is about the same distance from Railway Station G1, Commercial District H1, and Railway Station G2?
[0065] 6. Please choose the best place to eat between Plaza I1 and Commercial District H2?
[0066] 7. Find a tourist attraction that is close to me and the commercial district H3?
[0067] The target prompt word template is concise and enables the large model to understand the current task context, generate thought chains, and give high-quality responses. For example, after inputting the target prompt template into the large language model, the following output can be obtained:
[0068] Consider developing a more general function to cover the needs of these queries, which can increase code reuse and simplify the structure of the API. I suggest developing a function called explore_poi() that can flexibly handle multiple types of queries and adjust its functions and outputs based on different input parameters. The following is a possible design of this function:
[0069] Function name: explore_poi()
[0070] enter:
[0071] Type (poi_type): The type of the point of interest, such as intersection, tourist attraction, school, city, etc.
[0072] Attributes: Query specific attributes, such as suitable for the elderly, flower viewing, summer vacation, etc.
[0073] Quantity: Optional, the quantity to be recommended.
[0074] Season: Optional, season-related queries.
[0075] Target group (target_group): Optional, target user group, such as the elderly, children, etc.
[0076] Output:
[0077] Location (location_info): If the query is related to a location, output detailed information about the location, such as location, nearby facilities, etc.
[0078] Recommendations: If the query is related to recommendations, output a list of recommendations, including place names, features, user reviews, etc.
[0079] Statistics: If the query involves statistical data, such as city population, output relevant statistical information.
[0080] Functional description:
[0081] General query processing: Based on the input poi_type and attributes, the function can flexibly adjust the query processing method.
[0082] Dynamic output: Dynamically generate output content based on the type of information required (location, recommendations, statistics).
[0083] This design enables functions to handle a variety of different types of queries without the need to develop a specific function for each query type. This makes the system more flexible and easier to maintain.
[0084] Furthermore, in a specific example, the disclosed solution can also evaluate the service performance of the target agent obtained after fine-tuning by using the problem solving rate, thereby providing a data basis for further optimization of the target agent. Specifically, for any given time t i , let the set of question requests be Q i , the number of successfully solved problem requests is recorded as Q good , the number of unsuccessful problem requests is recorded as Q bad , let the problem solving rate be ACC, then the problem solving rate (ACC) is:
[0085]
[0086] In this way, the service performance of the target agent can be obtained using the above formula.
[0087] Figure 2 This is a schematic flow chart of a processing method of an intelligent agent according to an embodiment of the present application. Figure 2 The method can be optionally applied to electronic devices, such as personal computers, servers, server clusters, and other electronic devices. It can be understood that the above Figure 1 The relevant contents of the method shown can also be applied to this example, and the relevant contents will not be described in detail in this example.
[0088] Further, the method includes at least part of the following contents. Figure 2 As shown, including:
[0089] Step S201: Obtain the initial intention feature of each initial sample question among multiple initial sample questions.
[0090] Step S202: Based on the initial intent feature, determine a plurality of suspected sample questions belonging to the target intent category from the plurality of initial sample questions.
[0091] Step S203: using the target large model, verifying the intent feature of each suspected sample question to remove the suspected sample questions that do not belong to the target intent category from the multiple suspected sample questions, and obtaining multiple target sample questions that belong to the target intent category.
[0092] It should be noted that, in this example, after obtaining the initial intention features of each initial sample problem, in order to improve the data quality of multiple target sample problems belonging to the target intention category, first, based on the initial intention features, multiple sample problems that are suspected of not belonging to the target intention category (ie, suspected sample problems) are determined from multiple initial sample problems; secondly, the intention features of each suspected sample problem are tested by utilizing the powerful reasoning, discovery and discrimination capabilities of the target large model; suspected sample problems that do not belong to the target intention category are eliminated to correct multiple suspected sample problems. In this way, multiple high-quality target sample problems belonging to the target intention category can be obtained, which provides data support for subsequent fine-tuning of at least some adjustable parameters of the preset intelligent agent.
[0093] Step S204: Obtain interface feature data of the target interface required to be called to answer questions belonging to the target intent category.
[0094] It should be noted that the relevant content about the target interface can be referred to the above example and will not be repeated here.
[0095] Step S205: Based on the multiple target sample questions and the interface feature data of the target interface, fine-tune at least some of the adjustable parameters in the preset agent to obtain a target agent that can call the target interface to answer questions belonging to the target intent category.
[0096] It should be noted that the relevant content about the intelligent agent can be referred to the above examples and will not be repeated here.
[0097] In this way, the disclosed solution can use the target large language model to perform secondary corrections on each suspected sample question determined from multiple initial sample questions, so as to obtain multiple high-quality target sample questions belonging to the target intent category, in other words, to obtain high-quality training data, thus providing data support for subsequent training to improve the intelligence level of the intelligent agent. Moreover, high-quality training samples can effectively ensure that the intelligent agent learns accurate and reliable information, thereby further improving the task processing capability of the intelligent agent, and further improving the user experience.
[0098] Further, in a specific example, the initial intention feature of each initial sample question may be obtained in the following manner; specifically, the above-mentioned obtaining the initial intention feature of each initial sample question in the multiple initial sample questions (for example, step S201) may specifically include:
[0099] The pre-trained initial intent recognition model is used to obtain the initial intent feature of each initial sample question in multiple initial sample questions.
[0100] For instance, in one example, each initial sample question can be input into a pre-trained Intent Bidirectional Encoder Representations from Transformers (IntentBert) model to obtain the initial intent features of each initial sample question. In this way, a powerful intent recognition model can be used to preliminarily obtain the intent semantic features, laying the foundation for subsequently obtaining multiple target sample questions belonging to the target intent category.
[0101] Furthermore, in a specific example, after obtaining the initial intent features of each initial sample question using the above-mentioned initial intent recognition model, multiple suspected sample questions belonging to the target intent category can also be determined in the following manner, thereby further improving the accuracy of the obtained suspected sample questions. Specifically, the above-mentioned determination of multiple suspected sample questions belonging to the target intent category from the multiple initial sample questions based on the initial intent features (for example, step S202) can be implemented by specifically using one of the following clustering methods:
[0102] Method 1: Clustering method based on neighbor contrast learning
[0103] Step S202a-1: Based on the initial intention feature, determine the positive samples of the initial sample questions and the negative samples of the initial sample questions from multiple initial sample questions.
[0104] Here, both the positive sample and the negative sample are one of the multiple initial sample problems. In other words, in this step, a positive sample of a specified initial sample problem (for example, a randomly specified initial sample problem) and a negative sample of the specified initial sample problem can be determined from the multiple existing initial sample problems, so that subsequent clustering processing provides data support.
[0105] Further, in a specific example, the positive sample and the negative sample of the initial sample question can be obtained in the following manner. Specifically, the above-mentioned determination of the positive sample of the initial sample question and the negative sample of the initial sample question from multiple initial sample questions based on the initial intent feature (for example, step S202a-1) can specifically include:
[0106] Step S202a-1-1: Based on the initial intention feature, determine the distance between different initial sample questions. For example, obtain the distance between different initial sample questions in the intention feature space.
[0107] Step S202a-1-2: Based on the distances between different initial sample problems, determine the positive samples of the initial sample problems and the negative samples of the initial sample problems.
[0108] For example, based on the initial intent features, the distance between two different initial sample problems among multiple initial sample problems in the intent feature space is determined, and then the distance between any two initial sample problems is obtained. Furthermore, for a specified initial sample problem, the N (N is a preset value) initial sample problems closest to it can be determined as positive samples of the specified initial sample problem. At the same time, the remaining other initial sample problems can be determined as negative samples of the specified initial sample problem. Based on this, a set of training data can be obtained, thereby providing data support for the subsequent training of the initial intent recognition model, and thus laying the foundation for improving the intent understanding and recognition capabilities of the intent recognition model.
[0109] Here, the “distance” in this example may specifically be Euclidean distance, etc., and the disclosed solution does not make any specific limitation on this.
[0110] In this way, the disclosed solution provides a refined solution for obtaining positive samples and negative samples of the initial sample problem. The solution is simple and efficient, which provides strong support for optimizing the intent understanding and recognition capabilities of the initial intent recognition model using the positive samples and negative samples of the initial sample problem, and then obtaining accurate suspected sample problems. At the same time, it also lays a foundation for further improving the task processing capabilities of the intelligent agent and thus improving the user experience.
[0111] Step S202a-2: Based on the initial sample question, the positive sample of the initial sample question and the negative sample of the initial sample question, the initial intent recognition model is trained to obtain a target intent recognition model.
[0112] Step S202a-3: Utilize the target intent recognition model to obtain the target intent feature of each of the multiple initial sample questions, so as to obtain multiple suspected sample questions belonging to the target intent category based on the target intent feature.
[0113] That is to say, in this example, the positive sample and negative sample of the initial sample problem can be obtained first, and then the positive sample and negative sample of the initial sample problem can be used as training data to further train the initial intent recognition model, so as to optimize the initial intent recognition model, further enhance the intent understanding and recognition capabilities of the initial intent recognition model, and thus obtain a target intent recognition model with more accurate output results. At this time, the target intent features of each initial sample problem obtained by using the optimized target intent recognition model are more accurately expressed, thus providing strong support for further improving the task processing capabilities of the intelligent agent and thus improving the user experience.
[0114] Further, in a specific example, the initial intent recognition model may be trained in the following manner; specifically, the training of the initial intent recognition model based on the initial sample question, the positive sample of the initial sample question, and the negative sample of the initial sample question (for example, step S202a-2) may specifically include:
[0115] Step S202a-2-1: Based on the initial sample problem, the positive sample of the initial sample problem and the negative sample of the initial sample problem, determine the distance between the initial sample problem and its positive sample, and the distance between the initial sample problem and its negative sample.
[0116] Step S202a-2-2: Perform comparative learning on the initial intent recognition model to reduce the distance between the initial sample problem and its positive sample and / or expand the distance between the initial sample problem and its negative sample.
[0117] For example, in one example, the initial intent recognition model can be compared and learned using the positive sample of the initial sample problem and the negative sample of the initial sample problem to reduce the distance between the initial sample problem and the positive sample; or, in another example, the initial intent recognition model can be compared and learned using the positive sample of the initial sample problem and the negative sample of the initial sample problem to expand the distance between the initial sample problem and the negative sample; or, in another example, the initial intent recognition model can be compared and learned using the positive sample of the initial sample problem and the negative sample of the initial sample problem to reduce the distance between the initial sample problem and the positive sample and expand the distance between the initial sample problem and the negative sample. In this way, the anti-interference ability of the intent recognition model to noise is enhanced, and the intent understanding and recognition ability of the intent recognition model is significantly improved, thereby providing strong support for the subsequent accurate identification and distinction of different intents.
[0118] Method 2: Top K similarity clustering method
[0119] Step S202b-1: Based on the initial intent features, obtain the intent similarity between different initial sample questions.
[0120] Step S202b-2: Based on the intent similarity, cluster the multiple initial sample questions to obtain multiple suspected sample questions belonging to the target intent category.
[0121] That is to say, in this example, first, the intent similarity between different initial sample questions is calculated based on the initial intent features; secondly, clustering is performed based on the intent similarity, so that multiple suspected sample questions belonging to the target intent category are obtained. For example, the K initial sample questions with the closest intent similarity are clustered into one cluster to obtain multiple clusters, and further, the intent classification of each cluster is determined. In this way, K initial sample data belonging to the target intent category can be obtained.
[0122] In this way, the disclosed scheme provides a refined scheme for clustering based on intent similarity to obtain multiple suspected sample problems belonging to the target intent category. The scheme is simple and efficient, and can quickly obtain multiple suspected sample problems belonging to the target intent category. This provides strong support for further improving the task processing capabilities of the intelligent agent and thereby improving the user experience.
[0123] The present disclosure is further described in detail below with reference to specific examples. The present disclosure provides a processing method for an intelligent agent. Specifically, firstly, in combination with an intent recognition model (corresponding to the initial intent recognition model described above), intent recognition is performed on initial question requests (corresponding to the initial sample questions described above) in a massive data set to obtain massive intent semantic representations (corresponding to the initial sample questions described above), and a clustering method is used to cluster the massive intent semantic features to obtain initial clustering results, and then the initial clustering results are corrected using the powerful reasoning and discrimination capabilities of the large language model to obtain multiple target question requests (corresponding to the target sample questions described above) belonging to a new intent category (corresponding to the target intent category described above); secondly, the powerful reasoning and discrimination capabilities of the large language model are again used to obtain target questions for solving new intent categories. The interface feature data of the target interface that needs to be called for the question request is inferred, for example, the function definition and function parameters of the general API (that is, the new API) that can solve the target question request belonging to the new intent category are inferred, so as to obtain the accurate function range definition and parameter information of the general API that solves the target question request belonging to the new intent category; finally, using the target question request belonging to the new intent category and the accurate function range definition of the general API that solves the target question request belonging to the new intent category, combined with the self-instruction method, a large number of training data pairs are generated (corresponding to the above multiple target sample questions and the interface feature data of the target interface), and then the preset intelligent agent is trained, so that the preset intelligent agent quickly has the ability to use the above new API, thereby improving the intelligence level of the intelligent agent and thus improving the user experience.
[0124] like Figure 3 As shown, the core steps of the disclosed solution include:
[0125] Step S301: Use the new intent recognition model (corresponding to the initial intent recognition model described above) to perform intent recognition on each initial question request in a massive intent data set to obtain initial intent features corresponding to each initial question request.
[0126] Here, the massive data set may specifically refer to a massive online log data set; the new intent recognition model may specifically be an IntentBert model, or may also be other intent recognition models, and the present disclosure does not impose any specific restrictions on this.
[0127] Step S302: Cluster each initial question request according to the initial intent feature to obtain an initial clustering result containing multiple clusters, each cluster corresponds to an intent category, and determine multiple candidate question requests belonging to the new intent category from the multiple clusters contained in the initial clustering result (corresponding to the multiple suspected sample questions belonging to the target intent category mentioned above).
[0128] Here, the clustering method described above may be a clustering method based on neighbor contrast learning, or may be a clustering method based on Top-K similarity sorting, and the present disclosure does not impose any specific limitation on this.
[0129] For example, in one example, after using the IntentBert model to obtain the initial intent features of each initial question request, positive samples and negative samples of the initial intent features are obtained according to the method of dividing the neighborhood, and a positive sample adjacency matrix is constructed based on the initial intent features and their positive samples, and a negative sample adjacency matrix is constructed based on the initial intent features and their negative samples. The IntentBert model is trained by comparative learning using the constructed positive sample adjacency matrix and negative sample adjacency matrix to obtain a trained IntentBert model; finally, the trained IntentBert model is used to perform intent identification on each initial question request again to obtain the target intent features of each initial question request, and then the initial clustering results are updated according to the target intent features of each initial question request to obtain multiple candidate question requests belonging to the new intent category.
[0130] Alternatively, in another example, after using the IntentBert model to obtain the initial intent features of each initial question request, the intent similarity between different initial question requests is obtained based on the initial intent features. At this time, the top K initial question requests with the closest intent similarity are determined as a cluster. In this way, the initial clustering results are obtained, and then multiple candidate question requests belonging to the new intent category are obtained.
[0131] Step S303: Use a large language model (corresponding to the target large language model described above) to perform intent verification on each candidate question request belonging to the new intent category, so as to complete the intent correction of multiple candidate question requests belonging to the new intent category, and obtain multiple target question requests belonging to the new intent category (corresponding to the multiple target sample questions belonging to the target intent category described above).
[0132] For instance, in one example, for one candidate question request among multiple candidate question requests belonging to a new intent category, the candidate question request is input into a large language model to utilize the powerful reasoning and discrimination capabilities of the large language model to identify the candidate question requests that do not belong to the new intent category from the multiple candidate question requests, and delete the candidate question requests that do not belong to the new intent category to obtain multiple target question requests belonging to the new intent category. In this way, the data quality of the question requests belonging to the new intent category is ensured, providing strong support for the subsequent improvement of the task processing capabilities of the intelligent agent.
[0133] Step S304: Utilizing a large language model and based on multiple target question requests belonging to the new intent category, infer the function definition and function parameters of a new API (corresponding to the target interface described above) that can answer the target question requests belonging to the new intent category, so as to generate a calling code for the new API that answers the target question requests of the new intent category.
[0134] Step S305: Based on multiple target question requests belonging to the new intent category and the interface feature data of the target API that answers the question requests of the new intent category (such as function definition and function parameters, etc.), and using the self-instruction method, a large number of high-quality training sample pairs are constructed.
[0135] Here, the training sample pair may specifically include the new intent category and the interface feature data of the target API corresponding to the new intent category; or, the training sample pair may specifically include the target question request belonging to the new intent category and the interface feature data of the target API required to call to answer the target question request. In this way, data support is provided for the subsequent parameter fine-tuning of the agent (also known as "empowerment processing of new functions").
[0136] Step S306: Using the large number of constructed training sample pairs, fine-tune at least part of the adjustable parameters in the agent so that the agent has the ability to call the new API.
[0137] Here, before fine-tuning the intelligent agent using a large number of constructed training sample pairs, the constructed training sample pairs can also be screened to select training sample pairs that meet the training requirements, and the screened training sample pairs are used to fine-tune the intelligent agent. In this way, the fine-tuned intelligent agent can have the ability to call the new API, thereby laying the foundation for providing more accurate personalized services.
[0138] In summary, the disclosed solution has the following advantages, including:
[0139] First, efficient processing of massive data. The disclosed solution provides a method of combining an enhanced new intent recognition model with a large model to obtain sample data for training intelligent agents. For example, a powerful new intent recognition model can be used to obtain more accurate intent features, and then the massive data can be preliminarily clustered according to the intent features to obtain clustering results. Finally, a powerful large language model can be used to test and screen the clustering results. In this way, efficient processing of massive data is achieved, and the sample data obtained after the above processing is of higher quality and lower cost.
[0140] Second, the empowerment of intelligent agents is more flexible. The disclosed solution is based on multiple target sample problems belonging to the new intent category, and combines a large language model to perform function discovery, definition, and parameter setting of the new API, so as to obtain the calling code of the new API required for the new intent category; further, according to the target sample problems of the new intent category and the interface feature data of the new API, a large number of training sample pairs are constructed, and the training sample pairs are used to empower the intelligent agent, so that the empowered intelligent agent has the ability to call the new API. This process automates the solution process of new requirements to the greatest extent, while minimizing labor costs, significantly improving the intelligence of the intelligent agent and improving the user experience.
[0141] Third, improve user experience. Since the disclosed solution can empower the intelligent agent with new functions, making the intelligent agent more intelligent and able to adapt to different tasks and environments, it can efficiently solve the continuous user needs and provide users with richer and more personalized services, thereby improving the user experience.
[0142] The disclosed solution also provides a processing device for an intelligent agent, such as Figure 4 As shown, including:
[0143] The sample processing unit 401 is used to obtain a plurality of target sample questions belonging to the target intent category; and obtain interface feature data of the target interface required to be called to answer the questions belonging to the target intent category;
[0144] The agent training unit 402 is used to fine-tune at least some of the adjustable parameters in the preset agent based on the multiple target sample questions and the interface feature data of the target interface, so as to obtain a target agent that can call the target interface to answer questions belonging to the target intention category.
[0145] In a specific example of the disclosed solution, the sample processing unit is specifically used to:
[0146] obtaining an initial intention feature of each of the multiple initial sample questions;
[0147] Based on the initial intent feature, determining a plurality of suspected sample questions belonging to the target intent category from the plurality of initial sample questions;
[0148] The target large model is used to verify the intention feature of each suspected sample question, so as to remove the suspected sample questions that do not belong to the target intention category from the multiple suspected sample questions, and obtain multiple target sample questions that belong to the target intention category.
[0149] In a specific example of the disclosed solution, the sample processing unit is specifically used to:
[0150] The pre-trained initial intent recognition model is used to obtain the initial intent feature of each initial sample question in multiple initial sample questions.
[0151] In a specific example of the disclosed solution, the sample processing unit is specifically used to:
[0152] Based on the initial intention feature, determine a positive sample of the initial sample question and a negative sample of the initial sample question from a plurality of initial sample questions; wherein the positive sample and the negative sample are both one of the plurality of initial sample questions;
[0153] Based on the initial sample problem, the positive sample of the initial sample problem and the negative sample of the initial sample problem, the initial intent recognition model is trained to obtain a target intent recognition model;
[0154] The target intent recognition model is used to obtain the target intent feature of each of the multiple initial sample questions, so as to obtain multiple suspected sample questions belonging to the target intent category based on the target intent feature.
[0155] In a specific example of the disclosed solution, the sample processing unit is specifically used to:
[0156] Based on the initial intention features, the distances between different initial sample questions are determined;
[0157] Based on the distances between different initial sample problems, positive samples of the initial sample problems and negative samples of the initial sample problems are determined.
[0158] In a specific example of the disclosed solution, the sample processing unit is specifically used to:
[0159] Based on the initial sample problem, the positive sample of the initial sample problem, and the negative sample of the initial sample problem, determining the distance between the initial sample problem and the positive sample, and the distance between the initial sample problem and the negative sample;
[0160] The initial intent recognition model is subjected to comparative learning to reduce the distance between the initial sample problem and the positive sample and / or to expand the distance between the initial sample problem and the negative sample.
[0161] In a specific example of the disclosed solution, the sample processing unit is specifically used to:
[0162] Based on the initial intent features, the intent similarity between different initial sample questions is obtained;
[0163] Based on the intent similarity, the multiple initial sample questions are clustered to obtain multiple suspected sample questions belonging to the target intent category.
[0164] For the description of the specific functions and examples of each unit of the device in the embodiment of the present disclosure, reference can be made to the relevant description of the corresponding steps in the above method embodiment, which will not be repeated here.
[0165] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0166] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0167] Figure 5 A schematic block diagram of an example electronic device 500 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0168] like Figure 5As shown, the device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0169] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0170] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above, such as the processing method of the agent. For example, in some embodiments, the processing method of the agent may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the processing method of the agent described above may be executed. Alternatively, in other embodiments, the computing unit 501 may be configured to execute the processing method of the agent by any other appropriate means (e.g., by means of firmware).
[0171] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0172] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0173] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0174] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0175] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0176] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0177] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0178] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for processing an intelligent agent, comprising: Obtain multiple target sample questions belonging to the target intent category; Obtain interface feature data of a target interface that needs to be called to answer questions belonging to the target intent category; Based on the multiple target sample questions and the interface feature data of the target interface, at least some of the adjustable parameters in the preset agent are fine-tuned to obtain a target agent that can call the target interface to answer questions belonging to the target intent category.
2. The method according to claim 1, wherein: The method of obtaining multiple target sample problems belonging to the target intent category includes: obtaining an initial intention feature of each of the multiple initial sample questions; Based on the initial intent feature, determining a plurality of suspected sample questions belonging to the target intent category from the plurality of initial sample questions; The target large model is used to verify the intention feature of each suspected sample question, so as to remove the suspected sample questions that do not belong to the target intention category from the multiple suspected sample questions, and obtain multiple target sample questions that belong to the target intention category.
3. The method according to claim 2, wherein: The obtaining of the initial intention feature of each of the multiple initial sample questions includes: The pre-trained initial intent recognition model is used to obtain the initial intent feature of each initial sample question in multiple initial sample questions.
4. The method according to claim 3, wherein: The step of determining a plurality of suspected sample questions belonging to a target intent category from the plurality of initial sample questions based on the initial intent feature includes: Based on the initial intention feature, determine a positive sample of the initial sample question and a negative sample of the initial sample question from a plurality of initial sample questions; wherein the positive sample and the negative sample are both one of the plurality of initial sample questions; Based on the initial sample problem, the positive sample of the initial sample problem and the negative sample of the initial sample problem, the initial intent recognition model is trained to obtain a target intent recognition model; The target intent recognition model is used to obtain the target intent feature of each of the multiple initial sample questions, so as to obtain multiple suspected sample questions belonging to the target intent category based on the target intent feature.
5. The method according to claim 4, wherein: The method of determining, based on the initial intention feature, a positive sample of the initial sample question and a negative sample of the initial sample question from a plurality of initial sample questions comprises: Based on the initial intention features, the distances between different initial sample questions are determined; Based on the distances between different initial sample problems, positive samples of the initial sample problems and negative samples of the initial sample problems are determined.
6. The method according to claim 4 or 5, wherein: The initial intent recognition model is trained based on the initial sample question, the positive sample of the initial sample question, and the negative sample of the initial sample question, including: Based on the initial sample problem, the positive sample of the initial sample problem, and the negative sample of the initial sample problem, determining the distance between the initial sample problem and the positive sample, and the distance between the initial sample problem and the negative sample; The initial intent recognition model is subjected to comparative learning to reduce the distance between the initial sample problem and the positive sample and / or to expand the distance between the initial sample problem and the negative sample.
7. The method according to claim 3, wherein: The step of determining a plurality of suspected sample questions belonging to a target intent category from the plurality of initial sample questions based on the initial intent feature includes: Based on the initial intent features, the intent similarity between different initial sample questions is obtained; Based on the intent similarity, the multiple initial sample questions are clustered to obtain multiple suspected sample questions belonging to the target intent category.
8. A processing device for an intelligent agent, comprising: A sample processing unit, used for obtaining a plurality of target sample questions belonging to a target intent category; and obtaining interface characteristic data of a target interface required to be called to answer questions belonging to the target intent category; An agent training unit is used to fine-tune at least some of the adjustable parameters in the preset agent based on the multiple target sample questions and the interface feature data of the target interface, so as to obtain a target agent that can call the target interface to answer questions belonging to the target intention category.
9. The device according to claim 8, wherein: The sample processing unit is specifically used for: obtaining an initial intention feature of each of the multiple initial sample questions; Based on the initial intent feature, determining a plurality of suspected sample questions belonging to the target intent category from the plurality of initial sample questions; The target large model is used to verify the intention feature of each suspected sample question, so as to remove the suspected sample questions that do not belong to the target intention category from the multiple suspected sample questions, and obtain multiple target sample questions that belong to the target intention category.
10. The device according to claim 9, wherein: The sample processing unit is specifically used for: The pre-trained initial intent recognition model is used to obtain the initial intent feature of each initial sample question in multiple initial sample questions.
11. The device according to claim 10, wherein: The sample processing unit is specifically used for: Based on the initial intention feature, determine a positive sample of the initial sample question and a negative sample of the initial sample question from a plurality of initial sample questions; wherein the positive sample and the negative sample are both one of the plurality of initial sample questions; Based on the initial sample problem, the positive sample of the initial sample problem and the negative sample of the initial sample problem, the initial intent recognition model is trained to obtain a target intent recognition model; The target intent recognition model is used to obtain the target intent feature of each of the multiple initial sample questions, so as to obtain multiple suspected sample questions belonging to the target intent category based on the target intent feature.
12. The device according to claim 11, wherein The sample processing unit is specifically used for: Based on the initial intention features, the distances between different initial sample questions are determined; Based on the distances between different initial sample problems, positive samples of the initial sample problems and negative samples of the initial sample problems are determined.
13. The device according to claim 11 or 12, wherein: The sample processing unit is specifically used for: Based on the initial sample problem, the positive sample of the initial sample problem, and the negative sample of the initial sample problem, determining the distance between the initial sample problem and the positive sample, and the distance between the initial sample problem and the negative sample; The initial intent recognition model is subjected to comparative learning to reduce the distance between the initial sample problem and the positive sample and / or to expand the distance between the initial sample problem and the negative sample.
14. The device according to claim 10, wherein: The sample processing unit is specifically used for: Based on the initial intent features, the intent similarity between different initial sample questions is obtained; Based on the intent similarity, the multiple initial sample questions are clustered to obtain multiple suspected sample questions belonging to the target intent category.
15. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
16. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.
17. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Information processing method and device, equipment and storage medium
CN117194620A
Intelligent domain matching method and system based on intention large model
CN117708286A
AI intelligent robot interaction processing method and device based on large language model
CN117709357A
Flood control scheduling rule question and answer recommendation method and system based on large language model
CN118069797A
Financial field intelligent question and answer method based on tool enhancement
CN118227766A