How ronitpatil/healthcarechatbot works
Project Type and Purpose
• This is a full-stack, AI-powered healthcare data mining application. Its main goal is to process and retrieve accurate, timely healthcare information by directly interfacing with multiple Large Language Models (LLMs) via a Streamlit-based UI.
• The system integrates several LLMs (like OpenAI, Claude, Gemini, Mistral, and LLama2), uses web scraping (via Beautiful Soup and requests) to gather healthcare data, and evaluates responses using Trulens.
Analyzing the File Structure
• Top-Level Files and Directories:
– OpenAI.py: Likely acts as the main Streamlit entry point.
– README.md: Provides a high-level overview, architecture description, and setup instructions.
– pages/: Contains individual modules (Claude.py, Gemini.py, History_Aware_Retriever_Chain.py, Langchain_Agent.py, Retriever_Chain.py) which likely represent different LLM integrations or specific query chains.
– utils/: Provides supportive functions to create chains (create_chains.py), load healthcare data (data_loader.py, load_healthcare_data.py), and initialize the underlying vector store (initialize_vector_store.py).
– requirements.txt: Lists all the dependencies needed to run the project.
• Architectural Hint:
– The separation into “pages” and “utils” indicates a clear separation of concerns: the UI/interaction layer versus underlying data processing and logic.
Core Components to Highlight
a. Frontend/UI Layer:
– Streamlit Interface: Represents the entry point where users input queries, upload files, and view responses.
b. LLM Integration Modules (in the pages/ folder):
– Each script (e.g., OpenAI.py, Claude.py, Gemini.py) forms a distinct module responsible for handling communication with a particular LLM.
c. Data Processing and Chain Creation (in the utils/ folder):
– Utility modules such as create_chains.py, data_loader.py, initialize_vector_store.py, and load_healthcare_data.py handle backend processing like data pre-processing, chain creation, and vector store management.
– Label these as “Chain/Process Utilities” or “Backend Services.”
d. External Services:
– LLM APIs: Represent external connections to services such as OpenAI’s API, Claude, Gemini, and others.
– Data Sources: Represent healthcare websites (e.g., WebMD, Mayo Clinic) used for web scraping, and even the evaluation component using Trulens.
Relationships and Interactions
• How user queries flow from the Streamlit UI to the respective LLM integration modules.
• If relevant, indicate feedback paths from the evaluation engine (Trulens) back into the processing pipelines for adjustment or analysis.
Architectural Patterns and Technologies
• The system follows a modular design separating the presentation layer (UI), business logic (LLM integrations and chain operations), and data processing (utils for data loading and vector store initialization).
• Design principles like separation of concerns and the use of micro-modules for each LLM integration.
• Key technologies: Python, Streamlit, Beautiful Soup, Requests, and Trulens.