This commit is contained in:
Saifeddine ALOUI
2024-12-18 00:46:47 +01:00
parent 8a85b30aed
commit 59edc324af
2 changed files with 17 additions and 18 deletions

View File

@@ -47,7 +47,7 @@ pip install -r requirements.txt
The server can be configured using command-line arguments: The server can be configured using command-line arguments:
```bash ```bash
python ollama_lightrag_server.py --help python ollama_lightollama_lightrag_server.py --help
``` ```
Available options: Available options:
@@ -55,7 +55,7 @@ Available options:
| Parameter | Default | Description | | Parameter | Default | Description |
|-----------|---------|-------------| |-----------|---------|-------------|
| --host | 0.0.0.0 | Server host | | --host | 0.0.0.0 | Server host |
| --port | 8000 | Server port | | --port | 9621 | Server port |
| --model | gemma2:2b | LLM model name | | --model | gemma2:2b | LLM model name |
| --embedding-model | nomic-embed-text | Embedding model name | | --embedding-model | nomic-embed-text | Embedding model name |
| --ollama-host | http://localhost:11434 | Ollama host URL | | --ollama-host | http://localhost:11434 | Ollama host URL |
@@ -71,20 +71,19 @@ Available options:
1. Basic usage with default settings: 1. Basic usage with default settings:
```bash ```bash
python rag_server.py python ollama_lightrag_server.py
``` ```
2. Custom configuration: 2. Custom configuration:
```bash ```bash
python rag_server.py --model llama2:13b --port 8080 --working-dir ./custom_rag python ollama_lightrag_server.py --model llama2:13b --port 8080 --working-dir ./custom_rag
``` ```
3. Using the launch script:
```bash ```bash
chmod +x launch_rag_server.sh python ollama_lightrag_server.py --model mistral-nemo:latest --embedding-dim 1024 --embedding-model bge-m3
./launch_rag_server.sh
``` ```
## API Endpoints ## API Endpoints
### Query Endpoints ### Query Endpoints
@@ -93,7 +92,7 @@ chmod +x launch_rag_server.sh
Query the RAG system with options for different search modes. Query the RAG system with options for different search modes.
```bash ```bash
curl -X POST "http://localhost:8000/query" \ curl -X POST "http://localhost:9621/query" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"query": "Your question here", "mode": "hybrid"}' -d '{"query": "Your question here", "mode": "hybrid"}'
``` ```
@@ -102,7 +101,7 @@ curl -X POST "http://localhost:8000/query" \
Stream responses from the RAG system. Stream responses from the RAG system.
```bash ```bash
curl -X POST "http://localhost:8000/query/stream" \ curl -X POST "http://localhost:9621/query/stream" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"query": "Your question here", "mode": "hybrid"}' -d '{"query": "Your question here", "mode": "hybrid"}'
``` ```
@@ -113,7 +112,7 @@ curl -X POST "http://localhost:8000/query/stream" \
Insert text directly into the RAG system. Insert text directly into the RAG system.
```bash ```bash
curl -X POST "http://localhost:8000/documents/text" \ curl -X POST "http://localhost:9621/documents/text" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"text": "Your text content here", "description": "Optional description"}' -d '{"text": "Your text content here", "description": "Optional description"}'
``` ```
@@ -122,7 +121,7 @@ curl -X POST "http://localhost:8000/documents/text" \
Upload a single file to the RAG system. Upload a single file to the RAG system.
```bash ```bash
curl -X POST "http://localhost:8000/documents/file" \ curl -X POST "http://localhost:9621/documents/file" \
-F "file=@/path/to/your/document.txt" \ -F "file=@/path/to/your/document.txt" \
-F "description=Optional description" -F "description=Optional description"
``` ```
@@ -131,7 +130,7 @@ curl -X POST "http://localhost:8000/documents/file" \
Upload multiple files at once. Upload multiple files at once.
```bash ```bash
curl -X POST "http://localhost:8000/documents/batch" \ curl -X POST "http://localhost:9621/documents/batch" \
-F "files=@/path/to/doc1.txt" \ -F "files=@/path/to/doc1.txt" \
-F "files=@/path/to/doc2.txt" -F "files=@/path/to/doc2.txt"
``` ```
@@ -140,7 +139,7 @@ curl -X POST "http://localhost:8000/documents/batch" \
Clear all documents from the RAG system. Clear all documents from the RAG system.
```bash ```bash
curl -X DELETE "http://localhost:8000/documents" curl -X DELETE "http://localhost:9621/documents"
``` ```
### Utility Endpoints ### Utility Endpoints
@@ -149,7 +148,7 @@ curl -X DELETE "http://localhost:8000/documents"
Check server health and configuration. Check server health and configuration.
```bash ```bash
curl "http://localhost:8000/health" curl "http://localhost:9621/health"
``` ```
## Development ## Development
@@ -157,14 +156,14 @@ curl "http://localhost:8000/health"
### Running in Development Mode ### Running in Development Mode
```bash ```bash
uvicorn rag_server:app --reload --port 8000 uvicorn ollama_lightrag_server:app --reload --port 9621
``` ```
### API Documentation ### API Documentation
When the server is running, visit: When the server is running, visit:
- Swagger UI: http://localhost:8000/docs - Swagger UI: http://localhost:9621/docs
- ReDoc: http://localhost:8000/redoc - ReDoc: http://localhost:9621/redoc
## Contributing ## Contributing

View File

@@ -21,7 +21,7 @@ def parse_args():
# Server configuration # Server configuration
parser.add_argument('--host', default='0.0.0.0', help='Server host (default: 0.0.0.0)') parser.add_argument('--host', default='0.0.0.0', help='Server host (default: 0.0.0.0)')
parser.add_argument('--port', type=int, default=8000, help='Server port (default: 8000)') parser.add_argument('--port', type=int, default=9621, help='Server port (default: 9621)')
# Directory configuration # Directory configuration
parser.add_argument('--working-dir', default='./rag_storage', parser.add_argument('--working-dir', default='./rag_storage',