Skip to content

saadsafda/RAG-Chatboat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RAG FastAPI example

This repository contains a minimal FastAPI app with a simple Retrieval-Augmented Generation (RAG) flow.

What I added

  • main.py - main FastAPI app. generate_ai_response now implements a local RAG flow using OpenAI embeddings + ChatCompletion when OPENAI_API_KEY is present.
  • knowledge/ - folder to store .txt documents used as the knowledge base (one sample file is provided).
  • .rag_index.json (created at runtime) caches document embeddings.
  • requirements.txt lists the python dependencies.

Quickstart (macOS / zsh)

  1. Create a virtualenv and install deps:
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
  1. Create a .env file (or copy .env.example) and set OPENAI_API_KEY plus ERPNext vars:
cp .env.example .env
# edit .env and set OPENAI_API_KEY and ERPNext values
  1. Add knowledge files (plain .txt) into the knowledge/ folder. A sample is included.

  2. Run the app:

uvicorn main:app --reload

Notes

  • If OPENAI_API_KEY isn't set or openai isn't installed, generate_ai_response falls back to a simulated response.
  • For production, use a proper vector DB (Qdrant/Pinecone) and secure secrets management instead of .env.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages