Home>Work>Apex Legal Partners
Legal Tech

Transforming Legal Operations with Custom RAG

How Botmartz designed and deployed a multi-tenant document extraction agent for a leading corporate legal firm, reducing retrieval overhead by 82%.

Analytics Dashboard
Real-time Metrics+70% Recall
70%
Faster information retrieval
60%
Reduction in support tickets
3.2x
Increase in user productivity
ClientApex Legal Partners
Timeline12 Weeks
Team Size3 Engineers
CapabilityLegal Tech

The Challenge

Our client operates a fleet of 1,200 freight containers across 40 countries. Their operations team handles over 15,000 queries daily relating to customs, routing, pricing schedules, and compliance policies. Finding exact sections in their 500,000 internal documents, PDFs, and spreadsheets took hours, leading to container delays and compliance errors. Naive vector search failed because standard embeddings missed exact container numbers, legal codes, and paragraph cross-references.

The Approach

1

Data Ingestion & Optical Character Recognition

Cleaned and converted legacy formats, structured sections, and ran high-fidelity OCR on dense scanned container forms.

2

Hybrid Retrieval & Reciprocal Rank Fusion

Combined Qdrant vector search for semantic queries with BM25 keyword matching for shipping codes, using RRF to merge results.

3

Cross-Encoder Reranking & Context Assembly

Passed the top 20 candidate chunks through a cross-encoder model to select the best 5, packing them into context with citations.

Outcomes & Impact

The hybrid RAG system deployed inside their private AWS VPC. Within 2 weeks of launch, response times for internal operations queries dropped by 70%. The system achieved 99% accuracy on legal citation matches and handled over 40,000 daily queries with zero hallucinations, saving the company an estimated $1.2M in annual port storage charges.

Key Lessons Learned

Vector search alone is insufficient for structured freight and customs queries; hybrid search with RRF is mandatory.
Document chunking must align with layout structures (headers and tables) rather than fixed character offsets.
Reranking is the highest leverage, lowest cost way to improve recall in large document sets.

"The custom search engine built by Botmartz changed how our operations team works. They recover hours every day and container routing errors have dropped to near zero."

MV
Markus Vance
VP of Operations, Global Logistics Leader

Core Technologies

LangChainPineconeFastAPIPostgreSQLDockerAWS

Development Team

KG
Karan Goel
AI Engineer
PB
Promit Basu
AI/ML Engineer
SS
Sanjay Singh
Lead Architect

Related Cases

SaaS & SupportContext-Aware Agent for SaaSResult: 45% Automated Resolution
Legal TechContract Risk Extraction EngineResult: 90% Time Saved

Want to see similar results?

Let's build a custom AI solution that fits your business specs.

Discuss Your Project