Method and device for generating system prompt, equipment, medium and product

CN120994893APending Publication Date: 2025-11-21BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511240663.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-01
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

现有多智能体架构的对话系统在资源同步和风格统一性方面存在不足,难以兼顾多种用户需求,导致响应不一致且效率低下,无法适应复杂场景下的精细化交互需求。

Method used

通过获取用户查询信息,利用标签识别和匹配机制,从多个系统提示片段中精准召回符合需求的片段,生成系统提示,整合为最终指令以指导大语言模型响应。

Benefits of technology

提高了对话系统的响应准确性和效率,避免了模糊理解和风格割裂,提升了用户体验和交互质量。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994893A_ABST
    Figure CN120994893A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a method and device for generating a system prompt, equipment, a medium and a product. The method comprises the following steps: acquiring query information input by a user; the method further includes determining, based on the query information, a set of tags corresponding to the query information for the system prompt fragment. The method further includes determining, based on the set of tags, a set of system cue segments corresponding to the set of tags from a plurality of system cue segments for the model. The method also includes generating a system cue for the model based on the set of system cue segments. Through the method, user query and system prompt fragments can be accurately matched, system prompts meeting requirements can be generated, the accuracy and pertinence of model response are improved, and the processing efficiency of complex intentions is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments disclosed herein generally relate to the field of human-computer interaction, and specifically to methods, apparatus, devices, media, and products for generating system prompts. Background Technology

[0002] With the rapid development of computer technology, dialogue systems based on Large Language Models (LLMs) have been widely used in various scenarios, becoming an important means of human-computer interaction. These systems can handle diverse user needs, covering information retrieval, daily communication, task assistance, and other aspects, providing users with convenient and efficient services and driving continuous progress in the field of human-computer interaction.

[0003] In practical applications, multi-agent dialogue systems, with their specificity in handling different tasks, are gradually becoming the mainstream technology choice. By setting up different functional modules, these systems can respond to various user requests, playing an important role in improving interaction efficiency and optimizing user experience, and are widely used in customer service, intelligent assistants, education and training, and many other fields. Summary of the Invention

[0004] Embodiments of this disclosure provide a method, apparatus, device, medium, and product for generating system prompts.

[0005] According to a first aspect of this disclosure, a method for generating system prompts is provided. The method includes obtaining query information input by a user. The method further includes determining, based on the query information, a set of labels corresponding to the query information and for system prompt fragments. The method further includes determining, based on the set of labels, a set of system prompt fragments corresponding to the set of labels from multiple system prompt fragments for a model. The method also includes generating system prompts for a model based on the set of system prompt fragments.

[0006] According to a second aspect of this disclosure, an apparatus for generating system prompts is provided. The apparatus includes an acquisition module configured to acquire query information input by a user; a tag determination module configured to determine, based on the query information, a set of tags corresponding to the query information and for system prompt fragments; a system prompt fragment determination module configured to determine, based on the set of tags, a set of system prompt fragments corresponding to the set of tags from multiple system prompt fragments for a model; and a system prompt determination module configured to generate system prompts for a model based on the set of system prompt fragments.

[0007] In a third aspect of this disclosure, an electronic device is provided, including at least one processor; and a storage device for storing at least one program, which, when executed by the at least one processor, causes the at least one processor to implement the method according to the first aspect of this disclosure.

[0008] In a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the method according to a first aspect of this disclosure.

[0009] In a fifth aspect of this disclosure, a computer program product is provided. This computer program product includes a computer program that, when executed by a processor, implements the method according to a first aspect of this disclosure.

[0010] It should be understood that the content described in this section is not intended to limit the key or essential features of the embodiments of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0011] The above and other objects, features and advantages of this disclosure will become more apparent from the accompanying drawings, in which like reference numerals generally denote like parts.

[0012] Figure 1 The illustration shows an example environment in which some embodiments of the present disclosure can be applied;

[0013] Figure 2 The illustration shows a flowchart of a method for generating system prompts according to some embodiments of the present disclosure;

[0014] Figure 3 The illustration shows a schematic diagram of a large-model-based dialogue process according to some embodiments of the present disclosure;

[0015] Figure 4 The illustration shows a schematic diagram of the process of a tag-based model recall system for prompting fragments according to some embodiments of the present disclosure;

[0016] Figure 5 The illustration shows a schematic diagram of a process for determining labels using a scoring model according to some embodiments of the present disclosure;

[0017] Figure 6 The illustration shows a schematic diagram of determining a system prompt fragment based on query information according to some embodiments of the present disclosure;

[0018] Figure 7The illustration shows a schematic block diagram of an apparatus for generating system prompts according to some embodiments of the present disclosure;

[0019] Figure 8 A schematic block diagram of an example device suitable for implementing various embodiments of the present disclosure is illustrated. Detailed Implementation

[0020] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.

[0021] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0022] For example, upon receiving a user's proactive request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.

[0023] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0024] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0025] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0026] In the description of embodiments of this disclosure, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0027] As mentioned above, to meet the diverse interaction needs of users in different scenarios and improve the response quality and relevance of dialogue systems, existing technologies often adopt a multi-agent architecture based on LLM (Limited Least Mechanism). This type of solution sets up multiple agents with specific functions, corresponding to different task types such as casual conversation, translation, creation, knowledge acquisition, and mathematical calculation. Each agent is equipped with an independent system prompt (SP) to define the agent's identity, interaction rules, and customized information. When a user request is received, the system first determines the agent category to which the request belongs through intent recognition, and then calls the corresponding agent's SP to drive the LLM to generate a response, thereby adapting to the interaction needs in different scenarios.

[0028] However, existing multi-agent dialogue systems have many shortcomings in practical applications. For example, the Service Providers (SPs) of each agent generally contain a large amount of repetitive general information, which needs to be maintained separately in each agent, resulting in high synchronization costs during system iteration and difficulty in maintaining consistency. Simultaneously, when faced with users' cross-intent requests, a single agent's invocation struggles to accommodate multiple needs, easily leading to incomplete responses. Furthermore, the lack of unified coordination in the personas and styles of different agents can result in inconsistent response styles, and optimization of unsatisfactory responses needs to be performed separately in each agent, which is cumbersome and inefficient, making it difficult to adapt to the refined interaction needs of complex scenarios. Additionally, each agent maintains independent persona or style information; if not synchronized, the response effect is fragmented—for example, a casual chat agent might respond playfully and cutely, while a knowledge agent might respond professionally and rigorously, resulting in inconsistent styles. Furthermore, multilingual fixed responses for error scenarios (incorrect or unsatisfactory responses) are difficult to optimize uniformly, requiring repeated adjustments in each agent, leading to low efficiency. The lengthy and coarse-grained SP (Service Pack) format fails to meet the needs of various text types (such as jokes, short texts, email reports, and academic papers in creative writing), resulting in wasted resources and increased latency costs. At the same time, excessively long system prompts with too many sub-points reduce the ability of LLM (Low Length Model) commands to follow instructions, and the generated responses cannot fully follow all suitable sub-points.

