> For the complete documentation index, see [llms.txt](https://nomadamas.gitbook.io/ragchain-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nomadamas.gitbook.io/ragchain-docs/ragchain-structure/retrieval.md).

# Retrieval

## Overview

With Retrieval module, you can ingest passage contents to vector representations. Then the module can retrieve the most similar passages for answering to given questions.

## Supporting Retrievals

#### 1. [BM25 Retrieval](/ragchain-docs/ragchain-structure/retrieval/bm25-retrieval.md)

BM25 is a bag-of-words retrieval function that ranks a set of documents based on the query terms appearing in each document. It uses term frequency (TF) and inverse document frequency (IDF) to calculate a weight for each word in a document.

#### 2. [Hybrid Retrieval](/ragchain-docs/ragchain-structure/retrieval/hybrid-retrieval.md)

Hybrid Retrieval combines multiple retrieval methods into one system. It allows you to leverage the strengths of multiple methods at once, potentially leading to better results than using any single method alone.

#### 3. [Hyde Retrieval](/ragchain-docs/ragchain-structure/retrieval/hyde-retrieval.md)

Hyde is a passage retrieval method that generates hypothetical passages using language models and retrieves passages based on that generated passages.

#### 4. [VectorDB Retrieval](/ragchain-docs/ragchain-structure/retrieval/vectordb-retrieval.md)

VectorDBRetrieval uses VectorDB as a backend for storing embedded vectors of passages and retrieving similar vectors given an input query using similarity search.

## Role of the Retrievals in RAGchain

The role of these retrievals within our framework is essential as they serve as the backbone for information extraction from large amounts of data or documents based on user queries or needs. They provide efficient ways to search through data by embedding or ranking information so that relevant results can be returned quickly even with massive amounts of data.

## Advantages of Retrievals

Each type of retrieval system offers its own unique advantages:

* **BM25**: This method is simple yet effective, especially when dealing with unstructured text data where term frequency can indicate relevance.
* **Hybrid**: By combining multiple methods, this approach can take advantage of their individual strengths while mitigating their weaknesses.
* **Hyde**: This method's use of hypotheticals allows it to perform more precise search.&#x20;
* **VectorDB**: The use of vector embeddings enables this method to capture semantic relationships between words and phrases beyond simple keyword matching.

Remember that no single method will be best for all tasks; you should choose your retrieval system based on your specific needs and constraints.

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://nomadamas.gitbook.io/ragchain-docs/ragchain-structure/retrieval.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
