Updating file structure
Browse files- .DS_Store +0 -0
- RAG_APP_README.md +0 -54
- README.md +4 -8
- src/.DS_Store +0 -0
- src/__pycache__/__init__.cpython-310.pyc +0 -0
- src/__pycache__/__init__.cpython-313.pyc +0 -0
- src/__pycache__/ingest.cpython-310.pyc +0 -0
- src/__pycache__/ingest.cpython-313.pyc +0 -0
- src/__pycache__/qa_chain.cpython-310.pyc +0 -0
- src/__pycache__/vectorstore.cpython-310.pyc +0 -0
- tests/__pycache__/test_imports.cpython-310-pytest-7.2.0.pyc +0 -0
- tests/test_imports.py +0 -28
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
RAG_APP_README.md
DELETED
|
@@ -1,54 +0,0 @@
|
|
| 1 |
-
# Abalone RAG Chatbot
|
| 2 |
-
|
| 3 |
-
This project implements a Retrieval-Augmented Generation (RAG) chatbot about Abalone using LangChain + OpenAI with a Streamlit frontend. It's designed to be deployed on Hugging Face Spaces.
|
| 4 |
-
|
| 5 |
-
Contents
|
| 6 |
-
- `app.py` - Streamlit app entrypoint
|
| 7 |
-
- `src/ingest.py` - Ingest files from `data/` into a persisted Chroma vectorstore
|
| 8 |
-
- `src/vectorstore.py` - Helpers to build/load the Chroma vectorstore and return a retriever
|
| 9 |
-
- `src/qa_chain.py` - Build the conversational retrieval QA chain
|
| 10 |
-
- `data/` - Put Abalone source files here (CSV/MD/TXT/PDF)
|
| 11 |
-
- `vectorstore/` - Persisted vectorstore directory (created by ingestion)
|
| 12 |
-
|
| 13 |
-
Quickstart (local)
|
| 14 |
-
|
| 15 |
-
1. Create a venv and install dependencies:
|
| 16 |
-
|
| 17 |
-
```bash
|
| 18 |
-
python -m venv .venv
|
| 19 |
-
source .venv/bin/activate
|
| 20 |
-
pip install -r requirements.txt
|
| 21 |
-
```
|
| 22 |
-
|
| 23 |
-
2. Set your OpenAI API key:
|
| 24 |
-
|
| 25 |
-
```bash
|
| 26 |
-
export OPENAI_API_KEY="sk-..."
|
| 27 |
-
```
|
| 28 |
-
|
| 29 |
-
3. Add Abalone files into `data/` (for example `abalone.csv`).
|
| 30 |
-
|
| 31 |
-
4. Build the vectorstore:
|
| 32 |
-
|
| 33 |
-
```bash
|
| 34 |
-
python -m src.ingest --data-dir ./data --persist-dir ./vectorstore
|
| 35 |
-
```
|
| 36 |
-
|
| 37 |
-
5. Run the Streamlit app:
|
| 38 |
-
|
| 39 |
-
```bash
|
| 40 |
-
streamlit run app.py
|
| 41 |
-
```
|
| 42 |
-
|
| 43 |
-
Deploying to Hugging Face Spaces
|
| 44 |
-
|
| 45 |
-
- Add `OPENAI_API_KEY` in the Spaces secrets (Settings -> Secrets).
|
| 46 |
-
- Push this repository to your HF Space. HF will install `requirements.txt` and run the Streamlit app.
|
| 47 |
-
- On first run, click the "Ingest data" button or allow the app to rebuild the index.
|
| 48 |
-
|
| 49 |
-
Security
|
| 50 |
-
- Do NOT commit your OpenAI API key. Use HF Spaces Secrets for deployment.
|
| 51 |
-
|
| 52 |
-
License
|
| 53 |
-
- MIT
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
|
@@ -1,13 +1,9 @@
|
|
| 1 |
---
|
| 2 |
title: Abalone Chat Application
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
-
sdk:
|
| 7 |
-
sdk_version: 6.0.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
-
short_description: Abalone Chatbot
|
| 11 |
---
|
| 12 |
-
|
| 13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
title: Abalone Chat Application
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: pink
|
| 6 |
+
sdk: streamlit
|
|
|
|
| 7 |
app_file: app.py
|
| 8 |
pinned: false
|
|
|
|
| 9 |
---
|
|
|
|
|
|
src/.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
src/__pycache__/__init__.cpython-310.pyc
DELETED
|
Binary file (170 Bytes)
|
|
|
src/__pycache__/__init__.cpython-313.pyc
DELETED
|
Binary file (164 Bytes)
|
|
|
src/__pycache__/ingest.cpython-310.pyc
DELETED
|
Binary file (2.68 kB)
|
|
|
src/__pycache__/ingest.cpython-313.pyc
DELETED
|
Binary file (4.95 kB)
|
|
|
src/__pycache__/qa_chain.cpython-310.pyc
DELETED
|
Binary file (1.46 kB)
|
|
|
src/__pycache__/vectorstore.cpython-310.pyc
DELETED
|
Binary file (1.19 kB)
|
|
|
tests/__pycache__/test_imports.cpython-310-pytest-7.2.0.pyc
DELETED
|
Binary file (1.84 kB)
|
|
|
tests/test_imports.py
DELETED
|
@@ -1,28 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
from pathlib import Path
|
| 4 |
-
|
| 5 |
-
project_root = Path(__file__).resolve().parents[1]
|
| 6 |
-
if str(project_root) not in sys.path:
|
| 7 |
-
sys.path.insert(0, str(project_root))
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
def test_module_imports_and_symbols():
|
| 11 |
-
import importlib
|
| 12 |
-
|
| 13 |
-
modules = [
|
| 14 |
-
"src.ingest",
|
| 15 |
-
"src.vectorstore",
|
| 16 |
-
"src.qa_chain",
|
| 17 |
-
]
|
| 18 |
-
for mod_name in modules:
|
| 19 |
-
mod = importlib.import_module(mod_name)
|
| 20 |
-
assert mod is not None
|
| 21 |
-
|
| 22 |
-
from src import ingest as ingest_mod
|
| 23 |
-
from src.vectorstore import get_retriever
|
| 24 |
-
from src.qa_chain import make_conversational_chain
|
| 25 |
-
|
| 26 |
-
assert callable(ingest_mod.ingest)
|
| 27 |
-
assert callable(get_retriever)
|
| 28 |
-
assert callable(make_conversational_chain)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|