Data generation method and device and demand processing method and device

By generating dialogue streams and response data that meet specific needs, and training language models, the limitations of language models in meeting user needs such as booking flights and hotels are addressed, improving the model's ability to call external tools and the controllability and fluency of data generation.

CN121660060APending Publication Date: 2026-03-13HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing language models have limitations in their ability to meet user needs such as booking flights and hotels, making it difficult to improve their expected capabilities through continued training data.

Method used

By generating dialogue streams and response data that meet specific needs, the language model is trained, including dialogue responses and tool call statements, ensuring data consistency and controllability, and improving the model's ability to call external tools.

Benefits of technology

The training effect of the language model is improved in the desired capability direction, the controllability and fluency of the generated data are enhanced, the correctness and diversity of the training data are ensured, and illusions are reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121660060A_ABST
    Figure CN121660060A_ABST
Patent Text Reader

Abstract

The data generation method and device and the model training method and device comprise the steps that a dialogue stream is generated according to a first demand, and the dialogue stream comprises a dialogue process meeting the first demand; generating first demand data according to the dialogue flow; and generating first response data according to the first demand data, wherein the first demand data and the first response data are used for training a language model. According to the scheme provided by the embodiment of the invention, on one hand, the training data (namely the first demand data and the first response data) capable of improving the ability of the trained language model in the direction of the first demand can be obtained, and compared with a demand data generation process which is not limited by a dialogue flow, the first demand is set according to the expected ability; the first demand data can improve the ability of the trained language model in an expected ability direction; and on the other hand, the dialogue process included in the dialogue flow can improve the controllability and smoothness of the data generation process, and the data generation process is optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, and more specifically, to a method for generating data, a method for training models, and an apparatus. Background Technology

[0002] Language models, using text as a medium, perform excellently on various text understanding and generation tasks. However, relying solely on a bare language model has clear limitations, such as being unable to fulfill user requests for booking flights and hotels. To enable language models to call external tools and expand their capabilities, they can be trained on data to learn how to utilize these tools.

[0003] However, the data currently generated for further training of language models is insufficient to improve the language models in the desired direction. Summary of the Invention

[0004] This application provides a method for generating data, a method and apparatus for processing requirements, and an apparatus for generating data that can be used to continue training a language model. The ability of the language model trained based on this data can be improved in the desired direction.

[0005] In a first aspect, a method for generating data is provided, comprising: generating a dialogue stream based on a first requirement, the dialogue stream including a dialogue flow conforming to the first requirement; generating first requirement data based on the dialogue stream; and generating first response data based on the first requirement data, wherein the first requirement data and the first response data are used to train a language model.

[0006] Based on the solution provided in the embodiments of this application, by generating first demand data according to the dialogue flow and generating first response data in response to the first demand data, since the dialogue flow generated according to the first demand has a limiting effect on the generation of the first demand data, on the one hand, training data (i.e., first demand data and first response data) that can improve the ability of the trained language model in the direction of the first demand can be obtained. Compared with the process of generating demand data without the limitation of the dialogue flow, the first demand data can improve the ability of the trained language model in the direction of the desired ability by setting the first demand according to the desired ability. On the other hand, the dialogue flow included in the dialogue flow can improve the controllability and fluency of the data generation process, which helps to optimize the data generation process.

[0007] In some possible implementations, the dialogue flow indicates the response method of the dialogue response; when the first response data includes dialogue response data, the first response data satisfies the response method; or, when the first response data includes tool call statement data, the tool call result data satisfies the response method, and the tool call result data is determined based on the tool call statement data.

[0008] Based on the solution provided in the embodiments of this application, by restricting the response method of the dialogue flow, the constraints on the dialogue process can be further strengthened, the controllability and smoothness of the data generation process can be further improved, and the performance of the data generation process can be improved.

[0009] In some possible implementations, generating first requirement data based on the dialogue flow includes: generating second requirements based on the dialogue flow; generating first requirement data based on the second requirement, wherein the first requirement data indicates the second requirement.

[0010] In some possible implementations, generating first requirement data based on the dialogue flow includes: generating third requirements based on the dialogue flow and dialogue history, where the dialogue history includes completed requirements and the third requirement represents the next requirement after the last requirement in the dialogue history; generating first requirement data based on the third requirement, where the first requirement data indicates the third requirement.

[0011] Based on the solution provided in the embodiments of this application, a second or third requirement indicated by the first requirement data is generated according to the dialogue flow and dialogue history. This can effectively generate the first requirement in the dialogue process, or the next requirement after the last requirement in the dialogue history, based on the dialogue flow, thereby improving the controllability and smoothness of the data generation process.

[0012] In some possible implementations, the first response data includes tool call statement data; generating the first response data based on the first requirement data includes: generating multiple tool call statements based on the first requirement data; and determining the tool call statement data based on the consistency of the multiple tool call statements.

[0013] Based on the solution provided in the embodiments of this application, by generating multiple tool call statements according to the first requirement data, and then determining tool call statement data including tool call statements that meet the consistency requirements, on the one hand, training data that can expand the capability boundary of the trained language model can be obtained, enabling the trained language model to call external tools; on the other hand, based on the consistency of multiple tool call statements, appropriate tool call statement data can be determined, improving the correctness of tool call statement data.

[0014] In some possible implementations, when at least two of the multiple tool call statements indicate the same tool name and / or parameter input, the tool call statement data includes any one of the at least two tool call statements; or, when no at least two of the multiple tool call statements indicate the same tool name and / or parameter input, and the sum of the number of the multiple tool call statements satisfies a first threshold, the tool call statement data includes any one of the multiple tool call statements and a first mask marker, the first mask marker being used to indicate that any one of the tool call statements is incorrect.

[0015] For example, the consistency of multiple tool call statements can be determined based on multiple tool call statements and the first requirement data.

[0016] Based on the solution provided in the embodiments of this application, tool call statement data is determined by checking whether the tool name and / or parameter input of multiple tool call statements, and / or the number of multiple tool call statements meets a first threshold. On the one hand, this ensures that the training data generated for language model learning is verified and reasonable data, improving the correctness of the training data and helping the language model learn correct knowledge during training, reducing the illusion of the language model obtained by continuing to train based on the training data. On the other hand, it avoids generating tool call statements infinitely.

[0017] In some possible implementations, the first response data includes dialogue response data; generating the first response data based on the first demand data includes: generating multiple dialogue responses based on the first demand data; and determining the dialogue response data based on the consistency of the multiple dialogue responses.

[0018] Based on the solution provided in the embodiments of this application, on the one hand, by generating multiple dialogue responses based on the first demand data, and then determining the first response data including the dialogue response data, compared with generating training data only based on the tool call scenario, when the first demand data indicates a demand that does not require calling a tool, training data that can maintain the original general capabilities of the trained language model can be obtained, thereby improving the diversity and authenticity of the dialogue; on the other hand, based on the consistency of multiple dialogue responses, appropriate dialogue response data can be determined, thereby improving the correctness of the dialogue response data.

[0019] In some possible implementations, when at least two of the multiple dialogue responses satisfy content consistency, the dialogue response data includes any one of the at least two dialogue responses; or, when no at least two of the multiple dialogue responses satisfy content consistency, and the sum of the number of the multiple dialogue responses satisfies a second threshold, the dialogue response data includes any one of the multiple dialogue responses and a second mask marker, the second mask marker being used to indicate that the dialogue response is erroneous.

[0020] For example, the consistency of multiple dialogue responses can be determined based on multiple dialogue responses and the first requirement data.

[0021] Based on the solution provided in this application, the dialogue response data is determined by whether the content and / or number of multiple dialogue responses meet a second threshold. On the one hand, this ensures that the training data generated for language model learning is verified and reasonable, improving the accuracy of the training data and helping the language model learn correct knowledge during training, thus reducing the illusion of the language model obtained by continuing to train based on the training data. On the other hand, it avoids generating dialogue responses indefinitely.

[0022] Secondly, a method for model training is provided, comprising: inputting first demand data and first response data into a language model, wherein the first demand data is generated based on a dialogue flow, the dialogue flow is generated based on the first demand, and the dialogue flow includes a dialogue process that conforms to the first demand; and training a language model based on the first demand data and the first response data, wherein the first response data is generated based on the first demand data.

[0023] In some possible implementations, the dialogue flow indicates the response method of the dialogue response; when the first response data includes dialogue response data, the first response data satisfies the response method; or, when the first response data includes tool call statement data, the tool call result data satisfies the response method, and the tool call result data is determined based on the tool call statement data.

[0024] In some possible implementations, the first requirement data is generated based on the second requirement, the first requirement data indicates the second requirement, and the second requirement is generated based on the dialogue flow.

[0025] In some possible implementations, the first requirement data is generated based on the third requirement, which indicates the third requirement. The third requirement is generated based on the dialogue flow and dialogue history, which includes completed requirements. The third requirement represents the next requirement after the last requirement in the dialogue history.

[0026] In some possible implementations, the first response data includes tool call statement data, which is determined based on the consistency of multiple tool call statements, which are generated based on the first requirement data.

[0027] In some possible implementations, when at least two of the multiple tool call statements indicate the same tool name and / or parameter input, the tool call statement data includes any one of the at least two tool call statements; or, when no at least two of the multiple tool call statements indicate the same tool name and / or parameter input, and the sum of the number of the multiple tool call statements satisfies a first threshold, the tool call statement data includes any one of the multiple tool call statements and a first mask marker, the first mask marker being used to indicate that any one of the tool call statements is erroneous.

[0028] In some possible implementations, the first response data includes dialogue response data, which is determined based on the consistency of multiple dialogue responses, which are generated based on the first requirement data.

[0029] In some possible implementations, when at least two of the multiple dialogue responses satisfy content consistency, the dialogue response data includes any one of the at least two dialogue responses; or, when no at least two of the multiple dialogue responses satisfy content consistency, and the sum of the number of the multiple dialogue responses satisfies a second threshold, the dialogue response data includes any one of the multiple dialogue responses and a second mask marker, the second mask marker being used to indicate that the dialogue response is erroneous.

[0030] Thirdly, a method for demand processing is provided, including: determining the demand to be processed; inputting the demand to be processed into a language model to obtain a first processing result, wherein the language model is trained based on the first demand data and the first response data, the first demand data is generated based on the dialogue flow, the dialogue flow is generated based on the first demand, the dialogue flow includes a dialogue process that conforms to the first demand, and the first response data is generated based on the first demand data.

[0031] In some possible implementations, the dialogue flow indicates the response method of the dialogue response; when the first response data includes dialogue response data, the first response data satisfies the response method; or, when the first response data includes tool call statement data, the tool call result data satisfies the response method, and the tool call result data is determined based on the tool call statement data.

[0032] In some possible implementations, the first requirement data is generated based on the second requirement, the first requirement data indicates the second requirement, and the second requirement is generated based on the dialogue flow.

[0033] In some possible implementations, the first requirement data is generated based on the third requirement, which indicates the third requirement. The third requirement is generated based on the dialogue flow and dialogue history, which includes completed requirements. The third requirement represents the next requirement after the last requirement in the dialogue history.

[0034] In some possible implementations, the first response data includes tool call statement data, which is determined based on the consistency of multiple tool call statements, which are generated based on the first requirement data.

[0035] In some possible implementations, when at least two of the multiple tool call statements indicate the same tool name and / or parameter input, the tool call statement data includes any one of the at least two tool call statements; or, when no at least two of the multiple tool call statements indicate the same tool name and / or parameter input, and the sum of the number of the multiple tool call statements satisfies a first threshold, the tool call statement data includes any one of the multiple tool call statements and a first mask marker, the first mask marker being used to indicate that any one of the tool call statements is erroneous.

[0036] In some possible implementations, the first response data includes dialogue response data, which is determined based on the consistency of multiple dialogue responses, which are generated based on the first requirement data.

[0037] In some possible implementations, when at least two of the multiple dialogue responses satisfy content consistency, the dialogue response data includes any one of the at least two dialogue responses; or, when no at least two of the multiple dialogue responses satisfy content consistency, and the sum of the number of the multiple dialogue responses satisfies a second threshold, the dialogue response data includes any one of the multiple dialogue responses and a second mask marker, the second mask marker being used to indicate that the dialogue response is erroneous.

[0038] Fourthly, an apparatus for generating data is provided, including a processor, the processor being configured to: generate a dialogue stream according to a first requirement, the dialogue stream including a dialogue flow conforming to the first requirement; generate first requirement data according to the dialogue stream; and generate first response data according to the first requirement data, the first requirement data and the first response data being used to train a language model.

[0039] In some possible implementations, the dialogue flow indicates the response method of the dialogue response; when the first response data includes dialogue response data, the first response data satisfies the response method; or, when the first response data includes tool call statement data, the tool call result data satisfies the response method, and the tool call result data is determined based on the tool call statement data.

