Enterprise Knowledge Base Copilot powered by Retrieval-Augmented Generation (RAG)
KnowledgeHub-AI is an internal AI assistant designed to help employees ask questions about company knowledge and receive grounded answers based on trusted internal documents.
The long-term goal is to connect enterprise knowledge sources such as Google Drive, Notion, Confluence, and other internal systems while respecting user access permissions.
🚧 Work in Progress --- MVP under development
The current project is being built from the core RAG pipeline upward. The initial MVP focuses on document ingestion, chunking, embeddings, vector search, retrieval, and grounded answer generation through an API.
Company information is often distributed across:
- PDFs
- Text documents
- Internal policies
- Google Drive
- Notion
- Confluence
- Other knowledge repositories
Employees spend time searching through these sources manually.
KnowledgeHub-AI aims to provide a single interface where an employee can ask:
"What is our annual leave policy?"
and receive an answer based on the company's internal knowledge, along with the relevant source information.
Enterprise Knowledge Sources
│
┌────────────┼────────────┐
↓ ↓ ↓
Google Notion Confluence
Drive
│ │ │
└────────────┼────────────┘
↓
Ingestion Pipeline
↓
Document Processing
↓
Text Chunking
↓
Embeddings
↓
Vector Database
│
│
User Question ─────────────┘
↓
Retrieval
↓
Relevant Chunks
↓
Prompt Construction
↓
LLM
↓
Grounded Answer
↓
Answer + Sources
enterprise-copilot/
│
├── app/
│ ├── agents/
│ │
│ ├── api/
│ │ ├── dependencies.py
│ │ ├── exceptions.py
│ │ ├── routes.py
│ │ └── schemas.py
│ │
│ ├── core/
│ │ ├── exception_handler.py
│ │ ├── middleware.py
│ │ ├── security.py
│ │ └── settings.py
│ │
│ ├── database/
│ │ ├── database.py
│ │ ├── models.py
│ │ └── session.py
│ │
│ ├── embeddings/
│ │ └── embedder.py
│ │
│ ├── llm/
│ │ ├── base.py
│ │ ├── factory.py
│ │ ├── groq_client.py
│ │ ├── ollama_client.py
│ │ └── openai_client.py
│ │
│ ├── pipeline/
│ │ └── rag_pipeline.py
│ │
│ ├── storage/
│ │ ├── document_manager.py
│ │ └── vectordb.py
│ │
│ ├── utils/
│ │ ├── chunk_config.py
│ │ └── helpers.py
│ │
│ ├── generator.py
│ ├── knowledge_base.py
│ ├── models.py
│ ├── processing.py
│ └── retriever.py
│
├── data/
├── docs/
├── logs/
├── tests/
│
├── .env
├── .gitignore
├── main.py
├── README.md
└── requirements.txt
Responsible for converting raw documents into clean, manageable chunks.
Document
↓
Text Extraction
↓
Cleaning
↓
Chunking
↓
Chunks
Converts text chunks and user questions into numerical vector representations.
Text
↓
Embedding Model
↓
Vector
Stores document chunk embeddings and their metadata so relevant information can be retrieved efficiently.
Takes a user's question, searches the vector database, and returns the most relevant chunks.
Provides the retrieved context to an LLM and generates a grounded answer.
Coordinates the complete question-answering flow:
Question
↓
Embed
↓
Retrieve
↓
Build Context
↓
Generate
↓
Answer + Sources
The project uses an LLM abstraction so that the application is not tightly coupled to a single provider.
Currently planned/supported providers include:
- Groq
- OpenAI
- Ollama
The provider can be selected through configuration.
The basic RAG MVP will be extended with enterprise-specific capabilities.
Users will be able to:
- Register
- Login
- Receive JWT access tokens
- Access protected APIs
Different users will have different permissions.
Example:
Admin
├── Upload documents
├── Delete documents
└── Manage users
Employee
└── Query permitted knowledge
A key goal of the project is preventing users from retrieving information they are not authorized to access.
Document metadata will eventually contain access information such as:
department
role
visibility
owner
Retrieval will use this metadata when determining which chunks can be returned.
Planned connectors include:
- Google Drive
- Notion
- Confluence
- SharePoint
The system will eventually identify questions that cannot be answered confidently from the existing knowledge base.
This can help organizations discover:
- Missing documentation
- Outdated policies
- Frequently asked questions without clear answers
Documents will be tracked for freshness so that outdated internal knowledge can be identified.
The first working MVP should support this flow:
Upload Document
↓
Extract Text
↓
Clean + Chunk
↓
Generate Embeddings
↓
Store in Vector DB
↓
Ask Question
↓
Retrieve Relevant Chunks
↓
Generate Grounded Answer
↓
Return Answer + Sources
Example:
User:
"What is the company's annual leave policy?"
System:
1. Converts the question to an embedding
2. Searches the vector database
3. Retrieves relevant policy chunks
4. Sends the context to the LLM
5. Generates the answer
6. Returns the relevant source information
- Python
- FastAPI
- Retrieval-Augmented Generation
- Embedding models
- ChromaDB / vector database
- LLM provider abstraction
- PostgreSQL for application/enterprise metadata
- Vector database for semantic retrieval
- JWT
- Password hashing
- Git
- GitHub
- Pytest
This project is intentionally being built incrementally rather than treating it as a collection of generated code.
Each major component follows:
Design
↓
Implement
↓
Test
↓
Review
↓
Integrate
The goal is not only to build a working RAG application, but also to understand the engineering decisions behind each component.
- Project structure
- Document processing
- Chunking
- Embedding generation
- Vector storage
- Retrieval
- LLM generation
- End-to-end RAG pipeline
- Source citations
- Document upload API
- Chat API
- Document management
- Error handling
- API testing
- User registration
- Login
- JWT authentication
- Role-based authorization
- Access-control-aware retrieval
- Google Drive connector
- Notion connector
- Confluence connector
- Document synchronization
- Staleness detection
- Evaluation framework
- Retrieval quality evaluation
- Observability
- Audit logging
- Knowledge gap detection
- Deployment
- Performance optimization
Create a virtual environment:
python -m venv .venvActivate it on Windows:
.venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtCreate a .env file and provide the required configuration.
Start the FastAPI application:
uvicorn app.main:app --reloadThe API documentation will be available through FastAPI's Swagger UI.
Secrets and environment-specific configuration should be stored in
.env and never committed to Git.
Example categories:
DATABASE_URL
LLM_PROVIDER
LLM_MODEL
OPENAI_API_KEY
GROQ_API_KEY
Use the actual variables required by the current implementation.
Development is organized around small, meaningful commits.
Example:
git add .
git commit -m "feat: implement document chunking"
git pushAvoid committing:
.env- virtual environments
- generated logs
- cache files
- local databases
- secrets
KnowledgeHub-AI is intended to evolve from a basic RAG application into an enterprise knowledge platform capable of:
Multiple Sources
+
Access Control
+
Reliable Retrieval
+
Grounded Generation
+
Freshness Detection
+
Knowledge Gap Detection
↓
Enterprise Knowledge Copilot
Status: 🚧 MVP in development
Repository: KnowledgeHub-AI