π€ AI Chat Assistant Feature
Overviewβ
Vartovii includes an integrated AI Chat Assistant powered by Google Vertex AI (Gemini 3 Flash preview with Gemini 2.5 fallback).
The assistant is named ΠΠ°ΡΡΠΎΠ²ΠΈΠΉ (Guardian in Ukrainian) and can answer questions about:
- All platform features and tabs
- Trust Score formulas (Company & Crypto)
- Data sources
- How to use the platform
- Real-time market news (via Google Search Grounding)
- Internal documentation (via RAG - 86+ docs indexed)
How to Accessβ
- Click the floating chat button (bottom-right corner) π¬
- Type your question in any language
- Get instant AI-powered answers with beautiful markdown formatting
Capabilitiesβ
What the Assistant Knowsβ
| Topic | Details |
|---|---|
| Platform Navigation | All menu items, tabs, their purpose |
| Topics Tab | Aspect analysis, data from aspect_sentiments |
| Sentiment Tab | Pie charts, AI labels |
| Battle Mode | Company comparison |
| Trust Score | Complete formula breakdown |
| Data Sources | Kununu, Glassdoor, Reddit, etc. |
| Real-time Info | News, stock prices, market trends |
| Documentation | Deployment guides, API docs, troubleshooting |
Languages Supportedβ
- πΊπ¦ Ukrainian
- π¬π§ English
- π©πͺ German
π Google Search Groundingβ
The assistant can search the web to provide real-time information.
Auto-Detectionβ
Grounding is automatically triggered when your question contains:
latest,news,today,current,right nowstock,price,market,trendwhat is,who is,tell me aboutcompare to,competitor
Exampleβ
User: What are the latest news about Tesla?
Assistant: [searches Google, returns current info with sources]
π RAG (Internal Documentation Search)β
The assistant can search 86+ internal markdown documents to provide accurate, context-aware answers.
Auto-Detectionβ
RAG is automatically triggered for questions containing:
how to,how do I,where isdocumentation,docs,guidedeploy,setup,configureAPI,endpoint,errorΡΠΊ,Π΄Π΅ Π·Π½Π°ΠΉΡΠΈ(Ukrainian)
Exampleβ
User: How do I deploy to Cloud Run?
Assistant: [searches docs, cites GCP_MIGRATION_GUIDE.md]
Auto-Indexing (GitHub Action)β
Documents are automatically synced and re-indexed on every push to docs/:
- GitHub Action triggers on push to
docs/** - Syncs docs to GCS bucket
gs://sentry-analytics-docs-rag/docs/ - Re-indexes Vertex AI RAG corpus
- Shows summary in GitHub Actions
Manual indexing:
cd backend
python scripts/index_docs.py # Index from GCS
python scripts/index_docs.py --list # View indexed files
python scripts/index_docs.py --info # Corpus information
API Referenceβ
Endpointsβ
POST /api/ai/chatβ Main chat (with optional grounding/RAG)POST /api/ai/searchβ Web search with AI summaryGET /api/ai/chat/healthβ Health check
Request Parametersβ
| Parameter | Type | Description |
|---|---|---|
message | string | User's question (required) |
history | array | Previous messages for context |
company | string | Optional company context |
language | string | en, ua, or auto |
enable_grounding | bool | Force web search on/off |
enable_rag | bool | Force internal docs search on/off |
Response Fieldsβ
| Field | Type | Description |
|---|---|---|
response | string | AI answer (markdown formatted) |
status | string | ok or error |
grounded | bool | Whether web search was used |
rag_used | bool | Whether internal docs were searched |
sources | array | Citations (type: web or rag) |
Example Requestβ
{
"message": "How do I configure the database?",
"enable_rag": true
}
Example Responseβ
{
"response": "To configure the database...",
"status": "ok",
"grounded": false,
"rag_used": true,
"sources": [{ "type": "rag", "file": "QUICKSTART.md", "score": 0.85 }]
}
Architectureβ
backend/ai/
βββ config.py # Model config (Gemini 3 preview + fallback)
βββ client.py # GeminiClient singleton
βββ prompts/chat.py # System prompt + knowledge base
βββ services/
β βββ chat_service.py # Chat + Grounding + RAG logic
βββ rag/
βββ corpus_manager.py # Vertex AI RAG corpus
βββ retrieval_service.py # Semantic search
backend/api/
βββ chat.py # API endpoints
backend/scripts/
βββ index_docs.py # Document indexing CLI
.github/workflows/
βββ rag-auto-index.yml # Auto-sync & reindex on push
dashboard_app/src/components/
βββ ChatWidget.jsx # Floating UI widget + markdown
UI Featuresβ
Markdown Renderingβ
The chat widget renders AI responses with beautiful formatting:
- Headers β Styled h1, h2, h3
- Tables β Proper borders and highlighting
- Lists β Bullet and numbered lists
- Code β Syntax-highlighted blocks
- Links β Clickable with proper styling
- Bold/Italic β Emphasized text
Floating Widgetβ
- Bottom-right corner button
- Expandable chat panel (glassmorphism design)
- Multi-turn conversation with history
- Loading animation
Configurationβ
Environment Variablesβ
GOOGLE_CLOUD_PROJECT=sentry-analytics-prod
GEMINI_LOCATION=europe-west4
SEARCH_LOCATION=global
GOOGLE_APPLICATION_CREDENTIALS=./sentry-analytics-key.json
Models (current)β
| Task | Model | Notes |
|---|---|---|
| Chat | gemini-3-flash-preview | Fast, primary |
| Reports | gemini-3.1-pro-preview | High quality, primary |
| Fallback | gemini-2.5-* | Automatic safety chain |
| RAG Embeddings | text-embedding-004 | Vertex AI |
Statusβ
- Grounding β Google Search for real-time info β
- RAG Search β 86+ docs indexed β
- Auto-Indexing β GitHub Action on push β
- Markdown UI β Beautiful rendering β
- Source Citations UI β Display in chat widget
- Feedback Collection β Improve responses