This project is purposed to create RAG(retriever-augmented-generation) chatbot application using fastapi and docker.
If you upload .pdf file, RAG chatbot performs Q&A based on your document.
This project heavily referenced @AshishSinha5’s rag_api project.
- Getting Started
- Usage
- Starting the local server
- Deploying the server
-
Clone this repository to your local machine.
git clone https://github.com/jodog0412/langchain-app-with-fastapi.git cd langchain-app-with-fastapi
-
Create a virtual environment in your local directory and activate it.
python -m venv .venv .venv/bin/activate.bat
-
Install Python packages in your virtual environment.
pip install -r requirements.txt -
Set
OPEN_AI_API_KEYon.envfile in theappdirectory.# app/.env OPENAI_API_KEY =
cd app
uvicorn main:app --reload-
Set
OPEN_AI_API_KEYonDockerfile.FROM python:3.10 WORKDIR /code COPY . /code RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt ENV OPENAI_API_KEY "ENTER YOUR OPENAI API KEY" WORKDIR /code/app CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] -
Build docker-image.
docker build --pull --rm -f "Dockerfile" -t langchainappwithfastapi:latest "."
-
Create docker-container.
docker run -d --name container -p 8000:8000 langchainappwithfastapi
- build history-aware RAG chatbot
- implement client-server RESTful-API
- implement websocket connection
- deploy the app
- bug fixes(deployed app has some errors)
- support local LLM(only supports
GPTmodel in current version)