Health Bot is an intelligent conversational agent built using LangGraph that provides reliable health information to users. The bot can answer questions about various health topics, medical conditions, and treatments in patient-friendly language. It uses a structured conversation flow to gather necessary context before providing comprehensive answers.
- Interactive Health Information: Ask questions about any health topic and receive concise, accurate information.
- Clarification Questions: The bot asks follow-up questions to better understand your specific needs.
- Web Search Integration: Uses Tavily Search API to retrieve up-to-date medical information from reliable sources.
- Patient-Friendly Language: All responses are presented in clear, accessible language.
- Customizable Workflow: The conversation flow can be extended or modified to suit different healthcare information needs.
- Python 3.9+
- OpenAI API key
- Tavily API key
- Clone this repository:
git clone https://github.com/tanluuuuuuu/health-bot.git
cd health-bot- Install dependencies using
uv:
pip install uv==0.7.12
uv sync
source .venv/bin/activate- Create a .env file with your API keys:
cp .env.example .env Edit the .env file to include:
OPENAI_API_KEY=your_openai_api_key
TAVILY_API_KEY=your_tavily_api_keypython -m src.mainThis will start an interactive session where you can ask health-related questions.
The Health Bot uses a multi-step workflow:
- User Query: The user asks a health-related question.
- Clarification: The bot may ask follow-up questions to better understand the user's needs.
- Information Retrieval: The bot searches for relevant information using the Tavily Search API.
- Response Generation: The bot synthesizes the information into a clear, concise answer.
The core logic is defined in src/agent/graph.py, which orchestrates the conversation flow between different components.
- Define configurable parameters: Modify the
Configurationclass ingraph.pyto expose arguments you want to configure, such as the model to use or response length. - Extend the graph: Add new nodes or edges to change the conversation flow or add new capabilities.
- Customize prompts: Edit the prompt templates in the
src/promptsdirectory to change how the bot interacts with users.
The bot automatically searches for information on any health topic. However, you can enhance its knowledge by:
- Adding specialized prompt templates for common conditions
- Implementing domain-specific tools for particular health areas
- Fine-tuning the underlying model with medical knowledge
While developing, you can use LangGraph Studio to visualize and debug the conversation flow. Local changes will be automatically applied via hot reload.
For more advanced features and examples, refer to the LangGraph documentation.
LangGraph Studio integrates with LangSmith for in-depth tracing and collaboration, allowing you to analyze and optimize your bot's performance.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with LangGraph and LangChain
- Uses Tavily for web search capabilities
- Powered by OpenAI's language
