技术领域Technical field
本申请的实施例涉及自然语言处理技术领域,尤其涉及一种基于ChatGPT的智能问答方法、装置、设备及存储介质。Embodiments of the present application relate to the field of natural language processing technology, and in particular to an intelligent question and answer method, device, equipment and storage medium based on ChatGPT.
背景技术Background technique
ChatGPT是美国人工智能研究实验室OpenAI新推出的一种人工智能技术驱动的自然语言处理工具,使用了Transformer神经网络架构,也是GPT-3.5架构,这是一种用于处理序列数据的模型,拥有语言理解和文本生成能力,尤其是它会通过连接大量的语料库来训练模型,这些语料库包含了真实世界中的对话,使得ChatGPT能根据聊天的上下文进行互动的能力,做到与真正人类几乎无异的聊天场景进行交流。ChatGPT is a new natural language processing tool driven by artificial intelligence technology launched by OpenAI, an American artificial intelligence research laboratory. It uses the Transformer neural network architecture, which is also the GPT-3.5 architecture. This is a model for processing sequence data. It has Language understanding and text generation capabilities, in particular, it will train the model by connecting a large number of corpora that contain real-world conversations, giving ChatGPT the ability to interact according to the context of the chat, making it almost indistinguishable from real humans. Communicate in chat scenarios.
智能问答以一问一答形式,精确地定位网站用户所需要的提问知识,通过与网站用户进行交互,为网站用户提供个性化的信息服务。目前留学缴费系统接入ChatGPT的智能问答方法尚不完善,回答精度不高,且用户功能尚不完整,无法有效解决用户的需求。Intelligent Q&A uses a question-and-answer format to accurately locate the knowledge required by website users, and provides personalized information services to website users by interacting with them. At present, the intelligent question and answer method of the overseas study payment system connected to ChatGPT is not perfect, the answer accuracy is not high, and the user functions are not complete, and it cannot effectively solve the needs of users.
发明内容Contents of the invention
为了解决上述提到的技术问题,本申请的实施例提供了一种基于ChatGPT的智能问答方法、装置、设备及存储介质。In order to solve the above-mentioned technical problems, embodiments of the present application provide an intelligent question and answer method, device, equipment and storage medium based on ChatGPT.
第一方面,本申请的实施例提供了一种基于ChatGPT的智能问答方法,该方法包括:In the first aspect, embodiments of the present application provide an intelligent question and answer method based on ChatGPT, which method includes:
获取用户每一次输入的聊天内容;Obtain the chat content entered by the user each time;
将用户每一次新输入的聊天内容与之前所有的聊天内容一并发送至ChatGPT的系统模型;Each new chat content entered by the user is sent to the ChatGPT system model together with all previous chat content;
将用户反馈的ChatGPT的错误回复内容作为输入,训练模型;Use the ChatGPT error reply content fed back by users as input to train the model;
将系统模型变为ET模型,基于用户反馈的ChatGPT的错误回复内容不断训练,生成新的回复内容。The system model is changed into an ET model, and the error reply content of ChatGPT based on user feedback is continuously trained to generate new reply content.
在一种可能的实现方式中,所述将用户反馈的ChatGPT的错误回答内容作为输入,训练模型之前,还包括:In a possible implementation, using user feedback of wrong answers to ChatGPT as input, before training the model, also includes:
获取用户触发的图片操作需求;Obtain the image operation requirements triggered by the user;
将所述图片操作需求作为参数发送至ChatGPT后端,基于图片调用方法,生成图片渲染至聊天框中。The picture operation requirements are sent to the ChatGPT backend as parameters, and based on the picture calling method, the picture is generated and rendered into the chat box.
在一种可能的实现方式中,所述将用户反馈的ChatGPT的错误回答内容作为输入,训练模型之前,还包括:In a possible implementation, using user feedback of wrong answers to ChatGPT as input, before training the model, also includes:
获取用户触发的代码生成和程序语言需求;Obtain user-triggered code generation and programming language requirements;
将所述代码生成和程序语言需求作为参数发送至ChatGPT后端,基于用户输入的聊天内容生成对应的代码。The code generation and program language requirements are sent to the ChatGPT backend as parameters, and the corresponding code is generated based on the chat content input by the user.
在一种可能的实现方式中,所述将用户反馈的ChatGPT的错误回答内容作为输入,训练模型之前,还包括:In a possible implementation, using user feedback of wrong answers to ChatGPT as input, before training the model, also includes:
基于ChatGPT的内容审查工具标记所述用户输入的聊天内容中的预设敏感内容。The content review tool based on ChatGPT marks preset sensitive content in the chat content entered by the user.
在一种可能的实现方式中,所述将用户反馈的ChatGPT的错误回答内容作为输入,训练模型之前,还包括:In a possible implementation, using user feedback of wrong answers to ChatGPT as input, before training the model, also includes:
基于ChatGPT的stream模式建立websocket,实时输出ChatGPT的消息。Establish a websocket based on ChatGPT's stream mode and output ChatGPT messages in real time.
在一种可能的实现方式中,所述基于ChatGPT的stream模式建立websocket,实时输出ChatGPT的消息之前,还包括:In a possible implementation, the stream mode based on ChatGPT establishes a websocket, and before outputting the ChatGPT message in real time, it also includes:
设置模型参数确定回复内容数量以及最优回复内容数量。Set model parameters to determine the number of reply content and the optimal number of reply content.
在一种可能的实现方式中,所述将用户反馈的ChatGPT的错误回答内容作为输入包括:In a possible implementation, using the user's feedback of ChatGPT's incorrect answer content as input includes:
将所述用户反馈的ChatGPT的错误回答内容组装成json的格式输入系统模型。Assemble the incorrect answers to ChatGPT fed back by the users into a json format and input them into the system model.
第二方面,本申请的实施例提供了一种ChatGPT的智能问答装置,包括:In the second aspect, embodiments of the present application provide an intelligent question and answer device for ChatGPT, including:
获取模块,用于获取用户每一次输入的聊天内容;The acquisition module is used to obtain the chat content entered by the user each time;
发送模块,用于将用户每一次新输入的聊天内容与之前所有的聊天内容一并发送至ChatGPT的系统模型;The sending module is used to send each new chat content input by the user to the ChatGPT system model together with all previous chat content;
训练模块,用于将用户反馈的ChatGPT的错误回复内容作为输入,训练模型;The training module is used to use the user feedback ChatGPT error reply content as input to train the model;
生成模块,用于将系统模型变为ET模型,基于用户反馈的ChatGPT的错误回复内容不断训练,生成新的回复内容。The generation module is used to change the system model into an ET model. It is continuously trained based on the error reply content of ChatGPT fed back by users, and generates new reply content.
第三方面,本申请提供一种电子设备,采用如下技术方案:包括存储器和处理器,所述存储器上存储有计算机程序,所述处理器执行所述程序时实现如以上所述的方法。In a third aspect, the present application provides an electronic device, which adopts the following technical solution: including a memory and a processor, where a computer program is stored on the memory, and when the processor executes the program, the method as described above is implemented.
第四方面,本申请提供一种计算机可读存储介质,采用如下技术方案:存储有能够被处理器加载并执行上述任一种地图构建方法的计算机程序。In the fourth aspect, the present application provides a computer-readable storage medium that adopts the following technical solution: storing a computer program that can be loaded by a processor and execute any of the above map construction methods.
综上所述,本申请包括以下有益技术效果:To sum up, this application includes the following beneficial technical effects:
获取用户每一次输入的聊天内容;将用户每一次新输入的聊天内容与之前所有的聊天内容一并发送至ChatGPT的系统模型;将用户反馈的ChatGPT的错误回复内容作为输入,训练模型;将系统模型变为ET模型,基于用户反馈的ChatGPT的错误回复内容不断训练,生成新的回复内容。本申请能够将实现基于ChatGPT的智能问答对话,并根据用户反馈内容不断优化回复内容,精度更高,更有效地解决用户需求。Obtain the chat content entered by the user each time; send each new chat content entered by the user together with all previous chat content to the system model of ChatGPT; use the error reply content of ChatGPT fed back by the user as input to train the model; use the system The model becomes an ET model, and the error reply content of ChatGPT based on user feedback is continuously trained to generate new reply content. This application can realize intelligent question and answer dialogue based on ChatGPT, and continuously optimize the reply content based on user feedback content, with higher accuracy and more effective solution to user needs.
应当理解,发明内容部分中所描述的内容并非旨在限定本申请的实施例的关键或重要特征,亦非用于限制本申请的范围。本申请的其他特征将通过以下的描述变得容易理解。It should be understood that the content described in the Summary of the Invention is not intended to define key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the application will become readily apparent from the description below.
附图说明Description of drawings
结合附图并参考以下详细说明,本申请各实施例的上述和其他特征、优点及方面将变得更加明显。在附图中,相同或相似的附图标记表示相同或相似的元素。The above and other features, advantages and aspects of various embodiments of the present application will become more apparent with reference to the following detailed description taken in conjunction with the accompanying drawings. In the drawings, the same or similar reference numbers represent the same or similar elements.
图1示出了本申请实施例的基于ChatGPT的智能问答方法的流程图。Figure 1 shows a flow chart of the intelligent question and answer method based on ChatGPT according to the embodiment of the present application.
图2示出了本申请实施例的基于ChatGPT的智能问答装置的方框图。Figure 2 shows a block diagram of an intelligent question and answer device based on ChatGPT according to an embodiment of the present application.
图3示出了本申请实施例的一种电子设备的结构图。Figure 3 shows a structural diagram of an electronic device according to an embodiment of the present application.
具体实施方式Detailed ways
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
为了便于对本申请实施例的理解,首先对本申请实施例涉及的部分术语进行解释。In order to facilitate understanding of the embodiments of the present application, some terms involved in the embodiments of the present application are first explained.
ChatGPT,美国人工智能研究实验室OpenAI新推出的一种人工智能技术驱动的自然语言处理工具,使用了Transformer神经网络架构,也是GPT-3.5架构,这是一种用于处理序列数据的模型,拥有语言理解和文本生成能力,尤其是它会通过连接大量的语料库来训练模型,这些语料库包含了真实世界中的对话,使得ChatGPT具备上知天文下知地理,还能根据聊天的上下文进行互动的能力,做到与真正人类几乎无异的聊天场景进行交流。ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。 ChatGPT, a new artificial intelligence technology-driven natural language processing tool launched by OpenAI, an American artificial intelligence research laboratory, uses the Transformer neural network architecture, which is also the GPT-3.5 architecture. This is a model for processing sequence data and has Language understanding and text generation capabilities, in particular, it will train the model by connecting a large number of corpora. These corpora contain real-world conversations, giving ChatGPT the ability to understand astronomy and geography, and also have the ability to interact based on the context of the chat. , to communicate in a chatting scene that is almost the same as real humans. ChatGPT is not only a chat robot, it can also perform tasks such as email writing, video scripts, copywriting, translation, and coding.
智能问答,以一问一答形式,精确地定位网站用户所需要的提问知识,通过与网站用户进行交互,为网站用户提供个性化的信息服务。智能问答系统可以积累的无序语料信息,进行有序和科学地整理,并建立基于知识的分类模型;这些分类模型可以指导新增加的语料咨询和服务信息,节约人力资源,提高信息处理的自动性,方便了用户,提高了办事效率。Intelligent question and answer, in the form of one question and one answer, accurately locates the knowledge required by website users, and provides personalized information services to website users by interacting with website users. The intelligent question and answer system can organize the accumulated unordered corpus information in an orderly and scientific manner, and establish a knowledge-based classification model; these classification models can guide newly added corpus consultation and service information, save human resources, and improve the automation of information processing. It is convenient for users and improves work efficiency.
接下来对本申请实施例所涉及的应用场景进行介绍。需要说明的是,本申请实施例描述的应用场景为系统接入ChatGPT需求用户与ChatGPT进行智能问答的场景,仅仅是为了更加清楚地说明本申请实施例的技术方案,并不构成对本申请实施例提供的技术方案的限定。本申请实施例提供的基于ChatGPT的智能问答方法在其他智能问答的相似或类似的场景同样适用。Next, the application scenarios involved in the embodiments of this application are introduced. It should be noted that the application scenario described in the embodiments of this application is a scenario where the system accesses ChatGPT and requires users to conduct intelligent question and answer with ChatGPT. This is only to explain the technical solutions of the embodiments of this application more clearly, and does not constitute a review of the embodiments of this application. Limitations on the technical solutions provided. The ChatGPT-based intelligent question and answer method provided by the embodiments of this application is also applicable to other similar or similar scenarios of intelligent question and answer.
图1示出了本申请实施例的基于ChatGPT的智能问答方法的流程图,该方法基于Python程序运行实施,参见图1,该方法包括如下步骤:Figure 1 shows a flow chart of the intelligent question and answer method based on ChatGPT according to the embodiment of the present application. The method is implemented based on the Python program. See Figure 1. The method includes the following steps:
步骤101,获取用户每一次输入的聊天内容。Step 101: Obtain the chat content input by the user each time.
在本申请实施例中,在获取用户每一次输入的聊天内容之前首先基于ChatGPT获取一个ChatGPT的key。In the embodiment of this application, before obtaining the chat content input by the user each time, a ChatGPT key is first obtained based on ChatGPT.
具体地,点击Create new secret key(创建新的密钥),来获取自己的密钥。Specifically, click Create new secret key to obtain your own key.
进一步地,利用python下载需要的库OpenAI 。Further, use python to download the required library OpenAI.
具体地,基于pip下载,pip 是一个现代的、通用的 Python 包管理工具,提供了对Python 包的查找、下载、安装、卸载的功能。Specifically, based on pip download, pip is a modern and universal Python package management tool that provides the functions of finding, downloading, installing, and uninstalling Python packages.
其中,OpenAI 是一个人工智能的工具包,包括神经网络、遗传算法和有限状态机等。Among them, OpenAI is an artificial intelligence toolkit, including neural networks, genetic algorithms, finite state machines, etc.
进一步地,系统使用vue搭建一个聊天对话框。Furthermore, the system uses vue to build a chat dialog box.
其中,vue是一套用于构建用户界面的渐进式框架。Among them, vue is a progressive framework for building user interfaces.
步骤102,将用户每一次新输入的聊天内容与之前所有的聊天内容一并发送至ChatGPT的系统模型。Step 102: Send each new chat content input by the user to the system model of ChatGPT together with all previous chat content.
具体地,首先调用AI模型。Specifically, the AI model is first called.
其中,所调用的AI模型为text-davinci-003,text-davinci-003为最新的文本生成模型,通过处理更长的指令和创建更长形式的内容,生成更高质量的文字。Among them, the AI model called is text-davinci-003, which is the latest text generation model. It generates higher-quality text by processing longer instructions and creating longer-form content.
进一步地,输入每一次新输入的聊天内容与之前所有的聊天内容。Further, enter each newly entered chat content and all previous chat content.
在本申请实施例中,将每一次用户和ChatGPT的聊天内容保存下来,每次用户提出新的提问,将新的提问一起发送给ChatGPT,以使ChatGPT保持上下文的理解,修正反馈给用户的答案。In the embodiment of this application, the content of each chat between the user and ChatGPT is saved. Each time the user raises a new question, the new question is sent to ChatGPT together, so that ChatGPT maintains contextual understanding and corrects the answers fed back to the user. .
示例地,每一次新发送的聊天内容如下所示:For example, the content of each newly sent chat is as follows:
User:(用户之前的提问);AI:(ChatGPT之前的回答);User: (user’s previous question); AI: (ChatGPT’s previous answer);
User:(用户新的提问)。User: (new question from user).
进一步地,设置max_tokens和temperature的值。Further, set the values of max_tokens and temperature.
其中,max_tokens为完成过程中要生成的最大令牌数,即AI回复的最大单词数量,max_tokens的标记计数不能超过模型的上下文长度,大多数型号的上下文长度为2048个令牌,优选地,max_tokens设置为2048;temperature为要使用的采样温度,介于0和2之间,采样温度值越接近2将使输出越具随机性,而越接近于0将使输出越具针对性和确定性,优选地,temperature设置为0.7。Among them, max_tokens is the maximum number of tokens to be generated during the completion process, that is, the maximum number of words that the AI can reply to. The token count of max_tokens cannot exceed the context length of the model. The context length of most models is 2048 tokens. Preferably, max_tokens Set to 2048; temperature is the sampling temperature to be used, between 0 and 2. The closer the sampling temperature value is to 2, the more random the output will be, while the closer to 0 will be, the more targeted and deterministic the output will be. Preferably, temperature is set to 0.7.
进一步地,获取用户触发的图片操作需求,将图片操作需求作为参数发送至ChatGPT后端,基于图片调用方法,生成图片渲染至聊天框中。Further, the image operation requirements triggered by the user are obtained, the image operation requirements are sent as parameters to the ChatGPT backend, and based on the image calling method, the image is generated and rendered into the chat box.
具体地,聊天框里面增加图片操作功能,当用户选择图片操作功能时,将图片操作需求作为参数发送给ChatGPT后端,基于图片调用方法,创建一个新的图像生成模块,输入用户的图片操作需求,如:a white siamese cat(一只白色暹罗猫),然后设置输出数量n,示例地,设置为1,设定图片大小,示例地,设置为1024x1024,输出图片数据,将图片数据渲染至聊天框中。Specifically, a picture operation function is added to the chat box. When the user selects the picture operation function, the picture operation requirements are sent as parameters to the ChatGPT backend. Based on the picture calling method, a new image generation module is created and the user's picture operation requirements are input. , such as: a white siamese cat (a white Siamese cat), then set the output number n, for example, set it to 1, set the image size, for example, set it to 1024x1024, output the image data, and render the image data to in the chat box.
其中,图片操作功能包括但不限于图片生成或者图片优化。Among them, the image operation functions include but are not limited to image generation or image optimization.
进一步地,获取用户触发的代码生成和程序语言需求,将代码生成和程序语言需求作为参数发送至ChatGPT后端,基于用户输入的聊天内容生成对应的代码。Further, the code generation and programming language requirements triggered by the user are obtained, the code generation and programming language requirements are sent as parameters to the ChatGPT backend, and the corresponding code is generated based on the chat content input by the user.
具体地,聊天框增加代码生成和程序语言按钮,当用户触发代码生成和程序语言按钮时,将代码生成和程序语言需求作为参数发送至ChatGPT后端作为参数发送给后端,创建一个新的代码生成模块,调用新的AI模型code-davinci-002,temperature设置为0.7,输入用户的聊天内容,生成对应的代码(用户选择的程序语言),使得ChatGPT能够更准确地回答用户的问题。Specifically, the chat box adds code generation and programming language buttons. When the user triggers the code generation and programming language buttons, the code generation and programming language requirements are sent to the ChatGPT backend as parameters and a new code is created. The generation module calls the new AI model code-davinci-002, sets the temperature to 0.7, inputs the user's chat content, and generates the corresponding code (the programming language selected by the user), so that ChatGPT can answer the user's questions more accurately.
进一步地,基于ChatGPT的内容审查工具标记所述用户输入的聊天内容中的预设敏感内容。Further, the content review tool based on ChatGPT marks preset sensitive content in the chat content input by the user.
其中,预设敏感内容包括涵盖色情,暴力等内容的词条、语句等。Among them, the default sensitive content includes entries, sentences, etc. covering pornography, violence, etc.
示例地,使用ChatGPT中的内容审查工具Moderation对用户输入的聊天内容进行审查,用户输入聊天内容时,Moderation对其进行自动审查。、For example, the content review tool Moderation in ChatGPT is used to review the chat content entered by the user. When the user enters the chat content, Moderation automatically reviews it. ,
进一步地,设置模型参数确定回复内容数量以及最优回复内容数量。Further, set model parameters to determine the number of reply contents and the optimal number of reply contents.
示例地,参数n设置为3,参数best_of设置为1,每个用户提出的问题,ChatGPT均可以返回三个答案,并选择一个最优的答案。For example, the parameter n is set to 3, and the parameter best_of is set to 1. For each question raised by the user, ChatGPT can return three answers and select the optimal answer.
进一步地,基于ChatGPT的stream模式建立websocket,实时输出ChatGPT的消息。Furthermore, a websocket is established based on the stream mode of ChatGPT to output ChatGPT messages in real time.
其中,ChatGPT的stream模式是一个前端服务,以 websocket 的方式实时接收前端消息并返回ChatGPT的消息。Among them, the stream mode of ChatGPT is a front-end service that receives front-end messages in real time via websocket and returns ChatGPT messages.
步骤103,将用户反馈的ChatGPT的错误回复内容作为输入,训练模型。Step 103: Use the ChatGPT error reply content fed back by users as input to train the model.
具体地,首先ChatGPT每次返回回答内容后,对话框最后会显示一个选项,以便用户确认回答是否满意,若用户选择不满意,则会提示用户输入正确的答案,然后记录至数据库。Specifically, first, every time ChatGPT returns the answer content, the dialog box will display an option at the end so that the user can confirm whether the answer is satisfactory. If the user chooses not to be satisfied, the user will be prompted to enter the correct answer, which will then be recorded in the database.
进一步地,将用户反馈的ChatGPT的错误回答内容组装成json的格式输入系统模型。Furthermore, the incorrect answers to ChatGPT fed back by users are assembled into a json format input system model.
其中,json(JavaScript Object Notation)是一种轻量级的数据交换格式,用来存储简单的数据结构和对象的文件。Among them, json (JavaScript Object Notation) is a lightweight data exchange format used to store simple data structures and object files.
具体地,输入用户反馈的ChatGPT的错误回答,训练模型,输出用户输出的正确的答案,使模型进行调整。Specifically, the wrong answers to ChatGPT fed back by users are input, the model is trained, and the correct answers output by users are output, so that the model can be adjusted.
步骤104,将系统模型变为ET模型,基于用户反馈的ChatGPT的错误回复内容不断训练,生成新的回复内容。Step 104: Change the system model into an ET model, continuously train the error reply content of ChatGPT based on user feedback, and generate new reply content.
其中,ET模型是通过减少系统调用来达到提高并行效率的模型。Among them, the ET model is a model that improves parallel efficiency by reducing system calls.
具体地,训练完成后创建一个微调模型,通过suffix自定义模型名称为ET model,即ET模型,后续模型可以自行可以不断地训练和修正,生成新的回复内容。Specifically, after the training is completed, a fine-tuned model is created, and the name of the customized model is ET model through suffix, which is the ET model. Subsequent models can be continuously trained and modified by themselves to generate new reply content.
根据本公开的实施例,实现了以下技术效果:According to the embodiments of the present disclosure, the following technical effects are achieved:
获取用户每一次输入的聊天内容;将用户每一次新输入的聊天内容与之前所有的聊天内容一并发送至ChatGPT的系统模型;将用户反馈的ChatGPT的错误回复内容作为输入,训练模型;将系统模型变为ET模型,基于用户反馈的ChatGPT的错误回复内容不断训练,生成新的回复内容。本申请能够将实现基于ChatGPT的智能问答对话,并根据用户反馈内容不断优化回复内容,精度更高,更有效的解决用户需求。Obtain the chat content entered by the user each time; send each new chat content entered by the user together with all previous chat content to the system model of ChatGPT; use the error reply content of ChatGPT fed back by the user as input to train the model; use the system The model becomes an ET model, and the error reply content of ChatGPT based on user feedback is continuously trained to generate new reply content. This application can realize intelligent question and answer dialogue based on ChatGPT, and continuously optimize the reply content based on user feedback content, with higher accuracy and more effective solution to user needs.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于可选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that for the sake of simple description, the foregoing method embodiments are expressed as a series of action combinations. However, those skilled in the art should know that the present application is not limited by the described action sequence. Because in accordance with this application, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily necessary for this application.
以上是关于方法实施例的介绍,以下通过装置实施例,对本申请所述方案进行进一步说明。The above is an introduction to method embodiments. The solution described in this application will be further described below through device embodiments.
图2示出了本申请实施例的基于ChatGPT的智能问答装置的方块图,参见图2,该装置包括获取模块201、发送模块202、训练模块203、生成模块204。Figure 2 shows a block diagram of an intelligent question and answer device based on ChatGPT according to the embodiment of the present application. Referring to Figure 2, the device includes an acquisition module 201, a sending module 202, a training module 203, and a generation module 204.
获取模块201,用于获取用户每一次输入的聊天内容;The acquisition module 201 is used to obtain the chat content input by the user each time;
发送模块202,用于将用户每一次新输入的聊天内容与之前所有的聊天内容一并发送至ChatGPT的系统模型;The sending module 202 is used to send each new chat content entered by the user together with all previous chat content to the system model of ChatGPT;
训练模块203,用于将用户反馈的ChatGPT的错误回复内容作为输入,训练模型;The training module 203 is used to use the user feedback ChatGPT error reply content as input to train the model;
生成模块204,用于将系统模型变为ET模型,基于用户反馈的ChatGPT的错误回复内容不断训练,生成新的回复内容。The generation module 204 is used to change the system model into an ET model, continuously train the error reply content of ChatGPT based on user feedback, and generate new reply content.
需要说明的是:上述实施例提供基于ChatGPT的智能问答装置在进行用户智能问答时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的基于ChatGPT的智能问答装置基于ChatGPT的智能问答方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that the above embodiments provide an intelligent question and answer device based on ChatGPT. When performing intelligent question and answer for users, only the division of the above functional modules is used as an example. In actual applications, the above functions can be allocated to different functions according to needs. Module completion means dividing the internal structure of the device into different functional modules to complete all or part of the functions described above. In addition, the ChatGPT-based intelligent question answering device and the ChatGPT-based intelligent question answering method provided in the above embodiments belong to the same concept. Please refer to the method embodiments for details of the specific implementation process, which will not be described again here.
图3示出了本申请实施例的一种电子设备的结构图,参见图3,电子设备300包括处理器301和存储器303。其中,处理器301和存储器303相连,如通过总线302相连。可选地,电子设备300还可以包括收发器304。需要说明的是,实际应用中收发器304不限于一个,该电子设备300的结构并不构成对本申请实施例的限定。FIG. 3 shows a structural diagram of an electronic device according to an embodiment of the present application. Referring to FIG. 3 , the electronic device 300 includes a processor 301 and a memory 303 . Among them, the processor 301 and the memory 303 are connected, such as through a bus 302. Optionally, electronic device 300 may also include a transceiver 304. It should be noted that in practical applications, the number of transceivers 304 is not limited to one, and the structure of the electronic device 300 does not constitute a limitation on the embodiments of the present application.
处理器301可以是CPU(Central Processing Unit,中央处理器),通用处理器,DSP(Digital Signal Processor,数据信号处理器),ASIC(Application SpecificIntegrated Circuit,专用集成电路),FPGA(Field Programmable Gate Array,现场可编程门阵列)或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。处理器301也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,DSP和微处理器的组合等。The processor 301 may be a CPU (Central Processing Unit, central processing unit), a general-purpose processor, a DSP (Digital Signal Processor, data signal processor), ASIC (Application Specific Integrated Circuit, application specific integrated circuit), FPGA (Field Programmable Gate Array, field programmable gate array) or other programmable logic device, transistor logic device, hardware component, or any combination thereof. It may implement or execute the various illustrative logical blocks, modules, and circuits described in connection with this disclosure. The processor 301 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
总线302可包括一通路,在上述组件之间传送信息。总线302可以是PCI(Peripheral Component Interconnect,外设部件互连标准)总线或EISA(ExtendedIndustry Standard Architecture,扩展工业标准结构)总线等。总线302可以分为地址总线、数据总线、控制总线等。为便于表示,图3中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。Bus 302 may include a path that carries information between the above-mentioned components. The bus 302 may be a PCI (Peripheral Component Interconnect, Peripheral Component Interconnect Standard) bus or an EISA (Extended Industry Standard Architecture, Extended Industry Standard Architecture) bus, etc. The bus 302 can be divided into an address bus, a data bus, a control bus, etc. For ease of presentation, only one thick line is used in Figure 3, but it does not mean that there is only one bus or one type of bus.
存储器303可以是ROM(Read Only Memory,只读存储器)或可存储静态信息和指令的其他类型的静态存储设备,RAM(Random Access Memory,随机存取存储器)或者可存储信息和指令的其他类型的动态存储设备,也可以是EEPROM(Electrically ErasableProgrammable Read Only Memory,电可擦可编程只读存储器)、CD-ROM(Compact DiscRead Only Memory,只读光盘)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。The memory 303 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, RAM (Random Access Memory, random access memory) or other types that can store information and instructions. Dynamic storage devices can also be EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact DiscRead Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, Laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), magnetic disk storage medium or other magnetic storage device, or any other device capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer medium, but not limited to this.
存储器303用于存储执行本申请方案的应用程序代码,并由处理器301来控制执行。处理器301用于执行存储器303中存储的应用程序代码,以实现用户智能问答。The memory 303 is used to store application program code for executing the solution of the present application, and is controlled by the processor 301 for execution. The processor 301 is used to execute the application program code stored in the memory 303 to implement intelligent question answering for the user.
其中,电子设备包括但不限于:移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。需要说明的是,图3示出的电子设备仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。Among them, electronic devices include but are not limited to: mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PAD (tablet computers), PMP (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc. mobile terminals such as digital TVs, desktop computers, etc. It should be noted that the electronic device shown in FIG. 3 is only an example and should not impose any restrictions on the functions and scope of use of the embodiments of the present application.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意结合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络或其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如:同轴电缆、光纤、数据用户线(digital subscriber line,DSL))或无线(例如:红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质,或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如:软盘、硬盘、磁带)、光介质(例如:数字通用光盘(digital versatile disc,DVD))或半导体介质(例如:固态硬盘(solid state disk,SSD))等。值得注意的是,本申请实施例提到的计算机可读存储介质可以为非易失性存储介质,换句话说,可以是非瞬时性存储介质。In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on the computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, e.g., the computer instructions may be transferred from a website, computer, server, or data center Transmission to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer, or a data storage device such as a server or data center integrated with one or more available media. The available media may be magnetic media (such as floppy disks, hard disks, magnetic tapes), optical media (such as digital versatile discs (DVD)) or semiconductor media (such as solid state disks (SSD)) wait. It is worth noting that the computer-readable storage media mentioned in the embodiments of this application may be non-volatile storage media, in other words, may be non-transitory storage media.
应当理解的是,本文提及的“至少一个”是指一个或多个,“多个”是指两个或两个以上。在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,为了便于清楚描述本申请实施例的技术方案,在本申请的实施例中,采用了“第一”、“第二”等字样对功能和作用基本相同的相同项或相似项进行区分。本领域技术人员可以理解“第一”、“第二”等字样并不对数量和执行次序进行限定,并且“第一”、“第二”等字样也并不限定一定不同。It should be understood that "at least one" mentioned herein refers to one or more, and "plurality" refers to two or more. In the description of the embodiments of this application, unless otherwise stated, "/" means or, for example, A/B can mean A or B; "and/or" in this article is just a way to describe the association of related objects. Relationship means that three relationships can exist. For example, A and/or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in order to facilitate a clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as “first” and “second” are used to distinguish identical or similar items with basically the same functions and effects. Those skilled in the art can understand that words such as "first" and "second" do not limit the number and execution order, and words such as "first" and "second" do not limit the number and execution order.
以上所述为本申请提供的示例性实施例,并不用以限制本申请实施例,凡在本申请实施例的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above are exemplary embodiments provided by the present application and are not intended to limit the embodiments of the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application shall include within the protection scope of this application.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310269023.1ACN117290466A (en) | 2023-03-15 | 2023-03-15 | Intelligent question-answering method, device, equipment and storage medium based on ChatGPT |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310269023.1ACN117290466A (en) | 2023-03-15 | 2023-03-15 | Intelligent question-answering method, device, equipment and storage medium based on ChatGPT |
| Publication Number | Publication Date |
|---|---|
| CN117290466Atrue CN117290466A (en) | 2023-12-26 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310269023.1APendingCN117290466A (en) | 2023-03-15 | 2023-03-15 | Intelligent question-answering method, device, equipment and storage medium based on ChatGPT |
| Country | Link |
|---|---|
| CN (1) | CN117290466A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106663128A (en)* | 2016-06-29 | 2017-05-10 | 深圳狗尾草智能科技有限公司 | An extended learning method for chat dialogue system and chat dialogue system |
| CN109086329A (en)* | 2018-06-29 | 2018-12-25 | 出门问问信息科技有限公司 | Dialogue method and device are taken turns in progress based on topic keyword guidance more |
| CN112163079A (en)* | 2020-09-30 | 2021-01-01 | 民生科技有限责任公司 | Intelligent conversation method and system based on reading understanding model |
| CN113761111A (en)* | 2020-07-31 | 2021-12-07 | 北京汇钧科技有限公司 | Intelligent conversation method and device |
| US11417337B1 (en)* | 2021-08-12 | 2022-08-16 | Cresta Intelligence Inc. | Initiating conversation monitoring system action based on conversational content |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106663128A (en)* | 2016-06-29 | 2017-05-10 | 深圳狗尾草智能科技有限公司 | An extended learning method for chat dialogue system and chat dialogue system |
| CN109086329A (en)* | 2018-06-29 | 2018-12-25 | 出门问问信息科技有限公司 | Dialogue method and device are taken turns in progress based on topic keyword guidance more |
| CN113761111A (en)* | 2020-07-31 | 2021-12-07 | 北京汇钧科技有限公司 | Intelligent conversation method and device |
| CN112163079A (en)* | 2020-09-30 | 2021-01-01 | 民生科技有限责任公司 | Intelligent conversation method and system based on reading understanding model |
| US11417337B1 (en)* | 2021-08-12 | 2022-08-16 | Cresta Intelligence Inc. | Initiating conversation monitoring system action based on conversational content |
| Title |
|---|
| "CodeGPT:ChatGPT的VSCode插件扩展", Retrieved from the Internet <URL:https://www.jdon.com/64411-CodeGP.html>* |
| "OpenAl发布新人工智能系统根据文字生成图像", Retrieved from the Internet <URL:https://blog.csdn.net/PicUP1/article/details/127451537>* |
| "OpenAl新上线G PT太强了,服务器瞬间挤爆,马斯克:你们太沉迷了", Retrieved from the Internet <URL:https://blog.csdn.net/weixin_36896856/article/details/128195964?sharetype=blog&shareId=128195964&sharerefer=APP&sharesource=bbq_www&sharefrom=link>* |
| Publication | Publication Date | Title |
|---|---|---|
| CN112868004B (en) | Resource recommendation method and device, electronic equipment and storage medium | |
| CN110263142B (en) | Method and apparatus for outputting information | |
| CN117521625A (en) | Question answering method, question answering device, electronic equipment and medium | |
| CN110781373B (en) | List updating method and device, readable medium and electronic equipment | |
| CN119128127A (en) | Question and answer processing method, device and system | |
| CN111813407B (en) | Game development method, game running device and electronic equipment | |
| CN117908736A (en) | Interaction method, device, equipment and storage medium | |
| CN118964606A (en) | Session data processing method and device, search method and device, and electronic device | |
| CN109949806A (en) | Information interaction method and device | |
| CN111367689A (en) | Interactive prompt information sending method and device of online document and electronic equipment | |
| WO2025161306A1 (en) | Interactive information display method and apparatus, and device and storage medium | |
| WO2025108007A1 (en) | Information exchange method and apparatus, electronic device, and storage medium | |
| CN111949259B (en) | Risk decision configuration method, system, electronic device and storage medium | |
| WO2025051277A1 (en) | Interaction method and apparatus, and electronic device | |
| KR20250063138A (en) | Electronic device for generating training data to be used for training large-scale language model and method for operation thereof | |
| WO2025036386A1 (en) | Search result display method, and medium and electronic device | |
| CN118445399A (en) | Information generating method, apparatus, device, storage medium, and program product | |
| CN118535591A (en) | A SQL statement generation method and related device | |
| CN112733510A (en) | Financial certificate generation method, device, equipment and computer readable storage medium | |
| CN117290466A (en) | Intelligent question-answering method, device, equipment and storage medium based on ChatGPT | |
| CN111897910B (en) | Information pushing method and device | |
| CN111339770A (en) | Method and apparatus for outputting information | |
| CN113111643B (en) | Information processing method, device and apparatus | |
| CN112309403B (en) | Method and device for generating information | |
| CN119301588A (en) | Information processing method, device and system, electronic equipment, medium, program product |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |