Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.langchain.com/llms.txt

Use this file to discover all available pages before exploring further.

ParallelSearchRetriever is a LangChain BaseRetriever backed by Parallel’s Search API. It returns list[Document] with rich metadata (url, title, publish_date, search_id, excerpts, query) and slots into any RAG pipeline.
Looking for an LLM-callable tool that returns the raw search response instead of Documents? See ParallelSearchTool.

Overview

Integration details

ClassPackageJS supportPackage latest
ParallelSearchRetrieverlangchain-parallelPyPI - Latest version

Setup

The integration lives in the langchain-parallel package.
pip install -U langchain-parallel

Credentials

Head to Parallel to sign up and generate an API key. Set PARALLEL_API_KEY in your environment:
import getpass
import os

if not os.environ.get("PARALLEL_API_KEY"):
    os.environ["PARALLEL_API_KEY"] = getpass.getpass("Parallel API key:\n")

Instantiation

from langchain_parallel import ParallelSearchRetriever

retriever = ParallelSearchRetriever(
    max_results=3,
    excerpts={"max_chars_per_result": 800},
)

Usage

Each returned Document has its excerpts joined into page_content and exposes the source URL, title, and publish date in metadata:
docs = retriever.invoke("breakthroughs in fusion energy 2025")
for d in docs:
    print(d.metadata.get("title"), "—", d.metadata.get("url"))
    print(d.page_content[:200], "...\n")
Net energy gain in fusion: NIF results — https://www.nature.com/articles/...
The National Ignition Facility achieved net energy gain on December 5, 2022 ...

Commonwealth Fusion's SPARC milestone — https://news.mit.edu/...
SPARC is on track for first plasma in 2026 ...
Pass an objective for a richer retrieval target alongside the keyword search_queries. The retriever forwards source and fetch policies to the underlying Search API.
configured = ParallelSearchRetriever(
    max_results=5,
    excerpts={"max_chars_per_result": 1500},
    mode="basic",  # 'basic' (lower latency) or 'advanced' (higher quality)
    source_policy={
        "include_domains": ["nature.com", "science.org", "iter.org"],
    },
)

docs = configured.invoke(
    "What's the latest peer-reviewed result on net-energy-gain fusion?"
)

Async

docs = await retriever.ainvoke("Latest GLP-1 trial results 2025")

Use within a chain

ParallelSearchRetriever plugs into any LangChain chain:
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.runnables import RunnablePassthrough
from langchain.chat_models import init_chat_model

llm = init_chat_model(model="claude-opus-4-7")

prompt = ChatPromptTemplate.from_messages([
    ("system", "Answer using only the context below. Cite URLs."),
    ("human", "Context:\n{context}\n\nQuestion: {question}"),
])

def format_docs(docs):
    return "\n\n".join(
        f"[{d.metadata.get('url')}] {d.page_content[:500]}" for d in docs
    )

chain = (
    {"context": retriever | format_docs, "question": RunnablePassthrough()}
    | prompt
    | llm
    | StrOutputParser()
)

chain.invoke("What was the most recent fusion energy breakthrough?")

API reference

For detailed documentation, head to the ParallelSearchRetriever API reference or the Parallel Search API guides.