Question and answer method, device, medium and program product

CN123012127APending Publication Date: 2026-10-30SHANGHAI GLORY SMART TECH DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611471105.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-21
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]然而,“一场景一入口”的形态会导致用户在进行跨场景对话时需手动切换对话入口,操作较繁琐,并且可能会降低不同场景之间的交互连贯性

Benefits of technology

[0025]在本申请实施例中,通过并行执行标签匹配召回和语义召回,并将两路结果合并,既保证了常见场景下基于场景类型的精确匹配能够快速获取适配提示词,又通过语义召回的泛化能力作为边界情况的兜底机制,解决了复杂或模糊的用户输入无法被单一标签匹配准确命中的问题,提升了在各种输入情况下的召回覆盖率和鲁棒性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123012127A_ABST
    Figure CN123012127A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of artificial intelligence, and discloses a question and answer method, equipment, a medium and a program product. The question and answer method comprises the following steps: obtaining input information of an intelligent agent; determining a prompt word set corresponding to the input information, wherein the prompt word set comprises at least one fixed prompt word and at least one dynamic prompt word, the at least one fixed prompt word is related to a global inherent attribute of the intelligent agent, and the at least one dynamic prompt word is determined based on a scene type corresponding to the input information; generating a reply result corresponding to the input information based on the prompt word set, and displaying the reply result. In this way, when a user is in cross-scene conversation, the user does not need to manually switch an entry, and the electronic equipment can automatically identify a scene type and adapt to a corresponding dynamic prompt word based on current input information, so that smooth switching of scenes is realized in the same conversation, and the interaction continuity and operation convenience of cross-scene conversation are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a question-answering method, device, medium, and program product. Background Technology

[0002] Currently, with the rapid development of large language model technology, conversational artificial intelligence has gradually evolved into intelligent dialogue systems capable of understanding complex intentions, engaging in multi-turn interactions, and generating responses. In practical applications, dialogues between users and intelligent agents often involve various types of interaction needs, such as game interaction, knowledge-based question answering, role-playing, and general casual conversation. These different interaction needs constitute diverse dialogue scenarios.

[0003] To meet the differentiated interactive experience of users in different scenarios, intelligent dialogue systems usually adopt the form of "one scenario, one entry point", that is, separate dialogue entry points are set up for different dialogue scenarios.

[0004] However, the "one scene, one entry" approach requires users to manually switch dialogue entry points when engaging in cross-scene conversations, which is cumbersome and may reduce the continuity of interaction between different scenes. Summary of the Invention

[0005] The purpose of this application is to provide a question-and-answer method, device, medium, and program product to improve the interactive coherence and ease of operation of cross-scenario dialogue.

[0006] The first aspect of this application provides a question-answering method applied to an electronic device, the electronic device running an intelligent agent; and the method includes: acquiring input information of the intelligent agent; determining a set of prompt words corresponding to the input information, wherein the set of prompt words includes at least one fixed prompt word and at least one dynamic prompt word, the at least one fixed prompt word being related to the global inherent attributes of the intelligent agent, and the at least one dynamic prompt word being determined based on the scene type corresponding to the input information; generating a response result corresponding to the input information based on the set of prompt words, and displaying the response result.

[0007] In this embodiment, by dividing the prompt word set into fixed prompt words and dynamic prompt words, the fixed prompt words are related to the agent's global inherent attributes (i.e., they do not change with the scene), while the dynamic prompt words are determined based on the scene type (i.e., they change with the scene). This allows the agent to maintain consistency in personality and style across different scenes while flexibly adapting to the interaction needs of the current scene. Thus, users do not need to manually switch entry points during cross-scene dialogues. The electronic device can automatically identify the scene type based on the current input information and adapt the corresponding dynamic prompt words, thereby achieving smooth scene switching within the same conversation and improving the interactive coherence and operational convenience of cross-scene dialogues.

[0008] In one possible implementation of the first aspect above, the scenario type includes at least one of the following: game interaction, knowledge question and answer, device instruction, role-playing, and general chat.

[0009] In the embodiments of this application, multiple scene types provide a clear classification basis for the scene adaptation of dynamic prompt words, which improves the practicality and scene coverage of this solution.

[0010] In one possible implementation of the first aspect above, the fixed prompts include at least one of the following: agent personality profile prompts, used to limit the agent's response features to at least one of the following: identity features, personality traits, and response style; behavioral motivation prompts, used to limit the agent's response features to at least one of the following: service goals and behavioral orientation; and response constraint prompts, used to limit the restrictive rules that the agent must follow in the process of generating response results.

[0011] In this embodiment, by limiting the fixed prompts to intelligent agent personality profile prompts, behavioral motivation prompts, and response constraint prompts, the global inherent attributes of the intelligent agent are defined from three dimensions: identity characteristics, behavioral orientation, and response restrictions, thereby improving the personality consistency and response security of the intelligent agent in cross-scene interaction.

[0012] In one possible implementation of the first aspect above, the dynamic prompt words include at least one of the following: scenario behavior strategy prompt words, used to limit the agent's response features to at least one of the following: behavioral logic under the scenario type corresponding to the input information, and interaction strategy under the scenario type corresponding to the input information; scenario speech style prompt words, used to limit the agent's response features to at least one of the following: speech expression mode under the scenario type corresponding to the input information, and language habits under the scenario type corresponding to the input information.

[0013] In this embodiment, by limiting dynamic prompts to scenario-based behavioral strategy prompts and scenario-based speech style prompts, the intelligent agent can adopt matching behavioral logic and speech expression in different scenario types, thereby improving the naturalness of the dialogue experience and scenario adaptability.

[0014] In one possible implementation of the first aspect described above, at least one fixed prompt word and at least one dynamic prompt word have different hierarchical identifiers, wherein the hierarchical identifiers are used to indicate the concatenation order of the identified prompt word in the prompt word set; wherein the concatenation order of at least one fixed prompt word in the prompt word set is located before the concatenation order of at least one dynamic prompt word in the prompt word set.

[0015] In this embodiment, by configuring different hierarchical identifiers for fixed prompts and dynamic prompts, and limiting the concatenation order of fixed prompts in the prompt set to precede that of dynamic prompts, the fixed prompts take priority in acting on the agent in the prompt set. That is, a basic behavioral framework is established first, and then scene behavioral constraints are superimposed on it, which improves the priority constraint of the basic settings on scene behavior, so that the agent's behavior always runs within its inherent attribute framework.

[0016] In one possible implementation of the first aspect above, the hierarchical identifier corresponding to at least one fixed prompt word is a fixed hierarchical level, and the hierarchical identifier corresponding to at least one dynamic prompt word is a dynamic hierarchical level; wherein, the fixed hierarchical level includes a first hierarchical level and a second hierarchical level, and the dynamic hierarchical level includes a third hierarchical level, a fourth hierarchical level, and a fifth hierarchical level.

[0017] In this embodiment of the application, by specifically defining the fixed level as the first level and the second level, and the dynamic level as the third level, the fourth level and the fifth level, a clear level division standard is provided, which makes the management and maintenance of prompt words more structured and scalable, and facilitates the flexible configuration and updating of dynamic level content according to different scenarios, while maintaining the stability of the fixed level.

[0018] In one possible implementation of the first aspect described above, the prompts for the first and second levels are identified by Extensible Markup Language (XML) tags and heading tags, respectively; and the prompts for the third, fourth, and fifth levels are identified by first-level, second-level, and third-level indentation of an unordered list in Markup Language, respectively.

[0019] In this embodiment, different levels are identified by using different marking methods such as Extensible Markup Language (Extreme Markup Language) tags, title tags, and Markup Language unordered list indentation. This enables prompts at each level to be quickly identified and categorized during storage and retrieval, thereby improving parsing efficiency and reducing maintenance costs.

[0020] In one possible implementation of the first aspect mentioned above, the mapping relationship between each dynamic prompt word, fixed prompt word, and scene type and corresponding dynamic prompt word is pre-stored in a vector database in the form of a configuration table.

[0021] In this embodiment, by pre-storing dynamic prompts, fixed prompts, and the mapping relationship between scene types and dynamic prompts in a vector database in the form of a configuration table, offline pre-configuration and efficient retrieval of prompts are achieved. During the real-time inference stage, there is no need to regenerate or calculate prompts, which can reduce processing latency and improve response speed.

[0022] In one possible implementation of the first aspect above, each dynamic prompt word in the configuration table includes at least one of the following fields: a scene type label field, a prompt word content field, and a hierarchy identifier field; wherein, the scene type label field is used to store at least one scene type that has a mapping relationship with the corresponding dynamic prompt word, and at least one scene type serves as an associated label for the dynamic prompt word.

[0023] In this embodiment of the application, by setting a scene type label field, a prompt content field, and a hierarchy identifier field for each dynamic prompt word in the configuration table, wherein the scene type label field stores the scene types that have a mapping relationship with the dynamic prompt word, after determining the scene type corresponding to the user input, the appropriate dynamic prompt word can be quickly located by field matching, thereby realizing a structured association between scene types and dynamic prompt words, and improving retrieval efficiency and accuracy.

[0024] In one possible implementation of the first aspect above, determining the set of prompt words corresponding to the input information includes: performing tag matching recall on the configuration table based on the scene type corresponding to the input information to obtain a first recall result, wherein the tag matching recall includes: recalling dynamic prompt words in the scene type tag field of the configuration table that include the scene type corresponding to the input information; performing semantic recall based on the vector similarity between the input information and the extended retrieval information to obtain a second recall result, wherein the extended retrieval information is pre-stored in the configuration table and associated with the dynamic prompt words in the configuration table, and the extended retrieval information includes at least keywords and hypothetical query statements; and merging the first recall result and the second recall result to obtain at least one dynamic prompt word.

[0025] In this embodiment, by executing tag matching recall and semantic recall in parallel and merging the two results, it ensures that accurate matching based on scene type can quickly obtain suitable prompt words in common scenarios. At the same time, the generalization capability of semantic recall serves as a fallback mechanism for boundary cases, solving the problem that complex or ambiguous user input cannot be accurately matched by a single tag, thus improving the recall coverage and robustness under various input conditions.

[0026] In one possible implementation of the first aspect described above, each dynamic prompt word in the configuration table further includes a retrieval type field, which indicates the first matching mode or the second matching mode used by the corresponding dynamic prompt word when performing tag matching retrieval; in the first matching mode, the dynamic prompt word is retrieved if the scene type corresponding to the input information matches any one of the scene type tags stored in the scene type tag field of the dynamic prompt word; in the second matching mode, the dynamic prompt word is retrieved if the scene type corresponding to the input information matches multiple scene type tags stored in the scene type tag field of the dynamic prompt word.

[0027] In this embodiment, by setting a retrieval type field for dynamic prompt words in the configuration table, it supports a first matching mode (recalling if any related scene type is matched by the scene type) and a second matching mode (recalling only if the scene type matches multiple related scene types simultaneously). It can flexibly control the recall strategy according to the applicable granularity of the prompt words (using "OR" matching for broadly applicable prompt words and "AND" matching for strictly scene-limited prompt words), avoiding false recalls or missed recalls and improving recall accuracy.

[0028] In one possible implementation of the first aspect above, semantic recall is performed based on the vector similarity between the input information and the extended retrieval information to obtain a second recall result, including: calculating the sparse vector similarity between the input information and the keywords to obtain a first similarity; calculating the dense vector similarity between the input information and the hypothetical query statement to obtain a second similarity; fusing the first similarity and the second similarity according to a preset weight ratio to obtain a target similarity; and recalling semantically adapted dynamic prompts from the configuration table based on the target similarity.

[0029] In this embodiment, semantic recall is concretized into two paths: sparse vector similarity calculation (keyword matching) and dense vector similarity calculation (semantic matching). These paths are then fused into a final similarity score according to a preset weight ratio. This approach balances precise matching at the keyword level with generalized matching at the semantic level, thereby improving the recall accuracy of dynamic prompts in boundary scenarios.

