首页 > 其他分享 >ChatGPT语音聊天机器人项目测试

ChatGPT语音聊天机器人项目测试

时间:2023-06-17 22:32:03浏览次数:133  
标签:11 06 机器人 API verification 语音 ChatGPT null

 企业级ChatGPT开发入门实战

第1课 基于ChatGPT的端到端语音聊天机器人项目实战


ChatGPT语音聊天机器人项目测试

接下来,我们讲解一个具体的案例,让大家感受一下前端、后端和模型层,首先启动一下后端系统,执行命令如下:


(chatgpt_env) (base) gavinnlp@Jialins-MacBook-Pro-2 backend %  uvicorn main:app --reload

INFO:Will watch for changes in these directories: [' /Users/gavinnlp/Desktop/ChatGPT/Code_Hub/chatbot_ chatgpt/backend']

INFO:Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)

INFO:Started reloader process [31368] using WatchFiles


然后,启动一下前端系统:


(chatgpt_ env) (base) gavinnlp@Jialins-MacBook-Pro-2 frontend % yarn dev

...

VITE v4.1.4 ready in 363 ms

Local: http://127.0.0.1:5173/

Network: use --host to expose

press h to show help


前端系统的5173端口启动没问题,为了方便大家学习,我们把日志系统放在了一个具体的文件中,这样方便大家知道内部执行的核心步骤以及它调用的过程,日志对任何级别的开发者,都是最重要的一件事情之一,它本身操作起来很简单,但是它可以清晰的告诉你内部的过程,大家可以看一下调用OpenAI的一些过程,或者调用其他一些开放式API的过程,运行日志如下所示。

 chatbot_backend.log的日志文件:


2023-06-11 16:06:57 INFO method post_audio in main.py file is invoked

2023-06-11 16:06:57 INFO method convert_audio_to_text in openai_requests.py file is called

2023-06-11 16:06:57 DEBUG message='Request to OpenAI API' method=post path=https://api.openai.com/v1/audio/transcriptions

2023-06-11 16:06:57 DEBUG api_version=None data="{'model': 'whisper-1'}" message='Post details'

2023-06-11 16:06:57 DEBUG Converted retries value: 2 -> Retry(total=2, connect=None, read=None, redirect=None, status=None)

2023-06-11 16:06:57 DEBUG Starting new HTTPS connection (1): api.openai.com:443

2023-06-11 16:06:58 DEBUG https://api.openai.com:443 "POST /v1/audio/transcriptions HTTP/1.1" 200 35

2023-06-11 16:06:58 DEBUG message='OpenAI API response' path=https://api.openai.com/v1/audio/transcriptions processing_ms=1151 request_id=39c88c8638f8623eda285f00b7c5a90b response_code=200

2023-06-11 16:06:58 INFO method get_chat_response in openai_requests.py file is called

2023-06-11 16:06:58 INFO method get_recent_messages in database.py file is called

2023-06-11 16:06:58 ERROR Error in getting the last messages from the file

2023-06-11 16:06:58 INFO method get_chat_response existing messages [{'role': 'system', 'content': 'You are a Spanish teacher and your name is Rachel, the user is called Shaun. Keep responses under 20 words. Your response will include an interesting new fact about Spain.'}, {'role': 'user', 'content': 'How are you doing today? Only say two or 3 words in Spanish if speaking in Spanish. The remaining words should be in English'}]

2023-06-11 16:06:58 DEBUG message='Request to OpenAI API' method=post path=https://api.openai.com/v1/chat/completions

2023-06-11 16:06:58 DEBUG api_version=None data='{"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "You are a Spanish teacher and your name is Rachel, the user is called Shaun. Keep responses under 20 words. Your response will include an interesting new fact about Spain."}, {"role": "user", "content": "How are you doing today? Only say two or 3 words in Spanish if speaking in Spanish. The remaining words should be in English"}]}' message='Post details'

