Skip to main content

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

  1. 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

llama_index_readers_readwise-0.2.0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file llama_index_readers_readwise-0.2.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_readers_readwise-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ae77767177696c9651cb0c960a6abbe1c806bc13f1a151223050baa69aafdb53
MD5 d5d3e3c85d27b4f1e59b1f5471c6e9b0
BLAKE2b-256 1bc334c902dc05bf1738755e4c21c5b117974a892e69b7456b3792eee7ab710e

See more details on using hashes here.

File details

Details for the file llama_index_readers_readwise-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_readers_readwise-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f6d6bdc9d08ce2f4e24c0ff315ab2b63513142070ada6c61f6e832f34d57e84b
MD5 c2aed4d3b1cdc3c1c7983c708011513f
BLAKE2b-256 34562b6efc7a5081ffcfcf09a5a43ff9cb68212c2ca329bc36e160e4b1380b58

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page