[0040] In some possible implementations, the processor is specifically used to: generate a second requirement based on the dialogue flow; and generate first requirement data based on the second requirement, wherein the first requirement data indicates the second requirement.

[0041] In some possible implementations, the processor is specifically used to: generate a third requirement based on the dialogue flow and dialogue history, the dialogue history including completed requirements, and the third requirement representing the next requirement after the last requirement in the dialogue history; and generate first requirement data based on the third requirement, the first requirement data indicating the third requirement.

[0042] In some possible implementations, the first response data includes tool call statement data; the processor is specifically used to: generate multiple tool call statements based on the first requirement data; and determine the tool call statement data based on the consistency of the multiple tool call statements.

[0043] In some possible implementations, when at least two of the multiple tool call statements indicate the same tool name and / or parameter input, the tool call statement data includes any one of the at least two tool call statements; or, when no at least two of the multiple tool call statements indicate the same tool name and / or parameter input, and the sum of the number of the multiple tool call statements satisfies a first threshold, the tool call statement data includes any one of the multiple tool call statements and a first mask marker, the first mask marker being used to indicate that any one of the tool call statements is incorrect.

[0044] In some possible implementations, the first response data includes dialogue response data; the processor is specifically used to: generate multiple dialogue responses based on the first demand data; and determine the dialogue response data based on the consistency of the multiple dialogue responses.

[0045] In some possible implementations, when at least two of the multiple dialogue responses satisfy content consistency, the dialogue response data includes any one of the at least two dialogue responses; or, when no at least two of the multiple dialogue responses satisfy content consistency, and the sum of the number of the multiple dialogue responses satisfies a second threshold, the dialogue response data includes any one of the multiple dialogue responses and a second mask marker, the second mask marker being used to indicate that the dialogue response is erroneous.

[0046] In some possible implementations, the device is a chip.

[0047] Fifthly, an apparatus for model training is provided, including a processor, the processor being configured to: input first demand data and first response data into a language model, the first demand data being generated based on a dialogue stream, the dialogue stream being generated based on the first demand, the dialogue stream including a dialogue flow conforming to the first demand; and train a language model based on the first demand data and the first response data, the first response data being generated based on the first demand data.

[0048] In some possible implementations, the dialogue flow indicates the response method of the dialogue response; when the first response data includes dialogue response data, the first response data satisfies the response method; or, when the first response data includes tool call statement data, the tool call result data satisfies the response method, and the tool call result data is determined based on the tool call statement data.

[0049] In some possible implementations, the first requirement data is generated based on the second requirement, the first requirement data indicates the second requirement, and the second requirement is generated based on the dialogue flow.

[0050] In some possible implementations, the first requirement data is generated based on the third requirement, which indicates the third requirement. The third requirement is generated based on the dialogue flow and dialogue history, which includes completed requirements. The third requirement represents the next requirement after the last requirement in the dialogue history.

[0051] In some possible implementations, the first response data includes tool call statement data, which is determined based on the consistency of multiple tool call statements, which are generated based on the first requirement data.

[0052] In some possible implementations, when at least two of the multiple tool call statements indicate the same tool name and / or parameter input, the tool call statement data includes any one of the at least two tool call statements; or, when no at least two of the multiple tool call statements indicate the same tool name and / or parameter input, and the sum of the number of the multiple tool call statements satisfies a first threshold, the tool call statement data includes any one of the multiple tool call statements and a first mask marker, the first mask marker being used to indicate that any one of the tool call statements is erroneous.

[0053] In some possible implementations, the first response data includes dialogue response data, which is determined based on the consistency of multiple dialogue responses, which are generated based on the first requirement data.

[0054] In some possible implementations, when at least two of the multiple dialogue responses satisfy content consistency, the dialogue response data includes any one of the at least two dialogue responses; or, when no at least two of the multiple dialogue responses satisfy content consistency, and the sum of the number of the multiple dialogue responses satisfies a second threshold, the dialogue response data includes any one of the multiple dialogue responses and a second mask marker, the second mask marker being used to indicate that the dialogue response is erroneous.

[0055] In some possible implementations, the device is a chip.

[0056] In a sixth aspect, a demand processing apparatus is provided, including a processor, the processor being configured to: determine a demand to be processed; input the demand to be processed into a language model to obtain a first processing result, wherein the language model is trained based on first demand data and first response data, the first demand data is generated based on a dialogue stream, the dialogue stream is generated based on the first demand, the dialogue stream includes a dialogue flow that conforms to the first demand, and the first response data is generated based on the first demand data.

[0057] In some possible implementations, the dialogue flow indicates the response method of the dialogue response; when the first response data includes dialogue response data, the first response data satisfies the response method; or, when the first response data includes tool call statement data, the tool call result data satisfies the response method, and the tool call result data is determined based on the tool call statement data.

[0058] In some possible implementations, the first requirement data is generated based on the second requirement, the first requirement data indicates the second requirement, and the second requirement is generated based on the dialogue flow.

[0059] In some possible implementations, the first requirement data is generated based on the third requirement, which indicates the third requirement. The third requirement is generated based on the dialogue flow and dialogue history, which includes completed requirements. The third requirement represents the next requirement after the last requirement in the dialogue history.

[0060] In some possible implementations, the first response data includes tool call statement data, which is determined based on the consistency of multiple tool call statements, which are generated based on the first requirement data.

[0061] In some possible implementations, when at least two of the multiple tool call statements indicate the same tool name and / or parameter input, the tool call statement data includes any one of the at least two tool call statements; or, when no at least two of the multiple tool call statements indicate the same tool name and / or parameter input, and the sum of the number of the multiple tool call statements satisfies a first threshold, the tool call statement data includes any one of the multiple tool call statements and a first mask marker, the first mask marker being used to indicate that any one of the tool call statements is erroneous.

[0062] In some possible implementations, the first response data includes dialogue response data, which is determined based on the consistency of multiple dialogue responses, which are generated based on the first requirement data.

[0063] In some possible implementations, when at least two of the multiple dialogue responses satisfy content consistency, the dialogue response data includes any one of the at least two dialogue responses; or, when no at least two of the multiple dialogue responses satisfy content consistency, and the sum of the number of the multiple dialogue responses satisfies a second threshold, the dialogue response data includes any one of the multiple dialogue responses and a second mask marker, the second mask marker being used to indicate that the dialogue response is erroneous.

[0064] In some possible implementations, the device is a chip.

[0065] A seventh aspect provides a computing device, comprising: a processor configured to execute computer instructions stored in a memory, such that the device performs the method of the first aspect or any of its possible implementations; or performs the method of the second aspect or any of its possible implementations; or performs the method of the third aspect or any of its possible implementations.

[0066] In some possible implementations, the processor can be a general-purpose processor, which can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, integrated circuit, etc.; when implemented in software, the processor can be a general-purpose processor that reads software code stored in memory. This memory can be integrated into the processor or located outside the processor and exist independently.

[0067] In some possible implementations, the device also includes a memory.

[0068] In some possible implementations, the device also includes a communication interface coupled to the processor, which is used for inputting and / or outputting information.

[0069] In some possible implementations, the device is a chip.

[0070] Eighthly, a chip or chip system is provided, comprising: a circuit for performing the method of the first aspect or any of the possible implementations of the first aspect; or performing the method of the second aspect or any of the possible implementations of the second aspect; or performing the method of the third aspect or any of the possible implementations of the third aspect.

[0071] Ninthly, a computer program product is provided, which, when executed by a computing device, implements the method of the first aspect or any of the possible implementations of the first aspect; or implements the method of the second aspect or any of the possible implementations of the second aspect; or implements the method of the third aspect or any of the possible implementations of the third aspect.

[0072] In a tenth aspect, a computer-readable storage medium is provided, which stores a computer program or instructions that, when executed by a processor, implement the method of the first aspect or any of the possible implementations of the first aspect; or implement the method of the second aspect or any of the possible implementations of the second aspect; or implement the method of the third aspect or any of the possible implementations of the third aspect.

[0073] As examples, these computer-readable storage devices include, but are not limited to, one or more of the following: read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), flash memory, electrically EPROM (EEPROM), and hard drive.

[0074] In some possible implementations, the aforementioned storage medium may specifically be a non-volatile storage medium.

[0075] The beneficial effects of the solutions in aspects two through ten above can be referred to in the specific description of aspect one, and will not be repeated here for the sake of brevity. Attached Figure Description

[0076] Figure 1 This is a diagram illustrating the training and inference phases of a model.

[0077] Figure 2 This is a schematic diagram of the training process for reinforcement learning.

[0078] Figure 3 This is a schematic diagram of a supervised training method for deep learning models.

[0079] Figure 4 This is a schematic block diagram of a cloud scenario applicable to embodiments of this application.

[0080] Figure 5 This is a schematic diagram illustrating the interaction between a tenant and an AI infrastructure development platform, applicable to an embodiment of this application.

[0081] Figure 6 This is a schematic diagram of an intelligent agent.

[0082] Figure 7 This is a schematic diagram of a data generation method provided in an embodiment of this application.

[0083] Figure 8 This is a schematic diagram of a data generation process provided in an embodiment of this application.

[0084] Figure 9 This is a schematic diagram of an apparatus for generating data or model training or demand processing provided in an embodiment of this application.

[0085] Figure 10 This is a schematic diagram of an apparatus for generating data or model training or demand processing provided in an embodiment of this application.

[0086] Figure 11 This is a schematic diagram of a chip system provided in an embodiment of this application. Detailed Implementation

[0087] The technical solutions of this application will now be described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort should fall within the scope of protection of this application.

[0088] Before introducing the embodiments of this application, the following points should be made first.

[0089] In this application, the terms "exemplary," "for example," etc., are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as an "example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the term "example" is intended to present concepts in a concrete manner. In the embodiments of this application, "of," "corresponding, relevant," and "corresponding" may sometimes be used interchangeably, and it should be noted that their intended meanings are consistent unless their distinction is emphasized.

[0090] The business scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.

[0091] References such as "in some possible implementations" as used in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, phrases such as "in some possible implementations" appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless otherwise specifically emphasized.

[0092] In this application, "at least one" or "at least one item" refers to one or more items, and "more than one" refers to two or more items. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A alone, A and B simultaneously, and B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0093] In this application, terms such as "first," "second," "①," "②," "#1," and "#2" are used merely for descriptive convenience to distinguish objects and are not intended to limit the scope of the embodiments of this application. They are not used to describe the order or sequence of features. It should be understood that such described objects can be interchanged where appropriate to describe solutions other than those in the embodiments of this application.

[0094] In order to describe the embodiments of this application, several terms involved in the embodiments of this application will be introduced first.

[0095] like Figure 1 As shown, Figure 1 The diagram illustrates the training and inference phases of the model. The fundamental principle of artificial intelligence (AI) is to combine massive amounts of data with powerful computing capabilities and intelligent algorithms to build an AI model that solves specific problems. This AI model can automatically summarize and learn potential patterns or features from the data, thereby achieving a way of thinking that approximates humans.

[0096] AI models, also known as AI algorithms (or AI operators), are a collective term for mathematical algorithms built upon the principles of artificial intelligence. They form the foundation for using AI to solve specific problems. Depending on the specific methods and / or technologies used to implement artificial intelligence, AI models can also be called machine learning models, deep learning models, or reinforcement learning models. The following sections specifically describe machine learning, machine learning models, deep learning, deep learning models, neural networks, reinforcement learning, and reinforcement learning models.

[0097] Machine learning is a method for achieving artificial intelligence. The goal of this method is to design and analyze algorithms (i.e., models) that allow computers to "learn" automatically. The designed algorithms are called machine learning models.

[0098] Machine learning models are algorithms that automatically analyze data to identify patterns and use those patterns to predict unknown data. Machine learning models are diverse and can be categorized based on whether their training depends on the labels on the training data: 1. Supervised learning models; 2. Unsupervised learning models.

[0099] 1. Supervised Learning Models: These are models obtained by determining the parameters of an initial AI model based on data from a given training dataset and the labels corresponding to each data point. The process of determining the parameters of the initial AI model using the data and their labels in the training dataset is also called supervised learning (or supervised training). The labels on the data in the training dataset are usually manually labeled to indicate the correct answer for a specific task. Typical supervised learning models include: Support Vector Machines, Neural Network Models, Logistic Regression Models, Decision Trees, Naive Bayes Models, and Gaussian Discriminant Models. Supervised learning models are commonly used for classification or regression.

[0100] 2. Unsupervised Learning Models: These are models obtained by determining the parameters of an initial AI model using unlabeled data from a given training dataset. The process of determining the parameters of the initial AI model using unlabeled training data is also called unsupervised learning (or unsupervised training). Through unsupervised learning, the model can discover meaningful information and correlations in the data, thereby making predictions. There are many types of unsupervised learning models, some of the more commonly used ones being: clustering models, principal component analysis (PCA), anomaly detection models, autoencoders, and generative adversarial networks (GANs).

