TsgcAIOpenAIChatBot
The microphone audio must be captured, so a speech-to-text system is needed to get the text that will be sent to OpenAI.
Introduction
To build a ChatBot with voice commands, the following steps are required:
- The microphone audio must be captured, so a speech-to-text system is needed to get the text that will be sent to OpenAI.
- Capturing the microphone audio is done using the component TsgcAudioRecorderMCI.
- Once we've captured the audio, it is sent to the OpenAI Whisper API to convert the audio file to text.
- Once we get the speech-to-text result, we send the text to OpenAI using the ChatCompletion API.
- The response from OpenAI must then be converted to speech using one of the following components:
- TsgcTextToSpeechSystem: (currently only for Windows) uses the Windows text-to-speech from the operating system.
- TsgcTextToSpeechGoogle: sends the response from OpenAI to the Google Cloud Servers and an mp3 file is returned which is played by the TsgcAudioPlayerMCI.
- TsgcTextToSpeechAmazon: sends the response from OpenAI to the Amazon AWS Servers and an mp3 file is returned which is played by the TsgcAudioPlayerMCI.
Reference
- Properties — 6 properties available on the component.
- Methods — 4 public methods.
- Events — 4 events you can handle.