How can I enable context caching in Gemini for both Basic LLM Chain as well as AI Agent node? I have a big input prompt consuming easily around 2-3k input token per prompt. I want to cache that. But I don’t know how to do that in n8n for Gemini…
Any help would be immensely appreciated. Thanks!
My workflow
Information of my n8n setup
n8n version: 1.102.0
Database (default: SQLite): PostgreSQL
n8n EXECUTIONS_PROCESS setting (default: own, main): I don’t know
Running n8n via (Docker, npm, n8n cloud, desktop app): npm
Operating system: Fedora Linux 42 (Workstation Edition)
Memory Buffer: Use the “Chats” node to store the conversation context (like user details, preferences). This helps the AI “remember” past interactions.
Session Key: Make sure each user has a unique ID (like wa_id) to link their conversation across multiple chats, so the AI can remember them.
Update User Info: Each time the user shares new info (like a product or address), store it in memory so the AI doesn’t forget.
AI Agent: The AI uses this memory to keep the conversation flowing and provide relevant answers based on what was said earlier.
This setup makes sure the AI doesn’t start from scratch each time, and it can remember the user and their needs.
No, this would keep the context for sure but I am talking about caching the context. I am already doing what you suggested. My query is that I don’t want to send such a big prompt again and again. I want my prompt to be cached in with Gemini
No, @abhaysalvi is not talking about system message. @abhaysalvi btw welcome to community, and currently, n8n haven’t the caching context (even tho the official docs has), so the answer is “can’t enable it”