Skip to content

Commit dec9be8

Browse files
committed
Documenting
1 parent 46c7a2b commit dec9be8

File tree

3 files changed

+146
-8
lines changed

3 files changed

+146
-8
lines changed

README.md

Lines changed: 132 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,133 @@
1-
# Agentic Chatbot
1+
# 🤖 Agentic Chatbot: Navigating Red Hat Internal resources from THE SOURCE
22

3+
## Overview
4+
5+
The Agentic Chatbot is an intelligent assistant designed to help Red Hat associates navigate internal resources efficiently.
6+
7+
## Project Goals
8+
9+
- Simplify access to internal documentation
10+
- Reduce onboarding friction
11+
- Provide intelligent, context-aware resource discovery
12+
13+
## Use Case
14+
15+
Instead of navigating the Source portal manually, associates can ask:
16+
17+
- "What is the process for updating a Red Hat product?"
18+
- "Where can I find the latest documentation for a specific product?"
19+
- "How do I resolve a common issue with a Red Hat product?"
20+
21+
And receive:
22+
23+
- Direct answers
24+
- Links to the exact documents/pages
25+
- Context-aware follow-up suggestions
26+
27+
## Technical Architecture
28+
29+
### Core Components
30+
31+
| Layer | Technology |
32+
|---------------|--------------------------------------|
33+
| **Backend** | Python + FastAPI / Flask |
34+
| **LLMs** | OpenAI GPT, Ollama, Hugging Face |
35+
| **Vector DB** | ChromaDB / FAISS |
36+
| **Embeddings**| Hugging Face Transformers |
37+
| **Frontend** | Slack Bot (via Slack Bolt SDK)|
38+
39+
### Agentic Workflow
40+
41+
The chatbot operates on a **multi-agent architecture**, where each agent specializes in a sub-task:
42+
43+
- **Query Understanding Agent**
44+
Interprets user inputs into actionable formats.
45+
46+
- **Content Indexing Agent**
47+
Parses documents and pushes them to a vector database after generating embeddings.
48+
49+
- **Response Generation Agent**
50+
Retrieves relevant data and composes human-like, informative replies.
51+
52+
## Slack Integration
53+
54+
The chatbot is tightly integrated with Slack for enterprise accessibility:
55+
56+
- Users interact via DM or threads
57+
- Replies include embedded links to Source documents
58+
- Backend uses Slack Bolt SDK with FastAPI
59+
- Events are securely handled with workspace-level tokens
60+
61+
## Key Features
62+
63+
- **Semantic Search**
64+
Leverages vector embeddings to match intent with content, even for vague queries
65+
66+
- **Model Flexibility**
67+
Easily swap between OpenAI, Hugging Face, or locally hosted models via Ollama
68+
69+
- **Microservice Architecture**
70+
Modular design allows for scaling and independent agent upgrades
71+
72+
- **Multilingual Support**
73+
Via Hugging Face embeddings and tokenizers
74+
75+
- **Secure Document Handling**
76+
Respects access controls and data privacy protocols
77+
78+
## Impact
79+
80+
- **Significantly reduces time** spent navigating documentation manually
81+
- **Improves onboarding** experience for new Red Hatters
82+
- **Promotes self-service** culture and reduces dependency on internal channels
83+
- **Lays foundation** for enterprise-grade knowledge retrieval systems
84+
85+
## Future Scope
86+
87+
- **EagleView API Integration**
88+
Post-authentication, the chatbot can dynamically fetch the complete Source portal data and continuously update its knowledge base
89+
90+
- **Scalable to Entire Source Ecosystem**
91+
Once EagleView API access is enabled, the chatbot will be able to answer **all** questions across teams and departments
92+
93+
- **Credential-Aware Access Control**
94+
Role-based response customization based on user credentials
95+
96+
- **Intelligent Logging & Feedback Loop**
97+
Enable query analytics to improve answers through fine-tuning
98+
99+
- **Horizontally Scalable Architecture**
100+
Multi-agent system allows parallel processing, independent agent upgrades, and multi-tenant support
101+
102+
## Installation
103+
104+
```bash
105+
# Clone the repository
106+
git clone https://github.com/your-org/agentic-chatbot.git
107+
108+
# Install dependencies
109+
pip install -r requirements.txt
110+
111+
# Set up environment variables
112+
cp sample.env .env
113+
# Edit .env with your configurations
114+
```
115+
116+
## Quick Start
117+
118+
### Running the Slack Bot
119+
```bash
120+
python services/slack_service.py
121+
```
122+
123+
## Contributing
124+
125+
1. Fork the repository
126+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
127+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
128+
4. Push to the branch (`git push origin feature/AmazingFeature`)
129+
5. Open a Pull Request
130+
131+
## License
132+
133+
Distributed under the MIT License. See `LICENSE` for more information.

app/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
client = WebClient(token=slack_token)
1515
verifier = SignatureVerifier(signing_secret)
1616

17+
1718
@app.route("/slack/commands", methods=["POST"])
1819
def slack_commands():
1920
data = request.form
@@ -25,6 +26,7 @@ def slack_commands():
2526
})
2627
return "Unknown command", 200
2728

29+
2830
@app.route("/slack/prompt", methods=["POST"])
2931
def slack_prompt():
3032
data = request.form
@@ -42,5 +44,6 @@ def slack_prompt():
4244
"text": f"<@{user_id}> {response}"
4345
})
4446

47+
4548
if __name__ == "__main__":
4649
app.run(debug=True,port=3000)

services/slack_service.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,45 @@
1818
client = WebClient(token=slack_token)
1919
verifier = SignatureVerifier(signing_secret)
2020

21+
2122
def get_rag_response(query: str) -> str:
2223
"""
2324
Query the agent service and get response
2425
"""
2526
import requests
2627
import json
27-
28+
2829
# Configure the endpoint URL - adjust host/port as needed
2930
agent_service_url = f"{os.getenv("AGENT_SERVICE_URL")}/query"
30-
31+
3132
try:
3233
# Make POST request to the agent service
3334
response = requests.post(
3435
agent_service_url,
3536
json={"query": query},
3637
headers={"Content-Type": "application/json"}
3738
)
38-
39+
3940
# Check if request was successful
4041
response.raise_for_status()
41-
42+
4243
# Parse JSON response
4344
result = response.json()
44-
45+
4546
# Return the response text
4647
return result.get("response", "No response received from agent")
47-
48+
4849
except requests.exceptions.RequestException as e:
4950
# Handle connection errors
5051
print(f"Error querying agent service: {e}")
5152
return f"Sorry, I couldn't reach the knowledge base. Error: {str(e)}"
52-
53+
5354
except json.JSONDecodeError:
5455
# Handle invalid JSON response
5556
print(f"Invalid response from agent service: {response.text}")
5657
return "Sorry, I received an invalid response from the knowledge base."
5758

59+
5860
@app.route("/slack/commands", methods=["POST"])
5961
def slack_commands():
6062
data = request.form
@@ -66,6 +68,7 @@ def slack_commands():
6668
})
6769
return "Unknown command", 200
6870

71+
6972
@app.route("/slack/prompt", methods=["POST"])
7073
def slack_prompt():
7174
data = request.form
@@ -83,5 +86,6 @@ def slack_prompt():
8386
"text": f"<@{user_id}> {response}"
8487
})
8588

89+
8690
if __name__ == "__main__":
8791
app.run(debug=True,port=3000)

0 commit comments

Comments
 (0)