AI chat & analysis¶
Vesana has two AI features:
- AI chat — open-ended IT questions, with RAG from the wiki and a web-search fallback
- AI service analysis — automatic diagnosis of a check problem, with rich context
Both use the same context pipeline and the same configured provider.
Provider¶
Three options, see AI provider setup:
| Provider | Privacy | Cost |
|---|---|---|
| Ollama local | data stays in the stack | hardware (several GB of RAM) |
| Anthropic (cloud) | question + context go to the Anthropic API | API tokens |
| External (OpenAI-compatible endpoint) | depends on the provider | depends on the provider |
Embeddings need a separate model
Anthropic has no embedding API. With provider Anthropic, the embedding model still runs via Ollama — both are configured independently in the provider setup.
Search pipeline¶
Chat and service analysis go through the same source steps:
flowchart LR
Q[Request] --> RAG[1. RAG: pgvector]
RAG --> FTS[2. FTS German/English]
FTS --> ILIKE[3. ILIKE fallback]
ILIKE --> WEB[4. Web search, only with few wiki hits]
WEB --> CTX[Context for LLM]
CTX --> LLM[Provider]
LLM --> RESP[Answer + sources]
| Step | What it does |
|---|---|
| RAG | vector cosine similarity against wiki embeddings, top articles |
| FTS | PostgreSQL full text, German first, English added if there are too few hits |
| ILIKE | partial substring search as the last wiki anchor |
| Web | DuckDuckGo HTML search (no API key needed) — runs only when the wiki has produced fewer than two hits by that point |
AI chat¶
Chat widget, either as a bubble bottom-right or as a sidebar (AiChatWidget) — switchable via a button, the choice is remembered per browser.
Use¶
- Type a question, press Enter — the answer streams in.
- History: conversations are stored. Open the history, click an older conversation, keep asking — the wiki/web evidence of the answers is kept. Search also covers the message text; grouping Today / Yesterday / Last 7 days; rename, pin, delete.
- New chat starts a new conversation.
- A conversation belongs to exactly one person: nobody can read other people's histories, not even administrators. The operator view shows numbers only, never content.
- Admin → System → AI → Chat history: recording on/off and retention (any number of days, quick picks 7 days to 1 year, or unlimited = 0). Pinned conversations are always exempt.
Knowledge-source toggles¶
Three switches per chat session:
| Toggle | Meaning |
|---|---|
| 📖 Wiki | RAG + FTS from your own wiki |
| 🌐 Internet | web search as a fallback |
| 🧠 Own knowledge | on by default — lets the model add its own general knowledge on top of the wiki/web context found. Turning it off forces strict source adherence: the model answers only from the retrieved wiki articles and web results, and honestly says so when it finds no source, instead of guessing |
For sensitive discussions without web access: leave only Wiki on, turn Internet off.
Source badges¶
The answer shows which wiki articles and web results were used as context, with title/link — so it's traceable where a statement came from.
Tenant scope¶
The search respects the tenant scope from the JWT: a super admin sees across all tenants, a tenant user only their own tenant. Not client-side manipulable.
AI service analysis¶
On the error overview or host detail page there's an Analyze button per check.
sequenceDiagram
participant U as User
participant API
participant DB
participant RAG
participant LLM
U->>API: POST /api/v1/ai/analyze/{service_id}/stream
API->>DB: status, history, thresholds, agent/collector status
API->>RAG: wiki search for the check
API->>LLM: system prompt + context + RAG
LLM-->>API: streaming answer with sources
API-->>U: slide-in panel
Rich context¶
What the analysis gets as context:
- status, status duration, last value
- check history and state-change history
- agent/collector connection status
- thresholds, ACK/downtime flags
Cache¶
Analyses are cached keyed by the current status — an unchanged status returns the cached answer, no new LLM call. A status change invalidates the cache.
The regenerate button forces a fresh analysis with a slightly higher temperature (up to a max of 1.0) — useful when the first answer didn't help.
Privacy¶
What goes to the LLM?¶
| Feature | What goes out |
|---|---|
| Chat (only own knowledge) | only your question + conversation history |
| Chat (wiki on) | + retrieved wiki-article excerpts |
| Chat (internet on) | + web snippets — your question goes to the web search for this |
| Analysis | check context (hostname not masked) + wiki + optionally web |
Hostname and wiki content leave the server
With provider Anthropic or External, the request context goes to the configured API — hostnames are not masked in the process. With Ollama local, nothing leaves your own stack. If you have privacy concerns, set the provider to Ollama.
What does NOT go to the LLM?¶
- No passwords, tokens, API keys, SNMP communities
- No audit-log entries
- No data from other tenants
- No user list, no SLA reports
The system prompt is versioned code, not user-configurable — no entry point for prompt injection via user input.
Visibility¶
flowchart LR
A[AI visible?]
A --> S{Instance enabled?}
S -->|no| H1[Hidden]
S -->|yes| P{Permission ai.query/ai.analyze?}
P -->|no| H2[Hidden]
P -->|yes| U{User preference hide_ai?}
U -->|on| H3[Hidden]
U -->|off| Y[Visible]
Per user, in Settings → Preferences, the chat widget can be hidden entirely — regardless of whether the instance and role allow it.
Permissions¶
| Permission | Effect |
|---|---|
ai.query |
open the chat, ask questions |
ai.analyze |
start a service analysis |
admin.system |
configure provider and model (admin) |
Next¶
- AI provider setup — setup
- Wiki — RAG source — the better it's maintained, the better the answers