AI prompts
base on Demo of twilio # Cold Call Genius AKA ChatGPT Phone
### Practice realistic cold calls with an AI bot
π² This app uses a twilio number to point to a python script running on ngrok server
π± Twilio configuration for phone number, ngrok URL endpoint
π» python script 'start.py' runs as system service
πΈοΈ ngrok starts server pointing to coldcallgenius.ngrok.io
π Services restart and run while server is up
---
# Cold Call Genius Setup Playbook
### Overview
This playbook guides you through the setup process of the Cold Call Genius application, a voice chatbot that leverages Twilio, Deepgram, and OpenAI (GPT-4) to conduct phone conversations. Follow these steps to replicate the setup for future instances.
The source code and necessary files for the setup can be found in the [GitHub repository](https://github.com/kevingduck/ColdCallGenius)
### Prerequisites
Before you start, make sure you have *Python 3.10+* installed on your system.
#### Necessary API keys:
Twilio API Key
OpenAI API Key (for GPT-4)
Deepgram API Key
## Steps
### Clone the Repository
Clone the [Cold Call Genius GitHub repository](https://github.com/kevingduck/ColdCallGenius) to your local system or server.
`
git clone https://github.com/kevingduck/ColdCallGenius.git
`
### Install Dependencies
Navigate to the cloned repository and install the necessary Python packages. You can find these in the requirements.txt file.
```
cd ColdCallGenius
pip install -r requirements.txt
```
### Configure Environment Variables
Create a .env file in the repository folder and set the following environment variables with your API keys:
```
OPENAI_API_KEY=your_openai_api_key
CONSOLE_API_KEY=your_deepgram_api_key
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
```
### Setup Twilio
Set up a Twilio account and obtain a Twilio phone number.
In the Twilio console, configure the webhook endpoint to point to the URL generated by ngrok (detailed in the next step) followed by /twilio/twiml/start. For instance:
```
http://your-ngrok-subdomain.ngrok.io/twilio/twiml/start.
```
### Setup ngrok
Install ngrok on your system or server.
Authenticate following the [steps here](https://dashboard.ngrok.com/get-started/setup).
Run the following command to create a publicly accessible URL that forwards to your local server on port 8080 (reserve your own domain in ngrok settings):
```
ngrok http --hostname=coldcallgenius.ngrok.io 8080
```
At this point you should be able to run `python3 start.py` in one terminal and `ngrok http 8080` in another. In the Twilio console, set the endpoint as the ngrok URL, e.g., http://<ngrok-url.io>/twilio/twiml/start. You should be able to call the number and see it register on the ngrok terminal and also see the python script responding.
Continue on to make it more resilient with system services. A $10/mo subscription to ngrok is recommended as it gets you a static domain that doesn't go down (otherwise setup an apahce/ nginx server).
### Create System Services
Create system services to manage the Python script (start.py) and the ngrok script. Pre-created files are available in the system_config directory. These services will ensure that the scripts run continuously and restart in case of failures or system restarts.
Before we begin, ensure you have necessary packages installed. You might require systemd and python3 (along with pip to install dependencies from the repository).
```
sudo apt update
sudo apt install systemd python3 python3-pip
```
Navigate to the project directory
```
cd ColdCallGenius
```
Inside the repository folder, install the necessary Python dependencies using pip. It's recommended to do this in a virtual environment:
```
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
Next, create a systemd service file to manage the start.py script. Open a new file in the /etc/systemd/system directory (you'll need root permissions):
```
sudo nano /etc/systemd/system/coldcallgenius.service
```
In the editor, fill out the service file with the following details:
```
[Unit]
Description=Cold Call Genius Service
After=network.target
[Service]
User=yourusername
WorkingDirectory=/path/to/your/repository/ColdCallGenius
ExecStart=/path/to/your/repository/ColdCallGenius/venv/bin/python /path/to/your/repository/ColdCallGenius/start.py
Restart=always
[Install]
WantedBy=multi-user.target
```
Replace /path/to/your/repository with the actual path where the repository is cloned and yourusername with your Linux username.
Now, enable and start the service to make it run on boot:
```
sudo systemctl enable coldcallgenius.service
sudo systemctl start coldcallgenius.service
```
You can verify if the service is running successfully by checking its status:
```
sudo systemctl status coldcallgenius.service
```
Repeat the steps for the ngrok service. This is the service file coldcallgenius-ngrok.service:
```
sudo nano /etc/systemd/system/coldcallgenius-ngrok.service
```
```
[Unit]
Description=ngrok HTTP Tunnel Service
After=network.target
[Service]
ExecStart=/usr/local/bin/ngrok http --hostname=coldcallgenius.ngrok.io 8080
Restart=always
User=admin
[Install]
WantedBy=multi-user.target
```
then run this to enable it at startup and run it now:
```
sudo systemctl enable coldcallgenius-ngrok.service
sudo systemctl start coldcallgenius-ngrok.service
```
### Testing
Once the script and ngrok are running, call the twilio number to test it out.
### Logs
You can use the journalctl command to view the logs of your service. To watch the logs in real time, use the -f flag, which tells journalctl to follow the log output, similar to tail -f:
```
sudo journalctl -u coldcallgenius.service -f
```
", Assign "at most 3 tags" to the expected json: {"id":"7585","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"