[0029] To address the aforementioned problems and other potential issues, embodiments of this disclosure propose a method for generating system prompts. In these embodiments, a computing device acquires query information input by a user. Next, the computing device uses this query information to determine a corresponding set of tags. The computing device then uses these tags to determine a corresponding set of system prompt fragments from multiple system prompt fragments. Finally, the computing device uses this set of system prompt fragments to generate system prompts for a model. This method can accurately match user needs and efficiently generate system prompts that conform to the query, thereby improving the accuracy of the model's response.

[0030] The embodiments of this disclosure will now be described in further detail with reference to the accompanying drawings. Figure 1 A schematic diagram of an example environment 100 that can be applied according to some embodiments of the present disclosure is shown. In environment 100, computing device 102 can be used to process query information from user input.

[0031] Examples of computing device 102 include, but are not limited to, personal computers, server computers, handheld or laptop devices, mobile devices (such as mobile phones, personal digital assistants (PDAs), media players, etc.), multiprocessor systems, consumer electronics, minicomputers, mainframe computers, and distributed computing environments that include any of the above systems or devices.

[0032] like Figure 1As shown, the computing device 102 can analyze and process the query information 104 input by the user to obtain a set of tags 106 corresponding to the query information. In some embodiments of this disclosure, the query information 104 refers to the information expressing the user's needs input to the computing device 102. It can be understood that the user, through various input devices, such as keyboard, voice input, etc., transmits the task or information that the computing device 102 wants to complete or obtain to the computing device 102 in the form of query information. The query information is usually expressed as natural language text, but its form is not limited to this. It can also be text converted by automatic speech recognition, or instructions containing multimodal information. For example, the user may input "write an article about environmental protection" or "draw a landscape painting" on the client interface, which are all query information. Further, the computing device 102 can determine a set of tags 106 corresponding to the system prompt fragment based on the input query information 104. Specifically, this means that the query information 104 is parsed and reasoned through one or more model or strategy modules to output a set of tags 106 for recalling specific system prompt fragments. In the embodiments of this disclosure, the determination of the "set of labels" is not a simple classification of a single intent, but rather supports parallel output of multiple labels to handle complex cross-intent scenarios. Specifically, different labels correspond to different logical functional modules, which can encompass multiple dimensions such as task guidance, interaction style, output style, and supplementary persona. These logical functional modules are system prompt fragments formed by breaking down system prompts for multiple agents to achieve different functions.

[0033] For example, for the query "Write a short article about technological development in a humorous style", a set of tags can be identified that correspond to the "Knowledge Acquisition" sub-module in the interaction style module and the "Knowledge Acquisition" sub-module in the task guidance module.

[0034] Then, the computing device 102 uses this set of tags 106 to determine a set of system prompt fragments corresponding to this set of tags from multiple system prompt fragments 108 for the model. The multiple system prompt fragments 108 are obtained by splitting traditional multiple system prompts. In some embodiments, the multiple system prompt fragments 108 may include fixed fragments and dynamic fragments. Fixed fragments are mainly used to provide basic and general information, such as the identity settings of a large model. Dynamic fragments are flexibly recalled based on different sets of tags 106 to meet different types of specific needs. Each system prompt fragment is associated with a certain tag to indicate its applicable scenario and function. For example, there are interactive style system prompt fragments, which include multiple prompt fragments, one specifically for creation, and another suitable for casual conversation. Through tag matching, the computing device 102 can filter out the set that best meets the user's needs from a large number of system prompt fragments.

[0035] Furthermore, based on the determined set of system prompt fragments, system prompt 110 is generated for the model. System prompt 110 is the final instruction or information input into the model, integrating the content selected from the system prompt fragments to guide the model to respond according to the user's needs. For example, system prompt 110 may contain information such as output style requirements and creative style requirements. If the selected system prompt fragments contain information such as output style requirements and creative style requirements, the generated system prompt will integrate this information, enabling the model to generate a response that meets the requirements.

[0036] This approach allows for a more accurate understanding of user queries, avoiding issues such as ambiguity, misjudgment, and stylistic inconsistencies that may arise in traditional methods, thereby improving the efficiency and quality of system responses.

[0037] The above combination Figure 1 A schematic diagram of an example environment 100 that can be applied to some embodiments of the present disclosure is described below, in conjunction with... Figure 2 A flowchart describing a method for generating system prompts according to some embodiments of the present disclosure. Figure 2 Method 200 in the middle can be derived from Figure 1 The computing device 102 or any suitable device shall execute the command. It should be noted that... Figure 2 The steps shown are merely illustrative and should not be construed as limiting the scope of this disclosure. In different embodiments, the execution order of some steps may be adjusted, or some steps may be omitted, combined, or other additional steps may be introduced.

[0038] In box 202, computing device 102 can acquire query information input by the user. The query information can be natural language text entered by the user in the interactive interface of computing device 102, such as "Please help me generate a summary report," "Please translate the following sentence," or "Please help me calculate the square root of 5," or it can be information converted into text through speech recognition, image recognition, or other methods. In some embodiments, the query information may also include contextual information related to historical interactions, such as previous query information and system-generated responses. By acquiring complete query information, the system can more accurately understand the user's intent, enabling it to correctly determine tags and recall corresponding system prompts.

[0039] In box 204, computing device 102 determines a set of tags corresponding to the system prompt fragment based on query information. For ease of description, this set of tags may also be referred to as the first set of tags. In some embodiments, this step can be implemented by an intent recognition module. A second set of tags corresponding to the query information is determined by inputting the query information into the intent recognition module. If the second set of tags generated by the intent recognition module can be used to obtain the corresponding system prompt fragment, the first set of tags can be determined using the second set of tags.