[0030] In one possible implementation of the first aspect above, the method further includes: acquiring interaction history data of the input information, and determining whether the topic of the previous round continues based on the interaction history data and the input information, and determining the scenario type corresponding to the input information based on the determination result; wherein, corresponding to the determination result being that the topic of the previous round continues, the scenario type corresponding to the input information is determined based on the historical scenario type corresponding to the interaction history data and the input information; and corresponding to the determination result being that the topic of the previous round does not continue, the scenario type corresponding to the input information is determined based on the input information.

[0031] In this embodiment of the application, by obtaining input information and its interaction history data, it is determined whether to continue the topic of the previous round, and based on the determination result (if it continues, the current scenario type is determined in combination with the historical scenario type; if it does not continue, the current scenario type is determined independently), the determination of the scenario type is more accurate, and it supports switching between different scenarios in the same conversation, thereby improving the user's interaction continuity and experience in cross-scenario dialogue.

[0032] A second aspect of this application provides an electronic device, comprising: a memory for storing instructions executable by one or more processors of the electronic device; and a processor, one of the processors of the electronic device, for executing the instructions stored in the memory to implement any of the methods of the first aspect described above.

[0033] A third aspect of this application provides a computer-readable storage medium storing instructions that, when executed, implement any of the methods described in the first aspect.

[0034] The fourth aspect of this application provides a computer program product including instructions that, when executed, implement any of the methods described in the first aspect above.

[0035] In the embodiments of this application, when the second to fourth aspects implement any one of the methods in the first aspect, they can achieve the same or similar technical effects as any one of the methods in the first aspect. Attached Figure Description

[0036] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0037] Figure 1 An embodiment of this application illustrates an interface diagram of a user selecting a smart assistant application corresponding to a dialogue scenario using a smart assistant on a mobile phone;

[0038] Figure 2 According to an embodiment of this application, another interface diagram is shown where a user selects the smart assistant application corresponding to a dialogue scenario using the smart assistant on their mobile phone;

[0039] Figure 3 An embodiment of this application illustrates an interface diagram of a smart assistant application in which a user engages in conversation using a smart assistant on a mobile phone;

[0040] Figure 4 A flowchart of a question-and-answer method is shown according to an embodiment of this application;

[0041] Figure 5 A logical schematic diagram of a hybrid retrieval method is shown according to an embodiment of this application;

[0042] Figure 6 A logical diagram of a question-and-answer method is shown according to an embodiment of this application;

[0043] Figure 7 A recall logic diagram is shown according to an embodiment of this application;

[0044] Figure 8 A schematic diagram of a prompt word assembly process is shown according to an embodiment of this application;

[0045] Figure 9 A schematic diagram of the hardware structure of an electronic device is shown according to an embodiment of this application. Detailed Implementation

[0046] The illustrative embodiments of this application include, but are not limited to, a question-and-answer method, apparatus, medium, and program product.

[0047] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be described clearly and in detail below with reference to the accompanying drawings.

[0048] As mentioned earlier, current dialogues between users and intelligent agents often involve various types of interaction needs, such as game interaction, knowledge Q&A, role-playing, and general small talk. These different interaction needs constitute diverse dialogue scenarios.

[0049] To meet the differentiated interactive experience of users in different scenarios, intelligent dialogue systems usually adopt the form of "one scenario, one entry point", that is, separate dialogue entry points are set up for different dialogue scenarios.

[0050] However, the "one scene, one entry" approach requires users to manually switch dialogue entry points when engaging in cross-scene conversations, which is cumbersome and may reduce the continuity of interaction between different scenes.

[0051] For example, refer to Figure 1 The image shown shows the interface of a user selecting the corresponding smart assistant application for a dialogue scenario using the smart assistant in their mobile phone 10.

[0052] like Figure 1 As shown, the user interface 10a includes a session area 101 and a scenario selection area 102. The scenario selection area 102 displays a variety of scenario selection controls (such as the “Debate” selection control, the “Simultaneous Interpretation” selection control, the “Mock Interview” selection control, the “English Tutoring” selection control, and the “Soul Singer” selection control shown in the figure).

[0053] Users need to select the corresponding scenario selection control (i.e., the dialogue entry point) in the scenario selection area 102 before engaging in question-and-answer (or conversational interaction).

[0054] For example, refer to Figure 2The image shown is an interface diagram of another user using the Smart Assistant in their mobile phone to select the Smart Assistant application corresponding to the dialogue scenario.

[0055] like Figure 2 As shown, the user interface 20a includes a scenario selection area 201 and a scenario introduction area 202. The scenario selection area 201 displays various scenario selection controls (such as the "Free Conversation" selection control, "Role-Playing" selection control, and "English Practice" selection control shown in the illustration). The scenario introduction area 202 displays information about the scenarios corresponding to each scenario selection control. For example, the "Free Conversation" scenario is "Freely chat with the intelligent assistant on any topic"; the "Role-Playing" scenario is "Say your role and start an immersive conversation; whether it's a classic character, a fantasy figure, or a custom character you have in mind, you can easily master it"; and the "English Practice" scenario is "A personal speaking partner; practice anytime, anywhere to improve your English expression skills," and so on.

[0056] Users need to select the corresponding scenario selection control in the scenario selection area 201 before answering questions.

[0057] Furthermore, the "one scene, one entry point" approach leads to the isolation of contextual information between different dialogue entry points. The agent cannot share dialogue memory across different scene entry points. When a user switches from the current scene to another, previously stated background information, dialogue state, and interaction history are not inherited. The user must restate the background information in the new scene entry point, resulting in a broken dialogue experience and preventing the formation of complete, continuous multi-turn interactions.

[0058] For example, refer to Figure 3 The image shown is an interface diagram of the Smart Assistant application where a user engages in conversation using the Smart Assistant on a mobile phone (phone 10).

[0059] like Figure 3 As shown, the user interface 30a displays multiple text messages entered by the user in the "free conversation" scenario and the "English tutoring" scenario, as well as multiple responses to the corresponding text messages output by the smart assistant.

[0060] For example, in a "free-flowing conversation" scenario, if the user inputs the text "What did I do last night?", the smart assistant would reply, "You watched an action movie last night. Was there any scene that impressed you?"

[0061] When the user switches from the "free conversation" scenario to the "English tutoring" scenario (e.g., selects...), Figure 1 or Figure 2Following the selection controls shown in the user interface, in the "English tutoring" scenario, the user's first text message is "Can you remember what did I do last night?", and the smart assistant's response is "Overall, it's pretty good, but there's a small grammar problem...". The user's second text message is "I just want to chat with you.", and the smart assistant's response is "That's great! Chatting is so much fun. What kind of things do you like to talk about? Maybe movies, books, or travel?". The user's third text message is "So what did I do last night?", and the smart assistant's response is "I don't exactly know. But you can tell me. For example...".

[0062] It can be seen that in the "free conversation" scenario, the user stated to the agent that "I watched an action movie last night," and the smart assistant responded accordingly. However, when the user switched to the "English tutoring" scenario, the smart assistant could not access the conversation memory from the previous "free conversation" scenario. When the user asked again, "What did you do last night?", it could only reply, "I don't exactly know," instead of providing a coherent response based on previously acquired information. This demonstrates that the contextual information between different scenario entry points is isolated, forcing the user to frequently repeat previously stated background information in new scenarios, resulting in a fragmented conversation experience and further degrading the user experience.

[0063] Understandable. Figure 1 to Figure 3 The application scenarios shown are merely illustrative and do not constitute a limitation on the dialogue scenarios between users and intelligent agents.

[0064] To improve the interactive coherence and operational convenience of cross-scenario dialogue, this application provides a question-and-answer method applied to electronic devices, which operate with intelligent agents.

[0065] Furthermore, the method includes: acquiring input information of the agent; determining a set of prompt words corresponding to the input information, wherein the set of prompt words includes at least one fixed prompt word and at least one dynamic prompt word, the at least one fixed prompt word is related to the global inherent attributes of the agent, and the at least one dynamic prompt word is determined based on the scene type corresponding to the input information; generating a response result corresponding to the input information based on the set of prompt words, and displaying the response result.

[0066] It is understandable that by dividing the prompt word set into fixed prompt words and dynamic prompt words, where fixed prompt words are related to the agent's global inherent attributes (i.e., do not change with the scene) and dynamic prompt words are determined based on the scene type (i.e., change with the scene), the agent can maintain consistency in personality and style across different scenes while flexibly adapting to the interaction needs of the current scene. In this way, users do not need to manually switch entry points when engaging in cross-scene dialogues. The electronic device can automatically identify the scene type based on the current input information and adapt the corresponding dynamic prompt words, thereby achieving smooth scene switching within the same conversation and improving the interactive coherence and operational convenience of cross-scene dialogues.

[0067] Furthermore, since the dynamic prompts in the prompt word set are determined based on the scene type corresponding to the input information, electronic devices can identify the scene type of the current input information and adapt the corresponding dynamic prompts without switching dialogue entry points. In other words, the entire dialogue process continues continuously within the same session of the same agent, without the user needing to exit the current session or manually select a new dialogue entry point. During this process, the background information, dialogue state, and interaction history previously stated by the user are all retained within the context of the same session, allowing the agent to continue accessing and utilizing this historical information to generate responses. This avoids the contextual information isolation problem caused by switching dialogue entry points, ensuring contextual continuity in cross-scene dialogues and further improving the interactive coherence of cross-scene dialogues.

[0068] For example, with the above Figure 3 Taking the illustrated application scenario as an example, the user first asks the smart assistant, "What did I do last night?" Based on this input information, the smart assistant determines that the corresponding scenario type is "general chat" and identifies the corresponding set of prompt words (including dynamic prompt words corresponding to the "general chat" scenario type), generating the reply, "You watched an action movie last night. Was there any scene that impressed you?" At this point, the background information "the user watched an action movie last night" is already stored in the context of the current session.

[0069] In this embodiment, since the user does not need to manually switch the dialogue entry, the mobile phone 10 can directly obtain input information in the same conversation. The user can directly input the English content "Can you remember what did I do last night?" in the same conversation. Based on the input information, the mobile phone 10 determines that the corresponding scenario type is "English tutoring" and adapts the dynamic prompt words corresponding to the scenario type to generate a reply.

[0070] Because the entire dialogue takes place continuously within the same session of the same agent, the background information that "the user watched an action movie last night" remains in the context of the current session, allowing the agent to continue accessing this historical information. Therefore, when a user asks, "Can you remember what I did last night?", the intelligent assistant can provide a response in English based on previously acquired background information (e.g., "You watched an action movie last night. Did any scene impress you?"), without requiring the user to restate previously provided information, thus improving the interactive coherence and user experience of cross-scenario dialogue.

[0071] The question-and-answer method provided in the embodiments of this application is described in detail below with reference to the accompanying drawings.

[0072] For example, Figure 4 A flowchart illustrating a question-and-answer method is shown according to an embodiment of this application. It can be understood that... Figure 4 The execution entity in the flowchart shown is electronic device 100. Electronic device 100 operates an intelligent agent. For ease of description, the following section... Figure 4 When describing the flowchart shown, the execution subject of the flowchart will not be repeated.

[0073] like Figure 4 As shown, this process includes, but is not limited to:

[0074] S401: Obtain input information from the agent.

[0075] In some embodiments, an intelligent agent refers to an artificial intelligence (AI) program or model running on an electronic device 100 that can understand user input information and generate corresponding response results, such as a smart assistant, an AI chatbot, or a virtual digital human. This intelligent agent can be implemented based on a large language model, receiving input information and a set of prompt words as model input to generate corresponding response content.

[0076] In some embodiments, the input information includes at least one of the following types: text, image, and audio.

[0077] For example, text data can be files in formats such as pdf, ppt, doc, xlsx, or txt. Image data can be videos (e.g., mp4, avi, mov, wmv, mkv, or flv) or images (e.g., jpeg, png, gif, bmp, tiff, raw, or svg). Audio data can be files in formats such as mp3, wav, flac, aac, or m4a. This application does not limit the specific type and format of the data to be processed.

[0078] It is understood that text data can be text content entered by the user via keyboard, touchscreen, or voice input method, or text content obtained after the voice recognition module converts the user's speech. Image data can be photos or video frames taken by the user through a camera, or image files selected from the local storage of the electronic device 100. Audio data can be voice commands or conversational speech entered by the user through a microphone. This application does not limit the specific type and format of input information. In practical applications, input information can also be a combination of the above types, for example, voice input information can be converted into corresponding text input information through voice recognition.

