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:

 

  1. The microphone audio must be captured, so a speech-to-text system is needed to get the text that will be sent to OpenAI. 
    1. Capturing the microphone audio is done using the component TsgcAudioRecorderMCI.
    2. Once we've captured the audio, it is sent to the OpenAI Whisper API to convert the audio file to text.
  2. Once we get the speech-to-text result, we send the text to OpenAI using the ChatCompletion API.
  3. The response from OpenAI must then be converted to speech using one of the following components:
    1. TsgcTextToSpeechSystem: (currently only for Windows) uses the Windows text-to-speech from the operating system.
    2. TsgcTextToSpeechGoogle: sends the response from OpenAI to the Google Cloud Servers and an mp3 file is returned which is played by the TsgcAudioPlayerMCI.
    3. TsgcTextToSpeechAmazon: sends the response from OpenAI to the Amazon AWS Servers and an mp3 file is returned which is played by the TsgcAudioPlayerMCI.

 

Reference