[0040] In one example, the intent recognition module may include a label extraction model. In this case, the computing device 102 generates a second set of labels corresponding to the query information by inputting query information and contextual information related to the query information into the label extraction model. Specifically, the label extraction model may employ natural language understanding technology to identify multiple candidate labels related to the query information by extracting semantic features. For example, when a user inputs "Please check the exchange rate of USD to RMB today online," the label extraction model may output the label "Check online"; when the user further requests "And help me calculate how many RMB are equal to 100 USD," the model may simultaneously output the label "Mathematical calculation." It is understood that the second set of labels may include multiple labels, thereby supporting the recognition of multiple intents or cross-intents.

[0041] In some embodiments, the intent recognition module may include a scoring model. In this case, the computing device 102 can input query information, contextual information related to the query information, and multiple system prompt fragments into the scoring model to determine multiple scores for the multiple system prompt fragments. Each score in the multiple scores indicates the degree of relevance between the corresponding system prompt fragment and the query information. Further, the computing device 102 uses the obtained multiple scores to determine a second set of labels corresponding to a set of system prompt fragments from the multiple system prompt fragments, where the score corresponding to a label in the second set of labels is greater than a threshold score. Specifically, the scoring model comprehensively analyzes various types of input information, evaluates the fit between each system prompt fragment and the current query requirement through a preset algorithm logic, and forms a quantified score result; then, based on a set threshold standard, it filters out the parts with higher fit from all system prompt fragments and integrates the labels corresponding to these fragments into a second set of labels. For example, if a user inputs "Help me write a quicksort program using Python," the scoring model can calculate scores for candidate labels such as "code programming," "mathematical calculation," and "translation." If the score for "code programming" is significantly higher than a preset threshold, then this label will be selected as the target label. In this way, the scoring model can improve the accuracy of label recognition.

[0042] It is understandable that in some embodiments, where only the intent recognition module processes the query information, the second set of tags determined by the intent recognition module can be directly identified as the first set of tags for system prompt fragment recall. For example, when only the system intent recognition module processes user query information, when a user requests "translate 'hello' into English," the intent recognition module directly provides tags such as the output style "translation" and the task guidance "translation," and uses them as the first set of tags.

[0043] Furthermore, in some embodiments, the computing device 102 may further include a relevance matching module to jointly determine the final tags with the intent recognition module. In this case, the computing device 102 can use the relevance matching module to determine a third set of tags for the system prompt fragment corresponding to the query information. Then, the computing device 102 uses the second set of tags and the third set of tags to generate a first set of tags. Specifically, the relevance matching module can generate a third set of tags based on the semantic similarity between the query information and the description of the system prompt fragment. The computing device 102 can then combine the second set of tags and the third set of tags to finally determine the first set of tags, such as removing duplicate tags and retaining different tags. For example, if a user inputs "write a speech about artificial intelligence," the intent recognition module may output tags with an interaction style of "creation," while the relevance matching module outputs tags with an interaction style of "knowledge acquisition." Combining the two can form a more accurate set of tags.

[0044] In some embodiments, the computing device 102 may also incorporate a strategy module to enhance its ability to handle special requests. Query information is input into the strategy module to determine whether it outputs a fourth set of tags. The strategy module can be used to process query information of a predetermined type. If the strategy module can output a fourth set of tags, the second set of tags will not be used to obtain the corresponding system prompt fragment; instead, the fourth set of tags will be identified as the first set of tags. The strategy module may have a pre-set database to record high-frequency, regularized requests and their corresponding outputs. For example, when a user inputs "Please tell me today's date," the strategy module can directly output the tag for the interaction style "casual chat," thereby quickly completing tag recognition. The strategy module typically has a higher priority than the intent recognition module; therefore, when the strategy module outputs a fourth set of tags, the computing device 102 will identify this fourth set of tags as the first set of tags, while ignoring the second set of tags.

[0045] In box 206, based on the first set of labels, a set of system prompt fragments corresponding to a set of labels is determined from multiple system prompt fragments for the model. In some embodiments of this disclosure, the multiple system prompt fragments can be stored in a fragment library, which is organized in a modular structure to support rapid retrieval. Specifically, the fragment library can contain fixed function fragments, dynamic function fragments, and network result fragments. Fixed function fragments are used to define the basic attributes of the dialogue system. For example, fixed function fragments may include content such as "You are a professional and meticulous intelligent assistant" or "Please be polite and friendly." These fragments are applicable to different tasks and will therefore always be introduced. Dynamic function fragments are used to describe the logical functions that need to be implemented. For example, for the output style label "mathematical calculation," the corresponding dynamic function fragment may include "Please show the calculation process step by step and give the result at the end"; for the output style label "writing," the dynamic function fragment may include "Please write the article in a formal tone and keep it within 1000 words." Network result fragments are used to describe the function of obtaining network query results, that is, how to introduce external search results into the system prompts. For example, when a user queries the weather or exchange rate, the online results snippet might include "Please generate an answer based on the following search results: {external data}". In this way, large models can combine real-time data to provide more accurate answers.

[0046] In box 208, a system prompt for the model is generated based on a set of system prompt fragments. In some embodiments of this disclosure, system prompts can be obtained by combining a set of system prompt fragments. For example, computing device 102 first introduces fixed function fragments, then recalls dynamic function fragments according to tags, and finally adds network result fragments when necessary. By combining different fragments, a complete system prompt is finally formed, thereby guiding the large model to generate output that meets expectations. Specifically, the combination process can follow certain splicing rules. Rules may include order rules (fixed fragments take precedence, dynamic fragments take precedence), deduplication rules (eliminating duplicate content), and priority rules (retaining higher-priority fragments in case of conflict). For example, when both "translate" and "write" tags exist, the system prompt may include "Please translate the input into English and keep the writing style formal."

[0047] Furthermore, the system prompts and query information are input into the large language model to obtain a response to the query. Upon receiving the system prompts, the large language model will output according to the requirements therein, thereby achieving consistency with the user's intent.

[0048] The above combination Figure 2 Schematic diagrams illustrating example methods for simultaneous interpretation according to some embodiments of this disclosure are shown below. Figure 3 A schematic diagram illustrating an example of a dialogue translation scenario according to some embodiments of this disclosure.

