# Retrieval Augmented Generation (RAG)

Retrieval Augmented Generation (RAG) aims to **combine the power of Large Language Models (LLMs) with external, up-to-date information from knowledge bases or databases**.

While LLMs alone might be limited by the data they were trained on—especially if it’s not current or specific enough—RAG allows the model to produce more accurate, relevant, and context-aware responses in real-time.

## How Does It Work?

1. **User Query**
   1. A user provides a query or request (e.g., “What is the capital of \[X]?” or “Explain \[topic] in simple terms.”).
2. **Retrieval Step**
   1. The system searches a knowledge base (which could be documents, FAQs, websites, or any structured/unstructured data source) for relevant information.
   2. This often involves using vector embeddings: the query is converted into an embedding and compared against embeddings of stored documents to find the most relevant matches.
3. **Augmentation (Context Construction)**
   1. The retrieved information is then bundled together with the user’s query to form an augmented prompt or context.
4. **Generation with LLM**
   1. The LLM takes the augmented prompt (query + retrieved context) and generates a response.
   2. Because the model has direct access to the retrieved information, it can give answers that are more accurate and grounded in the current data.
5. **Response Delivery**
   1. The system presents the final answer to the user, often with references or citations back to the source documents.

## **Why It’s Helpful**

* **Accuracy & Up-to-Date Info**: The LLM no longer relies solely on its internal training data. It can incorporate fresh data, making answers more reliable.
* **Explainability**: By tracing the retrieved documents, the system can show sources, increasing transparency.
* **Flexibility**: You can point the retrieval step at any domain or dataset, enabling domain-specific or real-time solutions.

At indigo.ai, we’ve built a **cutting-edge RAG pipeline** that seamlessly integrates external knowledge sources into every conversational interaction. By **combining advanced retrieval methods and generative modeling**, our system ensures that user queries are always answered with the most relevant, up-to-date information. This robust design not only boosts accuracy and reliability but also provides clear references and sources, making our Conversational Assistants truly dynamic and trustworthy.


---

# Agent Instructions: 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:

```
GET https://guide.indigo.ai/getting-started/ai-knowledge-hub/introduction-to-ai-a-beginners-guide/retrieval-augmented-generation-rag.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
