How asjaytee/pb-chatbot works
Project’s Core Purpose and Components
• Purpose: A chatbot that handles user queries using a custom RAG system (focusing on embedding questions, not answers) combined with an intelligent therapist matching module.
• Main components include:
• Frontend Interface: A Streamlit-based demo (demo.py) as the user interface to interact with the chatbot.
• Backend Logic: The main application (main.py) which coordinates between various systems.
• RAG System: Implemented in systems/RAG.py, this module orchestrates the optimized retrieval of Q&A data.
• Therapist Matching & Filtering: Located in systems/filtering_agent.py, systems/therapists.py, and systems/refer.py, this part handles multi-factor filtering and matching of client preferences.
• Cost & Efficiency Management: In systems/cost.py, covering calculations and cost-efficiency measures.
• Data Management: The systems/data folder contains example datasets (FAQs and therapists), ensuring separation of data.
• Model and Vector Store: Within systems/model (especially model.py) and systems/vectorstore.py, which likely deal with embedding generation (using cosine similarity, etc.) and storage/retrieval of these embeddings.
• Additional Utility & Testing: Files like test.py provide unit or integration checks, and demo.py offers a quick demonstration.
File Structure for Architectural Relationships
• Directory Significance:
• The “systems” directory encapsulates the business logic split into several core components (RAG, filtering, cost, model, vector store).
• The “resources” directory houses assets (logos, demo images) used by the frontend.
• Files like .env.example, requirements.txt, and devcontainer configurations set up the environment and dependencies.
• Interaction Patterns:
• The main file (main.py) likely acts as the entry point for backend operations.
• The Streamlit UI (demo.py) interacts with the backend modules.
• The RAG system works by processing and embedding only the question components, routed through model and vector store components—this emphasizes the separation of concerns in data handling.
• Therapist matching modules communicate with user query data and stored therapist profiles (JSON files in systems/data) to deliver recommendations.