Skip to content
Back to the list

chat.rentaicoder.com/law.html

Vietnamese Legal AI Assistant

An agent that picks its own retrieval tool and cites the exact article

Legal chatbots fail at citation: they invent article numbers. This system never lets the model answer from memory — every answer goes through one of five lookup tools over an offline corpus of nine digitised Vietnamese legal codes.

§ 01Algorithm

LawChatOperator.cs — agent tự chọn công cụ tra cứu
tools = [
  read_summaries()             # chỉ mục kỹ thuật toàn corpus → định hướng
  search_law_embedding(q, n)   # ngữ nghĩa tình huống, 768-dim
  search_law_bm25(q, n)        # từ khoá
  search_law_grep(q, n)        # tra chính xác "Điều 34 khoản 2"
  get_references(article)      # tham chiếu chéo giữa các luật
]

loop:
  agent chọn tool theo dạng câu hỏi        # không phải RAG một chiều cố định
  nếu turn % 10 == 0:  compact(events)     # EventsCompactionConfig.CompactionInterval

answer := vấn đề pháp lý
        → trích nguyên văn Điều/Khoản
        → quyền & nghĩa vụ từng bên
        → hướng xử lý thực tế

§ 02Highlights

  • Nine Vietnamese legal codes digitised and vector-indexed, including the 2025 AI Law
  • Five tools: corpus index, semantic, keyword, exact article lookup, cross-reference
  • Offline corpus — there is no path for the model to invent an article that does not exist
  • Context compaction every ten turns keeps long threads coherent
  • Token-by-token streaming over Server-Sent Events

§ 03Screens

Vietnamese Legal AI Assistant01
Vietnamese Legal AI Assistant02