# vasiliskou/rag-explorer-eu-law architecture

> Architecture diagram of the GitHub repository vasiliskou/rag-explorer-eu-law, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vasiliskou/rag-explorer-eu-law
- Repository: https://github.com/vasiliskou/rag-explorer-eu-law

## Overview

This Colab-oriented app lets users configure a retrieval-augmented chat over a sample of Multi-EURLEX EU legal documents. Its workflow loads and chunks documents, builds a selectable embedding/vector-search and LLM configuration, then serves conversational answers through Gradio. The single Python file contains the runtime; unsampled sections are represented only where the README documents capabilities, and those links use the README as evidence.

Main entry points: [`rag_explorer_–_chat_with_eu_law.py`](https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py) (Chain builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Legal document ingest"]
  node_dataset[("Multi-EURLEX dataset")]
  node_loader["Dataset loading"]
  node_documents["Legal documents"]
  node_chunking["Document chunking"]
end

subgraph group_rag["RAG pipeline"]
  node_builder["Chain builder"]
  node_embeddings["Embedding selection"]
  node_vectorstore[("FAISS / Chroma")]
  node_retriever["Semantic retriever"]
  node_llm_select["LLM selection"]
  node_memory["Conversation memory"]
  node_chain["Conversational RAG chain"]
end

subgraph group_chat["Chat interface"]
  node_ui["Gradio interface"]
  node_handlers["Chat handlers"]
end

subgraph group_providers["External providers"]
  node_embed_api["Embedding providers"]
  node_llm_api["OpenAI / Gemini"]
end

node_user(("Legal questioner"))

node_user -->|"asks question"| node_ui
node_ui -->|"dispatches input"| node_handlers
node_dataset -->|"provides records"| node_loader
node_loader -->|"wraps entries"| node_documents
node_documents -->|"splits text"| node_chunking
node_handlers -->|"configures chain"| node_builder
node_builder -->|"selects model"| node_embeddings
node_embeddings -->|"requests vectors"| node_embed_api
node_builder -->|"indexes chunks"| node_vectorstore
node_chunking -->|"supplies chunks"| node_vectorstore
node_builder -->|"creates retriever"| node_retriever
node_vectorstore -->|"backs search"| node_retriever
node_builder -->|"selects backend"| node_llm_select
node_llm_select -->|"generates answers"| node_llm_api
node_builder -->|"creates memory"| node_memory
node_builder -->|"assembles chain"| node_chain
node_handlers -->|"invokes chain"| node_chain
node_chain -.->|"retrieves context"| node_retriever
node_chain -.->|"produces answer"| node_llm_api
node_chain -.->|"tracks dialogue"| node_memory
node_chain -.->|"returns answer"| node_handlers

click node_ui "https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py"
click node_handlers "https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py"
click node_loader "https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py"
click node_documents "https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py"
click node_chunking "https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py"
click node_builder "https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py"
click node_embeddings "https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py"
click node_vectorstore "https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py"
click node_retriever "https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py"
click node_llm_select "https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py"
click node_memory "https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py"
click node_chain "https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dataset,node_loader,node_documents,node_chunking toneBlue
class node_builder,node_embeddings,node_vectorstore,node_retriever,node_llm_select,node_memory,node_chain toneAmber
class node_ui,node_handlers toneMint
class node_embed_api,node_llm_api toneRose
class node_user toneIndigo
```

## Components

### Legal document ingest

- **Multi-EURLEX dataset**
- [Dataset loading](https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py): `rag_explorer_–_chat_with_eu_law.py`
- [Legal documents](https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py): `rag_explorer_–_chat_with_eu_law.py`
- [Document chunking](https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py): `rag_explorer_–_chat_with_eu_law.py`

### RAG pipeline

- [Chain builder](https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py): `rag_explorer_–_chat_with_eu_law.py`
- [Embedding selection](https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py): `rag_explorer_–_chat_with_eu_law.py`
- [FAISS / Chroma](https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py): `rag_explorer_–_chat_with_eu_law.py`
- [Semantic retriever](https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py): `rag_explorer_–_chat_with_eu_law.py`
- [LLM selection](https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py): `rag_explorer_–_chat_with_eu_law.py`
- [Conversation memory](https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py): `rag_explorer_–_chat_with_eu_law.py`
- [Conversational RAG chain](https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py): `rag_explorer_–_chat_with_eu_law.py`

### Chat interface

- [Gradio interface](https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py): `rag_explorer_–_chat_with_eu_law.py`
- [Chat handlers](https://github.com/vasiliskou/rag-explorer-eu-law/blob/main/rag_explorer_%E2%80%93_chat_with_eu_law.py): `rag_explorer_–_chat_with_eu_law.py`

### External providers

- **Embedding providers**
- **OpenAI / Gemini**

### Other components

- **Legal questioner**

## Connections

- Legal questioner → Gradio interface: asks question (evidence: `README.md`)
- Gradio interface → Chat handlers: dispatches input (evidence: `README.md`)
- Multi-EURLEX dataset → Dataset loading: provides records (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Dataset loading → Legal documents: wraps entries (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Legal documents → Document chunking: splits text (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Chat handlers → Chain builder: configures chain (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Chain builder → Embedding selection: selects model (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Embedding selection → Embedding providers: requests vectors (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Chain builder → FAISS / Chroma: indexes chunks (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Document chunking → FAISS / Chroma: supplies chunks (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Chain builder → Semantic retriever: creates retriever (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- FAISS / Chroma → Semantic retriever: backs search (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Chain builder → LLM selection: selects backend (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- LLM selection → OpenAI / Gemini: generates answers (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Chain builder → Conversation memory: creates memory (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Chain builder → Conversational RAG chain: assembles chain (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Chat handlers → Conversational RAG chain: invokes chain (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Conversational RAG chain → Semantic retriever: retrieves context (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Conversational RAG chain → OpenAI / Gemini: produces answer
- Conversational RAG chain → Conversation memory: tracks dialogue (evidence: `rag_explorer_–_chat_with_eu_law.py`)
- Conversational RAG chain → Chat handlers: returns answer (evidence: `rag_explorer_–_chat_with_eu_law.py`)
