Customer Case Study: INCM transforms legal accessibility with an AI Search Assistant
The Imprensa Nacional-Casa da Moeda (INCM) is responsible for managing and publishing Portugal’s Diário da República (Official Gazette of the Republic of Portugal), which includes essential information for understanding laws, regulations, and legal processes. The quantity of information and the complex language used in these documents present significant challenges for individuals seeking to access and understand them. This complexity often acts as an obstacle, limiting access to vital legal information. These challenges not only restrain individuals from understanding their legal rights but also impede businesses from ensuring compliance and protecting their interests.
Recognizing the need for a more accessible, efficient, and user-friendly way to interact with legal content, INCM collaborated with Xpand IT to develop LIA (Legal Information Assistant). The project started as a way to interact with legal content and has evolved into a comprehensive AI-powered assistant that simplifies access to legislative information.
Understanding customer needs
The Official Gazette contains thousands of legal documents, making it difficult for users to find the specific information they need quickly. The primary challenges were:
- Complexity of legal language: Understanding legal documents requires specialized knowledge, making them inaccessible to many users – who still need to access the information and understand it.
- Scalability of search capabilities: With hundreds of thousands of legal diplomas, traditional keyword-based search bars often proved too restrictive. Users frequently didn’t know the exact keywords necessary to retrieve relevant information, instead preferring to search by concepts or natural language queries.
- Avoiding AI hallucinations: Ensuring strict legal correctness was crucial for INCM, as the institution responsible for the edition of Portugal’s official law publication. It was essential that AI-generated responses were factually accurate, strictly based on official legal documents, and free from incorrect or misleading interpretations, or the accidental inclusion of foreign legal information.
- Ensuring impartiality: The assistant needed to abstain from providing legal advice while still delivering valuable insights based on official documents.
Addressing customer needs with AI
To overcome these challenges, INCM and Xpand IT implemented an AI solution based on Retrieval-Augmented Generation (RAG) architecture, leveraging:
- Azure OpenAI Service & Azure AI Search: Allowing for accurate and context-based responses directly linked to the Official Gazette’s database.
- Hybrid search (vector & keyword-based): Improving precision by combining semantic understanding with keyword-matching capabilities.
- Generative AI (GPT-4-based models): Providing natural language answers.
- Accuracy control: Training the assistant to limit responses strictly to official legal sources, preventing misleading or speculative answers.
By leveraging these technologies, LIA delivers structured, reliable, and user-friendly interactions, improving access to legal information for professionals and the public alike.
Enhancing legal accessibility through AI-powered search
LIA was designed to enhance the way legal information is retrieved and understood, offering real-time AI-powered assistance with key benefits such as:
- Simplified legal comprehension: Many legal texts, such as the Labor Code, contain complex terminology that is difficult for non-experts to interpret. LIA helps translate legal vocabulary into clear, comprehensible language, ensuring that users can easily understand the laws that affect them.
- Enhanced search for legal professionals: Lawyers, jurists, and legal researchers rely heavily on the Official Gazette to access up-to-date laws and regulations. While traditional legal research requires direct searches in outdated books or PDF repositories, LIA introduces an interactive chatbot that allows users to ask questions naturally and receive precise answers.
- Flexible search without exact keywords: Unlike conventional search engines that require exact terms, LIA’s AI-driven search capability understands intent, allowing users to find the right information even if they don’t use the exact legal terminology.
- Natural language responses: Instead of simply presenting an entire article or law, LIA provides well-structured, human-like responses that summarize the relevant legal text, making it easier to learn key details without extensive legal knowledge.
Hybrid search: Combining vectors and keyword-based search
During initial tests, legal experts made hundreds of queries and identified limitations with purely semantic or keyword-based approaches:
- Queries based on concepts (e.g., “How many vacation days am I entitled to per year?”) were effectively addressed by semantic vector search, as it comprehends the user’s intent and context.
- Queries directly referencing specific legal articles or precise terms (e.g., “What does article 238 of the Labor Code say?”) were not successfully handled by semantic search alone, due to the need for exact keyword matching.
To overcome these limitations, the team implemented a hybrid search by combining vector and keyword-based searches. Leveraging the native hybrid search capabilities of Azure AI Search and the flexibility of Semantic Kernel, LIA executes both semantic and keyword queries simultaneously. Results are merged and ranked using a reciprocal rank fusion (RRF) algorithm, providing users with comprehensive, relevant, and accurate answers quickly.
Benefits of hybrid search:
- Comprehensive coverage: Combines strengths of both semantic understanding and precise keyword matching.
- Enhanced relevance: Uses RRF to merge results effectively, improving the quality and reliability of results.
- Operational efficiency: Parallel execution of semantic and keyword-based queries ensures faster response times.
Why Semantic Kernel?
When INCM and Xpand IT started this project, Semantic Kernel was still in beta, presenting frequent updates on the road to General Availability (GA). The team quickly recognized the significant advantages offered by Semantic Kernel’s robust framework . The decision to adopt the framework was motivated by its powerful abstractions, which simplified the integration and management of various large language models (LLMs) and AI services.
Throughout the project, the team tested multiple LLMs, and thanks to Semantic Kernel’s flexibility, switching between models became straightforward and quick. Another critical aspect in retrieval-augmented generation (RAG) applications is the effective chunking of documents. Semantic Kernel simplified this process, offering built-in functionalities to intelligently split and overlap document content, ensuring accurate and contextually relevant information retrieval.
Semantic Kernel effectively laid a strong foundation upon which the team could confidently build sophisticated AI applications.
Summary
The collaboration between INCM and Xpand IT has successfully addressed a longstanding challenge in legal accessibility. By integrating AI-powered search and conversational interfaces, the LIA project provides an intuitive, intelligent, and reliable way for users to interact with the Official Gazette, democratizing access to legal content.
With features like natural language search, hybrid search, and AI-powered interpretation of legal texts, LIA makes legal research more accessible, efficient, and accurate for both professionals and the public.
As AI technology evolves, INCM and Xpand IT continue to push the boundaries of innovation, ensuring that legal information remains transparent, accessible, and easy to navigate.
0 comments
Be the first to start the discussion.