---
title: Introduction
description: Retrieval SDK is provider-agnostic retrieval for TypeScript, with BM25, vector search, hybrid fusion, reranking and evaluation.
sidebar:
  order: 1
---

Retrieval SDK gives you search building blocks that work with any model or database.

- **One contract.** A `Retriever` takes a query and returns ranked hits. BM25, vector search, hybrid fusion and reranking are all retrievers, so they nest.
- **Zero dependencies.** Models plug in through two small interfaces, `Embedder` and `Reranker`.
- **Measure it.** `evaluate` scores any retriever with NDCG, recall and precision.

## Install

```package-install
retrieval-sdk
```

## Quickstart

```ts
import {
  bm25,
  hybrid,
  memoryDocumentStore,
  memoryVectorStore,
  vectorSearch,
  withRerank,
} from "retrieval-sdk";
import { cohereEmbedder, cohereReranker } from "retrieval-sdk/cohere";

const lexical = bm25();
const semantic = vectorSearch({
  embedder: cohereEmbedder({ model: "embed-v4.0" }),
  store: memoryVectorStore(),
});
await Promise.all([lexical.add(docs), semantic.add(docs)]);

const retriever = withRerank({
  retriever: hybrid({ retrievers: [lexical, semantic] }),
  reranker: cohereReranker({ model: "rerank-v3.5" }),
  documents: memoryDocumentStore(docs),
});

const { hits } = await retriever.retrieve("reset my password", { topK: 10 });
// [{ id: "doc-7", score: 0.93 }, ...]
```

See [Concepts](/concepts) for how the pieces fit together.

## Credits

The API design takes inspiration from the [AI SDK](https://ai-sdk.dev) and [Files SDK](https://github.com/haydenbleasel/files-sdk).
