DJ-GPT (WIP)



Live Demo Badge Live Demo Badge


Features

The website provides a form where users can enter a description of the playlist they want, the website also fetches the users top tracks and provides a nice UI for adding tracks to the prompt. Those tracks will be included in the playlist and serve as extra context for the LLM. The backend also creates the playlist for you in Spotify and returns a link back to the frontend to be opened when the generation is complete.


Design Choices

This project was an idea I had for a while, or creating an AI playlist generator similar to the Spotify remix feature. I decided to use React on the frontend as I had already done one other project in react Statify. I also chose to use TypeScript, unlike Statify, mainly just for a change and I had never really used it in a proper project so it was nice to get some experience with it.


For the backend I chose Python as I wanted to try FastAPI and was a bit tired of node anyway. The Pydantic request validation really impressed me with how well it works, for so little setup. And the OpenAI API and Python client were super easy to get setup. I also took the opportunity to learn docker and docker-compose, which made deploying super smooth through Railway


One of the challenges I faced was that the OpenAI API endpoints don't always return the same structure of response. So, for example the response object had an ouput property which was an array, containing an object with the content property with the actual text response in it. However, this array had other things in it too and was not always sorted the same, so I had to implement a search over the array for the correct item.


Improvements (In Development)

A proper prompt evaluation and engineering strategy, I've started writing evals in OpenAI's prompt platform and need to conduct tests and iterate on prompts. The app works well enough most of the time, in that a good portion of the songs will be relevant to the mood or seed songs. However, you'll also get a few songs that make no sense being there.


An agent mode, I think this problem would actually be solved better using an agentic approach and giving the LLM access to APIs like last.fm to find more relevant songs. Also, having the agent check songs against the Spotify API as sometimes it does just make up non-existent songs and these have to be filtered manually in code. There are a bunch of tools I can think of that would be useful to an agent, so this is primarily my focus and what I'm currently working on.