Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
@@ -1,24 +1,70 @@
|
|
1 |
# Medical Chatbot API
|
2 |
|
3 |
-
|
4 |
|
5 |
-
##
|
6 |
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
|
13 |
-
- `QDRANT_URL`: URL for the Qdrant vector database
|
14 |
-
- `QDRANT_API_KEY`: API key for Qdrant authentication
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
|
|
|
20 |
```bash
|
21 |
-
docker
|
|
|
22 |
```
|
23 |
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Medical Chatbot API
|
2 |
|
3 |
+
A FastAPI-based medical chatbot API powered by LangChain and custom models.
|
4 |
|
5 |
+
## Configuration
|
6 |
|
7 |
+
### Environment Variables
|
8 |
+
|
9 |
+
Create a `.env` file with the following variables:
|
10 |
+
|
11 |
+
```env
|
12 |
+
QDRANT_URL=your_qdrant_url
|
13 |
+
QDRANT_API_KEY=your_qdrant_api_key
|
14 |
+
HF_TOKEN=your_huggingface_token
|
15 |
+
```
|
16 |
+
|
17 |
+
### Model Configuration
|
18 |
+
|
19 |
+
The application expects the following model structure:
|
20 |
+
```
|
21 |
+
models/
|
22 |
+
βββ embeddings/
|
23 |
+
βββ llm/
|
24 |
+
```
|
25 |
+
|
26 |
+
### Dependencies
|
27 |
|
28 |
+
Key dependencies include:
|
29 |
+
- LangChain ecosystem
|
30 |
+
- Qdrant for vector storage
|
31 |
+
- Unsloth for optimized model loading
|
32 |
+
- FastAPI for the web framework
|
33 |
|
34 |
+
## Development Setup
|
|
|
|
|
35 |
|
36 |
+
1. Install dependencies:
|
37 |
+
```bash
|
38 |
+
pip install -r requirements.txt
|
39 |
+
```
|
40 |
+
|
41 |
+
2. Run the development server:
|
42 |
+
```bash
|
43 |
+
uvicorn app.main:app --reload --host 0.0.0.0 --port 7860
|
44 |
+
```
|
45 |
|
46 |
+
## Docker Deployment
|
47 |
|
48 |
+
Build and run with Docker:
|
49 |
```bash
|
50 |
+
docker build -t medical-chatbot .
|
51 |
+
docker run -p 7860:7860 --env-file .env medical-chatbot
|
52 |
```
|
53 |
|
54 |
+
## API Endpoints
|
55 |
+
|
56 |
+
- `GET /health`: Health check endpoint
|
57 |
+
- `POST /chat`: Chat endpoint
|
58 |
+
```json
|
59 |
+
{
|
60 |
+
"question": "What are the symptoms of diabetes?",
|
61 |
+
"context": "Optional medical context"
|
62 |
+
}
|
63 |
+
```
|
64 |
+
|
65 |
+
## Production Deployment
|
66 |
+
|
67 |
+
For Hugging Face Spaces:
|
68 |
+
1. Set repository secrets in Space settings
|
69 |
+
2. Deploy using the provided Dockerfile
|
70 |
+
3. Ensure model weights are properly configured
|