File size: 1,270 Bytes
a8772c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Smart Escalation API
emoji: 🤖
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
license: mit
---

# Smart Escalation API

AI-powered L1 customer support system with intelligent escalation.

## Features

- RAG-based retrieval using sentence-transformers and FAISS
- Intelligent escalation to human agents
- Google Gemini LLM integration
- FastAPI backend with automatic documentation

## API Endpoints

- `GET /` - API information
- `GET /health` - Health check
- `POST /ask` - Submit customer questions

## Environment Variables

Configure these in your Space settings:

- `GOOGLE_API_KEY` - Your Google Gemini API key (required)
- `ARTICLES_DIR` - Path to help articles (default: data/articles)
- `EMBEDDING_MODEL` - Sentence transformer model (default: all-MiniLM-L6-v2)
- `RELEVANCE_THRESHOLD` - Minimum similarity score (default: 0.5)
- `TOP_K_CHUNKS` - Number of chunks to retrieve (default: 3)
- `LLM_MODEL` - Gemini model name (default: gemini-1.5-flash)
- `CORS_ORIGINS` - Allowed CORS origins

## Usage

```bash
curl -X POST https://YOUR_USERNAME-escalation-api.hf.space/ask \
  -H "Content-Type: application/json" \
  -d '{"question": "How do I reset my password?"}'
```

## Documentation

Visit `/docs` for interactive API documentation.