LexConsilia est un système RAG (Retrieval-Augmented Generation) intelligent conçu pour la gestion et la consultation de documents juridiques. Il combine ChromaDB pour le stockage vectoriel, Ollama pour la génération de réponses, et NestJS pour une API robuste et performante.
# 1. Installer les dépendances
npm install
# 2. Démarrer les services Docker (ChromaDB, Ollama, MongoDB)
cd docker
docker-compose up -d
# 3. Installer un modèle Ollama
docker exec -it ai-server ollama pull llama2
# 4. Démarrer l'application
npm run start:dev
L'application sera disponible sur:
http://localhost:3000http://localhost:3000/apicurl -X POST http://localhost:3000/rag/index/text \
-H "Content-Type: application/json" \
-d '{
"content": "Votre contenu juridique...",
"type": "LAW",
"metadata": {"title": "Titre du document"}
}'
curl -X POST http://localhost:3000/rag/index/pdf \
-F "[email protected]"
curl -X POST http://localhost:3000/rag/query \
-H "Content-Type: application/json" \
-d '{
"query": "Votre question juridique?",
"type": "QUESTION"
}'
src/
├── constants/ # Enums (DocumentTypesEnum, QueryTypesEnum)
├── interfaces/ # Interfaces TypeScript
├── rag/
│ ├── dto/ # Data Transfer Objects
│ ├── services/ # Services métier
│ │ ├── chromadb.service.ts
│ │ ├── ollama.service.ts
│ │ ├── document-processor.service.ts
│ │ └── rag.service.ts
│ ├── rag.controller.ts
│ └── rag.module.ts
└── app.module.ts
Créez un fichier .env à la racine:
PORT=3000
CHROMADB_URL=http://localhost:8000
OLLAMA_URL=http://localhost:11434
MONGODB_URI=mongodb://root:root@localhost:27017/lexconsilia?authSource=admin
http://localhost:8000 - Base vectoriellehttp://localhost:11434 - Modèle IAlocalhost:27017 - Base de données| Méthode | Endpoint | Description |
|---|---|---|
| POST | /rag/index/text | Indexer un document texte |
| POST | /rag/index/pdf | Indexer un fichier PDF |
| POST | /rag/index/pdfs | Indexer plusieurs PDFs |
| POST | /rag/query | Poser une question au système |
| POST | /rag/analyze/pdf | Analyser un PDF sans indexation |
| GET | /rag/stats | Obtenir les statistiques |
# unit tests
npm run test
# e2e tests
npm run test:e2e
# test coverage
npm run test:cov
class-validatorCe projet est sous licence MIT.
Construit avec ❤️ en utilisant NestJS
LexConsilia est un système RAG (Retrieval-Augmented Generation) intelligent conçu pour la gestion et la consultation de documents juridiques. Il combine ChromaDB pour le stockage vectoriel, Ollama pour la génération de réponses, et NestJS pour une API robuste et performante.
# 1. Installer les dépendances
npm install
# 2. Démarrer les services Docker (ChromaDB, Ollama, MongoDB)
cd docker
docker-compose up -d
# 3. Installer un modèle Ollama
docker exec -it ai-server ollama pull llama2
# 4. Démarrer l'application
npm run start:dev
L'application sera disponible sur:
http://localhost:3000http://localhost:3000/apicurl -X POST http://localhost:3000/rag/index/text \
-H "Content-Type: application/json" \
-d '{
"content": "Votre contenu juridique...",
"type": "LAW",
"metadata": {"title": "Titre du document"}
}'
curl -X POST http://localhost:3000/rag/index/pdf \
-F "[email protected]"
curl -X POST http://localhost:3000/rag/query \
-H "Content-Type: application/json" \
-d '{
"query": "Votre question juridique?",
"type": "QUESTION"
}'
src/
├── constants/ # Enums (DocumentTypesEnum, QueryTypesEnum)
├── interfaces/ # Interfaces TypeScript
├── rag/
│ ├── dto/ # Data Transfer Objects
│ ├── services/ # Services métier
│ │ ├── chromadb.service.ts
│ │ ├── ollama.service.ts
│ │ ├── document-processor.service.ts
│ │ └── rag.service.ts
│ ├── rag.controller.ts
│ └── rag.module.ts
└── app.module.ts
Créez un fichier .env à la racine:
PORT=3000
CHROMADB_URL=http://localhost:8000
OLLAMA_URL=http://localhost:11434
MONGODB_URI=mongodb://root:root@localhost:27017/lexconsilia?authSource=admin
http://localhost:8000 - Base vectoriellehttp://localhost:11434 - Modèle IAlocalhost:27017 - Base de données| Méthode | Endpoint | Description |
|---|---|---|
| POST | /rag/index/text | Indexer un document texte |
| POST | /rag/index/pdf | Indexer un fichier PDF |
| POST | /rag/index/pdfs | Indexer plusieurs PDFs |
| POST | /rag/query | Poser une question au système |
| POST | /rag/analyze/pdf | Analyser un PDF sans indexation |
| GET | /rag/stats | Obtenir les statistiques |
# unit tests
npm run test
# e2e tests
npm run test:e2e
# test coverage
npm run test:cov
class-validatorCe projet est sous licence MIT.
Construit avec ❤️ en utilisant NestJS