Spaces:
Running
Running
File size: 3,616 Bytes
6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 aefac4f 6dc9d46 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | # Scripts Directory
Utility scripts for setup, testing, and interaction with RagBot.
## Core Scripts
### `chat.py` - Interactive CLI Interface
Interactive command-line chatbot for analyzing blood test results.
**Usage:**
```bash
.\.venv\Scripts\python.exe scripts/chat.py
```
**Features:**
- Interactive prompt for biomarker input
- Example case loading (`example` command)
- Biomarker help reference (`help` command)
- Report saving (automatic JSON export)
- Real-time analysis with all 6 agents
**Example input:**
```
You: My glucose is 140 and HbA1c is 10
```
---
### `setup_embeddings.py` - Vector Store Builder
Builds or rebuilds the FAISS vector store from medical PDFs.
**Usage:**
```bash
# Build/update vector store
.\.venv\Scripts\python.exe scripts/setup_embeddings.py
# Force complete rebuild
.\.venv\Scripts\python.exe scripts/setup_embeddings.py --force-rebuild
```
**What it does:**
- Loads all PDFs from `data/medical_pdfs/`
- Chunks documents (1000 char with 200 overlap)
- Generates embeddings (HuggingFace, local)
- Creates FAISS vector database
- Saves to `data/vector_stores/medical_knowledge.faiss`
**When to run:**
- After adding new PDF documents
- After changing embedding model
- If vector store corrupts
---
## Testing Scripts
### `test_extraction.py` - Biomarker Extraction Tests
Tests the extraction and validation of biomarkers from user input.
**Usage:**
```bash
.\.venv\Scripts\python.exe scripts/test_extraction.py
```
---
### `test_chat_demo.py` - Chat Functionality Tests
Runs predefined test cases through the chat system.
**Usage:**
```bash
.\.venv\Scripts\python.exe scripts/test_chat_demo.py
```
---
### `monitor_test.py` - System Monitoring
Monitors system performance and vector store status.
**Usage:**
```bash
.\.venv\Scripts\python.exe scripts/monitor_test.py
```
---
## Startup Scripts (PowerShell for Windows)
### `run_api.ps1` - Run REST API Server
Starts the FastAPI server for REST endpoints.
**Usage:**
```powershell
.\scripts\run_api.ps1
```
**Starts:**
- FastAPI server on `http://localhost:8000`
- Interactive docs on `http://localhost:8000/docs`
---
### `start_api.ps1` - Alternative API Starter
Alternative API startup script with additional logging.
**Usage:**
```powershell
.\scripts\start_api.ps1
```
---
### `test_api_simple.ps1` - Simple API Tests
Tests basic API endpoints.
**Usage:**
```powershell
.\scripts\test_api_simple.ps1
```
---
## Quick Reference
| Script | Purpose | Command |
|--------|---------|---------|
| `chat.py` | Interactive biomarker analysis | `.\.venv\Scripts\python.exe scripts/chat.py` |
| `setup_embeddings.py` | Build vector store | `.\.venv\Scripts\python.exe scripts/setup_embeddings.py` |
| `test_extraction.py` | Test biomarker extraction | `.\.venv\Scripts\python.exe scripts/test_extraction.py` |
| `test_chat_demo.py` | Test chat system | `.\.venv\Scripts\python.exe scripts/test_chat_demo.py` |
| `monitor_test.py` | Monitor system performance | `.\.venv\Scripts\python.exe scripts/monitor_test.py` |
| `run_api.ps1` | Start REST API | `.\scripts\run_api.ps1` |
| `start_api.ps1` | Start API (alt) | `.\scripts\start_api.ps1` |
| `test_api_simple.ps1` | Test API | `.\scripts\test_api_simple.ps1` |
---
## Development Scripts (Useful for Developers)
To create new development utilities:
```bash
touch scripts/my_script.py
# Add your code following the pattern of existing scripts
```
---
For more information, see:
- [QUICKSTART.md](../QUICKSTART.md) - Setup guide
- [DEVELOPMENT.md](../docs/DEVELOPMENT.md) - Development guide
- [API.md](../docs/API.md) - REST API documentation
|