[0101] Deep learning is a new technological field that emerged during machine learning research. Specifically, deep learning is a method in machine learning based on deep representation learning of data. Deep learning interprets data by building neural networks that simulate the human brain's analytical learning process.

[0102] In the field of AI, deep learning is a learning technique based on deep neural network algorithms. A deep learning model consists of an input layer, hidden layers, and an output layer, and it uses multiple nonlinear transformations to process data.

[0103] In machine learning methods, almost all features need to be determined by industry experts and then encoded. However, deep learning algorithms attempt to learn features from data themselves; algorithms designed based on the principles of deep learning are called deep learning models.

[0104] The typical structure of current deep learning models is a deep neural network. A neural network is a mathematical or computational model that mimics the structure and function of biological neural networks (the central nervous system of animals, especially the brain). Neural networks consist of a large number of interconnected neurons performing computations. A neural network can include multiple layers with different functions, each layer containing parameters and computational rules. Different layers in a neural network have different names depending on the computational formula or function; for example, the layer performing convolution calculations is called a convolutional layer, which is often used for feature extraction from input signals (e.g., images). A neural network can also be composed of multiple sub-neural networks. Different neural network structures can be applied to different scenarios (e.g., classification, recognition) or provide different results when used in the same scenario. The specific differences in neural network structures include one or more of the following: different numbers of network layers, different order of network layers, and different weights, parameters, or computational formulas in each network layer. Various high-accuracy neural networks exist in the industry for applications such as recognition or classification. Some neural networks can be trained on specific datasets and used alone to complete a task or combined with other neural networks (or other functional modules) to complete a task.

[0105] In other words, deep learning models are actually machine learning models with complex neural network structures. Based on whether deep learning models need to rely on the labels of the training data during training, they can also be divided into supervised learning models and unsupervised learning models, which will not be elaborated upon here. Classic deep learning models include convolutional neural networks (CNNs), recurrent neural networks (RNNs), and recursive neural networks (RNNs).

[0106] Reinforcement learning (RL), also known as reward learning, evaluation learning, or reinforcement learning, is used to describe and solve problems in which an agent learns strategies to maximize rewards or achieve specific goals during its interaction with the environment.

[0107] Reinforcement learning is a learning process where an agent learns through trial and error. Rewards gained from interactions with the environment guide behavior, with the goal of maximizing the agent's reward. Reinforcement learning does not require a training dataset. Instead of instructing the system on how to produce the correct action, reinforcement signals (rewards) provided by the environment evaluate the quality of the action. Because the external environment provides limited information, the agent must learn through experience. In this way, the agent acquires knowledge within the action-reward (i.e., reward) environment and improves its actions to adapt to the environment.

[0108] Figure 2 This is a diagram illustrating the training process of reinforcement learning. For example... Figure 2 As shown, reinforcement learning mainly includes four elements: agent, environment, state, action, and reward. The agent's input is the state, and its output is the action.

[0109] In current technology, the training process of reinforcement learning is as follows: the agent interacts with the environment multiple times to obtain the action, state, and reward of each interaction; these multiple sets of information (action, state, reward) are used as training data to train the agent once. This process is repeated for the next round of training until the convergence condition is met.

[0110] The process of obtaining the action, state, and reward of an interaction is as follows: Figure 2 As shown, the current state s(t) of the environment is input to the agent to obtain the action a(t) output by the agent. The reward r(t) for this interaction is calculated based on the relevant performance indicators of the environment under the action a(t). Thus, the action a(t), state s(t), and reward r(t) for this interaction are obtained. The action a(t), state s(t), and reward r(t) of this interaction are recorded for subsequent training of the agent. The next state s(t+1) of the environment under the action a(t) is also recorded to enable the next interaction between the agent and the environment.

[0111] In this context, an intelligent agent is an entity capable of thought and interaction with its environment. For example, an intelligent agent can be a computer system or part of a computer system within a specific environment. Based on its own perception of the environment, following existing instructions or through autonomous learning, and by communicating and collaborating with other intelligent agents, an intelligent agent can autonomously complete set goals within its environment. An intelligent agent can be software or a combination of software and hardware.

[0112] Before any AI model can be used to solve a specific technical problem, it needs to be trained. AI model training refers to using a specified initial model to compute on training data, and then adjusting the parameters of the initial model based on the computation results, so that the model gradually learns certain patterns and acquires specific functions. Once trained and possessing stable functionality, the AI ​​model can be used for inference. AI model inference is the process of using the trained AI model to compute on input data and obtain predicted inference results.

[0113] The most common approach is supervised training of AI models. For example, most deep learning models are trained using supervised training methods.

[0114] The following is combined Figure 3 This section introduces the most widely used supervised training methods for deep learning models.

[0115] Figure 3 A schematic block diagram of a deep learning model 100 is shown. During the training phase, a training set for the deep learning model needs to be constructed based on the objective. The training set includes multiple training data points, each labeled. The label of a training data point represents the correct answer to a specific question, and the label can indicate the objective of training the deep learning model using the training data. For example, to train a deep learning model that can be used to identify different animals, the training set can include multiple images of different animals (i.e., training data). Each image can have a label identifying the type of animal it contains, such as cat or dog. In this example, the type of animal corresponding to each image is the label of that training data.

[0116] When training a deep learning model, training data can be input into the model in batches after parameter initialization. The deep learning model performs calculations (i.e., inference) on the training data to obtain prediction results. The prediction results obtained through inference, along with the corresponding labels of the training data, are used to calculate the loss based on the loss function. The loss function is used during the model training phase to calculate the difference (i.e., the loss value) between the model's prediction results on the training data and the labels of that training data. Loss functions can be implemented using different mathematical functions; commonly used expressions for loss functions include: mean squared error loss function, logarithmic loss function, least squares method, etc.

[0117] The loss value calculated based on the loss function can be used to update the parameters of the deep learning model. The gradient descent method is commonly used for parameter updating. Model training is a repetitive iterative process. Each iteration performs inference on different training data and calculates the loss value. The goal of multiple iterations is to continuously update the parameters of the deep learning model and find the parameter configuration that minimizes or stabilizes the loss value of the loss function.

[0118] During the training phase, to improve training efficiency and post-training model performance, it's necessary to set appropriate hyperparameters. Hyperparameters in deep learning models refer to parameters that cannot be obtained through learning from training data or that cannot be changed by training data; they are a concept relative to the parameters in the model. Hyperparameters of deep learning models are typically set manually based on experience or experiments. These hyperparameters include: learning rate, batch size, and network structure hyperparameters (e.g., number of layers (also called depth), interaction methods between layers, number and size of convolutional kernels, activation functions, etc.). Among these, the learning rate, as a hyperparameter, controls the magnitude of parameter weight updates during training, significantly impacting training speed and accuracy.

[0119] Once trained, a deep learning model can be used to infer from the input data. In the inference phase, data from real-world application scenarios is typically used as input. The trained deep learning model then infers the results. The inference phase is the practical application of the trained deep learning model, allowing for the rapid use of AI capabilities to solve specific technical problems. Today, AI has numerous applications, and the inference capabilities of deep learning models can be used in various scenarios, such as personnel identification in access control and security systems, video content detection (including pornography and violence detection), and express delivery tracking number detection and recognition.

[0120] The above only introduces the training of the most typical deep learning model as an example. The training of other types of models has slight differences, but the principle is similar. Most of them involve inference on the training data and adjusting the parameters in the model based on the inference results, with the goal of obtaining a parameter combination that makes the model performance stable.

[0121] Training is mainly divided into supervised training and unsupervised training. The training process of the aforementioned deep learning model belongs to supervised training. Taking images as an example, in unsupervised training of an AI model, the training images in the image set used for training are unlabeled. The training images in the image set are sequentially input into the AI ​​model, which gradually identifies the relationships and potential rules between the training images in the image set until the AI ​​model can be used to judge or identify the type or features of the input images. For example, in clustering, after receiving a large number of training images, the AI ​​model used for clustering can learn the features of each training image and the relationships and differences between the training images, automatically classifying the training images into multiple types. Different task types can use different AI models. Some AI models can only be trained using supervised learning, some can only be trained using unsupervised learning, and some can be trained using both supervised and unsupervised learning.

[0122] A language model (LM) is a type of machine learning model that can be used to process and predict natural language data. Language models can include various types, such as large language models, compact language models, or small language models, for processing and predicting natural language data.

[0123] Large language models (LLMs) are neural network models with a large number of parameters trained on massive corpora, capable of understanding and generating natural language text. Specifically, LLMs are typically based on neural network techniques, learning the syntax, semantics, and contextual information of a language through training on large amounts of text data. During training, the model continuously optimizes its parameters to improve its text understanding and generation capabilities. Due to their powerful ability to understand natural language, LLMs have been widely applied in many fields to solve natural language understanding and generation problems. LLMs have broad applications in artificial intelligence, such as natural language processing, machine translation, and dialogue systems.

[0124] A compact language model (CLM) typically refers to a language model that is more compact and efficient in design, providing good performance even with limited computing resources. CLMs can be achieved through techniques such as model compression and knowledge distillation to reduce the number of parameters and computational complexity. Compared to LLMs, CLMs can achieve comparable or even better performance, especially in scenarios with limited computing resources. Due to reduced computational and storage requirements, CLMs are also more cost-effective.

[0125] Small language models (SLMs) typically refer to models with a relatively small number of parameters. They are designed with efficiency and practicality in mind, are small in size, and easily adaptable to resource-constrained and computationally limited environments, such as mobile devices or embedded systems. Compared to LLMs, SLMs have a significantly reduced number of parameters, making them more economical in terms of storage and computing resource requirements. Due to the simplified parameters and model structure, SLMs often respond faster when processing requests. SLMs may be optimized for specific application scenarios or tasks to provide good performance with limited resources. Despite their smaller number of parameters, SLMs can still achieve generalization capabilities across a variety of tasks through careful design and training.

[0126] As an example, in one possible implementation, the method provided in this application embodiment can be applied to a cloud service scenario, where the method is executed by a cloud management platform within the cloud service scenario. For ease of description, the following will first combine... Figure 4 It provides a detailed description of cloud service scenarios.

[0127] Figure 4 A schematic block diagram illustrating a cloud scenario applicable to embodiments of this application is shown. For example... Figure 4 As shown, this cloud scenario may include: a cloud management platform 410, the Internet 420, and a client 430.

[0128] like Figure 4 As shown, the cloud management platform 410 is used to manage the infrastructure that provides multiple cloud services. The infrastructure includes multiple cloud data centers, each cloud data center includes multiple servers, and each server includes cloud service resources to provide corresponding cloud services to tenants.

[0129] The cloud management platform 410 can be located in a cloud data center and provides an access interface (such as a user interface or application program interface, API). Tenants can use client 430 to remotely access the access interface to register a cloud account and password on the cloud management platform 410 and log in. After successful authentication of the cloud account and password on the cloud management platform 410, the tenant can further select and purchase virtual machines of specific specifications (processor, memory, disk) on the cloud management platform 410. After successful purchase, the cloud management platform 410 provides the remote login account and password for the purchased virtual machine, and client 430 can remotely log in to the virtual machine to install and run the tenant's applications. Therefore, tenants can create, manage, log in to, and operate virtual machines in the cloud data center through the cloud management platform 410. Virtual machines can also be referred to as Elastic Compute Service (ECS) or Elastic Instances (different cloud service providers may use different names).

[0130] It should be understood that cloud service tenants can be individuals, businesses, schools, hospitals, government agencies, etc.

[0131] The cloud management platform 410 includes, but is not limited to, a user console, compute management services, network management services, storage management services, authentication services, and image management services. The user console provides an interface or API for interaction with tenants. The compute management services manage servers running virtual machines and containers, as well as bare metal servers. The network management services manage network services (such as gateways and firewalls). The storage management services manage storage services (such as data bucket services). The authentication services manage tenant account passwords. The image management services manage virtual machine images. Tenants use client 430 and can log in to the cloud management platform 410 via the internet 420 to manage their rented cloud services.

[0132] As an example, this cloud service may include, but is not limited to, AI services. AI services and products in the cloud domain embody both the on-demand and purchase-based characteristics of cloud services and the abstract, diverse, and widely applicable characteristics of AI technology. AI services in the cloud domain include: Platform-as-a-Service (PaaS) type AI infrastructure development platform services.

[0133] It should be understood that the AI ​​Infrastructure Development Platform service is a PaaS cloud service within the cloud management platform 410. It's a software platform provided to users (also known as tenants, AI developers, etc.) based on the abundant underlying resources and software capabilities of public cloud service providers. This platform assists users in building, training, and deploying AI models, as well as developing and deploying AI applications. In other words, public cloud service providers offer an AI Infrastructure Development Platform to tenants, leveraging their ample underlying resources and upper-layer AI algorithm capabilities. The AI ​​development framework and various AI algorithms built into this platform allow tenants to quickly build and develop AI models or applications that meet their individual needs.

