LlamaIndex Readers Integration: ContextFetch
pip install llama-index-readers-contextfetch
The ContextFetch reader loads web pages as LlamaIndex Documents with the page's Markdown as text, using the ContextFetch API. Give it URLs, a web search query, or both.
Pass api_key, or set the CONTEXTFETCH_API_KEY environment variable. With
neither, requests use ContextFetch's keyless tier, a small daily allowance per IP.
The contextfetch package can request a free starter key:
from contextfetch import ContextFetch; ContextFetch().free_key().
Usage
from llama_index.core import VectorStoreIndex
from llama_index.readers.contextfetch import ContextFetchReader
reader = ContextFetchReader() # or ContextFetchReader(api_key="...")
# Pages by URL
documents = reader.load_data(
urls=["https://docs.python.org/3/library/asyncio-task.html"]
)
# The pages a web search finds
documents = reader.load_data(query="asyncio task groups", num_results=5)
index = VectorStoreIndex.from_documents(documents)
Each Document has id_ set to its URL and metadata url, title and, when the
page provides them, published_date and author. A URL that fails to load is
skipped and logged as a warning.
This loader is designed to be used as a way to load data into LlamaIndex.
For an agent tool, see llama-index-tools-contextfetch.
Metadata
Release files for llama-index-readers-contextfetch 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llama_index_readers_contextfetch-0.1.0.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llama_index_readers_contextfetch-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / llama_index_readers_contextfetch-0.1.0.tar.gz
| Download URL | llama_index_readers_contextfetch-0.1.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c53896bad2ae3c8df52f41ca600ba7780f73b6ed6110b001c7c16a5a157558c5
|
|
BLAKE2b-256 checksum How to use checksums |
b417d8d2b1d54c01ddb68d3d1ff5e43d6491ee60914245ff9a63881a05dc88a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / llama_index_readers_contextfetch-0.1.0-py3-none-any.whl
| Download URL | llama_index_readers_contextfetch-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca353283a02d21b5fb0bcef4cb49d9ea09d36c12874184607c2891171d7ff33d
|
|
BLAKE2b-256 checksum How to use checksums |
26c4bbcb8d1301ad1053b6229ec8f49293ccc97d98dc86e5d2e67b08a0d8f8b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|