Inspiration
What it does
DeLey is an AI-powered legal copilot that helps users understand, learn, and practice law through natural voice and chat interactions. It provides legal education, simulated debates, and practical legal guidance grounded in real legislation. Users can ask questions by speaking, receive instant transcriptions, and get clear responses delivered in both text and voice. DeLey also saves conversation history automatically, allowing users to continue exactly where they left off, anytime.
Project Story
About the Project
Law Copilot is a voice-first AI legal assistant designed to help people with limited economic resources understand their basic legal rights in Peru.
In Peru, many citizens face legal problems but cannot afford a lawyer or do not know where to start. Legal texts are complex, fragmented, and difficult to access for non-experts. This project was inspired by the idea that access to legal information should not depend on income or education level.
The goal of Law Copilot is not to replace lawyers, but to act as a first point of orientation, helping users understand common legal questions related to constitutional rights, labor law, family law, and basic administrative procedures—using natural voice interaction.
What I Learned
Through this project, I learned:
- How to design a Retrieval-Augmented Generation (RAG) system to reduce hallucinations in Large Language Models.
- How to process and segment legal documents efficiently for semantic search.
- How to build a voice-first AI system, where all interaction happens through speech instead of text.
- How to balance model accuracy, performance, and cost in a real-world MVP.
- The importance of ethical constraints and clear disclaimers when working with legal AI systems.
How I Built It
The system is built as a modular MVP with the following flow:
- Legal Documents Ingestion
- Core Peruvian legal documents (e.g. Constitution, Labor Law excerpts) are cleaned and segmented using Pandas + regex.
- Embeddings & Vector Search
- Each chunk is embedded using Sentence-Transformers (
paraphrase-multilingual-MiniLM). - Embeddings are stored and queried using FAISS for fast semantic search.
- RAG Pipeline
When a user asks a question via voice, the system:
- Converts speech to text
- Retrieves the most relevant legal chunks
- Injects them as context into the LLM prompt
- Generates a grounded, explainable response
- Voice Interface
- Responses are converted back to speech using ElevenLabs, enabling a fully voice-based experience.
- Backend API
- A FastAPI backend orchestrates the entire flow and exposes endpoints for ingestion, search, and inference.
Challenges Faced
- Reducing hallucinations when dealing with sensitive legal topics.
- Choosing “just enough” legal documents to cover most real-world questions without overloading the model.
- Simplifying legal language so responses are understandable for non-technical users.
- Designing safeguards to clearly state that the assistant provides legal information, not legal advice.
- Ensuring good performance while keeping the system lightweight and scalable.
Built With
Languages
- Python
Frameworks & Libraries
- FastAPI
- Pandas
- Regex
- Sentence-Transformers
- FAISS
AI & NLP
- Retrieval-Augmented Generation (RAG)
- Multilingual embeddings
Voice & UX
- ElevenLabs (Text-to-Speech)
- Speech-to-Text pipeline (voice-first interaction)
Platforms & Tools
- Expo (frontend / mobile interface)
- REST APIs
How we built it
DeLey was built as a cloud-native, voice-first legal application. We used Expo with React Native and TypeScript to ship a single cross-platform mobile app. On the backend, we designed a serverless architecture that orchestrates speech-to-text, retrieval-augmented generation (RAG), and text-to-speech. Legal documents were indexed into a vector database, allowing the AI to ground its responses in real legislation. All services were containerized and deployed using cloud infrastructure to ensure scalability and reliability.
Challenges we ran into
One of the main challenges was reducing latency in a voice-based experience. Coordinating transcription, retrieval, reasoning, and voice synthesis in near real time required careful architectural decisions. Ensuring legal accuracy was another challenge, as generic AI responses are not sufficient in the legal domain. We also had to balance technical depth with usability, making sure the app remained intuitive while handling complex legal concepts.
Accomplishments that we're proud of
We’re proud of delivering a fully functional, end-to-end AI legal copilot with real-time voice interaction. Implementing a working RAG pipeline grounded in legal sources was a major milestone. We also successfully built a scalable cloud-native architecture and a polished mobile experience that feels responsive, modern, and accessible.
What we learned
This project reinforced the importance of grounding AI systems in trusted data, especially in high-stakes domains like law. We learned how to design low-latency, voice-first user experiences and how cloud-native services enable rapid iteration and scaling. Perhaps most importantly, we learned that clarity and trust are just as important as technical sophistication.
What's next for DeLey
Next, we plan to expand the legal knowledge base to cover more jurisdictions and languages. We aim to add deeper debate analytics, personalized learning paths, and improved explainability with clearer source citations. Long term, DeLey will evolve into a comprehensive legal learning and guidance platform that empowers users worldwide.
Built With
- elevenlabs
- expo.io
- fastapi
- google-cloud
- google-gemini
- pandas
- python
- sentence-transformers
Log in or sign up for Devpost to join the conversation.