[0134] like Figure 5 As shown, Figure 5 A schematic diagram illustrating the interaction between a tenant and an AI basic development platform, applicable to an embodiment of this application, is shown. The interaction between the tenant and the AI ​​basic development platform mainly includes: the tenant logging into the cloud management platform 410 through a webpage on the client 430, selecting and purchasing cloud services of the AI ​​basic development platform on the cloud management platform 410, and after purchase, the tenant can carry out full-process AI development based on the functions provided by the AI ​​basic development platform.

[0135] As an example, when tenants develop and train their AI models on an AI infrastructure development platform, they rely on the basic resources (primarily computing resources such as central processing units (CPUs), graphics processing units (GPUs), and neural network processing units (NPUs)) in the cloud service provider's data center. Therefore, the payment for purchasing and using the AI ​​infrastructure development platform primarily involves paying for the resources used. For instance, tenants need to prepay before using the AI ​​infrastructure development platform. Different resource specifications support varying functions of the AI ​​infrastructure development platform. Tenants select the name and specifications of the resources based on the functions they need from the AI ​​infrastructure development platform, and they can also choose the purchase duration. The cloud management platform 410 prices the package based on the user's selected resource name, specifications, and purchase duration. After purchasing the prepaid package, tenants can utilize the capabilities provided by the AI ​​infrastructure development platform and the basic computing resources included in the prepaid package for building, training, and deploying AI models. When resource usage exceeds the current prepaid package limit, the cloud management platform 410 charges for the excess resources on a pay-as-you-go basis. In reality, the basic resources used by tenants on the AI ​​infrastructure development platform are mainly virtualized computing resources, such as virtual machines and containers.

[0136] It should be understood that the sale of AI basic development platforms is actually a form of selling software capabilities together with hardware virtualization basic resources. Furthermore, the basic resources supporting any process in the AI ​​basic development platform may be distributed across different physical devices. In other words, the hardware devices that actually execute a process are usually server clusters in the same data center or server clusters distributed across different data centers.

[0137] Language models (such as LLM, SLM, CLM, etc.) use text as a medium and perform excellently on various text understanding and generation tasks. However, relying solely on bare models still has significant limitations, such as the inability to fulfill user requests for booking flights and hotels. By providing language models with external tool interfaces and enabling them to learn to input corresponding calling statements to invoke these external tools, the capabilities of language models can be greatly expanded.

[0138] Specifically, methods for enabling language models to call external tools can include:

[0139] ① By using prompt engineering, information such as how to use tools is put into the model input, and the model learns to output tool call statements based on its own basic capabilities.

[0140] Hint engineering can improve the performance of large language models by finding more suitable hints. For example, by introducing an iterative process of Thought, Action, and Observation, the language model can acquire the ability to invoke external tools without training. This method adds the necessary knowledge for invoking tools (such as tool definitions, format requirements for invocation statements, etc.) and corresponding examples to the prompt, enabling the language model to invoke external tools when given a user's request statement.

[0141] However, this method does not require further training of the language model and relies heavily on the language model's own understanding and reasoning abilities, making it difficult for language models with weaker basic capabilities to effectively learn to invoke external tools. Furthermore, due to the diversity and complexity of real-world external tools and user needs, the accuracy of language models based on this method in invoking these tools is unsatisfactory.

[0142] ② By constructing relevant data, the model can learn the corresponding knowledge and behavior through continuous training.

[0143] For example, new tool call request statements can be generated based on collected real APIs and constructed examples, and the LLM can be used to annotate the solution path. This method can construct a large amount of single-round request data, which can be used to further train the language model. The trained language model can then call external tools.

[0144] However, the data constructed by this method consists entirely of single-round tool call data, lacking user interaction. Language models trained solely on this data will suffer in terms of general capabilities, failing to maintain the original general capabilities of the language model and other capabilities required for user interaction.

[0145] For example, multiple agents can be introduced, and tool invocation data can be generated through interactions between these agents. An LLM can act as a user agent, assistant agent, and tool agent, and tool invocation dialogue data can be formed through interactions between these agents. Different agents can use different system prompts.

[0146] For example, an agent can use an LLM (Long-Term Memory) as its core, comprising a memory module, a tool module, a planning module, and an action module. The memory module implements long-term and / or short-term memory functions; the tool module contains multiple callable external tools; the planning module contains various planning algorithms; for example, the agent can plan externally input tasks based on its memory; and the action module supports the agent in performing actions based on the planning results, such as calling tools.

[0147] like Figure 6 As shown, Figure 6 A schematic diagram of an intelligent agent is shown. In an LLM-supported autonomous agent system, the LLM acts as the brain of the agent (or agent) and is complemented by several key components:

[0148] 1) Planning, including but not limited to:

[0149] Subgoal decomposition: Agents break down large tasks into smaller, manageable subgoals, enabling them to handle complex tasks more efficiently. For example, by instructing the model to "think step by step" through a chain of thoughts (CoT), more testing time is used to compute the breakdown of difficult tasks into smaller, simpler steps. CoT transforms large tasks into multiple manageable tasks and elucidates the explanation of the model's thought process.

[0150] Reflection and Improvement: Intelligent agents can engage in self-criticism and self-reflection on past behaviors, learn from mistakes, and improve future steps, thereby enhancing the quality of the final result.

[0151] 2) Memory, including but not limited to:

[0152] Short-term memory: Learning by utilizing the short-term memory of models.

[0153] Long-term memory: Provides agents with the ability to retain and recall (unlimited) information for a long time, usually by utilizing external vector storage and fast retrieval.

[0154] 3) Tool usage, including but not limited to:

[0155] Agent learning calls external application programming interfaces (APIs) to obtain additional information missing from the model weights (which is usually difficult to change after pre-training), including current information, code execution capabilities, and access to proprietary information sources.

[0156] 4) Task execution (action): The model performs a specific task and records the results.

[0157] The primary function of a prompt is to provide the AI ​​model with contextual information about the input and the model's parameters. When training supervised or unsupervised learning models, a prompt helps the model better understand the intent of the input and respond accordingly. Furthermore, a prompt can improve the interpretability and accessibility of the model.

[0158] In layman's terms, a prompt is to provide an AI model with a "hint" or "guidance" to help it better understand and complete tasks.

[0159] For example, a prompt is not just a user-inputted question or query; it also includes instructions, external information (context), and an output prompt. The user input or query is typically a query instruction entered into the system by the user (i.e., the prompter), which tells the model what to do, how to use external information, how to process the query, and how to construct the output. External information (context) acts as an additional source of knowledge for the model. This can be manually inserted into the prompt, obtained through retrieval from a vector database (retrieval enhancement), or introduced through other means (e.g., APIs, computations, etc.). The output prompt marks the beginning of the text to be generated.

[0160] This method assigns an LLM (Language Model) to act as a user agent, assistant agent, and tool agent. Through interactions between these agents, tool invocation dialogue data is generated. Given a set of tools, the user agent proposes a request; the assistant agent analyzes the request and invokes the appropriate tool to solve the user's problem; the tool agent simulates a real tool, taking the tool invocation statement generated by the assistant agent as input and outputting the corresponding tool invocation result. This method generates the corresponding tool invocation dialogue data (e.g., the user agent's request, the assistant agent's tool invocation statement, and the corresponding tool invocation result) without invoking real tools. The generated tool invocation dialogue data can be used to further train the language model, improving the flexibility of data construction.

[0161] However, the data constructed using this method still lacks realism and fluency, making it difficult to mimic real user interactions. Furthermore, the lack of control over the entire dialogue flow makes it difficult to consistently generate data that enhances expected capabilities. Moreover, this method is limited to tool-calling scenarios; language models trained solely on this data will suffer in terms of general capabilities, failing to maintain their original general abilities and other capabilities required for user interaction.

[0162] In view of this, embodiments of this application provide a method for generating data, a method for processing requirements, and an apparatus. Based on this method, data that can be used for further training of a language model can be generated, and the ability of the language model trained based on this data can be improved in the desired direction.

[0163] It should be understood that the embodiments shown below do not specifically limit the structure of the execution subject of the method provided in the embodiments of this application. As long as a program containing the code of the method provided in the embodiments of this application can be run to communicate according to the method provided in the embodiments of this application, it is acceptable. For example, the execution subject of the method provided in the embodiments of this application can be a device. Unless otherwise specified, "device" in this application can refer to the device itself (e.g., access network device, terminal device, or core network device, etc.), a component in the device (e.g., processor, chip, or chip system, etc.), or a logic module or software that can implement all or part of the device functions.

[0164] The following is combined Figure 7 This application provides a detailed description of a method for generating data according to an embodiment. Figure 7 A schematic diagram of a data generation method 700 provided in an embodiment of this application is shown. Method 700 may include:

[0165] S710 generates a dialogue flow based on a first requirement, the dialogue flow including a dialogue process that meets the first requirement.

[0166] Before generating data, a dialog flow can be generated based on the primary requirement. This dialog flow includes a dialogue sequence, and the generated dialog flow must conform to the primary requirement. The dialog sequence can consist of multiple dialogues, with smooth and natural transitions between them.

[0167] The primary need can be a need that does not require the use of tools (e.g., the primary need could be casual conversation or a non-tool-invoking need), or it can be a need that requires the use of tools (e.g., the primary need could be a tool-invoking need). When the primary need requires the use of tools, generating a dialogue flow based on the primary need can include: generating a dialogue flow based on the primary need and a tool list. The tool list can consist of tools from a toolset (e.g., the tool list could be a table or inventory of tools from a toolset), representing tools that can be invoked or simulated (simulated invocation refers to simulating an actual invocation, but not actually invoking it; the result obtained from a simulated invocation represents the result obtained from simulating an actual invocation, not the result produced by the actual invocation). Generating a dialogue flow based on the tool list can avoid generating a dialogue flow that cannot be invoked or simulated, which would make the generated dialogue flow difficult to implement.

[0168] Method 700 can be executed by multiple agents; for example, step S710 described above can be executed by a dialogue planning agent. For instance, the dialogue planning agent can generate a dialogue flow based on a given first requirement.

[0169] The dialogue flow, a natural language string that controls the direction of the conversation, is generated by the dialogue planning agent. It can be used as part of the user agent's input, allowing the user agent to generate new requests based on the plan and the dialogue history.

[0170] S720 generates first requirement data based on the dialogue flow.

[0171] After generating the dialogue stream (or obtaining the generated dialogue stream), the first requirement data can be generated based on the dialogue stream.

[0172] For example, the first requirement can be a basic requirement, and the data of the first requirement can be used to represent a sub-requirement belonging to the basic requirement. Multiple sub-requirements conform to the dialogue flow, and the transitions between multiple dialogues based on sub-requirements are reasonable and natural.

[0173] Taking the primary requirement as "booking train tickets" as an example, this requirement can include multiple sub-requirements, such as "booking outbound train tickets" and "booking return train tickets".

[0174] Scenarios requiring "ticket booking" might include traveling to a destination for tourism, business trips, studies, or visiting relatives. Before setting off, one can not only book round-trip tickets but also check the destination's weather, learn about local customs and culture, or initiate conversations through casual chat. Therefore, the primary need could further include sub-needs such as "checking destination weather," "travel suggestions," and "casual chat."

[0175] Taking the primary need as "shopping recommendations" as an example, this need can include multiple sub-needs, such as "women's shoe recommendations," "men's shoe recommendations," and "accessory recommendations."

[0176] Scenarios requiring "shopping recommendations" might include purchasing items for a specific occasion. Therefore, further, the primary need could also include sub-needs such as "outfit suggestions for award ceremonies" and "casual conversation."

[0177] For example, step S720 described above can be performed by a user agent. For instance, the user agent can generate first demand data, which can be used to represent the user agent's specific demands.

[0178] S730 generates first response data based on first demand data. The first demand data and the first response data are used to train the language model.

[0179] First response data can represent a response to first demand data. First demand data that conforms to the dialogue flow, and first response data representing a response to first demand data, can form training data, which can be used to train a language model.

[0180] For example, step S730 described above can be performed by an assistant agent. For instance, the assistant agent can generate first response data.

[0181] For example, the first response data may include data that includes the result of calling the tool, or it may be data that does not include the result of calling the tool and is a statement replying to the user agent.

[0182] Based on the solution provided in the embodiments of this application, by generating first demand data according to the dialogue flow and generating first response data in response to the first demand data, since the dialogue flow generated according to the first demand has a limiting effect on the generation of the first demand data, on the one hand, training data (i.e., first demand data and first response data) that can improve the ability of the trained language model in the direction of the first demand can be obtained. Compared with the process of generating demand data without the limitation of the dialogue flow, the first demand data can improve the ability of the trained language model in the direction of the desired ability by setting the first demand according to the desired ability. On the other hand, the dialogue flow included in the dialogue flow can improve the controllability and fluency of the data generation process, which helps to optimize the data generation process.

[0183] In some possible implementations, the first response data includes tool invocation statement data. S730 may include:

[0184] S730a generates multiple tool call statements based on the first requirement data.

[0185] S730b determines tool call statement data based on the consistency of multiple tool call statements.

[0186] The formats of tool call statements and non-tool call statements (e.g., dialogue responses) generated based on the first requirement differ. After generating data responding to the first requirement, it can be determined whether the generated response data is a tool call based on its format (if the generated response data is a tool call statement, it is considered a tool call; if it is a non-tool call statement, it is considered not a tool call). Regardless of whether it is a tool call, the consistency of multiple responses to the first requirement (i.e., multiple tool call statements or multiple dialogue responses) can be further evaluated.

[0187] For example, the above steps S730a and S730b can be executed by an assistant agent, and the consistency of multiple tool call statements can be determined by a verification agent.

[0188] For example, taking the existence of assistant agent #1 and verification agent #1 as an example, assistant agent #1 can receive the first request data generated by the user agent. Based on the first request data, assistant agent #1 can generate multiple tool call statements. Verification agent #1 can receive the multiple tool call statements generated by assistant agent #1 and determine the consistency of the multiple tool call statements. After determining the tool call statement used to respond to the first request based on the consistency of the multiple tool call statements, assistant agent #1 can generate tool call statement data based on the tool call statement used to respond to the first request.

[0189] It should be understood that the embodiments of this application do not limit the order in which an assistant agent generates multiple data responses to the first requirement. An assistant agent can generate multiple data responses to the first requirement simultaneously or sequentially.

[0190] For example, step S730a can be performed by an assistant agent and a verification agent, and step S730b can be performed by an assistant agent. The consistency of multiple tool call statements can be determined by the verification agent.

[0191] For example, taking the existence of assistant agent #1 and verification agent #1 as an example, assistant agent #1 and verification agent #1 can receive first request data generated by the user agent. Based on the first request data, assistant agent #1 can generate one or more first tool invocation statements, and verification agent #1 can generate one or more second tool invocation statements. Verification agent #1 can receive the first tool invocation statements generated by assistant agent #1 and determine the consistency between the first tool invocation statements and the second tool invocation statements. After determining the tool invocation statement used to respond to the first request based on the consistency between the first tool invocation statements and the second tool invocation statements, assistant agent #1 can generate tool invocation statement data based on the tool invocation statement used to respond to the first request.

[0192] It should be understood that the embodiments of this application do not limit the order in which the verification agent and the assistant agent generate the data in response to the first requirement. The verification agent and the assistant agent can generate the data in response to the first requirement simultaneously or sequentially.

[0193] For example, step S730a can be executed by multiple assistant agents, and step S730b can be executed by one assistant agent. The consistency of multiple tool call statements can be determined by the verification agent.

[0194] For example, assuming there are assistant agent #1, assistant agent #2, and verification agent #1, assistant agent #1 and assistant agent #2 can receive the first request data generated by the user agent. Based on the first request data, assistant agent #1 and assistant agent #2 can generate multiple first tool call statements. Verification agent #1 can receive the multiple first tool call statements generated by assistant agent #1 and assistant agent #2 and determine the consistency of the multiple first tool call statements. After determining the tool call statement used to respond to the first request based on the consistency of the multiple first tool call statements, assistant agent #1 or assistant agent #2 can generate tool call statement data based on the tool call statement used to respond to the first request.

[0195] It should be understood that when multiple assistant agents exist, these agents can generate multiple first tool call statements. Agent #1 is verified to receive these multiple first tool call statements, and their consistency is determined. After determining the tool call statement used to respond to the first request based on the consistency of the multiple first tool call statements, any one of the multiple assistant agents can be selected or designated. This selected or designated assistant agent can then generate tool call statement data based on the tool call statement used to respond to the first request.

[0196] It should be understood that the embodiments of this application do not limit the order in which multiple assistant agents generate data in response to the first requirement, and multiple assistant agents can generate data in response to the first requirement simultaneously or sequentially.

[0197] For example, step S730a can be executed by multiple assistant agents and one verification agent, and step S730b can be executed by one assistant agent. The consistency of multiple tool call statements can be determined by the verification agent.

[0198] For example, assuming there are assistant agent #1, assistant agent #2, and verification agent #1, these three agents can receive first request data generated by the user agent. Based on the first request data, assistant agent #1 and assistant agent #2 can generate multiple first tool call statements, and verification agent #1 can generate one or more second tool call statements. Verification agent #1 can receive the first tool call statements generated by assistant agent #1 and assistant agent #2 and determine the consistency between the first and second tool call statements. After determining the tool call statement used to respond to the first request based on the consistency between the first and second tool call statements, assistant agent #1 or assistant agent #2 can generate tool call statement data based on this tool call statement used to respond to the first request.

[0199] It should be understood that when multiple assistant agents exist, these agents can generate multiple first tool call statements. Agent #1 is verified to receive these multiple first tool call statements, and the consistency between the multiple first tool call statements and the second tool call statement is determined. After determining the tool call statement used to respond to the first request based on the consistency between the multiple first tool call statements and the second tool call statement, one assistant agent can be selected or designated from among the multiple assistant agents. This selected or designated assistant agent can then generate tool call statement data based on the tool call statement used to respond to the first request.

[0200] It should be understood that the embodiments of this application do not limit the order in which the verification agent generates the data in response to the first requirement and the multiple assistant agents generate the data in response to the first requirement. The multiple assistant agents and the verification agent can generate the data in response to the first requirement simultaneously or sequentially.

[0201] When the primary requirement is to invoke a tool, multiple tool invocation statements can be generated. These statements can be used to invoke or simulate the tool invoked as instructed by the statement. The invoked tool can be real or simulated. This application's embodiments do not impose any limitations on this.

[0202] Different agents can use different system prompts. Enhancing dialogue flow compliance through prompts ensures that dialogues between multiple agents proceed according to the dialogue flow.

[0203] Based on the solution provided in the embodiments of this application, by generating multiple tool call statements according to the first requirement data, and then determining tool call statement data including tool call statements that meet the consistency requirements, on the one hand, training data that can expand the capability boundary of the trained language model can be obtained, enabling the trained language model to call external tools; on the other hand, based on the consistency of multiple tool call statements, appropriate tool call statement data can be determined, improving the correctness of tool call statement data.

[0204] In some possible implementations, when at least two of the multiple tool call statements indicate the same tool name and / or parameter input, the tool call statement data includes any one of the at least two tool call statements; or, when no at least two of the multiple tool call statements indicate the same tool name and / or parameter input, and the sum of the number of the multiple tool call statements satisfies a first threshold, the tool call statement data includes any one of the multiple tool call statements and a first mask marker, the first mask marker being used to indicate that any one of the tool call statements is incorrect.

[0205] In the context of programming and software development, "parameters" (or simply "parameters") refer to the values ​​or data passed to a function, method, or procedure. These values ​​are received when the function is called and are used or processed within the function. Parameters are part of the function definition and specify the data types and quantities the function expects to receive, and how they are used by the function. "Tool names" can refer to function libraries, class libraries, frameworks, or other tools that can be called by code to perform specific tasks. Parameters and tool names are two distinct concepts that often appear together in programming and software development. When calling a function or method, we need to specify the corresponding parameters, which may be passed directly through the code or through an interface provided by a tool or framework.

[0206] For example, in some cases, the tool name itself can also be used as part of the parameter input. For instance, when using a library or framework, we might need to specify which specific tool to use by passing the library or framework name as a parameter. Furthermore, specifying the tool name is frequently involved when setting parameters in configuration files or environment variables.

[0207] For example, the verification agent #1 can take the first requirement data and multiple tool call statements as input, perform a consistency vote on the multiple tool call statements, and determine the consistency of the multiple tool call statements.

[0208] For example, multiple tool call statements can be generated first, and the tool name and / or parameter input of the multiple tool call statements can be determined. If at least two of the multiple tool call statements have the same tool name and / or parameter input, then one of the at least two tool call statements can be selected as the most reasonable tool call statement, and the tool call statement data includes the most reasonable tool call statement. Alternatively, a first tool call statement can be generated and its tool name and / or parameter inputs determined. Then, a second tool call statement can be generated and its tool name and / or parameter inputs determined. If the tool names and / or parameter inputs of the first and second tool call statements are the same, they are considered consistent, satisfying the consistency requirement. In this case, one of the at least two tool call statements can be selected as the most reasonable tool call statement, and the tool call statement data includes the most reasonable tool call statement. Alternatively, if the tool names and / or parameter inputs of the first and second tool call statements are different, a third tool call statement can be generated and its tool name and / or parameter inputs determined. The tool names and / or parameter inputs of the first, second, and third tool call statements are compared, and so on, until at least two tool call statements with the same tool name and / or parameter inputs can be determined. Then, one of these at least two tool call statements with the same tool name and / or parameter inputs is selected as the most reasonable tool call statement. For example, if the most reasonable tool call statement cannot be determined among the multiple generated tool call statements, new tool call statements can be generated and consistency can be ensured.

[0209] Furthermore, since the tool names and / or parameter inputs of the at least two tool call statements are the same, it can be assumed that the probability of the at least two tool call statements successfully calling / simulating the call of the tool required to process the first requirement is relatively high. It can be assumed that the consistency judgment of multiple tool call statements can improve the accuracy of tool call statements.

[0210] When the number of generated tool call statements reaches a first threshold, and there are still no at least two tool call statements with the same tool name and / or parameter input parameters, one of the generated tool call statements can be randomly selected and marked with a first mask. This randomly selected tool call statement and the first mask mark are then identified as the tool call statement data. Subsequently, if this randomly selected tool call statement is used to train a language model, training data including this tool call statement can be skipped based on the first mask mark, ensuring that the training data used for language model learning is all validated and reasonable data.

[0211] The tool call statement data can be used to call / simulate calling the tool, and the result of calling / simulating the tool call can be generated based on the result of calling / simulating the tool call.

[0212] For example, taking a tool agent as an example, the tool agent can generate the results of calling / simulating tool calls based on the tool call statement data; the assistant agent can summarize the tool call results generated by the tool agent and reply to the user agent based on the summarized results. The tool call statement data, the results of calling / simulating tool calls, and the data that the assistant agent replies to the user agent after summarizing the tool call results can all be used to train the language model.

[0213] Based on the solution provided in the embodiments of this application, tool call statement data is determined by checking whether the tool name and / or parameter input of multiple tool call statements, and / or the number of multiple tool call statements meets a first threshold. On the one hand, this ensures that the training data generated for language model learning is verified and reasonable data, improving the correctness of the training data and helping the language model learn correct knowledge during training, reducing the illusion of the language model obtained by continuing to train based on the training data. On the other hand, it avoids generating tool call statements infinitely.

[0214] In some other possible implementations, the first response data includes dialogue response data. S730 may include:

[0215] The S730d generates multiple dialogue responses based on the primary requirement data.

[0216] S730e determines dialogue response data based on the consistency of multiple dialogue responses.

[0217] When it is determined that the format of the data generated in response to the first requirement (e.g., multiple dialogue replies) meets the format of a non-tool call, the dialogue reply data can be determined based on the consistency of the dialogue replies.

[0218] For example, when the first requirement is that there is no need to invoke tools, a dialogue response can be generated, and the dialogue response data can be determined based on the consistency of the dialogue response (e.g., content consistency).

[0219] For example, the above steps S730d and S730e can be performed by an assistant agent, and the consistency of multiple dialogue responses can be determined by a verification agent.

[0220] For example, taking the existence of assistant agent #1 and verification agent #1 as an example, assistant agent #1 can receive the first request data generated by the user agent. Based on the first request data, assistant agent #1 can generate multiple dialogue responses. Verification agent #1 can receive the multiple dialogue responses generated by assistant agent #1 and determine the consistency of the multiple dialogue responses. After determining the dialogue response used to respond to the first request based on the consistency of the multiple dialogue responses, assistant agent #1 can generate dialogue response data based on the dialogue response used to respond to the first request.

[0221] It should be understood that the embodiments of this application do not limit the order in which an assistant agent generates multiple data responses to the first requirement. An assistant agent can generate multiple data responses to the first requirement simultaneously or sequentially.

[0222] For example, step S730d can be executed by an assistant agent and a verification agent, S730e can be executed by the assistant agent, and the consistency of multiple tool call statements can be determined by the verification agent.

[0223] For example, assuming there are assistant agent #1 and verification agent #1, both can receive first request data generated by the user agent. Based on the first request data, assistant agent #1 can generate one or more first dialogue responses, and verification agent #1 can generate one or more second dialogue responses. Verification agent #1 can receive the first dialogue responses generated by assistant agent #1 and determine the consistency between the first and second dialogue responses. After determining the dialogue response used to respond to the first request based on the consistency between the first and second dialogue responses, assistant agent #1 can generate dialogue response data based on this dialogue response used to respond to the first request.