[0049] Figure 3 A schematic diagram of a large-model-based dialogue process 300 according to some embodiments of the present disclosure is shown. Figure 3 The process 300 shown can be Figure 2 The specific implementation of process 200 in the middle. Figure 3 Method 300 in the middle can be made by Figure 1 The process is executed by computing device 102 or any suitable device. It is understood that process 300 is merely illustrative and not intended to limit the scope of embodiments of this disclosure. For example, in... Figure 3 The steps shown may be interchanged, some steps may be combined, omitted or modified, or additional steps not shown may be included.

[0050] like Figure 3As shown, computing device 102 first receives query information 302 input by the user. The user expects the large model to generate a response 310 that matches their needs based on the query information 302. In some embodiments of this disclosure, the original system prompts of each intelligent agent are modularly decomposed and divided into logical function modules. The logical function modules are further divided into fixed parts and dynamic parts. The fixed parts contain general content that does not change with the query information; the dynamic parts are adjusted according to the actual query information. The fixed parts may include a "robot (bot) basic persona module", the content of which may include the basic identity settings of the virtual assistant, such as name, function description, basic personality settings, etc. Such basic information needs to be loaded in all dialogue scenarios. Furthermore, the dynamic section allows configuration of modules such as interaction styles, task guidance, and output styles to control dialogue methods and capability boundaries. For example, in the interaction style module, the sub-module "Creation" can be configured as "An efficient writing expert, focused on providing high-quality writing solutions, ****"; the sub-module "Mathematical Calculation" can be configured as "A mathematics expert. Proficient in solving various mathematical problems, from basic arithmetic to complex calculations, ensuring comprehensive support for user inquiries, ***"; the sub-module "Code Programming" can be configured as "A programming expert. Can improve existing code, fix errors in code, and enhance code performance and reliability. You can also interpret code snippets and generate code based on user needs, ***"; and the sub-module "Casual Chat" can be configured as "An intelligent and adaptable personal assistant. The role provides support and assistance to users in a human-like manner, adjusting the dialogue style according to their needs and communication style, making users prefer talking to you, ***." Differentiated constraints and guidance are provided for different task scenarios.

[0051] Furthermore, the task guidance module will include several specific requirements for responding to specific questions, guiding the robot on how to comprehensively consider all aspects to arrive at the final answer. For example, in the "casual chat" submodule, the task guidance may require the bot to express specific information, engage in highly adaptive and non-judgmental communication, maintain friendly concern, and demonstrate high emotional intelligence in its responses. Specifically, the bot adjusts its dialogue style based on the user's behavior, using warm and friendly language to express support and care for the user, and understanding and responding to the user's needs. Everyday language and appropriate emojis can be used to enhance the intimacy of communication. In some embodiments, the dynamic section may also include various submodules of output styles, such as multiple sub-functions recorded in the output style rule base, including creation, casual chat, translation, etc. In addition, the dynamic section may also include tools such as bot character supplementation, bot capability description, fallback text, safety information, user variable information, clarification information, drawing, and network results modules, as shown in rule base 318.

[0052] After receiving the user query information 302, the computing device 102 will perform system fragment retrieval at point 304. During this process, the computing device provides the query information to the intent recognition module 312, the strategy module 314, and the relevance matching module 316. These three modules can operate independently or in combination, depending on the configuration of the computing device 102 and the application scenario.

[0053] In some embodiments, a set of tags corresponding to the query information can be directly determined by the strategy module 314. The strategy module is typically configured with a preset database that stores tag mappings for common or high-frequency query patterns. When the strategy module receives query information matching these patterns, it can directly output the tags. For example, when a user enters "What day of the week is today?", the strategy module can quickly output tags such as "Chat" for interaction style, "Chat" for output style, and "Chat" for task instruction; when a user enters "Calculate 2+2 for me", the strategy module can directly output tags such as "Mathematical Calculation" for interaction style, "Mathematical Calculation" for output style, and "Mathematical Calculation" for task instruction. This approach is efficient and fast-responding, making it suitable for handling high-frequency and standardized requests.

[0054] In some embodiments, the intent recognition module 312 can also determine the tags. The intent recognition module supports multi-tag recognition, enabling it to identify multiple intents within the query information and handle cross-intents and optional tags. Specifically, when a user inputs "search online and translate results," the intent recognition module can simultaneously identify multiple tags such as "online results," "translate" in the interaction style, "translate" in the output style, and "translate" in the task guidance. In some cases, the computing device 102 can also automatically add security information tags to ensure that the generated content meets requirements. For example, when a user inputs a request that may involve sensitive topics, the computing device 102 can attach a "security information" tag.

[0055] In some embodiments, the relevance matching module 316 can also be used to assist in label determination. The relevance matching module 316 performs semantic matching between the query information and the system prompt fragment corresponding to each candidate label, calculates the relevance score of each candidate label, and filters out labels with scores greater than or equal to a threshold. For example, when a user inputs "Help me write a speech about artificial intelligence," the relevance matching module may identify the interaction style "creation" label and assign it a high score. After these labels are merged with the label set identified by the intent recognition module, the computing device 102 integrates the results of both to obtain a more accurate final label set that better reflects the user's intent.

[0056] In some embodiments, the computing device 102 can first call the strategy module to quickly identify possible label groups. If the output of the strategy module is reliable, it can be directly used as the final label group. If the strategy module fails to provide a result, the computing device 102 calls the intent recognition module 312 and the relevance matching module 316. Furthermore, when all three are running simultaneously, the computing device 102 can also design a conflict resolution strategy, such as prioritizing the result output by the strategy module, and if not, taking the result from the relevance matching module, and then supplementing it with the intent recognition module. Through this multi-level filtering method, the computing device 102 can improve accuracy while ensuring efficiency.

[0057] In some embodiments, once the final tag group is determined, the computing device 102 recalls the corresponding system prompt fragments from the fragment library based on these tags. Then, at box 306, the system prompt fragments are assembled to generate a system prompt. For cases involving multiple tags, the computing device 102 can combine system prompt fragments from different modules into a final dynamic system prompt according to preset splicing rules. For example, for the "Task Guidance" module, if the user request involves the "Creation" and "Translation" sub-modules, the computing device 102 will recall the "Creation Guidance Fragment" and "Translation Guidance Fragment" respectively, and then splice them in sequence to form a complete task guidance prompt. To ensure the controllability and readability of the generated result, the computing device 102 can also simultaneously splice output style fragments and supplementary character information fragments, with values ​​of true / false. This indicates some information about the bot; to improve user understanding and self-service, the computing device 102 can selectively splice capability range fragments, indicating the bot's ability range and its structured display format.

