Large language model reply method, system, terminal and medium for automatically adjusting prompt words
Patent Information
- Application Number
- CN202311347571.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-17
- Publication Date
- 2026-09-29
- Estimated Expiration
- 2043-10-17
AI Technical Summary
[0003]一、没有考虑到来访者心理接受速度,因为大多数人需要逐渐建立信任关系才能有效的交流,因此直接给回复效果不佳,来访者会抵抗建议,接受意愿很低;
[0017]如上所述,本发明是一种自动调整提示词的大语言模型回复方法、系统、终端及介质,具有以下有益效果:本发明通过对每一轮对话初步判断当前阶段,并将当前阶段所对应的阶段提示词以及用户输入信息发送至大语言模型请求每轮对话的模型回复,再将所述用户输入信息、本轮对话的模型回复以及当前阶段所对应的判断提示词发送至所述大语言模型判断每轮对话的所属阶段,最后将每轮对话以及其所属阶段存入对话历史;本发明采用了多次分批请求判断阶段从而挑选合适的提词以适应多流派、多阶段等复杂的心理咨询手段,极大的提高了咨询回复的效果,使之更拟人,贴近真实心理咨询。且针对不同的心理咨询师可以更灵活的设置提词和阶段判断,最大化利用大语言模型提高心理咨询的效率,使得更多的来访者可以享受高质量心理咨询的服务。
Smart Images

