KrishnaCosmic commited on
Commit
8fcd54a
Β·
1 Parent(s): 5eebd59

checking changes

Browse files
Files changed (1) hide show
  1. README.md +65 -81
README.md CHANGED
@@ -1,95 +1,79 @@
1
- # OpenTriage AI Engine - Full Backend
 
 
 
 
 
 
 
 
2
 
3
- Full-featured AI backend for OpenTriage, lifted directly from the original Python codebase.
4
 
5
- ## Features
6
 
7
- - **Issue Triage** - AI-powered classification and labeling
8
- - **RAG Chatbot** - Repository-aware Q&A using retrieval-augmented generation
9
- - **Mentor Matching** - Tech stack-based mentor recommendations
10
- - **Hype Generator** - Celebration messages for PRs
11
- - **AI Chat** - General assistance for contributors
12
 
13
- ## API Endpoints
14
 
15
- | Endpoint | Method | Description |
16
- |----------|--------|-------------|
17
- | `/health` | GET | Health check |
18
- | `/triage` | POST | Issue classification |
19
- | `/chat` | POST | AI chat assistant |
20
- | `/rag/chat` | POST | RAG-based Q&A |
21
- | `/rag/index` | POST | Index repository for RAG |
22
- | `/rag/suggestions` | GET | Suggested questions |
23
- | `/mentor-match` | POST | Find mentor matches |
24
- | `/hype` | POST | Generate PR celebration |
25
- | `/rag/prepare` | POST | Prepare RAG documents |
26
- | `/rag/chunks` | GET | Get chunks for embedding |
27
 
28
- ## Quick Start
29
 
30
- ### Local Development
31
 
32
- ```bash
33
- # Create virtual environment
34
- python -m venv venv
35
- source venv/bin/activate
36
 
37
- # Install dependencies
38
- pip install -r requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
- # Set environment variables
41
- export OPENROUTER_API_KEY=your_key_here
42
 
43
- # Run the server
44
- python main.py
45
- ```
 
46
 
47
- ### Docker
 
 
 
 
 
 
 
 
 
 
48
 
49
  ```bash
50
- docker build -t opentriage-ai-engine .
51
- docker run -p 7860:7860 -e OPENROUTER_API_KEY=your_key opentriage-ai-engine
52
- ```
53
-
54
- ## Hugging Face Spaces Deployment
55
-
56
- 1. Create a new Space (Docker SDK)
57
- 2. Add secrets in Space settings:
58
- - `OPENROUTER_API_KEY` (required)
59
- - `MONGO_URL` (optional, for DB features)
60
- 3. Push this folder to the Space
61
-
62
- The Dockerfile is pre-configured for HF Spaces (non-root user, port 7860).
63
-
64
- ## Environment Variables
65
-
66
- | Variable | Required | Description |
67
- |----------|----------|-------------|
68
- | `OPENROUTER_API_KEY` | Yes | OpenRouter API key |
69
- | `MONGO_URL` | No | MongoDB connection string |
70
- | `FRONTEND_URL` | No | Frontend URL for CORS |
71
- | `CORS_ORIGINS` | No | Comma-separated CORS origins |
72
- | `ENVIRONMENT` | No | `development` or `production` |
73
-
74
- ## Architecture
75
-
76
- ```
77
- ai-engine/
78
- β”œβ”€β”€ main.py # FastAPI wrapper (new)
79
- β”œβ”€β”€ Dockerfile # HF-compliant Docker config
80
- β”œβ”€β”€ requirements.txt # Python dependencies
81
- β”œβ”€β”€ config/
82
- β”‚ └── settings.py # Environment configuration
83
- β”œβ”€β”€ models/ # Pydantic models (original)
84
- β”œβ”€β”€ services/ # AI services (original, unchanged)
85
- β”‚ β”œβ”€β”€ ai_service.py
86
- β”‚ β”œβ”€β”€ rag_chatbot_service.py
87
- β”‚ β”œβ”€β”€ mentor_matching_service.py
88
- β”‚ β”œβ”€β”€ hype_generator_service.py
89
- β”‚ └── rag_data_prep.py
90
- └── utils/ # Utilities (original)
91
- ```
92
-
93
- ## License
94
-
95
- MIT - See parent repository LICENSE file.
 
