This project develops an intelligent legal query system for Mexican labor law using Retrieval-Augmented Generation (RAG) and natural language processing, democratizing legal knowledge for non-specialized users. The methodology integrates ChromaDB as vector database, multilingual embeddings from Hugging Face, Ollama with llama2:7b-chat model, FastAPI framework, and LangChain for AI orchestration. The modular architecture ensures scalability and efficient maintenance. The system operates through three stages: semantic retrieval from the legal knowledge base, contextual augmentation using a legal glossary, and response generation via specialized prompts. Customized re-ranking algorithms enhance search precision. The JSON-formatted knowledge base contains frequently asked questions, detailed answers, and a specialized Mexican labor law glossary. Results demonstrate high efficacy in addressing queries on fundamental labor law concepts (worker, minimum wage, dismissal) with three-to-five-minute response times and high retrieval precision. This project significantly contributes to AI applications in the legal sector, democratizing access to labor legal information in Mexico and establishing a replicable framework for other legal domains, with implications for legal education and access to justice.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Intelligent Legal Query System for Mexican Labor Law Based on Retrieval-Augmented Generation (RAG)

  • Germán Ulises Estrada Alquicira,
  • José Ismael Ojeda Campaña,
  • Alberto Ochoa Zezzatti

摘要

This project develops an intelligent legal query system for Mexican labor law using Retrieval-Augmented Generation (RAG) and natural language processing, democratizing legal knowledge for non-specialized users. The methodology integrates ChromaDB as vector database, multilingual embeddings from Hugging Face, Ollama with llama2:7b-chat model, FastAPI framework, and LangChain for AI orchestration. The modular architecture ensures scalability and efficient maintenance. The system operates through three stages: semantic retrieval from the legal knowledge base, contextual augmentation using a legal glossary, and response generation via specialized prompts. Customized re-ranking algorithms enhance search precision. The JSON-formatted knowledge base contains frequently asked questions, detailed answers, and a specialized Mexican labor law glossary. Results demonstrate high efficacy in addressing queries on fundamental labor law concepts (worker, minimum wage, dismissal) with three-to-five-minute response times and high retrieval precision. This project significantly contributes to AI applications in the legal sector, democratizing access to labor legal information in Mexico and establishing a replicable framework for other legal domains, with implications for legal education and access to justice.