⚗️ 32dots Learn ist ein experimenteller Prototyp — Inhalte und Funktionen ändern sich kurzfristig.
Karte 03 · Kapitel getting-started

AI that reads your documents

n8n easy 90 min
🟢 USE — Run first
0 - 15 min

Ask a document any question — get a grounded answer

You will import a pre-built n8n workflow that fetches a public webpage and answers questions about it. No embeddings, no vector database — just an HTTP request and a smart system prompt.

  1. Go to Downloads (curriculum.32dots.de/share) and download 'Session 3 — AI that reads your documents'.
  2. In n8n: click the ⋯ menu → Import from file. Select the downloaded JSON.
  3. The workflow opens. Click 'Chat' (bottom right) to open the chat panel.
  4. Ask: 'What is a transformer architecture?'
  5. Ask: 'What is the difference between a language model and an embedding model?'
  6. Ask: 'Who invented the Higgs boson?' (Not in the document — notice what happens.)
  7. Open the Document URL node and change the URL to any Wikipedia page about your research topic.
Done-Signal: You got grounded answers for the first two questions and a correct refusal (or honest 'not in document') for the third.
🔵 UNDERSTAND — Look inside
15 - 60 min

How document QA works in n8n

This is a simplified RAG pattern — no embeddings, no vector store. The entire document is fetched live and passed directly into the AI's context window.

💬 When chat message received
Chat Trigger
Opens a chat interface. Each message gets a sessionId so the AI remembers the conversation.
🔗 Document URL
Set node
Stores the URL of the document to read. Edit this node to point to any public webpage or Wikipedia article.
🌐 Fetch Document
HTTP Request
Downloads the page as plain text. The response is truncated to ~12,000 characters to fit in the model's context window.
📋 Prepare Context
Set node
Combines the document text and the user's question into two separate fields passed to the AI Agent.
🧠 AI Agent
LLM with system prompt
System prompt injects the document and instructs the model to answer ONLY from it, always quoting the relevant passage.
🧵 Simple Memory
Session memory
Remembers the last 8 messages per session. Session key is set correctly to $('When chat message received').first().json.sessionId — required when intermediate nodes exist between the trigger and the agent.
This pattern — fetch a document, stuff it into context, answer from it — works for any public URL. The limitation is the context window (~12,000 chars here). For longer documents you need chunking and retrieval (RAG). Session 14 covers that.

Probe-Fragen

  • What happens when you ask about something not in the document? Is the refusal consistent?
  • Open the Prepare Context node. Where does $('When chat message received').first().json.chatInput appear — and why not just $json.chatInput?
  • What would break if you removed the Simple Memory node?
🟠 BUILD — Make it yours
60 - 90 min

Point the workflow at your own document

Adapt this workflow to answer questions about a document relevant to your research.

Aufgabe: Change the Document URL to a Wikipedia article, a PubMed abstract, or any public page in your field. Verify the AI answers correctly and refuses questions outside the document.

  1. Open the Document URL node. Paste a URL for a page relevant to your research.
  2. Open the chat. Ask three questions: one clearly answered by the page, one at the edge, one definitely outside.
  3. In the Prepare Context node, change substring(0, 12000) to a larger or smaller value. Test how this affects response quality.
  4. Change the system prompt in the AI Agent to add a citation format: 'Always end your answer with: Source: [section name]'.
  5. Try two different types of documents (e.g. a Wikipedia article and a PubMed abstract). Which one answers better and why?
Deliverable: Share a screenshot of three test questions (one inside, one edge, one outside) with a one-sentence explanation of why the edge case worked or failed.
✓ SELF-CHECK

Hast du das verstanden?

  • I can explain why the session key uses $('When chat message received').first().json.sessionId instead of $json.sessionId.
  • I understand the context window limit and why long documents need a different approach.
  • I adapted the workflow to my own document and tested the refusal behaviour.
This workflow always reads the full page on every question. What are the tradeoffs compared to chunking the document once and storing it in a vector database?
💬 KI-TUTOR

Frag den Tutor zu dieser Karte

Sokratisch: der Tutor antwortet mit Leitfragen statt fertigen Antworten — du erarbeitest die Lösung selbst.

Stell eine erste Frage zu dieser Karte unten.