# Chat with Your Own Documents (RAG Flow)

### **Unlock Generative AI for Corporate Data with Zero Risk**

Many organizations want to leverage Generative AI to query their internal corporate data. However, a critical concern remains: How do you do this without exposing sensitive documents to third-party governments or public cloud providers like OpenAI, Google, or Microsoft?

The GLBNXT platform solves this by allowing you to build **Retrieval Augmented Generation (RAG)** pipelines that are fully local, modular, and EU-compliant. Your data is processed, stored, and retrieved without ever leaving your sovereign infrastructure.

{% embed url="<https://youtu.be/NsuQ8bwxo-A>" %}

### The Sovereign Tech Stack

In this tutorial, we build a modular agent using open components available on the GLBNXT platform:

* **Storage:** **MinIO** for storing raw documents (PDFs, images, text).
* **Vector Database:** **PostgreSQL** with **pgvector** to store searchable data embeddings.
* **LLM:** Local GPU-accelerated models (e.g., **Mistral**, Gemma, or Llama) to handle reasoning and OCR.
* **Orchestration:** **n8n** to handle the ingestion, pre-processing, and retrieval logic.

### Step-by-Step Workflow

#### 1. The Ingestion Pipeline

Before chatting, data must be processed. The n8n workflow handles this automatically:

* **Loop & Download:** The system retrieves files uploaded to your private MinIO bucket.
* **Decision Logic:** It checks the file type. If it is an image or scanned document, it uses the **Mistral LLM** for OCR (Optical Character Recognition) to extract text.
* **Vectorization:** The extracted content is converted into vectors and stored in the PostgreSQL database.

#### 2. The Retrieval (Chat) Interface

Once the data is vectorized, you can interact with it via a chat interface. The AI agent is configured with specific **tool calls** that determine when and how to fetch information.

#### 3. Context-Aware Responses

The agent is capable of "switching context" within a single conversation.

* *Example:* You can ask for a summary of a technical manual (e.g., ISPMA software product management).
* *Follow-up:* In the same chat, you can ask about a specific person's education from a completely different file (e.g., a resume for "Leyon Vandervort").
* **Result:** The agent intelligently retrieves the correct document for each specific question.

#### 4. Full Traceability

Unlike "black box" public AI tools, GLBNXT provides full transparency. You can view the execution logs in real-time to see exactly:

* Which tool the agent called.
* Which documents were retrieved from the vector storage.
* How the answer was constructed.

### Why Build This on GLBNXT?

* **100% Data Sovereignty:** Your corporate knowledge base never leaves the EU.
* **Model Agnostic:** Swap models (Mistral, Llama, etc.) based on your specific requirements.
* **Secure Orchestration:** Manage complex logic and permissions locally without external API dependencies.


---

# 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.glbnxt.com/tutorials/video/chat-with-your-own-documents-rag-flow.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.
