Automatically guide students through personalized learning sessions using AI-powered intent classification, book-based knowledge retrieval (RAG), and full session logging — all without writing a single line of code.
Nathan is an intelligent AI tutor chatbot that detects what the student is trying to do — greeting, asking a question, answering, introducing a topic, or going off-topic — and responds accordingly using the right teaching strategy every time.
Key features:
Step 1 — User sends a message
The public chat trigger receives the student's input and simultaneously fires two paths: one to the Intent Classifier and one to the Merge node for later combining.
Step 2 — DeepSeek classifies intent
The Intent Classifier agent (powered by DeepSeek LLM + sliding-window memory) reads the message and outputs exactly one word:
greeting / topic / answer / question / random
Step 3 — Fetch matching system prompt
The classified intent is used to look up the correct system prompt from the pmt tab in Google Sheets (filtered by the Output column). Each intent maps to a unique pedagogical strategy.
Step 4 — Merge and aggregate
The fetched prompt and original user input are merged and aggregated into a single payload, ready to be passed to the AI teacher.
Step 5 — AI Teacher Agent generates response (RAG)
GPT-4o-mini receives the system prompt, full session memory (last 10 turns), and uses the Pinecone book vector store as a retrieval tool (topK=3). It generates a pedagogically appropriate, book-grounded response.
Step 6 — Log and return
The session ID, user message, and AI response are appended to the Preservation tab in Google Sheets. The final response is formatted and returned to the student in the chat interface.
Services you'll need:
Estimated setup time: 20–30 minutes
1. Add credentials in n8n
Go to Settings → Credentials and add:
DeepSeek API key → connect to the DeepSeek LLM nodeOpenAI API key → connect to both GPT-4o-mini LLM and OpenAI Embeddings nodesGoogle Sheets OAuth2 → connect to Fetch System Prompt and Log Q&A to Sheets nodesPinecone API key → connect to the Book Knowledge Base node2. Set up your Google Sheet
Create a new Google Sheet with two tabs:
Tab 1 — pmt (prompt library):
| Output | Prompt |
|---|---|
| greeting | You are Nathan, a friendly tutor… |
| topic | The student wants to learn about… |
| answer | The student has just answered… |
| question | The student is asking a question… |
| random | Gently redirect the conversation… |
Tab 2 — Preservation (Q&A log):
| Session | User Msg | AI Response |
|---|---|---|
| (auto-filled) | (auto-filled) | (auto-filled) |
3. Replace placeholder Sheet IDs
In the workflow, find all nodes that contain YOUR_GOOGLE_SHEET_ID and replace with your actual Google Sheets document ID (found in the URL: docs.google.com/spreadsheets/d/YOUR_ID_HERE).
Also replace YOUR_PRESERVATION_SHEET_GID with the gid value of your Preservation tab.
4. Set up Pinecone vector store
rag-vector-db-book-quiz (or rename the node to match your own index)topK=3 chunks per query5. Activate and test
Enable the workflow, open the public chat URL, and send a test message like:
"Hi, I want to learn about Newton's laws"
You should see:
topicSwap the classifier model
Replace DeepSeek with any chat LLM (GPT-4o-mini, Gemini, Claude) in the Intent Classifier node — the prompt is model-agnostic.
Add new intent categories
Add a new row to the pmt tab with your intent keyword and system prompt. Then extend the classifier's system message to recognize the new category.
Adjust retrieval depth
Change topK in the Pinecone node from 3 to 5 or 10 to retrieve more book chunks per query — useful for complex or detailed topics.
Change memory length
The Classifier Memory and Teacher Session Memory both use a context window of 10 turns. Lower this for faster responses, increase it for longer multi-turn sessions.
Embed multiple books
Upload chapters from different books into the same Pinecone index. The agent automatically retrieves the most relevant chunks regardless of source.
Intent classifier returns unexpected output
Make sure the DeepSeek system prompt ends with the exact instruction: "Respond with only one word from this list." Any extra text in the response will break the Google Sheets lookup.
Google Sheets lookup returns no results
Verify that the Output column in the pmt tab contains lowercase values matching exactly what DeepSeek outputs (e.g., greeting not Greeting).
Pinecone returns empty results
Confirm your index name matches the one in the node, your documents are embedded using the same OpenAI Embeddings model, and the index is not empty.
Session memory not persisting across turns
The session key is pulled from $('Chat Trigger').item.json.sessionId. Ensure you are using the same browser session (do not open in incognito) and the chat trigger is set to public mode.
Preservation sheet not updating
Check that the Preservation tab GID is correct and that your Google Sheets OAuth credentials have edit access to the document.
Need help setting this up or want a custom version for your school or platform?
📧 Email: [email protected]
🌐 Website: https://isawow.com/