To manage different Python versions, we use pyenv. Follow the installation steps based on your operating system:
- On macOS:
brew update brew install pyenv
- On Ubuntu:
sudo apt update sudo apt install -y build-essential curl libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git curl https://pyenv.run | bash - On Windows:
- Install pyenv-win via pip:
pip install pyenv-win --target %USERPROFILE%\\.pyenv - Alternatively, use the manual installation method:
git clone https://github.com/pyenv-win/pyenv-win.git "$HOME/.pyenv"
- Install pyenv-win via pip:
Add pyenv to your shell by updating your profile:
- For macOS and Linux:
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bash_profile echo 'eval "$(pyenv init --path)"' >> ~/.bash_profile
- For Windows:
- Add
%USERPROFILE%\.pyenv\pyenv-win\binand%USERPROFILE%\.pyenv\pyenv-win\shimsto your system's environment variables under 'Path'.
- Add
To isolate our project dependencies, we'll set up a virtual environment using pyenv and pyenv-virtualenv. Follow these steps:
-
Create a virtual environment:
pyenv virtualenv venv
-
Activate the virtual environment:
pyenv activate venv
With your virtual environment activated, install the required Python packages using pip:
- Install packages:
pip install -r requirements.txt
- Go to your RetellAI Dashboard
- Navigate to AI Agents, and click Add Agent
- Select Connect Your Own Agent
- You can rename the Agent, and choose a voice.
- Note down the Agent ID.
- This needed for the environment variable:
RETELL_AGENT_IDlater. - Agent ID will be specified when using Twilio calls.
- This needed for the environment variable:
- Under Custom LLM URL, paste the LLM websocket url with
/llm-websocketappended to the base URL.- Using ngrok:
wss://abcd-12-34-56-789.ngrok.io/llm-websocket(See Obtain and Set Up ngrok) - Using fly:
wss://pete-ai.fly.dev/llm-websocket
- Using ngrok:
- Login to your Calendly account.
- On the left-hand navigation panel, select
Integration & apps - In the
All integrationssection, selectAPI and webhooks - Click
Generate New Token - Enter a name for your token
- Click on
Copy Token. This will be the environment variable:CALENDLY_API_KEY
- Create a new project
- Navigate to your Google Cloud Console
- On the upper taskbar, next to the Google Cloud icon on the left-hand side, click the dropdown menu.
- On the upper right-hand corner, click
New Project, and create a new project. - Navigate to your project's dashboard by clicking the project name on the home page.
- You can find this in the section under your name. With the text:
You're working on project <your-project-name>
- You can find this in the section under your name. With the text:
- Enable Google Calendar API
- On the project dashboard, select
APIs & Serviceson the left-hand panel. - On the search bar, search for
Google Calendar. SelectGoogle Calendar APIthen clickEnable - Navigate back to your project's dashboard, then select
APIs & Services, then selectCredentials - On the upper taskbar, click
CREATE CREDENTIALSthen selectOAuth client ID- Select
External, then enter relevant information for your app such asApp Name, and yourEmail - In the
Scopestab, selectADD OR REMOVE SCOPES, then select the ff scopes:.../auth/userninfo.email.../auth/userinfo.profileopenid
- In the
Test userstab, selectADD USERS, here you can add email addresses for test users. - Click
Next and ContinuethenBack To Dashboard
- Select
- On the left-hand navigation panel, navigate to
Credentials, then clickCREATE CREDENTIALSthen selectOAuth client ID.- Select
Desktop appas application type. - A popup window will appear, confirming OAuth client has been created. In the popup window, click on
DOWNLOAD JSON - Rename this file to
credentials.json, and move it to thescriptsfolder in your project directory.
- Select
- On the project dashboard, select
- Generating the Token
- Run the file
scripts/create_google_token.py. This will create atoken.jsonfile. - You will be redirected to google. Authenticate with your email, then click
Continue - Copy the contents, this will be the value of the environment variable
GOOGLE_TOKEN
- Run the file
- Copy the
.env.examplefile to create a.envfile:cp .env.example .env
- Manually edit the
.envfile and add your environment variables:OPENAI_API_KEY=your-openai-api-keyRETELL_API_KEY=your-retell-api-keyRETELL_AGENT_ID=your-retell-agent-idCALENDLY_API_KEY=your-calendly-api-keyGOOGLE_TOKEN=your-google-token
- Download and install ngrok from ngrok's website.
- Start ngrok with the following command to expose port 8080:
ngrok http 8080
- Note the https URL that ngrok provides. You will need this URL to configure Slack to send events to your local machine.
- You can set the
--subdomainargument to pass in a different subdomain if you're using a paid version of Ngrok.
- Enter the following command on the terminal to run the server
uvicorn main:app --host 0.0.0.0 --port 8080