[0058] The computing device then provides the assembled system prompts to the language model 308 for processing. The language model 308 then processes the query information and system prompts to generate a corresponding response.

[0059] The following is a description of each functional module in rule base 318. For the bot basic persona module, it includes basic persona information, such as the bot name and a brief introduction of the bot. This part is always included in the system prompts as basic information.

[0060] For dynamic modules in the rule base, such as those related to interaction style, the values ​​include the original agent name or sub-type, indicating the bot's interaction style and capabilities when handling such issues, as further described below. For knowledge acquisition, the corresponding description is: You are an all-around personal assistant. Your goal is to provide concise, comprehensive, informative, and user-friendly answers, and optimize these answers for reading on mobile devices. For writing, the corresponding description is: You are an efficient writing expert, focused on providing high-quality writing solutions. For mathematical calculations, the description is: You are a mathematically proficient expert, skilled at solving various mathematical problems, from basic arithmetic to complex calculations, ensuring comprehensive support for user inquiries. For code programming, the description is: You are a programming expert; you can improve existing code, fix errors, and enhance code performance and reliability. You can also interpret code snippets and generate code based on user needs. For casual conversation, the description is: You are an intelligent and adaptable personal assistant. Your role is to provide support and assistance to users in a human-like manner, adapting your approach based on their needs and communication styles, making users enjoy talking to you. The description for translation is: You are a professional translation master, and your task is to accurately translate the given text into the specified target language.

[0061] The description of task guidance includes the name of the original intelligent agent or its sub-type. This mainly focuses on the specific requirements for responding to specific questions, guiding the bot on how to comprehensively consider all aspects to arrive at the final answer. For example, task guidance for casual conversation and knowledge acquisition could include the following: Casual Conversation: 1. Human Identity: Include personal experiences and perspectives. 2. High Adaptability: Adjust your conversational style based on user behavior. If the user is more dominant, be more compliant; if the user is more compliant, be more guiding. 3. Friendliness: Use warm and friendly language to express support and care for the user, understand and respond to their needs, and provide support and comfort. Use everyday language and appropriate emojis to enhance the intimacy of communication. 4. Non-judgment: Provide a non-judgmental conversational environment. Avoid evaluating or criticizing the user's words and actions. Reduce social anxiety by creating a relaxed and comfortable communication atmosphere. 5. High Emotional Intelligence: Demonstrate empathy and understanding, providing a human-like interactive experience. Understand the user's feelings and provide appropriate responses and suggestions. Proactively show concern for the user's situation and emotions. Knowledge Acquisition - KnowledgeQA: For definition-based questions: Requires explanation of the meaning of terms, concepts, people, places, or events. (e.g., "What is...", "What does..." mean, any word or phrase). Provide all relevant definitions, using bullet points to list different aspects, including literal and implied meanings. Follow with examples, sub-sections, nuances, and related concepts (history, development, research, value) to aid comprehensive understanding. For explanation-based questions: Requires detailed analysis of processes, phenomena, or viewpoints. (e.g., "Why...", "How..."). Begin with a brief overview. Break down the explanation into logically ordered steps or sections. For Knowledge Acquisition - Advice: For practical advice-based questions: Requires actionable advice or recommendations. First, provide actionable advice. Provide clear step-by-step instructions. Include example scenarios to illustrate how the advice can be applied. For scenario analysis-based questions: Requires advice or analysis in a specific context. Briefly summarize the scenario. Provide step-by-step guidance. State the goals, challenges, and risks. Offer alternatives or contingency plans as appropriate. For comparative decision-making questions: This requires evaluating options or choosing from multiple options. First, summarize the best option or key differences. Use tables or lists for comparison. Clearly state your recommendations and the reasons behind them. Remain objective unless the user explicitly expresses a preference.

[0062] The output style module can include values ​​that can be the original agent name or a sub-type, primarily specifying the requirements for the output format of the response. For example, the output format for mathematical calculations is as follows: Mathematical Calculations: 1. Use structured headings such as "##Step 1", "##Step 2", "##Answer" to separate the solution steps in the output. Never begin your answer with any type of heading. 2. Present mathematical formulas or symbols in ** format or using code snippets. 3. Do not use any HyperText Markup Language (HTML) tags to represent mathematical formulas or symbols. For example, use "_n" instead of "". n 4. Use precise mathematical notation in the explanation, and prioritize concise expressions such as "if h>0" rather than lengthy expressions such as "if his positive" or "Positive'h'".

[0063] The description for the knowledge acquisition module is as follows: Immediately begin responding to user questions; do not explain your thought process or reasoning. Do not use any XML tags in your responses. Use bullet points to present detailed content when necessary, and bold headings or important keywords to facilitate user understanding. Use appropriate reduction to make the structure clearer and more readable, use standard punctuation, and use interrogative sentences sparingly. Avoid nested lists unless absolutely necessary.

[0064] The supplementary character information module includes a value of true or false. This indicates the bot's positioning (personal assistant), interaction method, creation team, base model information, version number, and other more detailed character information.

[0065] The description of the capability scope module includes values ​​of true and false. It indicates the range of capabilities the bot can handle and its structured presentation. For example, the following capability description can structurally display the bot's total capabilities, providing users with a clear, intuitive, and user-friendly experience of accessing its capability scope, rather than a lengthy text. For instance: The capability scope description includes: Academic Support and Exam Preparation: Q&A, concept explanation and exam preparation assistance, problem-solving (mathematics, programming, academic problems), document analysis and comprehension; Daily Life and Practical Advice: Emotional support and friendly chat, fun facts and humorous content, multilingual translation; Creative and Writing Tasks: Writing, editing and content creation, creative writing and storytelling, image processing, text extraction and visual creation; Voice Conversation: Voice messaging and phone calls: Users can communicate with ** via voice, but cannot send voice messages or make phone calls to other contacts through **; Information Retrieval and Research: Information search and media retrieval; Deep Thinking and Expert Insights: Critical analysis and expert insights.

[0066] The user variable information module describes variables with values ​​of true or false, such as the user's time, location, and language. This information helps provide accurate answers when dealing with time- and location-related questions. For example, in a user question like "Recommend local food," the current location is {{location_var}}, and the response should consider the cultural background and local information provided by {{location_var}}. The current time is {{time}}, and if the user question is time-sensitive, it should be consistent with {{time}}. The response should preferably use the user's specified language. If the user does not specify a language, the response should refer to the user's most frequently used language, {{memory_user_profile_language}}.