[0079] S402: Determine the set of prompt words corresponding to the input information, wherein the set of prompt words includes at least one fixed prompt word and at least one dynamic prompt word, the at least one fixed prompt word is related to the global inherent attributes of the agent, and the at least one dynamic prompt word is determined based on the scene type corresponding to the input information.

[0080] In some embodiments, the scenario type includes at least one of the following: game interaction, knowledge Q&A, device command, role-playing, and general chat.

[0081] For example, interactive games can be further subdivided into specific game scenarios such as idiom chain games, poetry recitation games, mathematical calculations, memory challenges, charades, riddles, rock-paper-scissors, short story chain games, song title guessing, and brain teasers; knowledge-based Q&A games can be subdivided into specific Q&A scenarios such as encyclopedia Q&A, product Q&A, and trivia Q&A; device instruction games are used in scenarios where users request the intelligent agent to perform system operations or function calls; role-playing games are used in scenarios where users explicitly request the intelligent agent to play a specific role in a conversation; and general casual conversation games are used for everyday casual conversations that do not belong to the above categories or conversations that cannot be clearly categorized.

[0082] It is understandable that multiple scenario types provide a clear classification basis for the scenario adaptation of dynamic prompt words, thereby improving the practicality and scenario coverage of this solution.

[0083] In some embodiments, the fixed prompts include at least one of the following: agent personality profile prompts, used to limit the agent's response features to at least one of the following: identity features, personality traits, and response style; behavioral motivation prompts, used to limit the agent's response features to at least one of the following: service goals and behavioral orientation; and response constraint prompts, used to limit the restrictive rules that the agent must follow in the process of generating response results.

[0084] For example, the prompt for the intelligent agent's personality profile could be "You are a lively and humorous intelligent assistant named xx, who likes to communicate with users in a relaxed and pleasant tone." This prompt defines the intelligent agent's identity characteristics (intelligent assistant xx), personality traits (lively and humorous), and response style (relaxed and pleasant).

[0085] For example, a behavioral motivation cue could be, "Your core goal is to accompany users through enjoyable times and provide them with valuable information and assistance. In the conversation, you should proactively guide the topic, encourage users to express themselves, and adjust your response based on the user's emotional state." This cue defines the agent's service goals (accompanying users, providing value) and behavioral orientation (guiding the topic, perceiving emotions).

[0086] For example, the response constraint prompt could be "You must abide by the following rules: (1) Do not generate any content that does not meet the preset requirements; (2) Do not promise users anything beyond your capabilities; (3) When users ask questions that require professional knowledge (such as medical or legal knowledge), you must remind them to consult professionals; (4) Always maintain respect and courtesy towards users." This prompt limits the security and behavioral restrictions that the agent must follow when generating responses.

[0087] It is understandable that by limiting the fixed prompts to the agent's personality profile prompts, behavioral motivation prompts, and response constraint prompts, the global inherent attributes of the agent are defined from three dimensions: identity characteristics, behavioral orientation, and response restrictions, thereby improving the agent's personality consistency and response security in cross-scenario interactions.

[0088] In some embodiments, dynamic prompts include at least one of the following: scenario behavior strategy prompts, used to limit the agent's response features to at least one of the following: behavioral logic under the scenario type corresponding to the input information, and interaction strategy under the scenario type corresponding to the input information; scenario speech style prompts, used to limit the agent's response features to at least one of the following: speech expression style under the scenario type corresponding to the input information, and language habits under the scenario type corresponding to the input information.

[0089] For example, assuming the input information corresponds to a scenario type of "idiom chain game," the scenario behavior strategy prompt could be: "You need to guide the user in an idiom chain game. The specific rules are as follows: You first say a four-character idiom, and the user needs to say another four-character idiom starting with the last character of that idiom. You need to determine whether the user's response is a valid four-character idiom and provide confirmation or correction feedback. If the user successfully completes the chain, continue to say a new idiom starting with the last character of the user's response; if the user fails to complete the chain, prompt the user to try again." This prompt defines the agent's specific behavioral logic and interaction strategy in the idiom chain game scenario.

[0090] For example, assuming the input information corresponds to a scenario type of "idiom chain game," the scenario-specific dialogue style prompt could be: "In the idiom chain game, you should use a lively and encouraging tone when speaking to the user. When the user successfully completes the chain, provide positive encouragement, such as 'Great job!' or 'You're so smart!'; when the user fails, provide friendly prompts, such as 'Think again,' or 'This character is a bit difficult.' Additionally, when the user fails consecutively, you can appropriately reduce the difficulty and provide candidate idioms for the user to choose from." This prompt limits the agent's specific speech expression and language habits in the idiom chain game scenario.

[0091] It is understandable that by limiting dynamic prompts to scenario-based behavioral strategy prompts and scenario-based speech style prompts, the intelligent agent can adopt matching behavioral logic and speech expression in different scenario types, thereby improving the naturalness of the dialogue experience and scenario adaptability.

[0092] In some embodiments, at least one fixed prompt word and at least one dynamic prompt word have different hierarchical identifiers, wherein the hierarchical identifiers are used to indicate the concatenation order of the identified prompt word in the prompt word set; wherein the concatenation order of at least one fixed prompt word in the prompt word set is located before the concatenation order of at least one dynamic prompt word in the prompt word set.

[0093] It is understandable that by configuring different hierarchical identifiers for fixed prompts and dynamic prompts, and limiting the concatenation order of fixed prompts in the prompt set to precede that of dynamic prompts, fixed prompts take priority in acting on the agent within the prompt set. That is, a basic behavioral framework is established first, and then scene behavioral constraints are superimposed on it, which improves the priority constraint of the basic settings on scene behavior, so that the agent's behavior always runs within its inherent attribute framework.

[0094] In some embodiments, the hierarchical identifier corresponding to at least one fixed prompt word is a fixed hierarchical level, and the hierarchical identifier corresponding to at least one dynamic prompt word is a dynamic hierarchical level; wherein, the fixed hierarchical level includes a first hierarchical level and a second hierarchical level, and the dynamic hierarchical level includes a third hierarchical level, a fourth hierarchical level, and a fifth hierarchical level.

[0095] It is understandable that by specifically defining the fixed level as the first and second levels, and the dynamic level as the third, fourth, and fifth levels, a clear level division standard is provided, making the management and maintenance of prompt words more structured and scalable. This facilitates the flexible configuration and updating of dynamic level content according to different scenarios, while maintaining the stability of the fixed level.

[0096] In some embodiments, the first and second level prompts are identified by Extensible Markup Language (XML) tags and title tags, respectively; the third, fourth, and fifth level prompts are identified by first-level, second-level, and third-level indentation of an unordered list in Markup Language, respectively.

[0097] It is understandable that by using different markup methods such as Extensible Markup Language (EXPLAIN) tags, heading tags, and unordered list indentation in Markup Language (ARL) to identify different levels, prompts at each level can be quickly identified and categorized during storage and retrieval, thereby improving parsing efficiency and reducing maintenance costs.

[0098] In some embodiments, the prompt words at the first level (fixed level) further include at least one of the following subtypes: character, information, persona, style, and shot. The initial Extensible Markup Language tag contains fixed prompt words used to define the agent's basic personality and response tone.

[0099] For example, first-level (fixed-level) cue words can be identified using Extensible Markup Language (XML) tags, such as... <persona>You are a lively, humorous and witty AI assistant...< / persona> It is used to define the personality profile of an intelligent agent.

[0100] In some embodiments, the prompts at the second level (fixed level) are static strings, identified by title markers (e.g., "#"), and include at least one of the following: "#Agent-related information" describes the agent's identity information and background knowledge, such as the product name and development entity to which the agent belongs; "#Core motivation" describes the agent's service goals and behavioral orientation; "#Behavioral pattern:" describes the agent's behavioral patterns and interaction methods in the dialogue; "#Memory" stores information or user profiles that the agent needs to maintain for a long time during the conversation; "#Profile" describes the agent's perception of the user and user characteristics, such as the user's preferences and habits; "#Sentence style" limits the sentence structure and expression habits used by the agent when replying; "#Constraints" limits the rules that the agent must follow when generating replies; and "#Word style" limits the vocabulary preferences and language style used by the agent when replying.

[0101] It should be noted that the prompts in the second level are all static strings, which together with the fixed prompts in the first level constitute the global inherent attributes of the agent. They remain unchanged during the session and do not update with the change of scene type.

[0102] For example, second-level (fixed-level) prompts can be identified by title tags (such as "#" title tags), such as "#Core Motivation: Your core goal is to accompany users through pleasant times...", to define the agent's behavioral motivation.

[0103] It is understandable that the second-level "#constraint" corresponds functionally to the aforementioned "response constraint prompt," both serving to restrict the rules that the agent must follow when generating a response. In actual configuration, the response constraint prompt can be one of the specific implementations of "#constraint," and both can coexist or be used selectively; this application does not impose any restrictions on this.

[0104] It's understandable that "shots" typically only appear within the initial Extensible Markup Language (XML) tag at the first level, serving as a small sample dialogue for the agent to reference when generating responses. The second level generally doesn't contain shot types; shot content can be stored as supplementary information for fixed prompts within XML tags at the first level.

[0105] In some embodiments, the prompts for the third level (dynamic level) can be identified by first-level indentation (e.g., "-") in an unordered list of a markup language (e.g., markdown) to define the core behavioral strategies and interaction logic of the agent in a specific scenario type. For example, "- As Xiaozhi's product, you need to provide users with a high-quality dialogue experience..." is used to define the scenario's behavioral strategy.

[0106] In some embodiments, the prompts at the fourth level (dynamic level) can be indented using a second-level indentation marker (e.g., "--") in a markup language (e.g., markdown) to further refine the third-level scenario behavior strategy, providing more specific interaction methods and operational guidance. For example, "-- Ensure users have a positive emotional experience, specifically through methods including...", can be used to further refine the scenario behavior strategy.

[0107] In some embodiments, the fifth-level (dynamic level) prompts can be indicated by a three-level indentation identifier (e.g., "---") in a markup language (e.g., markdown) unordered list to provide more granular contextual style constraints and specific examples. For example, "---In the idiom chain game, common idioms should be used preferentially..." provides more granular contextual style constraints.

[0108] It is understood that the above five-level division is merely illustrative and does not constitute a limitation on this application. In practical applications, the number of fixed levels is not limited to two, and the number of dynamic levels is not limited to three. Those skilled in the art can flexibly adjust the number of fixed and dynamic levels according to the actual configuration requirements of the intelligent agent (such as the complexity of global inherent attributes, the richness of scene types, etc.). More or fewer levels can also achieve the technical solution of this application.

[0109] For example, in scenarios where it is only necessary to distinguish between "basic settings" and "scenario behavior", the prompts can be simplified into two levels: a fixed level (first level) and a dynamic level (second level). The fixed level includes the agent's personality profile and response constraints, while the dynamic level includes the scenario behavior strategy.

[0110] For example, in scenarios where it is necessary to further subdivide the priority of fixed prompts, the fixed level can be expanded into three sub-levels: the first level defines the core personality profile, the second level defines the behavioral motivation, and the third level defines the response constraints. The three sub-levels together constitute the fixed prompt part.

[0111] In some embodiments, the mapping relationships between each dynamic prompt word, fixed prompt word, and scene type and corresponding dynamic prompt word are pre-stored in a vector database in the form of a configuration table.

[0112] It is understandable that by pre-storing dynamic prompts, fixed prompts, and the mapping relationship between scene types and dynamic prompts in the vector database in the form of a configuration table, offline pre-configuration and efficient retrieval of prompts are achieved. During the real-time inference stage, there is no need to regenerate or calculate prompts, which can reduce processing latency and improve response speed.

[0113] In some embodiments, each dynamic prompt word in the configuration table includes at least one of the following fields: scene type label field, prompt word content field, and hierarchy identifier field; wherein, the scene type label field is used to store at least one scene type that has a mapping relationship with the corresponding dynamic prompt word, and at least one scene type serves as an associated label for the dynamic prompt word.

