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 | requests to the model stay in the stack (web search see Privacy) | 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¶
The AI Assistant opens either as a bubble bottom-right or as a sidebar — switchable via a button in the window header; the choice (and the sidebar width) is remembered per browser. It does not appear on kiosk/TV views or public pages.
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 (default 90 days; any number of days, quick picks 7 days to 1 year, or unlimited = 0). A conversation is deleted once it has had no new message for that long; pinned ones are always exempt. Delete all histories removes the conversations of every person on the instance.
- Admin → System → AI → Concurrent AI requests per person (Advanced settings): upper limit for AI requests running at the same time per person (default 3; 0 = unlimited, at most 50). When it is reached, the chat shows “Es laufen bereits N KI-Anfragen …” (the server text is German); requests already running continue. The setting is saved immediately.
Knowledge-source toggles¶
Three switches below the input field, all on by default:
| Toggle | Meaning |
|---|---|
| 📖 Wiki | RAG + FTS from your own wiki — only while the preview feature "Wiki" is enabled; otherwise the toggle is gone and the AI does not search there |
| 🌐 Internet | web search as a fallback (only with fewer than two wiki hits) |
| 🧠 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 says so plainly 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, the host detail page and in the check detail there's a button per check for the AI Analysis. It opens as a slide-in panel.
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:
- check name and type, hostname and host address
- status, status message, status duration, last value, attempt x of y
- the last 10 check results and the last 5 state changes
- agent/collector connection status (version, operating system, last seen)
- interval, 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 the temperature raised by 0.3 (at most 1.0) — useful when the first answer didn't help. Models that don't accept a temperature still answer anew, just without this effect.
After the analysis¶
- Ask opens a chat about the analysis ("Ask about this analysis") that knows the diagnosis as context (it runs through the chat, so it needs
ai.query). - Similar Wiki Articles lists the articles that were used as context.
- Save as Wiki Article turns the diagnosis into a new wiki article, linked to the check type.
The two wiki items only appear while the preview feature "Wiki" is enabled; saving additionally needs wiki.create.
Privacy¶
What goes to the LLM?¶
| Feature | To the AI provider | To the web search (DuckDuckGo) |
|---|---|---|
| Chat, wiki and internet off | your question + previous history (up to 10 messages) | nothing |
| Chat, wiki on | + retrieved wiki articles | – |
| Chat, internet on | + web snippets | your question — only when the wiki returns fewer than two hits |
| Analysis | check context (hostname and address not masked) + wiki + web snippets if any | check name, check type and status message — with fewer than two wiki hits; cannot be turned off for the analysis |
What leaves the server
With provider Anthropic or External, the request context goes to the configured API — hostnames are not masked in the process. With Ollama, requests to the model stay in your own stack. The web search, however, runs regardless of the provider: even with Ollama, chat questions (Internet switch on) and, for the analysis, check name, type and status message go to DuckDuckGo as soon as the wiki returns too little. If you don't want that, turn Internet off in the chat — the analysis has no switch, so the only option there is not to use it.
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{Preference: AI hidden?}
U -->|on| H3[Hidden]
U -->|off| Y[Visible]
Each person can hide the chat and the analysis buttons for themselves under Settings → Preferences → AI Features with Show AI Assistant and AI Analysis — regardless of whether the instance and role allow them.
Permissions¶
| Permission | Effect |
|---|---|
ai.query |
open the chat, ask questions |
ai.analyze |
start a service analysis |
admin.system |
configure provider and model (admin) |
wiki.create |
save an analysis as a wiki article |
Next¶
- AI provider setup — setup
- Wiki — RAG source — the better it's maintained, the better the answers