Sign inSign up

michafein/ragchatapp

By michafein

•Updated over 1 year ago

RAG Chatbot App built with Python (Flask) and designed to interact with LM-Studio via its REST API

Image
Machine learning & AI
Data science
0

863

michafein/ragchatapp repository overview

⁠Docker Hub Repository: RAG Chatbot App
⁠Description

This Docker image features a Retrieval-Augmented Generation (RAG) Chatbot App built with Python (Flask) and designed to interact with LM-Studio via its REST API. The app enables users to communicate with an AI model running on a local LM-Studio server through a web interface and interact with the contents of a selected PDF document.


⁠Prerequisites
  1. LM-Studio:

    • Ensure LM-Studio is running on your host system with the REST API enabled.
    • Load the models in LM-Studio:
      • Chat Model loaded for this image: deepseek-r1-distill-qwen-7b
      • Embedding loaded for this image: text-embedding-all-minilm-l6-v2-embedding
  2. Docker:

    • Docker must be installed on your system.

⁠Pull the Image

Download the Docker image from Docker Hub:

docker pull michafein/ragchatapp:latest

⁠Run the Container

Run the container with the following environment variables to configure the app:

docker run -d \  # Run the container in detached mode (background)
  -p 5000:5000 \  # Map port 5000 on the host to port 5000 in the container
  -e LM_STUDIO_API_URL="http://host.docker.internal:1234/v1/chat/completions" \  # Set the API URL for chat completions
  -e LM_STUDIO_EMBEDDING_API_URL="http://host.docker.internal:1234/v1/embeddings" \  # Set the API URL for embeddings
  -e EMBEDDING_MODEL_NAME="text-embedding-all-minilm-l6-v2-embedding" \  # Define the embedding model name you select in LM Studio
  -e CHAT_MODEL_NAME="deepseek-r1-distill-qwen-7b" \  # Define the chat model name you select in LM Studio
  -e PDF_PATH="human-nutrition-text.pdf" \  # Specify the path to the PDF file for retrieval
  --name ragchatbot \  # Assign a name to the running container (ragchatbot)
  michafein/ragchatapp:latest  # Use the specified image from Docker Hub (latest version)

⁠Environment Variables

The following variables can be set when running the container:

VariableDescriptionMy Default Values
LM_STUDIO_API_URLURL for the LM-Studio Chat API.http://host.docker.internal:1234/v1/chat/completions
LM_STUDIO_EMBEDDING_API_URLURL for the LM-Studio Embedding API.http://host.docker.internal:1234/v1/embeddings
EMBEDDING_MODEL_NAMEName of the embedding model in LM-Studio.text-embedding-all-minilm-l6-v2-embedding
CHAT_MODEL_NAMEName of the chat model in LM-Studio.deepseek-r1-distill-qwen-7b
PDF_PATHPath to the PDF file used for the RAG pipeline.human-nutrition-text.pdf

⁠Access the App

Once the container is running, open your browser and navigate to:

http://localhost:5000

⁠Notes
  • LM-Studio on Host:
    Since LM-Studio runs on your host system, use host.docker.internal (Mac/Windows) or your host's IP (Linux) to access the API.
  • PDF File:
    My default PDF file (human-nutrition-text.pdf) is included in the image. If you want to use a different file, mount it as a volume into the container.

⁠Volumes (Optional)

If you want to use a custom PDF file, mount it into the container:

docker run -d
  -p 5000:5000
  -v /path/to/your/pdf.pdf:/app/your_pdf_file.pdf
  -e PDF_PATH="your_pdf_file.pdf"
  --name ragchatbot
  michafein/ragchatapp:latest

Tag summary

Content type

Image

Digest

sha256:0f6cc6166…

Size

295.3 MB

Last updated

over 1 year ago

docker pull michafein/ragchatapp