[0067] For the clarification information module, the description information takes the values ​​true or false. This guides the bot on how to clarify. When a user's question is unclear and you cannot answer it, remember to respond to the user's question before asking follow-up questions to confirm the information, and provide relevant options. Avoid excessive questioning, as this can annoy the user.

[0068] For the security information module, its description value is either true or false. When a user's question involves sensitive information, the boundaries of the security issue are clearly defined, guiding the bot not to answer sensitive topics, ensuring that all generated or summarized content conforms to standards, and not mentioning or responding to any unsafe content. Unsafe scenarios include: explicit or implicit mentions of eating disorders and extreme weight loss, promotion of specific body image and cosmetic surgery, and behaviors related to social prejudice.

[0069] For the online results module, its description information can include values ​​of true and false. When a user's question requires online searching to obtain the answer, adding this fragment makes the response more reliable.

[0070] For the drawing tool module, its description includes the values ​​true and false. When a user needs to invoke the drawing tool to generate an image, the tool description is provided to the large language model to facilitate the tool's invocation. An example is shown below:

[0071] code block

[0072]

[0073] The "fallback" section describes how to guide the user when the bot cannot answer their question or when the situation is beyond its capabilities. When you are unable to complete the task, please provide suitable possible solutions or pathways to guide the user to fulfill the request through other means; do not directly tell the user that you cannot do it.

[0074] For other modules, the description includes support for expansion to other modules, dynamically assembling corresponding system prompt fragments to form the final system prompt.

[0075] Understandably, compared to traditional fixed-prompt-word schemes, this disclosure can dynamically adjust system prompt fragments based on query differences, making the output of the large model more accurate, flexible, and controllable. Simultaneously, by introducing multiple label determination mechanisms (strategy, intent recognition, relevance matching), the computing device 102 can balance efficiency and accuracy, significantly improving the response quality and user experience of the large model dialogue system in various application scenarios.

[0076] Figure 4 A schematic diagram of a process 400 for recalling prompt fragments in a tag-based extraction model according to some embodiments of the present disclosure is shown. Figure 4 The process 400 shown can be generated by Figure 1 The process is executed by computing device 102 or any suitable device. It is understood that process 400 is merely illustrative and is not intended to limit the scope of embodiments of this disclosure.

[0077] like Figure 4 As shown, the user-input query information 402 and context information 404 can be simultaneously input into the tag extraction model 406. Context information 404 may include previous interaction records, such as queries made in previous conversations, responses generated by computing device 102, and conversation state parameters related to the current conversation. In some embodiments of this disclosure, by introducing context information, the tag extraction model 406 can be more accurate in recognizing user intent, avoiding bias caused by relying solely on a single query.

[0078] In some embodiments of this disclosure, the tag extraction model 406 can determine a set of tags 408 corresponding to the input query information 402 and context information 404. The tags 408 can be used to indicate the system prompt fragment to be used when generating system prompts. Furthermore, the tag extraction model 406 can not only recognize single tags but also multiple tags, supporting multi-tag recognition, cross-intent recognition, and optional tag output. For example, when a user queries "What are some good places to eat locally," the tag extraction model 406 can simultaneously output the interaction style: ["Knowledge Acquisition"], task guidance: ["Knowledge Acquisition"], output format: ["Knowledge Acquisition"], network connection result: true, and user variable information: true.

[0079] It is understood that the output of the tag extraction model 406 includes not only the tags themselves, but also values ​​specific to different modules. In some embodiments of this disclosure, for modules such as interaction style, task guidance, and output style, the output of the tag extraction model 406 can be a list containing multiple selectable values. The computing device 102 can select and use the corresponding system prompt fragment based on the values ​​in the list. Furthermore, for certain modules, the output of the tag extraction model 406 can be in the form of a Boolean value (true / false) to indicate whether the corresponding system prompt fragment needs to be enabled. For example, for the "network result module," if the output is true, a fragment of network result is added to the system prompt to guide the large model in generating a response containing network information; if the output is false, the fragment is omitted to avoid introducing irrelevant content.

[0080] For example, when a user inputs the query "What are some good places to eat locally", the tag extraction model 406, after combining the context information 404, may output a set of tags {"Interaction Style": Knowledge Acquisition}, and simultaneously mark the value of the "Network Result" module as true. At this time, the computing device 102 will recall the corresponding "Knowledge Acquisition" fragment and "Network Result" fragment from the interaction style module, and splice them together to generate the final system prompt, enabling the large model to generate output that better meets the user's needs.

[0081] Understandably, this differs from traditional multi-agent dialogue systems. Figure 4 The processing procedure 400 shown can uniformly identify cross-intents through the label extraction model within a single model framework, and effectively solve complex and diverse user query requests based on a flexible output mechanism of Boolean values ​​and list values, thereby improving the dialogue generation quality and adaptability of the large model in multiple scenarios and with multiple intents.

[0082] Figure 5 A schematic diagram of a process 500 for determining a label using a scoring model according to some embodiments of the present disclosure is shown. Figure 5 The process 500 shown can be performed by Figure 1 The process 500 is executed by the computing device 102 or any suitable device, or by the processor of an electronic device. It should be understood that process 500 is merely an illustrative example to illustrate how to filter and determine system prompt fragments by introducing a scoring model, and is not intended to limit the scope of this disclosure.

[0083] like Figure 5As shown, process 500 begins with multi-source information input, specifically including user-input query information 502, contextual information 504 related to the query information, and pre-set candidate tool / system prompt fragments 506. These three types of information are jointly input into the scoring model 508. This model is a pre-trained machine learning model capable of performing comprehensive semantic analysis and relevance evaluation on the input information. In some embodiments of this disclosure, the contextual information 504 may include previous input, responses generated by the computing device 102 in previous interactions, or dialogue state parameters related to the user's needs. The candidate tool / system prompt fragments 506 may be a collection of fragments from a pre-built system prompt fragment library, covering different types such as fixed function fragments, dynamic function fragments, and network result fragments.

