Applying retrieval-augmented AI to legal guidance
Programming Languages: Python
Natural Language Processing: LangChain, Hugging Face Transformers, spaCy, NLTK, TextBlob
Large Language Models (LLMs): OpenAI GPT, Llama
Backend Development: Python
FastAPI Infrastructure: AWS
Deployment & Automation: CI/CD Pipelines (Jenkins, GitHub Actions)
Databases and Data Warehouses: PostgreSQL, chromaDB
Containerization: Docker, Docker Compose, Kubernetes
OS: Unix
Legal questions are rarely simple — and generic answers are rarely useful. We built a retrieval-augmented AI system that delivers clear, context-aware legal guidance by grounding every response in verified source material, rather than relying on a language model’s general knowledge
The Client
The client was building a legal assistance service focused on Israeli law, primarily around repatriation and housing-related questions. The target audience included people preparing to move to Israel, as well as legal professionals who regularly handle repetitive consultations.

Legal advice in this area is expensive and often inaccessible. At the same time, public sources such as forums and social media rarely provide answers that fit a person’s specific situation.
The Problem: Legal Knowledge Is Fragmented and Context-Dependent
Many legal questions cannot be answered with a simple search. Users often describe their situation in free form, combining personal context, documents and edge cases.

In Israel, this is further complicated by the common law system, where legal outcomes depend not only on statutory texts but also on precedents. Even when regulations exist, relevant information is scattered across multiple documents and interpretations.
The challenge was to provide clear, situation-specific guidance without requiring a full consultation with a lawyer for every basic question.
Why a Generic Chatbot Was Not Enough
A standalone language model cannot be trusted with legal guidance:
  • It may lack up-to-date or jurisdiction-specific knowledge
  • It can hallucinate answers that sound convincing but are incorrect
  • It cannot reliably distinguish relevant legal context without guidance

To be useful, the system needed a way to ground its answers in verified legal sources, rather than relying on general language model knowledge.
The Solution: A Retrieval-Augmented Legal Assistant
We designed a legal assistant based on a retrieval-augmented generation (RAG) approach.

Before exposing the system to users, the client provided a curated set of Israeli legal materials covering repatriation and housing regulations. These documents were processed, structured and stored in a searchable knowledge base.

When a user submitted a question:
1
User context analysis. The system analysed the user’s description to identify the legal domain and relevant constraints.
2
Targeted document retrieval. Only the most relevant legal excerpts were selected from the knowledge base. Unrelated topics were excluded.

3
Context-grounded response generation. The retrieved legal context was injected into the language model prompt, ensuring that answers were grounded in actual regulations rather than general assumptions.

4
Iterative clarification. Users could ask follow-up questions, refining the context in a way similar to a real legal consultation.
The result was a conversational interface that simulated the flow of a legal consultation, while remaining anchored to verified legal texts.
Intended Use Cases
The system was designed to support two scenarios:
  • End users, seeking preliminary guidance before deciding whether a full legal consultation was required
  • Legal professionals, using the assistant to speed up routine consultations and information lookup
In both cases, the goal was not to replace lawyers, but to reduce repetitive work and improve access to basic legal clarity.
Project Status
The legal assistant was fully implemented and functionally operational, covering the complete consultation flow — from user context interpretation to source-grounded response generation.

The project validated the use of retrieval-augmented AI for legal guidance, demonstrating how curated domain knowledge can be combined with natural language interaction to deliver clear, explainable answers in a sensitive domain.
Made on
Tilda