[0224] It should be understood that the embodiments of this application do not limit the order in which the verification agent and the assistant agent generate the data in response to the first requirement. The verification agent and the assistant agent can generate the data in response to the first requirement simultaneously or sequentially.

[0225] For example, step S730d can be performed by multiple assistant agents, and step S730e can be performed by one assistant agent. The consistency of multiple dialogue responses can be determined by the verification agent.

[0226] For example, assuming there are assistant agent #1, assistant agent #2, and verification agent #1, assistant agent #1 and assistant agent #2 can receive the first request data generated by the user agent. Based on the first request data, assistant agent #1 and assistant agent #2 can generate multiple first dialogue responses. Verification agent #1 can receive the multiple first dialogue responses generated by assistant agent #1 and assistant agent #2 and determine the consistency of the multiple first dialogue responses. After determining the dialogue response used to respond to the first request based on the consistency of the multiple first dialogue responses, assistant agent #1 or assistant agent #2 can generate dialogue response data based on the dialogue response used to respond to the first request.

[0227] It should be understood that when multiple assistant agents exist, these agents can generate multiple first dialogue responses. Verification agent #1 can receive these multiple first dialogue responses, and the consistency of these responses is determined. After determining the dialogue response used to address the first request based on the consistency of the multiple first dialogue responses, any one of the multiple assistant agents can be selected or designated. This selected or designated assistant agent can then generate dialogue response data based on the dialogue response used to address the first request.

[0228] It should be understood that the embodiments of this application do not limit the order in which multiple assistant agents generate data in response to the first requirement, and multiple assistant agents can generate data in response to the first requirement simultaneously or sequentially.

[0229] For example, step S730d can be performed by multiple assistant agents and one verification agent, and step S730e can be performed by one assistant agent. The consistency of multiple dialogue responses can be determined by the verification agent.

[0230] For example, assuming there are assistant agent #1, assistant agent #2, and verification agent #1, these three agents can receive first request data generated by the user agent. Based on the first request data, assistant agent #1 and assistant agent #2 can generate multiple first dialogue responses, and verification agent #1 can generate one or more second dialogue responses. Verification agent #1 can receive the first dialogue responses generated by assistant agent #1 and assistant agent #2 and determine the consistency between the first and second dialogue responses. After determining the dialogue response used to respond to the first request based on the consistency between the first and second dialogue responses, assistant agent #1 or assistant agent #2 can generate dialogue response data based on this dialogue response used to respond to the first request.

[0231] It should be understood that when multiple assistant agents exist, these agents can generate multiple first dialogue responses. Verification agent #1 can receive these multiple first dialogue responses, and the consistency between the multiple first dialogue responses and the second dialogue responses is determined. After determining the dialogue response used to respond to the first request based on the consistency between the multiple first dialogue responses and the second dialogue responses, one assistant agent can be selected or designated from among the multiple assistant agents. This selected or designated assistant agent can then generate dialogue response data based on the dialogue response used to respond to the first request.

[0232] It should be understood that the embodiments of this application do not limit the order in which the verification agent generates the data in response to the first requirement and the multiple assistant agents generate the data in response to the first requirement. The multiple assistant agents and the verification agent can generate the data in response to the first requirement simultaneously or sequentially.

[0233] Based on the solution provided in the embodiments of this application, on the one hand, by generating multiple dialogue responses based on the first demand data, and then determining the first response data including the dialogue response data, compared with generating training data only based on the tool call scenario, when the first demand data indicates a demand that does not require calling a tool, training data that can maintain the original general capabilities of the trained language model can be obtained, thereby improving the diversity and authenticity of the dialogue; on the other hand, based on the consistency of multiple dialogue responses, appropriate dialogue response data can be determined, thereby improving the correctness of the dialogue response data.

[0234] In some possible implementations, when at least two of the multiple dialogue responses satisfy content consistency, the dialogue response data includes any one of the at least two dialogue responses; or, when no at least two of the multiple dialogue responses satisfy content consistency, and the sum of the number of the multiple dialogue responses satisfies a second threshold, the dialogue response data includes any one of the multiple dialogue responses and a second mask marker, the second mask marker being used to indicate that the dialogue response is erroneous.

[0235] For example, the verification agent#1 can take the first requirement data and multiple dialogue responses as input, perform a consistency vote on the multiple dialogue responses, and determine the consistency of the multiple dialogue responses.

[0236] For example, after generating the data responding to the first request, it can be first determined whether the generated data meets the non-tool call criteria (because when the assistant agent generates the first response data, it cannot predict in advance whether the dialogue will be a tool call or a non-tool call; it needs to be determined based on the format of the dialogue response). Multiple data responses to the first request can be generated first. If at least two of the generated data responses meet the non-tool call criteria, then the data responding to the first request that meets the non-tool call criteria can be considered a dialogue response. The content of these multiple dialogue responses can then be determined, and the consistency of the content of these multiple dialogue responses can be judged. Alternatively, the first dialogue response can be determined based on the format of the first generated data response to the first request, and then the content of the first dialogue response can be determined. Then, based on the format of the second generated data response to the first request, the second dialogue response and its content can be determined, and the consistency of the content of the two dialogue responses can be compared.

