How arslaan5/lexiassist works
Project Type and Purpose
• LexiAssist is a full-stack web application (Django-based) with an AI chatbot front end.
• Purpose: Accept user legal queries, convert to embeddings, perform vector search (Pinecone), call an LLM (Groq), and render structured answers.
File Structure
• Top level:
• manage.py, requirements.txt
• legal_document_assistant/ – Django project settings, ASGI/WSGI, URLs
• assistant/ – Django app containing models, views, forms, templates, static assets, and data-processing scripts.
• documents/ – Source PDFs ingested into the vector store.
• staticfiles/ & theme/ – Collected static assets (Tailwind, admin, Jazzmin, DRF docs).
• The “assistant/scripts” directory holds the RAG pipeline stages: embedding, ingestion, search, transformation, uploading, and response handling.
• Config files: settings.py (DB, Pinecone, LLM credentials), package.json (static build).
README Insights
• Flow: Frontend → backend embedding → Pinecone similarity search → LLM → frontend.
• Tech stack: Django 5.1, Python 3.12, Tailwind CSS, PostgreSQL, Pinecone, langchain, huggingface & Groq APIs.
a. Main Components
• User Browser (React/Tailwind HTML templates)
• Django Server
• URL Router
• Views & Forms (assistant/views.py, forms.py)
• Models (PostgreSQL)
• Scripts Pipeline (assistant/scripts/)
• External Services
• Pinecone Vector DB
• Embedding API (Hugging Face jina-embeddings-v3)
• LLM API (Groq llama-3.1-8b)
• Static Assets Server (collected staticfiles)
b. Relationships & Interactions
1. User submits query → HTTP POST to Django URL endpoint.
2. View invokes data_embedder.py → calls embedding API.
3. embeddings → Pinecone similarity search (data_retriever.py) → returns top chunks.
4. data_transformation.py assembles context → response_handler.py calls LLM API.
5. LLM generates answer → view sends JSON/HTML response.
6. Browser displays answer; user session & auth managed by Django’s auth & assistant/models.py.
c. Architectural Patterns & Principles
• MVC pattern (Django’s MVT)
• Modular pipeline: each script focuses on one step (SRP).
• External service abstraction via utility layer (assistant/scripts/utils.py).
d. Key Technologies
• Django (URLs, Views, Models, Templates)
• Tailwind CSS + Jazzmin (UI)
• PostgreSQL (Django ORM)
• Pinecone & Hugging Face & Groq (external AI services)
• Langchain orchestrator (implicit in scripts)
Essential Elements
• Component labels: “User Browser”, “Django (View, Scripts)”, “PostgreSQL”, “Pinecone”, “LLM API”.