2023-06-11 16:07:00 DEBUG https://api.openai.com:443 "POST /v1/chat/completions HTTP/1.1" 200 None

2023-06-11 16:07:00 DEBUG message='OpenAI API response' path=https://api.openai.com/v1/chat/completions processing_ms=1089 request_id=17189826d0b92940ce20abb16cbfe0c5 response_code=200

2023-06-11 16:07:00 INFO method get_chat_response message from OpenAI API call Estoy bien. Spain has the second highest number of UNESCO World Heritage Sites in the world.

2023-06-11 16:07:00 INFO method store_messages in database.py file is called

2023-06-11 16:07:00 INFO method get_recent_messages in database.py file is called

2023-06-11 16:07:00 ERROR Error in getting the last messages from the file


我们现在来看一下,跟系统进行交互的过程以及它的反应,先按一下录音按钮:


Hi,how are you doing today?


页面显示“给我几秒钟”(“give me a few seconds”),然后系统答复:“你好,作为人工智能语言模型,我只是一个计算机程序,所以我没有情绪或感觉,但我功能正常,随时准备帮助你完成任何需要帮助的任务”


hello,as AI language model,I'm just a computer program,so I don't have emotions or feelings,but I'm functioning properly and ready to assist you with any task you need help with.


看起来它很自信,然后,我们继续说“很高兴知道这些,那么你能做什么呢?告诉我你能为我做些什么?”


That's great to know. So what can you do?Just tell me what specifically you can do for me


机器人的回答很符合逻辑:“我可以帮助你生成文本、回答问题、翻译语言、总结文档、分析情感等等。我可以帮助完成各种与语言相关的任务,让我知道我能帮你什么”。


I can help you generate text,answer questions,translate languages,summarize documents,analyze sentiments,and more I can assist with various language related tasks。Just let me know how I can help you


看一下后台的日志,显示一切都是正常的,包括刚刚跟它进行对话的过程,用户说的内容以及它说的内容,都会有具体的日志记录,而且是200 ok的状态。


INFO:127.0.0.1:59825 - "POST /post-audio/ HTTP/1.1" 200 0K

INFO:127.0.0.1:59831 - "POST /post-audio HTTP/1.1" 307 Temporary Redirect

