{
  "project_name": "com.github.openmined.rag-router-demo",
  "description": "\"Attribution based control source\"",
  "tags": [
    "paper",
    "openmined"
  ],
  "version": "0.1.0",
  "dependencies": [
    "loguru>=0.6.0",
    "syft-event>=0.1.0",
    "syft-llm-router>=0.1.0",
    "pydantic>=2.0.0",
    "requests>=2.32.3",
    "tqdm>=4.67.1",
    "PyPDF2>=3.0.0",
    "ebooklib>=0.18.0",
    "beautifulsoup4>=4.12.0"
  ],
  "code_hash": "df3d89f8095a4e327b2f42323ee2fae58852198e0f915e3a13ac83cbf904b86a",
  "readme": "# RAG Router Implementation\n\nA Syft-based RAG (Retrieval-Augmented Generation) router implementation that provides a unified interface for LLM interactions, document retrieval, and embedding management.\n\n## Features\n\n- **Unified LLM Interface**: Support for both chat and completion endpoints\n- **Document Retrieval**: Integrated RAG capabilities with vector search\n- **Embedding Management**: Automatic document embedding and indexing\n- **Event-Driven Architecture**: Built on SyftEvents for scalable processing\n- **Rate Limiting**: Configurable rate limits for API endpoints\n- **Extensible Design**: Easy to add new LLM providers and retrieval strategies\n\n## Project Structure\n\n```\n.\n\u251c\u2500\u2500 pyproject.toml      # Project dependencies and configuration\n\u251c\u2500\u2500 run.sh             # Service startup script\n\u251c\u2500\u2500 router.py          # RAG router implementation\n\u251c\u2500\u2500 server.py          # Server implementation\n\u2514\u2500\u2500 chat_test.py       # Example chat implementation\n```\n\n## Prerequisites\n\n- Python 3.12 or higher\n- uv (Python package manager)\n- Access to a Syft network\n\n## Installation\n\n1. Install uv (if not already installed):\n```bash\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n```\n\n2. Clone the repository and install dependencies:\n```bash\ngit clone <repository-url>\ncd rag-router-demo\nuv pip install -e .\n```\n\n## Configuration\n\nThe application can be configured through the `pyproject.toml` file:\n\n```toml\n[tool.rag-app]\n# Rate limiting settings\nenable_rate_limiting = true\nrequests_per_minute = 1\nrequests_per_hour = 10\nrequests_per_day = 1000\n\n# Embedding settings\nembedder_endpoint = \"\"\nindexer_endpoint = \"\"\n\n# Retrieval settings\nretriever_endpoint = \"\"\n```\n\n## Running the Service\n\nStart the service using the provided script:\n\n```bash\n./run.sh\n```\n\nThe script will:\n1. Create a Python virtual environment\n2. Install all dependencies\n3. Start the server with the specified project name\n\n## API Endpoints\n\n### Document Retrieval\n- `POST /retrieve`: Retrieve relevant documents\n  ```json\n  {\n    \"query\": \"string\",\n    \"options\": {\n      \"top_k\": 5,\n      \"score_threshold\": 0.7\n    }\n  }\n  ```\n\n### Health Check\n- `GET /ping`: Check service health\n\n## Document Embedding\n\nThe service automatically watches for new documents in the `{datasite}/embeddings` directory. When new JSON files are added, they are automatically:\n1. Chunked into appropriate sizes\n2. Embedded using the configured embedder\n3. Indexed in the vector database\n\n## Development\n\n### Setting Up Development Environment\n\n1. Create and activate a virtual environment:\n```bash\nuv venv -p 3.12 .venv\nsource .venv/bin/activate\n```\n\n2. Install development dependencies:\n```bash\nuv pip install -e \".[dev]\"\n```\n\n### Adding New LLM Providers\n\nTo add a new LLM provider:\n1. Create a new class that inherits from `BaseLLMRouter`\n2. Implement the required methods:\n   - `generate_completion`\n   - `generate_chat`\n   - `retrieve_documents`\n   - `embed_documents`\n3. Update the `load_router()` function in `server.py`\n",
  "documented_endpoints": {},
  "publish_date": "2025-06-16T21:15:44.775801",
  "pricing": "free - 0.0"
}