ParallelExtractTool()Parallel Extract Tool.
This tool extracts clean, structured content from web pages using the Parallel Extract API.
Setup:
Install langchain-parallel and set environment variable
PARALLEL_API_KEY.
pip install -U langchain-parallel
export PARALLEL_API_KEY="your-api-key"
Key init args:
api_key: Optional[SecretStr] Parallel API key. If not provided, will be read from PARALLEL_API_KEY env var. base_url: str Base URL for Parallel API. Defaults to "https://api.parallel.ai". max_chars_per_extract: Optional[int] Maximum characters per extracted result.
Instantiation:
from langchain_parallel import ParallelExtractTool
# Basic instantiation
tool = ParallelExtractTool()
# With custom API key and parameters
tool = ParallelExtractTool(
api_key="your-api-key",
max_chars_per_extract=5000
)
Invocation:
# Extract content from URLs
result = tool.invoke({
"urls": [
"https://example.com/article1",
"https://example.com/article2"
]
})
# Result is a list of dicts with url, title, and content
for item in result:
print(f"Title: {item['title']}")
print(f"URL: {item['url']}")
print(f"Content: {item['content'][:200]}...")
Response Format:
Returns a list of dictionaries, each containing: