How kalvaharshith/org-brain works
Organizational Brain is a FastAPI knowledge service for indexing organizational documents and answering questions from them. The main workflow is document upload, parsing and chunking, local embedding, and persistence; chat uses hybrid vector/keyword retrieval, builds cited context, and asks Groq to generate an answer. Project, knowledge-search, and feedback endpoints expose supporting capabilities. The sampled code supports ingestion and retrieval details; chat and feedback route internals are not included, so those connections are limited to the apparent API entry points.
Main entry points: main.py FastAPI app · rag.py RAG orchestration · database.py Database session · ingestion.py Document ingestion
Components 14
API surface
- FastAPI app
backend/app/main.py - Documents API
backend/app/api/documents.py - Chat API
backend/app/api/chat.py - Knowledge API
backend/app/api/knowledge.py - Projects API
backend/app/api/projects.py - Feedback API
backend/app/api/feedback.py
Knowledge indexing
- Document ingestion
backend/app/services/ingestion.py - Embeddings
backend/app/services/embeddings.py
Question answering
- RAG orchestration
backend/app/services/rag.py - LLM client
backend/app/services/llm.py
Persistence
- Domain models
backend/app/models.py - Database session
backend/app/database.py
Other components
- API client
- Groq API
Connections 21
- API client → FastAPI app: sends requests
- FastAPI app → Documents API: dispatches
- FastAPI app → Chat API: dispatches
- FastAPI app → Knowledge API: dispatches
- FastAPI app → Projects API: dispatches
- FastAPI app → Feedback API: dispatches
- Documents API → Document ingestion: uploads for indexing
- Document ingestion → Embeddings: embeds chunks
- Document ingestion → Database session: persists records
- Document ingestion → Domain models: creates records
- Chat API → RAG orchestration: requests answers
- Knowledge API → RAG orchestration: requests search
- RAG orchestration → Embeddings: embeds query
- RAG orchestration → Database session: retrieves and stores
- RAG orchestration → Domain models: reads and writes
- RAG orchestration → LLM client: requests generation
- LLM client → Groq API: calls
- Documents API → Database session: reads records
- Knowledge API → Database session: reads records
- Projects API → Database session: reads records
- Feedback API → Database session: accesses records