[0114] It is understandable that by setting a scenario type label field, a suggestion content field, and a hierarchy identifier field for each dynamic suggestion in the configuration table, where the scenario type label field stores the scenario types that have a mapping relationship with the dynamic suggestion, the appropriate dynamic suggestion can be quickly located through field matching after determining the scenario type corresponding to the user input. This achieves a structured association between scenario types and dynamic suggestion, improving retrieval efficiency and accuracy.

[0115] Specifically, the configuration table can be found in the detailed description of the configuration table below, which will not be repeated here.

[0116] In some embodiments, the electronic device 100 may determine the set of prompt words corresponding to the input information by the following method: performing tag matching recall on the configuration table based on the scene type corresponding to the input information to obtain a first recall result, wherein the tag matching recall includes: recalling dynamic prompt words in the scene type tag field of the configuration table that include the scene type corresponding to the input information; performing semantic recall based on the vector similarity between the input information and the extended retrieval information to obtain a second recall result, wherein the extended retrieval information is pre-stored in the configuration table and associated with the dynamic prompt words in the configuration table, and the extended retrieval information includes at least keywords and hypothetical query statements; merging the first recall result and the second recall result to obtain at least one dynamic prompt word.

[0117] In some embodiments, extended retrieval information refers to auxiliary retrieval data associated with dynamic prompts that is pre-stored in a configuration table. This data is used to achieve semantic-level matching by calculating the vector similarity between user input information and extended retrieval information when tag matching recall fails or supplementary recall is required.

[0118] Extended retrieval information includes at least keywords and hypothetical queries. Keywords are one or more words related to the scenario type of the dynamic prompts, used for keyword-level matching via sparse vectors (e.g., the BM25 algorithm). Hypothetical queries are simulated descriptions of user input scenarios to which the dynamic prompts might apply, used for semantic-level matching via dense vectors (e.g., converting text into semantic vectors using an embedding model). Keywords and hypothetical queries together constitute the two vectorized retrieval dimensions of extended retrieval information.

[0119] It should be noted that the keywords and hypothetical query statements are static data pre-built in the offline phase and remain unchanged during the operation of the electronic device 100. The term frequency-inverse document frequency (TF-IDF) features of the keywords are pre-calculated and stored in the configuration table in the offline phase, and the semantic embedding vector of the hypothetical query statements is also pre-calculated through the embedding model and stored in the configuration table.

[0120] In actual question-and-answering, the electronic device 100 directly calculates the similarity between the user input information and the pre-stored sparse vector of keywords and dense vector of hypothetical query statements, without the need for online text preprocessing or vectorization encoding, thereby reducing real-time computing overhead and improving response speed.

[0121] For example, assuming the scenario type corresponding to the input information is "idiom chain", and there is a record in the configuration table with a dynamic prompt word containing "idiom chain" in the scenario type label field, then the label matching recall can hit this record and use it as the first recall result.

[0122] For example, suppose a user inputs "Wake me up at 8 a.m. tomorrow." This input might be identified as "Other" or not explicitly match any scenario type. However, the configuration table contains an extended search record with keywords including "alarm clock," "reminder," and "timed." The hypothetical query is "The user wants to set an alarm clock or a timed reminder." Electronic device 100 can calculate the vector similarity between the user input and the extended search record, and semantic recall can hit this record, using it as a secondary recall result.

[0123] In other words, tag matching recall and semantic recall are executed independently. When the two recall results are merged, a union strategy is used. That is, the final recall result is the deduplicated merged result of the first and second recall results. For the same dynamic prompt word record that is hit by both tag matching recall and semantic recall, only one record is retained.

[0124] It is understandable that when tag matching recall has hit several dynamic prompt words, the extended records hit by semantic recall can also serve as a supplement, providing additional edge case prompt words and enriching the coverage of dynamic prompt words; when tag matching recall has not hit any dynamic prompt words, the records hit by semantic recall can serve as a fallback result, so that the system can still return appropriate dynamic prompt words in edge cases.

[0125] In some embodiments, each dynamic prompt word in the configuration table further includes a retrieval type field, which indicates the first matching mode or the second matching mode used by the corresponding dynamic prompt word when performing tag matching retrieval; in the first matching mode, the dynamic prompt word is retrieved if the scene type corresponding to the input information matches any one of the scene type tags stored in the scene type tag field of the dynamic prompt word; in the second matching mode, the dynamic prompt word is retrieved if the scene type corresponding to the input information matches multiple scene type tags stored in the scene type tag field of the dynamic prompt word.

[0126] For example, the configuration table contains a dynamic prompt word record A, whose scene type label field stores three scene type labels: "idiom chain", "poetry recitation", and "riddle game". The retrieval type field indicates the first matching mode ("OR" matching). When the scene type corresponding to the input information is any one of "idiom chain", "poetry recitation", or "riddle game", the prompt word is recalled.

[0127] For example, the configuration table contains a dynamic suggestion word record B. Its scene type label field stores two scene type labels: "role-playing" and "historical figure," and the search type field indicates the second matching mode ("AND" match). The suggestion word is only recalled when the scene type corresponding to the input information is both "role-playing" and "historical figure" (for example, the user inputs "play as Zhuge Liang"). If the scene type corresponding to the input information is only "role-playing" but not "historical figure" (for example, the user inputs "play as a cat"), the suggestion word will not be recalled.

[0128] It is understandable that by setting a search type field for dynamic prompts in the configuration table, it supports the first matching mode (the scene type is recalled if it matches any associated scene type) and the second matching mode (the scene type must match multiple associated scene types simultaneously to be recalled). It can flexibly control the recall strategy according to the applicable granularity of the prompts (the "OR" matching is used for broadly applicable prompts, and the "AND" matching is used for prompts with strict scene limitations), avoiding false recalls or missed recalls and improving recall accuracy.

[0129] In some embodiments, the electronic device 100 determines the second recall result by: calculating the sparse vector similarity between the input information and the keywords to obtain a first similarity; calculating the dense vector similarity between the input information and the hypothetical query statement to obtain a second similarity; fusing the first similarity and the second similarity according to a preset weight ratio to obtain a target similarity; and recalling semantically adapted dynamic prompts from the configuration table based on the target similarity to obtain the second recall result.

[0130] For example, assume that the input information is "Wake me up at 8 o'clock tomorrow morning". In the keyword matching path, sparse vector similarity calculation is performed between this input information and the keywords "alarm clock", "reminder" and "timing" of an extended record in the configuration table, to obtain a first similarity (for example, 0.85); in the hypothetical query statement matching path, dense vector similarity calculation is performed between this input information and the semantic embedding vector of the hypothetical query statement "The user wants to set an alarm clock or a timed reminder" of the extended record, to obtain a second similarity (for example, 0.78). After fusion according to a preset weight ratio (for example, the weight of the sparse vector is 0.5, and the weight of the dense vector is 0.5), the target similarity is 0.815, which is greater than the preset threshold of 0.5, so the dynamic prompt word corresponding to the extended record is recalled.

[0131] It can be understood that by implementing semantic recall through two specific paths, namely sparse vector similarity calculation (keyword matching) and dense vector similarity calculation (semantic matching), and fusing them into the final similarity according to the preset weight ratio, both the exact matching at the keyword level and the generalized matching at the semantic level are considered, which improves the recall accuracy of dynamic prompt words in boundary scenarios.

[0132] In some embodiments, the electronic device 100 determines the scenario type corresponding to the input information through the following method: acquiring interaction history data of the input information, judging whether the current topic continues the previous round of topic according to the interaction history data and the input information, and determining the scenario type corresponding to the input information based on the judgment result; wherein, in response to the judgment result that the previous round of topic is continued, the scenario type corresponding to the input information is determined based on the historical scenario type corresponding to the interaction history data and the input information; in response to the judgment result that the previous round of topic is not continued, the scenario type corresponding to the input information is determined based on the input information.

[0133] For example, an agent has played multiple rounds of an idiom solitaire game in the current session. The text information input by the user in the current round is "Continue: A profound saying", and the interaction history data of the previous round is "User: Rushing ahead; Agent: Foreseeable". The electronic device 100 acquires the interaction history data of the previous round and the current input information, and judges whether the current input information continues the previous round of topic. The current input information "Continue: A profound saying" is a continuation of the previous round of idiom solitaire game, so the judgment result is that the previous round of topic is continued. Based on this, the electronic device 100 determines that the current scenario type is still "idiom solitaire" by combining the historical scenario type "idiom solitaire" of the previous round and the current input information "Continue: A profound saying".

[0134] For example, after the aforementioned idiom chain game ends, the user inputs "What time is it now?". The electronic device 100 retrieves the previous round's interaction history data (still the idiom chain game content) and the current input information to determine if the current input continues the topic from the previous round. Since the current input "What time is it now?" is completely unrelated to the previous idiom chain game, the result is that it does not continue the previous topic. Based on this, the electronic device 100 determines the current scenario type as "general casual conversation" (or "other") solely based on the current input "What time is it now?".

[0135] It is understandable that by acquiring input information and its interaction history data, it determines whether to continue the topic from the previous round, and based on the determination result (combining the historical scenario type to determine the current scenario type if it continues, and independently determining the current scenario type if it does not continue), the determination of the scenario type becomes more accurate. Furthermore, it supports switching between different scenarios within the same conversation, improving the continuity of context between different scenarios within the same conversation, and further enhancing the user's interactive coherence and experience in cross-scenario dialogues. S403: Generate a response result corresponding to the input information based on the prompt word set, and display the response result.

[0136] In some embodiments, after determining the set of prompt words, the electronic device 100 concatenates fixed prompt words and dynamic prompt words according to the concatenation order indicated by their respective hierarchical identifiers to obtain a complete set of prompt words. This complete set of prompt words is provided as input to the large language model on which the agent is based. After receiving the set of prompt words, the large language model combines it with the original input information from the user, performs inference calculations, and generates a corresponding response result. Finally, the electronic device 100 displays the response result on a display screen.

[0137] For example, when the set of prompts includes the fixed prompt "You are a lively and humorous AI assistant xx" and the dynamic prompt "You need to guide users in playing the idiom chain game", the complete prompt after splicing is "You are a lively and humorous AI assistant xx. You need to guide users in playing the idiom chain game". This complete prompt is input into the large language model, which then generates a response that matches the specified personality and scenario requirements.

[0138] It is understandable that by concatenating fixed and dynamic prompts according to hierarchical identifiers and using them as input to the large language model, the consistency of the agent's responses can be guaranteed, and the response content can be adapted to the current scenario type, thus enabling the agent to flexibly adapt in cross-scenario dialogue.

[0139] Understandable. Figure 4 The flowchart shown is merely an illustrative example and does not constitute an absolute limitation on the method steps. In other embodiments, Figure 4Some steps in S401 to S403 shown can be combined, split, or rearranged.

[0140] For example, in some embodiments, the timing relationship between S401 (acquiring input information) and S402 (determining the set of prompt words) can be adjusted. Specifically, the electronic device 100 can first determine the scene type based on the input information, and then retrieve dynamic prompt words from the configuration table according to the scene type; or it can first perform the scene type determination step, and then perform the scene type determination and prompt word retrieval in parallel.

[0141] For example, in some embodiments, in addition to parallel execution, tag matching recall and semantic recall can also be executed sequentially, first tag matching recall and then semantic recall: tag matching recall is executed first, and if the first recall result contains a dynamic prompt word, it is directly used as the final dynamic prompt word; if the first recall result is empty, semantic recall is then executed, and the second recall result is used as the final dynamic prompt word. This sequential execution method can also achieve the technical solution of this application, achieving the technical effect of quickly obtaining suitable prompt words in common scenarios and using semantic recall in boundary cases. Those skilled in the art can choose the execution method according to actual needs, and this application does not impose any restrictions on it.

[0142] For example, in some embodiments, the configuration table is not limited to vector database storage; it can also be implemented using relational databases, key-value stores, or local file configurations.

[0143] For example, in some embodiments, the scene type corresponding to the input information can also be manually selected and specified by the user, and the scene type is determined by combining automatic recognition.

