AI legal assistant for Chinese law leveraging vector search
Top 10.4% on sourcepulse
This project provides an AI legal assistant that leverages custom knowledge bases to enhance OpenAI's text completion capabilities. It's designed for developers and researchers looking to build domain-specific AI applications, offering a streamlined approach to integrating external data with large language models.
How It Works
The system follows a four-step process, separating knowledge base preprocessing from runtime query execution. At build time, .mdx
files are chunked, converted into embeddings using OpenAI's API, and stored in a PostgreSQL database with the pgvector
extension. Checksums are used to efficiently update embeddings only when source files change. At runtime, user queries are also embedded, and a similarity search is performed against the stored vectors to retrieve relevant document chunks. These chunks are then injected into an OpenAI GPT-3 prompt, and the response is streamed back to the client.
Quick Start & Requirements
.env
with OPENAI_KEY
, starting Supabase via npx supabase start
, and running the Next.js app with pnpm dev
.Highlighted Details
pgvector
for efficient similarity search within PostgreSQL.Maintenance & Community
The project is based on a Supabase community template. Further community engagement or roadmap details are not explicitly provided in the README.
Licensing & Compatibility
The repository's license is not specified in the README. Compatibility for commercial use or closed-source linking would depend on the underlying licenses of its dependencies (OpenAI API, Next.js, Supabase, etc.).
Limitations & Caveats
The project relies heavily on the OpenAI API, incurring associated costs. The effectiveness of the legal assistant is directly tied to the quality and comprehensiveness of the provided .mdx
legal documents.
2 years ago
Inactive