As I returned to Ukraine in my role as Field Coordinator with Doctors of the World, I took the opportunity to deepen my understanding of the local legislative landscape. I curated legislation texts—sometimes translated from Ukrainian to English—vectorized them for Retrieval-Augmented Generation (RAG), and built a chatbot I could actively discuss legal questions with.
I'm now sharing this tool publicly as a free online humanitarian legal advisor, designed to help both local and international humanitarian NGOs navigate Ukraine's legal framework. Country directors, operations managers, and technical coordinators will benefit the most. The knowledge base is particularly rich in the health sector.
Try it here: baena.ai/demos/paralegal-advisor
Please note: This advisor is not a substitute for professional legal counsel. It provides preliminary guidance on everyday legal issues, helping you decide whether to seek further consultation and how to better frame your legal inquiries.
Why This Tool Matters
Legal consultation fees are a standard and expected indirect cost for NGOs operating in emergencies—agencies must adhere to local laws and uphold the rule of law as a principle. This tool helps optimize those expenses. It acts as a friendly, non-judgmental assistant, equipped with an extensive and regularly updated database of legislation. You can first run your questions through this model to prepare for consultations with qualified lawyers.
An Evolving Legal Framework
The core law governing humanitarian aid in Ukraine dates back to 1999 and has been amended and rephrased numerous times since February 2022 to reflect wartime conditions. Beyond this core legislation, a broad range of laws governs general economic activities—including labor, auditing, and import regulations—as well as sector-specific laws, such as those covering medical services. Many of these have been profoundly affected by the imposition of martial law.
The full database of primary legislative sources is embedded below and also available as a direct link.
Use Cases
Based on current trends on the ground, the following topics are especially relevant for humanitarian NGOs operating in Ukraine:
- NGO registration and legal status
- Conscription issues affecting national staff
- Import regulations for humanitarian supplies
- Implications of martial law on operations and contracts
Technology Stack
Full technical details are available in the GitHub repository. Below is a summary of the tools used:
| Layer | Technology |
|---|---|
| Frontend | HTML5, CSS3, JavaScript, Marked.js |
| Backend | n8n (workflow automation) |
| AI Models | OpenAI Chat Model, Google Gemini Chat Model |
| External APIs | SerpAPI, Llama Cloud Parser, DeepL |
| Databases | PostgreSQL (chat memory), Supabase (vector store) |
| Integrations | Google Drive (document triggers), Google Sheets (data export) |
For the translation, vectorization, and metadata extraction phases, I used local models via Ollama running on my own hardware. The chat interface is primarily powered by Llama 3.2, though external models may be used when local hardware is at capacity—see the privacy note for details.
How the Knowledge Base Was Built
Categorizing the Legislation
When building a knowledge base for RAG, structuring the source material is as important as collecting it. Each document was tagged with three key metadata fields:
- Category — the area of law (e.g., labor, health, customs)
- Date — the enactment or most recent amendment date
- Relevance rank — a score reflecting its operational importance for NGOs
Ranking Legislation
Not all legal texts hold equal significance for humanitarian operations. Some are procedural formalities or overly technical annexes. It was therefore essential to rank each piece of legislation by operational relevance—based on metadata extracted from the texts themselves—ensuring that NGOs can prioritize the most impactful legal information.
This online legal advisor aims to streamline the process of understanding and complying with a complex legal environment, ultimately saving time and resources for humanitarian organizations.
Want this for your own documents? Think of this as a chat with your knowledge base, not a replacement for a lawyer. If you're interested in a private, custom solution built around your organization's documents, get in touch.

