File size: 2,358 Bytes
ae6193f
ba18317
 
 
 
ae6193f
ba18317
ae6193f
 
 
 
ba18317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: AI Recruitment Agent
emoji: 
colorFrom: indigo
colorTo: green
sdk: gradio
sdk_version: "4.44.0"
app_file: app.py
pinned: false
---

# ⚡ AI Recruitment Agent

A production-grade hybrid candidate matching pipeline using **Groq LLM**, **Pinecone vector DB**, and a **Gradio** UI.

## Architecture

```
CSV Input → Stage 1: Normalize (Groq)
          → Stage 2: Embed + Match (Pinecone + SentenceTransformers) → Top 20
          → Stage 3: Deterministic Rerank (Groq) → Top 10
          → Stage 4: LLM Deep Review (Groq) → Top 5
          → Stage 5: Final Synthesis (Groq) → Shortlist
```

## Setup (Local)

### 1. Install dependencies

```bash
pip install -r requirements.txt
```

### 2. Configure environment

```bash
cp .env.example .env
# Edit .env and fill in your API keys
```

### 3. Create Pinecone index

In your Pinecone console:
- Create an index named `recruitment-index` (or whatever you set in `PINECONE_INDEX`)
- Dimension: **384** for `all-MiniLM-L6-v2`, **1024** for `BAAI/bge-m3`
- Metric: **cosine**

### 4. Run

```bash
python app.py
```

Open http://localhost:7860

## Setup (Hugging Face Spaces)

Do **not** commit a `.env` file. Instead, go to your Space → **Settings → Repository Secrets** and add:

| Secret | Example value |
|--------|--------------|
| `GROQ_API_KEYS` | `gsk_xxx,gsk_yyy` |
| `GROQ_MODEL` | `llama3-70b-8192` |
| `PINECONE_API_KEY` | `pcsk_xxx` |
| `PINECONE_INDEX` | `recruitment-index` |
| `EMBEDDING_MODEL` | `all-MiniLM-L6-v2` |
| `STAGE2_TOP_K` | `20` |

## CSV Format

| Column | Variants accepted |
|--------|----------|
| `name` | `full_name`, `candidate_name` |
| `email` | `email_address` |
| `skills` | `parsed_skills`, `technical_skills` |
| `experience` | `parsed_work_experience`, `years_of_experience` |
| `education` | `parsed_metadata_education` |
| `resume_text` | `parsed_summary`, `summary` |

## Pipeline Stages

| Stage | Method | Input | Output |
|-------|--------|-------|--------|
| 1. Normalize | Groq LLM | All candidates | Structured features |
| 2. Embed & Match | Pinecone + SentenceTransformers | All candidates | Top 20 by similarity |
| 3. Rerank | Groq LLM (deterministic scoring) | Top 20 | Top 10 with scores |
| 4. Deep Review | Groq LLM | Top 5 | Verdicts + signals |
| 5. Final Synthesis | Groq LLM | Top 5 reviews | Final ranked shortlist |