|
1 | | ---- |
2 | | -title: HiringHelp-Chatbot |
3 | | -app_file: app.py |
4 | | -sdk: gradio |
5 | | -sdk_version: 5.22.0 |
6 | | ---- |
7 | | - |
8 | 1 | # HiringHelp Chatbot |
9 | 2 |
|
10 | | -A chatbot that helps with hiring-related questions using RAG (Retrieval-Augmented Generation) with Gradio interface. |
11 | | - |
12 | | -## Features |
13 | | - |
14 | | -- Interactive chat interface using Gradio |
15 | | -- RAG system for retrieving relevant information from candidate documents |
16 | | -- Support for text document formats |
17 | | -- Conversation memory to maintain context |
18 | | -- Real-time responses using OpenRouter API |
19 | | - |
20 | | -## Setup |
21 | | - |
22 | | -1. Clone the repository |
23 | | -2. Install dependencies: |
24 | | - ```bash |
25 | | - pip install -r requirements.txt |
26 | | - ``` |
27 | | -3. Create a `.env` file with your OpenRouter API key: |
28 | | - ``` |
29 | | - OPENROUTER_API_KEY=your_api_key_here |
30 | | - ``` |
31 | | -4. Place your candidate documents in the `knowledge_sources` directory |
32 | | -5. Run the application: |
33 | | - ```bash |
34 | | - python app.py |
35 | | - ``` |
36 | | - |
37 | | -## Usage |
38 | | - |
39 | | -1. Start the application |
40 | | -2. Ask questions about candidates or hiring-related topics |
41 | | -3. The chatbot will retrieve relevant information from the documents and provide answers |
42 | | - |
43 | | -## Project Structure |
44 | | - |
45 | | -- `app.py`: Main application file |
46 | | -- `requirements.txt`: Python dependencies |
47 | | -- `knowledge_sources/`: Directory containing candidate documents |
48 | | -- `.env`: Environment variables (API keys) |
49 | | - |
50 | | -## Dependencies |
| 3 | +A chatbot that helps with hiring-related questions using RAG (Retrieval-Augmented Generation) with LangChain. |
51 | 4 |
|
52 | | -- gradio |
53 | | -- openai |
54 | | -- python-dotenv |
55 | | -- pandas |
56 | | -- langchain |
57 | | -- faiss-cpu |
58 | | -- requests |
59 | | -- beautifulsoup4 |
| 5 | +## How It Works |
| 6 | +HiringHelp uses LangChain's RAG implementation to provide accurate, document-grounded responses. The process involves: |
| 7 | +1. **Document Processing**: Candidate documents are split into chunks and embedded |
| 8 | +2. **Retrieval**: When a query is received, relevant document chunks are retrieved using FAISS vector similarity |
| 9 | +3. **Generation**: Retrieved context is combined with the query to generate accurate responses |
60 | 10 |
|
61 | | -## Local Development |
62 | | - |
63 | | -1. Clone the repository: |
64 | | -```bash |
65 | | -git clone https://github.com/natgluons/hiringhelp-chatbot.git |
66 | | -cd hiringhelp-chatbot |
67 | | -``` |
68 | | - |
69 | | -2. Create a virtual environment and activate it: |
70 | | -```bash |
71 | | -python -m venv venv |
72 | | -source venv/bin/activate # On Windows: venv\Scripts\activate |
73 | | -``` |
74 | | - |
75 | | -3. Install dependencies: |
76 | | -```bash |
77 | | -pip install -r requirements.txt |
78 | | -``` |
79 | | - |
80 | | -4. Create a `.env` file with your OpenRouter API key: |
81 | | -``` |
82 | | -OPENROUTER_API_KEY=your_api_key_here |
83 | | -``` |
84 | | - |
85 | | -5. Add your knowledge source documents to the `knowledge_sources` directory. |
86 | | - |
87 | | -6. Run the application: |
88 | | -```bash |
89 | | -python app.py |
90 | | -``` |
91 | | - |
92 | | -The application will be available at `http://localhost:7860`. |
93 | | - |
94 | | -## Deploying to Hugging Face Spaces |
95 | | - |
96 | | -1. Fork this repository to your GitHub account |
97 | | - |
98 | | -2. Create a new Space on Hugging Face: |
99 | | - - Go to [Hugging Face Spaces](https://huggingface.co/spaces) |
100 | | - - Click "New Space" |
101 | | - - Choose "Gradio" as the SDK |
102 | | - - Name your space (e.g., "hiringhelp-chatbot") |
103 | | - |
104 | | -3. Link your GitHub repository: |
105 | | - - Go to the Space's settings |
106 | | - - Navigate to the "Repository" section |
107 | | - - Select your GitHub repository |
108 | | - |
109 | | -4. Set up the OpenRouter API key: |
110 | | - - Go to your Space's settings |
111 | | - - Navigate to "Repository Secrets" |
112 | | - - Add your `OPENROUTER_API_KEY` as a secret |
113 | | - |
114 | | -The Space will automatically build and deploy your application. |
115 | | - |
116 | | -## Project Structure |
117 | | - |
118 | | -``` |
119 | | -HiringHelp-Chatbot/ |
120 | | -├── app.py # Main Gradio application |
121 | | -├── styles.css # Custom CSS styles |
122 | | -├── requirements.txt # Python dependencies |
123 | | -├── .env # Environment variables (local only) |
124 | | -└── knowledge_sources/ # Directory for knowledge base documents |
125 | | - └── README.md # Instructions for adding documents |
126 | | -``` |
127 | | - |
128 | | -## Overview |
129 | | -HiringHelp Chatbot is an intelligent hiring assistant that uses Retrieval-Augmented Generation (RAG) to match candidates with job positions. Built with LangChain and advanced language models, the chatbot analyzes candidate resumes by first retrieving relevant information from documents and then generating contextual responses. This RAG architecture ensures responses are grounded in actual candidate data rather than hallucinations. |
130 | | - |
131 | | -## Model Choices |
132 | | -- **Chat Completion**: Using Qwen-2-7B-Chat (via OpenRouter) for its fast and accurate responses in RAG applications |
133 | | -- **Embeddings**: Using OpenAI's text-embedding-ada-002 for optimal compatibility with LangChain and proven reliability in document retrieval tasks |
| 11 | +## Technology |
| 12 | +- **API & Model**: Using Qwen-2-7B-Chat via OpenRouter API for its balance of performance and cost-effectiveness in RAG applications, with custom embedding generation for document retrieval. |
| 13 | +- **Stack**: LangChain, FAISS, Gradio, Flask-Limiter |
134 | 14 |
|
135 | 15 | ## Features |
136 | | -- **RAG-Based Analysis**: Uses Retrieval-Augmented Generation to provide accurate, document-grounded responses |
137 | | -- **Resume Analysis**: Processes and analyzes candidate resumes |
138 | | -- **Intelligent Matching**: Uses LangChain and advanced language models to match candidates with job requirements |
139 | | -- **Interactive Chat Interface**: User-friendly web interface for natural conversations |
140 | | -- **Rate-Limited API**: Implements rate limiting (10 requests/minute, 100 requests/day) for stable service |
141 | | -- **Document Management**: Stores and retrieves candidate information from the `knowledge_sources` directory |
142 | | -- **Vector Search**: Uses FAISS for efficient similarity search in candidate documents |
143 | | -- **Secure Environment**: Handles sensitive information through environment variables |
144 | | - |
145 | | -## Tech Stack |
146 | | -- **Framework**: LangChain for RAG implementation and document processing |
147 | | -- **Language Models**: |
148 | | - - Qwen-2-7B-Chat: Primary model for chat completions (via OpenRouter) |
149 | | - - text-embedding-ada-002: OpenAI's embedding model for document vectorization |
150 | | -- **Vector Database**: FAISS for efficient document retrieval |
151 | | -- **Document Processing**: LangChain for text splitting and embedding |
152 | | -- **Rate Limiting**: Flask-Limiter for API protection |
153 | | -- **Data Storage**: SQLite for persistent storage |
154 | | -- **Containerization**: Docker for deployment |
155 | | - |
156 | | -## How RAG Works in This Application |
157 | | -1. **Document Ingestion**: |
158 | | - - Documents are processed and split into chunks using LangChain's text splitters |
159 | | - - Each chunk is embedded using OpenAI's text-embedding-ada-002 model |
160 | | - - Embeddings are stored in a FAISS vector database |
161 | | - |
162 | | -2. **Query Processing**: |
163 | | - - User queries are embedded using the same OpenAI embedding model |
164 | | - - Relevant document sections are retrieved using vector similarity search |
165 | | - - Retrieved context is used to generate accurate, grounded responses |
| 16 | +- Interactive chat interface |
| 17 | +- Support for text document formats |
| 18 | +- Example questions for easy interaction |
| 19 | +- Source attribution for responses |
| 20 | +- Rate limiting (10 requests/minute, 100 requests/day) |
| 21 | +- Vector similarity search for accurate retrieval |
| 22 | +- Environment variable configuration |
166 | 23 |
|
167 | | -3. **Response Generation**: |
168 | | - - Qwen-2-7B-Chat model receives both the user query and retrieved context |
169 | | - - Responses are generated based on actual document content |
170 | | - - The RAG approach ensures responses are factual and verifiable |
| 24 | +## Deployment Options |
| 25 | +1. **Vercel Deployment**: [Live Demo](https://hiring-help-chatbot.vercel.app/) |
| 26 | +2. **Hugging Face Spaces**: [Interactive Demo](https://huggingface.co/spaces/natgluons/HiringHelp-Chatbot) |
| 27 | +3. **Local Development**: See [docs branch](https://github.com/natgluons/hiringhelp-chatbot/tree/docs) for setup instructions |
171 | 28 |
|
172 | 29 | ## Requirements |
173 | 30 | ``` |
@@ -250,19 +107,12 @@ HiringHelp-Chatbot/ |
250 | 107 | ``` |
251 | 108 | "List all the available candidates" |
252 | 109 | "Tell me about a candidate named [Name]" |
253 | | -"Which candidate is best for an AI Engineer role?" |
| 110 | +"Which candidate is best for [Role] role?" |
254 | 111 | ``` |
255 | 112 |
|
256 | 113 | ## Rate Limits |
257 | 114 | - 10 requests per minute |
258 | 115 | - 100 requests per day |
259 | 116 |
|
260 | 117 | ## Demo |
261 | | -A demo version is available with sample candidate data for testing purposes. |
262 | | - |
263 | | -## Security Note |
264 | | -This application handles sensitive information. Always: |
265 | | -- Keep API keys secure |
266 | | -- Use environment variables for secrets |
267 | | -- Review candidate information handling policies |
268 | | -- Monitor rate limits and usage |
| 118 | +A demo version is available with sample candidate data for testing purposes. |
0 commit comments