Name | llama-index-readers-genius JSON |
Version |
0.1.2
JSON |
| download |
home_page | |
Summary | llama-index readers genius integration |
upload_time | 2024-02-21 19:54:23 |
maintainer | |
docs_url | None |
author | Your Name |
requires_python | >=3.8.1,<4.0 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# LlamaIndex Readers Integration: Genius
This loader connects to the Genius API and loads lyrics, metadata, and album art into `Documents`.
As a prerequisite, you will need to register with [Genius API](https://genius.com/api-clients) and create an app in order to get a `client_id` and a `client_secret`. You should then set a `redirect_uri` for the app. The `redirect_uri` does not need to be functional. You should then generate an access token as an instantiator for the GeniusReader.
## Usage
Here's an example usage of the GeniusReader. It will retrieve songs that match specific lyrics. Acceptable arguments are lyrics (str): The lyric snippet you're looking for and will return List[Document]: A list of documents containing songs with those lyrics.
## GeniusReader Class Methods
### `load_artist_songs`
- **Description**: Fetches all or a specified number of songs by an artist.
- **Arguments**:
- `artist_name` (str): The name of the artist.
- `max_songs` (Optional[int]): Maximum number of songs to retrieve.
- **Returns**: List of `Document` objects with song lyrics.
### `load_all_artist_songs`
- **Description**: Fetches all songs of an artist and saves their lyrics.
- **Arguments**:
- `artist_name` (str): The name of the artist.
- **Returns**: List of `Document` objects with the artist's song lyrics.
### `load_artist_songs_with_filters`
- **Description**: Loads the most or least popular song of an artist based on filters.
- **Arguments**:
- `artist_name` (str): The artist's name.
- `most_popular` (bool): `True` for most popular song, `False` for least popular.
- `max_songs` (Optional[int]): Max number of songs to consider for popularity.
- `max_pages` (int): Max number of pages to fetch.
- **Returns**: `Document` with lyrics of the selected song.
### `load_song_by_url_or_id`
- **Description**: Loads a song by its Genius URL or ID.
- **Arguments**:
- `song_url` (Optional[str]): URL of the song on Genius.
- `song_id` (Optional[int]): ID of the song on Genius.
- **Returns**: List of `Document` objects with the song's lyrics.
### `search_songs_by_lyrics`
- **Description**: Searches for songs by a snippet of lyrics.
- **Arguments**:
- `lyrics` (str): Lyric snippet to search for.
- **Returns**: List of `Document` objects with songs matching the lyrics.
### `load_songs_by_tag`
- **Description**: Loads songs by a specific tag or genre.
- **Arguments**:
- `tag` (str): Tag or genre to search for.
- `max_songs` (Optional[int]): Max number of songs to fetch.
- `max_pages` (int): Max number of pages to fetch.
- **Returns**: List of `Document` objects with song lyrics.
```python
from llama_index.core.readers import download_loader
GeniusReader = download_loader("GeniusReader")
access_token = "your_generated_access_token"
loader = GeniusReader(access_token)
documents = loader.search_songs_by_lyrics("Imagine")
```
## Example
This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index) and/or subsequently used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent.
### LlamaIndex
```python
from llama_index.core import VectorStoreIndex, download_loader
GeniusReader = download_loader("GeniusReader")
access_token = "your_generated_access_token"
loader = GeniusReader(access_token)
documents = loader.search_songs_by_lyrics("Imagine")
index = VectorStoreIndex.from_documents(documents)
index.query(
"What artists have written songs that have the lyrics imagine in them?"
)
```
Raw data
{
"_id": null,
"home_page": "",
"name": "llama-index-readers-genius",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8.1,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Your Name",
"author_email": "you@example.com",
"download_url": "https://files.pythonhosted.org/packages/7f/55/1fd2f5f39d5c256dba82bbce29624afb4a38a784933947b0fbc0e78b3b70/llama_index_readers_genius-0.1.2.tar.gz",
"platform": null,
"description": "# LlamaIndex Readers Integration: Genius\n\nThis loader connects to the Genius API and loads lyrics, metadata, and album art into `Documents`.\n\nAs a prerequisite, you will need to register with [Genius API](https://genius.com/api-clients) and create an app in order to get a `client_id` and a `client_secret`. You should then set a `redirect_uri` for the app. The `redirect_uri` does not need to be functional. You should then generate an access token as an instantiator for the GeniusReader.\n\n## Usage\n\nHere's an example usage of the GeniusReader. It will retrieve songs that match specific lyrics. Acceptable arguments are lyrics (str): The lyric snippet you're looking for and will return List[Document]: A list of documents containing songs with those lyrics.\n\n## GeniusReader Class Methods\n\n### `load_artist_songs`\n\n- **Description**: Fetches all or a specified number of songs by an artist.\n- **Arguments**:\n - `artist_name` (str): The name of the artist.\n - `max_songs` (Optional[int]): Maximum number of songs to retrieve.\n- **Returns**: List of `Document` objects with song lyrics.\n\n### `load_all_artist_songs`\n\n- **Description**: Fetches all songs of an artist and saves their lyrics.\n- **Arguments**:\n - `artist_name` (str): The name of the artist.\n- **Returns**: List of `Document` objects with the artist's song lyrics.\n\n### `load_artist_songs_with_filters`\n\n- **Description**: Loads the most or least popular song of an artist based on filters.\n- **Arguments**:\n - `artist_name` (str): The artist's name.\n - `most_popular` (bool): `True` for most popular song, `False` for least popular.\n - `max_songs` (Optional[int]): Max number of songs to consider for popularity.\n - `max_pages` (int): Max number of pages to fetch.\n- **Returns**: `Document` with lyrics of the selected song.\n\n### `load_song_by_url_or_id`\n\n- **Description**: Loads a song by its Genius URL or ID.\n- **Arguments**:\n - `song_url` (Optional[str]): URL of the song on Genius.\n - `song_id` (Optional[int]): ID of the song on Genius.\n- **Returns**: List of `Document` objects with the song's lyrics.\n\n### `search_songs_by_lyrics`\n\n- **Description**: Searches for songs by a snippet of lyrics.\n- **Arguments**:\n - `lyrics` (str): Lyric snippet to search for.\n- **Returns**: List of `Document` objects with songs matching the lyrics.\n\n### `load_songs_by_tag`\n\n- **Description**: Loads songs by a specific tag or genre.\n- **Arguments**:\n - `tag` (str): Tag or genre to search for.\n - `max_songs` (Optional[int]): Max number of songs to fetch.\n - `max_pages` (int): Max number of pages to fetch.\n- **Returns**: List of `Document` objects with song lyrics.\n\n```python\nfrom llama_index.core.readers import download_loader\n\nGeniusReader = download_loader(\"GeniusReader\")\n\naccess_token = \"your_generated_access_token\"\n\nloader = GeniusReader(access_token)\ndocuments = loader.search_songs_by_lyrics(\"Imagine\")\n```\n\n## Example\n\nThis loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index) and/or subsequently used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent.\n\n### LlamaIndex\n\n```python\nfrom llama_index.core import VectorStoreIndex, download_loader\n\nGeniusReader = download_loader(\"GeniusReader\")\n\naccess_token = \"your_generated_access_token\"\n\nloader = GeniusReader(access_token)\ndocuments = loader.search_songs_by_lyrics(\"Imagine\")\nindex = VectorStoreIndex.from_documents(documents)\nindex.query(\n \"What artists have written songs that have the lyrics imagine in them?\"\n)\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "llama-index readers genius integration",
"version": "0.1.2",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "21ed2c675488d456bb426fc6fc28bb465d49c29912c07713db2ab551c9bb9add",
"md5": "4ba8f079ed3b24bd7bf70852469293c7",
"sha256": "7d98bd0f1dabc1566cd313750ba101ff54483f3c1f9fdb31e2c76455d22cfced"
},
"downloads": -1,
"filename": "llama_index_readers_genius-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4ba8f079ed3b24bd7bf70852469293c7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.1,<4.0",
"size": 4163,
"upload_time": "2024-02-21T19:54:22",
"upload_time_iso_8601": "2024-02-21T19:54:22.001241Z",
"url": "https://files.pythonhosted.org/packages/21/ed/2c675488d456bb426fc6fc28bb465d49c29912c07713db2ab551c9bb9add/llama_index_readers_genius-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7f551fd2f5f39d5c256dba82bbce29624afb4a38a784933947b0fbc0e78b3b70",
"md5": "36918e02cba0286e98e17bf76ec96b7b",
"sha256": "5bf2f67589cc6900bf0cd619547a39cd1a61f9f1aa60519b47743e7f46078ddd"
},
"downloads": -1,
"filename": "llama_index_readers_genius-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "36918e02cba0286e98e17bf76ec96b7b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.1,<4.0",
"size": 3797,
"upload_time": "2024-02-21T19:54:23",
"upload_time_iso_8601": "2024-02-21T19:54:23.023014Z",
"url": "https://files.pythonhosted.org/packages/7f/55/1fd2f5f39d5c256dba82bbce29624afb4a38a784933947b0fbc0e78b3b70/llama_index_readers_genius-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-21 19:54:23",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-readers-genius"
}