Spaces:
Sleeping
Sleeping
File size: 2,419 Bytes
8fcd54a e98319e 8fcd54a ce673e5 8fcd54a ce673e5 8fcd54a ce673e5 8fcd54a ce673e5 8fcd54a ce673e5 8fcd54a ce673e5 8fcd54a ce673e5 8fcd54a ce673e5 8fcd54a ce673e5 8fcd54a 5eebd59 8fcd54a 5eebd59 8fcd54a 5eebd59 8fcd54a | 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 | ---
title: OpenTriage AI Engine
emoji: π§
colorFrom: purple
colorTo: pink
sdk: docker
app_port: 7860
pinned: false
---
# π§ OpenTriage AI Engine (Microservice)
This is the **AI Brain** of the OpenTriage platform. It is a specialized Python microservice acting as a "Sidecar" to the main TypeScript backend.
It hosts the heavy-lifting AI logic, including RAG (Retrieval-Augmented Generation), Issue Triage, and Mentor Matching, keeping the main application fast and lightweight.
## π Features
* **π AI Triage:** Automatically classifies GitHub issues by complexity and type.
* **π RAG Chatbot:** "Chat with Repo" functionality using vector search.
* **π€ Mentor Match:** Connects contributors to mentors based on tech stack analysis.
* **π Hype Generator:** Generates celebratory messages for PR merges.
---
## π How to Connect
This service exposes a REST API via **FastAPI**. It is designed to be called by the Main Backend, not directly by users.
### Base URL
Your API is live at:
`https://[YOUR_USERNAME]-opentriage-ai-engine.hf.space`
*(Check the "Embed this space" menu in the top right to get your exact direct URL)*
### API Endpoints
| Method | Endpoint | Description |
| :--- | :--- | :--- |
| `GET` | `/health` | Server health check (returns 200 OK) |
| `POST` | `/triage` | Classifies an issue description |
| `POST` | `/chat` | General AI assistant response |
| `POST` | `/rag/chat` | Context-aware repository Q&A |
| `POST` | `/mentor-match` | Finds best matching mentors |
---
## π Deployment Configuration
### 1. Environment Variables (Secrets)
You must set these in the **Settings** tab of this Space under "Variables and secrets":
| Secret Name | Required? | Description |
| :--- | :--- | :--- |
| `OPENROUTER_API_KEY` | **Yes** | Required for all AI generation |
| `MONGO_URL` | Optional | If your RAG needs persistent vector storage |
### 2. Docker Configuration
This Space uses a custom Dockerfile to ensure all Python scientific libraries (NumPy, Scikit-learn, LangChain) are installed in a compatible environment.
* **Port:** 7860 (Standard HF Space port)
* **User:** Runs as non-root user `user` (ID 1000) for security.
---
## π» Local Development
If you want to run this brain locally:
```bash
# 1. Create venv
python -m venv venv
source venv/bin/activate
# 2. Install
pip install -r requirements.txt
# 3. Run
uvicorn main:app --reload --port 8000 |