# Contextual Compression Retriever

A Contextual Compression Retriever is designed to improve the answers returned from vector store document similarity searches by better taking into account the context from the query.

It wraps another retriever, and uses a Document Compressor as an intermediate step after the initial similarity search that removes information irrelevant to the initial query from the retrieved documents.
This reduces the amount of distraction a subsequent chain has to deal with when parsing the retrieved documents and making its final judgements.

## Usage

This example shows how to intialize a `ContextualCompressionRetriever` with a vector store and a document compressor:

import CodeBlock from "@theme/CodeBlock";
import Example from "@examples/retrievers/contextual_compression.ts";

<CodeBlock language="typescript">{Example}</CodeBlock>
