OpenAI bot: "persona.py" implements our instance of OpenAI, which reacts to the chat logs collected from the Twitch account, and connects with the text-to-speech implemented in /tts_utils
Stability AI:
Working with the Conda Environment (click to expand)
This project uses a conda environment to manage dependencies. To set up the environment on your local machine, follow these steps:
-
Install Miniconda or Anaconda:
If you haven't already, install Miniconda or Anaconda on your machine. Visit Miniconda or Anaconda for installation instructions.
-
Create the Environment:
Navigate to the project directory and run the following command to create a conda environment from the
environment.yml
file:
conda env --name myenv create -f environment.yml
-
Activate the Environment:
Once the environment is created, you can activate it using:
conda activate myenv
Replace myenv
with the name of the environment specified in the environment.yml
file.
If you need to install additional packages, make sure to activate the environment and use:
conda install package-name
Or, if the package is only available via pip (still check installation guide for the specific package):
pip install package-name
There may be other ways to install a package for example using conda-forge
( conda install package -c conda-forge
) so always look for instructions online.
If you've added new packages or made other changes to the environment that you want to share with the team, you can update the environment.yml
file by running:
conda env export --from-history > environment.yml
Note: The yml file contains prefix
field which relates to the path of the environment locally, conda however, doesn't care and besides manually deleting the line there doens't seem to be a way to avoid creating that line when exporting.
Note: Use the --from-history
flag to only include packages you've explicitly installed, avoiding platform-specific packages in the environment file.
After updating the environment.yml
file, commit and push the changes to the GitHub repository so the team members can update their environments by running:
conda env update --file environment.yml --prune
The --prune
option removes any dependencies that are no longer needed from the environment.
To make your conda environment visible to JupyterLab you need to add your environment by creating a kernel spec:
python -m ipykernel install --user --name YourEnvironmentName --display-name "Display Name"
- Intall JupyterLab:
pip3 install jupyter
- Navigate to the notebooks directory:
cd notebooks
- Run JupyterLab
jupyter lab
- Create Conda environment
cd src
conda env create --name myenv -f environment.yml
Change myenv for the name you want.
- Create .env
Create .env and change the placeholders for your keys/tokens
AUTH_TOKEN_STABILITY_AI='Your Stability AI token'
First to use the code you need to install irc
using pip. Locate the pip of your conda environment and use the specific pip.
conda activate myenv
echo $CONDA_PREFIX
[YOUR PREFIX]/bin/pip(3) install irc
It may be pip or pip3
- Setup TWITCH_CLIENT_ID Useful reference
After you obtain TWITCH_CLIENT_ID, put it inside the .env file.
---rest of the file---
TWITCH_CLIENT_ID='YOUR TWITCH CLIENT ID'
---rest of the file---
- Setup TWITCH_OAUTH_TOKEN
Connect using link, this will prompt you to connect oauth with twitch. It will then generate OAUTH token. It will look something like this:
oauth::YOUR-TOKEN
After you obtain the OAUTH token, put it inside the.env file.
---rest of the file---
TWITCH_OAUTH_TOKEN='YOUR TWITCH OAUTH TOKEN'
---rest of the file---
Check your oauth token and also the relevant client id with the following command:
curl -X GET 'https://id.twitch.tv/oauth2/validate' \
-H 'Authorization: OAuth <replace with your oauth token>'
-
Install openai through pip
-
Add OPENAI_API_KEY to .env
---rest of the file---
OPENAI='YOUR OPENAI API KEY'
---rest of the file---
- Install elevenlabs through pip
There isn't a way to install the elevenlabs package through conda so just install it into conda with its appropriate pip.
echo $CONDA_PREFIX
[YOUR PREFIX]/bin/pip(3) install elevenlabs
It may be pip or pip3
- Add ELEVEN_API_KEY to .env
---rest of the file---
ELEVEN_API_KEY='YOUR ELEVEN LABS API KEY'
---rest of the file---
- Installing ffmpeg
(Need to add the actual instructions...) Follow instructions here
If you want to just put something in its chat use this link