DefangLabs / docs-chatbot

0 stars 0 forks source link

Scikit RAG + OpenAI

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.

Prerequisites

  1. Download Defang CLI
  2. (Optional) If you are using Defang BYOC authenticated with your AWS account
  3. (Optional - for local development) Docker CLI

Deploying

  1. Open the terminal and type defang login
  2. Type defang compose up in the CLI.
  3. Your app will be running within a few minutes.

Local Development

  1. Clone the repository.
  2. Create a .env file in the root directory and set your OpenAI API key or add the OPENAI_API_KEY into your .zshrc or .bashrc file:
  3. Run the command docker compose -f compose.dev.yaml up --build to spin up a docker container for this RAG chatbot

Configuration


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