> ## Documentation Index
> Fetch the complete documentation index at: https://wwwpoc.ibm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Langchain RAG

> Create an AI-powered document retrieval system with LangChain and Granite.

Retrieval-Augmented Generation (RAG) enhances the performance of foundation models by grounding their calculations in external knowledge sources, resulting in more accurate and up-to-date responses. RAG is a versatile pattern that combines the power of retrieval systems with generative models to unlock use cases that are less accurate when using standalone foundation models.

This tutorial demonstrates RAG leveraging [LangChain](https://github.com/langchain-ai/langchain) and Granite. LangChain is a framework for building LLM-powered applications by chaining interoperable components. LangChain provides a standard interface for models, embeddings, vector stores, and more.

You will need a Replicate API token and a Hugging Face token to run this recipe in Colab. Instructions for obtaining these credentials can be found [here](/granite/docs/use-cases/getting-credentials).

<CardGroup cols={2}>
  <Card title="Get started" icon="github" href="https://github.com/ibm-granite-community/granite-snack-cookbook/blob/main/recipes/RAG/RAG_with_Langchain.ipynb">
    Explore sample code in a GitHub repo
  </Card>

  <Card title="Try it out" icon="https://mintcdn.com/ibmgranite/m3dncz2KrKeb3pcV/granite/docs/images/icons8-google-colab.svg?fit=max&auto=format&n=m3dncz2KrKeb3pcV&q=85&s=fb39ef667c012d0fcef53599b6c5c0fd" href="https://colab.research.google.com/github/ibm-granite-community/granite-snack-cookbook/blob/main/recipes/RAG/RAG_with_Langchain.ipynb" width="144" height="144" data-path="granite/docs/images/icons8-google-colab.svg">
    Execute sample code in Colab
  </Card>
</CardGroup>
