Spaces:
Sleeping
Sleeping
Commit
·
0314a77
1
Parent(s):
d5cc289
Add Hugging Face Space configuration to README.md
Browse files- Readme.md +10 -80
- config/config.py +10 -7
Readme.md
CHANGED
|
@@ -1,80 +1,10 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
## Prerequisites
|
| 13 |
-
- Python 3.9+
|
| 14 |
-
- pip
|
| 15 |
-
- (Optional) Virtual environment
|
| 16 |
-
|
| 17 |
-
## Installation
|
| 18 |
-
|
| 19 |
-
1. Clone the repository
|
| 20 |
-
```bash
|
| 21 |
-
git clone https://your-repo-url.git
|
| 22 |
-
cd rag-chatbot
|
| 23 |
-
```
|
| 24 |
-
|
| 25 |
-
2. Create a virtual environment
|
| 26 |
-
```bash
|
| 27 |
-
python -m venv venv
|
| 28 |
-
source venv/bin/activate # On Windows use `venv\Scripts\activate`
|
| 29 |
-
```
|
| 30 |
-
|
| 31 |
-
3. Install dependencies
|
| 32 |
-
```bash
|
| 33 |
-
pip install -r requirements.txt
|
| 34 |
-
```
|
| 35 |
-
|
| 36 |
-
4. Set up environment variables
|
| 37 |
-
```bash
|
| 38 |
-
cp .env.example .env
|
| 39 |
-
# Edit .env with your credentials
|
| 40 |
-
```
|
| 41 |
-
|
| 42 |
-
## Configuration
|
| 43 |
-
|
| 44 |
-
### Environment Variables
|
| 45 |
-
- `OPENAI_API_KEY`: OpenAI API key
|
| 46 |
-
- `OLLAMA_BASE_URL`: Ollama server URL
|
| 47 |
-
- `EMBEDDING_MODEL`: Hugging Face embedding model
|
| 48 |
-
- `CHROMA_PATH`: Vector store persistence path
|
| 49 |
-
- `DEBUG`: Enable debug mode
|
| 50 |
-
|
| 51 |
-
## Running the Application
|
| 52 |
-
|
| 53 |
-
### Development Server
|
| 54 |
-
```bash
|
| 55 |
-
uvicorn src.main:app --reload
|
| 56 |
-
```
|
| 57 |
-
|
| 58 |
-
### Production Deployment
|
| 59 |
-
```bash
|
| 60 |
-
gunicorn -w 4 -k uvicorn.workers.UvicornWorker src.main:app
|
| 61 |
-
```
|
| 62 |
-
|
| 63 |
-
## Testing
|
| 64 |
-
```bash
|
| 65 |
-
pytest tests/
|
| 66 |
-
```
|
| 67 |
-
|
| 68 |
-
## Features
|
| 69 |
-
- Multiple LLM Provider Support
|
| 70 |
-
- Retrieval Augmented Generation
|
| 71 |
-
- Document Ingestion
|
| 72 |
-
- Flexible Configuration
|
| 73 |
-
- FastAPI Backend
|
| 74 |
-
|
| 75 |
-
## Contributing
|
| 76 |
-
1. Fork the repository
|
| 77 |
-
2. Create your feature branch
|
| 78 |
-
3. Commit your changes
|
| 79 |
-
4. Push to the branch
|
| 80 |
-
5. Create a Pull Request
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Chatbot Backend
|
| 3 |
+
emoji: 💬
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: docker
|
| 7 |
+
sdk_version: latest
|
| 8 |
+
app_file: src/main.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config/config.py
CHANGED
|
@@ -40,13 +40,16 @@ class Settings:
|
|
| 40 |
|
| 41 |
# MongoDB Configuration
|
| 42 |
# MONGODB_URI = os.getenv('MONGODB_URI', 'mongodb://localhost:27017')
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
# New Conversation Summarizer Settings
|
| 52 |
SUMMARIZER_CONFIG = {
|
|
|
|
| 40 |
|
| 41 |
# MongoDB Configuration
|
| 42 |
# MONGODB_URI = os.getenv('MONGODB_URI', 'mongodb://localhost:27017')
|
| 43 |
+
MONGODB_URI = os.getenv('MONGODB_URI', '')
|
| 44 |
+
# MONGODB_URI = 'mongodb+srv://talat:[email protected]/?retryWrites=true&w=majority&appName=Chatbot'
|
| 45 |
+
|
| 46 |
+
# @property
|
| 47 |
+
# def MONGODB_URI(self):
|
| 48 |
+
# if self.ENVIRONMENT == 'production':
|
| 49 |
+
# # Better model for demos
|
| 50 |
+
# return os.getenv('MONGODB_URI', 'mongodb+srv://talat:[email protected]/?retryWrites=true&w=majority&appName=Chatbot')
|
| 51 |
+
# # Better for development purposes.
|
| 52 |
+
# return os.getenv('MONGODB_URI', 'mongodb://localhost:27017')
|
| 53 |
|
| 54 |
# New Conversation Summarizer Settings
|
| 55 |
SUMMARIZER_CONFIG = {
|