[0084] Specifically, the core function of the scoring model 508 is to calculate a quantitative score for each candidate system prompt fragment 506. This score characterizes the degree of relevance between the corresponding system prompt fragment and the current query information 502. During the calculation process, the model integrates the core intent of the query information, previous interaction features in the context, and the functional attributes of the system prompt fragment, generating a numerical result reflecting the matching degree through a preset algorithm logic. For example, when a user enters the query "Write me a story about an owl and draw a cartoon," the scoring model 508 will evaluate multiple candidate system prompt fragments separately.

[0085] Furthermore, the scoring model 508 compares the scores of each system prompt segment with preset thresholds, selecting those with scores higher than the thresholds as valid recall results. For modules that support multiple segment combinations, such as interaction styles, task guidance, and output styles, the model can simultaneously recall multiple system prompt segments that meet the score criteria to adapt to users' complex needs. Figure 5 As shown in example output 512, after filtering, "drawing tools" was marked as "true" (indicating that the fragment was enabled), while tags such as "interaction style - narrative", "task guidance - creation + drawing", and "output format - combination of text and images" were also determined as valid results. These tags correspond one-to-one with the recalled system prompt fragments, and together they constitute a set of tags describing user needs.

[0086] Through the above process, the scoring model 508 can accurately filter and map system prompt fragments, ensuring a high degree of matching with the user's core needs and supporting parallel processing of multi-dimensional intents. This provides a reliable fragment basis and tag guidance for the generation of subsequent system prompts, effectively improving the response accuracy of the computing device 102 to complex queries.

[0087] Figure 6 A schematic diagram is shown illustrating how a system prompt fragment is determined based on query information according to some embodiments of the present disclosure. Figure 6 The process 600 shown can be performed by Figure 1 The execution may be carried out by the computing device 102 or any suitable device, or by the processor of an electronic device. It should be understood that... Figure 6 This is merely an illustrative example to illustrate how system prompts (SPs) for different query information are constructed in various functional scenarios, and is not intended to limit the scope of this disclosure.

[0088] like Figure 6 As shown, for different types of user queries, the computing device 102 can dynamically select functional modules related to the query from the fragment library based on tag extraction and fragment retrieval mechanisms, and then concatenate them to generate the final system prompt. Specifically, in a writing scenario, if the user inputs the query "Write a review of a food article in my own words, and comment on whether it can promote social influence," the computing device 102 first identifies that the query involves content creation and interaction requirements. The corresponding SPs include: bot basic persona, user variable information, network results, interaction style - creation, output style - creation, and task guidance - creation. Therefore, the generated system prompt can guide the large model to output text content that conforms to the creative intent and has a clear interaction style.

[0089] In a question-and-answer scenario, the user inputs the query "Who are you, and what can you do?" The computing device 102 uses tag recognition to determine that the query primarily involves identity description and capability demonstration. The corresponding SPs recalled include: basic bot persona, bot capability description, interaction style (casual conversation), output style (casual conversation), and task guidance (casual conversation). It can be understood that this type of SP ensures that the model includes necessary identity information and function introductions in its responses, while maintaining a consistent dialogue style.

[0090] In the drawing scenario, the user inputs the query "generate a cartoon image". The computing device 102, through tag extraction and fragment matching, determines that the core requirement is a drawing task. The corresponding SP is simplified to: a basic bot character design and drawing tool modules. In this way, the computing device 102 can call image generation-related tools or model interfaces to output results that satisfy the drawing request.

[0091] Understandable. Figure 6The different scenarios shown all demonstrate the flexibility and modularity of the SP construction mechanism proposed in this application. Fixed segments (such as the basic bot persona) ensure that the dialogue system maintains a consistent identity setting and basic style in different scenarios; while dynamic segments (such as interaction style, task guidance, network results, etc.) can be flexibly combined according to specific query intent, thereby achieving personalized response generation. In addition, by setting value options (such as "creation", "question and answer", "drawing", etc.) between different modules, the computing device 102 can achieve multi-scenario and multi-functional dialogue support under a unified architecture.

[0092] Figure 7 The illustration shows a schematic block diagram of an apparatus for simultaneous interpretation according to some embodiments of the present disclosure. The apparatus 700 can be implemented by software, hardware, or a combination of both. Figure 7 As shown, the device 700 includes an acquisition module 702, a tag determination module 704, a system prompt fragment determination module 706, and a system prompt determination module 708.

[0093] The acquisition module 702 is configured to acquire query information input by the user. The label determination module 704 is configured to determine a set of labels corresponding to the query information and for the system prompt fragments. The system prompt fragment determination module 706 is configured to determine a set of system prompt fragments corresponding to a set of labels from multiple system prompt fragments for the model. The system prompt determination module 708 is configured to generate system prompts for the model based on a set of system prompt fragments.

[0094] In some embodiments, one set of tags is a first set of tags, and the tag determination module 704 includes: a second set of tag determination module configured to determine a second set of tags corresponding to the query information by inputting query information into the intent recognition module; and a first determination module configured to determine the first set of tags based on the second set of tags in response to the second set of tags being available for obtaining the corresponding system prompt fragment.

[0095] In some embodiments, the intent recognition module includes a tag extraction model, and the second set of tag determination module includes a first tag generation module configured to generate a second set of tags corresponding to the query information by inputting query information and contextual information related to the query information into the tag extraction model.

[0096] In some embodiments, the intent recognition module includes a scoring model, and the second set of label determination module includes: an input module configured to determine multiple scores for the multiple system prompt fragments by inputting query information, contextual information related to the query information, and multiple system prompt fragments into the scoring model, each of the multiple scores indicating the degree of association between the corresponding system prompt fragment and the query information; and a second determination module configured to determine a second set of labels corresponding to a set of system prompt fragments among the multiple system prompt fragments based on the multiple scores, wherein the score corresponding to the label in the second set of labels is greater than a threshold score.

[0097] In some embodiments, the first determining module includes a third determining module configured to determine the second group of tags as the first group of tags.

[0098] In some embodiments, the first label determination module includes: a third label determination module, configured to determine a third set of labels for the system prompt fragment corresponding to the query information using a relevance matching module; and a fourth determination module, configured to determine a first set of labels based on a second set of labels and a third set of labels.

[0099] In some embodiments, the tag determination module 704 includes: a fourth group tag determination module, configured to input query information into a strategy module to determine whether the strategy module outputs a fourth group of tags, the strategy module being used to process query information of a predetermined type; a prompt fragment unavailable determination module, configured to determine that a second group of tags is unavailable for obtaining the corresponding system prompt fragment in response to the strategy module outputting a fourth group of tags; and a fourth determination module, configured to determine the fourth group of tags as a first group of tags.

