# Contextual Compression Retriever node

The Contextual Compression Retriever node improves the answers returned from [vector store](../../../../../glossary/#ai-vector-store) document similarity searches by taking into account the context from the query.

Parameter resolution in sub-nodes

Sub-nodes behave differently to other nodes when processing multiple items using an expression.

Most nodes, including root nodes, take any number of items as input, process these items, and output the results. You can use expressions to refer to input items, and the node resolves the expression for each item in turn. For example, given an input of five `name` values, the expression `{{ $json.name }}` resolves to each name in turn.

In sub-nodes, the expression always resolves to the first item. For example, given an input of five `name` values, the expression `{{ $json.name }}` always resolves to the first name.

## Templates and examples

**Generate Contextual YouTube Comments Automatically with GPT-4o**

by Yaron Been

[View template details](https://n8n.io/workflows/4580-generate-contextual-youtube-comments-automatically-with-gpt-4o/)

**Dynamic MCP Server Selection with OpenAI GPT-4.1 and Contextual AI Reranker**

by Jinash Rouniyar

[View template details](https://n8n.io/workflows/8272-dynamic-mcp-server-selection-with-openai-gpt-41-and-contextual-ai-reranker/)

**Generate Contextual Recommendations from Slack using Pinecone**

by Rahul Joshi

[View template details](https://n8n.io/workflows/6018-generate-contextual-recommendations-from-slack-using-pinecone/)

[Browse Contextual Compression Retriever integration templates](https://n8n.io/integrations/contextual-compression-retriever/), or [search all templates](https://n8n.io/workflows/)

## Related resources

Refer to [LangChain's contextual compression retriever documentation](https://js.langchain.com/docs/how_to/contextual_compression/) for more information about the service.

View n8n's [Advanced AI](../../../../../advanced-ai/) documentation.
