MeloGenAI: Generating a 🌈Rainbow Playlist 🏳‍🌈 for ChatGPT and YouTube Music
Tags: lgbtq, opensource, music, chatgpt
Published: 2023-06-02 09:16:46

Hello and happy pride month! 🌈

I am thrilled to introduce to the Dev.to community [MeloGenAI](https://www.melogenai.dev/), an [open source](https://github.com/AustinMichaelColeman/melo-gen-ai/) playlist generator plugin that I've developed for both ChatGPT and YouTube Music.

## 🎶 What is MeloGenAI?

MeloGenAI is a playlist generator plugin for ChatGPT. Given a playlist title, a list of songs, and a privacy setting for the playlist, it will return a URL to a YouTube Music playlist. That way if you generate a playlist with ChatGPT, you don't have to manually copy and paste the songs to get a playlist. It automates that process.

## 🌈 A Rainbow-Themed Playlist 

For a quick demonstration, I used MeloGenAI to ask ChatGPT to generate a rainbow-themed playlist in honor of pride month. Check out the process and results in this YouTube video I made: 

[![MeloGenAI Rainbow Playlist](http://img.youtube.com/vi/8pOSu8AR8j0/0.jpg)](http://www.youtube.com/watch?v=8pOSu8AR8j0 "MeloGenAI Rainbow Playlist")

Here is the [Colors of the Rainbow](https://music.youtube.com/playlist?list=PLHue5YJSxY0hyWcMmM73hOqvhCy3wwvLY) playlist it generated.

## 💻 How does it work?
MeloGenAI is a JavaScript API deployed using [Vercel serverless functions](https://vercel.com/docs/concepts/functions/serverless-functions). The process of working with ChatGPT plugins involves writing an endpoint, providing a description of the endpoint, and then ChatGPT uses that description to call your endpoint. For example, here is the [openapi.yaml](https://www.melogenai.dev/openapi.yaml) file for MeloGenAI. It describes one simple endpoint called /playlist which generates a playlist given a name, list of songs, and a privacy setting for the playlist. My API makes calls to YouTube's API to create a playlist, add songs to the playlist, and return the playlist URL for YouTube Music.

## 🕵️‍♀️ The fine details
If you'd like to know some of the finer implementation details, I have mocked the YouTube Service using Jest in my [tests](https://github.com/AustinMichaelColeman/melo-gen-ai/blob/main/src/test/playlist.test.js) for it. The tests mock my [YouTubeService.js](https://github.com/AustinMichaelColeman/melo-gen-ai/blob/main/src/services/YouTubeService.js) script, which is a wrapper around the YouTube API. The tests also contain [Schema Validations](https://github.com/AustinMichaelColeman/melo-gen-ai/blob/main/src/test/playlist.test.js#LL294C54-L294C54) to verify my openapi.yaml spec matches the mocks. [playlist.js](https://github.com/AustinMichaelColeman/melo-gen-ai/blob/main/api/playlist.js) is the main playlist generation endpoint code, while [YouTubeService.js](https://github.com/AustinMichaelColeman/melo-gen-ai/blob/main/src/services/YouTubeService.js) is a wrapper script I wrote for the YouTube Data API. If you'd like to contribute or collaborate, feel free to email me at austin@melogenai.dev


## 🚀 The Future of MeloGenAI

At present, the plugin is still in its development phase and not yet publicly available. However, I am currently in the process of obtaining necessary approvals from both YouTube and OpenAI. The most challenging part of the process has been ensuring that the auth flow aligns with what OpenAI and YouTube expect, as well as adhering to their policies. I have been diligently working to ensure compliance.

Once approved, I hope for MeloGenAI to be accessible to all. I'll make sure to keep you all updated on the progress. 

## 💖 Thank You 

I'm incredibly excited about this project and the potential it has to bring even more joy to music lovers. I've been using it and have been loving it. I hope to share it with you all soon too. I appreciate your interest and support.

Please note that I am an independent developer, and this project is not officially affiliated with nor endorsed by OpenAI or YouTube.

Here's to a bright future filled with even more personalized playlists! Thanks, and happy pride month. 🏳‍🌈