# RAG-based Document Search

Large Language Models are trained on a huge amount of data, yet when you search for your organization or brand, you might find that it usually can’t respond accurately. This means that LLMs might hallucinate (or “make up”) irrelevant or inaccurate information for your business needs.

This is why Retrieval Augmented Generation (RAG) is an excellent solution! RAG will:

1. Index all of your knowledge base in a vectorDB - pdfs, csvs, texts, web pages, images, and more
2. Retrieve all the most relevant information from the vectorDB
3. Use LLM to provide summaries that work for your use case and generate accurate answers

<figure><img src="/files/pOtjTs2sDrPi8cff85H2" alt=""><figcaption></figcaption></figure>

### Where is RAG useful? <a href="#pk2fnertmmfp" id="pk2fnertmmfp"></a>

RAG is useful for:

1. For site-wide searches
2. AI copilots
3. Research and analyses of large datasets
4. Workplace searches
5. Search powered applications
6. Search and summaries for the legal industry

### How to use RAG on Gooey.AI? <a href="#t71waoaanjb8" id="t71waoaanjb8"></a>

#### Step 1: Prepare your knowledge base <a href="#id-7ycp7arvb983" id="id-7ycp7arvb983"></a>

You can upload all your documents and data in the “Documents” section. You can add PDFs, docs, spreadsheets, charts, and texts.

**These can be uploaded from your local drive or online hosted links. We even accept Google Drive links.**

![](/files/cPztrno4fGENHiLBup71)

#### Step 2: Choose your preferred Large Language Model <a href="#jw7i6tz1b2xd" id="jw7i6tz1b2xd"></a>

Head to the “settings” option and choose your preferred LLM!

![](/files/tkS4a4Du2KVMS2OYrHPl)

#### Step 3: Add your query <a href="#cve6n4liro9f" id="cve6n4liro9f"></a>

Scroll to the top of the page, and add your query/question for the RAG.

![](/files/K9xmE6J10HAqef2X8LoA)

#### Step 4: Hit Submit <a href="#ftzxwu9v5kmm" id="ftzxwu9v5kmm"></a>

Hit the Submit button!

### Output <a href="#kd4xn1r795m" id="kd4xn1r795m"></a>

Your output will be on the right side and look like this:

![](/files/4yuFinGSpEHSFFbx0Syr)

You might notice, there is a citation legend in the output. All referenced and cited text snippets from the search query will be shared in the “Sources” section below the output.

![](/files/KdDnvXHYvk4ozekhgMLb)


---

# 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://docs.gooey.ai/tools/how-does-rag-based-document-search-work.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.