[0144] Those skilled in the art will understand that the above embodiments can be combined to form new embodiments, and this application does not limit such combinations. The above embodiments are merely illustrative examples and do not constitute a limitation on the scope of protection of this application.

[0145] The configuration table provided in the embodiments of this application will be described in detail below with reference to Table 1.

[0146] For example, Table 1 illustrates a configuration table according to an embodiment of this application. This configuration table is pre-stored in the electronic device 100 in the form of a vector database table, and is used to store the mapping relationship between each dynamic prompt word, fixed prompt words, and each scene type and its corresponding dynamic prompt word.

[0147] It is understandable that this configuration table is pre-built in the offline phase. During the actual question-and-answer process of electronic device 100, only query and recall operations are performed, without modifying the data content in the configuration table. Through the offline pre-configuration of the configuration table, electronic device 100 does not need to regenerate or calculate prompt words during the actual question-and-answer process, thereby reducing processing latency and improving response speed.

[0148] Table 1 Configuration Table

[0149] As shown in Table 1, the configuration table provided in this application embodiment includes the following fields: ID field, promptId field, parentId field, order field, layer field, prompt field, constantLabel field, languageLabel field, sceneLabel field, personaLabel field, keywords field, sparse vector of keywords field, hypothetical query field, dense vector of hypothetical query field, and searchType field. Among them:

[0150] The `id` field is of type string and serves as the primary key, automatically generated by the vector database (`autoId`). For example, `e6266c35f05a4dec80d3d11da965ed08`. This field uniquely identifies each record in the configuration table.

[0151] The `promptId` field is a string and serves as a filter index to store the unique value of the prompt word. This field is maintained by algorithm engineers. If multiple mixed search records are built for the same prompt word (e.g., multiple sets of different keywords and hypothetical queries are configured for the same prompt word), there will be multiple records with different IDs but the same `promptId`. For example, "PER-31161".

[0152] Understandably, the promptId field allows multiple versions of the same prompt word to be associated and traced, facilitating version management and effect analysis of prompt words.

[0153] The `parentId` field is a string and serves as a filter index, storing the ID of the parent record. When a suggestion word at the third, fourth, or fifth level is recalled, the electronic device 100 synchronously recalls its parent record (i.e., the suggestion word corresponding to the previous level) through the `parentId` field. For example, when a suggestion word at the fifth level is semantically retrieved, the electronic device 100 uses the `parentId` field to find the suggestion word at the fourth level to which it belongs, and then further finds the suggestion word at the third level, thus ensuring that all dynamic suggestion words at the complete level are recalled.

[0154] It is understandable that the hierarchical relationship established through the parentId field ensures that the recall of dynamic prompts has hierarchical integrity, avoiding the problem of only recalling fine-grained prompts without the guidance of their upper-level strategies.

[0155] The `order` field is a 64-bit integer (int64) used as a filter index to determine the order of the prompts when concatenating the complete prompt. This field does not require manual maintenance; it increments sequentially when the configuration table is exported from a maintained table (e.g., an Excel file).

[0156] It is understandable that by using the order field, electronic device 100 can maintain the orderliness of prompts within each level when assembling the prompt set, making the structure of the prompt set clearer and more predictable.

[0157] The `layer` field is a 64-bit integer (int64) used as a filter index to indicate the level of the prompt word. The values ​​for the `layer` field are 1, 2, 3, 4, and 5, corresponding to levels one through five, respectively. When concatenating the prompt word set, the electronic device 100 sorts the prompt words in ascending order of their `layer` field values ​​(i.e., level one, level two, level three, level four, and level five) to ensure that fixed prompt words (levels one and two) precede dynamic prompt words (levels three through five). This establishes the basic behavioral framework of the agent before overlaying scene behavioral constraints.

[0158] The prompt field is of type string and serves as a filter index to store the specific content of the prompt words.

[0159] For example, first-level prompts are identified using Extensible Markup Language (XML) tags, such as... <persona><!--Your personality characteristics, ensure they are invisible to users-->< / persona> This is used to define the personality profile of the intelligent agent. This part is not visible to the user and is only used by the large language model as system instructions.

[0160] The second-level prompts are identified by title markers (such as "#"), for example, "#core motivation:", which are used to define the agent's core motivation, behavior, memory, profile, sentence style, response constraints, and word choice style, and other global inherent attributes.

[0161] The third-level cue words are identified by first-level indentation in a markup language unordered list (e.g., "-"), such as "- As a product of a certain company, it brings positive word-of-mouth and market benefits. For this, you need:", to define the core behavioral strategy of the agent in a specific scenario.

[0162] The fourth level of prompts uses second-level indentation markers in a markup language unordered list (e.g., "--"), such as "-- to ensure that users have a positive emotional experience after interaction; to achieve this: ...", to further refine the scenario behavior strategy.

[0163] The fifth level of prompts is identified by three levels of indentation in a markup language unordered list (e.g., "---"), such as "---You need to provide as much knowledge or practical help as possible to the user's actions;", to provide more granular contextual style constraints and specific examples.

[0164] The `constantLabel` field is an array and serves as a filter index for storing static labels. Static labels identify the fixed attributes and applicable conditions of the prompt words, including but not limited to the following values: "-1": Required, indicating that the prompt word must be included in the prompt word set in any scenario; "-2": Long-term memory, indicating that the prompt word is related to the agent's long-term memory; "-3": Personal profile, indicating that the prompt word is related to the user's or agent's personal profile; "0": Water droplet, indicating that the prompt word is related to a specific user profile type (water droplet); "1": Male, indicating that the prompt word is suitable for male user scenarios; "2": Female, indicating that the prompt word is suitable for female users. User scenarios; "3": Milk Dragon 1 - Slacking Off Dragon, indicating that the prompt word is associated with the "Slacking Off Dragon" image tag; "4": Milk Dragon 2 - Rogue Dragon, indicating that the prompt word is associated with the "Rogue Dragon" image tag; "5": Milk Dragon 3 - Check-in Dragon, indicating that the prompt word is associated with the "Check-in Dragon" image tag; "6": Milk Dragon 4 - Sneaky Dragon, indicating that the prompt word is associated with the "Sneaky Dragon" image tag; "7": Milk Dragon 5 - Iron-Pulling Dragon, indicating that the prompt word is associated with the "Iron-Pulling Dragon" image tag; "8": Milk Dragon 6 - Flowery Dragon, indicating that the prompt word is associated with the "Flowery Dragon" image tag.

[0165] It is understandable that, through the constantLabel field, electronic device 100 can quickly filter and recall appropriate dynamic prompts based on various contextual dimensions of the current session (such as currently active image tags, user profile tags, etc.).

[0166] The `languageLabel` field is of type string and serves as a filter index for storing language tags. Language tags identify the language scenario to which the suggestion term applies, including but not limited to the following values: "en" indicates an English response scenario, "cn" indicates a Chinese response scenario, and an empty value indicates the default language (e.g., Chinese).

[0167] It is understandable that when the language of the input information is English, the electronic device 100 can filter out dynamic prompts suitable for English scenarios through the languageLabel field, so that the intelligent agent can reply in English.

[0168] The `sceneLabel` field is an array and serves as a filter index for storing a list of scene tags. Scene tags identify the type of scene to which the prompt applies, including but not limited to: product Q&A, device instructions, role-playing, song guessing, mathematical calculations, encyclopedia Q&A, riddles, idiom chain games, short story chain games, rock-paper-scissors, brain teasers, poetry recitation games, guessing games, memory challenges, jokes, etc.

[0169] It is understandable that, through the sceneLabel field, electronic device 100 can filter out appropriate dynamic prompts based on the scene type corresponding to the input information.

[0170] The `personaLabel` field is an array, serving as a filter index to store persona tags. Persona tags identify the type of persona to which the prompt applies, including but not limited to: "0" indicates the default persona (not a default value, meaning no specific persona is specified); "1" indicates a custom persona, i.e., a style or personality setting customized by the user through commands during the conversation.

[0171] It is understandable that, through the personaLabel field, electronic device 100 can filter out appropriate dynamic prompts based on the persona type active in the current session.

[0172] The `keywords` field is of type string and serves as a filter index for storing a list of keywords. Multiple keywords are separated by spaces. Keywords are used in semantic recall to calculate sparse vector similarity with user input.

[0173] Understandably, the keyword list provides a search path based on precise word matching for dynamic suggestion words, thereby improving recall efficiency.

[0174] The `sparse_vector` field is of type binary vector, and its index type is hierarchical navigable small world (HNSW), used to store sparse vectors of keywords. This field name is fixed by the vector database. In semantic recall, the electronic device 100 calculates the sparse vector similarity between the user input information and the `sparse_vector` field (e.g., using the BM25 algorithm) to obtain the first similarity score.

[0175] It is understandable that the sparse_vector field enables electronic device 100 to perform efficient sparse vector retrieval based on the statistical features of keywords, thereby improving the accuracy of keyword matching.

[0176] The `hypoQuery` field is a string and serves as a filter index to store hypothetical query statements. These hypothetical query statements are simulated descriptions of user input scenarios to which the dynamic suggestion might be applicable. In semantic recall, the electronic device 100 calculates a second similarity score by performing dense vector similarity calculations between the user input information and the semantic embedding vector of the `hypoQuery` field.

[0177] It is understandable that the hypoQuery field provides a semantic generalization-based retrieval path for dynamic prompts, enabling electronic device 100 to recall dynamic prompts that are semantically related to user input but do not completely match the keywords.

[0178] The `vector` field is of type `vector` and indexed by an inverted index. It is used to store dense vectors of hypothetical query statements. The field name is fixed by the vector database. In semantic recall, the electronic device 100 calculates dense vector similarity between the semantic embedding vector of the user input information and the `vector` field to obtain a second similarity score.

[0179] It is understandable that the vector field enables electronic device 100 to perform efficient dense vector retrieval based on semantic similarity, thereby improving the ability of semantic generalization matching.

[0180] The `searchType` field is a 64-bit integer (int64) used as a filter index to indicate the matching logic employed when recalling the suggested term based on tag matching. The values ​​for the `searchType` field include: "0" indicates an OR query, meaning the suggested term is recalled if either the tag query or the mixed search matches; "1" indicates an AND query, meaning the suggested term is recalled only if both the tag query and the mixed search match.

[0181] For example, in a scenario where the character tag is "Mo Yulong", there might be a language style prompt: "When the user shows signs of frustration, you should reply with reassuring content." The searchType field of this prompt can be set to "1" (with query), meaning that it will only be retrieved if both the character tag and the scenario tag match, in order to avoid the prompt being mistakenly retrieved under an inappropriate persona.

[0182] It is understandable that by using the searchType field, the electronic device 100 can flexibly control the recall strategy according to the applicable granularity of the prompt words, thereby avoiding false recalls or missed recalls and improving recall accuracy.

[0183] The forHybrid field is a 64-bit integer (int64) used as a filter index to identify whether the record is an extended record added for hybrid retrieval. The values ​​for the forHybrid field include: "0" indicates that the record is the original record of the prompt word; "1" indicates that the record is an extended record used for hybrid retrieval (such as different keyword or hypothetical query versions built for the same prompt word).

[0184] It is understandable that, through the forHybrid field, electronic device 100 can distinguish between the original prompt word records and the hybrid retrieval extended records. When tag matching is used for recall, only the original records are queried (forHybrid=0), while when semantic recall is used, the extended records can be queried (forHybrid=1), thus achieving data-level isolation between tag matching and semantic retrieval.

[0185] The `version` field is of type string and serves as a filter index to store the version number of the configuration table. The version number identifies the version to which the configuration table belongs, for example, "iteration 29-dev-20260310-1740".

[0186] It is understandable that, through the version field, electronic device 100 can support version management and canary release of configuration tables, and use different versions of configuration tables in different versions of intelligent agents.

[0187] It is understood that the field design of the above configuration table is only an illustrative example. In actual applications, fields can be added, deleted, or modified as needed, and this application does not impose any restrictions on this. Through the structured storage and multi-dimensional tag system of the above configuration table, the electronic device 100 can achieve refined management and efficient retrieval of prompt words, providing a data foundation for scene-adaptive prompt word arrangement.

