Integrations
LangChain
Use Aether as a LangChain retriever to build RAG chains with any LLM provider.
LangChain's retriever interface is the standard way to plug external search sources into chains. By wrapping Aether in a BaseRetriever, it works seamlessly with RetrievalQA, conversational chains, LCEL pipelines, and agents. The retriever handles Aether's search and content download while the chain handles prompt construction and LLM invocation.
Prerequisites
Install the Aether SDK alongside LangChain and an LLM provider package.
pip install aether-ai langchain langchain-openai
Environment variables
Configuration
Set the following environment variables before running the examples below.
OPENAI_API_KEY— your OpenAI API key (required).AETHER_API_KEY— your Aether API key, loaded and passed to the client below (optional for unauthenticated deployments).
Swappable LLM
The examples below use OpenAI, but you can swap ChatOpenAI for any LangChain-compatible LLM — ChatAnthropic, ChatGoogleGenerativeAI, ChatMistralAI, and others. Only the import and model name need to change.
Full working example
The key idea is a custom AetherRetriever that subclasses LangChain's BaseRetriever. Inside it, aether.retrieve() finds the most relevant documents and converts them into LangChain Document objects. From there, any LangChain chain can use it as a drop-in retriever.
import os
from aether import AetherClient
from langchain_core.documents import Document
from langchain_core.retrievers import BaseRetriever
from langchain_openai import ChatOpenAI
from langchain.chains import RetrievalQA
class AetherRetriever(BaseRetriever):
"""LangChain retriever backed by Aether vector search."""
client: AetherClient
k: int = 3
class Config:
arbitrary_types_allowed = True
def _get_relevant_documents(self, query: str) -> list[Document]:
results = self.client.retrieve(query, k=self.k)
return [
Document(
page_content=r.content,
metadata={"doc_id": r.doc_id, "title": r.title or r.doc_id},
)
for r in results
]
aether = AetherClient(api_key=os.environ.get("AETHER_API_KEY"))
retriever = AetherRetriever(client=aether, k=3)
chain = RetrievalQA.from_chain_type(
llm=ChatOpenAI(model="gpt-4o"),
retriever=retriever,
)
answer = chain.invoke("What is the company's policy on professional development?")
print(answer["result"])