CoolFace
Apppublic

buschbd7/North_Carolina_Statutory_Librarian_Fronty

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes
App README

North Carolina General Statutes RAG Chatbot

This is a Retrieval Augmented Generation (RAG) application powered by Grok LLM and VoyageAI embeddings within a ChromaDB vector store. It serves as a legal librarian, allowing users to query the North Carolina General Statutes.

Application Purpose

This application is designed to provide precise and and context-aware answers to legal questions based on the North Carolina General Statutes. It aims to assist legal professionals and researchers by retrieving relevant statutory text and generating responses that adhere strictly to the provided legal context.

How it Works

  1. 1.Embedding Generation: The entire collection of North Carolina General Statutes has been processed and embedded using VoyageAI's voyage-law-2 model.
  2. 2.Vector Store (ChromaDB): These embeddings are stored in a persistent ChromaDB, enabling efficient semantic search.
  3. 3.Context Retrieval: When a user submits a query, the application performs a similarity search on the ChromaDB to retrieve the most relevant sections of the North Carolina General Statutes.
  4. 4.Grok LLM Integration: The retrieved statutory context, along with the user's query, is then fed to the Grok LLM (grok-4-1-fast-reasoning).
  5. 5.Response Generation: Grok generates an answer, strictly adhering to the provided context and a set of predefined rules to ensure accuracy and relevance, acting as an "ultra-precise statutory research assistant."

How to Use

  1. 1.Type your legal question regarding North Carolina General Statutes into the chat input box at the bottom of the screen.
  2. 2.Press Enter or click the send button.
  3. 3.The chatbot will retrieve relevant sections from the statutes and provide an answer, citing its sources. You may also find direct HTML links to the official statutes within the generated response.

Configuration

The application uses specific configurations for Grok and retrieval:

  • —Grok Model: grok-4-1-fast-reasoning
  • —Temperature: 0.2 (for more factual and less creative responses)
  • —Number of Retrieved Documents (N_RESULTS): 15 (top 15 most relevant documents)

API Keys

This application requires XAI_API_KEY for Grok LLM and VOYAGE_API_KEY for VoyageAI Embeddings to be set as environment variables in the Hugging Face Space secrets.