[0188] The following section describes in detail, with specific examples, how electronic device 100 performs prompt word recall based on the above configuration table.

[0189] For ease of explanation, let's assume the input message (query) is "Let's play idiom chain game", the character tag corresponding to the current session is "Milk Dragon 1-Touching Fish Dragon", the scene tag is "Idiom Chain Game", and the language tag is empty (i.e., the default is Chinese).

[0190] Based on the above conditions, electronic device 100 executes two recall requests in parallel: tag query and mixed retrieval.

[0191] For example, tag query request 1 is used to retrieve dynamic prompt word records from the configuration table that precisely match the current scene tag, image tag, and language tag.

[0192] Specifically, the query parameters for this request are as follows:

[0193] The query text is {query}, which means "Let's play the idiom chain game".

[0194] Maximum number of records returned (topK): 10000 (default value);

[0195] Semantic similarity threshold (score): 0.01 (an extremely low threshold to ensure that records with matching tags are not filtered out by the semantic similarity threshold);

[0196] Filter condition string (filterCondStr):

[0197] version = "iteration 29-dev-20260310-1740" and forHybrid = 0 and (

[0199] (searchType = 0 and (constantLabel include ("-1", "-2", "-3", "{characterTag}") or sceneLabel include ("{sceneTag}") or languageLabel = "{langTag}") or

[0200] searchType = 1 and (

[0201] (constantLabel includes ("-1", "-2", "-3", "{characterTag}") and sceneLabel includes ("{sceneTag}") and hypoQuery = "" and languageLabel ="{langTag}") )

[0203] ).

[0204] That is, first, the fixed filter conditions are: the version number of the configuration table is "Iteration 29-dev-20260310-1740", and the record type is the original prompt record (forHybrid=0, that is, a non-hybrid retrieval extended record).

[0205] Second, based on the value of the searchType field, the filter conditions are divided into two cases:

[0206] Case 1 (searchType=0, OR query): A record is recalled if it meets any of the following conditions — the constantLabel field contains "-1" (mandatory), "-2" (long-term memory), "-3" (personal profile) or the current character tag "Nailong 1 - Slacking Dragon"; or the sceneLabel field contains the current scene tag "Idiom Solitaire"; or the languageLabel field is empty (the current language tag is Chinese).

[0207] Case 2 (searchType=1, AND query): A record is recalled only if it meets all of the following conditions simultaneously — the constantLabel field contains "-1", "-2", "-3" and "Nailong 1 - Slacking Dragon"; the sceneLabel field contains "Idiom Solitaire"; the hypoQuery field is empty (that is, the record is a common record without hypothetical query statements); and the languageLabel field is empty.

[0208] It can be understood that Case 1 (OR query) is applicable to prompts that are general across scenarios (for example, prompts such as "as a product, it is necessary to provide users with positive experience" that are applicable regardless of the scenario), while Case 2 (AND query) is applicable to prompts that require exact matching of multiple conditions (for example, specific script prompts that are only applicable under the "Slacking Dragon" character and the "Idiom Solitaire" scenario).

[0209] For another example, the hybrid retrieval request 2 is used to recall hybrid retrieval extended records that match the current scene tag, character tag and language tag from the configuration table.

[0210] Specifically, the query parameters for this request are as follows:

[0211] The query text is {query}, which means "Let's play the idiom chain game".

[0212] Maximum number of records returned (topK): 10000 (default value);

[0213] Semantic similarity threshold (score): 0.5;

[0214] Sparse vector weights: 0.5;

[0215] Dense vector weights: 0.5;

[0216] Filter condition string (filterCondStr):

[0217] forHybrid = 1 and (

[0218] (searchType = 0) or

[0219] (searchType = 1 and (

[0220] (constantLabel include ("-1", "-2", "-3", "{characterTag}")and sceneLabel include ("{sceneTag}") and languageLabel= "{langTag}") or

[0221] (constantLabel include ("-1", "-2", "-3", "{characterTag}")and sceneLabel include ("{sceneTag}")) or

[0222] (sceneLabel include ("{sceneTag}") and languageLabel= "{langTag}") or

[0223] (constantLabel include ("-1", "-2", "-3", "{characterTag}")and languageLabel= "{langTag}") ))

[0225] ).

[0226] In other words, firstly, the fixed filter condition is: record type is hybrid search extended record (forHybrid=1). Secondly, based on the value of the searchType field, the filter condition is divided into two cases:

[0227] Scenario 1 (searchType=0, or query): This record is directly allowed to enter the vector similarity calculation stage of hybrid retrieval without additional tag filtering. This corresponds to records that are not limited to specific scenarios and can be recalled through semantic matching.

[0228] Scenario 2 (searchType=1, and query): The record must meet any one of the following four combined conditions to be allowed to enter the vector similarity calculation stage of the mixed search: Combination condition 1: The constantLabel field contains "-1", "-2", "-3" and the current image tag; and the sceneLabel field contains the current scene tag; and the languageLabel field is the current language tag; Combination condition 2: The constantLabel field contains "-1", "-2", "-3" and the current image tag; and the sceneLabel field contains the current scene tag (regardless of language); Combination condition 3: The sceneLabel field contains the current scene tag; and the languageLabel field is the current language tag (regardless of image); Combination condition 4: The constantLabel field contains "-1", "-2", "-3" and the current image tag; and the languageLabel field is the current language tag (regardless of scene).

[0229] It's understandable that the `searchType=1` in request 2 lacks the `hypoQuery=""` condition compared to `searchType=1` in request 1. This is because the hybrid search extended record itself necessarily contains a `hypoQuery` (hypothetical query statement) field, used for semantic similarity calculation with user input information. Therefore, request 2 no longer checks for null values ​​in the `hypoQuery` field.

[0230] It is understood that, through the above flexible combination of conditions, the embodiments of this application can achieve flexible tag filtering in different dimensions (image, scene, language), and recall as many semantically related extended records as possible while ensuring recall accuracy, so as to provide further screening in the subsequent vector similarity calculation stage.

[0231] In some embodiments, when executing request 2, the electronic device 100 further calculates the vector similarity between the user input information "Let's play idiom chain" and each candidate extended record based on the tag filtering. For the specific vector similarity calculation method, please refer to the relevant description of semantic recall mentioned above, which will not be repeated here.

[0232] In some embodiments, after both request 1 and request 2 have been executed, the electronic device 100 merges the two recall results (the first recall result and the second recall result). For example, a union strategy is used to deduplicate and merge the dynamic prompt word records in the two results to obtain a final set of dynamic prompt words, which serves as the at least one dynamic prompt word.

[0233] It is understandable that through the above two-pronged parallel recall mechanism, tag matching recall can quickly and accurately obtain dynamic prompt words directly related to the current scene, while hybrid retrieval recall can cover boundary cases through semantic generalization capabilities. After merging the two results, the accuracy and efficiency of prompt word recall in common scenarios are improved, and the coverage and robustness of prompt word recall in boundary cases are also enhanced, thus providing the agent with adaptive dynamic prompt words in various input scenarios.

[0234] It is understood that the specific values ​​in the above examples (e.g., score=0.01, score=0.5, sparse vector weight=0.5, dense vector weight=0.5, version number "iteration 29-dev-20260310-1740", image tag "Milk Dragon 1-Touching Fish Dragon", scene tag "Idiom Chain", etc.) are merely illustrative and do not constitute a limitation on this application. In practical applications, those skilled in the art can adjust the specific values ​​of these parameters according to actual needs, and this application does not impose any restrictions on this.

[0235] The process of hybrid retrieval is described in detail below with reference to the accompanying diagram.

[0236] For example, Figure 5 A logical schematic diagram of a hybrid retrieval is shown according to an embodiment of this application. It can be understood that... Figure 5 The entity executing the flowchart shown is electronic device 100.

[0237] like Figure 5 As shown, after the electronic device 100 determines the scenario type corresponding to the current query statement (i.e., the input information of the agent), the electronic device 100 uses the current query statement as input data for hybrid retrieval.

[0238] First, the electronic device 100 performs a scalar filtering (i.e., tag filtering) stage. Based on scalar information such as current scene tags, image tags, and language tags, the electronic device 100 performs a preliminary screening of the prompt word records in the configuration table, retaining only candidate records related to the current scene, so as to reduce the computational load of subsequent vector retrieval.

[0239] It is understandable that by using scalar filtering, electronic device 100 can eliminate a large number of irrelevant records before vector retrieval, thereby improving retrieval efficiency.

[0240] Secondly, the electronic device 100 performs vector retrieval on the candidate records filtered by scalar. Specifically, the electronic device 100 calculates the similarity between the current query and the sparse vector (i.e., the sparse vector of keywords) and dense vector (i.e., the dense vector of hypothetical query) of each candidate record. During the vector retrieval process, the electronic device 100 recalls N candidate records that match the user input information at the keyword level through a sparse vector index (e.g., a keyword inverted index), where N is a positive integer; and recalls M candidate records that match the user input information at the semantic level through a dense vector index, where M is a positive integer.

[0241] Then, the electronic device 100 performs a fusion reranking on the recalled N candidate records and M candidate records. In the fusion reranking stage, the electronic device 100 fuses the sparse vector similarity (first similarity) and the dense vector similarity (second similarity) according to a preset weight ratio (e.g., sparse vector weight 0.5, dense vector weight 0.5) to obtain the target similarity.

[0242] Finally, the electronic device 100 sorts all candidate records based on target similarity and selects the K candidate records with the highest similarity as the second recall result of semantic recall.

[0243] It is understandable that by performing a hybrid retrieval process of first executing scalar filtering, then vector index retrieval, and finally fusion reordering, the electronic device 100 can achieve both precise keyword matching and semantic generalization matching while ensuring retrieval efficiency, thereby improving the recall accuracy and recall efficiency of dynamic prompts in boundary scenarios.

[0244] In some embodiments, the electronic device 100 can determine the scene type corresponding to the input information through a scene classification model. The input data of the scene classification model may include at least one of a short-term topic question and answer list (i.e., the aforementioned interaction history data) and the current query statement (query, i.e., the aforementioned agent's input information). The output data of the scene classification model is the scene type, including but not limited to: jokes, idiom chain games, poetry recitation games, mathematical calculations, memory challenges, encyclopedia questions and answers, charades, riddles, rock-paper-scissors, short story chain games, song title guessing, brain teasers, role-playing, product questions and answers, character questions and answers, trivia questions and answers, instructions, and others. Among them, the "other" category is used for other games, game selections, casual chat and daily chat content that do not belong to the above categories (such as asking about the weather forecast, what day of the week it is, etc.), meaningless content or interjections, etc.

[0245] Specifically, when the topic continuation marker indicates that the current query statement continues from the previous round of topics, the input data is a short topic question and answer list and the current query statement; when the topic continuation marker indicates that the current query statement does not continue from the previous round of topics, the input is only the current query statement.

[0246] In some embodiments, the scenario classification model determines the scenario type based on the following judgment rules: If the topic continuation marker indicates that the current query statement does not continue the topic of the previous round (i.e., the topic continuation marker is NO), the scenario type is determined independently based solely on the content of the current query statement; if the topic continuation marker indicates that the current query statement continues the topic of the previous round (i.e., the topic continuation marker is YES), a comprehensive judgment is required by combining historical dialogue content and historical scenario types: if the current query statement is a continuation of a historical scenario (e.g., answering a game question, continuing game steps, giving a reaction or evaluation, etc.), the historical scenario type is maintained; if the current query statement changes the topic, it is re-judged into a new category.

[0247] In some embodiments, the scene classification model classifies based on the following prompt word template: "You are a dialogue scene classifier. Please determine the scene type of the current query based on the following input information and output the category strictly according to the output requirements. Selectable category list: 1. Joke – Must be a joke explicitly requested or told by the user, such as a dry joke; 2. Idiom Chain – A game of sequentially connecting four-character idioms, where the user explicitly requests to "play an idiom chain game"; 3. Poetry Recitation – A game of connecting lines of poetry based on specific characters or themes, note that it must be lines of poetry; 4. Mathematical Calculation – Mathematical calculation, mental arithmetic, or a math problem challenge; 5. Memory Challenge – A game testing memory; 6. Encyclopedia Q&A – The user asks the assistant for relevant knowledge, including various encyclopedic questions and answers, requiring a questioning tone, such as: 'How is this done?'" "Give me an introduction..." If it's just a statement or casual conversation, it belongs to the "Other" category; 7. Pictionary - must explicitly include keywords like "Pictionary", otherwise it belongs to "Other"; 8. Riddle Game - a riddle or puzzle game, explicitly including keywords like "riddle"; 9. Rock-Paper-Scissors - a rock-paper-scissors game; 10. Story Chain - taking turns continuing a story, if it's just simple storytelling, it belongs to "Other"; 11. Guess the Song Title - identifying the melody or lyrics of a song; 12. Brain Teasers - thinking... 13. Riddles – Clearly state the role to be played; 14. Product Q&A – Must be related to the product or electronic product; 15. Persona Q&A – Inquire about the assistant's persona, such as personality, age, and functions, e.g., "Who are you?", "What's your name?"; 16. Trivia Q&A – Explicitly ask for trivia; 17. Commands – User requests the assistant to perform system operations, close the assistant, etc., e.g., "Turn off the call", "Call the boss"; 18. Other – Games, game selections, or casual conversation content that do not belong to the above categories, such as asking about the weather forecast, what day of the week it is, or meaningless content, interjections, etc., that do not belong to the above categories, should be output as "Other". Judgment Rules: 1. If the topic is not continuous (topic continuity is marked as NO), the judgment is based solely on the content of the current query statement; 2. If the topic is continuous (topic continuity is marked as YES), a comprehensive judgment is needed combining historical dialogue content and historical scenario types: if the current query statement is a continuation of a historical scenario (such as answering game questions, continuing game steps, giving a reaction or evaluation, etc.), the historical scenario type is maintained; if the current query statement changes topics, it is re-judged into a new category. Input Information: Historical Dialogue: [Historical Dialogue Record]; Historical Scenario Type: [Scenario Type of Historical Dialogue]; Topic Continuation Marker: [YES / NO]; Current Query Statement: [User Input Content]. Output Requirements: Output only one category name, which must be one of the above 18 categories; if it cannot be determined, output "Other".

[0248] Exemplarily, the following are multiple judgment examples of the scene classification model.

[0249] For example, assume that the historical dialog includes the user's input "Solitaire: The horse is in the foremost position" and the smart assistant's response "Foreknowledge", the historical scene type is idiom solitaire, the topic continuation flag is YES, the current query statement is "The answer is 'The pupil surpasses the master'", and the model output is "idiom solitaire".

[0250] Or for example, the historical dialog includes the user's input "Uh, how is it made?", the smart assistant's response "Sorry, what do you want to ask about how it is made? Could you describe it in more detail? I will try my best to help you", the user's input "It is konjac that is used" and the smart assistant's response "Konjac", the historical scene type is others, the topic continuation flag is NO, the current query statement is "How is it processed?", and the model output is "encyclopedia Q&A". The reason is that although "How is it processed?" follows the above topic about "konjac", the topic continuation flag is NO (no continuation), so the judgment is made independently only based on the current query statement. The current query statement is in an interrogative tone and belongs to encyclopedia Q&A.

[0251] Or for example, the historical dialog includes the user's input "If progress can be made in these aspects, it will be more effective than empty talk" and the smart assistant's response "Yes", the topic continuation flag is YES, the current query statement is "He also knows that G's current situation is not optimistic", and the model output is "others". The reason is that the user is expressing his own opinions and views, not asking the smart assistant, which belongs to casual chat content.

[0252] Or for example, the current query statement is "What time is it now, what day of the week is it today?", and the model output is "others". The reason is that the daily topic of asking for the time belongs to others, not to encyclopedia Q&A.

[0253] Or for example, the historical dialog includes the user's input "Blah blah blah" and the smart assistant's response "Do you want to play an idiom solitaire game? I'll start first with 'Cheerful voices and laughter', and you can reply with 'Sincere words and earnest wishes' to continue", the historical scene type is others, the topic continuation flag is YES, the current query statement is "Oh no / Nonsense / Smart assistant, why don't you say anything", and the model output is "others". The reason is that although the smart assistant proposed to play the idiom solitaire game, the user did not respond, so it belongs to others.

[0254] In some embodiments, after the scene classification model outputs the scene type, the electronic device 100 may further perform a post-processing mapping phase, to normalize the original category name output by the scene classification model into a standard label.

[0255] For example, if the scene classification model outputs multiple variations such as "joke", "funny", "humor", and "cold joke", the post-processing mapping stage can uniformly map the above variations to the "joke" label; if the scene classification model outputs multiple variations such as "encyclopedia Q&A", "encyclopedia", "knowledge", "history", "culture", "geography", "art", "law", "funny knowledge", "popular science", and "tourism", the post-processing mapping stage can uniformly map the above variations to the "encyclopedia Q&A" label.

[0256] For example, the post-processing mapping stage may include: matching the scene categories output by the scene classification model with preset scene categories. If the match fails, matching the scene categories output by the scene classification model with variants of the preset scene categories. If all the above matches fail, "Other" is output.

[0257] It is understandable that through post-processing mapping, the electronic device 100 can unify the various variants output by the scene classification model into standardized scene labels, thereby improving the robustness and stability of scene classification.

[0258] In some embodiments, the aforementioned question-answering method can be further divided into an offline preparation stage and a real-time reasoning stage (i.e., the aforementioned actual question-answering process). The execution process of the question-answering method provided by the embodiments of this application at different stages will be described below with reference to the accompanying drawings.

[0259] For example, Figure 6 A logical diagram of a question-and-answer method is shown according to an embodiment of this application.

[0260] like Figure 6 As shown, during the offline preparation phase, the electronic device 100 pre-configures, vectorizes, stores, and caches the prompt words, providing data support for prompt word retrieval in real-time question answering.

[0261] In some embodiments, developers maintain a prompt word table and generate a prompt word vector database (VDB) insertion request using a one-time developed script to complete the prompt word version update and write it to the system prompt word vector database. The engineering microservice (such as the aforementioned smart assistant) reads the latest version of all prompt words upon startup and stores them in a Redis cache (an in-memory database) for VDB real-time recall timeout scenarios, ensuring that the recalled prompt words can still be read normally in abnormal scenarios.

[0262] It is understandable that the offline preparation phase is performed in advance before the user initiates the question-and-answer interaction, and will not occupy real-time computing resources during the question-and-answer interaction process, thereby reducing the latency of the real-time inference phase.

[0263] During the real-time inference phase, after acquiring the current query, the electronic device 100 executes multi-modal processing, tool invocation, and audio chat branches in parallel via intent control, outputting the current query and the historical question-and-answer list (qa_list), and performs session continuation judgment. If the current query is determined to be a continuation of the previous round's topic, scene recognition is performed based on the current query and the historical question-and-answer list; if it is determined to be a completely new topic, scene recognition is performed only based on the current query.

[0264] It can be understood that intent control refers to the decision-making module in electronic device 100 used for intent recognition and task distribution of user input information. Specifically, after receiving the current query statement, intent control performs semantic understanding and intent classification on the query statement, and routes the query statement to the corresponding processing branch according to the recognition results. For example, when the user inputs "Set an alarm for 8 am tomorrow", intent control recognizes that the input information contains a device instruction intent, and routes the input information to the tool call branch; when the user inputs "Tell a joke", intent control recognizes that the input information contains a casual conversation intent, and routes the input information to the audio casual conversation branch; when the user inputs "Let's play idiom chain", intent control recognizes that the input information contains a game intent, and routes the input information to the scene dialogue branch. It can be understood that through the decision-making and distribution of intent control, electronic device 100 can allocate different types of user input information to corresponding processing branches, thereby achieving efficient concurrent processing of multiple tasks.

[0265] Multimodal processing refers to the ability of electronic device 100 to process and fuse data from multiple modalities in user input information. Specifically, user input information may include text modality (e.g., text entered by the user via keyboard or obtained through speech recognition), speech modality (e.g., raw speech signals entered by the user via microphone), and image modality (e.g., images or video frames captured by the user via camera). The multimodal processing module performs corresponding processing and feature extraction on the input data of different modalities, and fuses the multimodal information to enable the intelligent agent to more comprehensively understand the user's input intent and contextual information. It can be understood that through multimodal processing, electronic device 100 can support users to interact with the intelligent agent in real-time call scenarios using multiple methods such as voice, text, or images.

[0266] Tool invocation refers to the ability of electronic device 100 to invoke its operating system interface or third-party application interface to perform corresponding operations in response to device command intent in user input information. Specifically, when the intent control center recognizes that the user input information contains device command intent (e.g., "set an alarm for 8 a.m. tomorrow", "call the boss", "turn on Bluetooth", etc.), the tool invocation module generates a corresponding system call request based on the instruction, invokes the operating system interface or relevant application interface of electronic device 100 to perform the corresponding operation, and returns the execution result to the intelligent agent to generate a response message containing the operation result. It can be understood that, through tool invocation, the question-and-answer method provided in this application embodiment can not only generate text-based responses, but also perform specific device operations according to user instructions, thus expanding the capability boundaries of the intelligent agent.

[0267] Audio chat refers to the ability of electronic device 100 to process the voice signal in user input information in real time and generate a voice response. Specifically, in a real-time call scenario, the audio chat branch receives the user's voice input, converts the voice signal into text information through speech recognition, provides the text information to the intelligent agent for processing, and after the intelligent agent generates a response text, it converts the response text into a voice signal through speech synthesis and plays it to the user through the speaker of electronic device 100. It can be understood that, through the audio chat branch, the question-and-answer method provided in this application embodiment can provide users with a smooth voice dialogue experience in real-time call scenarios, allowing users to interact with the intelligent agent without having to input text via a keyboard.

[0268] Continue to refer to Figure 6 During scene recognition, the electronic device 100 generates scene tags (such as role-playing tags, emotion tags, etc.) based on the current query (or the current query and the historical question-and-answer list); obtains fixed prompt words such as required / image tags and language tags; extracts keywords from the current query (or the current query and the historical question-and-answer list); and calls an embedding model to encode the current query (or the current query and the historical question-and-answer list) to obtain a query embedding. Then, the required / image tags, language tags, scene tags, role-playing tags, emotion tags, keywords, version numbers, and query embeddings are input into the system prompt word VDB. The query embedding is used for vector retrieval (refer to the aforementioned description of vector retrieval, which will not be repeated here).

[0269] Then, the electronic device 100 performs a prompt word recall process:

[0270] The first approach involves sending tag query requests and mixed search requests to the system's suggestion word VDB: tag queries yield required suggestion words, scene-related suggestion words, character-related suggestion words, and language-related suggestion words, while mixed searches yield corner case suggestion words. For details, please refer to the aforementioned description of tag matching and recall; this application will not elaborate further.

[0271] The second approach involves using keywords and query vectors to retrieve mid-term topics from Redis / VDB, and then recalling the corresponding atomic facts and atomic event dialogue summaries. For details, please refer to the aforementioned description of semantic recall; this application will not elaborate further here.

[0272] The third approach uses query vectors to retrieve long-term memory (VDB) information related to the current user.

[0273] The recall process can be referenced. Figure 7 The diagram shows the recall logic.

[0274] like Figure 7 As shown, electronic device 100 retrieves dynamic prompt word records that precisely match the current scene tag, image tag, and language tag from the configuration table through tag query request request 1, obtaining the first retrieval result prompt_list1. Then, it retrieves mixed search extended records that match the current scene tag, image tag, and language tag from the configuration table through mixed search request request 2, obtaining the second retrieval result prompt_list2.

[0275] Continue to refer to Figure 6 After the recall process is completed, the prompt words are merged and assembled to obtain a complete set of prompt words.

[0276] The assembly process can be referenced. Figure 8 The diagram shown illustrates the logic of the prompt word assembly process.

[0277] like Figure 8 As shown, the prompt word merging and assembly process includes: merging and deduplicating the tag matching recall results and semantic recall results (the first recall result prompt_list1 and the second recall result prompt_list2); traversing the recall records to complete the parent-child hierarchical related prompt words; and sorting all prompt word records in ascending order, assembling them one by one according to the hierarchy and indentation rules to form a complete prompt word set.

[0278] The assembly process includes a tag write-back judgment branch: when user profile information is identified in the session, profile tags are generated and written back to the system prompt word VDB; when long-term memory information is identified in the session, constant tags are generated and written back to the system prompt word VDB. Finally, the assembled prompt word set is fed into the large language model, and the corresponding response result is generated and output in combination with the user input information.

[0279] Understandably, the specific processing flow for the real-time inference stage can be found in the aforementioned documentation. Figure 4 The question-and-answer method shown in the figure has its prompts configured and vectorized in advance during the offline stage, which can reduce the computational overhead of the real-time inference stage.

[0280] It is understood that the question-answering method provided in this application can be applied to various application scenarios that require real-time dialogue interaction between intelligent agents and users. For example, it can be applied to the following scenarios: intelligent assistants in electronic devices (such as voice assistants in terminal devices such as mobile phones, tablets, smart speakers, and smart wearable devices) to provide users with a natural and fluent voice dialogue interaction experience; AI call robots in real-time communication scenarios to provide users with intelligent question-answering, entertainment interaction, or information query services during voice calls; intelligent customer service systems to provide users with automated consultation responses and problem solving in enterprise service scenarios; AI tutoring in education and tutoring scenarios to assist users in language learning, knowledge training, or skills practice; and virtual digital human interaction scenarios to provide users with an immersive intelligent dialogue experience in virtual reality or augmented reality environments.

[0281] It is understood that the above application scenarios are merely illustrative examples. The question-answering method provided in this application can also be applied to other interactive scenarios that require intelligent agents to adaptively switch between different dialogue scenarios. This application does not impose any limitations on this.

[0282] It is understood that the intelligent agent in the embodiments of this application can be a large language model based on the transformer architecture, such as the Qwen series models, LLaMA series models, GPT series models, etc.; or it can be a language model without a transformer architecture, such as a state space model (SSM). The embodiments of this application do not limit the specific architecture and number of parameters of the intelligent agent. As long as the intelligent agent can receive a set of prompt words as input and generate corresponding response results based on the set of prompt words, the question-answering method provided in the embodiments of this application can be used.

[0283] It is understood that electronic device 100 can be a cloud server. The cloud server can be a physical server or virtual server deployed in a public cloud, private cloud, or hybrid cloud environment, such as an elastic cloud server (ECS), a bare metal server, or a cloud virtual machine.

[0284] Electronic device 100 can also be a local server. This local server can be a physical server deployed in an enterprise's internal data center or a private cloud server.

[0285] Electronic device 100 can also be a terminal device. The terminal device can be a personal computer (PC), laptop, workstation, tablet, or smartphone used by the developer.

[0286] Electronic device 100 can also be a combination of the above forms, such as a distributed system composed of cloud servers and terminal devices, in which different functional modules can be deployed on different electronic devices and work together through network communication.

[0287] It is understood that the specific type of electronic device 100 is not limited in the embodiments of this application, as long as it can execute the question-and-answer method provided in the embodiments of this application.

[0288] To better understand the technical solutions of the embodiments of this application, the devices involved in the embodiments of this application will be described below with reference to the accompanying drawings.

[0289] For example, Figure 9 A schematic diagram of the hardware structure of an electronic device 100 is shown according to an embodiment of this application.

[0290] like Figure 9 As shown, the electronic device 100 includes one or more (only one is shown in the figure) processors 110, memory 120, communication interface 130, and bus 140. The processors 110, memory 120, and communication interface 130 are interconnected via the bus 140.

[0291] The processor 110 may include one or more processing units, such as a central processing unit (CPU), a microprocessor, a graphics processing unit (GPU), an application-specific integrated circuit, etc., for executing relevant programs to implement the question-and-answer method of the method embodiments of this application.

[0292] The memory 120 may include one or more memories for storing data or one or more applications. The memory may be read-only memory (ROM), static storage device, dynamic storage device, random access memory (RAM), high-speed random access memory, double data rate synchronous dynamic RAM (DDR), high bandwidth memory (HBM), or non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.

[0293] In some embodiments, if the processor is a CPU, the corresponding memory 120 is main memory. In some embodiments, if the processor 110 is a GPU, the corresponding memory 120 can be video memory.

[0294] Processor 110 can also be an integrated circuit chip with signal processing capabilities. In implementation, each step of the data processing method of this application can be completed by software instructions in processor 110. The aforementioned processor 110 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by 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 120. Processor 110 reads information from memory 120 and executes the question-and-answer method of the method embodiments of this application in conjunction with its hardware.

[0295] Communication interface 130 is used to enable communication between electronic device 100 and other devices or communication networks. Communication interface 130 may include wired or wireless communication interfaces, so that electronic device 100 can access the Internet via wired or wireless means, and obtain data from or send data to other devices based on the Internet.

[0296] Bus 140 is used to connect processor 110, memory 120, communication interface 130 and other possible modules or circuits.

[0297] In some embodiments, the electronic device 100 can be used to execute the question-and-answer method corresponding to the method embodiments described above. To avoid repetition, it will not be described again here.

[0298] It should be understood that Figure 9 The structure of the electronic device 100 shown is only an example. In other embodiments, the electronic device 100 may include more or fewer modules, which is not limited here.

[0299] This application also provides a computer-readable storage medium storing at least one computer program instruction, at least one program segment, code set, or instruction set, which is loaded and executed by a processing circuit to implement the question-and-answer method provided in this application.

[0300] This application also provides a program product that includes instructions that, when executed by an electronic device, enable the electronic device to implement the question-and-answer method provided in this application.

[0301] This application also provides a chip, including a processor coupled to a memory, for executing computer programs or instructions stored in the memory, so that the chip implements the question-and-answer method provided in this application.

[0302] Embodiments of this application can be implemented as computer programs or program code that execute on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0303] Various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or combinations of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0304] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digital signal processor, a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor.

