How shreeyashah09/end-to-end-medibot-generative-ai works
Project type and purpose
• This is a Python-based AI tool (not a full web-stack) that ingests medical reference material, constructs prompts, calls an LLM (e.g., OpenAI or Hugging Face endpoint), and returns generated medical content.
• README title “End-to-End-MediBot-Generative-AI” implies a pipeline from raw data (a PDF medical book) through prompt/template construction to model inference.
File structure
• Top‐level orchestrator: app.py (entry point for CLI or service).
• Data folder: holds the source PDF (Data/Medical_book.pdf.pdf).
• src/ directory:
– helper.py: routines for PDF parsing, text cleaning, chunking.
– prompt.py: logic to assemble question + context into API payload.
– __init__.py: packaging marker.
• template.py: houses reusable prompt templates or Jinja-style structures.
• research/trials.ipynb: exploratory notebooks for model testing, not part of production pipeline.
• setup.py, requirements.txt: packaging and dependency definitions.
README for additional insights
• No detailed architecture section, so infer from filenames and common Generative-AI pipelines.
Main components and their interactions
a. Data Ingestion & Preprocessing
– Component: “PDF Loader & Text Extractor” (helper.py)
– Input: Data/Medical_book.pdf.pdf
– Output: Cleaned text or tokenized chunks.
b. Prompt Construction
– Component: “Prompt Builder” (prompt.py + template.py)
– Input: User query (from app.py) + relevant text chunks
– Output: API payload (JSON) with fully formed prompt
c. Model Inference
– Component: “LLM Client” (wrapped in prompt.py or a separate layer)
– External Service: OpenAI/HF API endpoint
– Input: Prompt JSON, API key from environment or config
– Output: Generated response text
d. Output Handling
– Component: “Response Formatter” (helper.py or app.py)
– Formats returned text, handles pagination or saving results
e. Orchestration & CLI Service
– Component: “Application Entry Point” (app.py)
– Coordinates all sub-components and exposes a simple CLI or REST endpoint
f. Packaging & Installation
– setup.py & requirements.txt define dependencies and installable package
g. Research & Experimentation
– research/trials.ipynb sits outside production flow—used for model hyperparameter tuning and testing
Architectural patterns & design principles
• Pipeline pattern: clear linear flow from ingestion → prompt assembly → inference → output.
• Modular separation: each responsibility lives in its own file (Single Responsibility Principle).
• Dependency inversion: app.py depends on abstracted helper and prompt modules, not raw parsing code.