[0237] For example, after determining that two dialogue responses satisfying non-tool calls have been generated (hereinafter referred to as dialogue response #A and dialogue response #B), the content of dialogue response #A and dialogue response #B can be determined, and their content consistency can be compared. When the content of dialogue response #A and dialogue response #B is consistent, either dialogue response #A or dialogue response #B can be selected as the most reasonable dialogue response; when the content of dialogue response #A and dialogue response #B is inconsistent, a third dialogue response, namely dialogue response #C, can be generated, and the content of dialogue response #C can be determined, then the content consistency of dialogue response #A, dialogue response #B, and dialogue response #C can be compared. When two of the dialogue responses #A, #B, and #C have the same content (e.g., dialogue responses #A and #C have the same content), either #A or #C can be chosen as the most reasonable dialogue response. When the content of dialogue responses #A, #B, and #C are all inconsistent, dialogue response #D can be generated, its content determined, and its consistency compared... When at least two dialogue responses with consistent content cannot be determined among dialogue responses #A, #B, #C, #D... #X, new dialogue responses can be generated and their consistency compared until at least two dialogue responses with consistent content can be determined; or, until the number of generated dialogue responses is greater than or equal to the second threshold.

[0238] It is understandable that the above-mentioned consistency is not limited to complete identical content. When two dialogue responses are largely consistent in content, express similar meanings, or achieve the same result, they can be considered to have consistent content. At least two dialogue responses with consistent content satisfy the consistency requirement.

[0239] If the number of generated dialogue responses is greater than or equal to the second threshold, and no dialogue response still meets the above requirement of content consistency, one of the generated dialogue responses can be randomly selected and marked with a second mask. This selected dialogue response and its second mask mark are then designated as the dialogue response data. If this selected dialogue response is subsequently used to train a language model, it can be skipped based on the second mask mark, ensuring that the training data used for language model learning is validated and reasonable.

[0240] Based on the solution provided in this application, the dialogue response data is determined by whether the content and / or number of multiple dialogue responses meet a second threshold. On the one hand, this ensures that the training data generated for language model learning is verified and reasonable, improving the accuracy of the training data and helping the language model learn correct knowledge during training, thus reducing the illusion of the language model obtained by continuing to train based on the training data. On the other hand, it avoids generating dialogue responses indefinitely.

[0241] In some possible implementations, the dialogue flow indicates the response method of the dialogue response; when the first response data includes dialogue response data, the first response data satisfies the response method; or, when the first response data includes tool call statement data, the tool call result data satisfies the response method, and the tool call result data is determined based on the tool call statement data.

[0242] In method 700 above, the generated first requirement data needs to conform to the constraints of the dialogue flow. The first response data generated in step S730 above, and / or the tool call result data determined based on the tool call statement data in the first response data, may also need to conform to the constraints of the dialogue flow.

[0243] For example, in addition to the dialogue flow, the dialogue flow may also include / indicate the response style of the dialogue reply (e.g., the dialogue flow constrains the language style of the reply to be serious, playful, or cute, etc.). The tool agent can return the result of the tool call / simulated tool call based on the tool call statement data. The assistant agent can summarize the result of the tool call and send it to the user agent as tool call result data representing the summarized result of the tool call. The tool call result data sent by the assistant agent to the user agent to represent the summarized result of the tool call can satisfy the constraints of the dialogue flow (the tool call result data needs to satisfy the language style of the reply constrained by the dialogue flow).

[0244] For example, in addition to the dialogue flow, the dialogue flow may also include / instruct the response method of the dialogue response (e.g., the dialogue flow constrains the language style of the response, whether to add a rhetorical question, etc.), and the dialogue response data may also need to meet the response method of the dialogue flow.

[0245] Based on the solution provided in the embodiments of this application, by restricting the response method of the dialogue flow, the constraints on the dialogue process can be further strengthened, the controllability and smoothness of the data generation process can be further improved, and the performance of the data generation process can be improved.

[0246] In some possible implementations, S720 may include:

[0247] S720a generates a second requirement based on the dialogue flow.

[0248] S720b generates first requirement data based on the second requirement, and the first requirement data indicates the second requirement.

[0249] In some other possible implementations, S720 may include:

[0250] S720c generates a third requirement based on the dialogue flow and dialogue history. The dialogue history includes completed requirements, and the third requirement represents the next requirement after the last requirement in the dialogue history.

[0251] S720d generates first requirement data based on third requirement, and the first requirement data indicates the third requirement.

[0252] For example, a first requirement may include multiple sub-requirements, and the dialogue flow generated based on the first requirement may include a dialogue process composed of dialogues based on multiple sub-requirements. Before generating the first requirement data based on the dialogue flow, a second requirement may be generated first. If no requirement in the dialogue process has been completed before generating the first requirement data based on the dialogue flow, then the second requirement may be the first requirement among multiple sub-requirements. If one or more requirements in the dialogue process have been completed before generating the first requirement data based on the dialogue flow, but not all requirements in the dialogue process have been completed, then the last requirement in the dialogue history can be determined based on the dialogue process and the dialogue history. Based on the last requirement in the dialogue history, a third requirement can be generated. The third requirement and the last requirement can satisfy the dialogue process (for example, a certain dialogue process includes requirement a, requirement b, requirement c, requirement d, and requirement e in sequence. When the last requirement in the dialogue history is determined to be requirement c, the next requirement of requirement c, i.e., requirement e, can be generated, and requirement e can be used as the third requirement).

[0253] Based on the solution provided in the embodiments of this application, a second or third requirement indicated by the first requirement data is generated according to the dialogue flow and dialogue history. This can effectively generate the first requirement in the dialogue process, or the next requirement after the last requirement in the dialogue history, based on the dialogue flow, thereby improving the controllability and smoothness of the data generation process.

[0254] The following describes some possible ways to build a toolset:

[0255] ① A large number of potentially valuable tools can be obtained from the internet (these tools do not need to have functional APIs or structured documentation that can be directly used by LLM), along with their names and brief descriptions. LLM text generation capabilities can then be used to build a comprehensive toolset, creating standardized documentation formats for each tool. The documentation for tools with structured documentation can describe their functions and usage in detail. This approach allows for the construction of a diverse and structured toolset that closely resembles real-world scenarios.

[0256] ② Alternatively, you can obtain an existing toolset, which may have structured documents that LLM can directly use; or, an existing toolset may not have structured documents that LLM can directly use. LLM can optimize or supplement the existing toolset based on its own capabilities, and finally obtain a toolset with structured documents that LLM can directly use.

[0257] ③ It can also obtain a large amount of information such as the names, introductions, descriptions, functional documents, and OpenAPI specifications of real tools, and build a toolset of real tools based on the above information.

[0258] Tool Usage Examples: To obtain tool usage examples from the aforementioned toolset, a simulation environment can be designed to model the interaction between the language model, the user, and the tool. For example, an LLM can be used to act as different agents, each with a specific prompt. Multiple agents can interact with the language model, the user, and the tool through method 700 above or process 800 below. In this way, a large number of tool usage examples can be generated without any manual intervention. Each tool usage example can consist of three key elements: {user's instructions, operations and their corresponding tool outputs, and the final response}.

[0259] Understandably, when the user agent's request does not involve invoking a tool, the assistant agent can generate a response directly without calling the tool. In this case, the user agent's command and the assistant agent's final response can constitute a non-tool usage instance.

[0260] By having an LLM act as the agent in method 700 above, tool usage instances and / or non-tool usage instances can be obtained. Tool usage instances can be used to train language models such as SLM and CLM, enabling them to learn corresponding knowledge and action methods, thus expanding the capability boundaries of language models such as SLM and CLM. Non-tool usage instances can be used together with tool usage instances to train language models such as SLM and CLM, allowing them to learn to invoke tools while retaining their original general capabilities.

[0261] It is understandable that the first demand data and the first response data can be used as training data to train a language model; the trained language model can then be used to process demands.

[0262] For example, the first demand data and the first response data can be used as training data. The training data can be input into the language model, and the language model can be trained by fine-tuning it.

[0263] For example, when the first response data meets the response method specified by the dialogue flow, the language model can be trained using this first response data, and the language model can be given the same requirements for the response method. For instance, the language model can be given the same requirements for the response method by adding a corresponding prompt to the first response data.

[0264] The specific implementation of the method for training the language model can be found in relevant technologies, and will not be elaborated further in the embodiments of this application.

[0265] For example, after determining the requirement to be processed, the requirement can be input into a language model, which is trained using the first requirement data and the first response data as training data. By inputting the requirement into the language model and processing it using a requirement processing method, a first processing result can be obtained. The specific implementation of the requirement processing method can be found in related technologies, and will not be elaborated further in this embodiment.

[0266] For example, the user's input request to "book a train ticket" can be identified as a request to be processed. The language model can process this request and output the result of booking the train ticket. The result of booking the train ticket is one possible implementation of the first processing result.

[0267] It is understood that the aforementioned methods for generating data, training models, or processing requirements can be implemented using a device. For example, the aforementioned methods for generating data, training models, or processing requirements can be implemented using a processor within the device. Specific implementation details of these methods using a processor within the device can be found in the invention summary section and will not be repeated here.

[0268] Figure 8 This is a schematic diagram of a data generation process 800 provided in an embodiment of this application. Process 800 can be used to implement the above-described method 700, and process 800 can be used to generate tool usage instances and / or non-tool usage instances.

[0269] like Figure 8As shown in (a), the dialogue planning agent can generate a dialogue flow based on given requirements and a list of tools. The dialogue flow can constrain the dialogue process. The planned dialogue process in the dialogue flow needs to meet the given requirements and the transitions between each requirement should be reasonable and natural.

[0270] The following describes the process 800 provided in this application embodiment using the given requirement of "booking an air ticket" as an example. It should be understood that the given requirement of "booking an air ticket" is merely illustrative and intended to facilitate understanding of this application, and should not constitute a limitation thereof. The given requirement can also be "booking a hotel," "booking tickets," "booking a conference," "travel advice," etc. The given requirement can be determined based on the aspects to be trained, or it can be determined from a requirement library storing multiple requirements according to a certain rule or randomly; this application embodiment does not impose any limitations in this regard.

[0271] For example, when training a language model to invoke tools for booking airline tickets, the given requirement could be "book an airline ticket"; or, a requirement could be randomly selected from those stored in a requirement library.

[0272] Given the requirement "book a flight", the dialogue planning agent can generate a dialogue flow based on "book a flight" and a tool list, etc. For example, the dialogue flow planned by the dialogue planning agent can include tool call requests, small talk, or non-tool call requests; the tool list can consist of tools from a toolset, representing tools that the assistant agent can call or simulate calls to.

[0273] Tool usage requirements refer to a user's need to use a tool or system to complete a specific task or obtain specific information. Tool usage requirements have a clear purpose; the user hopes to achieve a specific function or obtain a specific result through tool usage. For example, a user might want to use a tool to book a flight.

[0274] Non-tool-based needs refer to users' needs for information, advice, or non-tool-based interaction without requiring the use of specific tools. These needs are more flexible and diverse, potentially involving user emotions, opinions, suggestions, or general information queries. For example, users might ask for travel advice, seek shopping recommendations, or discuss news events. These needs do not require specific tools but rather broader interaction and discussion with the user.

[0275] Casual conversation refers to the need for relaxed and casual conversations between users without a specific purpose. Casual conversation is characterized by its casualness and lack of purpose; users may simply want to engage in friendly exchange, sharing thoughts or feelings. Examples include daily chats with friends, casual exchanges on social media, and other scenarios where conversations typically lack a specific objective or need, aiming only to enhance mutual understanding and friendship.

[0276] For example, a dialogue flow can be planned based on the following requirements:

[0277] Requirement 1: The user requests to book a flight.

[0278] Requirement 2: Users initiate casual conversation.

[0279] Requirement 3: Users ask for travel advice.

[0280] Requirement 4: Users request additional flight bookings.

[0281] Requirement 5: The user requests to book a return flight.

[0282] The five requirements described above are merely illustrative and do not constitute a limitation of this application. The transformation of the five requirements is reasonable and natural, and the dialogue process based on the five requirements conforms to the given requirements.

[0283] The user agent generation requirement must conform to the above dialogue process.

[0284] Specifically, after the dialogue planning agent generates the dialogue flow, the user agent needs to determine which requirement in the dialogue flow planning is currently being implemented based on the dialogue flow and dialogue history, and then generate the corresponding requirement. The generated requirement is the next requirement after the last requirement that has been completed in the current dialogue process.

[0285] For example, if the user agent determines that there are no completed requests based on the dialogue history, it can generate request ①; if the user agent determines that the last completed request was request ① based on the dialogue history, it can generate the next request after request ①, i.e., generate request ②; if the user agent determines that the last completed request was request ② based on the dialogue history, it can generate the next request after request ②, i.e., generate request ③; if the user agent determines that the last completed request was request ③ based on the dialogue history, it can generate the next request after request ③, i.e., generate request ④; if the user agent determines that the last completed request was request ④ based on the dialogue history, it can generate the next request after request ④, i.e., generate request ⑤; if the user agent determines that the last completed request was request ⑤ based on the dialogue history, and there are no other requests after request ⑤, then data generation can stop.

[0286] If the requirements generated by the user agent do not conform to the above dialogue process, the user agent needs to regenerate the requirements.

[0287] In some possible implementations, in addition to the dialogue planning agent and the user agent, an assistant agent can also be set up to generate response data that corresponds to the requirements generated by the user agent.

[0288] The assistant agent in this solution can be as follows: Figure 8 As shown, this is an assistant agent. An assistant agent can receive interaction requests / follow-up questions and other data sent by each user agent, and generate follow-up / completion requests and other data to respond to the user agents. In this solution, there can also be multiple assistant agents. Figure 8 (Not shown in the diagram), multiple assistant agents can receive interaction requests / follow-up questions and other data sent by each user agent, and generate multiple follow-up questions / completion requests and other data to respond to the user agent (for example, multiple assistant agents can generate multiple responses to the first request, and the multiple responses to the first request are used to respond to the user agent). This application embodiment does not limit this.

[0289] For example, the assistant agent can generate response data based on the request generated by the user agent. After generating the response data, its format can be used to determine whether it involves a tool call. If it involves a tool call, the response data is considered a tool call statement; otherwise, it is considered a dialogue response.

[0290] In some possible implementations, in addition to the dialogue planning agent, assistant agent, and user agent, a tool agent can also be set up to invoke the tool.

[0291] In some possible implementations, in addition to the dialogue planning agent, assistant agent, and user agent, a verification agent can also be set up to verify whether the response data meets the consistency requirements. After the assistant agent generates one or more dialogue responses or one or more tool call statements, it can send the generated one or more dialogue responses or one or more tool call statements to the verification agent, which will then verify whether the consistency is met.

[0292] For example, the verification agent in this solution can be as follows: Figure 8As shown, the verification agent can verify whether multiple dialogue responses / tool ​​invocation statements generated by a single assistant agent satisfy consistency; the verification agent can also verify whether multiple dialogue responses / tool ​​invocation statements generated by multiple assistant agents satisfy consistency; the verification agent can also verify whether multiple dialogue responses / tool ​​invocation statements generated by one or more assistant agents and the verification agent itself satisfy consistency (for example, the verification agent can receive interaction requests / follow-up questions sent by each user agent and generate follow-up questions / completion requests, etc., to respond to the user agent). Figure 8 (Not shown in the image); The verification agent can verify whether the response data it generates and the response data it receives are consistent. The received response data can be generated by one or more assistant agents based on the request data sent by the user agent.

[0293] After the user agent generates requirement ① based on the dialogue flow, it needs to send requirement ① to the assistant agent (and may also send it to the verification agent). Requirement ① involves using a tool, so the data generated by the assistant agent and / or verification agent in response to requirement ① should include a tool invocation statement. The assistant agent can send the tool invocation statement data, including the generated tool invocation statement, to the tool agent to obtain the tool invocation result. If multiple tool invocation statements generated by the assistant agent and / or verification agent satisfy consistency, any one of the consistent tool invocation statements can be identified as the tool invocation statement data and considered correct. The tool agent can send the tool invocation result to the assistant agent, which can summarize the tool invocation result and reply to the user agent. If multiple tool invocation statements generated by the assistant agent and / or verification agent do not satisfy consistency and the number of multiple tool invocation statements is greater than or equal to a preset threshold (e.g., a first threshold), any one of the inconsistent tool invocation statements can be masked, and that tool invocation statement and the masked label can be identified as the tool invocation statement data.

[0294] For details on determining the specific data of tool call statements based on the consistency of multiple tool call statements, please refer to the relevant description of step S730 above.

[0295] After the user agent generates requirement ③ based on the dialogue flow, it needs to send requirement ③ to the assistant agent (and may also send it to the verification agent). If requirement ③ does not involve the use of tools, the data in the response requirement ③ generated by the assistant agent and / or verification agent should include the dialogue reply. After generating the dialogue reply, the assistant agent can send the dialogue reply data to the user agent based on the generated dialogue reply.

[0296] For example, the assistant agent and / or verification agent can generate two dialogue responses, namely response #A and response #B. The verification agent performs consistency verification on response #A and response #B. If response #A and response #B are substantially consistent or have identical content, response #A / response #B can be determined as the most reasonable response, and the assistant agent sends dialogue response data including this most reasonable response to the user agent. If response #A and response #B do not meet the criteria of substantially consistent or having identical content, the assistant agent and / or verification agent can generate response #C, and the verification agent performs consistency verification until the most reasonable response can be determined from multiple dialogue responses. Alternatively, a threshold can be preset (e.g., a second threshold). When the number of dialogue responses is greater than or equal to the threshold and there is no most reasonable response among the generated multiple dialogue responses, any one of the multiple dialogue responses can be selected and masked. This selected dialogue response and the masked label are then used as the dialogue response sent to the user agent (i.e., the selected dialogue response and the masked label are determined as the dialogue response data).

[0297] For details on determining the specifics of dialogue response data based on the consistency of multiple dialogue responses, please refer to the relevant description of step S730 above.

[0298] The user agent's requests generated based on the dialogue flow, the assistant agent's responses to the user agent, or the tool invocation statements and / or dialogue responses generated by the assistant agent and / or verification agent can all be used as data for further training of the language model, enabling the trained language model's capabilities to improve in the desired direction. When the data for further training the language model is masked, it can be skipped during training, thereby reducing errors by the assistant agent. When the user's request involves a tool invocation, the response sent by the assistant agent to the user agent may include the result of the tool invocation.

[0299] like Figure 8As shown in (b), the user agent needs to generate requirements based on the dialogue flow and dialogue history. For example, after the user agent determines from the dialogue history that the last requirement that has been completed is the user's additional flight booking requirement, the user agent can generate the next requirement after the user's additional flight booking requirement, namely, the return flight booking requirement, based on the dialogue flow.

[0300] In some possible implementations, no special requirements may be placed on the assistant agent and / or verification agent, as long as the assistant agent and / or verification agent can accurately answer the user agent's questions and the verification agent can verify consistency.

[0301] In some other possible implementations, the way the assistant agent and / or verification agent generate responses needs to conform to the constraints of the dialogue flow.

[0302] For example, the response methods generated by the assistant agent and / or verification agent can also be constrained by the dialogue flow. For instance, the dialogue flow can restrict the response methods of the assistant agent and / or verification agent (such as the style of their responses, whether to add rhetorical questions, etc.). In this case, both the user agent and the assistant agent and / or verification agent need to conform to the dialogue flow when generating their responses. If the response methods generated by the assistant agent and / or verification agent do not conform to the above dialogue flow, the assistant agent and / or verification agent need to regenerate their responses.

[0303] For example, one or more of the dialogue planning agent, user agent, assistant agent, tool agent, and verification agent mentioned above can be intelligent agents played by the LLM. The data obtained by the intelligent agents played by the LLM can be used to train language models such as SLM and CLM, and to expand the capability boundaries of language models such as SLM and CLM. The tool agent mentioned above can also be a real tool interface.

[0304] The methods 700 or processes 800 described above can be used for content generation, chatbot construction, and other tasks requiring specific needs. For example, methods 700 or processes 800 can be used to construct scripts, where the expected plot development is used as a dialogue flow. By having LLMs play different roles, and based on this dialogue flow, a script that meets the expectations can be generated.

[0305] Figure 9 This is a schematic diagram of an apparatus 900 for generating data or model training or demand processing provided in an embodiment of this application. Figure 9As shown, the device 900 can be a data generation device with data generation function, a model training device with model training function, or a demand processing device with demand processing function. It can also be a component (e.g., unit, module, chip, or chip system) configured in the data generation device, model training device, or demand processing device. The device 900 includes a processing unit 920, and optionally, a transceiver unit 910. The transceiver unit 910 can be used to implement transceiver functions. The transceiver unit 910 can also be called a communication interface or communication unit. The processing unit 920 can be used to process the demand to be processed, the first demand data, or the first demand, etc.

[0306] Optionally, the device 900 may further include a storage unit, which can be used to store instructions and / or data, and the processing unit 920 can read the instructions and / or data in the storage unit to enable the device to implement the aforementioned method embodiments.

[0307] For example, the device 900 may be a data generation device with data generation function, or a data generation device applied to or used in conjunction with a data generation device and capable of implementing a method executed by the data generation device, such as a chip, chip system, or circuit. See details below. Figure 11 The chip system shown is described in detail.

[0308] For example, the device 900 can be a model training device with model training function, or a model training device applied to or used in conjunction with a model training device and capable of implementing the methods executed by the model training device, such as a chip, chip system, or circuit. See details below. Figure 11 The chip system shown is described in detail.

[0309] For example, the device 900 may be a demand processing device with demand processing function, or a demand processing device applied to or used in conjunction with a demand processing device to implement a method executed by the demand processing device, such as a chip, chip system, or circuit. See details below. Figure 11 The chip system shown is described in detail.

[0310] As a design, the device 900 can be used to perform the above. Figure 7 The method embodiment executes the steps or processes described above, and the processing unit 920 is used to execute the above. Figure 7 The method embodiment processes related operations (e.g., steps S710 to S730 described above). The transceiver unit 910 can be used to receive data, and the processing unit 920 can use the data received by the transceiver unit 910 as a pending requirement, a first requirement, or first requirement data, etc.

[0311] As a design feature, the processing unit 920 can be used to input the requirements to be processed into the language model after further training to obtain the first processing result.

[0312] It should be understood that the specific process of each unit performing the above-mentioned corresponding steps has been described in detail in the above method embodiments, and will not be repeated here for the sake of brevity.

[0313] It should also be understood that the device 900 here is embodied in the form of a functional unit. The term "unit" here may refer to application-specific integrated circuits (ASICs), electronic circuits, processors (e.g., shared processors, proprietary processors, or group processors) and memories for executing one or more software or firmware programs, combined logic circuits, and / or other suitable components that support the described functions.

[0314] The apparatus 900 of each of the above-described schemes can have the function of implementing the corresponding steps in the method 700 described above. The function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions; for example, the transceiver unit can be replaced by a transceiver (e.g., the transmitting unit in the transceiver unit can be replaced by a transmitter, and the receiving unit in the transceiver unit can be replaced by a receiver), and other units, such as processing units, can be replaced by processors, each executing the transceiver operations and related processing operations in the respective method embodiments.

[0315] In addition, the transceiver unit 910 described above can also be a transceiver circuit (for example, it may include a receiving circuit and a transmitting circuit), and the processing unit can be a processing circuit.

[0316] It should be pointed out that, Figure 9 The device mentioned can be the data generation, model training, or demand processing device described in the foregoing embodiments, or it can be a chip or a chip system, such as a system on a chip (SoC). The transceiver unit can be an input / output circuit or a communication interface; the processing unit is a processor, microprocessor, or integrated circuit integrated on the chip. No limitations are imposed here.

[0317] Figure 10 This is a schematic diagram of an apparatus 1000 for generating data or model training or demand processing provided in an embodiment of this application. Figure 10 As shown, the device 1000 includes a processor 1010. Optionally, the device 1000 also includes a communication interface 1030, which is used for receiving and / or transmitting signals or data, and the processor 1010 is used for processing the received signals or data. For example, the processor 1010 is used to process the signals or data received and / or transmitted by the communication interface 1030.

[0318] Optionally, the device 1000 further includes a memory 1020, with a processor 1010 coupled to the memory 1020. The memory 1020 is used to store programs or instructions and / or data for generating data or model training or demand processing. The processor 1010 is used to execute the programs or instructions for generating data or model training or demand processing stored in the memory 1020, or to read the data stored in the memory 1020, to execute the methods in the above-described method embodiments. For example, the processor 1010 can obtain data or algorithms stored in the memory 1020 to perform the above-described data generation, model training, or demand processing.

[0319] Optionally, there may be one or more processors 1010.

[0320] Optionally, there may be one or more memory units 1020.

[0321] Optionally, the memory 1020 can be integrated with the processor 1010, or it can be set separately.

[0322] As an example, processor 1010 may have Figure 9 The processing unit 920 shown has the function of a storage unit, the memory 1020 can have the function of a storage unit, and the communication interface 1030 can have the function of a storage unit. Figure 9 The function of the transceiver unit 910 shown is illustrated.

[0323] For example, the device 1000 may be a data generation device with data generation function, or a data generation device applied to or used in conjunction with a data generation device and capable of implementing a method executed by the data generation device, such as a chip, chip system, or circuit. See details below. Figure 11 The chip system shown is described in detail.

[0324] For example, the device 1000 may be a model training device with model training function, or a model training device applied to or used in conjunction with a model training device and capable of implementing the methods executed by the model training device, such as a chip, chip system, or circuit. See details below. Figure 11 The chip system shown is described in detail.

[0325] For example, the device 1000 may be a demand processing device with demand processing function, or a demand processing device applied to or used in conjunction with a demand processing device to implement a method executed by the demand processing device, such as a chip, chip system, or circuit. See details below. Figure 11 The chip system shown is described in detail.

[0326] As a design, the device 1000 is used to perform the above. Figure 7 In the method embodiments, the communication interface 1030 is used to execute the send / receive related operations in the above method embodiments, and the processor 1010 is used to execute the above... Figure 7 The method implementation involves processing related operations (e.g., determining the requirement to be processed; inputting the requirement to be processed into the language model after further training to obtain the first processing result, etc.).

[0327] It should be understood that the processor mentioned in the embodiments of this application can be one of the following devices or a portion of the circuitry used for processing functions: a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), ASICs, field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or the execution of a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory 1020. Processor 1010 reads information from memory 1020 and, in conjunction with its hardware, completes the functions required by the units included in the electronic device, or executes the data processing method of the embodiments of this application.

[0328] The communication interface uses transceiver devices, such as, but not limited to, transceivers, to enable communication between device 1000 and other devices or communication networks. For example, data to be processed can be obtained through the communication interface.

[0329] The bus may include a pathway for transmitting information between various components of the device 1000 (e.g., memory 1020, processor 1010, communication interface 1030).

[0330] Below, in conjunction with Figure 11 The chip system in the data generation device / demand processing device / model training device is described.

[0331] Figure 11 This is a schematic diagram of a chip system 1100 provided in an embodiment of this application. The chip system 1100 (or may also be called a processing system) includes logic circuitry 1110 and an input / output interface 1120.

[0332] The logic circuit 1110 can be a processing circuit in the chip system 1100. The logic circuit 1110 can be coupled to a memory unit, calling instructions from the memory unit, enabling the chip system 1100 to implement the methods and functions of the embodiments of this application. The input / output interface 1120 can be an input / output circuit in the chip system 1100, outputting processed information from the chip system 1100, or inputting data or signaling information to be processed into the chip system 1100 for processing.

[0333] For example, if the processing device is equipped with the chip system 1100, the logic circuit 1110 is coupled to the input / output interface 1120, and the input / output interface 1120 can input the input information to the logic circuit 1110 for processing.

[0334] This application provides a computer-readable storage medium storing computer instructions for implementing the methods executed by the data generation device / demand processing device / model training device in the above-described method embodiments.

[0335] For example, when the computer program is executed by a computer, the computer can implement the methods performed by the data generation device / demand processing device / model training device in the various embodiments of the above methods.

[0336] This application provides a computer program product containing instructions that, when executed by a computer, implement the methods performed by the data generation device / demand processing device / model training device in the above-described method embodiments.

[0337] The explanations and beneficial effects of the relevant contents in any of the devices provided above can be found in the corresponding method embodiments provided above, and will not be repeated here.

[0338] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0339] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0340] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0341] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0342] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0343] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0344] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for generating data, characterized in that, include: A dialogue flow is generated based on a first requirement, the dialogue flow including a dialogue process that conforms to the first requirement; First demand data is generated based on the dialogue flow; First response data is generated based on the first demand data, and the first demand data and the first response data are used to train a language model.