[0305] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.

[0306] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, optical discs, magneto-optical disks, read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other forms of propagated signals. Therefore, machine-readable media include any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.

[0307] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, the inclusion of structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.

[0308] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.

[0309] It should be noted that in the examples and description of this patent, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, 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 limitations, 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.

[0310] Although this application has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art should understand that various changes in form and detail may be made thereto without departing from the spirit and scope of this application.

Claims

1. A question-and-answer method, characterized in that, Applied to electronic devices, which operate intelligent agents; and, The method includes: Obtain the input information of the intelligent agent; A set of prompt words corresponding to the input information is determined, wherein the set of prompt words includes at least one fixed prompt word and at least one dynamic prompt word, wherein the at least one fixed prompt word is related to the global inherent attributes of the agent, and the at least one dynamic prompt word is determined based on the scene type corresponding to the input information; Based on the set of prompt words, a response result corresponding to the input information is generated and displayed.

2. The method according to claim 1, characterized in that, The scenario types include at least one of the following: game interaction, knowledge Q&A, device command, role-playing, and general chat.

3. The method according to claim 1, characterized in that, The fixed prompt words include at least one of the following: Intelligent agent personality profile prompts are used to limit at least one of the following response characteristics of the intelligent agent: Identity characteristics, personality traits, and response style; Behavioral motivation cue words are used to limit at least one of the following response characteristics of the agent: service goal, behavior orientation; The response constraint prompts are used to limit the rules that the agent must follow in generating the response result.

