The Pharma Knowledge Assistant is an intelligent application designed to enhance access to pharmaceutical knowledge using cutting-edge AI technologies. Built with GPT-2 from Huggingface and an interactive user interface powered by Streamlit, this project incorporates Retrieval-Augmented Generation (RAG) and an Agentic framework to deliver dynamic and accurate responses to user queries. It provides features such as question answering, recommendations, alternatives generation, and summarization tailored for pharmaceutical datasets.
-
Question Answering
- Responds to natural language queries about pharmaceutical products.
- Example: "What is the composition and primary use of Paracetamol?"
-
Recommendations
- Provides tailored advice or warnings based on user inputs.
- Example: "Can I take Ibuprofen if I have a history of stomach ulcers?"
-
Alternatives Generation
- Suggests product alternatives when specific medications are not suitable.
-
Summarization
- Delivers concise summaries of pharmaceutical product details.
-
Agentic Framework
- Integrates all features into a graph-based Agentic framework, where each functionality operates as a node.
-
Search Integration
- Leverages external search tools when the dataset lacks sufficient information.
-
GUI Chatbot
- A user-friendly chatbot interface built with Streamlit, enabling real-time interactions.
- Large Language Model: GPT-2 via Huggingface.
- Frameworks: Streamlit, LangChain, LangGraph.
- Backend: Python-based architecture leveraging Agentic RAG principles.
- Evaluation Tools: Metrics evaluation using TruLens for relevance, groundedness, and comprehensiveness.
The application is structured as a graph-based Agentic system:
- Nodes:
- Question Answering using RAG.
- Recommender system.
- Alternatives generator.
- Summarizer.
- Router Nodes:
- Routes user queries to the appropriate node.
- Handles fallback mechanisms for web search when required.
- Context Sharing:
- Maintains a unified context across nodes for seamless interactions.
- Python 3.9 or above
- GPU (optional for improved performance)
- Streamlit installed
- Clone the repository:
git clone https://github.com/your-username/pharma-knowledge-assistant.git
cd pharma-knowledge-assistant- Install dependencies
pip install -r requirements.txt- Start the application
streamlit run streamlit.pyInteract with the chatbot via the web-based GUI
The following metrics are used to evaluate the system:
Context Relevance: Ensuring the response aligns with the query context. Answer Relevance: Accuracy and utility of responses. Groundedness: Validity of responses backed by the dataset. Comprehensiveness: Coverage of the query requirements.
- PES University ESA Hackathon for the foundational problem statement.
- Huggingface, Streamlit, LangChain, and LangGraph communities for their resources and support.