1
+ ---
2
+ title: OpenTriage AI Engine
3
+ emoji: 🧠
4
+ colorFrom: purple
5
+ colorTo: pink
6
+ sdk: docker
7
+ app_port: 7860
8
+ pinned: false
9
+ ---
10
 
11
+ # 🧠 OpenTriage AI Engine (Microservice)
12
 
13
+ This is the **AI Brain** of the OpenTriage platform. It is a specialized Python microservice acting as a "Sidecar" to the main TypeScript backend.
14
 
15
+ It hosts the heavy-lifting AI logic, including RAG (Retrieval-Augmented Generation), Issue Triage, and Mentor Matching, keeping the main application fast and lightweight.
 
 
 
 
16
 
17
+ ## πŸš€ Features
18
 
19
+ * **πŸ” AI Triage:** Automatically classifies GitHub issues by complexity and type.
20
+ * **πŸ“š RAG Chatbot:** "Chat with Repo" functionality using vector search.
21
+ * **🀝 Mentor Match:** Connects contributors to mentors based on tech stack analysis.
22
+ * **πŸŽ‰ Hype Generator:** Generates celebratory messages for PR merges.
 
 
 
 
 
 
 
 
23
 
24
+ ---
25
 
26
+ ## πŸ”— How to Connect
27
 
28
+ This service exposes a REST API via **FastAPI**. It is designed to be called by the Main Backend, not directly by users.
 
 
 
29
 
30
+ ### Base URL
31
+ Your API is live at:
32
+ `https://[YOUR_USERNAME]-opentriage-ai-engine.hf.space`
33
+
34
+ *(Check the "Embed this space" menu in the top right to get your exact direct URL)*
35
+
36
+ ### API Endpoints
37
+
38
+ | Method | Endpoint | Description |
39
+ | :--- | :--- | :--- |
40
+ | `GET` | `/health` | Server health check (returns 200 OK) |
41
+ | `POST` | `/triage` | Classifies an issue description |
42
+ | `POST` | `/chat` | General AI assistant response |
43
+ | `POST` | `/rag/chat` | Context-aware repository Q&A |
44
+ | `POST` | `/mentor-match` | Finds best matching mentors |
45
+
46
+ ---
47
+
48
+ ## πŸ›  Deployment Configuration
49
 
50
+ ### 1. Environment Variables (Secrets)
51
+ You must set these in the **Settings** tab of this Space under "Variables and secrets":
52
 
53
+ | Secret Name | Required? | Description |
54
+ | :--- | :--- | :--- |
55
+ | `OPENROUTER_API_KEY` | **Yes** | Required for all AI generation |
56
+ | `MONGO_URL` | Optional | If your RAG needs persistent vector storage |
57
 
58
+ ### 2. Docker Configuration
59
+ This Space uses a custom Dockerfile to ensure all Python scientific libraries (NumPy, Scikit-learn, LangChain) are installed in a compatible environment.
60
+
61
+ * **Port:** 7860 (Standard HF Space port)
62
+ * **User:** Runs as non-root user `user` (ID 1000) for security.
63
+
64
+ ---
65
+
66
+ ## πŸ’» Local Development
67
+
68
+ If you want to run this brain locally:
69
 
70
  ```bash
71
+ # 1. Create venv
72
+ python -m venv venv
73
+ source venv/bin/activate
74
+
75
+ # 2. Install
76
+ pip install -r requirements.txt
77
+
78
+ # 3. Run
79
+ uvicorn main:app --reload --port 8000