![]() Make sure the songs are popular enough for me to have heard of them.” The prompt was “Give me a list of Cars, Blink 182 and Sum 41 songs that are upbeat, loud and fun. To get the disappointment and/or excitement out of the way early on, here’s the playlist we wind up with at the end: If you are a less technical person, just relax while you’re reading the next few sections! They’re the “why” for how we end up tackling our problem. If you’re a LangChain pro and are just looking for code to run, you can can skip all these words and just visit the GitHub repo Putting it all together to let you, GPT and Spotify and have a little chat about your musical tastes.Combining aspects both to allow LangChain/GPT to use arbitrary Python packages.How LangChain’s APIChain (API access) and PALChain (Python execution) chains are built.Accessing Spotify data through the Spotipy Python library.The Spotipy library is a lot easier to use, but as of this moment it isn’t super-simple to run arbitrary code through LangChain.īut let’s make it happen anyway! In this walkthrough, we’ll look at: Trying to get this to work, you hit a wall pretty quickly: while LangChain supports APIs, the Spotify API is an awful complex OAuth2 beast that doesn’t fit the existing examples. Can we combine this information with LangChain and GPT to talk to Spotify through natural language? Spotify actually knows the diference between a slow song and an upbeat one, although somewhat secretly – they don’t reveal it in the app, but their API includes data for songs like energy level and danceability. They put me to sleep! Instead of screaming at Alexa to “play The Cars” I want to say “play The Cars but none of those boring slow songs.” The Cars have Drive, Green Day has Boulevard of Broken Dreams, Blink 182 has I Miss You. The top track or two for practically any band on Spotify is a slow one. The universal need for on-demand, vibes-based Spotify playlists Hi, I’m Soma! You can find me on email at on Twitter at or maybe even on this newsletter I’ve never sent. ![]() Why this doesn’t work for our Spotify use case. ![]()
0 Comments
Leave a Reply. |