2. The method according to claim 1, characterized in that, The dialogue flow indicates the response method for the dialogue reply; When the first response data includes dialogue reply data, the first response data satisfies the reply method; or... When the first response data includes tool call statement data and the tool call result data satisfies the response method, the tool call result data is determined based on the tool call statement data.

3. The method according to claim 1 or 2, characterized in that, The step of generating the first demand data based on the dialogue stream includes: Generate a second requirement based on the dialogue flow; generate first requirement data based on the second requirement, the first requirement data indicating the second requirement; and / or A third requirement is generated based on the dialogue flow and dialogue history, the dialogue history including completed requirements, and the third requirement representing the next requirement after the last requirement in the dialogue history; first requirement data is generated based on the third requirement, and the first requirement data indicates the third requirement.

4. The method according to any one of claims 1 to 3, characterized in that, The first response data includes tool call statement data; The step of generating first response data based on the first demand data includes: Generate multiple tool call statements based on the first requirement data; The tool call statement data is determined based on the consistency of the multiple tool call statements.

5. The method according to claim 4, characterized in that, When at least two of the plurality of tool call statements indicate the same tool name and / or parameter input, the tool call statement data includes any one of the at least two tool call statements; or... When there are no at least two tool call statements that indicate the same tool name and / or parameter input, and the sum of the number of the multiple tool call statements meets a first threshold, the tool call statement data includes any one of the multiple tool call statements and a first mask mark, the first mask mark being used to indicate that any one of the tool call statements is incorrect.

6. The method according to any one of claims 1 to 3, characterized in that, The first response data includes dialogue reply data; The step of generating first response data based on the first demand data includes: Multiple dialogue responses are generated based on the first requirement data; The dialogue response data is determined based on the consistency of the multiple dialogue responses.

7. The method according to claim 6, characterized in that, When at least two of the multiple dialogue responses satisfy the content consistency requirement, the dialogue response data includes any one of the at least two dialogue responses. or, When at least two of the multiple dialogue responses satisfy content consistency, and the sum of the number of the multiple dialogue responses satisfies a second threshold, the dialogue response data includes any one of the multiple dialogue responses and a second mask marker, the second mask marker being used to indicate that any one of the dialogue responses is incorrect.

8. A method for demand processing, characterized in that, include: Identify the requirements to be processed; The requirement to be processed is input into a language model to obtain a first processing result, wherein the language model is trained based on the first requirement data and the first response data, the first requirement data is generated based on a dialogue flow, the dialogue flow is generated based on the first requirement, the dialogue flow includes a dialogue process that conforms to the first requirement, and the first response data is generated based on the first requirement data.

9. The method according to claim 8, characterized in that, The dialogue flow indicates the response method for the dialogue reply; When the first response data includes dialogue reply data, the first response data satisfies the reply method; or... When the first response data includes tool call statement data and the tool call result data satisfies the response method, the tool call result data is determined based on the tool call statement data.

10. The method according to claim 8 or 9, characterized in that, The first requirement data is generated based on the second requirement, the first requirement data indicating the second requirement, and the second requirement being generated based on the dialogue flow; or, The first requirement data is generated based on the third requirement, which indicates the third requirement. The third requirement is generated based on the dialogue flow and dialogue history, which includes completed requirements. The third requirement represents the next requirement after the last requirement in the dialogue history.

11. An apparatus for generating data, characterized in that, Includes a processor, the processor being used for: A dialogue flow is generated based on a first requirement, the dialogue flow including a dialogue process that conforms to the first requirement; First demand data is generated based on the dialogue flow; First response data is generated based on the first demand data, and the first demand data and the first response data are used to train a language model.

12. The apparatus according to claim 11, characterized in that, The device is a chip.

13. A demand processing apparatus, characterized in that, Includes a processor, the processor being used for: Identify the requirements to be processed; The requirement to be processed is input into a language model to obtain a first processing result, wherein the language model is trained based on the first requirement data and the first response data, the first requirement data is generated based on a dialogue flow, the dialogue flow is generated based on the first requirement, the dialogue flow includes a dialogue process that conforms to the first requirement, and the first response data is generated based on the first requirement data.

14. The apparatus according to claim 13, characterized in that, The device is a chip.

15. A chip or chip system, characterized in that, Includes: a circuit for performing the method as described in any one of claims 1 to 7, or the method as described in any one of claims 8 to 10.

16. A computer program product, characterized in that, When the computer program in the computer program product is executed by a computing device, it implements the method as described in any one of claims 1 to 7, or the method as described in any one of claims 8 to 10.

17. A computer-readable storage medium, characterized in that, The storage medium stores a computer program or instructions that, when executed by a computing device, implement the method as described in any one of claims 1 to 7, or the method as described in any one of claims 8 to 10.