spotify demo with optimized context window code change (#397)

This commit is contained in:
Adil Hafeez 2025-02-07 19:14:15 -08:00 committed by GitHub
parent b3c95a6698
commit 8de6eacfbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 265 additions and 8 deletions

View file

@ -0,0 +1,155 @@
version: v0.1
listener:
address: 127.0.0.1
port: 8080 #If you configure port 443, you'll need to update the listener with tls_certificates
message_format: huggingface
overrides:
optimize_context_window: true
endpoints:
spotify:
endpoint: api.spotify.com
protocol: https
system_prompt: |
I have the following JSON data representing a list of albums from Spotify:
{
"items": [
{
"album_type": "album",
"artists": [
{
"external_urls": {
"spotify": "https://open.spotify.com/artist/06HL4z0CvFAxyc27GXpf02"
},
"href": "https://api.spotify.com/v1/artists/06HL4z0CvFAxyc27GXpf02",
"id": "06HL4z0CvFAxyc27GXpf02",
"name": "Taylor Swift",
"type": "artist",
"uri": "spotify:artist:06HL4z0CvFAxyc27GXpf02"
}
],
"available_markets": [ /* ... markets omitted for brevity ... */ ],
"external_urls": {
"spotify": "https://open.spotify.com/album/1Mo4aZ8pdj6L1jx8zSwJnt"
},
"href": "https://api.spotify.com/v1/albums/1Mo4aZ8pdj6L1jx8zSwJnt",
"id": "1Mo4aZ8pdj6L1jx8zSwJnt",
"images": [
{
"height": 300,
"url": "https://i.scdn.co/image/ab67616d00001e025076e4160d018e378f488c33",
"width": 300
},
{
"height": 64,
"url": "https://i.scdn.co/image/ab67616d000048515076e4160d018e378f488c33",
"width": 64
},
{
"height": 640,
"url": "https://i.scdn.co/image/ab67616d0000b2735076e4160d018e378f488c33",
"width": 640
}
],
"name": "THE TORTURED POETS DEPARTMENT",
"release_date": "2024-04-18",
"release_date_precision": "day",
"total_tracks": 16,
"type": "album",
"uri": "spotify:album:1Mo4aZ8pdj6L1jx8zSwJnt"
}
]
}
Please convert this JSON into Markdown with the following layout for each album:
- Display the album image (using Markdown image syntax) first.
- On the next line immediately after the image, display the album title, artist name (use the first artist listed), and the release date, all separated by a hyphen or another clear delimiter.
- On the next line, provide the Spotify link (using Markdown link syntax).
For example, the output should look similar to this (using the data above):
![Album Image](https://i.scdn.co/image/ab67616d00001e025076e4160d018e378f488c33)
**THE TORTURED POETS DEPARTMENT**
Taylor Swift - 2024-04-18
[Listen on Spotify](https://open.spotify.com/album/1Mo4aZ8pdj6L1jx8zSwJnt)
Arist Id: 06HL4z0CvFAxyc27GXpf02
<hr>
Make sure your output is valid Markdown. And don't say "formatted in Markdown". Thanks!
llm_providers:
- name: OpenAI
provider_interface: openai
access_key: $OPENAI_API_KEY
model: gpt-4o
default: true
prompt_targets:
- name: get_new_releases
description: Get a list of new album releases featured in Spotify (shown, for example, on a Spotify players “Browse” tab).
parameters:
- name: country
description: the country where the album is released
required: true
type: str
in_path: true
- name: limit
type: integer
description: The maximum number of results to return
default: "5"
endpoint:
name: spotify
path: /v1/browse/new-releases
http_headers:
Authorization: "Bearer $SPOTIFY_CLIENT_KEY"
- name: get_artist_top_tracks
description: Get information about an artist's top tracks
parameters:
- name: artist_id
description: The ID of the artist.
required: true
type: str
in_path: true
endpoint:
name: spotify
path: /v1/artists/{artist_id}/top-tracks
http_headers:
Authorization: "Bearer $SPOTIFY_CLIENT_KEY"
# - name: search_for_item
# description: Get information about albums, artists, playlists, tracks, shows, episodes or audiobooks. You can search for an item by its name, creator, or topic.
# parameters:
# - name: q
# description: Your search query, which can include keywords related to the item name, its creator, or its topic.
# required: true
# type: str
# - name: type
# type: str
# description: The type of the item to search for (e.g., album, artist, playlist, track, show, episode, audiobook).
# enum:
# - album
# - artist
# - playlist
# - track
# - show
# - episode
# - audiobook
# required: true
# - name: market
# type: str
# description: A country code
# default: US
# - name: limit
# type: integer
# description: The maximum number of results to return
# default: "5"
# endpoint:
# name: spotify
# path: /v1/search
# http_headers:
# Authorization: "Bearer $SPOTIFY_CLIENT_KEY"