How rithwikthirumalaraju14/medchatbot works
Main Components
• Web Interface & API: Represented primarily by app.py together with the Flask templates (in the templates folder) and static assets (in the static folder).
• Backend Processing Modules: Include the modules in src (prompt.py and helper.py) that generate prompts and perform processing.
• Persistent Context Storage: The client directory contains ChromaDB-related files (SQLite file and binary assets) that are used to store conversation context.
• External LLM Service: The integration with GROQ’s Llama-3.1-70B model, which is used for generating responses.
• Configuration & Dependencies: Files such as .env and requirements.txt should be noted to understand configuration and external dependencies.
• Utility Files: Additional files like store.py and trying_chat_templates.py can be indicated as support or layer components to facilitate data management or experimental UI components.
• Static Medical Data: The “data” folder (e.g., Medical_book.pdf) might be used as a reference or source of additional information.
Out the Interactions
• Web Routing & API: Show that the Flask server handles both HTML-based requests (rendering chat.html) and REST API calls (e.g., the “/get” endpoint).
• Chatbot Processing Flow:
◦ On receiving an input, the Flask app may call functions in the src directory (prompt.py and helper.py) to build the prompt.
◦ The prompt is sent to the GROQ Llama-3.1-70B external service (likely via LangChain integration).
◦ Concurrently, context data is retrieved from or stored into the ChromaDB system, which is represented by the files in the client directory.
• Response Flow: The generated response is then routed back from the external language model through the Flask app to the web client.
Architectural Patterns and Technologies
• MVC Pattern: Although it’s simple, note that Flask acts as the controller and view, while the src modules act as business logic layers.
• REST API and Web Frontend Separation: Clearly denote the two interaction types (web and API).
• External Service Integration: Show the linkage to the GROQ language model service, indicating that this is an external dependency.
• Persistent Storage: Emphasize how ChromaDB (with its client data) is crucial for maintaining conversation context.