Make sure your .env file look

Discuss hot database and enhance operational efficiency together.
Post Reply
hasinam2206
Posts: 18
Joined: Sun Dec 22, 2024 4:39 am

Make sure your .env file look

Post by hasinam2206 »

You’ll start by creating a new serverless project. Since you’ve installed the amazing open source serverless toolkit , you can do this in one line by passing the command to your terminal: bash copy the code twilio serverless:init replace with whatever name you want. Mine is three-robot-rhumba . Terminal window showing initialization of a twilio serverless project now, run cdin your project directory and update the .

Env file to provide your twilio authentication 11-digit phone number format philippines token as auth_tokenand your openai api key as openai_api_key. Your twilio account sid should auto-populate. s like this (with the placeholders xxxxxreplaced with their respective keys): text copy the code account_sid=xxxxx auth_token=xxxxx openai_api_key=xxxxx since twilio serverless functions are simple node.js applications, you can add dependencies using any package manager that writes to package.

Image

Json. Here, i'm using npm, for simplicity. Go back to your terminal and enter the following to install the openai npm package: bash copy the code npm install [email protected] now that your environment variables are set and your dependencies are added, you can get down to business. You’ll create two functions: one /transcribethat uses twilio speech recognition to turn your spoken words into text that chatgpt can understand using the twiml verb , and one /respondthat takes the text generated by speech recognition, sends it to the openai api, and passes the response to twilio’s amazon polly text to speech neural text-to-speech engine using the twiml verb .
Post Reply