langchain-wtmapi
LangChain Document Loader for WTM API — convert any webpage to clean, structured Markdown.
Installation
pip install langchain-wtmapi
Quick Start
from langchain_wtmapi import WTMApiLoader
# Get your free API key at https://wtmapi.com
loader = WTMApiLoader(
urls=[
"https://en.wikipedia.org/wiki/Artificial_intelligence",
"https://developer.mozilla.org/en-US/docs/Web/JavaScript",
],
api_key="wtm_your_api_key",
)
# Load all documents
docs = loader.load()
for doc in docs:
print(f"Source: {doc.metadata['source']}")
print(f"Length: {doc.metadata['length']} chars")
print(f"Response time: {doc.metadata['response_time_ms']}ms")
print(doc.page_content[:500])
print("---")
Lazy Loading
For large batches, use lazy loading to process documents one at a time:
for doc in loader.lazy_load():
# Process each document as it's loaded
process_document(doc)
Use with RAG Pipeline
from langchain_wtmapi import WTMApiLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_openai import OpenAIEmbeddings
from langchain_community.vectorstores import FAISS
# Load web pages as Markdown
loader = WTMApiLoader(
urls=["https://docs.python.org/3/tutorial/index.html"],
api_key="wtm_your_api_key",
)
docs = loader.load()
# Split into chunks
splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
chunks = splitter.split_documents(docs)
# Create vector store
embeddings = OpenAIEmbeddings()
vectorstore = FAISS.from_documents(chunks, embeddings)
# Query
results = vectorstore.similarity_search("How do I use lists in Python?")
Options
| Parameter | Type | Default | Description |
|---|---|---|---|
urls |
list[str] |
required | List of URLs to convert |
api_key |
str |
required | Your WTM API key |
include_links |
bool |
True |
Include links in output |
include_images |
bool |
True |
Include images in output |
api_url |
str |
https://wtmapi.com/api/v1/convert |
API endpoint |
Document Metadata
Each loaded document includes metadata:
{
"source": "https://example.com", # Original URL
"length": 15234, # Markdown length in chars
"response_time_ms": 523, # API response time
"usage_used": 5, # Monthly calls used
"usage_limit": 50, # Monthly call limit
"plan": "free", # Current plan
}
Get Your API Key
Sign up at wtmapi.com — free tier includes 50 calls/month, no credit card required.
License
MIT
Metadata
Release files for langchain-wtmapi 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 | |
|---|---|---|---|
| langchain_wtmapi-0.1.0.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_wtmapi-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / langchain_wtmapi-0.1.0.tar.gz
| Download URL | langchain_wtmapi-0.1.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e4b2dc9f8e75d4332481e46b32054dac9e8e85e09d16fbad635415ae347bdd3
|
|
BLAKE2b-256 checksum How to use checksums |
6e592bc09923e795c625333756577ecc0998a61791dbbdbb523a3b5420935d09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / langchain_wtmapi-0.1.0-py3-none-any.whl
| Download URL | langchain_wtmapi-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
785b8103a1501edbf1bb2a83aaf97e78ed321031a2fea9d34c1413125f37e8cc
|
|
BLAKE2b-256 checksum How to use checksums |
b668bc10e993b4f71dde7bd7e13a29960105d79263f495a885c5743f5bd4ec5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|