[0100] In some embodiments, the system prompt fragment determination module 706 includes a recall module configured to recall a set of system prompt fragments corresponding to a set of tags from a fragment library storing multiple system prompt fragments based on a set of tags.

[0101] In some embodiments, the multiple system prompt fragments include fixed function fragments, dynamic function fragments, and network result fragments. Fixed function fragments are used to define the basic attributes of the dialogue system, dynamic function fragments are used to describe the logical functions that need to be implemented, and network result fragments are used to describe the function of obtaining network query results.

[0102] In some embodiments, the system prompt determination module 708 includes a combination module configured to obtain a system prompt by combining a set of system prompt fragments.

[0103] In some embodiments, the device 700 further includes a response module configured to input system prompts and query information into a language model to obtain a response to the query information.

[0104] Figure 7 The device 700 can be used to achieve the above-mentioned combination. Figures 1 to 6 For the sake of brevity, the process described will not be repeated here.

[0105] The division of modules or units in the embodiments of this disclosure is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods. Furthermore, the functional units in the disclosed embodiments may be integrated into one unit, exist as separate physical entities, or two or more units may be integrated into one unit. The integrated unit described above can be implemented in hardware or as a software functional unit.

[0106] Figure 8 A schematic block diagram of an example device 800 that can be used to implement embodiments of the present disclosure is shown. Figure 1 The computing device 102 can be implemented using device 800. As shown, device 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to computer program instructions stored in read-only memory (ROM) 802 or loaded from storage unit 808 into random access memory (RAM) 803. RAM 803 can also store various programs and data required for the operation of device 800. CPU 801, ROM 802, and RAM 803 are interconnected via bus 804. Input / output (I / O) interface 807 is also connected to bus 804.

[0107] Multiple components in device 800 are connected to I / O interface 807, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of monitors, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0108] The various processes and handling described above, such as method 200, can be executed by processing unit 801. For example, in some embodiments, method 200 can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by CPU 801, one or more actions of the example method 200 described above can be performed.

[0109] This disclosure can be a method, apparatus, system, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing various aspects of this disclosure.

[0110] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.

[0111] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0112] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.

[0113] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0114] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0115] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0116] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0117] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, and are not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical applications, or technical improvements to the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A method for generating system prompts, comprising: Obtain the query information entered by the user; Based on the query information, determine a set of tags corresponding to the system prompt fragment; Based on the set of labels, a set of system prompt fragments corresponding to the set of labels is determined from multiple system prompt fragments for the model; as well as Based on the set of system prompt fragments, system prompts for the model are generated.

2. The method according to claim 1, wherein the set of tags is a first set of tags, and determining a set of tags corresponding to the query information and for the system prompt fragment based on the query information includes: The second set of tags corresponding to the query information is determined by inputting the query information into the intent recognition module. as well as In response to the fact that the second set of tags can be used to obtain the corresponding system prompt fragment, the first set of tags is determined based on the second set of tags.

3. The method according to claim 2, wherein the intent recognition module includes a tag extraction model, and determining the second set of tags corresponding to the query information by inputting the query information into the intent recognition module includes: The second set of tags corresponding to the query information is generated by inputting the query information and contextual information related to the query information into the tag extraction model.

4. The method according to claim 2, wherein the intent recognition module includes a scoring model, and the step of determining the second set of tags corresponding to the query information by inputting the query information into the intent recognition module includes: By inputting the query information, context information related to the query information, and the multiple system prompt fragments into the scoring model, multiple scores are determined for the multiple system prompt fragments, and each of the multiple scores is used to indicate the degree of relevance between the corresponding system prompt fragment and the query information; as well as Based on the multiple scores, the second set of labels is determined to correspond to a set of system prompt fragments among the multiple system prompt fragments, and the score corresponding to the label in the second set of labels is greater than the threshold score.

5. The method of claim 2, wherein determining the first set of tags based on the second set of tags includes: The second group of labels is identified as the first group of labels.

6. The method of claim 2, wherein determining the first set of tags based on the second set of tags includes: The relevance matching module is used to determine the third set of tags for the system prompt fragment corresponding to the query information; as well as The first set of tags is determined based on the second set of tags and the third set of tags.

7. The method according to claim 2, wherein determining a set of tags corresponding to the query information based on the query information further includes: The query information is input into the strategy module to determine whether the strategy module outputs the fourth set of tags. The strategy module is used to process query information of a predetermined type. In response to the strategy module outputting the fourth set of tags, It has been determined that the second set of tags cannot be used to retrieve the corresponding system prompt fragment; as well as The fourth group of labels is identified as the first group of labels.

8. The method of claim 1, wherein determining a set of system prompt fragments corresponding to the set of tags from a plurality of system prompt fragments for the model based on the set of tags comprises: Based on the set of tags, the set of system prompt fragments corresponding to the set of tags are recalled from the fragment library that stores the plurality of system prompt fragments.

9. The method according to claim 1, wherein the plurality of system prompt fragments include fixed function fragments, dynamic function fragments, and network result fragments, wherein the fixed function fragments are used to define the basic attributes of the dialogue system, the dynamic function fragments are used to describe the logical functions to be implemented, and the network result fragments are used to describe the function of obtaining network query results.

10. The method of claim 1, wherein generating system prompts for the model based on the set of system prompt fragments comprises: The system prompt is obtained by combining the set of system prompt fragments.

11. The method according to claim 1, further comprising: The system prompt and the query information are input into the language model to obtain a response to the query information.

12. An apparatus for generating system prompts, comprising: The acquisition module is configured to acquire query information input by the user; The tag determination module is configured to determine a set of tags corresponding to the system prompt fragment based on the query information; The system prompt fragment determination module is configured to determine a set of system prompt fragments corresponding to the set of labels from multiple system prompt fragments for the model based on the set of labels. as well as The system prompt determination module is configured to generate system prompts for the model based on the set of system prompt fragments.

13. An electronic device, comprising: At least one processor; as well as A storage device for storing at least one program, which, when executed by the at least one processor, causes the at least one processor to implement the method according to any one of claims 1-11.

14. A computer-readable storage medium having a computer program stored thereon, the computer program implementing the method according to any one of claims 1-11 when executed by a processor.

15. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-11.