OpenAI Account (https://platform.openai.com/apps).
Postfix for sending emails
Python, for ChatGPT query service
PHP 8
Chroma database
MariaDB 10
Apache
apt update apt install python3 python3-pip pip install websocket-client pip install asyncio
wget https://raw.githubusercontent.com/VitalPBX/vitalpbx_ai_support/main/requirements.txt
pip install -r requirements.txt
This example is made to work with Postfix, so we recommend you configure it correctly before proceeding.
Install Postfix
sudo apt install postfix
wget https://raw.githubusercontent.com/VitalPBX/vitalpbx_ai_support/main/vpbx_agentai.sql mysql -u root -e "CREATE DATABASE vpbx_agentai;" mysql -u root vpbx_agentai < vpbx_agentai.sql
Create User
mysql -u root GRANT ALL PRIVILEGES ON vpbx_agentai.* TO myuser@'localhost' IDENTIFIED BY 'mypassword'; FLUSH PRIVILEGES; exit;
Download the script
wget https://raw.githubusercontent.com/VitalPBX/vitalpbx_ai_support/main/install.sh
Give execution permissions
chmod +x install.sh
Run the script
./install.sh
Now we are going to edit the .env file to add the Openai API Key and the paths to the documents and the ChromaDB database.
cd /usr/share/vpbx_ai_support/ nano .env
Later we are going to edit the database.php file to configure the access credentials to the amriadb database
cd /var/www/vpbx_ai_support/html/ nano dtabase.php
In vpbxaisupport.py change the route of valid certificate
ssl_cert = "/usr/share/PathToCertificate/bundle.pem" ssl_key = "/usr/share/PathToCertificate/private.pem"
To transfer our documents to the ChromaDB database we must do the following:
1.- Upload the document to the /usr/share/vpbx_ai_support/docs folder with the information to use for the query with ChatGPT-Embedded
2.- To transfer this document to a Vector database (ChromaDB), proceed to execute the following command.
cd /usr/share/vpbx_ai_support/ ./embedded-docs.py
Remember to create the Apache configuration file to access the web site (/etc/apache2/sites-available).
We can see an example of the configuration in the following file:
mysite.com.conf
Remember to unblock port 3002 or the one you decided to use in the VitalPBx firewall as in any other firewall that VitalPBX has in front of you.
To make sure everything is fine, we can run the following command.
netstat -tuln | grep 3002
And it would have to return the following to us:
tcp 0 0 192.168.57.50:3002 0.0.0.0:* LISTEN tcp 0 0 127.0.1.1:3002 0.0.0.0:* LISTEN
192.168.57.50 is our public or private IP.