Spaces:
Sleeping
Sleeping
updated
Browse files
README.md
CHANGED
|
@@ -1,152 +1,10 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
β βββ main.py
|
| 12 |
-
β βββ config.py
|
| 13 |
-
β βββ database.py
|
| 14 |
-
β βββ qdrant_client.py
|
| 15 |
-
β βββ models/
|
| 16 |
-
β β βββ __init__.py
|
| 17 |
-
β β βββ user.py
|
| 18 |
-
β β βββ chat.py
|
| 19 |
-
β βββ schemas/
|
| 20 |
-
β β βββ __init__.py
|
| 21 |
-
β β βββ chat.py
|
| 22 |
-
β βββ routes/
|
| 23 |
-
β β βββ __init__.py
|
| 24 |
-
β β βββ chat.py
|
| 25 |
-
β β βββ health.py
|
| 26 |
-
β βββ services/
|
| 27 |
-
β βββ __init__.py
|
| 28 |
-
β βββ rag_service.py
|
| 29 |
-
β βββ embeddings_service.py
|
| 30 |
-
β βββ openai_service.py
|
| 31 |
-
βββ scripts/
|
| 32 |
-
β βββ ingest_content.py
|
| 33 |
-
βββ .env.example
|
| 34 |
-
βββ requirements.txt
|
| 35 |
-
βββ README.md
|
| 36 |
-
βββ .gitignore
|
| 37 |
-
```
|
| 38 |
-
|
| 39 |
-
## Setup Instructions
|
| 40 |
-
|
| 41 |
-
1. **Clone the repository**:
|
| 42 |
-
|
| 43 |
-
```bash
|
| 44 |
-
git clone <repository-url>
|
| 45 |
-
cd robotic
|
| 46 |
-
```
|
| 47 |
-
|
| 48 |
-
2. **Navigate to the backend directory**:
|
| 49 |
-
|
| 50 |
-
```bash
|
| 51 |
-
cd backend
|
| 52 |
-
```
|
| 53 |
-
|
| 54 |
-
3. **Set up the Python virtual environment and install dependencies**:
|
| 55 |
-
|
| 56 |
-
On Windows, run:
|
| 57 |
-
```bash
|
| 58 |
-
.\setup.bat
|
| 59 |
-
```
|
| 60 |
-
|
| 61 |
-
On Linux/macOS, run:
|
| 62 |
-
```bash
|
| 63 |
-
python3 -m venv venv
|
| 64 |
-
source venv/bin/activate
|
| 65 |
-
pip install -r requirements.txt
|
| 66 |
-
```
|
| 67 |
-
|
| 68 |
-
4. **Configure Environment Variables**:
|
| 69 |
-
|
| 70 |
-
Create a `.env` file in the `backend/` directory by copying `.env.example` and filling in your credentials:
|
| 71 |
-
|
| 72 |
-
```bash
|
| 73 |
-
copy .env.example .env
|
| 74 |
-
# or for Linux/macOS
|
| 75 |
-
cp .env.example .env
|
| 76 |
-
```
|
| 77 |
-
|
| 78 |
-
Edit the `.env` file with your actual API keys and database URLs:
|
| 79 |
-
|
| 80 |
-
```
|
| 81 |
-
OPENAI_API_KEY=your_openai_api_key_here
|
| 82 |
-
NEON_DATABASE_URL=your_neon_postgres_connection_string_here
|
| 83 |
-
QDRANT_URL=your_qdrant_cluster_url_here
|
| 84 |
-
QDRANT_API_KEY=your_qdrant_api_key_here
|
| 85 |
-
```
|
| 86 |
-
|
| 87 |
-
## Running the Application
|
| 88 |
-
|
| 89 |
-
1. **Activate your virtual environment**:
|
| 90 |
-
|
| 91 |
-
On Windows:
|
| 92 |
-
```bash
|
| 93 |
-
.\venv\Scripts\activate
|
| 94 |
-
```
|
| 95 |
-
|
| 96 |
-
On Linux/macOS:
|
| 97 |
-
```bash
|
| 98 |
-
source venv/bin/activate
|
| 99 |
-
```
|
| 100 |
-
|
| 101 |
-
2. **Start the FastAPI server**:
|
| 102 |
-
|
| 103 |
-
On Windows, run:
|
| 104 |
-
```bash
|
| 105 |
-
.\run.bat
|
| 106 |
-
```
|
| 107 |
-
|
| 108 |
-
On Linux/macOS, run:
|
| 109 |
-
```bash
|
| 110 |
-
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
|
| 111 |
-
```
|
| 112 |
-
|
| 113 |
-
The API will be accessible at `http://localhost:8000`.
|
| 114 |
-
|
| 115 |
-
## API Endpoints
|
| 116 |
-
|
| 117 |
-
*(Note: Detailed API documentation will be available at `/docs` once the server is running)*
|
| 118 |
-
|
| 119 |
-
### Health Check
|
| 120 |
-
|
| 121 |
-
- **GET `/health`**
|
| 122 |
-
- Returns the health status of the backend and its integrated services.
|
| 123 |
-
|
| 124 |
-
### Chatbot Interaction
|
| 125 |
-
|
| 126 |
-
- **POST `/chat/`**
|
| 127 |
-
- **Description**: Sends a user query to the RAG chatbot and receives a generated response.
|
| 128 |
-
- **Request Body Example**:
|
| 129 |
-
|
| 130 |
-
```json
|
| 131 |
-
{
|
| 132 |
-
"query": "What is the main topic of the book?"
|
| 133 |
-
}
|
| 134 |
-
```
|
| 135 |
-
- **Response Body Example**:
|
| 136 |
-
|
| 137 |
-
```json
|
| 138 |
-
{
|
| 139 |
-
"response": "The main topic of the book is ..."
|
| 140 |
-
}
|
| 141 |
-
```
|
| 142 |
-
|
| 143 |
-
## Content Ingestion Script
|
| 144 |
-
|
| 145 |
-
- **`scripts/ingest_content.py`**
|
| 146 |
-
- This script is responsible for reading MDX files from `../physical-ai-humanoid-robotics/docs/`, chunking the text, generating OpenAI embeddings, and storing them in Qdrant.
|
| 147 |
-
- **Usage**:
|
| 148 |
-
|
| 149 |
-
```bash
|
| 150 |
-
python scripts/ingest_content.py
|
| 151 |
-
```
|
| 152 |
-
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Chat Robot
|
| 3 |
+
emoji: π»
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|