llama-index readers readwise integration
Project description
Readwise Reader
pip install llama-index-readers-readwise
Use Readwise's export API to fetch your highlights from web articles, epubs, pdfs, Kindle, YouTube, and load the resulting text into LLMs.
Setup
- Get your Readwise API key from readwise.io/access_token.
Usage
Here is an example usage of the Readwise Reader:
import os
from llama_index.core import VectorStoreIndex, download_loader
from llama_index.readers.readwise import ReadwiseReader
token = os.getenv("READWISE_API_KEY")
loader = ReadwiseReader(api_key=token)
documents = loader.load_data()
index = VectorStoreIndex.from_documents(documents)
index.query("What was the paper 'Attention is all you need' about?")
You can also query for highlights that have been created after a certain time:
import os
import datetime
from llama_index.core import VectorStoreIndex, download_loader
from llama_index.readers.readwise import ReadwiseReader
token = os.getenv("READWISE_API_KEY")
loader = ReadwiseReader(api_key=token)
seven_days_ago = datetime.datetime.now() - datetime.timedelta(days=7)
documents = loader.load_data(updated_after=seven_days_ago)
index = VectorStoreIndex.from_documents(documents)
index.query("What has Elon Musk done this time?")
This loader is designed to be used as a way to load data into LlamaIndex.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file llama_index_readers_readwise-0.2.0.tar.gz
.
File metadata
- Download URL: llama_index_readers_readwise-0.2.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae77767177696c9651cb0c960a6abbe1c806bc13f1a151223050baa69aafdb53 |
|
MD5 | d5d3e3c85d27b4f1e59b1f5471c6e9b0 |
|
BLAKE2b-256 | 1bc334c902dc05bf1738755e4c21c5b117974a892e69b7456b3792eee7ab710e |
File details
Details for the file llama_index_readers_readwise-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_readers_readwise-0.2.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6d6bdc9d08ce2f4e24c0ff315ab2b63513142070ada6c61f6e832f34d57e84b |
|
MD5 | c2aed4d3b1cdc3c1c7983c708011513f |
|
BLAKE2b-256 | 34562b6efc7a5081ffcfcf09a5a43ff9cb68212c2ca329bc36e160e4b1380b58 |