Prompt word generation method and device for large model, equipment, medium and program product
By dynamically segmenting and selecting system prompt words to generate streamlined prompt word information, the problem in existing technologies where the complexity of prompt words affects model response is solved, thereby improving the accuracy and efficiency of machine learning models.
Patent Information
- Application Number
- CN202510712977.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-05-29
AI Technical Summary
In the prior art, prompt words generated based on standard operating procedures may be too complex, affecting the reasoning and response accuracy of the machine learning model, especially when the background knowledge of the request is rich or complex.
By dynamically segmenting and selecting system prompt words, dynamic prompt word information for processing requests is generated, and the collaborative work of machine learning models and large models is used to determine and generate streamlined prompt word information.
It improves the response accuracy and efficiency of machine learning models, ensures that prompt word information matches the processing request, and enhances the processing capabilities of digital assistant-type functions.
Smart Images

Figure CN120632025A_ABST
Abstract
Description
Technical Field
[0001] Example embodiments of the present disclosure generally relate to the field of computers, and more particularly, to methods, devices, apparatuses, computer-readable storage media, and computer program products for generating prompt words for large models. Background Art
[0002] With the development of information technology, various terminal devices can provide a variety of services to people in their work and daily lives. Applications that provide these services can be deployed on these devices. These devices or applications can provide users with digital assistant-like functions to facilitate better user interaction. These digital assistant functions can use language models to enable question-and-answer interactions with users, meeting their various needs. For example, in information technology customer service scenarios, intelligent customer service assistants can use language models to answer questions users may have during use. Summary of the Invention
[0003] In a first aspect of the present disclosure, a method for generating prompt words for a large model is provided. The method includes: in response to receiving a processing request initiated to the large model, determining a system prompt word for the processing request, the system prompt word comprising multiple parts; determining at least one part from the multiple parts of the system prompt word based on at least one item of the processing request or contextual information associated with the processing request; and generating prompt word information for the processing request based on the at least one part, the prompt word information being provided to the large model to obtain a response to the processing request.
[0004] In a second aspect of the present disclosure, a device for generating prompt words for a large model is provided. The device includes: a first determination module configured to, in response to receiving a processing request initiated to the large model, determine a system prompt word for the processing request, wherein the system prompt word includes multiple parts; a second determination module configured to determine at least one part from the multiple parts of the system prompt word based on at least one item of the processing request or context information associated with the processing request; and a generation module configured to generate prompt word information for the processing request based on the at least one part, wherein the prompt word information is provided to the large model to obtain a response to the processing request.
[0005] In a third aspect of the present disclosure, an electronic device is provided. The device includes at least one processor; and at least one memory coupled to the at least one processor and storing instructions for execution by the at least one processor. When executed by the at least one processor, the instructions cause the device to perform the method of the first aspect.
[0006] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein computer-executable instructions are stored on the computer-readable storage medium, and the computer-executable instructions can be executed by a processor to implement the method of the first aspect.
[0007] In a fifth aspect of the present disclosure, a computer program product is provided. The program product includes computer-executable instructions, and the computer-executable instructions can be executed by a processor to implement the method of the first aspect.
[0008] It should be understood that the content described in this summary section is not intended to limit the key features or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:
[0010] Figure 1 A schematic diagram illustrating an example environment in which embodiments according to the present disclosure may be implemented;
[0011] Figure 2 A schematic diagram illustrating an example architecture for generating prompt word information according to some embodiments of the present disclosure is shown;
[0012] Figure 3 A schematic diagram illustrating an example architecture for determining at least one portion from a system prompt word according to some embodiments of the present disclosure is shown;
[0013] Figure 4 A flowchart illustrating an example process of generating prompt word information according to some embodiments of the present disclosure is shown;
[0014] Figure 5 A schematic structural block diagram of an example apparatus for generating prompt word information according to some embodiments of the present disclosure is shown; and
[0015] Figure 6 A block diagram of an electronic device capable of implementing various embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0016] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0017] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested 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 electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.
[0018] As an optional but non-limiting implementation, in response to receiving a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. Furthermore, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0019] It is understandable that the above notification and user authorization process are merely illustrative and do not limit the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0020] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) must comply with the requirements of relevant laws, regulations and relevant provisions.
[0021] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0022] It should be noted that the titles of any section / subsection provided herein are not limiting. Various embodiments are described throughout this document, and any type of embodiment may be included under any section / subsection. Furthermore, the embodiments described in any section / subsection may be combined in any manner with any other embodiments described in the same section / subsection and / or in different sections / subsections.
[0023] Herein, unless explicitly stated otherwise, executing a step “in response to A” does not mean executing the step immediately after “A” but may include one or more intermediate steps.
[0024] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may be included below. The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may be included below.
[0025] As used herein, the term "model" can learn the association between corresponding inputs and outputs from training data, so that after training is completed, corresponding outputs can be generated for given inputs. The generation of the model can be based on machine learning technology. Deep learning is a machine learning algorithm that processes inputs and provides corresponding outputs by using multiple layers of processing units. In this article, "model" may also be referred to as "machine learning model", "machine learning network" or "network", and these terms are used interchangeably in this article. A model can also include different types of processing units or networks.
[0026] Figure 1 A schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented is shown. In the example environment 100, a digital assistant 130 having an application 120 is installed in a terminal device 110. A user 140 can interact with the application 120 via the terminal device 110 and / or an attached device of the terminal device 110. Exemplarily, the application 120 can be a chat application (also known as an instant messaging application), a document application, an audio and video conferencing application, an email application, a task application, a calendar application, an objective and key result (OKR) application, and the like. It is understood that although Figure 1 Although a single application 120 is shown, multiple applications 120 may be installed on the terminal device 110. In some embodiments, the application 120 may include a multi-functional collaboration platform. For example, an office collaboration platform (also known as an office suite) can integrate multiple types of applications to facilitate office work, communication, and other activities. In the multi-functional collaboration platform, people can activate different business components as needed to complete corresponding information processing, sharing, and communication.
[0027] The digital assistant 130 may be configured to have an intelligent conversation function. Figure 1 In the example shown, digital assistant 130 can be configured as an independently running application, such as a web application or other type of application. In other examples, digital assistant 130 can be integrated into application 120.
[0028] The user can interact with the digital assistant 130 through the client. During the interaction process, the user inputs an interactive message, and the digital assistant 130 provides a reply message in response to the user input. Generally, the digital assistant 130 can support the user to input questions in a natural language, and perform tasks and provide replies based on the understanding of natural language input and logical reasoning ability. In some embodiments, depending on the configuration of the application 120, the interactive message with the application 120 may include multimodal messages, such as text messages (e.g., natural language text), voice messages, image messages, video messages, and the like.
[0029] exist Figure 1 In the environment 100, the terminal device 110 can present the user interface 150 of the application 120. The user interface 150 can include various interfaces that the application 120 can provide, such as an interaction interface between the user 140 and the digital assistant 130. The interaction interface can include, for example, a conversation window between the user 140 and the digital assistant 130.
[0030] In some embodiments, the terminal device 110 communicates with the server 160 to enable the supply of services to the application 120. The terminal device 110 can be any type of mobile terminal, fixed terminal or portable terminal, including a mobile phone, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a media computer, a multimedia tablet, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an e-book device, a gaming device or any combination thereof, including accessories and peripherals of these devices or any combination thereof. In some embodiments, the terminal device 110 can also support any type of interface for the user (such as a "wearable" circuit, etc.). The server 160 can be various types of computing systems / servers that can provide computing power, including but not limited to mainframes, edge computing nodes, computing devices in cloud environments, and the like.
[0031] It should be understood that the structure and function of each element in the environment 100 are described for exemplary purposes only and do not imply any limitation on the scope of the present disclosure. For example, the embodiments of the present disclosure can be applied to any suitable one or more applications, and are not limited to office suites.
[0032] As mentioned above, digital assistant functions can realize question-and-answer interaction with users through machine learning models (for example, language models) to meet various needs of users. In one solution, digital assistant functions can provide users (for example, operation and maintenance personnel) with services such as operation and maintenance information query with the help of machine learning models. In this solution, for different processing requests, digital assistant functions mostly generate prompt words based on standard operating procedures (SOPs) to complete processing requests using machine learning models.
[0033] When there is a large amount of background knowledge related to the request or the request is complex, the prompt words generated based on the SOP may be more complex. However, more complex prompt words may affect the reasoning or generation of the machine learning model. For example, irrelevant or useless information in the prompt words may affect the reasoning of the machine learning model. This may further cause the output of the machine learning model to fail to meet the requirements, affecting the performance of digital assistant functions in resolving processing requests.
[0034] In view of this, embodiments of the present disclosure provide a solution for generating prompt words for large models, which can be applied to large models. In this solution, in response to receiving a processing request initiated to the large model, a system prompt word for the processing request is determined, the system prompt word comprising multiple parts; at least one part is determined from the multiple parts of the system prompt word based on at least one item of the processing request or contextual information associated with the processing request; and based on the at least one part, prompt word information for the processing request is generated, and the prompt word information is provided to the large model to obtain a response to the processing request.
[0035] In an embodiment of the present disclosure, the system prompt word is divided into multiple parts. For a received processing request, one or more parts are determined from these parts to generate prompt word information. That is, the parts of the prompt word information provided to the machine learning model are not static but are determined based on the processing request. This is a dynamic prompt word generation solution. In this way, more accurate and concise prompt word information can be obtained while ensuring that the prompt word information corresponds to the processing request. Furthermore, the accuracy of the response to the processing request is improved.
[0036] Various example implementations of this solution are described in detail below with reference to the accompanying drawings.
[0037] Example Architecture
[0038] Figure 2 FIG. 2 shows a schematic diagram of an example architecture 200 for generating prompt word information according to some embodiments of the present disclosure. Figure 2As shown, the architecture 200 may be implemented or included at the terminal device 110 or the server 160. Alternatively, the architecture 200 may be implemented in collaboration between the server 160 and the terminal device 110. For illustrative purposes only, the following description will take the architecture 200 implemented at the server 160 as an example.
[0039] In some embodiments, if it is determined that a processing request initiated to a large model is received, a system prompt word for processing the request is determined. The large model may include but is not limited to a large language model or a multimodal model. The multimodal model can, for example, process inputs in multiple modalities such as text, images, or videos. Exemplarily, the processing request 210 can be a request input by the user 140, for example, a query for system operation and maintenance information or a query for system files. Exemplarily, the processing request 210 can be a query request input by the user. For example, the processing request 210 can be "query the weather in area A" input by the user. In some embodiments, the processing request 210 can be a request generated by the application 120 or other applications during the preceding processing process. Exemplarily, if during the preceding processing process, the application 120 detects that there is an abnormality in the execution of task A, a processing request 210 for querying the execution progress of task A is generated.
[0040] In some embodiments, the system prompt word (SP) includes multiple parts. Hereinafter, these parts may also be referred to as prompt word parts or SP parts. As an example, Figure 2 The first part 232-1, the second part 232-2, the third part 232-3 and the fourth part 232-4 of the system prompt word are shown, which are individually or collectively referred to as part 232. It should be understood that Figure 2 The number of parts 232 shown in FIG is merely exemplary and is not intended to be limiting. For example, the system prompt word can be implemented as a prompt word template, and the multiple parts can include multiple sub-templates. It will be understood that the embodiments described below with respect to prompt word templates and sub-templates can also be applied to system prompt words and parts of system prompt words.
[0041] In some embodiments, multiple candidate system prompt words for the large model can be set based on the different application scenarios of the large model. The multiple candidate system prompt words can be applied to different task types. Exemplarily, the multiple candidate system prompt words may include system prompt words corresponding to operation and maintenance scenarios or system prompt words corresponding to information query scenarios. If the server 160 receives a processing request initiated to the large model, it determines the task type indicated by the processing request. Based on the determined task type, the server 160 can select a system prompt word for the task type from the multiple candidate system prompt words. Exemplarily, the server 160 can determine the system prompt word corresponding to the task type indicated by the processing request 210 from a plurality of predetermined candidate system prompt words. For example, if the task type indicated by the processing request 210 is an operation and maintenance information query, the server 160 can determine the system prompt word corresponding to the operation and maintenance information query task from the multiple candidate system prompt words. In some embodiments, the server 160 can use a machine learning model to generate a corresponding system prompt word based on the task type indicated by the processing request 210.
[0042] In some embodiments, at least one portion is determined from multiple portions of the system prompt word based on at least one of the processing request or context information associated with the processing request. In some embodiments, server 160 determines at least one portion from multiple portions of the system prompt word based on at least one of the processing request 210 or context information 220 associated with the processing request 210. Context information 220 associated with processing request 210 may include information related to the task corresponding to processing request 210. For example, if processing request 210 is a weather query request, context information 220 may include location information and time information corresponding to the weather query request. If processing request 210 is an operation and maintenance request for a robot, context information 220 may include robot operation information. In some embodiments, processing request 210 may include only processing instructions. Server 160 may determine context information 220 from a predetermined data source (e.g., the internet, a designated database) based on the processing instructions and the task type corresponding to processing request 210. For example, if processing request 210 is a request to postpone task A, context information 220 is determined from a data source that includes operation and maintenance information related to task A. In some embodiments, the processing request 210 may include processing instructions and reference information related to the processing request 210, and the context information 220 may be determined based on the reference information. For example, if the processing request 210 is "I am in city A, query today's weather", the context information 220 may be determined based on "city A" and "today".
[0043] In some embodiments, for the determined system prompt word, the server 160 may obtain prompt word configuration information 230 for the system prompt word. The prompt word configuration information 230 may indicate corresponding prompt word generation logic for multiple parts of the system prompt word. The server 160 selects at least one part of the system prompt word that satisfies the prompt word generation logic based on at least one of the processing request or context information 220 and the corresponding prompt word generation logic. For example, Figure 2 The first prompt word generation logic 231-1, the second prompt word generation logic 231-2, the third prompt word generation logic 231-3 and the fourth prompt word generation logic 231-4 corresponding to the parts of the system prompt word are shown, which are individually or collectively referred to as the prompt word generation logic 231. It should be understood that Figure 2 The number of prompt word generation logics 231 shown in FIG. 1 is merely an exemplary number and is not intended to be limiting.
[0044] In some embodiments, the prompt word configuration information may include a configuration item for each prompt word part. Each configuration item may include the text of the corresponding prompt word part and prompt word generation logic.
[0045] In some embodiments, the prompt word generation logic may include a judgment condition corresponding to a certain part and the logical type of the part. The judgment condition may represent the logic that needs to be followed in the process of selecting at least one part from multiple parts of the system prompt word. For a certain part 232 in the system prompt word, if it is detected that at least one item in the processing request 210 or the context information 220 meets the judgment condition corresponding to the part, then it is determined that the prompt word generation logic of the part is satisfied. The part can be determined as one of the at least one part. Exemplarily, the judgment condition corresponding to a certain part is "whether task A is completed". If it can be determined that task A has been completed based on the processing request 210 and the context information 220, then it is determined that the judgment condition is met and the part is determined as one of the at least one part.
[0046] The logic type of a certain part in the system prompt word indicates the logic of generating prompt words based on this part. In some embodiments, the logic type of the prompt word generation logic can include a default inclusion type, a stop generation type, a continue generation type, or a branch selection type. In some embodiments, for the prompt word part of the default inclusion type, the prompt word configuration information can include the text or necessary text included by default in the prompt word information. In some embodiments, for the prompt word part of the stop generation type (i.e., stop type), the prompt word configuration information can include a tuple with three elements. This tuple can include the prompt word text that needs to be output when the judgment condition is established, and the corresponding stop label when the judgment condition is not established. In some embodiments, for the prompt word part of the continue generation type (i.e., continue type), the prompt word configuration information can include a tuple with three elements. This tuple can include the prompt word text that needs to be output when the judgment condition is established, and the corresponding jump label when the judgment condition is not established. In some embodiments, for the prompt word part of the branch selection type (i.e., if-else type), the prompt word configuration information can include a tuple with three elements. The tuple may include a judgment condition, a prompt word to be output when the judgment condition is met, and a prompt word to be output when the judgment condition is not met.
[0047] In some embodiments, for the first part 232-1 of the plurality of parts 232, the server 160 may determine state information 310 of the first prompt word generation logic corresponding to the first part 232-1 based on at least one of the processing request 210 or the context information 220 associated with the processing request 210. If the determined state information 310 matches the condition indicated by the first prompt word generation logic 231-1 corresponding to the first sub-template 232-1, the server 160 may select the first part 232-1 as one of the at least one part. Figure 2 As shown, the determined at least one portion may include a first portion 240-1 and a second portion 240-2, which may be individually or collectively referred to as at least one portion 240. It should be understood that Figure 2 The number of the at least one portion 240 shown in FIG. 1 is exemplary only and is not intended to be limiting.
[0048] Figure 3 FIG. 3 is a schematic diagram illustrating an example architecture 300 for determining at least one portion according to some embodiments of the present disclosure. Figure 3As shown, for a particular portion of the plurality of sections 232, server 160 determines, based on processing request 210 and / or context information 220, state information 310 corresponding to the prompt word generation logic of the sub-template. For example, if the condition indicated by the prompt word generation logic is "if task A has completed, output B," server 160 may obtain state information 310 related to the completion progress of task A based on processing request 210 and / or context information 220. Subsequently, server 160 determines whether state information 310 matches the condition indicated by the prompt word generation logic of the sub-section. If so, the sub-section is included as one of the at least one sections 240.
[0049] In some embodiments, a match between the status information 310 and the conditions indicated by the prompt word generation logic can indicate that the status information 310 meets the judgment conditions of the prompt word generation logic. In this case, the selected at least one portion 240 can be used to generate the prompt word. For example, if Task A has been completed, it indicates that the status information 310 matches the prompt word generation logic. If Task A is not completed, it indicates that the status information 310 does not match the prompt word generation logic, and the portion will be discarded.
[0050] In some embodiments, server 160 may determine state information 310 based solely on processing request 210, solely on context information 220, or based on both processing request 210 and context information 220. For example, if the task type corresponding to processing request 210 is an operation and maintenance request, server 160 may determine state information 310 based on processing request 210 and context information 220. In some embodiments, server 160 may determine a basis for determining state information 310 based on the task type corresponding to processing request 210.
[0051] In some embodiments, server 160 may determine state information 310 based on predetermined data extraction rules. For example, if context information 220 includes structured information, server 160 may determine information extraction rules for the first prompt word generation logic based on the data structure of the structured information. Subsequently, server 160 may determine state information 310 from the context information based on the information extraction rules. For example, if context information 220 includes tabular data, server 160 may determine state information 310 using information extraction rules for extracting tabular information.
[0052] In some embodiments, the server 160 may pre-determine different information extraction rules for different forms of structured information. As an example, the context information 220 may include JavaScript Object Notation (JSON) data. The server 160 may determine the status information 310 using the JSON data extraction rules. Table 1 shows an example of structured information. As shown in Table 1, the context information 220 may be presented in the form of structured information. In this case, the status information 310 in Table 1 may be extracted using information extraction rules. For example, for the context information 220 in Table 1, the information extraction rules may be for obtaining the field value of the "Basic Risk Information" field and the field value of the "Repair Suggestion" field. Furthermore, the server 160 may generate the status information 310 based on the extracted field values.
[0053] Table 1
[0054]
[0055]
[0056] In some embodiments, the server 160 may process the context information using a machine learning model to obtain state information 310. The machine learning model may be a language model (e.g., a large language model). The machine learning model may be the same as or different from the large model described above. For example, for a certain part of the plurality of parts 232, the server 160 may generate a prompt word for the machine learning model based on the processing request 210, the context information 220, and the prompt word generation logic for the part. Subsequently, the server 160 provides the prompt word to the machine learning model to obtain the output of the machine learning model. The server 160 determines the state information 310 based on the output of the machine learning model.
[0057] In some embodiments, the context information 220 processed by the machine learning model may be unstructured information (eg, text description, image, or audio, etc.). Table 2 is an example of the context information 220.
[0058] Table 2
[0059]
[0060] As shown in Table 2, context information 220 may be in the form of text descriptions. In this case, server 160 may process context information 220 using a machine learning model to obtain state information 310. In some embodiments, the machine learning model may be used to process context information 220 in structured or other forms. In some embodiments, the machine learning model may be a lightweight model to improve the efficiency of obtaining state information 310.
[0061] In some embodiments, during the process of selecting at least one portion 240 from the plurality of portions 232, the server 160 may sequentially determine, according to the order of the portions in the system prompt word, whether the conditions indicated by the prompt word generation logic of each portion match the corresponding state information 310. During the process of selecting at least one portion 240 from the plurality of portions 232, the server 160 may need to refer to the generation type of each portion. For example, for a portion of the plurality of portions 232, if the state information 310 is detected to match the conditions indicated by the prompt word generation logic of that portion, the server 160 may first determine the logical type indicated by the prompt word generation logic of that portion. If the logical type indicated by the prompt word generation logic of that portion is a stop generation type, the server 160 stops selecting portions from the plurality of portions. Subsequently, the server 160 generates at least one sub-prompt word based on the currently determined at least one portion 240 (e.g., that portion or another portion determined before it). If the logical type of the prompt word generation logic of that portion is a continue generation type, the server 160 may continue to select at least one portion of the at least one portion 240 from subsequent portions of the plurality of portions.
[0062] The above describes an example process for generating prompt word information. To more clearly understand the embodiments of the present disclosure, the following describes the types of various system prompt word components and the process for generating prompt word information, taking the task type "Work Order Delay Query Task" indicated by processing request 210 as an example. The following describes the generation of prompt word information with reference to Table 3, which provides an example of prompt word configuration information.
[0063] Table 3
[0064]
[0065] As shown in Table 3, a system prompt word can include multiple parts (e.g., parts 1-5). Accordingly, the prompt word configuration information 230 can include configuration items for these prompt word parts. Parts 1 and 4 are default inclusion type prompt word parts. For parts 1 and 4, the prompt word configuration information includes the corresponding text that needs to be included in the prompt word information 260. Part 2 is a system prompt word part of the stop generation type. For part 2, the prompt word configuration information includes the logical condition "Work Order Status == 'Complete'", the logical type "STOP", and the text to be output. During the process of selecting at least one part 240 from multiple parts 232, if a stop tag corresponding to a part of the stop generation type is detected, the server 160 can stop the selection operation. For part 2, if the judgment condition corresponding to the part is met (i.e., the status information 310 matches the corresponding prompt word generation logic), the server 160 selects the part as one of the at least one part 240 and stops selecting the parts after part 2. If the judgment condition is not met, the server 160 may judge the condition indicated by the subsequent part of the multiple parts to continue the operation of selecting at least one part 240.
[0066] Part 3 is a prompt word part of the continue generation type. For part 3, if the judgment condition corresponding to the part is met (i.e., work order extension == 'True'), the server 160 can take the part as one of the at least one part 240 and continue to perform the selection operation on the subsequent part of the part. If the judgment condition is not met, the server 160 can judge the subsequent part of the part in multiple parts to continue to perform the operation of the selection part. Part 4 is a branch selection type part. For part 4, if the judgment condition corresponding to the part is met (i.e., the user is NOT IN the handler list), the server 160 can add "inform the user that "non-work order handlers cannot apply for risk acceptability / exemption" to the prompt word information 260. If the judgment condition is not met, the server 160 can add "inform the user: "If necessary, you can ask the risk handler to click the operation control to perform the corresponding operation and fully explain the reason for the application to facilitate the evaluation to pass." to the prompt word information 260.
[0067] In some embodiments, server 160 may generate prompt word information 260 for processing request 210 based on at least one portion 240. For example, at least one portion 240 may be selected and concatenated based on the order of the at least one portion in the system prompt word to generate a template for processing request 210. Subsequently, prompt word information 260 is generated based on the template for processing request 210, context information 220, and processing request 210. In some embodiments, sub-prompt words corresponding to each portion 240 may be generated separately. Subsequently, at least one sub-prompt word is combined according to the order of the at least one portion in the system prompt word to determine prompt word information 260.
[0068] In one example, the extracted work order status is "Complete", that is, the status information 310 logically matches the prompt word generation corresponding to Part 2. In this case, based on the prompt word configuration information shown in Table 3, prompt word information 260 shown in Table 4 below can be generated.
[0069] Table 4
[0070]
[0071] In one example, the extracted work order status is "Complete," the work order extension is "True," and the user is in the reconciler list. This means that the status information 310 matches the prompt word generation logic corresponding to Section 3. In this case, based on the prompt word configuration information shown in Table 3, prompt word information 260 as shown in Table 5 below can be generated.
[0072] Table 5
[0073]
[0074] In one example, the extracted work order status is "Complete," the work order extension is "False," and the user is not in the list of handlers. This means that the status information 310 matches the prompt word generation logic corresponding to Section 4. In this case, based on the prompt word configuration information shown in Table 3, prompt word information 260 as shown in Table 6 below can be generated.
[0075] Table 6
[0076]
[0077]
[0078] Based on the determined at least one portion 240 (eg, the first portion 240-1 and the second portion 240-2), at least one sub-prompt word may be generated. Figure 2As shown, the generated sub-prompt words include a first sub-prompt word 250-1 and a second sub-prompt word 250-2, which can be individually or collectively referred to as sub-prompt words 250. It should be understood that Figure 2 The number of sub-prompt words 250 shown in FIG. 1 is exemplary only and is not intended to be limiting.
[0079] In some embodiments, server 160 may generate prompt word information 260 based on context information 220, the determined at least one sub-template, and corresponding prompt word generation logic. For example, if context information 220 includes "The person in charge of the task is A," and a portion includes "Send the exception information to the person in charge of task B," prompt word information 260 generated based on the portion and context information 220 may include "Send the exception information to A." In some embodiments, if context information 220 includes "The handling method for task B," prompt word information 260 generated based on the portion and context information 220 may include a corresponding instruction for executing the aforementioned handling method.
[0080] In some embodiments, the prompt word information 260 is provided to the large model to obtain a response to the processing request 210. For example, if the processing request 210 includes a weather query request, the server 160 generates corresponding prompt word information 260 based on the processing request. Subsequently, the server 160 provides the prompt word information to the large model to obtain the output of the large model (i.e., weather information).
[0081] Example Process
[0082] Figure 4 A flowchart illustrating an example process 400 for generating prompt word information according to some embodiments of the present disclosure is provided. Process 400 may be implemented or comprised of terminal device 110 or server 160. Alternatively, process 400 may be implemented collaboratively by server 160 and terminal device 110. For illustrative purposes only, the following description uses the example of process 400 being implemented on server 160.
[0083] like Figure 4 As shown, in block 410 , in response to receiving a processing request initiated to the large model, the server 160 determines a system prompt word for processing the request, where the system prompt word includes multiple parts.
[0084] In some embodiments, determining a system prompt word includes: in response to receiving a processing request, determining a task type indicated by the processing request; and based on the task type, selecting a system prompt word for the determined task type from a plurality of candidate system prompt words for different task types.
[0085] At block 420 , the server 160 determines at least one portion from among the plurality of portions of the system prompt word based at least on at least one of the processing request or context information associated with the processing request.
[0086] In some embodiments, determining at least one part from multiple parts includes: obtaining prompt word configuration information for the system prompt word, the prompt word configuration information indicating corresponding prompt word generation logic of the multiple parts; and selecting at least one part from the multiple parts whose prompt word generation logic is satisfied based on at least one of the processing request or context information.
[0087] In some embodiments, selecting at least one part from multiple parts whose prompt word generation logic is satisfied includes: determining, for a first part of the multiple parts, state information of a first prompt word generation logic for the first part based on at least one of a processing request or context information; and selecting the first part as one of the at least one part in response to the state information matching a condition indicated by the first prompt word generation logic.
[0088] In some embodiments, process 400 further includes: in response to the state information matching the condition indicated by the first prompt word generation logic, determining the logic type of the first prompt word generation logic; in response to the logic type being a stop generation type, generating prompt word information based on at least one part; and in response to the logic type being a continue generation type, determining the state information of the second prompt word generation logic for a second part subsequent to the first part in the multiple parts.
[0089] In some embodiments, the context information includes structured information, and determining the state information includes: determining an information extraction rule for the first prompt word generation logic based on a data structure of the structured information; and determining the state information from the context information based on the information extraction rule.
[0090] In some embodiments, determining status information includes: generating a prompt word for the machine learning model based on at least one of the context information or the processing request and a first prompt word generation logic; providing the prompt word for the machine learning model to the machine learning model to obtain an output of the machine learning model; and determining status information based on the output of the machine learning model.
[0091] In some embodiments, the logic type of the prompt word generation logic includes at least one of the following: a default inclusion type, a stop generation type, a continue generation type, or a branch selection type.
[0092] In block 430 , the server 160 generates prompt word information for the processing request based on the at least one portion, where the prompt word information is provided to the large model to obtain a response to the processing request.
[0093] In some embodiments, generating prompt word information includes: generating at least one sub-prompt word corresponding to the at least one part based on the at least one part; and determining the prompt word information by combining the at least one sub-prompt word according to the order of the at least one part in the system prompt word.
[0094] Example devices and equipment
[0095] The embodiments of the present disclosure also provide corresponding devices for implementing the above methods or processes. Figure 5 The following is a schematic block diagram of an example apparatus for generating prompt word information according to some embodiments of the present disclosure. Apparatus 500 may be implemented as or included in terminal device 110 or server 160. Alternatively, apparatus 500 may be implemented collaboratively by server 160 and terminal device 110. The various modules / components in apparatus 500 may be implemented by hardware, software, firmware, or any combination thereof. For illustrative purposes only, the following description takes apparatus 500 implemented in server 160 as an example.
[0096] like Figure 5 As shown, apparatus 500 includes a first determination module 510 configured to, in response to receiving a processing request initiated to a large model, determine a system prompt word for the processing request, wherein the system prompt word includes multiple parts. Apparatus 500 also includes a second determination module 520 configured to determine at least one part from the multiple parts of the system prompt word based on at least one item of the processing request or context information associated with the processing request. Apparatus 500 also includes a generation module 530 configured to generate prompt word information for the processing request based on the at least one part, wherein the prompt word information is provided to the large model to obtain a response to the processing request.
[0097] In some embodiments, the first determination module 510 is further configured to, in response to receiving the processing request, determine the task type indicated by the processing request; and based on the task type, select a system prompt word for the determined task type from a plurality of candidate system prompt words for different task types.
[0098] In some embodiments, the second determination module 520 is further configured to obtain prompt word configuration information for the system prompt word, the prompt word configuration information indicating corresponding prompt word generation logic of multiple parts; and based on at least one of the processing request or context information, select at least one part from the multiple parts whose prompt word generation logic is satisfied.
[0099] In some embodiments, the second determination module 520 is further configured to determine, for a first part of the multiple parts, state information of a first prompt word generation logic for the first part based on at least one of the processing request or context information; and select the first part as one of the at least one part in response to the state information matching a condition indicated by the first prompt word generation logic.
[0100] In some embodiments, the device 500 also includes a status information generation module, which is configured to determine the logic type of the first prompt word generation logic in response to the status information matching the condition indicated by the first prompt word generation logic; generate prompt word information based on at least one part in response to the logic type being a stop generation type; and determine the status information of the second prompt word generation logic for the second part subsequent to the first part in multiple parts in response to the logic type being a continue generation type.
[0101] In some embodiments, the status information generation module is further configured to generate prompt words for the machine learning model based on at least one of the context information or the processing request and the first prompt word generation logic; provide the prompt words for the machine learning model to the machine learning model to obtain the output of the machine learning model; and determine the status information based on the output of the machine learning model.
[0102] In some embodiments, the logic type of the prompt word generation logic includes at least one of the following: a default inclusion type, a stop generation type, a continue generation type, or a branch selection type.
[0103] In some embodiments, the second determination module is further configured so that the context information includes structured information, and determining the state information includes: determining information extraction rules for the first prompt word generation logic based on the data structure of the structured information; and determining the state information from the context information based on the information extraction rules.
[0104] In some embodiments, the generation module 530 is further configured to generate at least one sub-prompt word corresponding to the at least one part based on the at least one part; and determine the prompt word information by combining the at least one sub-prompt word according to the order of the at least one part in the system prompt word.
[0105] Figure 6 1 shows a block diagram of an electronic device 600 capable of implementing various embodiments of the present disclosure. Figure 6As shown, electronic device 600 is in the form of a general electronic device. Components of electronic device 600 may include, but are not limited to, one or more processors 610 or processing units, memory 620, storage device 630, one or more communication units 640, one or more input devices 650, and one or more output devices 660. Processor 610 may be a real or virtual processor and is capable of performing various processes according to programs stored in memory 620. In a multi-processor system, multiple processors execute computer-executable instructions in parallel to increase the parallel processing capabilities of electronic device 600.
[0106] The electronic device 600 typically includes a plurality of computer storage media. Such media can be any accessible media that can be obtained by the electronic device 600, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 620 can be a volatile memory (e.g., registers, cache, random access memory (RAM)), a non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 630 can be a removable or non-removable medium and can include a machine-readable medium, such as a flash drive, a disk, or any other medium that can be used to store information and / or data and can be accessed within the electronic device 600.
[0107] The electronic device 600 may further include additional removable / non-removable, volatile / non-volatile storage media. Figure 6 As shown in FIG, a magnetic disk drive for reading from or writing to a removable, non-volatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to a bus (not shown) by one or more data media interfaces. Memory 620 may include a computer program product 625 having one or more program modules configured to perform various methods or actions of various embodiments of the present disclosure.
[0108] The communication unit 640 enables communication with other electronic devices via a communication medium. Additionally, the functions of the components of the electronic device 600 can be implemented in a single computing cluster or multiple computing machines that can communicate via a communication connection. Thus, the electronic device 600 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.
[0109] The input device 650 may be one or more input devices, such as a mouse, keyboard, or trackball. The output device 660 may be one or more output devices, such as a display, a speaker, or a printer. The electronic device 600 may also communicate with one or more external devices (not shown) through the communication unit 640 as needed, such as a storage device, a display device, or the like, with one or more devices that allow a user to interact with the electronic device 600, or with any device that allows the electronic device 600 to communicate with one or more other electronic devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).
[0110] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.
[0111] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.
[0112] 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 device, thereby producing a machine, such that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0113] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are 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 implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0114] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple implementations of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part for a module, program segment or instruction, and a part for a module, program segment or instruction comprises one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.
[0115] While various implementations of the present disclosure have been described above, the foregoing description is intended to be illustrative, not exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is selected to best explain the principles of the implementations, their practical applications, or improvements to existing technologies, or to enable others skilled in the art to understand the various implementations disclosed herein.
Claims
1. A method for generating prompt words for a large model, comprising: In response to receiving a processing request initiated to the large model, determining a system prompt word for the processing request, the system prompt word including a plurality of parts; determining at least one portion from a plurality of portions of the system prompt word based at least on at least one of the processing request or context information associated with the processing request; as well as Based on the at least one part, prompt word information for the processing request is generated, and the prompt word information is provided to the large model to obtain a response to the processing request.
2. The method of claim 1 , wherein determining at least one portion from the plurality of portions comprises: Acquire prompt word configuration information for the system prompt word, wherein the prompt word configuration information indicates corresponding prompt word generation logic of the plurality of parts; as well as The at least one portion for which prompt word generation logic is satisfied is selected from the plurality of portions based on at least one of the processing request or the context information.
3. The method according to claim 2, wherein selecting the at least one portion for which prompt word generation logic is satisfied from the plurality of portions comprises: For a first part of the plurality of parts, determining, based on at least one of the processing request or the context information, state information of a first prompt word generation logic for the first portion; as well as In response to the state information matching a condition indicated by the first prompt word generation logic, the first part is selected as one of the at least one part.
4. The method according to claim 3, further comprising: In response to the state information matching a condition indicated by the first prompt word generation logic, determining a logic type of the first prompt word generation logic; In response to the logic type being a stop generation type, generating the prompt word information based on the at least one part; as well as In response to the logic type being a continue generation type, state information of a second prompt word generation logic for a second part subsequent to the first part among the multiple parts is determined.
5. The method according to claim 1, wherein generating the prompt word information comprises: Based on the at least one part, generating at least one sub-prompt word corresponding to the at least one part; as well as The prompt word information is determined by combining the at least one sub-prompt word according to the order of the at least one part in the system prompt word.
6. The method of claim 3, wherein the context information comprises structured information, and determining the state information comprises: Determining, based on the data structure of the structured information, an information extraction rule for the first prompt word generation logic; as well as The state information is determined from the context information based on the information extraction rule.
7. The method of claim 4, wherein determining the status information comprises: generating a prompt word for a machine learning model based on at least one of the context information or the processing request and the first prompt word generation logic; providing a prompt word for the machine learning model to the machine learning model to obtain an output of the machine learning model; and The state information is determined based on an output of the machine learning model.
8. The method according to claim 2, wherein the logic type of the prompt word generation logic includes at least one of the following: The default contains type, Stop generating types, Continue generating types, or Branch selection type.
9. The method according to claim 1, wherein determining the system prompt word comprises: In response to receiving the processing request, determining a task type indicated by the processing request; as well as Based on the task type, a system prompt word for the determined task type is selected from a plurality of candidate system prompt words for different task types.
10. A device for generating prompt words for a large model, comprising: A first determining module is configured to, in response to receiving a processing request initiated to the large model, determine a system prompt word for the processing request, wherein the system prompt word includes multiple parts; a second determining module configured to determine at least one portion from the plurality of portions of the system prompt word based at least on at least one of the processing request or context information associated with the processing request; as well as The generating module is configured to generate prompt word information for the processing request based on the at least one part, wherein the prompt word information is used to be provided to the large model to obtain a response to the processing request.
11. An electronic device comprising: at least one processor; as well as At least one memory coupled to the at least one processor and storing instructions for execution by the at least one processor, the instructions causing the electronic device to perform the method according to any one of claims 1 to 9 when executed by the at least one processor. 12 . A computer-readable storage medium having computer-executable instructions stored thereon, wherein the computer-executable instructions can be executed by a processor to implement the method according to claim 1 .
13. A computer program product comprising computer executable instructions, wherein the computer executable instructions, when executed by a processor, implement the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Image processing method and device and computer readable storage medium
CN117975497A
Business processing system, business processing method and related device
CN118152584A
Prompt word generation method and device, equipment, storage medium and program product
CN118820415A
Information processing method and device, equipment and storage medium
CN119003039A
Prompt word generation processing method and device, equipment and medium
CN119129605A