AI assistant on Moroccan law
An assistant that answers legal questions from the texts of the law, and runs on your own machine, with no cloud service.
The need
In law, an answer is only worth something if it rests on the texts. A language model alone answers from memory; this project answers from the documents.
What I built
A complete pipeline: documents are imported and split, turned into numerical representations (embeddings) and stored in a vector database (ChromaDB). For each question, the assistant retrieves the relevant passages and answers from them. The language model runs locally with Ollama, with no dependence on a cloud service. The instructions given to the model are tuned for legally precise answers.
Why this approach
Answering from the documents makes it possible to see where an answer comes from. A local model keeps the documents on the machine, which matters when they are confidential.
Time given back
Illustrative scenario
This is not a measured result: it is what the project could give back, given the assumptions below.
For a firm, the time given back would come from looking up a text or an answer in its documentation, done by the assistant instead of searched by hand.
What it rests on
- The current search time for each question: to be measured with the firm.
- The number of questions asked each week: to be confirmed.
- The firm's documents to include: to be defined together.
Technologies
- Python
- Ollama
- LangChain
- ChromaDB
Other projects
- Automated medical reportsThe reports of a hospital management platform are produced as PDFs from the entered data, with no manual layout.
- Real-time data trackingA background service watches transactions live and historically, and computes the results for you.
A task like this one?
Describe it in a few words. I reply with precise questions.