How antxnyxsajan/ai-powered-information-security-policy-advisor works
This repository implements an AI Security Advisor: employees ask policy questions in a React chat, the FastAPI service refines the query, searches company policies first and standards as a fallback, then returns a grounded answer. Separate scripts prepare and index the two document collections and maintain Pinecone metadata; another script evaluates RAG answers against a question set. The main chat flow is visible in excerpts, but some backend setup and internal calls were omitted, so uncertain relationships are not asserted.
Main entry points: main.py Chat API · indextext_company.py Company indexing · indextext_standards.py Standards indexing · App.jsx Chat interface
Components 18
Chat experience
- Chat interface
frontend/chatbot-frontend/src/App.jsx - App mount
frontend/chatbot-frontend/src/main.jsx
Answer service
- Chat API
backend/main.py - Query refinement
backend/main.py - Company retrieval
backend/main.py - Standards fallback
backend/main.py - Answer generation
backend/main.py - Request metrics
backend/main.py
Knowledge management
- Company indexing
backend/indextext_company.py - Standards indexing
backend/indextext_standards.py - Company policies
documents/Company - External standards
documents/standards - Pinecone index
Maintenance and evaluation
- Policy separation
backend/process_company_policies.py - Metadata updater
backend/update_metadata.py - RAG evaluation
backend/measure_metrics.py
Other components
- Employee
- Cohere services
Connections 20
- Employee → Chat interface: asks question
frontend/chatbot-frontend/src/App.jsx - App mount → Chat interface: renders
frontend/chatbot-frontend/src/main.jsx - Chat interface → Chat API: posts question
frontend/chatbot-frontend/src/App.jsx - Chat API → Query refinement: refines query
backend/main.py - Chat API → Company retrieval: searches first
backend/main.py - Chat API → Standards fallback: falls back
backend/main.py - Chat API → Answer generation: generates answer
backend/main.py - Chat API → Request metrics: records metrics
backend/main.py - Company retrieval → Pinecone index: searches namespace
backend/main.py - Standards fallback → Pinecone index: searches namespace
backend/main.py - Answer generation → Cohere services: invokes model
backend/main.py - Company indexing → Company policies: loads files
backend/indextext_company.py - Standards indexing → External standards: loads files
backend/indextext_standards.py - Company indexing → Cohere services: embeds text
backend/indextext_company.py - Standards indexing → Cohere services: embeds text
backend/indextext_standards.py - Company indexing → Pinecone index: indexes chunks
backend/indextext_company.py - Standards indexing → Pinecone index: indexes chunks
backend/indextext_standards.py - Metadata updater → Pinecone index: updates metadata
backend/update_metadata.py - RAG evaluation → Pinecone index: retrieves context
backend/measure_metrics.py - RAG evaluation → Cohere services: compares answers
backend/measure_metrics.py