File size: 2,142 Bytes
ba4e1dd
90878c1
ba4e1dd
cf02b2b
ba4e1dd
edd4785
ba4e1dd
 
90878c1
ba4e1dd
cf02b2b
ba4e1dd
90878c1
ba4e1dd
90878c1
ba4e1dd
90878c1
ba4e1dd
90878c1
ba4e1dd
90878c1
ba4e1dd
cf02b2b
90878c1
 
 
ba4e1dd
90878c1
ba4e1dd
90878c1
cf02b2b
90878c1
 
 
cf02b2b
ba4e1dd
cf02b2b
ba4e1dd
cf02b2b
 
 
 
 
 
 
 
ba4e1dd
cf02b2b
 
 
ba4e1dd
cf02b2b
ba4e1dd
cf02b2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ba4e1dd
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
---
title: PensionBot
emoji: 🎀
colorFrom: blue
colorTo: green
sdk: docker
sdk_version: "latest"
app_file: app.py
pinned: false
---

# PensionBot - Voice Assistant 🎀

A sophisticated AI-powered voice assistant designed for government pension queries and document searches. Built with FastAPI, this backend provides comprehensive API endpoints for voice interaction, document processing, and intelligent responses.

## πŸš€ Features

- **Voice Processing**: Advanced ASR and TTS capabilities
- **Document Search**: RAG-based government document knowledge base
- **Hybrid AI**: Multiple LLM providers for optimal responses
- **WebSocket Support**: Real-time communication
- **Authentication**: JWT-based secure access

## πŸ“‘ API Endpoints

- `GET /` - Service information and available endpoints
- `GET /health` - Health check with service status
- `POST /chat` - Text-based conversation interface
- `WebSocket /ws` - Real-time voice and text communication
- `GET /docs` - Interactive API documentation

## πŸ›  Technology Stack

- **FastAPI**: High-performance web framework
- **LangChain**: AI orchestration and document processing
- **LanceDB**: Vector database for document search
- **Whisper**: Speech-to-text processing
- **Edge-TTS**: Text-to-speech synthesis

## πŸ”— Usage

The API is accessible at the base URL of this space. Use the `/docs` endpoint to explore the interactive API documentation.

### Example Usage:

```bash
# Health check
curl https://chabhishek28-pensionbot.hf.space/health

# Chat endpoint
curl -X POST https://chabhishek28-pensionbot.hf.space/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Tell me about pension policies"}'
```

## πŸ“‹ Environment Variables

The following environment variables are required:

- `GOOGLE_API_KEY`: Google Gemini API key
- `GROQ_API_KEY`: Groq API key for Whisper
- `TAVILY_API_KEY`: Tavily search API key
- `JWT_SECRET_KEY`: JWT authentication secret

## πŸ”’ Security

This API includes JWT-based authentication for secure access to protected endpoints.

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference