AI Summary System
Last Updated: 2026-05-27
The AI Summary system generates concise Dutch-language summaries for knowledge items, powering the digest pipeline.
Architecture
The system is intentionally simple — a single prompt, a single provider interface, and lazy generation.
How It Works
Lazy Generation
AI summaries are generated only when needed — during digest creation. If a knowledge item already has a highlight, the AI call is skipped entirely.
The Prompt
A single hardcoded constant in DigestConstants::HIGHLIGHT_SUMMARY_PROMPT:
Summarize the following content in 2-3 sentences (in Dutch).
If it's a link or short title, infer its context from the extracted text:
Title/Input: %s
URL: %s
Content:
%sThree variables are injected via sprintf: title, URL, and content.
AI Configuration
| Parameter | Value |
|---|---|
| Temperature | 0.3 (factual, consistent) |
| Max Tokens | 150 (2-3 sentences) |
| Language | Dutch (implicit in prompt) |
| Fallback | Truncate content to 200 characters on failure |
Provider Architecture
The AiProviderInterface abstracts AI provider communication:
interface AiProviderInterface {
public function generateCompletion(string $prompt, AiOptionsDto $options): AiResponseDto;
}OpenAIService implements this with dual support:
- OpenAI — Default when
OPENAI_API_URLpoints toapi.openai.com - OpenRouter — Auto-detected when URL contains
openrouter.ai
Switching providers requires only changing environment variables.
Storage
AI summaries are stored in two locations:
Knowledge.highlight— The primary TEXT field. The 2-3 sentence Dutch summary persisted on the knowledge entity.Digest.knowledgeHighlights— A JSON snapshot captured at digest generation time. Each entry includes{id, title, highlight, aiSummary, notionUrl, tags, createdAt}. This makes digests immutable — even if source knowledge changes later.