This sample demonstrates how to deploy a Flask-based Retrieval-Augmented Generation (RAG) chatbot using OpenAI's GPT model. The chatbot retrieves relevant documents from a knowledge base using scikit-learn and Sentence Transformers and then generates responses using OpenAI's GPT model.
defang login
defang compose up
in the CLI..env
file in the root directory and set your OpenAI API key or add the OPENAI_API_KEY into your .zshrc or .bashrc file:docker compose -f compose.dev.yaml up --build
to spin up a docker container for this RAG chatbotget_knowledge_base.py
parses every webpage as specified into paragraphs and writes to knowledge_base.json
for the RAG retrieval.Title: Scikit RAG + OpenAI
Description: An application demonstrating a GPT-4-based chatbot enhanced with a Retrieval-Augmented Generation (RAG) framework, leveraging scikit-learn for efficient contextual embeddings and dynamic knowledge retrieval.
Tags: Flask, Scikit, Python, RAG, OpenAI, GPT, Machine Learning
Languages: python