Skip to content

Designed and developed a chatbot for hospital management systems using LangChain. The chatbot incorporated RAG with Neo4j graph database for knowledge retrieval, memory chains for context retention, and ChatGPT models to handle dynamic patient interactions. It also employed agents and tools for enhanced conversational capabilities

Notifications You must be signed in to change notification settings

hperer02/Hospital-Chatbot

Repository files navigation

Hospital-Chatbot

Designed and developed a chatbot for hospital management systems using LangChain. The chatbot incorporated RAG with Neo4j graph database for knowledge retrieval, memory chains for context retention, and ChatGPT models to handle dynamic patient interactions. It also employed agents and tools for enhanced conversational capabilities

Build an LLM RAG Chatbot With LangChain

To run the final application that you'll build in this tutorial, you can use the code provided in Hospital-Chatbot

Setup

Create a .env file in the root directory and add the following environment variables:

OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>

NEO4J_URI=<YOUR_NEO4J_URI>
NEO4J_USERNAME=<YOUR_NEO4J_USERNAME>
NEO4J_PASSWORD=<YOUR_NEO4J_PASSWORD>

HOSPITALS_CSV_PATH=https://raw.githubusercontent.com/hfhoffman1144/langchain_neo4j_rag_app/main/data/hospitals.csv
PAYERS_CSV_PATH=https://raw.githubusercontent.com/hfhoffman1144/langchain_neo4j_rag_app/main/data/payers.csv
PHYSICIANS_CSV_PATH=https://raw.githubusercontent.com/hfhoffman1144/langchain_neo4j_rag_app/main/data/physicians.csv
PATIENTS_CSV_PATH=https://raw.githubusercontent.com/hfhoffman1144/langchain_neo4j_rag_app/main/data/patients.csv
VISITS_CSV_PATH=https://raw.githubusercontent.com/hfhoffman1144/langchain_neo4j_rag_app/main/data/visits.csv
REVIEWS_CSV_PATH=https://raw.githubusercontent.com/hfhoffman1144/langchain_neo4j_rag_app/main/data/reviews.csv

HOSPITAL_AGENT_MODEL=gpt-3.5-turbo-1106
HOSPITAL_CYPHER_MODEL=gpt-3.5-turbo-1106
HOSPITAL_QA_MODEL=gpt-3.5-turbo-0125

CHATBOT_URL=http://host.docker.internal:8000/hospital-rag-agent

The chatbot uses OpenAI LLMs, so you'll need to create an OpenAI API key and store it as OPENAI_API_KEY.

The three NEO4J_ variables are used to connect to your Neo4j AuraDB instance. Follow the directions here to create a free instance.

Once you have a running Neo4j instance, and have filled out all the environment variables in .env, you can run the entire project with Docker Compose. You can install Docker Compose by following these directions.

Once you've filled in all of the environment variables, set up a Neo4j AuraDB instance, and installed Docker Compose, open a terminal and run:

$ docker-compose up --build

After each container finishes building, you'll be able to access the chatbot API at http://localhost:8000/docs and the Streamlit app at http://localhost:8501/.

About

Designed and developed a chatbot for hospital management systems using LangChain. The chatbot incorporated RAG with Neo4j graph database for knowledge retrieval, memory chains for context retention, and ChatGPT models to handle dynamic patient interactions. It also employed agents and tools for enhanced conversational capabilities

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published