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.3.0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for llama_index_readers_readwise-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ba11589b49d3e9f8e5868ce7aba4f152619743886aa2c828eb075121d9797486
MD5 8dc0c70782263941b599b130258f2619
BLAKE2b-256 2c8088fe5142e42be6f2b97c1eaf79607dae41f271bbd68c2dc94e0a4d8dabd8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_readers_readwise-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aef02ba5f2198dfd6dbdb30ca7338018b355110fb02543e7a5de19e47b111ab7
MD5 26bc0ab03b8eaeba8a7669a190e7860a
BLAKE2b-256 36ae36c4f04f7b12749bd6e8279536ae4bf9e0fe7ff006cf0fad1a44160f6070

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