Information generation method and apparatus, and electronic device
Patent Information
- Application Number
- CN202610703133.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-20
- Publication Date
- 2026-08-18
AI Technical Summary
而这个过程通常需要重复多次才能够收集到所有信息要素,这就导致用户迟迟无法获取期望的回复信息,从而影响用户使用体验
[0025]This specification provides an information generation scheme that eliminates the need to collect all information elements at once before generating a response. Instead, it employs a progressive response mechanism. When the information elements obtained from the question are incomplete, intermediate response information can be generated based on these incomplete elements and quickly returned to the client, thus avoiding the negative experience caused by users not receiving a response for an extended period. Furthermore, all information elements are gradually collected through subsequent questions, and the final response information is generated and presented only after all information elements have been collected. This step-by-step display of intermediate response information also demonstrates the "thinking process" to the user, enhancing their sense of trust and control.
Smart Images

Figure CN122594426A_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification relate to the field of computer technology, and in particular to an information generation method, apparatus, and electronic device. Background Technology
[0002] Intelligent customer service typically refers to an automated customer service system based on natural language processing and deep learning. Its core technologies include semantic parsing and dynamic knowledge base management, and it has 24 / 7 response capabilities.
[0003] Traditional intelligent customer service relies on a sequential model of "aggregating all information before generating a reply." Simply put, it requires waiting for all the information elements needed to generate a reply to be complete before generating the corresponding reply based on these information elements.
[0004] This means that when a user doesn't input all the necessary information in their question at once, the AI-powered customer service needs to prompt the user to re-enter or provide several options for the missing information. This process often needs to be repeated multiple times to collect all the information, resulting in users being unable to receive the expected response and negatively impacting their user experience. Summary of the Invention
[0005] This specification provides an information generation method, apparatus, and electronic device through its embodiments.
[0006] According to a first aspect of the embodiments of this specification, an information generation method is provided, the method comprising: Receive questions sent by the client; The question information carried in the question request is preprocessed to obtain a set of information elements used to generate the response information; Determine whether the information elements in the information element set are complete. If the information elements are incomplete, send the information element set to the first large language model to generate intermediate response information; or, if the information elements are complete, send the information element set and the generated intermediate response information to the second large language model to generate final response information. The intermediate response information or the final response information is returned to the client.
[0007] Optionally, the preprocessing of the question information carried in the question request includes: The question request carries the question information to a distributed cluster, where different nodes in the distributed cluster asynchronously preprocess the question information for different information elements; wherein, one node corresponds to the preprocessing of one type of information element.
[0008] Optionally, the information elements include the questioning intent, knowledge fragments, user information, and prediction functions; The question intent and the user information are determined from the question information; the knowledge fragment is retrieved from a preset knowledge base based on the question intent; and the prediction function is a function predicted based on the question intent that is required to call an external service. Determining whether the information elements in the information element set are complete includes: Determine whether the set of information elements includes the question intent, knowledge fragments, and user information, or the question intent, knowledge fragments, user information, and prediction function; If the information element set includes the question intent, knowledge fragment, and user information, or the question intent, knowledge fragment, user information, and prediction function, then the information element set is determined to be complete. If the information element set lacks at least one of the question intent, knowledge fragment, and user information, then the information element set is determined to be incomplete.
[0009] Optionally, the first large language model is a lightweight language model, and the second large language model is the main language model; the intermediate response information includes confirmation response information or summary response information.
[0010] Optionally, determining whether the information elements in the information element set are complete includes: The ready status of each information element in the information element set is monitored according to the event notification mechanism; When an event notification indicating that any information element is ready is received, the completeness of the information element set is determined based on the ready information elements.
[0011] Optionally, before determining whether the information elements in the information element set are complete, the method further includes: Determine if there are any historical question requests belonging to the same dialogue as the question request; If it exists, merge the information element set with the historical information element set corresponding to the historical question request to obtain the merged information element set; Determining whether the information elements in the information element set are complete includes: Determine whether the information elements in the merged information element set are complete.
[0012] Optionally, merging the information element set with the historical information element set corresponding to the historical query request includes at least one of the following: When the information element set contains a target information element that is missing from the historical information element set, the target information element is added to the historical information element set to obtain a merged information element set. When a target information element that is missing from the information element set exists in the historical information element set, the target information element is added to the information element set to obtain a merged information element set.
[0013] Optionally, returning the intermediate response information or the final response information to the client includes: The intermediate response information or the final response information is encapsulated into structured event data for data updating. The structured event data includes an event type field, which includes at least one of a first field corresponding to the intermediate response information or a second field corresponding to the final response information. The first field is used to instruct the client to append the structured event data, and the second field is used to instruct the client to finally display the structured event data. The structured event data is pushed to the client, so that the client can, based on the event type field in the structured event data, display the intermediate response information as append content after the already displayed historical intermediate response information; or, replace the already displayed historical intermediate response information with the final response information.
[0014] Optionally, during the process of gradually preparing each information element in the information element set, for each prepared information element, a corresponding semantic fragment is generated in real time using the prepared information element. The semantic fragment is returned to the client via a push event stream.
[0015] Optionally, after receiving the query request sent by the client, the method further includes: In response to the query request, a prompt message is returned to the client; wherein the prompt message is used to indicate that a response message is being generated.
[0016] Optionally, the method further includes: If the waiting time for all information elements in the information element set to be ready reaches a preset threshold, then the first large language model or the second large language model is triggered to generate response information based on the ready information elements.
[0017] According to a second aspect of the embodiments of this specification, a system is provided, the system comprising: a gateway, a preprocessor, and a model coordinator; The gateway is used to receive query requests sent by clients; The preprocessor is used to preprocess the question information carried in the question request to obtain a set of information elements for generating response information; The model coordinator is used to determine whether the information elements in the information element set are complete. If the information elements are incomplete, the information element set is sent to the first large language model to generate intermediate response information; or, if the information elements are complete, the information element set and the generated intermediate response information are sent to the second large language model to generate final response information. The gateway is also used to return the intermediate response information or the final response information to the client.
[0018] Optionally, the system also includes a message queue; The gateway is also used to add the query request to the message queue; The message queue is used to send the target question request to the preprocessor in the order in which the question requests are added.
[0019] Optionally, the preprocessor includes a distributed cluster; The preprocessor is used to preprocess the question information carried in the question request, including: Different nodes in the distributed cluster are used to asynchronously preprocess different information elements of the question information carried by the question request; wherein, one node corresponds to the preprocessing of one type of information element.
[0020] Optionally, the system may also include an event database; The preprocessor associates the preprocessed information elements with the unique identifier corresponding to the query request and writes them into the event database. In response to the written information element, the event database generates an event notification that the information element is ready. The model coordinator is used to determine whether the information elements in the information element set are complete, including: The model coordinator is used to retrieve the information element corresponding to the event notification from the event database when the event notification is detected, and add it to the information element set corresponding to the unique identifier according to the unique identifier associated with the information element; Determine whether the information elements in the information element set are complete.
[0021] Optionally, the system also includes a real-time message pusher; The real-time message pusher is used to receive intermediate response information output by the first large language model or final response information output by the second large language model, and encapsulate the intermediate response information or the final response information into structured event data for data updates. The structured event data includes an event type field, which includes at least one of a first field corresponding to the intermediate response information or a second field corresponding to the final response information. The first field is used to instruct the client to append to the structured event data, and the second field is used to instruct the client to finally display the structured event data. Furthermore, the structured event data is pushed to the client, so that the client can, based on the event type field in the structured event data, display the intermediate response information as append content after the already displayed historical intermediate response information; or, replace the already displayed historical intermediate response information with the final response information.
[0022] According to a third aspect of the embodiments of this specification, an information generation apparatus is provided, the apparatus comprising: The receiving unit receives query requests sent by the client; The preprocessing unit preprocesses the question information carried in the question request to obtain a set of information elements for generating response information; The generation unit determines whether the information elements in the information element set are complete. If the information elements are incomplete, the information element set is sent to the first large language model to generate intermediate response information; or, if the information elements are complete, the information element set and the generated intermediate response information are sent to the second large language model to generate final response information. The return unit returns the intermediate response information or the final response information to the client.
[0023] According to a fourth aspect of the embodiments of this specification, an electronic device is provided, comprising: processor; Memory used to store processor-executable instructions; The processor is configured for any of the above-mentioned methods of information generation or student model application.
[0024] According to a fifth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform any of the above-described methods for information generation or student model application.
[0025] This specification provides an information generation scheme that eliminates the need to collect all information elements at once before generating a response. Instead, it employs a progressive response mechanism. When the information elements obtained from the question are incomplete, intermediate response information can be generated based on these incomplete elements and quickly returned to the client, thus avoiding the negative experience caused by users not receiving a response for an extended period. Furthermore, all information elements are gradually collected through subsequent questions, and the final response information is generated and presented only after all information elements have been collected. This step-by-step display of intermediate response information also demonstrates the "thinking process" to the user, enhancing their sense of trust and control. Attached Figure Description
[0026] Figure 1 This is a schematic diagram of the system architecture provided in one embodiment of this specification; Figure 2 This is an execution flowchart of a gateway provided in one embodiment of this specification; Figure 3 This is an execution flowchart of a distributed cluster provided in one embodiment of this specification; Figure 4 This is a flowchart of an information generation method provided in one embodiment of this specification; Figure 5 This is a structural diagram of an electronic device provided in one embodiment of this specification; Figure 6 This is a module of the information generation apparatus provided in one embodiment of this specification. Detailed Implementation
[0027] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this specification as detailed in the appended claims.
[0028] The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of this specification. The singular forms “a,” “the,” and “the” as used in this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0029] It should be understood that although the terms first, second, third, etc., may be used in this specification to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this specification, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0030] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties. The collection, use and processing of related data shall comply with relevant laws, regulations and standards, and corresponding operation entry points shall be provided for users to choose to authorize or refuse.
[0031] This application aims to provide an information generation scheme that does not require collecting all information elements at once before responding. Specifically, it adopts a progressive response mechanism of "acquiring and generating simultaneously." When the information elements obtained from the received question are incomplete, intermediate response information can be generated based on these incomplete elements to quickly return the intermediate response information to the client, thereby avoiding the poor user experience caused by the inability to receive a response for a long time. All information elements are gradually collected through subsequent question information, and the final response information is generated and presented only after all information elements have been collected. By displaying each intermediate response information step by step, the "thinking process" can also be shown to the user, enhancing the user's sense of trust and control.
[0032] Please refer to the following: Figure 1 This specification provides an architectural diagram of a system for information generation. The system may include a gateway, a preprocessor, and a model coordinator; furthermore, the system may be equipped with or connected to a first and second major language model. The interface gateway is used to receive query requests sent by the client; The preprocessor is used to preprocess the question information carried in the question request to obtain a set of information elements for generating response information; The model coordinator is used to determine whether the information elements in the information element set are complete. If the information elements are incomplete, the information element set is sent to the first large language model to generate intermediate response information; or, if the information elements are complete, the information element set and the generated intermediate response information are sent to the second large language model to generate final response information. The gateway is also used to return the intermediate response information or the final response information to the client.
[0033] In this system, the aforementioned primary language model can be one or more lightweight language models. These lightweight language models only have the ability to generate simple content such as confirmation / summary types, and do not need to generate complex content, thus improving response speed. When selecting the primary language model, one can be randomly chosen, a default model can be selected, or the model with the lowest load can be selected based on the actual load of these primary language models.
[0034] The second major language model mentioned above can be one or more main language models capable of generating complex content. Because the main language model has the ability to generate complex content, it can improve the quality of the generated response information. When selecting the second major language model, you can randomly choose one, select the default one, or select the one with the lowest load based on the actual load of these major language models.
[0035] In this application, a hierarchical generation mechanism that coordinates the first and second language models is used to achieve a balance between information response speed and quality. When the information elements are incomplete, the first language model quickly returns simple intermediate response information (such as confirmation response information or summary response information), and when the information elements are complete, the second language model generates high-quality final response information.
[0036] In one exemplary embodiment, the system may further include a message queue; The gateway is also used to add the query request to the message queue; The message queue is used to send the target question request to the preprocessor in the order in which the question requests are added.
[0037] The following is combined with Figure 2 The flowchart shown illustrates the gateway's execution process. Upon receiving a query request, the gateway first verifies its validity: whether it possesses a unique identifier (session_id) and valid query information. If both are present, the gateway directly returns a prompt message to the client, indicating that the system is generating a response (e.g., "The system is understanding your question, please wait a moment"). If a unique identifier is missing, the query request is discarded, and the prompt message ("Please log in to your account") is returned. Similarly, if query information is missing, the query request is also discarded, and the prompt message ("Please enter valid query information") is returned. Displaying prompt messages provides the user with quick and effective feedback, preventing the user from mistakenly believing that the system is lagging or malfunctioning.
[0038] After verifying the validity of the query request, the gateway also adds the query request to a message queue. In implementation, the gateway can construct a dialogue object that triggers a large language model (e.g., ...) based on the query request. Figure 3 The `ChatTask` object shown contains a unique identifier and question information corresponding to the question request; the constructed dialog object is then added to the message queue. The message queue can then send the first dialog object added to the queue to the preprocessor for processing, based on the order in which the dialog objects are added.
[0039] In this system, since each query request requires a certain amount of time to respond, the gateway cannot receive other query requests while the current query request is being executed. To avoid blocking the delivery of other query requests, the current query request is added to a message queue, thus preventing the gateway from blocking the reception of other query requests. Furthermore, any type of message queue, such as Kafka or RabbitMQ, can be used; this application does not impose any restrictions on this.
[0040] In one exemplary embodiment, the preprocessor may include a distributed cluster; The aforementioned preprocessor is used to preprocess the question information carried in the question request, and may further include: Different nodes in the distributed cluster are used to asynchronously preprocess different information elements of the question information carried by the question request; wherein, one node corresponds to the preprocessing of one type of information element.
[0041] In this application, the distributed cluster may include, for example, a SolrCloud cluster, an Elasticsearch cluster, a Hadoop cluster, etc., and this application does not limit it.
[0042] Different nodes (Workers) in a distributed cluster can independently and asynchronously preprocess information elements to improve preprocessing efficiency.
[0043] In this application, the information elements may include intent, knowledge fragments, user information, and prediction functions.
[0044] The following is combined with Figure 3 The diagram shows the execution flow of a distributed cluster. Figure 1 As shown, the nodes of this distributed cluster may include at least: a first node (IntentWorker), a second node (KnowledgeWorker), a third node (UserContextLoader), and a fourth node (FunctionPredictor). The first node can invoke an intent recognition model to analyze the query information and thus obtain the query intent. This intent recognition model can use models such as the ONNX model or other conventional intent recognition models, and this application does not limit it.
[0045] The second node can access a vector knowledge base to retrieve knowledge fragments related to the question's intent. For example, the required number of knowledge fragments can be set. Figure 3 The top 3 results shown represent the three knowledge fragments most relevant to the query intent. The vector knowledge base stores structured / unstructured databases containing frequently asked questions, policy documents, etc., and supports semantic retrieval. The vector knowledge base can be, for example, Elasticsearch, Milvus, etc., and this application does not limit its scope.
[0046] The third node can call the query interface provided by the user center to query the user information of the user who asked the question; the user information may include, for example, the user's historical behavior data (click operations, query operations, etc.). The fourth node can further analyze the data required to predict the response information based on the question intent, and determine the external service interfaces required to obtain this data; for example, if the question intent is an abnormal account balance, then it is necessary to obtain the user's account balance and recent bills. Based on this, the prediction function can be a balance query function or a bill query function.
[0047] The first to fourth nodes mentioned above can be executed concurrently or asynchronously to meet different usage requirements.
[0048] In one exemplary embodiment, the system may further include an event database; the time database is used for the preprocessor to write various information elements obtained from preprocessing.
[0049] The preprocessor associates the preprocessed information elements with the unique identifier corresponding to the query request and writes them into the event database. In response to the written information element, the event database generates an event notification that the information element is ready.
[0050] In this application, the event database may include, but is not limited to, Redis, Memcached, EhCache, Hazelcast, Aerospike, and Couchbase.
[0051] Still as Figure 3 As shown, the first node, upon receiving the query intent, associates the query intent (intent) with the unique identifier corresponding to this query request via Redis (ctx:{sid}:intent). Figure 3The sid shown in the image (i.e., the aforementioned session_id) is written to Redis; The second node associates the obtained knowledge fragment with the unique identifier corresponding to this question request via Redis (ctx:{sid}:knowledge). Figure 3 The sid shown in the image (i.e., the aforementioned session_id) is written to Redis; The third node, upon receiving the user information, associates the user information (user_info) with the unique identifier corresponding to this query request via Redis (ctx:{sid}:user_info). Figure 3 The sid shown in the image (i.e., the aforementioned session_id) is written to Redis; The fourth node associates the obtained prediction function with the unique identifier corresponding to this query request via Redis(ctx:{sid}:predict_funcs). Figure 3 The sid shown in the figure, which is the aforementioned session_id, is written to Redis.
[0052] Accordingly, Redis generates corresponding event notifications in response to writes from the first, second, third, and fourth nodes. This provides a triggering mechanism for an event-driven model coordinator. When the model coordinator detects an event notification that an information element is ready, it retrieves the information element corresponding to the event notification from the event database and adds it to the information element set corresponding to the unique identifier based on the unique identifier associated with the information element. The added information element is in a ready state in the information element set. When the model coordinator receives any event notification that an information element is ready, it can determine whether the information elements in the information element set are complete based on the ready information elements.
[0053] In this application, the model coordinator determines whether the information elements in the information element set are complete using the following decision logic: If the information element set includes the question intent, knowledge fragment, and user information, or the question intent, knowledge fragment, user information, and prediction function, then the information element set is determined to be complete. If the information element set lacks at least one of the question intent, knowledge fragment, and user information, then the information element set is determined to be incomplete.
[0054] If the information elements are incomplete, the model coordinator sends the set of information elements to the first large language model to generate intermediate response information; if the information elements are complete, the model coordinator sends the set of information elements and the generated intermediate response information to the second large language model to generate final response information.
[0055] In this application, even when the information elements of the question intent, knowledge fragments, user information, and prediction function are incomplete, the model coordinator can still prioritize calling the first language model to generate simple intermediate response information based on these incomplete information elements. This allows for the rapid return of the intermediate response information to the client, thus avoiding a poor user experience caused by prolonged delays in receiving a reply. Furthermore, by gradually collecting all the information elements through subsequent question information, the second language model is then called to generate a higher-quality final response information after all information elements have been collected. This achieves a progressive response model of "acquiring and generating simultaneously," improving the user experience.
[0056] In addition, to prevent response timeouts caused by single-point blocking, a preset threshold for the longest waiting time (e.g., 3 seconds) can be set. Based on this, the model coordinator, in determining whether the information elements in the information element set are complete, may also include: If the waiting time for all information elements in the information element set to be ready reaches a preset threshold, then the first large language model or the second large language model is triggered to generate response information based on the ready information elements.
[0057] In this way, even if some information elements have not been preprocessed, subsequent processes can be forcibly triggered to avoid indefinite waiting. For example, the first language model can be triggered to generate intermediate response information based on the information elements in the current information element set, or the second language model can be triggered to generate final response information based on the information elements in the current information element set. Of course, whether the model coordinator triggers the first or second language model can refer to the aforementioned decision logic, which will not be elaborated here.
[0058] In one exemplary embodiment, such as Figure 1 As shown, the system may also include a real-time message pusher; The real-time message pusher is used to receive intermediate response information output by the first large language model or final response information output by the second large language model, and encapsulate the intermediate response information or the final response information into structured event data for data updates. The structured event data includes an event type field, which includes at least one of a first field corresponding to the intermediate response information or a second field corresponding to the final response information. The first field is used to instruct the client to append to the structured event data, and the second field is used to instruct the client to finally display the structured event data. Furthermore, the structured event data is pushed to the client, so that the client can, based on the event type field in the structured event data, display the intermediate response information as append content after the already displayed historical intermediate response information; or, replace the already displayed historical intermediate response information with the final response information.
[0059] In this system, the real-time message pusher can use technologies such as SEE (Server-Sent Events) and WebTransport for data push. Among them, SEE has the characteristic of pushing text streams in one direction, which allows the real-time message pusher to not need to pay attention to the client side, but only to transmit the reply information generated by the large language model to the client in real time.
[0060] Furthermore, the real-time message pusher provided in this application also offers a standard SEE format encapsulation mechanism for SEE technology, supporting encapsulation into structured event data such as final (also known as the second field, used for final display), update (also known as the first field, used for appending display), and replace (also known as the third field, used for replacing display). This allows the client to dynamically append, replace, and finally display reply information. For example, for intermediate reply information, encapsulated as structured event data of data:{type: update; intermediate reply information}, when the client obtains this structured event data, based on type: update (i.e., the first field), the intermediate reply information can be appended to the already displayed historical intermediate reply information; and for final reply information, encapsulated as structured event data of data:{type: final; final reply information}, when the client obtains this structured event data, based on type: final (i.e., the second field), the already displayed historical intermediate reply information can be replaced with the final reply information. Alternatively, intermediate response information can be encapsulated as structured event data:{type:replace; intermediate response information}. When the client obtains this structured event data, based on type:replace (i.e., the third field), the intermediate response information displayed in the previous round can be replaced with the intermediate response information in this structured event data.
[0061] Having described the system of the exemplary embodiments of this specification, the method of the exemplary embodiments of this specification will now be described.
[0062] Please refer to the following: Figure 4 This specification introduces an embodiment of the information generation method provided, which can be applied to the aforementioned system (for relevant details, please refer to the aforementioned system embodiment). The method includes: Step 410: Receive the question request sent by the client.
[0063] In one exemplary embodiment, after receiving the query request sent by the client, the process may further include: In response to the query request, a prompt message is returned to the client; wherein the prompt message is used to indicate that a response message is being generated.
[0064] In this application, upon receiving a query request, the validity of the request can be verified first: whether it has a unique identifier (session_id) corresponding to the query request, and whether it has valid query information. If both are present, the gateway can directly return a prompt message to the client, indicating that the system is generating a response (e.g., "The system is understanding your question, please wait a moment"). If the unique identifier is missing, the query request is discarded, and the prompt message ("Please log in to your account") is returned. Similarly, if the query information is missing, the query request is also discarded, and the prompt message ("Please enter valid query information") is returned. Displaying prompt messages provides the user with quick and effective feedback, preventing the user from mistakenly believing that the system is lagging or malfunctioning.
[0065] Step 420: Preprocess the question information carried in the question request to obtain a set of information elements for generating response information.
[0066] In one exemplary embodiment, preprocessing the question information carried in the question request may include: The question request carries the question information to a distributed cluster, where different nodes in the distributed cluster asynchronously preprocess the question information for different information elements; wherein, one node corresponds to the preprocessing of one type of information element.
[0067] As described in the previous system embodiments, different nodes in the distributed cluster can independently and asynchronously perform preprocessing of information elements to improve preprocessing efficiency.
[0068] Step 230: Determine whether the information elements in the information element set are complete. If the information elements are incomplete, send the information element set to the first large language model to generate intermediate response information; or, if the information elements are complete, send the information element set and the generated intermediate response information to the second large language model to generate final response information.
[0069] In one exemplary embodiment, the information elements may include intent, knowledge fragments, user information, and prediction functions.
[0070] The question intent and the user information are determined from the question information; the knowledge fragment is retrieved from a preset knowledge base based on the question intent; and the prediction function is a function predicted based on the question intent that is required to call an external service.
[0071] Determining whether the information elements in the information element set are complete in step 430 above may include: Determine whether the set of information elements includes the question intent, knowledge fragments, and user information, or the question intent, knowledge fragments, user information, and prediction function; If the information element set includes the question intent, knowledge fragment, and user information, or the question intent, knowledge fragment, user information, and prediction function, then the information element set is determined to be complete. If the information element set lacks at least one of the question intent, knowledge fragment, and user information, then the information element set is determined to be incomplete.
[0072] In this application, even when the information elements of the question intent, knowledge fragments, user information, and prediction function are incomplete, the first language model can be prioritized to generate a simple intermediate response based on these incomplete information elements. This intermediate response is then quickly returned to the client, avoiding a poor user experience caused by prolonged delays in receiving a reply. Furthermore, all information elements are gradually collected through subsequent question information. Once all information elements are fully collected, the second language model is then invoked to generate a higher-quality final response, which is then presented. This achieves a progressive response model of "acquiring and generating simultaneously," improving the user experience.
[0073] In an exemplary embodiment, determining whether the information elements in the information element set are complete includes: The ready status of each information element in the information element set is monitored according to the event notification mechanism; When an event notification indicating that any information element is ready is received, the completeness of the information element set is determined based on the ready information elements.
[0074] This application provides an event notification mechanism. When any information element is obtained during preprocessing, a corresponding event notification indicating that the information element is ready is generated. The event notification mechanism continuously listens for these event notifications and, upon receiving each event notification indicating that an information element is ready, determines whether the information element set is complete. If all information elements in the set are ready, the information element set is considered complete; otherwise, it is considered incomplete. Because the event notification mechanism triggers a completeness check upon receiving each event notification, it can promptly trigger the generation of response information when the information element set is complete, thereby accelerating the response speed.
[0075] It should be noted that if the waiting time for all information elements in the information element set to be ready reaches a preset threshold, the first large language model or the second large language model will be triggered to generate response information based on the ready information elements.
[0076] To prevent response timeouts caused by single-point blocking, a preset threshold for the longest waiting time (e.g., 3 seconds) can be set. This way, even if some information elements have not completed preprocessing, subsequent processes can be forcibly triggered, avoiding infinite waiting. For example, the first language model can be triggered to generate intermediate response information based on the information elements in the current information element set, or the second language model can be triggered to generate final response information based on the information elements in the current information element set.
[0077] In an exemplary embodiment, before determining whether the information elements in the information element set are complete in step 430, the method may further include: Determine if there are any historical question requests belonging to the same dialogue as the question request; If it exists, merge the information element set with the historical information element set corresponding to the historical question request to obtain the merged information element set; Accordingly, step 430, determining whether the information elements in the information element set are complete, may include: Determine whether the information elements in the merged information element set are complete.
[0078] In this embodiment, determining whether there are historical question requests belonging to the same dialogue as the current question request can refer to the description of the event database in the aforementioned system embodiment. First, different question requests within the same dialogue can use the same unique identifier (session_id). Second, the information elements obtained after preprocessing historical question requests can be associated with the unique identifier and written into the event database. Finally, when determining whether the information element set of the current question request is complete, the unique identifier of the current question request is used to query the event database for historically written information elements with the same unique identifier; these historically written information elements constitute the historical information element set. By comparing the historical information element set with the current information element set obtained from the current question request, a more complete information element set can be merged.
[0079] In an exemplary embodiment, merging the information element set with the historical information element set corresponding to the historical query request includes at least one of the following: When the information element set contains a target information element that is missing from the historical information element set, the target information element is added to the historical information element set to obtain a merged information element set. When a target information element that is missing from the information element set exists in the historical information element set, the target information element is added to the information element set to obtain a merged information element set.
[0080] When merging information element sets, one can either use the historical information element set as a benchmark to query the target information elements missing from the historical information element set in the current information element set, or use the current information element set as a benchmark to query the target information elements missing from the historical information element set in the current information element set. By incorporating the missing target information elements into the benchmark, a more complete information element set can be generated.
[0081] Step 240: Return the intermediate response information or the final response information to the client.
[0082] In this application, a hierarchical generation mechanism is employed, which coordinates a first language model and a second language model. The first language model is a lightweight language model, while the second language model is the main language model. When the information elements are incomplete, the first language model quickly returns simple intermediate response information, including confirmation or summary response information. When the information elements are complete, the second language model generates high-quality final response information, thereby achieving a balance between information response speed and quality.
[0083] In one exemplary embodiment, step 240 above may further include: The intermediate response information or the final response information is encapsulated into structured event data for data updating. The structured event data includes an event type field, which includes at least one of a first field corresponding to the intermediate response information or a second field corresponding to the final response information. The first field is used to instruct the client to append the structured event data, and the second field is used to instruct the client to finally display the structured event data. The structured event data is pushed to the client, so that the client can, based on the event type field in the structured event data, display the intermediate response information as append content after the already displayed historical intermediate response information; or, replace the already displayed historical intermediate response information with the final response information.
[0084] This application also provides a standard-formatted encapsulation mechanism for structured event data, supporting encapsulation into structured event data such as `final` (also known as the second field, used for final display), `update` (also known as the first field, used for appending display), and `replace` (also known as the third field, used for replacing display), enabling clients to dynamically append, replace, and finally display reply information. For example, for intermediate reply information, encapsulated as structured event data of type:{update; intermediate reply information}, when the client obtains this structured event data, based on type:update (i.e., the first field), the intermediate reply information can be appended to the already displayed historical intermediate reply information; while for final reply information, encapsulated as structured event data of type:{final; final reply information}, when the client obtains this structured event data, based on type:final (i.e., the second field), the already displayed historical intermediate reply information can be replaced with the final reply information. Alternatively, intermediate response information can be encapsulated as structured event data:{type:replace; intermediate response information}. When the client obtains this structured event data, based on type:replace (i.e., the third field), the intermediate response information displayed in the previous round can be replaced with the intermediate response information in this structured event data.
[0085] In an exemplary embodiment, as each information element in the information element set gradually becomes ready, for each ready information element, a corresponding semantic fragment can be generated in real time using the ready information element; the semantic fragment is then returned to the client via a push event stream.
[0086] In this embodiment, semantic fragments can be generated in real time for ready information elements through a preset semantic analysis model and pushed to the client. This method generates feedback in real time so that users can check whether the semantic fragments match the original meaning of the question. If they do not match, the semantics of the question can be corrected by asking follow-up questions (sending new questions). This replaces the information elements in the information element set with information elements that match the original meaning of the question, thereby improving the accuracy of intermediate or final response information and preventing the situation of "answering the wrong question".
[0087] After introducing the methods of exemplary embodiments of this specification, the apparatus, electronic devices, and computer-readable storage media of exemplary embodiments of this specification will now be described.
[0088] In an exemplary embodiment of this specification, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor implements the method described above by executing the executable instructions.
[0089] Figure 5 This is a schematic structural diagram of an electronic device provided in an exemplary embodiment. Please refer to... Figure 5 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, memory, and non-volatile memory, and may also include other necessary hardware. One or more embodiments of this specification can be implemented in software, such as by the processor reading the corresponding computer program from non-volatile memory into memory and then running it. Of course, besides software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of hardware and software. That is to say, the execution entity of the following processing flow is not limited to individual logic units, but can also be hardware or logic devices.
[0090] Please see Figure 6 This is a block diagram of an information generation apparatus provided in one embodiment of this specification, the apparatus corresponding to... Figure 4 The illustrated embodiment includes: The receiving unit 610 receives the query request sent by the client; The preprocessing unit 620 preprocesses the question information carried in the question request to obtain a set of information elements for generating response information; The generation unit 630 determines whether the information elements in the information element set are complete. If the information elements are incomplete, the generation unit sends the information element set to the first large language model to generate intermediate response information; or, if the information elements are complete, the generation unit sends the information element set and the generated intermediate response information to the second large language model to generate final response information. The return unit 640 returns the intermediate response information or the final response information to the client.
[0091] In an exemplary embodiment, the preprocessing unit 620 is further configured to send the question information carried by the question request to a distributed cluster, where different nodes in the distributed cluster asynchronously preprocess the question information for different information elements; wherein, one node corresponds to the preprocessing of one type of information element.
[0092] In one exemplary embodiment, the information elements include question intent, knowledge fragments, user information, and prediction functions; The question intent and the user information are determined from the question information; the knowledge fragment is retrieved from a preset knowledge base based on the question intent; and the prediction function is a function predicted based on the question intent that is required to call an external service. The generation unit 630 further includes: The sub-unit is determined to determine whether the information element set includes the question intent, knowledge fragment, and user information, or the question intent, knowledge fragment, user information, and prediction function; if the information element set includes the question intent, knowledge fragment, and user information, or the question intent, knowledge fragment, user information, and prediction function, then the information elements in the information element set are determined to be complete; if the information element set lacks at least one of the question intent, knowledge fragment, and user information, then the information elements in the information element set are determined to be incomplete. The generation subunit, when the information elements are incomplete, sends the set of information elements to the first large language model to generate intermediate response information; or, when the information elements are complete, sends the set of information elements and the generated intermediate response information to the second large language model to generate final response information.
[0093] In one exemplary embodiment, the first large language model is a lightweight language model, and the second large language model is the main language model; the intermediate response information includes confirmation response information or summary response information.
[0094] In an exemplary embodiment, when determining whether the information elements in the information element set are complete, the generation unit 630 is further configured to monitor the readiness status of each information element in the information element set according to an event notification mechanism; when receiving an event notification that any information element is ready, it determines whether the information element set is complete based on the ready information elements.
[0095] In one exemplary embodiment, prior to the generation unit 630, the following further step is taken: The merging unit determines whether there is a historical question request belonging to the same dialogue as the question request; if so, it merges the information element set with the historical information element set corresponding to the historical question request to obtain a merged information element set. When determining whether the information elements in the information element set are complete, the generation unit 630 is further used to determine whether the information elements in the merged information element set are complete.
[0096] In an exemplary embodiment, when merging the information element set with the historical information element set corresponding to the historical query request, the merging unit further includes at least one of the following: When the information element set contains a target information element that is missing from the historical information element set, the target information element is added to the historical information element set to obtain a merged information element set. When a target information element that is missing from the information element set exists in the historical information element set, the target information element is added to the information element set to obtain a merged information element set.
[0097] In one exemplary embodiment, the return unit 640 further includes: An encapsulation subunit encapsulates the intermediate response information or the final response information into structured event data for data updating. The structured event data includes an event type field, which includes at least one of a first field corresponding to the intermediate response information or a second field corresponding to the final response information. The first field is used to instruct the client to append the structured event data, and the second field is used to instruct the client to finally display the structured event data. The sub-unit returns to push the structured event data to the client, so that the client can, based on the event type field in the structured event data, display the intermediate response information as append content after the already displayed historical intermediate response information; or, replace the already displayed historical intermediate response information with the final response information.
[0098] In one exemplary embodiment, the apparatus further includes: The semantic analysis subunit, during the gradual preparation of each information element in the information element set, generates corresponding semantic fragments in real time for each prepared information element; and returns the semantic fragments to the client in a push event stream.
[0099] In one exemplary embodiment, after the receiving unit 610, the following is further included: The return prompt subunit, in response to the question request, returns prompt information to the client; wherein, the prompt information is used to indicate that a response is being generated.
[0100] In one exemplary embodiment, the apparatus further includes: If the waiting time for all information elements in the information element set to be ready reaches a preset threshold, the first or second language model is triggered to generate response information based on the ready information elements.
[0101] The specific implementation process of the functions and roles of each module in the above device can be found in the implementation process of the corresponding steps in the above method. For relevant details, please refer to the description of the method implementation method. It will not be repeated here.
[0102] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the units or modules can be selected to achieve the purpose of the solution described in this specification, depending on actual needs. Those skilled in the art can understand and implement this without any inventive effort.
[0103] The systems, devices, modules, or units described in the above embodiments can be implemented by a computer or entity, or by a product with a certain function. A typical implementation device is a computer, which can be a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email sending and receiving device, game console, tablet computer, wearable device, or any combination of these devices.
[0104] In exemplary embodiments of this specification, a computer-readable storage medium is also provided, which, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform the aforementioned method embodiments.
[0105] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0106] Program code contained on a computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RE, or any suitable combination thereof.
[0107] Program code for performing the operations described herein can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0108] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0109] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0110] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this specification. The singular forms “a,” “described,” and “the” used in one or more embodiments of this specification and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0111] It should be understood that although the terms first, second, third, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first information may also be referred to as second information without departing from the scope of one or more embodiments of this specification, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "in response to a determination," or "when," or "in the event of a determination."
[0112] The above description is merely a preferred embodiment of one or more embodiments of this specification and is not intended to limit the scope of one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of one or more embodiments of this specification should be included within the protection scope of one or more embodiments of this specification.
Claims
1. An information generation method, the method comprising: Receive questions sent by the client; The question information carried in the question request is preprocessed to obtain a set of information elements used to generate the response information; Determine whether the information elements in the information element set are complete. If the information elements are incomplete, send the information element set to the first large language model to generate intermediate response information. Alternatively, when the information elements are complete, the set of information elements and the generated intermediate response information are sent to the second language model to generate the final response information. The intermediate response information or the final response information is returned to the client.
2. The method according to claim 1, wherein the preprocessing of the question information carried in the question request includes: The question request carries the question information to a distributed cluster, where different nodes in the distributed cluster asynchronously preprocess the question information for different information elements; wherein, one node corresponds to the preprocessing of one type of information element.
3. The method according to claim 1, wherein the information elements include question intent, knowledge fragments, user information, and prediction functions; in, The question intent and the user information are determined from the question information; the knowledge fragment is retrieved from a preset knowledge base based on the question intent. The prediction function is a function predicted based on the intent of the question, which is required to call an external service. Determining whether the information elements in the information element set are complete includes: Determine whether the set of information elements includes the question intent, knowledge fragments, and user information, or the question intent, knowledge fragments, user information, and prediction function; If the information element set includes the question intent, knowledge fragment, and user information, or the question intent, knowledge fragment, user information, and prediction function, then the information element set is determined to be complete. If the information element set lacks at least one of the question intent, knowledge fragment, and user information, then the information element set is determined to be incomplete.
4. The method according to claim 1, wherein the first large language model is a lightweight language model, and the second large language model is a main language model; the intermediate response information includes confirmation response information or summary response information.
5. The method according to claim 1, wherein determining whether the information elements in the information element set are complete includes: The ready status of each information element in the information element set is monitored according to the event notification mechanism; When an event notification indicating that any information element is ready is received, the completeness of the information element set is determined based on the ready information elements.
6. The method according to claim 1, further comprising, before determining whether the information elements in the information element set are complete: Determine if there are any historical question requests belonging to the same dialogue as the question request; If it exists, merge the information element set with the historical information element set corresponding to the historical question request to obtain the merged information element set; Determining whether the information elements in the information element set are complete includes: Determine whether the information elements in the merged information element set are complete.
7. The method according to claim 6, wherein merging the information element set with the historical information element set corresponding to the historical query request includes at least one of the following: When the information element set contains a target information element that is missing from the historical information element set, the target information element is added to the historical information element set to obtain a merged information element set. When a target information element that is missing from the information element set exists in the historical information element set, the target information element is added to the information element set to obtain a merged information element set.
8. The method according to claim 1, wherein returning the intermediate response information or the final response information to the client comprises: The intermediate response information or the final response information is encapsulated into structured event data for data updating. The structured event data includes an event type field, which includes at least one of a first field corresponding to the intermediate response information or a second field corresponding to the final response information. The first field is used to instruct the client to append the structured event data, and the second field is used to instruct the client to finally display the structured event data. The structured event data is pushed to the client, so that the client can, based on the event type field in the structured event data, display the intermediate response information as append content after the already displayed historical intermediate response information; or, replace the already displayed historical intermediate response information with the final response information.
9. The method according to claim 5, further comprising: During the process of gradually preparing each information element in the information element set, for each prepared information element, a corresponding semantic fragment is generated in real time using the prepared information element. The semantic fragment is returned to the client via a push event stream.
10. The method according to claim 1, further comprising, after receiving the query request sent by the client: In response to the query request, a prompt message is returned to the client; wherein the prompt message is used to indicate that a response message is being generated.
11. The method according to claim 5, further comprising: If the waiting time for all information elements in the information element set to be ready reaches a preset threshold, then the first large language model or the second large language model is triggered to generate response information based on the ready information elements.
12. A system comprising: Gateway, preprocessor, and model coordinator; The gateway is used to receive query requests sent by clients; The preprocessor is used to preprocess the question information carried in the question request to obtain a set of information elements for generating response information; The model coordinator is used to determine whether the information elements in the information element set are complete. If the information elements are incomplete, the information element set is sent to the first large language model to generate intermediate response information. Alternatively, when the information elements are complete, the set of information elements and the generated intermediate response information are sent to the second language model to generate the final response information. The gateway is also used to return the intermediate response information or the final response information to the client.
13. The system according to claim 12, further comprising a message queue; The gateway is also used to add the query request to the message queue; The message queue is used to send the target question request to the preprocessor in the order in which the question requests are added.
14. The system of claim 12, wherein the preprocessor comprises a distributed cluster; The preprocessor is used to preprocess the question information carried in the question request, including: Different nodes in the distributed cluster are used to asynchronously preprocess different information elements of the question information carried by the question request; wherein, one node corresponds to the preprocessing of one type of information element.
15. The system according to claim 12, further comprising an event database; The preprocessor associates the preprocessed information elements with the unique identifier corresponding to the query request and writes them into the event database. In response to the written information element, the event database generates an event notification that the information element is ready. The model coordinator is used to determine whether the information elements in the information element set are complete, including: The model coordinator is used to retrieve the information element corresponding to the event notification from the event database when the event notification is detected, and add it to the information element set corresponding to the unique identifier according to the unique identifier associated with the information element; Determine whether the information elements in the information element set are complete.
16. The system according to claim 12, further comprising a real-time message pusher; The real-time message pusher is used to receive intermediate response information output by the first large language model or final response information output by the second large language model, and encapsulates the intermediate response information or the final response information into structured event data for data updates, wherein... The structured event data includes an event type field, which includes at least one of a first field corresponding to the intermediate response information or a second field corresponding to the final response information; the first field is used to instruct the client to append to the structured event data, and the second field is used to instruct the client to finally display the structured event data; Furthermore, the structured event data is pushed to the client, so that the client can, based on the event type field in the structured event data, display the intermediate response information as append content after the already displayed historical intermediate response information; or, replace the already displayed historical intermediate response information with the final response information.
17. An information generation apparatus, the apparatus comprising: The receiving unit receives query requests sent by the client; The preprocessing unit preprocesses the question information carried in the question request to obtain a set of information elements for generating response information; The generation unit determines whether the information elements in the information element set are complete. If the information elements are incomplete, the information element set is sent to the first large language model to generate intermediate response information. Alternatively, when the information elements are complete, the set of information elements and the generated intermediate response information are sent to the second language model to generate the final response information. The return unit returns the intermediate response information or the final response information to the client.
18. An electronic device comprising: processor; Memory used to store processor-executable instructions; The processor is configured to perform the method according to any one of claims 1-11.