Figure CN117407498B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence model responses, and in particular to a method, system, terminal, and medium for automatically adjusting prompt words in a large language model response. Background Technology
[0002] The response quality of current generative AI large language models is highly dependent on the content of the cue words. This is because the characteristics of large language models, such as word-by-word output and vector embedding, mean that the quality of the cue words significantly impacts the model's response. Currently, general-purpose large language models used in psychological counseling scenarios can generate simple counseling responses using simple, fixed cue words and basic contextual understanding. However, this response quality cannot compare to that of real psychological counseling for the following reasons:
[0003] First, the psychological acceptance speed of the visitor was not taken into account. Since most people need to gradually build trust before effective communication can take place, giving a direct response is not effective. The visitor will resist the suggestion and have a very low willingness to accept it.
[0004] Second, in practical application, psychological counseling is more about the client's cognitive exploration, which requires the client to keep answering deeper questions rather than the counselor giving standard answers directly. Although the prompts can be modified to keep asking deeper questions, this model will fall into a cycle that never ends, without skill output, practice and summary, and is not suitable as psychological counseling.
[0005] Third, if multiple stages are added to the prompt words at the same time, considering that all current large language models have a limit on the number of prompt words, and considering the input from the client, it is impossible to put prompt words for all stages of all counseling schools into the system. Therefore, fixed prompt words cannot achieve the ideal effect, and similar robots on the market that can modify prompt words as a psychological counseling application scenario cannot truly achieve the effect of psychological counseling. Summary of the Invention
[0006] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a method, system, terminal and medium for automatically adjusting prompt words in a large language model response, in order to solve the above-mentioned technical problems in the prior art.
[0007] To achieve the above and other related objectives, this invention provides a method for automatically adjusting prompt words in a large language model response. The method includes: upon receiving user input information, obtaining the current stage; sending the stage prompt word corresponding to the current stage and the user input information to the large language model to obtain the model response for the current round of dialogue; sending the user input information, the model response for the current round of dialogue, and the judgment prompt word corresponding to the current stage to the large language model to obtain the stage to which the current round of dialogue belongs; storing the stage to which the current round of dialogue belongs and the current round of dialogue in the dialogue history; wherein, the current round of dialogue includes: the user input information and the model response for the current round of dialogue.
[0008] In one embodiment of the present invention, each stage corresponds to a stage prompt word and a judgment prompt word for determining the stage to which it belongs; wherein, the stage prompt word includes: one or more steps of information acquisition prompt content required to complete the corresponding stage.
[0009] In one embodiment of the present invention, the judgment prompt includes: the name of the current stage and the name of the next stage.
[0010] In one embodiment of the present invention, the method for obtaining the current stage includes: determining whether the conditions for obtaining the most recent dialogue stage are met by checking the dialogue history; if they are met, the stage corresponding to the previous round of dialogue in the dialogue history is taken as the current stage; if they are not met, the default stage is taken as the current stage.
[0011] In one embodiment of the present invention, determining whether the conditions for obtaining the most recent dialogue stage are met by using the dialogue history includes: determining whether there was a previous dialogue in the dialogue history within a set time period; if there is, it is determined that the conditions for obtaining the most recent dialogue stage are met; if not, it is determined that the conditions for obtaining the most recent dialogue stage are not met.
[0012] In one embodiment of the present invention, the stage prompt word corresponding to the current stage and the user input information are concatenated and sent to the large language model.
[0013] In one embodiment of the present invention, the user input information, the model response of the current round of dialogue, and the judgment content corresponding to the current stage are concatenated and sent to the large language model.
[0014] To achieve the above and other related objectives, this invention provides a large language model response system for automatically adjusting prompt words. The system includes: a stage acquisition module, used to acquire the current stage upon receiving user input information; a model response module, connected to the stage acquisition module, used to send the stage prompt word corresponding to the current stage and the user input information to the large language model to obtain the model response for the current dialogue; a stage judgment module, connected to the model response module, used to send the user input information, the model response for the current dialogue, and the judgment prompt word corresponding to the current stage to the large language model to obtain the stage to which the current dialogue belongs; and a dialogue saving module, connected to the stage judgment module, used to save the stage to which the current dialogue belongs and the current dialogue into the dialogue history; wherein, the current dialogue includes: the user input information and the model response for the current dialogue.
[0015] To achieve the above and other related objectives, the present invention provides a large language model response terminal with automatic adjustment of prompt words, comprising: one or more memory units and one or more processor units; the one or more memory units are used to store computer programs; the one or more processor units are connected to the memory units and are used to run the computer programs to execute the large language model response method with automatic adjustment of prompt words.
[0016] To achieve the above and other related objectives, the present invention provides a computer-readable storage medium storing a computer program that is executed by one or more processors to perform the method.
[0017] As described above, this invention is a method, system, terminal, and medium for automatically adjusting prompts in a large language model response, offering the following advantages: This invention preliminarily determines the current stage of each round of dialogue and sends the corresponding stage prompt and user input information to the large language model to request a model response for each round. Then, it sends the user input information, the model response for this round, and the corresponding stage prompt to the large language model to determine the stage to which each round of dialogue belongs. Finally, each round of dialogue and its stage are stored in the dialogue history. This invention employs multiple batches of stage requests to select appropriate prompts, adapting to complex psychological counseling methods involving multiple schools of thought and stages, greatly improving the effectiveness of counseling responses, making them more human-like and closer to real psychological counseling. Furthermore, it allows for more flexible setting of prompts and stage judgments for different psychological counselors, maximizing the use of the large language model to improve the efficiency of psychological counseling, enabling more clients to enjoy high-quality psychological counseling services. Attached Figure Description
[0018] Figure 1 The diagram shown is a flowchart illustrating a large language model response method for automatically adjusting prompt words according to an embodiment of the present invention.
[0019] Figure 2 The diagram shown is a flowchart illustrating a large language model response method for automatically adjusting prompt words according to an embodiment of the present invention.
[0020] Figure 3 The diagram shown is a structural schematic of a large language model response system with automatic adjustment of prompt words according to an embodiment of the present invention.
[0021] Figure 4 The diagram shown is a structural schematic of a large language model response terminal with automatically adjusted prompt words according to an embodiment of the present invention. Detailed Implementation
[0022] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.
[0023] It should be noted that in the following description, reference is made to the accompanying drawings, which illustrate several embodiments of the invention. It should be understood that other embodiments may also be used, and changes in mechanical composition, structure, electrical system, and operation may be made without departing from the spirit and scope of the invention. The following detailed description should not be considered limiting, and the scope of the embodiments of the invention is defined only by the claims of the published patents. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. Spatially related terms, such as “upper,” “lower,” “left,” “right,” “below,” “below,” “lower part,” “above,” “upper part,” etc., may be used herein to illustrate the relationship between one element or feature shown in the figures and another element or feature.
[0024] Throughout this specification, when it is said that a part is "connected" to another part, this includes not only "direct connection" but also "indirect connection" by placing other elements in between. Furthermore, when it is said that a part "includes" a certain constituent element, unless otherwise stated otherwise, this does not exclude other constituent elements, but rather means that other constituent elements may also be included.
[0025] The terms "first," "second," and "third," etc., used herein are for the purpose of describing various parts, components, regions, layers, and / or segments, but are not limiting. These terms are used only to distinguish one part, component, region, layer, or segment from others. Therefore, the "first part," "component," "region," "layer," or "segment" described below may refer to a "second part," "component," "region," "layer," or "segment" without departing from the scope of this invention.
[0026] Furthermore, as used herein, the singular forms “a,” “an,” and “the” are intended to include the plural forms as well, unless the context indicates otherwise. It should be further understood that the terms “comprising,” “including,” indicate the presence of the stated feature, operation, element, component, item, kind, and / or group, but do not preclude the presence, occurrence, or addition of one or more other features, operations, elements, components, items, kinds, and / or groups. The terms “or” and “and / or” as used herein are interpreted as inclusive, or mean any one or any combination thereof. Thus, “A, B, or C” or “A, B, and / or C” means “any one of: A; B; C; A and B; A and C; B and C; A, B, and C.” Exceptions to this definition arise only when combinations of elements, functions, or operations are inherently mutually exclusive in some manner.
[0027] Large language models (MLMs) face several challenges in psychological counseling. First, they struggle to establish a strong human-computer relationship. Second, the limited input text capacity of MLMs results in inconsistent or disorganized responses. Therefore, applying MLMs to psychological counseling requires dynamically adjusting prompts based on content and stage to achieve the effectiveness of a truly professional counselor's approach. This involves building trust between the client and counselor, gradually exploring the issues, and ultimately providing a solution and a summary, thus achieving the desired therapeutic outcome.
[0028] Therefore, this invention provides a method, system, terminal, and medium for automatically adjusting prompts in a large language model response. It preliminarily determines the current stage of each round of dialogue and sends the corresponding stage prompt and user input information to the large language model to request a model response for each round. Then, it sends the user input information, the model response for this round, and the corresponding stage prompt to the large language model to determine the stage of each round of dialogue. Finally, it stores each round of dialogue and its stage in the dialogue history. This invention employs multiple batches of stage requests to select appropriate prompts to adapt to complex psychological counseling methods involving multiple schools of thought and multiple stages, greatly improving the effectiveness of counseling responses and making them more human-like and closer to real psychological counseling. Furthermore, it allows for more flexible setting of prompts and stage judgments for different counselors, maximizing the use of the large language model to improve the efficiency of psychological counseling and enabling more clients to enjoy high-quality psychological counseling services.
[0029] The present invention will now be described in detail with reference to the accompanying drawings, so that those skilled in the art can readily implement it. The present invention can be embodied in many different forms and is not limited to the embodiments described herein.
[0030] like Figure 1 This is a flowchart illustrating a large language model response method for automatically adjusting prompt words according to an embodiment of the present invention.
[0031] Before responding using the large language model, the psychological counseling process is divided into multiple consecutive stages, each with a corresponding stage cue word and a judgment cue word for identifying the stage. Examples of these consecutive stages include the five stages of cognitive behavioral therapy: "Background Information" (default), "Counseling Goals," "Exploration and Discussion," "Skills Training," and "Summary."
[0032] A complete psychological counseling session requires multiple rounds of dialogue, and the following methods are used to respond in each round;
[0033] The method includes:
[0034] Step S1: When user input information is received, obtain the current stage.
[0035] In detail, when a user sends in input information, a new round of dialogue begins, and the current stage is obtained.
[0036] In one embodiment, the method for obtaining the current stage includes:
[0037] Determine whether the conditions for obtaining the information in the most recent dialogue stage are met by analyzing the dialogue history.
[0038] If the conditions are met, the stage corresponding to the previous round of dialogue in the dialogue history will be taken as the current stage.
[0039] If it does not meet the requirements, the default stage will be used as the current stage. The default stage is one of a set of consecutive stages, preferably the first stage.
[0040] In one specific embodiment, determining whether the recent dialogue phase meets the acquisition criteria through dialogue history includes:
[0041] Determine if there is a previous conversation in the dialogue history within a set time period; the set time period can be any time period. If there is, it is determined that the condition for obtaining the most recent conversation phase is met.
[0042] If not, it is determined that the conditions for obtaining the most recent dialogue phase are not met.
[0043] In other words, the system determines the stage of the most recent conversation. If there is no stage or the time interval between the last conversation is too long, a default stage is specified. If there is a previous conversation within the set time, the stage corresponding to the previous conversation is used as the current stage. For example, if the last conversation was within one hour, the prompt words for that stage should be inherited as the prompt words for the next conversation. If it is more than one hour, the user may have forgotten the content of the previous conversation, and it is necessary to start from the default stage.
[0044] Step S2: Send the stage prompt words corresponding to the current stage and the user input information to the large language model to obtain the model response for this round of dialogue.
[0045] In one embodiment, after obtaining the current stage, the corresponding stage prompt word is obtained; each stage prompt word contains prompt words for all key information acquisition steps required to complete the stage; that is, if all the information of the current stage is not obtained, the dialogue of the current stage continues in the next round; if the required information is obtained, the dialogue of the next stage proceeds.
[0046] For example, in the "Background Information" stage, the prompts include: obtain the client's background, situation, and reasons for seeking consultation; after completion, set the goals for this consultation and confirm them with the client. In the "Goal Setting" stage, the prompts include: obtain the client's goals for this consultation; after completion, begin exploration and discussion.
[0047] In one embodiment, the stage prompt word corresponding to the current stage and the user input information are concatenated and sent to the large language model to obtain the model response for this round of dialogue. At this time, the large language model has already responded to the user.
[0048] Step S3: Send the user input information, the model response of this round of dialogue, and the judgment prompt words corresponding to the current stage to the large language model to obtain the stage to which the current round of dialogue belongs.
[0049] In one embodiment, the user input information, the model response of the current round of dialogue, and the judgment prompt word corresponding to the current stage are sent to the large language model to obtain a response indicating the stage to which the current round of dialogue belongs.
[0050] The judgment prompt is used to determine the stage to which the current round of dialogue belongs; the judgment prompt can correspond to the next stage or the current stage related to the current stage; or it can correspond to all stages.
[0051] Specifically, the prompt words can specify the next stage, limiting the range of responses from the large language model to achieve a steady progression and eliminate the possibility of random chatter; alternatively, they can be left unspecified, allowing the large language model to determine all stages automatically, as users may engage in divergent chatter, and the model's responses need to adapt accordingly. This judgment depends on the school of thought and stage of psychological counseling.
[0052] Preferably, the judgment prompts include: the name of the current stage and the name of the next stage. For example, for the "Background Information" stage, the judgment prompts include: Please determine whether the stage of the most recent round of dialogue is "Goal Setting" or "Exploration and Discussion". For the "Goal Setting" stage, the judgment prompts include: Please determine whether the stage of the most recent round of dialogue is "Goal Setting" or "Exploration and Discussion".
[0053] In one embodiment, the user input information, the model response of the current round of dialogue, and the judgment content corresponding to the current stage are concatenated and sent to the large language model, so that the large language model can reply with the stage to which the current dialogue belongs.
[0054] Step S4: Save the current stage of the conversation and the current conversation into the conversation history.
[0055] In detail, this round of dialogue includes: the user input information and the model's response to this round of dialogue.
[0056] In one embodiment, the current stage of the dialogue, the user input information, and the model response for this round of dialogue are stored in a database. When user input information for the next round is received, this stage can be used as the current stage to continue the dialogue.
[0057] To better describe the large language model response method that automatically adjusts prompt words, the following specific embodiments are provided for illustration;
[0058] Example 1: A large language model response method that automatically adjusts prompt words. Figure 2 This is a flowchart illustrating the large language model response method for automatically adjusting prompt words in this embodiment.
[0059] The method includes:
[0060] Multiple sets of prompts are provided for each stage, including stage prompts and decision-making stage prompts. The stage prompts include the name of the next step or parallel stage associated with that stage.
[0061] The responses for each round of dialogue include:
[0062] Step 1: Acquisition Phase;
[0063] Upon receiving user input, the system determines the stage of the most recent conversation. If a previous conversation existed and it occurred within a specified timeframe, the current stage is used, along with its prompts and user input, and sent to the general language model to receive a response. If no previous conversation existed, or the previous conversation lasted longer than a specified timeframe, the default stage is used, along with its prompts and user input, and sent to the general language model to receive a response.
[0064] Step 2: Formal Request Model;
[0065] The user input and model response for this round will be merged, and based on the current stage of the first step, the content judged in this stage will be added as the main prompt words. The data will then be packaged and sent to the large language model to obtain a response indicating the current stage.
[0066] Step 3: Stage assessment;
[0067] The stage judgment prompts obtained in the first step, along with the user input and the model response, are concatenated and sent to the general large language model to obtain a new stage, and the new stage and dialogue are saved.
[0068] When the user types again, new prompts are read based on the stage of the most recent conversation. This process, from the first to the third step, is repeated to dynamically adjust the prompts according to the user's conversation.
[0069] It should be noted that although two similar requests were sent to the large language model, the purposes of the two requests were different. The stage judgment words and stage judgment responses should not be stored in the dialogue history to avoid affecting subsequent responses. Furthermore, in the stage judgment, there is a small probability that the large language model's response is outside the specified stage range, possibly due to discontinuity or going off-topic. In such cases, the previous stage content can be retained or the system can return to the default stage. The method in this embodiment uses the native Chinese general language model, and its stage prompt words and stage judgment prompt words can be in Chinese; native English prompt words are in English. This setting improves the accuracy of the judgment and is independent of the response language; since the stage judgment belongs to a simple classification, a simpler model from the large language model can be used.
[0070] Example 1: A method for automatically adjusting prompt words in response using a general large language model in a psychological counseling scenario.
[0071] Assuming a new client is starting to use it, a relatively simple Cognitive Behavioral Therapy (CBP) is set up with 5 phases [“Background Information” (default), “Counseling Goals”, “Exploration and Discussion”, “Skills Training”, and “Summary”], the process is as follows:
[0072] 1. First round of dialogue;
[0073] a) The visitor first enters "User Input 1" and sends it. The system does not find any recent chat history, so it starts from the default stage "Background Information".
[0074] b) Read the prompt word "background information" obtained in step a for the default stage, concatenate it with the user input 1, send a request to the large language model, and get the model's reply 1;
[0075] c) Based on the user input 1 and model response 1 in this round, as well as the stage judgment prompt words of the "background information" reading stage, concatenate them and send a request to the large language model to obtain the stage 1. Then save the stage 1, user input 1, and model response 1 to the database.
[0076] 2. The next round of dialogue;
[0077] a) The visitor responded to the question in model response 1, which is to obtain user input 2. At the same time, the system finds the most recent dialogue stage (stage 1).
[0078] b) Read the prompt words from stage 1, concatenate them with user input 2, send a request to the large language model, and obtain the model's response 2;
[0079] c) Based on the user input 2 and model response 2 in this round, as well as the stage judgment prompt words of stage 1, concatenate them and send a request to the large language model to obtain stage 2. Then save stage 2, user input 2, and model response 2 to the database.
[0080] Similar to the principles of the above embodiments, the present invention provides a large language model response system that automatically adjusts prompt words.
[0081] The following specific embodiments are provided in conjunction with the accompanying drawings:
[0082] like Figure 3 This diagram illustrates the structure of a large language model response system that automatically adjusts prompt words according to an embodiment of the present invention.
[0083] The system includes:
[0084] Phase acquisition module 1 is used to acquire the current phase when user input information is received;
[0085] Model response module 2, connected to stage acquisition module 1, is used to send the stage prompt words corresponding to the current stage and user input information to the big language model in order to obtain the model response for this round of dialogue;
[0086] The stage judgment module 3 is connected to the model response module 2 and is used to send the user input information, the model response of the current round of dialogue and the judgment prompt words corresponding to the current stage to the big language model in order to obtain the stage to which the current round of dialogue belongs.
[0087] The dialogue saving module 4 is connected to the stage judgment module 3 and is used to save the stage to which the current dialogue belongs and the current dialogue into the dialogue history; wherein, the current dialogue includes: the user input information and the model response of the current dialogue.
[0088] It should be noted that, as should be understood Figure 3 The division of modules in the system embodiment is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, these units can be implemented entirely in software through processing element calls; they can be implemented entirely in hardware; or some units can be implemented by processing element calls to software, while others are implemented in hardware.
[0089] Since the implementation principle of this large language model response system with automatic adjustment of prompt words has been described in the foregoing embodiments, it will not be repeated here.
[0090] In one embodiment, each stage corresponds to a stage prompt word and a judgment prompt word for determining the stage to which it belongs; wherein, the stage prompt word includes: one or more steps of information acquisition prompts required to complete the corresponding stage.
[0091] In one embodiment, the judgment prompt includes: the name of the current stage and the name of the next stage.
[0092] In one embodiment, the method for obtaining the current stage includes: determining whether the conditions for obtaining the most recent dialogue stage are met through the dialogue history; if they are met, the stage corresponding to the previous round of dialogue in the dialogue history is taken as the current stage; if they are not met, the default stage is taken as the current stage.
[0093] In one embodiment, determining whether the conditions for obtaining the most recent dialogue stage are met by using the dialogue history includes: determining whether there was a previous dialogue within a set time period in the dialogue history; if there is, it is determined that the conditions for obtaining the most recent dialogue stage are met; if not, it is determined that the conditions for obtaining the most recent dialogue stage are not met.
[0094] In one embodiment, the user input information, the model response of the current round of dialogue, and the judgment content corresponding to the current stage are concatenated and sent to the large language model.
[0095] In one embodiment, the user input information, the model response of the current round of dialogue, and the judgment content corresponding to the current stage are concatenated and sent to the large language model.
[0096] like Figure 4 A schematic diagram of the structure of the large language model response terminal 10 with automatic adjustment of prompt words in an embodiment of the present invention is shown.
[0097] The large language model response terminal 40 with automatic adjustment of prompt words includes: a memory 41 and a processor 42. The memory 41 is used to store computer programs; the processor 42 runs the computer programs to implement, for example... Figure 1 The large language model response method that automatically adjusts prompt words.
[0098] Optionally, the number of memories 41 can be one or more, and the number of processors 42 can be one or more. Figure 4 Each example is taken as an instance.
[0099] Optionally, the processor 42 in the large language model response terminal 40 that automatically adjusts prompt words will follow the instructions as follows: Figure 1 The steps described involve loading one or more instructions corresponding to the process of an application into memory 41, and having the processor 42 run the application stored in the first memory 41, thereby achieving the following: Figure 1 The various functions in the large language model response method that automatically adjusts prompt words.
[0100] Optionally, the memory 41 may include, but is not limited to, high-speed random access memory and non-volatile memory. For example, one or more disk storage devices, flash memory devices, or other non-volatile solid-state storage devices; the processor 42 may include, but is not limited to, a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0101] Optionally, the processor 42 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0102] The present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed, implements as follows: Figure 1 The method for automatically adjusting prompts using a large language model is illustrated. The computer-readable storage medium may include, but is not limited to, floppy disks, optical disks, CD-ROMs (Read-Only Optical Disk Memory), magneto-optical disks, ROMs (Read-Only Memory), RAMs (Random Access Memory), EPROMs (Erasable Programmable Read-Only Memory), EEPROMs (Electrically Erasable Programmable Read-Only Memory), magnetic cards or optical cards, flash memory, or other types of media / machine-readable media suitable for storing machine-executable instructions. The computer-readable storage medium may be a product not connected to a computer device or a component used in a computer device.
[0103] In summary, the automatic prompt word adjustment system of the large language model of the present invention preliminarily judges the current stage of each round of dialogue, sends the stage prompt word corresponding to the current stage and user input information to the large language model to request a model response for each round of dialogue, then sends the user input information, the model response for this round of dialogue, and the judgment prompt word corresponding to the current stage to the large language model to determine the stage to which each round of dialogue belongs, and finally stores each round of dialogue and its stage in the dialogue history. The present invention employs multiple batches of stage judgment requests to select appropriate prompts to adapt to complex psychological counseling methods such as multiple schools of thought and multiple stages, greatly improving the effectiveness of counseling responses, making them more human-like and closer to real psychological counseling. Furthermore, it allows for more flexible setting of prompts and stage judgments for different psychological counselors, maximizing the use of the large language model to improve the efficiency of psychological counseling, enabling more clients to enjoy high-quality psychological counseling services. Therefore, the present invention effectively overcomes the various shortcomings of existing technologies and has high industrial application value.
[0104] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.
Claims
1. A method for automatically adjusting prompt words in a large language model response, characterized in that, Applied to the field of psychological counseling, the method includes: When user input is received, the current stage is obtained; Send the stage prompt words corresponding to the current stage and the user input information to the large language model to obtain the model's response for this round of dialogue; The user input information, the model response to the current round of dialogue, and the judgment prompt words corresponding to the current stage are sent to the large language model to obtain the stage to which the current round of dialogue belongs; wherein, the judgment prompt words are used to determine the stage to which the current round of dialogue belongs; the judgment prompt words can correspond to the next stage or the current stage associated with the current stage; the judgment prompt words can specify the next stage, which is used to limit the stage response range of the large language model; The current stage of the dialogue and the current dialogue itself are stored in the dialogue history; wherein, the current dialogue includes: the user input information and the model response of the current dialogue; Each stage corresponds to a stage prompt word and a judgment prompt word for determining the stage. The stage prompt word includes one or more information retrieval prompts required to complete the corresponding stage. The judgment prompt word includes the name of the current stage and the name of the next stage. The responses to the stage judgment words and stage judgments are not stored in the dialogue history. The methods for obtaining the current stage include: determining whether the conditions for obtaining the most recent dialogue stage are met through the dialogue history; if they are met, the stage corresponding to the previous round of dialogue in the dialogue history is taken as the current stage; if they are not met, the default stage is taken as the current stage. Determining whether the conditions for obtaining the most recent dialogue stage are met by checking the dialogue history includes: checking whether there was a previous dialogue within a set time period; if so, it is determined that the conditions for obtaining the most recent dialogue stage are met; if not, it is determined that the conditions for obtaining the most recent dialogue stage are not met.
2. The large language model response method for automatically adjusting prompt words as described in claim 1, characterized in that, The current stage prompt and user input information are concatenated and sent to the large language model.
3. The large language model response method for automatically adjusting prompt words as described in claim 1, characterized in that, The user input information, the model's response in this round of dialogue, and the judgment content corresponding to the current stage are concatenated and sent to the large language model.
4. A large language model response system that automatically adjusts prompt words, characterized in that, The system, applied in the field of psychological counseling, includes: The stage acquisition module is used to acquire the current stage when user input information is received; The model response module, connected to the stage acquisition module, is used to send the stage prompt words corresponding to the current stage and user input information to the large language model to obtain the model response for this round of dialogue. Each stage corresponds to a stage prompt word and a judgment prompt word for determining the stage to which it belongs. The stage prompt word includes prompts for obtaining one or more steps of information required to complete the corresponding stage. The judgment prompt word includes the name of the current stage and the name of the next stage. The judgment prompt word is used to determine the stage to which the current round of dialogue belongs. The judgment prompt word can correspond to the next stage or the current stage associated with that stage. The judgment prompt word can specify the next stage, thus limiting the stage response range of the large language model. The stage determination module, connected to the model response module, is used to send the user input information, the model response of the current round of dialogue, and the judgment prompt words corresponding to the current stage to the large language model to obtain the stage to which the current round of dialogue belongs. The method for obtaining the current stage includes: determining whether the dialogue history meets the conditions for obtaining the most recent dialogue stage; if it does, the stage corresponding to the previous round of dialogue in the dialogue history is taken as the current stage; if it does not, the default stage is taken as the current stage. Determining whether the dialogue history meets the conditions for obtaining the most recent dialogue stage includes: determining whether there is a previous round of dialogue in the dialogue history within a set time period; if there is, it is determined that the conditions for obtaining the most recent dialogue stage are met; if not, it is determined that the conditions for obtaining the most recent dialogue stage are not met. The dialogue saving module, connected to the stage judgment module, is used to save the stage to which the current dialogue belongs and the current dialogue into the dialogue history; wherein, the current dialogue includes: the user input information and the model response of the current dialogue; stage judgment words and stage judgment responses are not saved into the dialogue history.
5. A large language model response terminal that automatically adjusts prompt words, characterized in that, include: One or more memories and one or more processors; The one or more memories are used to store computer programs; The one or more processors are connected to the memory and are used to run the computer program to perform the method as described in any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that, The device contains a computer program that, when executed by one or more processors, performs the method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Government affair service field multi-strategy fusion dialogue method based on knowledge graph
CN116628172A
Intelligent consultation and public opinion processing system based on multi-modal large model
CN116821457A