Text To Speech OpenAI request
Text To Speech Open AI request generates a voice from the text and sends it to the bot in audio format.
- Component configuration →
- How to output audio from Text To Speech to a message →
- How to accept users requests →
Component configuration
1. From the Components section on the right panel, drag or double-click the Request to Text To Speech OpenAI component to move it to the desired screen.
2. In the Prompt field, add the OpenAI token. You can get it in your OpenAI personal account (LogIn - API). Then, in the Overview section, open the Personal tab and select the View API keys section in it.
If Openal is not available in your country, use a VPN service.
Generate a token using the Create new secret key button.
3. In the Prompt field, write the text that the neural network should voice. The description can be written in plain text or taken from a variable. The text should contain less than 4096 characters.
The shorter the text, the faster the audio will be generated.
4. Add Variable name for the response so that the link to the audio from Text To Speech is passed to this variable.
After the audio is generated and gets into the bot, it can be output.
5. Specify the Successful request screen. This screen will be executed upon successful request to the neural network. If the successful request screen is not selected, then if successful, the following component will be executed.
6. Specify the Request error screen. This screen will be executed in case of one or more request errors. Examples of errors:
- the audio is being generated for too long;
- the invalid OpenAI token is specified;
- OpenAI is not available;
- the error is on the OpenAI side.
7. In the Advanced settings, select the model, format and type of voice for audio from the lists. If necessary, you can change the audio recording speed that will be generated from your text.
How to output audio from Text To Speech OpenAI to a message
Audio come from Text To Speech OpenAI as a link. You can see these links in the Users section by opening the variables of the user who sent the request.
If you need a recording with a voiced text to come to the bot immediately, the Audio component is suitable.
To get the voiced text in the bot, in the URL field of the Audio component, output the variable where the link to the audio generated from your text is recorded.
How to accept users requests
Using User Input or Fork, you can accept requests for audio generation from the user.
To do this, output a variable with a message from the user into the Request Text field in the Request To Text To Speech OpenAI component.