Live Coding session video! Click here
![spotify](https://private-user-images.githubusercontent.com/16231195/237075611-6cb0863e-6293-4aed-94cb-36dea2f6e7e9.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MzQ4ODYsIm5iZiI6MTcyNDUzNDU4NiwicGF0aCI6Ii8xNjIzMTE5NS8yMzcwNzU2MTEtNmNiMDg2M2UtNjI5My00YWVkLTk0Y2ItMzZkZWEyZjZlN2U5LmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDIxMjMwNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMyMTVmZTYzYzE1ZWJkMzQ1ZjI0ZTYzNjg0NmVjNmNiMjVkZTU5ZTZiOTkwOTQ2MWZkYjg0NTBkOWFhOWRmMDkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.HbRmyIbVJuwQasCBt2wuOIy-oZEmtacWsFYwx-1MDBs)
This is an intro to AI (LLM) Agents using LangChain. The goal is to use natural language commands towards Spotify player to be able to play certain songs. Example queries: "Play Despacito", "I know a song that goes like I was running through the six with my woes. Play me that song", etc..
Please follow the instructions below to setup the project. Play with it, and build on top of it!
- Python
- LangChain (ReAct Agent)
- Spotipy
- Spotify
- OpenAI API
-
Sign up for Spotify and Spotify API (developer.spotify.com)
-
Sign up for OpenAI API Key (platform.openai.com)
-
Create a
.env
file and put these values inOPENAI_API_KEY=********************** SPOTIFY_CLIENT_ID=******************* SPOTIFY_CLIENT_SECRET=*************** SPOTIFY_REDIRECT_URI=****************
-
Create a new Python virtual environment
-
python -m venv spotify-chat
(Mac) -
py -m venv spotify-chat
(Windows 11)
-
-
Install Python requirements in the project repository:
pip install -r requirements.txt
-
Open a Spotify Player (Web or Local)
-
Hit play to activate the player (otherwise Spotify Web API won't recognize it). Then pause.
-
Start virtual environment manually by running:
-
source spotify-chat/bin/activate
(Mac) -
.\spotify-chat\Scripts\activate
(Windows 11)
-
-
Start script: In your Powershell (Windows) or Terminal (Mac), run either
py main.py
(Windows 11) orpython main.py
(Mac)
- If new dependencies are added, add them manually to
requirements.txt