4. The method according to claim 1, characterized in that, The dynamic prompt words include at least one of the following: Scene behavior strategy prompts are used to limit at least one of the following response features of the intelligent agent: behavioral logic under the scene type corresponding to the input information, and interaction strategy under the scene type corresponding to the input information. Scene-specific dialogue style prompts are used to limit at least one of the following response characteristics of the agent: the way of expressing speech in the scene type corresponding to the input information, and the language habits in the scene type corresponding to the input information.

5. The method according to claim 1, characterized in that, The at least one fixed prompt word and the at least one dynamic prompt word have different hierarchical identifiers, wherein the hierarchical identifier is used to indicate the concatenation order position of the identified prompt word in the prompt word set; wherein, The position of the at least one fixed prompt word in the concatenation order of the prompt word set is before the position of the at least one dynamic prompt word in the concatenation order of the prompt word set.

6. The method according to claim 5, characterized in that, The hierarchical identifier corresponding to the at least one fixed prompt word is a fixed hierarchical level, and the hierarchical identifier corresponding to the at least one dynamic prompt word is a dynamic hierarchical level; wherein... The fixed hierarchy includes a first level and a second level, and the dynamic hierarchy includes a third level, a fourth level, and a fifth level.

7. The method according to claim 6, characterized in that, The prompts for the first and second levels are identified using Extensible Markup Language (XML) tags and heading tags, respectively. The prompts for the third, fourth, and fifth levels are identified by first-level, second-level, and third-level indentation in a markup language unordered list, respectively.

8. The method according to claim 1, characterized in that, The dynamic prompts, the fixed prompts, and the mapping relationships between each scene type and the corresponding dynamic prompts are pre-stored in a vector database in the form of a configuration table.

9. The method according to claim 8, characterized in that, Each dynamic prompt word in the configuration table includes at least one of the following fields: scene type label field, prompt word content field, and hierarchy identifier field; wherein... The scene type label field is used to store at least one scene type that has a mapping relationship with the corresponding dynamic prompt word, and the at least one scene type serves as the associated label of the dynamic prompt word.

10. The method according to claim 9, characterized in that, Determining the set of prompt words corresponding to the input information includes: Based on the scene type corresponding to the input information, a tag matching recall is performed on the configuration table to obtain a first recall result. The tag matching recall includes: recalling dynamic prompt words in the scene type tag field of the configuration table that include the scene type corresponding to the input information. Semantic recall is performed based on the vector similarity between the input information and the extended retrieval information to obtain a second recall result. The extended retrieval information is pre-stored in the configuration table and associated with the dynamic prompts in the configuration table. The extended retrieval information includes at least keywords and hypothetical query statements. The first recall result and the second recall result are combined to obtain the at least one dynamic prompt word.

11. The method according to claim 10, characterized in that, Each dynamic suggestion word in the configuration table also includes a search type field, which indicates the first matching mode or the second matching mode used by the corresponding dynamic suggestion word when performing the tag matching recall. In the first matching mode, the dynamic prompt word is recalled if the scene type corresponding to the input information matches any scene type label stored in the scene type label field of the dynamic prompt word; In the second matching mode, the dynamic prompt word is recalled if the scene type corresponding to the input information matches multiple scene type tags stored in the scene type tag field of the dynamic prompt word.

12. The method according to claim 10, characterized in that, The semantic recall based on the vector similarity between the input information and the extended retrieval information, to obtain a second recall result, includes: The input information and the keywords are used to calculate the sparse vector similarity to obtain the first similarity. The input information and the hypothetical query statement are compared using dense vector similarity calculation to obtain a second similarity. The first similarity and the second similarity are fused according to a preset weight ratio to obtain the target similarity; Based on the target similarity, semantically adapted dynamic prompt words are recalled from the configuration table as the second recall result.

13. The method according to claim 1, characterized in that, The method further includes: The interaction history data of the input information is obtained, and based on the interaction history data and the input information, it is determined whether the topic of the previous round continues. Based on the determination result, the scenario type corresponding to the input information is determined; wherein, Corresponding to the judgment result that the topic continues from the previous round, the scene type corresponding to the input information is determined based on the historical scene type corresponding to the interaction history data and the input information; If the judgment result is that the topic of the previous round was not continued, the scenario type corresponding to the input information is determined based on the input information.

14. An electronic device, characterized in that, include: A memory for storing instructions executed by one or more processors of the electronic device; as well as The processor is one of the processors of the electronic device, used to execute instructions stored in the memory to implement the method of any one of claims 1 to 13.

15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed, implement the method of any one of claims 1 to 13.

16. A computer program product, characterized in that, The computer program product includes instructions that, when executed, implement the method of any one of claims 1 to 13.