Read the web as clean AIDocuments through Lyrenth (with LangChain and LlamaIndex adapters).
Project description
lyrenth (Python)
Read the web as clean AIDocuments through Lyrenth, with first-class LangChain and LlamaIndex adapters.
Each URL resolves to a stable AIDocument: cleaned Markdown plus title, description, and structure, with navigation and boilerplate stripped. Reads go through Lyrenth's cross-caller cache, and for verified domains you get the publisher's canonical version.
Install
pip install lyrenth # core client, zero dependencies
pip install 'lyrenth[langchain]' # + LangChain loader
pip install 'lyrenth[llamaindex]' # + LlamaIndex reader
Get a free API key at https://lyrenth.com/signup (2,000 reads/month, no card)
and set it as LYRENTH_API_KEY.
Client
from lyrenth import Lyrenth
client = Lyrenth() # reads LYRENTH_API_KEY from the environment
doc = client.read("https://example.com/article")
print(doc.title)
print(doc.markdown) # cleaned, agent-ready body
print(doc.word_count)
print(doc.raw) # full v2 envelope if you need structure/economics
# just the text:
text = client.read_markdown("https://example.com/article")
# force a fresh fetch instead of the cached version:
fresh = client.read("https://example.com/article", fresh=True)
# cap the body to a context budget:
small = client.read("https://example.com/article", max_tokens=500)
# up to 20 URLs in one call (each result isolated):
for r in client.read_batch(["https://a.com", "https://b.com"]):
print(r.document.title if r.ok else f"{r.url}: {r.error}")
LangChain
from lyrenth.langchain import LyrenthLoader
docs = LyrenthLoader(
["https://example.com/a", "https://example.com/b"]
).load()
# -> list[langchain_core.documents.Document]
# page_content = cleaned Markdown
# metadata = {source, title, description, word_count}
Use it anywhere a LangChain loader fits (RAG ingestion, splitters, vector
stores). lazy_load() streams documents one URL at a time.
LlamaIndex
from lyrenth.llamaindex import LyrenthReader
docs = LyrenthReader().load_data(["https://example.com/a"])
# -> list[llama_index.core.Document] (text = cleaned Markdown)
Why read through Lyrenth
- Cleaner, cheaper. One stable shape per URL, far fewer tokens than raw HTML.
- Cached across callers. Repeat URLs collapse to a minimal number of origin fetches, so it is fast and origin-friendly.
- Canonical when verified. When a site's owner has verified with Lyrenth, you get the version they authored, kept fresh by their change signal.
Config
| Argument / env | Default | Notes |
|---|---|---|
api_key / LYRENTH_API_KEY |
none | Free key at https://lyrenth.com/signup |
base_url |
https://api.lyrenth.com |
Override for staging / self-host |
The AIDocument format is an open contract; see https://lyrenth.com/llms-full.txt. MIT licensed.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lyrenth-0.1.1.tar.gz.
File metadata
- Download URL: lyrenth-0.1.1.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
551abeb718b785c51b9cc72e637b39b7fc727308f54005c11ddd5f114cee523b
|
|
| MD5 |
42dca4543448ead8db9cdac80f88a339
|
|
| BLAKE2b-256 |
dd843bed84abad0f5f3dafd7dbb98f4a32c7d127d8c72c304927a3b6a395c2d4
|
File details
Details for the file lyrenth-0.1.1-py3-none-any.whl.
File metadata
- Download URL: lyrenth-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46b480e45a780447755bcfc130beddfa223c9232260d44a3e2b35660e896c871
|
|
| MD5 |
6bd4bfd116f0f30fb1c48c0b53b1e5b3
|
|
| BLAKE2b-256 |
59ae68cb72a61376ff0df3c088b0a8cd389e7aa3c85477b3f98d400bf423226c
|