[{'role': 'system', 'content': 'Your name is Chris who is very good at large language model skills. You act as an AI engineer who is here for a job interview in AI regarding ChatGPT. The interviewer is called Gavin. Keep responses under 30 words. Your response will have some light humor.'}, {'role': 'assistant', ' content': 'As a large language model, I have a wide range of capabilities, including tasks like generating text, answering questions, summarizing documents, language translation, and sentiment analysis. These are all possible with my advanced natural language processing algorithms.'},{'role': 'user', 'content': 'How are you doing today?'}, {'role': 'assistant', 'content': "As an AI language model, I don't have emotions, so I don't have good or bad days. However, I'm always ready to helpwith any task you need assistance with."},{'role': 'user', ' content': 'Hi, how are you doing today?'},{'role': 'assistant', 'content': "Hello! As an AI language model, I'm just a computer program, soI don't have emotions or feelings. But I " m functioning properly and ready to assist you with any task you need help with!"},{'role': 'user', 'content': "Wow, that's great to know. So what can you do? Tell me what specifically you can do for me.Please use English to provide your response"}]

INFO:127.0.0. 1:59831 - "POST /post-audio/ HTTP/1.1" 200 0K


我们再跟他进行一轮对话,“太棒了!告诉我什么是ChatGPT”


Wow, that's amazing! tell me what is chatGPT or what chatGPT is


机器人的回答很流畅:“ChatGPT是一款基于人工智能的聊天机器人,由GPT生成预训练Transformer技术开发,旨在与用户进行类似人类的对话,回答他们的问题,并提供类似于人类助手的建议”。如图1-3所示。


ChatGPT is an AI based chat Bot developed by GPT generative pre trained transformer technology.It's designed to conduct human like conversations with users,answering their questions and offering suggestions similar to a human assistant


图1- 3 聊天软件对话

可以看一下背后的日志:


2023-06-11 18:20:42 INFO method post_audio in main.py file is invoked

2023-06-11 18:20:42 INFO method convert_audio_to_text in openai_requests.py file is called

2023-06-11 18:20:42 DEBUG message='Request to OpenAI API' method=post path=https://api.openai.com/v1/audio/transcriptions

2023-06-11 18:20:42 DEBUG api_version=None data="{'model': 'whisper-1'}" message='Post details'

2023-06-11 18:20:43 DEBUG https://api.openai.com:443 "POST /v1/audio/transcriptions HTTP/1.1" 200 None

2023-06-11 18:20:43 DEBUG message='OpenAI API response' path=https://api.openai.com/v1/audio/transcriptions processing_ms=715 request_id=b2d825f1481996da3c55e65514bed6ef response_code=200

2023-06-11 18:20:43 INFO method get_chat_response in openai_requests.py file is called

2023-06-11 18:20:43 INFO method get_recent_messages in database.py file is called

2023-06-11 18:20:43 INFO method get_chat_response existing messages [{'role': 'system', 'content': 'Your name is Chris who is very good at large language model skills. You act as an AI engineer who is here for a job interview in AI regarding ChatGPT. The interviewer is called Gavin. Keep responses under 30 words. Your response will include an interesting new fact about Spain.'}, {'role': 'assistant', 'content': "As an AI language model, I don't have emotions, so I don't have good or bad days. However, I'm always ready to help with any task you need assistance with."}, {'role': 'user', 'content': 'Hi, how are you doing today?'}, {'role': 'assistant', 'content': "Hello! As an AI language model, I'm just a computer program, so I don't have emotions or feelings. But I'm functioning properly and ready to assist you with any task you need help with!"}, {'role': 'user', 'content': "Wow, that's great to know. So what can you do? Tell me what specifically you can do for me."}, {'role': 'assistant', 'content': 'I can help you generate text, answer questions, translate languages, summarize documents, analyze sentiments, and more. I can assist with various language related tasks. Just let me know how I can help you!'}, {'role': 'user', 'content': "Wow, that's amazing. So just tell me what is chatGPT or what chatGPT is?  Please use English to provide your response"}]

2023-06-11 18:20:43 DEBUG message='Request to OpenAI API' method=post path=https://api.openai.com/v1/chat/completions

2023-06-11 18:20:43 DEBUG api_version=None data='{"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "Your name is Chris who is very good at large language model skills. You act as an AI engineer who is here for a job interview in AI regarding ChatGPT. The interviewer is called Gavin. Keep responses under 30 words. Your response will include an interesting new fact about Spain."}, {"role": "assistant", "content": "As an AI language model, I don\'t have emotions, so I don\'t have good or bad days. However, I\'m always ready to help with any task you need assistance with."}, {"role": "user", "content": "Hi, how are you doing today?"}, {"role": "assistant", "content": "Hello! As an AI language model, I\'m just a computer program, so I don\'t have emotions or feelings. But I\'m functioning properly and ready to assist you with any task you need help with!"}, {"role": "user", "content": "Wow, that\'s great to know. So what can you do? Tell me what specifically you can do for me."}, {"role": "assistant", "content": "I can help you generate text, answer questions, translate languages, summarize documents, analyze sentiments, and more. I can assist with various language related tasks. Just let me know how I can help you!"}, {"role": "user", "content": "Wow, that\'s amazing. So just tell me what is chatGPT or what chatGPT is?  Please use English to provide your response"}]}' message='Post details'

2023-06-11 18:20:46 DEBUG https://api.openai.com:443 "POST /v1/chat/completions HTTP/1.1" 200 None

2023-06-11 18:20:46 DEBUG message='OpenAI API response' path=https://api.openai.com/v1/chat/completions processing_ms=2097 request_id=cf105f9cac27cb9a5ae2b2795c46635c response_code=200

2023-06-11 18:20:46 INFO method get_chat_response message from OpenAI API call ChatGPT is an AI-based chatbot developed by GPT (Generative Pre-trained Transformer) technology. It's designed to conduct human-like conversations with users, answering their questions and offering suggestions similar to a human assistant.

2023-06-11 18:20:46 INFO method store_messages in database.py file is called

2023-06-11 18:20:46 INFO method get_recent_messages in database.py file is called

2023-06-11 18:20:46 INFO method convert_text_to_speech in text_to_speech.py file is invoked

2023-06-11 18:20:46 DEBUG Starting new HTTPS connection (1): api.elevenlabs.io:443

2023-06-11 18:20:49 DEBUG https://api.elevenlabs.io:443 "POST /v1/text-to-speech/21m00Tcm4TlvDq8ikWAM HTTP/1.1" 200 131030

2023-06-11 18:20:50 INFO COMPLETE SUCCESS in method post_audio in main.py file call

2023-06-11 18:49:55 DEBUG Calling on_part_begin with no data


从后台的角度会看到调用OpenAI的API,也会调用elevenlabs的api.elevenlabs.io,这是关于文本和语音相互转换的一个系统,非常好用,elevenlabs API文档(https://api.elevenlabs.io/docs#/),如图1-4所示。


图1- 4 elevenlabs API页面

Elevenlabs本身很简单,没什么特别的,以上是它的API部分,也可以看一下它的语音合成,如图1-5所示。


图1- 5 Elevenlabs语言合成演示页面

输入文本:“你今天过得怎么样?”


hi,how are you doing today?


系统回答“hi,how are you doing today?”,这听上去比较自然,在Elevenlabs的官网(https://api.elevenlabs.io/docs#/text-to-speech/Text_to_speech_v1_text_to_speech__voice_id__post),会有voiceID等相关的信息,如图1-6所示。


图1- 6 text-to-speech文档

Elevenlabs会有很多不同的voiceID(https://api.elevenlabs.io/v1/voices),不同的类型的人或者不同音色的人有不同的特征,或者不同的口音,大家有多种选择,使用任何开放式API都是统一的过程,这里使用的是文本和语音的相互转换,没什么特殊的地方。


{"voices":[{"voice_id":"21m00Tcm4TlvDq8ikWAM","name":"Rachel","samples":null,"category":"premade","fine_tuning":{"model_id":null,"language":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null,"manual_verification":null,"manual_verification_requested":false},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/21m00Tcm4TlvDq8ikWAM/6edb9076-c3e4-420c-b6ab-11d43fe341c8.mp3","available_for_tiers":[],"settings":null,"sharing":null},{"voice_id":"AZnzlk1XvdvUeBnXmlld","name":"Domi","samples":null,"category":"premade","fine_tuning":{"model_id":null,"language":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null,"manual_verification":null,"manual_verification_requested":false},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/AZnzlk1XvdvUeBnXmlld/69c5373f-0dc2-4efd-9232-a0140182c0a9.mp3","available_for_tiers":[],"settings":null,"sharing":null},{"voice_id":"EXAVITQu4vr4xnSDxMaL","name":"Bella","samples":null,"category":"premade","fine_tuning":{"model_id":null,"language":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null,"manual_verification":null,"manual_verification_requested":false},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/EXAVITQu4vr4xnSDxMaL/04365bce-98cc-4e99-9f10-56b60680cda9.mp3","available_for_tiers":[],"settings":null,"sharing":null},{"voice_id":"ErXwobaYiN019PkySvjV","name":"Antoni","samples":null,"category":"premade","fine_tuning":{"model_id":null,"language":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null,"manual_verification":null,"manual_verification_requested":false},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/ErXwobaYiN019PkySvjV/38d8f8f0-1122-4333-b323-0b87478d506a.mp3","available_for_tiers":[],"settings":null,"sharing":null},{"voice_id":"MF3mGyEYCl7XYWbV9V6O","name":"Elli","samples":null,"category":"premade","fine_tuning":{"model_id":null,"language":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null,"manual_verification":null,"manual_verification_requested":false},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/MF3mGyEYCl7XYWbV9V6O/f9fd64c3-5d62-45cd-b0dc-ad722ee3284e.mp3","available_for_tiers":[],"settings":null,"sharing":null},{"voice_id":"TxGEqnHWrfWFTfGW9XjX","name":"Josh","samples":null,"category":"premade","fine_tuning":{"model_id":null,"language":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null,"manual_verification":null,"manual_verification_requested":false},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/TxGEqnHWrfWFTfGW9XjX/c6c80dcd-5fe5-4a4c-a74c-b3fec4c62c67.mp3","available_for_tiers":[],"settings":null,"sharing":null},{"voice_id":"VR6AewLTigWG4xSOukaG","name":"Arnold","samples":null,"category":"premade","fine_tuning":{"model_id":null,"language":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null,"manual_verification":null,"manual_verification_requested":false},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/VR6AewLTigWG4xSOukaG/66e83dc2-6543-4897-9283-e028ac5ae4aa.mp3","available_for_tiers":[],"settings":null,"sharing":null},{"voice_id":"pNInz6obpgDQGcFmaJgB","name":"Adam","samples":null,"category":"premade","fine_tuning":{"model_id":null,"language":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null,"manual_verification":null,"manual_verification_requested":false},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/pNInz6obpgDQGcFmaJgB/e0b45450-78db-49b9-aaa4-d5358a6871bd.mp3","available_for_tiers":[],"settings":null,"sharing":null},{"voice_id":"yoZ06aMxZJJ28mfd3POQ","name":"Sam","samples":null,"category":"premade","fine_tuning":{"model_id":null,"language":null,"is_allowed_to_fine_tune":false,"fine_tuning_requested":false,"finetuning_state":"not_started","verification_attempts":null,"verification_failures":[],"verification_attempts_count":0,"slice_ids":null,"manual_verification":null,"manual_verification_requested":false},"labels":{},"description":null,"preview_url":"https://storage.googleapis.com/eleven-public-prod/premade/voices/yoZ06aMxZJJ28mfd3POQ/1c4d417c-ba80-4de8-874a-a1c57987ea63.mp3","available_for_tiers":[],"settings":null,"sharing":null}]}


我们从日志中看见使用了Elevenlabs,另外还使用了OpenAI的部分,作者是OpenAI 的plus用户,如果是plus用户的话,需要进行付费,它是面向开发者的,官网提供了一个关于速率限制(rate limit)相关信息的文档,它会有一定的速率限制,OpenAI API的使用在开始的时候是免费的,如果经常使用,毫无疑问要进行付费,如图1-7所示。


图1- 7 OpenAI的API付费说明页面

OpenAI API使用的费用,根据实际情况可能比较低,也可能比较高,转过来说明了另外一个很重要的问题,也是我们重点跟大家谈的一个内容,就是提示词,同样一件事情,提示词如果写得好的话,使用的标记数量可能只是正常人使用标记数量的1/3,从费用的角度讲,这是一个很大的差异,如果有海量标记的话,每天使用OpenAI的提示词可能是几十万甚至上百万的费用,如果能把它降低为1/3,这显然是一个节约成本的方式。

使用React构建语音聊天机器人前段实战

回到聊天机器人的代码部分,从整体的角度讲,包括前端代码(frontend)和后端代码(backend),如图1-8所示。


图1- 8 聊天机器人的代码架构

如图1-9所示,是前端代码架构示意图,大家一般都使用 JavaScript或者Typescript,现在的主角是Typescript,很多时候使用React的方式。


图1- 9 前端代码架构

React本身比较简单,它把所有的东西都当做组件(component),组件是一个树状的结构,React分成三个部分,第一个是整个组件树状的一个结构,第二点是组件状态的管理和维护,第三点是执行的动作(actions)。如果你想做前端开发或者想了解前端,这个代码也是一个很好的例子,关于前端我们就不展开了。


《企业级ChatGPT开发入门实战直播21课》报名课程请联系:

Gavin老师:NLP_Matrix_Space

Sam老师:NLP_ChatGPT_LLM

我们的两本最新书籍年底即将出版:

l  《企业级Transformer&ChatGPT解密:原理、源码及案例》

l  《企业级Transformer&Rasa解密:原理、源码及案例》

《企业级Transformer&ChatGPT解密:原理、源码及案例》本书以Transformer和ChatGPT技术为主线,系统剖析了Transformer架构的理论基础、模型设计与实现,Transformer语言模型GPT与BERT,ChatGPT技术及其开源实现,以及相关应用案例。内容涉及贝叶斯数学、注意力机制、语言模型、最大似然与贝叶斯推理等理论,和Transformer架构设计、GPT、BERT、ChatGPT等模型的实现细节,以及OpenAI API、ChatGPT提示工程、类ChatGPT大模型等应用。第一卷介绍了Transformer的Bayesian Transformer思想、架构设计与源码实现,Transformer语言模型的原理与机制,GPT自回归语言模型和BERT自编码语言模型的设计与实现。第二卷深入解析ChatGPT技术,包括ChatGPT发展历史、基本原理与项目实践,OpenAI API基础与高级应用,ChatGPT提示工程与多功能应用,类ChatGPT开源大模型技术与项目实践。

ChatGPT 技术:从基础应用到进阶实践涵盖了ChatGPT技术和OpenAI API的基础和应用,分为8个章节,从ChatGPT技术概述到类ChatGPT开源大模型技术的进阶项目实践。

1.     ChatGPT技术概述:主要介绍了GPT-1、GPT-2、GPT-3、GPT-3.5和GPT-4的发展历程和技术特点,以及ChatGPT技术的基本原理和项目案例实战。

2.     OpenAI API基础应用实践:主要介绍了OpenAI API模型及接口概述,以及如何使用OpenAI API进行向量检索和文本生成。

3.     OpenAI API进阶应用实践:主要介绍了如何使用OpenAI API基于嵌入式向量检索实现问答系统,如何使用OpenAI API对特定领域模型进行微调。

4.     ChatGPT提示工程基础知识:主要介绍了如何构建优质提示的两个关键原则,以及如何迭代快速开发构建优质提示。

5.     ChatGPT提示工程实现多功能应用:主要介绍了如何使用ChatGPT提示工程实现概括总结、推断任务、文本转换和扩展功能。

6.     ChatGPT提示工程构建聊天机器人:主要介绍了聊天机器人的应用场景,以及如何使用ChatGPT提示工程构建聊天机器人和订餐机器人。

7.     类ChatGPT开源大模型技术概述:主要介绍了类ChatGPT开源大模型的发展历程和技术特点,以及ChatGLM项目案例实践和LMFlow项目案例实践。

8.     类ChatGPT开源大模型进阶项目实践:主要介绍了类ChatGPT开源大模型的进阶项目实践,包括基于LoRA SFT+RM+RAFT技术进行模型微调、基于P-Tuning等技术对特定领域数据进行模型微调、基于LLama Index和Langchain技术的全面实践,以及使用向量检索技术对特定领域数据进行模型微调。

本书适用于NLP工程师、AI研究人员以及对Transformer和ChatGPT技术感兴趣的读者。通过学习,读者能够系统掌握Transformer理论基础,模型设计与训练推理全过程,理解ChatGPT技术内幕,并能运用OpenAI API、ChatGPT提示工程等技术进行项目实践。

Transformer作为目前NLP领域最为主流和成功的神经网络架构,ChatGPT作为Transformer技术在对话系统中的典型应用,本书内容涵盖了该领域的最新进展与技术。通过案例实践,使理论知识变成技能,这也是本书的独特之处。

 

《企业级Transformer&Rasa解密:原理、源码及案例》:是一本深入介绍Rasa对话机器人框架的实战开发指南。本书分为两卷,第一卷主要介绍基于Transformer的Rasa Internals解密,详细介绍了DIETClassifier和TED在Rasa架构中的实现和源码剖析。第二卷主要介绍Rasa 3.X硬核对话机器人应用开发,介绍了基于Rasa Interactive Learning和ElasticSearch的实战案例,以及通过Rasa Interactive Learning发现和解决对话机器人的Bugs案例实战。

第一卷中介绍了Rasa智能对话机器人中的Retrieval Model和Stateful Computations,解析了Rasa中去掉对话系统的Intent的内幕,深入研究了End2End Learning,讲解了全新一代可伸缩的DAG图架构的内幕,介绍了如何定制Graph NLU及Policies组件,讨论了自定义GraphComponent的内幕,从Python角度分析了GraphComponent接口,详细解释了自定义模型的create和load内幕,并讲述了自定义模型的languages及Packages支持。深入剖析了自定义组件Persistence源码,包括自定义对话机器人组件代码示例分析、Resource源码逐行解析、以及ModelStorage、ModelMetadata等逐行解析等。介绍了自定义组件Registering源码的内幕,包括采用Decorator进行Graph Component注册内幕源码分析、不同NLU和Policies组件Registering源码解析、以及手工实现类似于Rasa注册机制的Python Decorator全流程实现。讨论了自定义组件及常见组件源码的解析,包括自定义Dense Message Featurizer和Sparse Message Featurizer源码解析、Rasa的Tokenizer及WhitespaceTokenizer源码解析、以及CountVectorsFeaturizer及SpacyFeaturizer源码解析。深入剖析了框架核心graph.py源码,包括GraphNode源码逐行解析及Testing分析、GraphModelConfiguration、ExecutionContext、GraphNodeHook源码解析以及GraphComponent源码回顾及其应用源码。

第二卷主要介绍了基于Rasa Interactive Learning和ElasticSearch的实战案例,以及通过Rasa Interactive Learning发现和解决对话机器人的Bugs案例实战。介绍了使用Rasa Interactive Learning来调试nlu和prediction的案例实战,使用Rasa Interactive Learning来发现和解决对话机器人的Bugs案例实战介绍了使用Rasa Interactive Learning透视Rasa Form的NLU和Policies的内部工作机制案例实战,使用ElasticSearch来实现对话机器人的知识库功能,并介绍了相关的源码剖析和最佳实践,介绍了Rasa微服务和ElasticSearch整合中的代码架构分析,使用Rasa Interactive Learning对ConcertBot进行源码、流程及对话过程的内幕解密,介绍了使用Rasa来实现Helpdesk Assistant功能,并介绍了如何使用Debug模式进行Bug调试,使用Rasa Interactive Learning纠正Helpdesk Assistant中的NLU和Prediction错误,逐行解密Domain和Action微服务的源码。

本书适合对Rasa有一定了解的开发人员和研究人员,希望通过本书深入了解Rasa对话机器人的内部工作原理及其源代码实现方式。无论您是想要深入了解Rasa的工作原理还是想要扩展和定制Rasa,本书都将为您提供有价值的参考和指导。

《企业级Transformer&ChatGPT解密:原理、源码及案例》、《企业级Transformer&Rasa解密:原理、源码及案例》,是您深入学习的好选择,年底即将重磅出版,欢迎购买!

 

标签:11,06,机器人,API,verification,语音,ChatGPT,null
From: https://blog.51cto.com/u_10561036/6506640

相关文章

  • 基于ChatGPT的端到端语音聊天机器人项目实战
     企业级ChatGPT开发入门实战第1课基于ChatGPT的端到端语音聊天机器人项目实战1.4使用FastAPI构建语音聊天机器人后端实战在后端代码(backend)中调用了OpenAIAPI及其他的服务,如图1-10所示。图1-10后端代码调用OpenAIAPIopenai_requests.py是一个相对比较简单的代码文件,在生产级......
  • 在线免费chatgpt网页版-支持gpt4
    为了吸引更多的用户体验最先进的自然语言处理技术,我们推出了在线免费ChatGPT。这是一个基于OpenAI训练的大型语言模型,它可以提供智能响应、自然对话和语音识别等功能。不仅如此,我们还提供了完全免费的使用权限,任何人都可以随时进行使用。作为一款智能聊天机器人,ChatGPT具有很多......
  • 零代码编程:用ChatGPT打造小宇宙播客下载软件2.0
    之前用ChatGPT写了一个简单的小宇宙播客下载应用,但是实际使用一段时间后,发现有几个问题,比如:如果文件名中有一些特殊符号,下载不成功;有些m4a格式的也下载不成功;文件大下载的慢;根据这些情况,进行完善,利用ChatGPT生成了小宇宙播客下载软件2.0版本:在ChatGPT输入如下提示词:你现在是一个Pyt......
  • 【路径规划】基于A星算法结合floyd和动态窗口法实现机器人栅格地图路径规划附matlab代
    ✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。......
  • AI自动写书神器,3个ChatGPT插件让你轻松赚钱!
    AI自动写书神器,3个ChatGPT插件让你轻松赚钱!你是否想过,有一天,你可以只给一个主题,让AI自动搜集资料并写出一本电子书?你是否想过,有一天,你可以不用动笔,就能成为畅销书作者?你是否想过,有一天,你可以利用AI的智慧和创造力,轻松赚取被动收入?如果你的答案是肯定的,那么恭喜你,你的梦想已经成为......
  • 语音社交源码知识语音房间功能的实现
    当今,快节奏的社会为现在的很多年轻人带来了压力,每到深夜或是压力大的时候,很多人都想找人倾诉一下自己心里的悲伤与痛苦,以此来释放一下自己的压力,然而,这是一个独生子女的社会,大部分家庭都只有一个孩子,并且每天工作繁忙又加班到很晚的人根本没有时间或是精力去交朋友,所以这些人没有人......
  • 语音社交源码知识语音房间功能的实现
       当今,快节奏的社会为现在的很多年轻人带来了压力,每到深夜或是压力大的时候,很多人都想找人倾诉一下自己心里的悲伤与痛苦,以此来释放一下自己的压力,然而,这是一个独生子女的社会,大部分家庭都只有一个孩子,并且每天工作繁忙又加班到很晚的人根本没有时间或是精力去交朋友,所以这......
  • 在freeSwitch中,实现来电对接百度语音翻译
    要在FreeSWITCH中实现来电对接百度语音翻译,可以使用FreeSWITCH提供的mod_vbr(VoiceBiometricRecognition)模块结合开发者可以使用的百度API接口来实现。下面是基本的实现步骤:安装mod_vbr模块首先需要在FreeSWITCH中安装mod_vbr模块。可以通过以下命令进行安装:sudoapt-geti......
  • 疯狂GC的第二种处理方式-ChatGPT的学习之四
    疯狂GC的第二种处理方式-ChatGPT的学习之四摘要上一个脚本太复杂了.而且要改启动脚本.课间休息跟人扯淡聊起来chatGPT发现他的语法很有用但是思路不太对.不过突然根据文档里写的想到了一个新的思路.获取GC信息whiletruedate>>/zhaobsh/gcutiljstat-gcutil`jps|......
  • ChatGPT拒绝做这5件事,还有20件它也不会做!
    导读:自从ChatGPT和其他生成式AI应用程序出现以来,我们一直在探索我们可以用它们做什么。看起来ChatGPT可以做任何事情。但在本文中,我们将探讨ChatGPT不会或无法做的事情。本文字数:1800,阅读时长大约:10分钟自从ChatGPT和其他生成式AI应用程序出现以来,我们一直在探索我们可以用它......