Movie recommender chatbot using FastAPI, Streamlit, LangChain and semantic-router with FAISS RAG.
Navigate to the project directory 1.
cd movie-recommender-chatbot
- Create
.env
file and add these keys
OPENAI_API_KEY={OPENAI_API_KEY}
RETRIEVER_EMBEDDING_MODEL=text-embedding-3-small
OPENAI_TIMEOUT=30
OPENAI_TEMPERATURE=0.3
OPENAI_MODEL_NAME=gpt-4o
RETRIEVER_EMBEDDING_THRESHOLD=0.4
docker-compose up --build
- Make sure you have
Poetry
innstalled in your enviornment
pip install poetry
- Navigate to the backed directory
cd components/backend
- Install dependencies
poetry shell
poetry install
- Run the app
cd src/
uvicorn app:app --host 0.0.0.0 --port 8080
- Navigate to the backed directory
cd components/frontend
- Install dependencies
poetry shell
poetry install
- Run the frontend (optional)
Make sure you are in the right dir
frontend
streamlit run src/app.py --server.port 8081 --server.address 0.0.0.0
- URL:
/chat
- Method:
POST
- Description: stream the chatbot response to the user
- Request Body:
{
"message": "hello",
"clear_history": false
}
-
Success Response:
-
Response Type:
text/event-stream
-
Code:
200 OK
-
Content:
data: {"streamed_text": "Hello! I'm here to help you find the perfect movie to watch. ", "is_final": false} data: {"streamed_text": "Could you tell me a bit about what you're in the mood for? ", "is_final": false} data: {"streamed_text": "Are there any specific themes, settings, or favorite movies you'd like me to consider for my recommendations?", "is_final": true}