Integrations

LlamaIndex

Use Aether as a LlamaIndex retriever to power query engines with semantic document search.

LlamaIndex is purpose-built for RAG, and Aether slots in as a custom retriever. The RetrieverQueryEngine handles response synthesis — stuffing context, refining answers, and formatting output — while Aether handles the vector search and document retrieval. This gives you LlamaIndex's advanced RAG features (re-ranking, query transformations) with Aether's managed vector storage.


Prerequisites

Install the Aether SDK alongside LlamaIndex and an LLM provider package.

pip install aether-ai llama-index llama-index-llms-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 LlamaIndex supports many LLM providers. Swap OpenAI for Anthropic, Gemini, or any other LlamaIndex-compatible LLM — only the import and model name change.

Full working example

The custom AetherRetriever subclasses LlamaIndex's BaseRetriever and implements _retrieve(). Each Aether result is converted into a NodeWithScore wrapping a TextNode, which is exactly what LlamaIndex's query engine expects. Aether returns a 0-100 relevance score, so the example normalizes it to LlamaIndex's 0-1 score range.

import os

from aether import AetherClient
from llama_index.core import QueryBundle
from llama_index.core.retrievers import BaseRetriever
from llama_index.core.schema import NodeWithScore, TextNode
from llama_index.core.query_engine import RetrieverQueryEngine
from llama_index.llms.openai import OpenAI


class AetherRetriever(BaseRetriever):
    """LlamaIndex retriever backed by Aether vector search."""

    def __init__(self, aether_client: AetherClient, top_k: int = 3):
        super().__init__()
        self._client = aether_client
        self._top_k = top_k

    def _retrieve(self, query_bundle: QueryBundle) -> list[NodeWithScore]:
        results = self._client.retrieve(query_bundle.query_str, k=self._top_k)
        return [
            NodeWithScore(
                node=TextNode(
                    text=r.content,
                    metadata={"doc_id": r.doc_id, "title": r.title or r.doc_id},
                ),
                score=r.score / 100,
            )
            for r in results
        ]


aether = AetherClient(api_key=os.environ.get("AETHER_API_KEY"))
retriever = AetherRetriever(aether, top_k=3)

query_engine = RetrieverQueryEngine.from_args(
    retriever,
    llm=OpenAI(model="gpt-4o"),
)

response = query_engine.query("What are the company's core collaboration hours?")
print(response)