https://github.com/trancethehuman/spotify-chat
Chat with your Spotify account using GPT & LangChain AI Agent
https://github.com/trancethehuman/spotify-chat
Last synced: 4 months ago
JSON representation
Chat with your Spotify account using GPT & LangChain AI Agent
- Host: GitHub
- URL: https://github.com/trancethehuman/spotify-chat
- Owner: trancethehuman
- Created: 2023-05-04T17:59:02.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-14T21:37:42.000Z (almost 2 years ago)
- Last Synced: 2024-12-01T02:26:20.614Z (5 months ago)
- Language: Python
- Homepage:
- Size: 251 KB
- Stars: 83
- Watchers: 4
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
- jimsghstars - trancethehuman/spotify-chat - Chat with your Spotify account using GPT & LangChain AI Agent (Python)
README
# Spotify GPT Agent
## Overview
### Demo
[Live Coding session video! Click here](https://www.youtube.com/live/RPloCT-0Xag?feature=share&t=2335)
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!
## Tech Overview
- Python
- [LangChain (ReAct Agent)](https://python.langchain.com/en/latest/modules/agents.html)
- [Spotipy](https://spotipy.readthedocs.io/en/2.22.1/)
- Spotify
- OpenAI API## Setup
1. Sign up for Spotify and Spotify API ([developer.spotify.com](developer.spotify.com))
2. Sign up for OpenAI API Key ([platform.openai.com](https://platform.openai.com/overview))
3. Create a `.env` file and put these values in
```
OPENAI_API_KEY=**********************
SPOTIFY_CLIENT_ID=*******************
SPOTIFY_CLIENT_SECRET=***************
SPOTIFY_REDIRECT_URI=****************
```4. Create a new Python virtual environment
- `python -m venv spotify-chat` (Mac)
- `py -m venv spotify-chat` (Windows 11)
5. Install Python requirements in the project repository: `pip install -r requirements.txt`
## Usage
1. Open a Spotify Player (Web or Local)
2. Hit play to activate the player (otherwise Spotify Web API won't recognize it). Then pause.
3. Start virtual environment manually by running:
- `source spotify-chat/bin/activate` (Mac)
- `.\spotify-chat\Scripts\activate` (Windows 11)
4. Start script: In your Powershell (Windows) or Terminal (Mac), run either `py main.py` (Windows 11) or `python main.py` (Mac)
## Development
1. If new dependencies are added, add them manually to `requirements.txt`